David Catuhe 7 vuotta sitten
vanhempi
commit
e7f9584d25

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 2254 - 2246
Playground/babylon.d.txt


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 8375 - 8366
dist/preview release/babylon.d.ts


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 5 - 5
dist/preview release/babylon.js


+ 20 - 1
dist/preview release/babylon.max.js

@@ -73585,6 +73585,14 @@ var BABYLON;
             this._padSensibilityDown = 0.35;
             this.onNewMeshSelected = new BABYLON.Observable();
             /**
+             * Observable raised before camera teleportation
+            */
+            this.onBeforeCameraTeleport = new BABYLON.Observable();
+            /**
+             *  Observable raised after camera teleportation
+            */
+            this.onAfterCameraTeleport = new BABYLON.Observable();
+            /**
             * Observable raised when current selected mesh gets unselected
             */
             this.onSelectedMeshUnselected = new BABYLON.Observable();
@@ -74635,6 +74643,7 @@ var BABYLON;
             else {
                 this._workingVector.y += this._defaultHeight;
             }
+            this.onBeforeCameraTeleport.notifyObservers(this._workingVector);
             // Create animation from the camera's position to the new location
             this.currentVRCamera.animations = [];
             var animationCameraTeleportation = new BABYLON.Animation("animationCameraTeleportation", "position", 90, BABYLON.Animation.ANIMATIONTYPE_VECTOR3, BABYLON.Animation.ANIMATIONLOOPMODE_CONSTANT);
@@ -74689,7 +74698,9 @@ var BABYLON;
             this._scene.beginAnimation(this._postProcessMove, 0, 11, false, 1, function () {
                 _this._webVRCamera.detachPostProcess(_this._postProcessMove);
             });
-            this._scene.beginAnimation(this.currentVRCamera, 0, 11, false, 1);
+            this._scene.beginAnimation(this.currentVRCamera, 0, 11, false, 1, function () {
+                _this.onAfterCameraTeleport.notifyObservers(_this._workingVector);
+            });
         };
         VRExperienceHelper.prototype._castRayAndSelectObject = function () {
             if (!(this.currentVRCamera instanceof BABYLON.FreeCamera)) {
@@ -77577,6 +77588,7 @@ var BABYLON;
     BABYLON.HDRCubeTextureAssetTask = HDRCubeTextureAssetTask;
     var AssetsManager = /** @class */ (function () {
         function AssetsManager(scene) {
+            this._isLoading = false;
             this.tasks = new Array();
             this.waitingTasksCount = 0;
             //Observables
@@ -77650,6 +77662,7 @@ var BABYLON;
                     BABYLON.Tools.Error("Error running tasks-done callbacks.");
                     console.log(e);
                 }
+                this._isLoading = false;
                 this._scene.getEngine().hideLoadingUI();
             }
         };
@@ -77681,16 +77694,22 @@ var BABYLON;
             task.run(this._scene, done, error);
         };
         AssetsManager.prototype.reset = function () {
+            this._isLoading = false;
             this.tasks = new Array();
             return this;
         };
         AssetsManager.prototype.load = function () {
+            if (this._isLoading) {
+                return this;
+            }
+            this._isLoading = true;
             this.waitingTasksCount = this.tasks.length;
             if (this.waitingTasksCount === 0) {
                 if (this.onFinish) {
                     this.onFinish(this.tasks);
                 }
                 this.onTasksDoneObservable.notifyObservers(this.tasks);
+                this._isLoading = false;
                 return this;
             }
             if (this.useDefaultLoadingScreen) {

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 17 - 17
dist/preview release/babylon.worker.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 7421 - 7413
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 5 - 5
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 12 - 1
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -73431,6 +73431,14 @@ var BABYLON;
             this._padSensibilityDown = 0.35;
             this.onNewMeshSelected = new BABYLON.Observable();
             /**
+             * Observable raised before camera teleportation
+            */
+            this.onBeforeCameraTeleport = new BABYLON.Observable();
+            /**
+             *  Observable raised after camera teleportation
+            */
+            this.onAfterCameraTeleport = new BABYLON.Observable();
+            /**
             * Observable raised when current selected mesh gets unselected
             */
             this.onSelectedMeshUnselected = new BABYLON.Observable();
@@ -74481,6 +74489,7 @@ var BABYLON;
             else {
                 this._workingVector.y += this._defaultHeight;
             }
+            this.onBeforeCameraTeleport.notifyObservers(this._workingVector);
             // Create animation from the camera's position to the new location
             this.currentVRCamera.animations = [];
             var animationCameraTeleportation = new BABYLON.Animation("animationCameraTeleportation", "position", 90, BABYLON.Animation.ANIMATIONTYPE_VECTOR3, BABYLON.Animation.ANIMATIONLOOPMODE_CONSTANT);
@@ -74535,7 +74544,9 @@ var BABYLON;
             this._scene.beginAnimation(this._postProcessMove, 0, 11, false, 1, function () {
                 _this._webVRCamera.detachPostProcess(_this._postProcessMove);
             });
-            this._scene.beginAnimation(this.currentVRCamera, 0, 11, false, 1);
+            this._scene.beginAnimation(this.currentVRCamera, 0, 11, false, 1, function () {
+                _this.onAfterCameraTeleport.notifyObservers(_this._workingVector);
+            });
         };
         VRExperienceHelper.prototype._castRayAndSelectObject = function () {
             if (!(this.currentVRCamera instanceof BABYLON.FreeCamera)) {

+ 3 - 0
dist/preview release/serializers/babylon.glTF2Serializer.js

@@ -485,6 +485,9 @@ var BABYLON;
                     }
                     gltf.meshes.push(mesh);
                     node.mesh = gltf.meshes.length - 1;
+                    if (babylonMesh.name) {
+                        node.name = babylonMesh.name;
+                    }
                     gltf.nodes.push(node);
                     scene.nodes.push(gltf.nodes.length - 1);
                 }

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 1
dist/preview release/serializers/babylon.glTF2Serializer.min.js


+ 3 - 0
dist/preview release/serializers/babylonjs.serializers.js

@@ -629,6 +629,9 @@ var BABYLON;
                     }
                     gltf.meshes.push(mesh);
                     node.mesh = gltf.meshes.length - 1;
+                    if (babylonMesh.name) {
+                        node.name = babylonMesh.name;
+                    }
                     gltf.nodes.push(node);
                     scene.nodes.push(gltf.nodes.length - 1);
                 }

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 1
dist/preview release/serializers/babylonjs.serializers.min.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 4 - 4
dist/preview release/viewer/babylon.viewer.js


+ 16 - 9
src/Tools/babylon.assetsManager.ts

@@ -7,7 +7,7 @@ module BABYLON {
         ERROR
     }
 
-    export abstract class AbstractAssetTask  {
+    export abstract class AbstractAssetTask {
         public onSuccess: (task: any) => void;
         public onError: (task: any, message?: string, exception?: any) => void;
 
@@ -112,7 +112,7 @@ module BABYLON {
         public text: string;
 
         public onSuccess: (task: TextFileAssetTask) => void;
-        public onError: (task: TextFileAssetTask, message?: string, exception?: any) => void;        
+        public onError: (task: TextFileAssetTask, message?: string, exception?: any) => void;
 
         constructor(public name: string, public url: string) {
             super(name);
@@ -134,7 +134,7 @@ module BABYLON {
         public data: ArrayBuffer;
 
         public onSuccess: (task: BinaryFileAssetTask) => void;
-        public onError: (task: BinaryFileAssetTask, message?: string, exception?: any) => void;               
+        public onError: (task: BinaryFileAssetTask, message?: string, exception?: any) => void;
 
         constructor(public name: string, public url: string) {
             super(name);
@@ -156,7 +156,7 @@ module BABYLON {
         public image: HTMLImageElement;
 
         public onSuccess: (task: ImageAssetTask) => void;
-        public onError: (task: ImageAssetTask, message?: string, exception?: any) => void;            
+        public onError: (task: ImageAssetTask, message?: string, exception?: any) => void;
 
         constructor(public name: string, public url: string) {
             super(name);
@@ -186,9 +186,9 @@ module BABYLON {
 
     export class TextureAssetTask extends AbstractAssetTask implements ITextureAssetTask<Texture> {
         public texture: Texture;
-        
+
         public onSuccess: (task: TextureAssetTask) => void;
-        public onError: (task: TextureAssetTask, message?: string, exception?: any) => void;    
+        public onError: (task: TextureAssetTask, message?: string, exception?: any) => void;
 
         constructor(public name: string, public url: string, public noMipmap?: boolean, public invertY?: boolean, public samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE) {
             super(name);
@@ -212,7 +212,7 @@ module BABYLON {
         public texture: CubeTexture;
 
         public onSuccess: (task: CubeTextureAssetTask) => void;
-        public onError: (task: CubeTextureAssetTask, message?: string, exception?: any) => void;            
+        public onError: (task: CubeTextureAssetTask, message?: string, exception?: any) => void;
 
         constructor(public name: string, public url: string, public extensions?: string[], public noMipmap?: boolean, public files?: string[]) {
             super(name);
@@ -236,7 +236,7 @@ module BABYLON {
         public texture: HDRCubeTexture;
 
         public onSuccess: (task: HDRCubeTextureAssetTask) => void;
-        public onError: (task: HDRCubeTextureAssetTask, message?: string, exception?: any) => void;               
+        public onError: (task: HDRCubeTextureAssetTask, message?: string, exception?: any) => void;
 
         constructor(public name: string, public url: string, public size?: number, public noMipmap = false, public generateHarmonics = true, public useInGammaSpace = false, public usePMREMGenerator = false) {
             super(name);
@@ -258,6 +258,7 @@ module BABYLON {
 
     export class AssetsManager {
         private _scene: Scene;
+        private _isLoading = false;
 
         protected tasks = new Array<AbstractAssetTask>();
         protected waitingTasksCount = 0;
@@ -365,7 +366,7 @@ module BABYLON {
                     Tools.Error("Error running tasks-done callbacks.");
                     console.log(e);
                 }
-
+                this._isLoading = false;
                 this._scene.getEngine().hideLoadingUI();
             }
         }
@@ -401,11 +402,16 @@ module BABYLON {
         }
 
         public reset(): AssetsManager {
+            this._isLoading = false;
             this.tasks = new Array<AbstractAssetTask>();
             return this;
         }
 
         public load(): AssetsManager {
+            if (this._isLoading) {
+                return this;
+            }
+            this._isLoading = true;
             this.waitingTasksCount = this.tasks.length;
 
             if (this.waitingTasksCount === 0) {
@@ -413,6 +419,7 @@ module BABYLON {
                     this.onFinish(this.tasks);
                 }
                 this.onTasksDoneObservable.notifyObservers(this.tasks);
+                this._isLoading = false;
                 return this;
             }
 

BIN
tests/validation/ReferenceImages/GLTF LOD.png


BIN
tests/validation/ReferenceImages/instancedBones.png


BIN
tests/validation/ReferenceImages/instances.png


BIN
tests/validation/ReferenceImages/waterMaterial.png


+ 5 - 23
tests/validation/config.json

@@ -241,8 +241,7 @@
       "renderCount": 20,
       "scriptToRun": "/Demos/GLTF1CesiumMan/index.js",
       "functionToCall": "createScene",
-      "referenceImage": "gltf1CesiumMan.png",
-      "onlyVisual": true
+      "referenceImage": "gltf1CesiumMan.png"
     },
     {
       "title": "GLTF Mesh Primitive Attribute Test",
@@ -267,13 +266,6 @@
       "referenceImage": "pbrrough.png"
     },
     {
-      "title": "GLTF LOD",
-      "renderCount": 500,
-      "playgroundId": "#TC80RU#41",
-      "referenceImage": "GLTF LOD.png",
-      "onlyVisual": true
-    },
-    {
       "title": "Reflection probes",
       "renderCount": 10,
       "scriptToRun": "/Demos/RefProbe/reflectionProbe.js",
@@ -341,30 +333,20 @@
       "replace": "./land, https://cdn.rawgit.com/BabylonJS/Website/06ecbea7/Demos/Procedural/land"
     },
     {
-      "title": "Water material (only visual check)",
-      "renderCount": 10,
-      "scriptToRun": "/Demos/WaterMaterial/water.js",
-      "functionToCall": "CreateWaterTestScene",
-      "referenceImage": "waterMaterial.png",
-      "onlyVisual": true
-    },
-    {
-      "title": "Instances (only visual check)",
+      "title": "Instances",
       "renderCount": 10,
       "scriptToRun": "/Demos/Instances/instances.js",
       "functionToCall": "CreateInstancesTestScene",
       "referenceImage": "instances.png",
-      "replace": "ground., Ground.",
-      "onlyVisual": true
+      "replace": "ground., Ground."
     },
     {
-      "title": "Instanced Bones (only visual check)",
+      "title": "Instanced Bones",
       "renderCount": 10,
       "scriptToRun": "/Demos/InstancedBones/bones2.js",
       "functionToCall": "CreateBones2TestScene",
       "referenceImage": "instancedBones.png",
-      "replace": "Dude.babylon, dude.babylon",
-      "onlyVisual": true
+      "replace": "Dude.babylon, dude.babylon"
     }
   ]
 }

+ 15 - 0
tests/validation/validation.js

@@ -9,6 +9,20 @@ var justOnce;
 var threshold = 25;
 var errorRatio = 5;
 
+// Overload the random to make it deterministic
+var seed = 100000,
+    constant = Math.pow(2, 13) + 1,
+    prime = 37,
+    maximum = Math.pow(2, 50);
+
+Math.random = function () {
+    seed *= constant;
+    seed += prime;
+    seed %= maximum;
+
+    return seed / maximum;
+}
+
 function compare(renderData, referenceCanvas) {
     var width = referenceCanvas.width;
     var height = referenceCanvas.height;
@@ -77,6 +91,7 @@ function saveRenderImage(data, canvas) {
 }
 
 function evaluate(test, resultCanvas, result, renderImage, index, waitRing, done) {
+    seed = 100000;
     var renderData = getRenderData(canvas, engine);
     var testRes = true;