Browse Source

setActiveCameraById
setActiveCameraByName

Deltakosh 11 years ago
parent
commit
145c709c7c

+ 1 - 1
Babylon/Loading/Plugins/babylon.babylonFileLoader.js

@@ -651,7 +651,7 @@ var BABYLON = BABYLON || {};
             }
 
             if (parsedData.activeCameraID) {
-                scene.activeCameraByID(parsedData.activeCameraID);
+                scene.setActiveCameraByID(parsedData.activeCameraID);
             }
 
             // Materials

+ 2 - 1
Babylon/Tools/babylon.virtualJoystick.js

@@ -73,7 +73,7 @@ window.requestAnimationFrame = (function () {
                 vjCanvas.style.backgroundColor = "transparent";
                 vjCanvas.style.top = "0px";
                 vjCanvas.style.left = "0px";
-                vjCanvas.style.zIndex = 10;
+                vjCanvas.style.zIndex = 5;
                 vjCanvas.style.msTouchAction = "none";
                 vjCanvasContext = vjCanvas.getContext('2d');
                 vjCanvasContext.strokeStyle = "#ffffff";
@@ -297,6 +297,7 @@ window.requestAnimationFrame = (function () {
         VirtualJoystick.prototype.releaseCanvas = function () {
             if (vjCanvas) {
                 document.body.removeChild(vjCanvas);
+                vjCanvas = null;
             };
         };
 

+ 1 - 1
Babylon/babylon.engine.js

@@ -735,7 +735,7 @@ var BABYLON = BABYLON || {};
 
     BABYLON.Engine.prototype.updateVideoTexture = function (texture, video, invertY) {
         this._gl.bindTexture(this._gl.TEXTURE_2D, texture);
-        this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL, invertY);
+        this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL, invertY ? false : true); // Video are upside down by default
 
         // Scale the video if it is a NPOT
         if (video.videoWidth !== texture._width || video.videoHeight !== texture._height) {

+ 29 - 6
Babylon/babylon.scene.js

@@ -326,13 +326,26 @@ var BABYLON = BABYLON || {};
     };
 
     // Methods
-    BABYLON.Scene.prototype.activeCameraByID = function (id) {
-        for (var index = 0; index < this.cameras.length; index++) {
-            if (this.cameras[index].id === id) {
-                this.activeCamera = this.cameras[index];
-                return;
-            }
+    BABYLON.Scene.prototype.setActiveCameraByID = function (id) {
+        var camera = this.getCameraByID(id);
+
+        if (camera) {
+            this.activeCamera = camera;
+            return camera;
         }
+
+        return null;
+    };
+
+    BABYLON.Scene.prototype.setActiveCameraByName = function (name) {
+        var camera = this.getCameraByName(name);
+
+        if (camera) {
+            this.activeCamera = camera;
+            return camera;
+        }
+
+        return null;
     };
 
     BABYLON.Scene.prototype.getMaterialByID = function (id) {
@@ -355,6 +368,16 @@ var BABYLON = BABYLON || {};
         return null;
     };
 
+    BABYLON.Scene.prototype.getCameraByID = function (id) {
+        for (var index = 0; index < this.cameras.length; index++) {
+            if (this.cameras[index].id === id) {
+                return this.cameras[index];
+            }
+        }
+
+        return null;
+    };
+
     BABYLON.Scene.prototype.getCameraByName = function (name) {
         for (var index = 0; index < this.cameras.length; index++) {
             if (this.cameras[index].name === name) {

File diff suppressed because it is too large
+ 2 - 2
babylon.1.9.0.js