active camera index

beta.r3js.org
Theunis J. Botha 2016-11-23 13:01:24 +01:00
parent 50f04fd988
commit 1a855bbf3d
2 changed files with 14 additions and 2 deletions

View File

@ -30,7 +30,7 @@ GameLib.D3.Game.prototype.render = function(
) { ) {
for(var s in this.scenes) { for(var s in this.scenes) {
var scene = this.scenes[s]; var scene = this.scenes[s];
scene.render(dt, renderer, scene.camera); scene.render(dt, renderer, scene.cameras[scene.activeCameraIndex]);
} }
}; };

View File

@ -68,7 +68,9 @@ GameLib.D3.Scene.API = function(
worlds, worlds,
entities, entities,
components, components,
shapes shapes,
cameras,
activeCameraIndex
) { ) {
if (GameLib.D3.Utils.UndefinedOrNull(id)) { if (GameLib.D3.Utils.UndefinedOrNull(id)) {
id = GameLib.D3.Tools.RandomId(); id = GameLib.D3.Tools.RandomId();
@ -139,6 +141,16 @@ GameLib.D3.Scene.API = function(
shapes = []; shapes = [];
} }
this.shapes = shapes; this.shapes = shapes;
if (GameLib.D3.Utils.UndefinedOrNull(cameras)) {
cameras = [];
}
this.cameras = cameras;
if (GameLib.D3.Utils.UndefinedOrNull(activeCameraIndex)) {
activeCameraIndex = 0;
}
this.activeCameraIndex = activeCameraIndex;
}; };
/** /**