Last active
August 29, 2015 14:17
-
-
Save rezoner/c8e0e9be86d74b36b2aa to your computer and use it in GitHub Desktop.
Playground.js + Three.js - draft 3
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
/* | |
I've decided there will be two levels of integration | |
1) You get loaders only. You have to create renderers and scenes manually. | |
2) You get loaders and magically bootstrapped Three.js | |
Below is level 2 integration example which renders a textured cube: | |
*/ | |
var app = playground({ | |
create: function() { | |
this.loadTexture("bricks"); | |
}, | |
ready: function() { | |
this.setState(app.game); | |
} | |
}); | |
app.game = { | |
create: function() { | |
var geometry = new THREE.BoxGeometry(1, 1, 1); | |
var material = new THREE.MeshBasicMaterial({ map: app.textures.bricks }); | |
this.cube = new THREE.Mesh(geometry, material); | |
this.scene.add(this.cube); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment