From 1a855bbf3dd5c83a6dbb936460e5e06e8f73befc Mon Sep 17 00:00:00 2001 From: "Theunis J. Botha" Date: Wed, 23 Nov 2016 13:01:24 +0100 Subject: [PATCH] active camera index --- src/game-lib-game.js | 2 +- src/game-lib-scene.js | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/game-lib-game.js b/src/game-lib-game.js index 592b74f..e390d2b 100644 --- a/src/game-lib-game.js +++ b/src/game-lib-game.js @@ -30,7 +30,7 @@ GameLib.D3.Game.prototype.render = function( ) { for(var s in this.scenes) { var scene = this.scenes[s]; - scene.render(dt, renderer, scene.camera); + scene.render(dt, renderer, scene.cameras[scene.activeCameraIndex]); } }; diff --git a/src/game-lib-scene.js b/src/game-lib-scene.js index ca809d3..c4492dd 100644 --- a/src/game-lib-scene.js +++ b/src/game-lib-scene.js @@ -68,7 +68,9 @@ GameLib.D3.Scene.API = function( worlds, entities, components, - shapes + shapes, + cameras, + activeCameraIndex ) { if (GameLib.D3.Utils.UndefinedOrNull(id)) { id = GameLib.D3.Tools.RandomId(); @@ -139,6 +141,16 @@ GameLib.D3.Scene.API = function( 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; }; /**