Procházet zdrojové kódy

Fixing other issues :)

David Catuhe před 9 roky
rodič
revize
bdebc3bc8f

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 3 - 3
dist/preview release/babylon.core.js


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 2168 - 2166
dist/preview release/babylon.d.ts


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 14 - 14
dist/preview release/babylon.js


+ 12 - 2
dist/preview release/babylon.max.js

@@ -12659,10 +12659,13 @@ var BABYLON;
             }
         };
         Scene.prototype._animate = function () {
-            if (!this.animationsEnabled) {
+            if (!this.animationsEnabled || this._activeAnimatables.length === 0) {
                 return;
             }
             if (!this._animationStartDate) {
+                if (this._pendingData.length > 0) {
+                    return;
+                }
                 this._animationStartDate = BABYLON.Tools.Now;
             }
             // Getting time
@@ -36319,6 +36322,8 @@ var BABYLON;
         function EdgesRenderer(source, epsilon, checkVerticesInsteadOfIndices) {
             if (epsilon === void 0) { epsilon = 0.95; }
             if (checkVerticesInsteadOfIndices === void 0) { checkVerticesInsteadOfIndices = false; }
+            this.edgesWidthScalerForOrthographic = 1000.0;
+            this.edgesWidthScalerForPerspective = 50.0;
             this._linesPositions = new Array();
             this._linesNormals = new Array();
             this._linesIndices = new Array();
@@ -36531,7 +36536,12 @@ var BABYLON;
             engine.bindMultiBuffers(this._buffers, this._ib, this._lineShader.getEffect());
             scene.resetCachedMaterial();
             this._lineShader.setColor4("color", this._source.edgesColor);
-            this._lineShader.setFloat("width", this._source.edgesWidth / 50.0);
+            if (scene.activeCamera.mode === BABYLON.Camera.ORTHOGRAPHIC_CAMERA) {
+                this._lineShader.setFloat("width", this._source.edgesWidth / this.edgesWidthScalerForOrthographic);
+            }
+            else {
+                this._lineShader.setFloat("width", this._source.edgesWidth / this.edgesWidthScalerForPerspective);
+            }
             this._lineShader.setFloat("aspectRatio", engine.getAspectRatio(scene.activeCamera));
             this._lineShader.bind(this._source.getWorldMatrix());
             // Draw order

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 5 - 5
dist/preview release/babylon.noworker.js


+ 8 - 1
src/Rendering/babylon.edgesRenderer.js

@@ -12,6 +12,8 @@ var BABYLON;
         function EdgesRenderer(source, epsilon, checkVerticesInsteadOfIndices) {
             if (epsilon === void 0) { epsilon = 0.95; }
             if (checkVerticesInsteadOfIndices === void 0) { checkVerticesInsteadOfIndices = false; }
+            this.edgesWidthScalerForOrthographic = 1000.0;
+            this.edgesWidthScalerForPerspective = 50.0;
             this._linesPositions = new Array();
             this._linesNormals = new Array();
             this._linesIndices = new Array();
@@ -224,7 +226,12 @@ var BABYLON;
             engine.bindMultiBuffers(this._buffers, this._ib, this._lineShader.getEffect());
             scene.resetCachedMaterial();
             this._lineShader.setColor4("color", this._source.edgesColor);
-            this._lineShader.setFloat("width", this._source.edgesWidth / 50.0);
+            if (scene.activeCamera.mode === BABYLON.Camera.ORTHOGRAPHIC_CAMERA) {
+                this._lineShader.setFloat("width", this._source.edgesWidth / this.edgesWidthScalerForOrthographic);
+            }
+            else {
+                this._lineShader.setFloat("width", this._source.edgesWidth / this.edgesWidthScalerForPerspective);
+            }
             this._lineShader.setFloat("aspectRatio", engine.getAspectRatio(scene.activeCamera));
             this._lineShader.bind(this._source.getWorldMatrix());
             // Draw order

+ 9 - 1
src/Rendering/babylon.edgesRenderer.ts

@@ -9,6 +9,8 @@
     }
 
     export class EdgesRenderer {
+        public edgesWidthScalerForOrthographic = 1000.0;
+        public edgesWidthScalerForPerspective = 50.0;
         private _source: AbstractMesh;
         private _linesPositions = new Array<number>();
         private _linesNormals = new Array<number>();
@@ -284,7 +286,13 @@
 
             scene.resetCachedMaterial();
             this._lineShader.setColor4("color", this._source.edgesColor);
-            this._lineShader.setFloat("width", this._source.edgesWidth / 50.0);
+
+            if (scene.activeCamera.mode === Camera.ORTHOGRAPHIC_CAMERA) {
+                this._lineShader.setFloat("width", this._source.edgesWidth / this.edgesWidthScalerForOrthographic);
+            } else {
+                this._lineShader.setFloat("width", this._source.edgesWidth / this.edgesWidthScalerForPerspective);
+            }
+
             this._lineShader.setFloat("aspectRatio", engine.getAspectRatio(scene.activeCamera));
             this._lineShader.bind(this._source.getWorldMatrix());
 

+ 4 - 1
src/babylon.scene.js

@@ -619,10 +619,13 @@ var BABYLON;
             }
         };
         Scene.prototype._animate = function () {
-            if (!this.animationsEnabled) {
+            if (!this.animationsEnabled || this._activeAnimatables.length === 0) {
                 return;
             }
             if (!this._animationStartDate) {
+                if (this._pendingData.length > 0) {
+                    return;
+                }
                 this._animationStartDate = BABYLON.Tools.Now;
             }
             // Getting time

+ 5 - 2
src/babylon.scene.ts

@@ -673,7 +673,6 @@
                         return false;
                     }
                 }
-
             }
 
             return true;
@@ -827,11 +826,15 @@
         }
 
         private _animate(): void {
-            if (!this.animationsEnabled) {
+            if (!this.animationsEnabled || this._activeAnimatables.length === 0) {
                 return;
             }
 
             if (!this._animationStartDate) {
+                if (this._pendingData.length > 0) {
+                    return;
+                }
+
                 this._animationStartDate = Tools.Now;
             }
             // Getting time