From e7144a513caea16cf9fd73517543826c39589e06 Mon Sep 17 00:00:00 2001 From: "Theunis J. Botha" Date: Tue, 15 Nov 2016 17:12:27 +0100 Subject: [PATCH] have to start with refactoring meshes, shapes, scenes and worlds --- src/game-lib-scene.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/game-lib-scene.js b/src/game-lib-scene.js index bf1938b..c769388 100644 --- a/src/game-lib-scene.js +++ b/src/game-lib-scene.js @@ -34,7 +34,8 @@ GameLib.D3.Scene = function( entities, progressCallback, uploadUrl, - components + components, + shapes ) { this.id = id; this.sceneId = GameLib.D3.Tools.RandomId(); @@ -105,6 +106,11 @@ GameLib.D3.Scene = function( } this.components = components; + if (typeof shapes == 'undefined') { + shapes = []; + } + this.components = shapes; + // assoc array this.meshIdToMesh = {}; @@ -710,10 +716,24 @@ GameLib.D3.Scene.LoadScene = function( meshes: instanceMeshes } ); + }); }; +GameLib.D3.Scene.prototype.intitializeComponents = function() { + for (var c = 0; c < this.components.length; c++) { + + var component = this.components[c]; + + this.scene3d.registerComponent(component); + + if(component.setParentEntity && typeof component.setParentEntity == 'function') { + component.setParentEntity(this.parentScene, this); + } + } +}; + GameLib.D3.Scene.FromAPIScene = function( apiScene, graphics,