Scene script code
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
|
||||
|
||||
const platformNames = {
|
||||
[System.PLATFORM_LINUX]: 'Linux',
|
||||
[System.PLATFORM_KNULLI]: 'Knulli',
|
||||
@@ -9,3 +11,12 @@ const platformNames = {
|
||||
Console.print('Platform: ' + (platformNames[System.platform] || 'Unknown'));
|
||||
|
||||
// Scene.set('testscene.js');
|
||||
// Console.print('Loading scene...');
|
||||
// requireAsync('./testscene.js', function(scene) {
|
||||
// throw "test";
|
||||
// Console.print('Initializing scene...');
|
||||
// var batch = scene.load();
|
||||
// batch.lock();
|
||||
// batch.requireLoaded();
|
||||
// scene.init();
|
||||
// });
|
||||
+12
-10
@@ -1,6 +1,8 @@
|
||||
var scene = {};
|
||||
var scene = {
|
||||
'test': 'teststring'
|
||||
};
|
||||
|
||||
scene.batch = AssetBatch([
|
||||
var assets = AssetBatch([
|
||||
{ path: 'test.png', type: Asset.TYPE_TEXTURE, format: Texture.FORMAT_RGBA }
|
||||
]);
|
||||
|
||||
@@ -11,12 +13,13 @@ var testPos;
|
||||
var testRenderable;
|
||||
var texEntry;
|
||||
|
||||
scene.load = function() {
|
||||
return scene.batch;
|
||||
scene.init = function() {
|
||||
assets.lock();
|
||||
assets.onLoaded[0] = scene.loaded;
|
||||
};
|
||||
|
||||
scene.init = function() {
|
||||
texEntry = scene.batch.entry(0);
|
||||
scene.loaded = function() {
|
||||
texEntry = assets.entry(0);
|
||||
|
||||
// Camera at (3, 3, 3) looking at origin
|
||||
cam = Entity.create();
|
||||
@@ -35,14 +38,13 @@ scene.init = function() {
|
||||
[0, 0, 1, 1, 0, 1, 1, 0]
|
||||
];
|
||||
testPos.localPosition = new Vec3(0, 0, 0);
|
||||
};
|
||||
}
|
||||
|
||||
scene.dispose = function() {
|
||||
Console.print('Scene Dispose');
|
||||
Entity.dispose(cam);
|
||||
Entity.dispose(testEntity);
|
||||
|
||||
texEntry.unlock();
|
||||
scene.batch.unlock();
|
||||
assets.unlock();
|
||||
};
|
||||
|
||||
module.exports = scene;
|
||||
|
||||
Reference in New Issue
Block a user