瀏覽代碼

Points WMR controllers to CDN

David Catuhe 8 年之前
父節點
當前提交
450f12624e

File diff suppressed because it is too large
+ 4346 - 4346
dist/preview release/babylon.d.ts


File diff suppressed because it is too large
+ 17 - 17
dist/preview release/babylon.js


+ 21 - 19
dist/preview release/babylon.max.js

@@ -15214,18 +15214,6 @@ var BABYLON;
             var engine = this.getEngine();
             this._cache.position.copyFrom(this.position);
             this._cache.upVector.copyFrom(this.upVector);
-            this._cache.mode = this.mode;
-            this._cache.minZ = this.minZ;
-            this._cache.maxZ = this.maxZ;
-            this._cache.fov = this.fov;
-            this._cache.fovMode = this.fovMode;
-            this._cache.aspectRatio = engine.getAspectRatio(this);
-            this._cache.orthoLeft = this.orthoLeft;
-            this._cache.orthoRight = this.orthoRight;
-            this._cache.orthoBottom = this.orthoBottom;
-            this._cache.orthoTop = this.orthoTop;
-            this._cache.renderWidth = engine.getRenderWidth();
-            this._cache.renderHeight = engine.getRenderHeight();
         };
         // Synchronized
         Camera.prototype._isSynchronized = function () {
@@ -15267,10 +15255,10 @@ var BABYLON;
         Camera.prototype.detachControl = function (element) {
         };
         Camera.prototype.update = function () {
+            this._checkInputs();
             if (this.cameraRigMode !== Camera.RIG_MODE_NONE) {
                 this._updateRigCameras();
             }
-            this._checkInputs();
         };
         Camera.prototype._checkInputs = function () {
             this.onAfterCheckInputsObservable.notifyObservers(this);
@@ -15369,6 +15357,7 @@ var BABYLON;
             if (!force && this._isSynchronizedViewMatrix()) {
                 return this._computedViewMatrix;
             }
+            this.updateCache();
             this._computedViewMatrix = this._getViewMatrix();
             this._currentRenderId = this.getScene().getRenderId();
             this._refreshFrustumPlanes = true;
@@ -15406,10 +15395,18 @@ var BABYLON;
             if (this._doNotComputeProjectionMatrix || (!force && this._isSynchronizedProjectionMatrix())) {
                 return this._projectionMatrix;
             }
+            // Cache
+            this._cache.mode = this.mode;
+            this._cache.minZ = this.minZ;
+            this._cache.maxZ = this.maxZ;
+            // Matrix
             this._refreshFrustumPlanes = true;
             var engine = this.getEngine();
             var scene = this.getScene();
             if (this.mode === Camera.PERSPECTIVE_CAMERA) {
+                this._cache.fov = this.fov;
+                this._cache.fovMode = this.fovMode;
+                this._cache.aspectRatio = engine.getAspectRatio(this);
                 if (this.minZ <= 0) {
                     this.minZ = 0.1;
                 }
@@ -15429,6 +15426,12 @@ var BABYLON;
                 else {
                     BABYLON.Matrix.OrthoOffCenterLHToRef(this.orthoLeft || -halfWidth, this.orthoRight || halfWidth, this.orthoBottom || -halfHeight, this.orthoTop || halfHeight, this.minZ, this.maxZ, this._projectionMatrix);
                 }
+                this._cache.orthoLeft = this.orthoLeft;
+                this._cache.orthoRight = this.orthoRight;
+                this._cache.orthoBottom = this.orthoBottom;
+                this._cache.orthoTop = this.orthoTop;
+                this._cache.renderWidth = engine.getRenderWidth();
+                this._cache.renderHeight = engine.getRenderHeight();
             }
             this.onProjectionMatrixChangedObservable.notifyObservers(this);
             return this._projectionMatrix;
@@ -18949,8 +18952,6 @@ var BABYLON;
             this._renderDuration.endMonitoring(false);
             // Finalize frame
             this.postProcessManager._finalizeFrame(camera.isIntermediate);
-            // Update camera
-            this.activeCamera.updateCache();
             // Reset some special arrays
             this._renderTargets.reset();
             this._alternateRendering = false;
@@ -18970,7 +18971,6 @@ var BABYLON;
             }
             this.activeCamera = camera;
             this.setTransformMatrix(this.activeCamera.getViewMatrix(), this.activeCamera.getProjectionMatrix());
-            this.activeCamera.updateCache();
         };
         Scene.prototype._checkIntersections = function () {
             for (var index = 0; index < this._meshesForIntersections.length; index++) {
@@ -52617,11 +52617,12 @@ var BABYLON;
          * @param scene scene in which to add meshes
          * @param meshLoaded optional callback function that will be called if the mesh loads successfully.
          */
-        WindowsMotionController.prototype.initControllerMesh = function (scene, meshLoaded) {
+        WindowsMotionController.prototype.initControllerMesh = function (scene, meshLoaded, forceDefault) {
             var _this = this;
+            if (forceDefault === void 0) { forceDefault = false; }
             // Determine the device specific folder based on the ID suffix
             var device = 'default';
-            if (this.id) {
+            if (this.id && !forceDefault) {
                 var match = this.id.match(WindowsMotionController.GAMEPAD_ID_PATTERN);
                 device = ((match && match[0]) || device);
             }
@@ -52648,6 +52649,7 @@ var BABYLON;
             }, null, function (scene, message) {
                 BABYLON.Tools.Log(message);
                 BABYLON.Tools.Warn('Failed to retrieve controller model from the remote server: ' + path + filename);
+                _this.initControllerMesh(scene, meshLoaded, true);
             });
         };
         /**
@@ -52771,7 +52773,7 @@ var BABYLON;
             _super.prototype.dispose.call(this);
             this.onTrackpadChangedObservable.clear();
         };
-        WindowsMotionController.MODEL_BASE_URL = 'https://controllers.babylonjs.com/';
+        WindowsMotionController.MODEL_BASE_URL = 'https://controllers.babylonjs.com/microsoft/';
         WindowsMotionController.MODEL_LEFT_FILENAME = 'left.glb';
         WindowsMotionController.MODEL_RIGHT_FILENAME = 'right.glb';
         WindowsMotionController.MODEL_ROOT_NODE_NAME = 'RootNode';

File diff suppressed because it is too large
+ 4346 - 4346
dist/preview release/babylon.module.d.ts


File diff suppressed because it is too large
+ 17 - 17
dist/preview release/babylon.worker.js


File diff suppressed because it is too large
+ 2741 - 2741
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


File diff suppressed because it is too large
+ 17 - 17
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 21 - 19
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -15214,18 +15214,6 @@ var BABYLON;
             var engine = this.getEngine();
             this._cache.position.copyFrom(this.position);
             this._cache.upVector.copyFrom(this.upVector);
-            this._cache.mode = this.mode;
-            this._cache.minZ = this.minZ;
-            this._cache.maxZ = this.maxZ;
-            this._cache.fov = this.fov;
-            this._cache.fovMode = this.fovMode;
-            this._cache.aspectRatio = engine.getAspectRatio(this);
-            this._cache.orthoLeft = this.orthoLeft;
-            this._cache.orthoRight = this.orthoRight;
-            this._cache.orthoBottom = this.orthoBottom;
-            this._cache.orthoTop = this.orthoTop;
-            this._cache.renderWidth = engine.getRenderWidth();
-            this._cache.renderHeight = engine.getRenderHeight();
         };
         // Synchronized
         Camera.prototype._isSynchronized = function () {
@@ -15267,10 +15255,10 @@ var BABYLON;
         Camera.prototype.detachControl = function (element) {
         };
         Camera.prototype.update = function () {
+            this._checkInputs();
             if (this.cameraRigMode !== Camera.RIG_MODE_NONE) {
                 this._updateRigCameras();
             }
-            this._checkInputs();
         };
         Camera.prototype._checkInputs = function () {
             this.onAfterCheckInputsObservable.notifyObservers(this);
@@ -15369,6 +15357,7 @@ var BABYLON;
             if (!force && this._isSynchronizedViewMatrix()) {
                 return this._computedViewMatrix;
             }
+            this.updateCache();
             this._computedViewMatrix = this._getViewMatrix();
             this._currentRenderId = this.getScene().getRenderId();
             this._refreshFrustumPlanes = true;
@@ -15406,10 +15395,18 @@ var BABYLON;
             if (this._doNotComputeProjectionMatrix || (!force && this._isSynchronizedProjectionMatrix())) {
                 return this._projectionMatrix;
             }
+            // Cache
+            this._cache.mode = this.mode;
+            this._cache.minZ = this.minZ;
+            this._cache.maxZ = this.maxZ;
+            // Matrix
             this._refreshFrustumPlanes = true;
             var engine = this.getEngine();
             var scene = this.getScene();
             if (this.mode === Camera.PERSPECTIVE_CAMERA) {
+                this._cache.fov = this.fov;
+                this._cache.fovMode = this.fovMode;
+                this._cache.aspectRatio = engine.getAspectRatio(this);
                 if (this.minZ <= 0) {
                     this.minZ = 0.1;
                 }
@@ -15429,6 +15426,12 @@ var BABYLON;
                 else {
                     BABYLON.Matrix.OrthoOffCenterLHToRef(this.orthoLeft || -halfWidth, this.orthoRight || halfWidth, this.orthoBottom || -halfHeight, this.orthoTop || halfHeight, this.minZ, this.maxZ, this._projectionMatrix);
                 }
+                this._cache.orthoLeft = this.orthoLeft;
+                this._cache.orthoRight = this.orthoRight;
+                this._cache.orthoBottom = this.orthoBottom;
+                this._cache.orthoTop = this.orthoTop;
+                this._cache.renderWidth = engine.getRenderWidth();
+                this._cache.renderHeight = engine.getRenderHeight();
             }
             this.onProjectionMatrixChangedObservable.notifyObservers(this);
             return this._projectionMatrix;
@@ -18949,8 +18952,6 @@ var BABYLON;
             this._renderDuration.endMonitoring(false);
             // Finalize frame
             this.postProcessManager._finalizeFrame(camera.isIntermediate);
-            // Update camera
-            this.activeCamera.updateCache();
             // Reset some special arrays
             this._renderTargets.reset();
             this._alternateRendering = false;
@@ -18970,7 +18971,6 @@ var BABYLON;
             }
             this.activeCamera = camera;
             this.setTransformMatrix(this.activeCamera.getViewMatrix(), this.activeCamera.getProjectionMatrix());
-            this.activeCamera.updateCache();
         };
         Scene.prototype._checkIntersections = function () {
             for (var index = 0; index < this._meshesForIntersections.length; index++) {
@@ -52617,11 +52617,12 @@ var BABYLON;
          * @param scene scene in which to add meshes
          * @param meshLoaded optional callback function that will be called if the mesh loads successfully.
          */
-        WindowsMotionController.prototype.initControllerMesh = function (scene, meshLoaded) {
+        WindowsMotionController.prototype.initControllerMesh = function (scene, meshLoaded, forceDefault) {
             var _this = this;
+            if (forceDefault === void 0) { forceDefault = false; }
             // Determine the device specific folder based on the ID suffix
             var device = 'default';
-            if (this.id) {
+            if (this.id && !forceDefault) {
                 var match = this.id.match(WindowsMotionController.GAMEPAD_ID_PATTERN);
                 device = ((match && match[0]) || device);
             }
@@ -52648,6 +52649,7 @@ var BABYLON;
             }, null, function (scene, message) {
                 BABYLON.Tools.Log(message);
                 BABYLON.Tools.Warn('Failed to retrieve controller model from the remote server: ' + path + filename);
+                _this.initControllerMesh(scene, meshLoaded, true);
             });
         };
         /**
@@ -52771,7 +52773,7 @@ var BABYLON;
             _super.prototype.dispose.call(this);
             this.onTrackpadChangedObservable.clear();
         };
-        WindowsMotionController.MODEL_BASE_URL = 'https://controllers.babylonjs.com/';
+        WindowsMotionController.MODEL_BASE_URL = 'https://controllers.babylonjs.com/microsoft/';
         WindowsMotionController.MODEL_LEFT_FILENAME = 'left.glb';
         WindowsMotionController.MODEL_RIGHT_FILENAME = 'right.glb';
         WindowsMotionController.MODEL_ROOT_NODE_NAME = 'RootNode';

File diff suppressed because it is too large
+ 2741 - 2741
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts


+ 19 - 16
src/Cameras/babylon.camera.ts

@@ -261,21 +261,6 @@
 
             this._cache.position.copyFrom(this.position);
             this._cache.upVector.copyFrom(this.upVector);
-
-            this._cache.mode = this.mode;
-            this._cache.minZ = this.minZ;
-            this._cache.maxZ = this.maxZ;
-
-            this._cache.fov = this.fov;
-            this._cache.fovMode = this.fovMode;
-            this._cache.aspectRatio = engine.getAspectRatio(this);
-
-            this._cache.orthoLeft = this.orthoLeft;
-            this._cache.orthoRight = this.orthoRight;
-            this._cache.orthoBottom = this.orthoBottom;
-            this._cache.orthoTop = this.orthoTop;
-            this._cache.renderWidth = engine.getRenderWidth();
-            this._cache.renderHeight = engine.getRenderHeight();
         }
 
         // Synchronized
@@ -328,10 +313,10 @@
         }
 
         public update(): void {
+            this._checkInputs();
             if (this.cameraRigMode !== Camera.RIG_MODE_NONE) {
                 this._updateRigCameras();
             }
-            this._checkInputs();
         }
 
         public _checkInputs(): void {
@@ -436,6 +421,7 @@
                 return this._computedViewMatrix;
             }
 
+            this.updateCache();
             this._computedViewMatrix = this._getViewMatrix();
             this._currentRenderId = this.getScene().getRenderId();
             
@@ -484,11 +470,21 @@
                 return this._projectionMatrix;
             }
 
+            // Cache
+            this._cache.mode = this.mode;
+            this._cache.minZ = this.minZ;
+            this._cache.maxZ = this.maxZ;
+        
+            // Matrix
             this._refreshFrustumPlanes = true;
 
             var engine = this.getEngine();
             var scene = this.getScene();
             if (this.mode === Camera.PERSPECTIVE_CAMERA) {
+                this._cache.fov = this.fov;
+                this._cache.fovMode = this.fovMode;
+                this._cache.aspectRatio = engine.getAspectRatio(this);
+                
                 if (this.minZ <= 0) {
                     this.minZ = 0.1;
                 }
@@ -528,6 +524,13 @@
                         this.maxZ,
                         this._projectionMatrix);
                 }
+
+                this._cache.orthoLeft = this.orthoLeft;
+                this._cache.orthoRight = this.orthoRight;
+                this._cache.orthoBottom = this.orthoBottom;
+                this._cache.orthoTop = this.orthoTop;
+                this._cache.renderWidth = engine.getRenderWidth();
+                this._cache.renderHeight = engine.getRenderHeight();                    
             }
 
             this.onProjectionMatrixChangedObservable.notifyObservers(this);

+ 4 - 3
src/Gamepad/Controllers/babylon.windowsMotionController.ts

@@ -24,7 +24,7 @@ module BABYLON {
     }
 
     export class WindowsMotionController extends WebVRController {
-        private static readonly MODEL_BASE_URL:string = 'https://controllers.babylonjs.com/';
+        private static readonly MODEL_BASE_URL:string = 'https://controllers.babylonjs.com/microsoft/';
         private static readonly MODEL_LEFT_FILENAME:string = 'left.glb';
         private static readonly MODEL_RIGHT_FILENAME:string = 'right.glb';
         private static readonly MODEL_ROOT_NODE_NAME:string = 'RootNode';
@@ -180,10 +180,10 @@ module BABYLON {
          * @param scene scene in which to add meshes
          * @param meshLoaded optional callback function that will be called if the mesh loads successfully.
          */
-        public initControllerMesh(scene: Scene, meshLoaded?: (mesh: AbstractMesh) => void) {
+        public initControllerMesh(scene: Scene, meshLoaded?: (mesh: AbstractMesh) => void, forceDefault = false) {
             // Determine the device specific folder based on the ID suffix
             let device = 'default';
-            if (this.id) {
+            if (this.id && !forceDefault) {
                 let match = this.id.match(WindowsMotionController.GAMEPAD_ID_PATTERN);
                 device = ((match && match[0]) || device);
             }
@@ -216,6 +216,7 @@ module BABYLON {
             }, null, (scene: Scene, message: string) => {
                 Tools.Log(message);
                 Tools.Warn('Failed to retrieve controller model from the remote server: ' + path + filename);
+                this.initControllerMesh(scene, meshLoaded, true);
             });
         }
 

+ 1 - 5
src/babylon.scene.ts

@@ -3004,10 +3004,7 @@
 
             // Finalize frame
             this.postProcessManager._finalizeFrame(camera.isIntermediate);
-
-            // Update camera
-            this.activeCamera.updateCache();
-            
+           
             // Reset some special arrays
             this._renderTargets.reset();
 
@@ -3034,7 +3031,6 @@
 
             this.activeCamera = camera;
             this.setTransformMatrix(this.activeCamera.getViewMatrix(), this.activeCamera.getProjectionMatrix());
-            this.activeCamera.updateCache();
         }
 
         private _checkIntersections(): void {