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
playground({ | |
create: function() { | |
app.loadData(...); | |
}, | |
ready: function() { |
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
var app = new PLAYGROUND.Application({ | |
preload: function() { | |
/* this is called before create and lets you silently load some assets */ | |
this.loadData("objects/buildings", "objects/subObjects", "objects/townBuildingList"); | |
}, |
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
/* This will make you a screenshot for later usage whenever you want */ | |
ENGINE.Game = { | |
showOptionsScreen: function() { | |
app.screenshot = this.app.layer.cache(); | |
app.setState(ENGINE.Options); | |
} |
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
/* | |
Here is a simple plugin that creates scanlines image | |
and draws it after everything has been rendered | |
I am still not sure what will be the standard for configuration. | |
*/ | |
PLAYGROUND.Scanlines = function(app) { |
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
PLAYGROUND.Layer = { | |
plugin: true, | |
app: { | |
create: function(app, data) { | |
app.layer = cq().appendTo(app.container); |
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: | |
*/ |
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
/* | |
ThreeJS bootstrap plugin | |
Sets up three.js render for an application | |
Sets up separate camera and scene for each state | |
*/ | |
playground.plugins.three = { |
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
var app = playground({ | |
use: { | |
"three": { | |
renderer: "webgl" | |
}, | |
}, |
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
var app = playground({ | |
create: function() { | |
this.renderer = new THREE.WebGLRenderer(); | |
document.body.appendChild(app.renderer.domElement); | |
}, |
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
/* | |
A full list of simple easing equations inspired by GIST from greweb - https://gist.github.com/gre/1650294 | |
Equations source - http://gsgd.co.uk/sandbox/jquery/easing/ | |
*/ | |
{ | |
linear: function(t) { | |
return t | |
}, | |
inQuad: function(t) { |