David Catuhe 7 anos atrás
pai
commit
5bba3edc84

Diferenças do arquivo suprimidas por serem muito extensas
+ 5676 - 5673
dist/preview release/babylon.d.ts


Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 1
dist/preview release/babylon.js


Diferenças do arquivo suprimidas por serem muito extensas
+ 36 - 32
dist/preview release/babylon.max.js


Diferenças do arquivo suprimidas por serem muito extensas
+ 36 - 32
dist/preview release/babylon.no-module.max.js


Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 1
dist/preview release/babylon.worker.js


Diferenças do arquivo suprimidas por serem muito extensas
+ 36 - 32
dist/preview release/es6.js


+ 14 - 12
src/Engine/Extensions/babylon.engine.occlusionQuery.ts

@@ -250,20 +250,22 @@ module BABYLON {
 
     // We also need to update AbstractMesh as there is a portion of the code there
     AbstractMesh.prototype._checkOcclusionQuery = function() {
+        let dataStorage = this._occlusionDataStorage;
+
         if (this.occlusionType === AbstractMesh.OCCLUSION_TYPE_NONE) {
-            this._isOccluded = false;
+            dataStorage.isOccluded = false;
             return;
         }
 
         var engine = this.getEngine();
 
         if (engine.webGLVersion < 2) {
-            this._isOccluded = false;
+            dataStorage.isOccluded = false;
             return;
         }
 
         if (!engine.isQueryResultAvailable) { // Occlusion query where not referenced
-            this._isOccluded = false;
+            dataStorage.isOccluded = false;
             return;
         }
 
@@ -273,21 +275,21 @@ module BABYLON {
             if (isOcclusionQueryAvailable) {
                 var occlusionQueryResult = engine.getQueryResult(this._occlusionQuery);
 
-                this._isOcclusionQueryInProgress = false;
-                this._occlusionInternalRetryCounter = 0;
-                this._isOccluded = occlusionQueryResult === 1 ? false : true;
+                dataStorage.isOcclusionQueryInProgress = false;
+                dataStorage.occlusionInternalRetryCounter = 0;
+                dataStorage.isOccluded = occlusionQueryResult === 1 ? false : true;
             }
             else {
 
-                this._occlusionInternalRetryCounter++;
+                dataStorage.occlusionInternalRetryCounter++;
 
-                if (this.occlusionRetryCount !== -1 && this._occlusionInternalRetryCounter > this.occlusionRetryCount) {
-                    this._isOcclusionQueryInProgress = false;
-                    this._occlusionInternalRetryCounter = 0;
+                if (this.occlusionRetryCount !== -1 && dataStorage.occlusionInternalRetryCounter > this.occlusionRetryCount) {
+                    dataStorage.isOcclusionQueryInProgress = false;
+                    dataStorage.occlusionInternalRetryCounter = 0;
 
                     // if optimistic set isOccluded to false regardless of the status of isOccluded. (Render in the current render loop)
                     // if strict continue the last state of the object.
-                    this._isOccluded = this.occlusionType === AbstractMesh.OCCLUSION_TYPE_OPTIMISTIC ? false : this._isOccluded;
+                    dataStorage.isOccluded = this.occlusionType === AbstractMesh.OCCLUSION_TYPE_OPTIMISTIC ? false : dataStorage.isOccluded;
                 }
                 else {
                     return;
@@ -307,7 +309,7 @@ module BABYLON {
             engine.beginOcclusionQuery(this.occlusionQueryAlgorithmType, this._occlusionQuery);
             occlusionBoundingBoxRenderer.renderOcclusionBoundingBox(this);
             engine.endOcclusionQuery(this.occlusionQueryAlgorithmType);
-            this._isOcclusionQueryInProgress = true;
+            this._occlusionDataStorage.isOcclusionQueryInProgress = true;
         }
     } 
 }

+ 19 - 11
src/Mesh/babylon.abstractMesh.ts

@@ -1,4 +1,17 @@
 module BABYLON {
+
+    /** @hidden */
+    class _OcclusionDataStorage {
+        /** @hidden */
+        public occlusionInternalRetryCounter = 0;
+
+        /** @hidden */
+        public isOccluded = false;
+
+        /** @hidden */
+        public isOcclusionQueryInProgress = false;
+    }
+
     /**
      * Class used to store all common mesh properties
      */
@@ -213,33 +226,28 @@
         * @see http://doc.babylonjs.com/features/occlusionquery
         */
         public occlusionRetryCount = -1;
-        /** @hidden */
-        public _occlusionInternalRetryCounter = 0;
 
         /** @hidden */
-        public _isOccluded = false;
+        public _occlusionDataStorage: _OcclusionDataStorage;
 
         /**
         * Gets or sets whether the mesh is occluded or not, it is used also to set the intial state of the mesh to be occluded or not
         * @see http://doc.babylonjs.com/features/occlusionquery
         */
         public get isOccluded(): boolean {
-            return this._isOccluded;
+            return this._occlusionDataStorage.isOccluded;
         }
 
         public set isOccluded(value: boolean) {
-            this._isOccluded = value;
+            this._occlusionDataStorage.isOccluded = value;
         }
 
-        /** @hidden */
-        public _isOcclusionQueryInProgress = false;
-
         /**
          * Flag to check the progress status of the query
          * @see http://doc.babylonjs.com/features/occlusionquery
          */
         public get isOcclusionQueryInProgress(): boolean {
-            return this._isOcclusionQueryInProgress;
+            return this._occlusionDataStorage.isOcclusionQueryInProgress;
         }
 
         /** @hidden */
@@ -1483,7 +1491,7 @@
             // Query
             let engine = this.getScene().getEngine();
             if (this._occlusionQuery) {
-                this._isOcclusionQueryInProgress = false;
+                this._occlusionDataStorage.isOcclusionQueryInProgress = false;
                 engine.deleteQuery(this._occlusionQuery);
                 this._occlusionQuery = null;
             }
@@ -1952,7 +1960,7 @@
 
         /** @hidden */
         public _checkOcclusionQuery() { // Will be replaced by correct code if Occlusion queries are referenced
-            this._isOccluded = false;
+            this._occlusionDataStorage.isOccluded = false;
         }
     }
 }

+ 1 - 1
src/Mesh/babylon.mesh.ts

@@ -1482,7 +1482,7 @@
         public render(subMesh: SubMesh, enableAlphaMode: boolean): Mesh {
 
             this._checkOcclusionQuery();
-            if (this._isOccluded) {
+            if (this._occlusionDataStorage.isOccluded) {
                 return this;
             }