Przeglądaj źródła

Fixing a bug with new cache engine

David Catuhe 11 lat temu
rodzic
commit
50c2f9700c

+ 8 - 2
Babylon/babylon.engine.js

@@ -656,6 +656,8 @@
         };
 
         Engine.prototype.clear = function (color, backBuffer, depthStencil) {
+            this.applyStates();
+
             this._gl.clearColor(color.r, color.g, color.b, color.a !== undefined ? color.a : 1.0);
             if (this._depthCullingState.depthMask) {
                 this._gl.clearDepth(1.0);
@@ -889,10 +891,14 @@
             }
         };
 
-        Engine.prototype.draw = function (useTriangles, indexStart, indexCount, instancesCount) {
-            // Apply states
+        Engine.prototype.applyStates = function () {
             this._depthCullingState.apply(this._gl);
             this._alphaState.apply(this._gl);
+        };
+
+        Engine.prototype.draw = function (useTriangles, indexStart, indexCount, instancesCount) {
+            // Apply states
+            this.applyStates();
 
             // Render
             if (instancesCount) {

+ 8 - 2
Babylon/babylon.engine.ts

@@ -663,6 +663,8 @@
         }
 
         public clear(color: any, backBuffer: boolean, depthStencil: boolean): void {
+            this.applyStates();
+
             this._gl.clearColor(color.r, color.g, color.b, color.a !== undefined ? color.a : 1.0);
             if (this._depthCullingState.depthMask) {
                 this._gl.clearDepth(1.0);
@@ -896,10 +898,14 @@
             }
         }
 
-        public draw(useTriangles: boolean, indexStart: number, indexCount: number, instancesCount?: number): void {
-            // Apply states
+        public applyStates() {
             this._depthCullingState.apply(this._gl);
             this._alphaState.apply(this._gl);
+        }
+
+        public draw(useTriangles: boolean, indexStart: number, indexCount: number, instancesCount?: number): void {
+            // Apply states
+            this.applyStates();
             
             // Render
             if (instancesCount) {

+ 8 - 2
babylon.1.14-beta-debug.js

@@ -3417,6 +3417,8 @@ var BABYLON;
         };
 
         Engine.prototype.clear = function (color, backBuffer, depthStencil) {
+            this.applyStates();
+
             this._gl.clearColor(color.r, color.g, color.b, color.a !== undefined ? color.a : 1.0);
             if (this._depthCullingState.depthMask) {
                 this._gl.clearDepth(1.0);
@@ -3650,10 +3652,14 @@ var BABYLON;
             }
         };
 
-        Engine.prototype.draw = function (useTriangles, indexStart, indexCount, instancesCount) {
-           
+        Engine.prototype.applyStates = function () {
             this._depthCullingState.apply(this._gl);
             this._alphaState.apply(this._gl);
+        };
+
+        Engine.prototype.draw = function (useTriangles, indexStart, indexCount, instancesCount) {
+           
+            this.applyStates();
 
            
             if (instancesCount) {

Plik diff jest za duży
+ 2 - 2
babylon.1.14-beta.js