Browse Source

Merge branch 'master' of https://github.com/BabylonJS/Babylon.js

David Catuhe 8 years ago
parent
commit
86e38be15a
24 changed files with 18309 additions and 18264 deletions
  1. 1230 1228
      dist/preview release/babylon.d.ts
  2. 43 42
      dist/preview release/babylon.js
  3. 21 12
      dist/preview release/babylon.max.js
  4. 1230 1228
      dist/preview release/babylon.module.d.ts
  5. 45 44
      dist/preview release/babylon.worker.js
  6. 7684 7683
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts
  7. 31 31
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js
  8. 21 12
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js
  9. 7684 7683
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts
  10. 1 1
      dist/preview release/gui/babylon.gui.min.js
  11. 263 263
      dist/preview release/inspector/babylon.inspector.bundle.js
  12. 3 3
      dist/preview release/inspector/babylon.inspector.min.js
  13. 2 2
      dist/preview release/loaders/babylon.glTF1FileLoader.min.js
  14. 1 1
      dist/preview release/loaders/babylon.glTF2FileLoader.min.js
  15. 2 2
      dist/preview release/loaders/babylon.glTFFileLoader.min.js
  16. 1 1
      dist/preview release/loaders/babylon.objFileLoader.min.js
  17. 1 1
      dist/preview release/materialsLibrary/babylon.customMaterial.min.js
  18. 1 1
      dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.min.js
  19. 1 1
      dist/preview release/materialsLibrary/babylon.waterMaterial.min.js
  20. 1 1
      dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js
  21. 1 1
      dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js
  22. 30 20
      src/Mesh/babylon.abstractMesh.ts
  23. 11 3
      src/babylon.engine.ts
  24. 1 0
      src/babylon.mixins.ts

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


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


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

@@ -10986,6 +10986,9 @@ var BABYLON;
         Engine.prototype.createQuery = function () {
             return this._gl.createQuery();
         };
+        Engine.prototype.deleteQuery = function (query) {
+            this.deleteQuery(query);
+        };
         Engine.prototype.isQueryResultAvailable = function (query) {
             return this._gl.getQueryParameter(query, this._gl.QUERY_RESULT_AVAILABLE);
         };
@@ -11818,14 +11821,12 @@ var BABYLON;
             // Properties
             _this.definedFacingForward = true; // orientation for POV movement & rotation
             _this.position = BABYLON.Vector3.Zero();
-            _this._webGLVersion = _this.getEngine().webGLVersion;
-            _this._occlusionInternalRetryCounter = 0;
+            _this.isOcclusionQueryInProgress = false;
+            _this.occlusionQueryAlgorithmType = AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE;
             _this.occlusionType = AbstractMesh.OCCLUSION_TYPE_NONE;
             _this.occlusionRetryCount = -1;
+            _this._occlusionInternalRetryCounter = 0;
             _this._isOccluded = false;
-            _this.occlusionQuery = _this.getEngine().createQuery();
-            _this.isOcclusionQueryInProgress = false;
-            _this.occlusionQueryAlgorithmType = AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE;
             _this._rotation = BABYLON.Vector3.Zero();
             _this._scaling = BABYLON.Vector3.One();
             _this.billboardMode = AbstractMesh.BILLBOARDMODE_NONE;
@@ -13417,8 +13418,14 @@ var BABYLON;
                     sceneOctree.dynamicContent.splice(index, 1);
                 }
             }
+            // Query
+            var engine = this.getScene().getEngine();
+            if (this._occlusionQuery) {
+                engine.deleteQuery(this._occlusionQuery);
+                this._occlusionQuery = null;
+            }
             // Engine
-            this.getScene().getEngine().wipeCaches();
+            engine.wipeCaches();
             // Remove from scene
             this.getScene().removeMesh(this);
             if (!doNotRecurse) {
@@ -13859,15 +13866,15 @@ var BABYLON;
             this.setVerticesData(BABYLON.VertexBuffer.NormalKind, normals, updatable);
         };
         AbstractMesh.prototype.checkOcclusionQuery = function () {
-            if (this._webGLVersion < 2 || this.occlusionType === AbstractMesh.OCCLUSION_TYPE_NONE) {
+            var engine = this.getEngine();
+            if (engine.webGLVersion < 2 || this.occlusionType === AbstractMesh.OCCLUSION_TYPE_NONE) {
                 this._isOccluded = false;
                 return;
             }
-            var engine = this.getEngine();
             if (this.isOcclusionQueryInProgress) {
-                var isOcclusionQueryAvailable = engine.isQueryResultAvailable(this.occlusionQuery);
+                var isOcclusionQueryAvailable = engine.isQueryResultAvailable(this._occlusionQuery);
                 if (isOcclusionQueryAvailable) {
-                    var occlusionQueryResult = engine.getQueryResult(this.occlusionQuery);
+                    var occlusionQueryResult = engine.getQueryResult(this._occlusionQuery);
                     this.isOcclusionQueryInProgress = false;
                     this._occlusionInternalRetryCounter = 0;
                     this._isOccluded = occlusionQueryResult === 1 ? false : true;
@@ -13875,7 +13882,6 @@ var BABYLON;
                 else {
                     this._occlusionInternalRetryCounter++;
                     if (this.occlusionRetryCount !== -1 && this._occlusionInternalRetryCounter > this.occlusionRetryCount) {
-                        // break;
                         this.isOcclusionQueryInProgress = false;
                         this._occlusionInternalRetryCounter = 0;
                         // if optimistic set isOccluded to false regardless of the status of isOccluded. (Render in the current render loop)
@@ -13889,7 +13895,10 @@ var BABYLON;
             }
             var scene = this.getScene();
             var occlusionBoundingBoxRenderer = scene.getBoundingBoxRenderer();
-            engine.beginQuery(this.occlusionQueryAlgorithmType, this.occlusionQuery);
+            if (!this._occlusionQuery) {
+                this._occlusionQuery = engine.createQuery();
+            }
+            engine.beginQuery(this.occlusionQueryAlgorithmType, this._occlusionQuery);
             occlusionBoundingBoxRenderer.renderOcclusionBoundingBox(this);
             engine.endQuery(this.occlusionQueryAlgorithmType);
             this.isOcclusionQueryInProgress = true;

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


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


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


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


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

@@ -10986,6 +10986,9 @@ var BABYLON;
         Engine.prototype.createQuery = function () {
             return this._gl.createQuery();
         };
+        Engine.prototype.deleteQuery = function (query) {
+            this.deleteQuery(query);
+        };
         Engine.prototype.isQueryResultAvailable = function (query) {
             return this._gl.getQueryParameter(query, this._gl.QUERY_RESULT_AVAILABLE);
         };
@@ -11818,14 +11821,12 @@ var BABYLON;
             // Properties
             _this.definedFacingForward = true; // orientation for POV movement & rotation
             _this.position = BABYLON.Vector3.Zero();
-            _this._webGLVersion = _this.getEngine().webGLVersion;
-            _this._occlusionInternalRetryCounter = 0;
+            _this.isOcclusionQueryInProgress = false;
+            _this.occlusionQueryAlgorithmType = AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE;
             _this.occlusionType = AbstractMesh.OCCLUSION_TYPE_NONE;
             _this.occlusionRetryCount = -1;
+            _this._occlusionInternalRetryCounter = 0;
             _this._isOccluded = false;
-            _this.occlusionQuery = _this.getEngine().createQuery();
-            _this.isOcclusionQueryInProgress = false;
-            _this.occlusionQueryAlgorithmType = AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE;
             _this._rotation = BABYLON.Vector3.Zero();
             _this._scaling = BABYLON.Vector3.One();
             _this.billboardMode = AbstractMesh.BILLBOARDMODE_NONE;
@@ -13417,8 +13418,14 @@ var BABYLON;
                     sceneOctree.dynamicContent.splice(index, 1);
                 }
             }
+            // Query
+            var engine = this.getScene().getEngine();
+            if (this._occlusionQuery) {
+                engine.deleteQuery(this._occlusionQuery);
+                this._occlusionQuery = null;
+            }
             // Engine
-            this.getScene().getEngine().wipeCaches();
+            engine.wipeCaches();
             // Remove from scene
             this.getScene().removeMesh(this);
             if (!doNotRecurse) {
@@ -13859,15 +13866,15 @@ var BABYLON;
             this.setVerticesData(BABYLON.VertexBuffer.NormalKind, normals, updatable);
         };
         AbstractMesh.prototype.checkOcclusionQuery = function () {
-            if (this._webGLVersion < 2 || this.occlusionType === AbstractMesh.OCCLUSION_TYPE_NONE) {
+            var engine = this.getEngine();
+            if (engine.webGLVersion < 2 || this.occlusionType === AbstractMesh.OCCLUSION_TYPE_NONE) {
                 this._isOccluded = false;
                 return;
             }
-            var engine = this.getEngine();
             if (this.isOcclusionQueryInProgress) {
-                var isOcclusionQueryAvailable = engine.isQueryResultAvailable(this.occlusionQuery);
+                var isOcclusionQueryAvailable = engine.isQueryResultAvailable(this._occlusionQuery);
                 if (isOcclusionQueryAvailable) {
-                    var occlusionQueryResult = engine.getQueryResult(this.occlusionQuery);
+                    var occlusionQueryResult = engine.getQueryResult(this._occlusionQuery);
                     this.isOcclusionQueryInProgress = false;
                     this._occlusionInternalRetryCounter = 0;
                     this._isOccluded = occlusionQueryResult === 1 ? false : true;
@@ -13875,7 +13882,6 @@ var BABYLON;
                 else {
                     this._occlusionInternalRetryCounter++;
                     if (this.occlusionRetryCount !== -1 && this._occlusionInternalRetryCounter > this.occlusionRetryCount) {
-                        // break;
                         this.isOcclusionQueryInProgress = false;
                         this._occlusionInternalRetryCounter = 0;
                         // if optimistic set isOccluded to false regardless of the status of isOccluded. (Render in the current render loop)
@@ -13889,7 +13895,10 @@ var BABYLON;
             }
             var scene = this.getScene();
             var occlusionBoundingBoxRenderer = scene.getBoundingBoxRenderer();
-            engine.beginQuery(this.occlusionQueryAlgorithmType, this.occlusionQuery);
+            if (!this._occlusionQuery) {
+                this._occlusionQuery = engine.createQuery();
+            }
+            engine.beginQuery(this.occlusionQueryAlgorithmType, this._occlusionQuery);
             occlusionBoundingBoxRenderer.renderOcclusionBoundingBox(this);
             engine.endQuery(this.occlusionQueryAlgorithmType);
             this.isOcclusionQueryInProgress = true;

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


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


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


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


File diff suppressed because it is too large
+ 2 - 2
dist/preview release/loaders/babylon.glTF1FileLoader.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


File diff suppressed because it is too large
+ 2 - 2
dist/preview release/loaders/babylon.glTFFileLoader.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/loaders/babylon.objFileLoader.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/materialsLibrary/babylon.customMaterial.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/materialsLibrary/babylon.waterMaterial.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js


+ 30 - 20
src/Mesh/babylon.abstractMesh.ts

@@ -128,22 +128,22 @@
         public definedFacingForward = true; // orientation for POV movement & rotation
         public position = Vector3.Zero();
 
-        private _webGLVersion = this.getEngine().webGLVersion;
-        private _occlusionInternalRetryCounter = 0;
+        public occlusionQueryAlgorithmType = AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE;
         public occlusionType = AbstractMesh.OCCLUSION_TYPE_NONE;
         public occlusionRetryCount = -1;
+        private _occlusionInternalRetryCounter = 0;
+
         protected _isOccluded = false;
         get isOccluded(): boolean {
             return this._isOccluded;
         }
-        set isOccluded(value: boolean) {
-            this._isOccluded = value;
-        }
 
-        public occlusionQuery = this.getEngine().createQuery();
-        public isOcclusionQueryInProgress = false;
+        private _isOcclusionQueryInProgress = false;
+        public get isOcclusionQueryInProgress(): boolean {
+            return this._isOcclusionQueryInProgress;
+        }
 
-        public occlusionQueryAlgorithmType = AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE;
+        private _occlusionQuery: WebGLQuery;
 
         private _rotation = Vector3.Zero();
         private _rotationQuaternion: Quaternion;
@@ -1788,8 +1788,15 @@
                 }
             }
 
+            // Query
+            let engine = this.getScene().getEngine();
+            if (this._occlusionQuery) {
+                engine.deleteQuery(this._occlusionQuery);
+                this._occlusionQuery = null;
+            }
+
             // Engine
-            this.getScene().getEngine().wipeCaches();
+            engine.wipeCaches();
 
             // Remove from scene
             this.getScene().removeMesh(this);
@@ -2271,20 +2278,20 @@
         }
 
         protected checkOcclusionQuery() {
-            if (this._webGLVersion < 2 || this.occlusionType === AbstractMesh.OCCLUSION_TYPE_NONE) {
+            var engine = this.getEngine();
+
+            if (engine.webGLVersion < 2 || this.occlusionType === AbstractMesh.OCCLUSION_TYPE_NONE) {
                 this._isOccluded = false;
                 return;
             }
 
-            var engine = this.getEngine();
-
             if (this.isOcclusionQueryInProgress) {
                 
-                var isOcclusionQueryAvailable = engine.isQueryResultAvailable(this.occlusionQuery);
+                var isOcclusionQueryAvailable = engine.isQueryResultAvailable(this._occlusionQuery);
                 if (isOcclusionQueryAvailable) {
-                    var occlusionQueryResult = engine.getQueryResult(this.occlusionQuery);
+                    var occlusionQueryResult = engine.getQueryResult(this._occlusionQuery);
 
-                    this.isOcclusionQueryInProgress = false;
+                    this._isOcclusionQueryInProgress = false;
                     this._occlusionInternalRetryCounter = 0;
                     this._isOccluded = occlusionQueryResult === 1 ? false : true;
                 }
@@ -2293,8 +2300,7 @@
                     this._occlusionInternalRetryCounter++;
 
                     if (this.occlusionRetryCount !== -1 && this._occlusionInternalRetryCounter > this.occlusionRetryCount) {
-                        // break;
-                        this.isOcclusionQueryInProgress = false;
+                        this._isOcclusionQueryInProgress = false;
                         this._occlusionInternalRetryCounter = 0;
 
                         // if optimistic set isOccluded to false regardless of the status of isOccluded. (Render in the current render loop)
@@ -2308,13 +2314,17 @@
                 }
             }
 
-
             var scene = this.getScene();
             var occlusionBoundingBoxRenderer = scene.getBoundingBoxRenderer();
-            engine.beginQuery(this.occlusionQueryAlgorithmType, this.occlusionQuery);
+
+            if (!this._occlusionQuery) {
+                this._occlusionQuery = engine.createQuery();
+            }
+
+            engine.beginQuery(this.occlusionQueryAlgorithmType, this._occlusionQuery);
             occlusionBoundingBoxRenderer.renderOcclusionBoundingBox(this);
             engine.endQuery(this.occlusionQueryAlgorithmType);
-            this.isOcclusionQueryInProgress = true;
+            this._isOcclusionQueryInProgress = true;
         }
 
     }

+ 11 - 3
src/babylon.engine.ts

@@ -4395,11 +4395,17 @@
             return this._gl.createQuery();
         }
 
-        public isQueryResultAvailable(query: WebGLQuery) {
+        public deleteQuery(query: WebGLQuery): Engine {
+            this.deleteQuery(query);
+
+            return this;
+        }
+
+        public isQueryResultAvailable(query: WebGLQuery): boolean {
             return this._gl.getQueryParameter(query, this._gl.QUERY_RESULT_AVAILABLE) as boolean;
         }
 
-        public getQueryResult(query: WebGLQuery) {
+        public getQueryResult(query: WebGLQuery): number {
             return this._gl.getQueryParameter(query, this._gl.QUERY_RESULT) as number;
         }
 
@@ -4408,9 +4414,11 @@
             this._gl.beginQuery(glAlgorithm, query);
         }
 
-        public endQuery(algorithmType: number) {
+        public endQuery(algorithmType: number): Engine {
             var glAlgorithm = this.getGlAlgorithmType(algorithmType);
             this._gl.endQuery(glAlgorithm);
+
+            return this;
         }
 
         private getGlAlgorithmType(algorithmType: number): number {

+ 1 - 0
src/babylon.mixins.ts

@@ -46,6 +46,7 @@ interface WebGLRenderingContext {
 
     // Occlusion Query
     createQuery(): WebGLQuery;
+    deleteQuery(query: WebGLQuery);
     beginQuery(target: number, query: WebGLQuery);
     endQuery(target: number): void;
     getQueryParameter(query: WebGLQuery, pname: number): any;