This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import R from 'ramda'; | |
import * as Perf from '../cpcs/performance'; | |
import fast from '../../node_modules/fast.js/index'; | |
/** | |
* @return {string} | |
*/ | |
function newId(){ | |
let d = new Date().getTime(); | |
let uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import R from 'ramda'; | |
import * as Debug from './debug'; | |
export function create(){ | |
const events = { | |
componentCreations: [], | |
componentChanges: [], | |
componentDeletions: [] | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import R from 'ramda'; | |
function newId(){ | |
let d = new Date().getTime(); | |
let uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { | |
const r = (d + Math.random()*16)%16 | 0; | |
d = Math.floor(d/16); | |
return (c=='x' ? r : (r&0x3|0x8)).toString(16); | |
}); | |
return uuid; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import R from 'ramda'; | |
function newId(){ | |
let d = new Date().getTime(); | |
let uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { | |
const r = (d + Math.random()*16)%16 | 0; | |
d = Math.floor(d/16); | |
return (c=='x' ? r : (r&0x3|0x8)).toString(16); | |
}); | |
return uuid; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// save camera views | |
const savedCamera = JSON.parse( localStorage.getItem( 'savedCamera' ) ); | |
if( savedCamera ){ | |
camera.position.copy( savedCamera.cameraPosition ); | |
orbitControls.target.copy( savedCamera.targetPosition ); | |
} | |
$(window).unload( function(){ | |
localStorage.savedCamera = JSON.stringify({ | |
cameraPosition: camera.position, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fixGroupToShapes( g ){ | |
var bb = g.getBoundingClientRect(); | |
var cx = bb.width * 0.5 + bb.left; | |
var cy = bb.height * 0.5 + bb.top; | |
g.center(); | |
g.translation.x = cx; | |
g.translation.y = cy; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Goes after | |
Polygon.MakeObservable(Polygon.prototype); | |
//... | |
*/ | |
var Text = Two.Text = function( text ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function traverseGroup( group, fn ){ | |
for( var i in group.children ){ | |
var child = group.children[ i ]; | |
fn( child ); | |
traverseGroup( child, fn ); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Phaser.Plugin.Isometric.Projector.prototype.unproject = function (point, out) { | |
if (typeof out === "undefined") { | |
out = new Phaser.Plugin.Isometric.Point3(); | |
} | |
var px = point.x; | |
var py = point.y; | |
px *= this.projectionRatio; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ForceGPULoad = (function(){ | |
var renderer; | |
var scene; | |
var camera; | |
return { | |
buffer: function( object3D ){ | |
// push | |
var originalPosition = object3D.position.clone(); | |
object3D.position.set( 0,0,0 ); |