Преглед изворни кода

IOS WebGLRenderingContext constants undefined

sebavan пре 9 година
родитељ
комит
e8e2c279c1
3 измењених фајлова са 87 додато и 8 уклоњено
  1. 4 4
      src/Layer/babylon.highlightlayer.ts
  2. 4 4
      src/States/babylon.stencilState.ts
  3. 79 0
      src/babylon.engine.ts

+ 4 - 4
src/Layer/babylon.highlightlayer.ts

@@ -421,8 +421,8 @@
          * @return true if ready otherwise, false
          */
         private isReady(subMesh: SubMesh, useInstances: boolean): boolean {
-            if (!subMesh.getMaterial().isReady()) {
-                return false;
+            if (!subMesh.getMaterial().isReady()) {
+                return false;
             }
 
             var defines = [];
@@ -523,12 +523,12 @@
 
             if (this.outerGlow) {
                 currentEffect.setFloat("offset", 0);
-                engine.setStencilFunction(WebGLRenderingContext.NOTEQUAL);
+                engine.setStencilFunction(Engine.NOTEQUAL);
                 engine.draw(true, 0, 6);
             }
             if (this.innerGlow) {
                 currentEffect.setFloat("offset", 1);
-                engine.setStencilFunction(WebGLRenderingContext.EQUAL);
+                engine.setStencilFunction(Engine.EQUAL);
                 engine.draw(true, 0, 6);
             }
 

+ 4 - 4
src/States/babylon.stencilState.ts

@@ -133,13 +133,13 @@
             this._stencilTest = false;
             this._stencilMask = 0xFF;
 
-            this._stencilFunc = 0x0207; //WebGLRenderingContext.ALWAYS;
+            this._stencilFunc = Engine.ALWAYS;
             this._stencilFuncRef = 1;
             this._stencilFuncMask = 0xFF;
 
-            this._stencilOpStencilFail = 0x1E00; //WebGLRenderingContext.KEEP;
-            this._stencilOpDepthFail = 0x1E00; //WebGLRenderingContext.KEEP;
-            this._stencilOpStencilDepthPass = 0x1E01; //WebGLRenderingContext.REPLACE;
+            this._stencilOpStencilFail = Engine.KEEP;
+            this._stencilOpDepthFail = Engine.KEEP;
+            this._stencilOpStencilDepthPass = Engine.REPLACE;
 
             this._isStencilTestDirty = true;
             this._isStencilMaskDirty = true;

+ 79 - 0
src/babylon.engine.ts

@@ -219,6 +219,85 @@
         private static _TEXTURETYPE_FLOAT = 1;
         private static _TEXTURETYPE_HALF_FLOAT = 2;
 
+        // Depht or Stencil test Constants.
+        private static _NEVER =     0x0200; //	Passed to depthFunction or stencilFunction to specify depth or stencil tests will never pass. i.e. Nothing will be drawn.
+        private static _ALWAYS =    0x0207; //	Passed to depthFunction or stencilFunction to specify depth or stencil tests will always pass. i.e. Pixels will be drawn in the order they are drawn.
+        private static _LESS =      0x0201; //	Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than the stored value.
+        private static _EQUAL =     0x0202; //	Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is equals to the stored value.
+        private static _LEQUAL =    0x0203; //	Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than or equal to the stored value.
+        private static _GREATER =   0x0204; //	Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than the stored value.
+        private static _GEQUAL =    0x0206; //	Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than or equal to the stored value.
+        private static _NOTEQUAL =  0x0205; //  Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is not equal to the stored value.
+
+        public static get NEVER(): number {
+            return Engine.NEVER;
+        }
+
+        public static get ALWAYS(): number {
+            return Engine.ALWAYS;
+        }
+
+        public static get LESS(): number {
+            return Engine.LESS;
+        }
+
+        public static get EQUAL(): number {
+            return Engine.EQUAL;
+        }
+
+        public static get LEQUAL(): number {
+            return Engine.LEQUAL;
+        }
+
+        public static get GREATER(): number {
+            return Engine.GREATER;
+        }
+
+        public static get GEQUAL(): number {
+            return Engine.GEQUAL;
+        }
+
+        public static get NOTEQUAL(): number {
+            return Engine.NOTEQUAL;
+        }
+
+        // Stencil Actions Constants.
+        private static _KEEP =	    0x1E00; 
+        private static _REPLACE =	0x1E01; 
+        private static _INCR =	    0x1E02; 
+        private static _DECR =	    0x1E03; 
+        private static _INVERT =	0x150A; 
+        private static _INCR_WRAP =	0x8507; 
+        private static _DECR_WRAP =	0x8508;
+
+        public static get KEEP(): number {
+            return Engine.KEEP;
+        }
+
+        public static get REPLACE(): number {
+            return Engine.REPLACE;
+        }
+
+        public static get INCR(): number {
+            return Engine.INCR;
+        }
+
+        public static get DECR(): number {
+            return Engine.DECR;
+        }
+
+        public static get INVERT(): number {
+            return Engine.INVERT;
+        }
+
+        public static get INCR_WRAP(): number {
+            return Engine.INCR_WRAP;
+        }
+
+        public static get DECR_WRAP(): number {
+            return Engine.DECR_WRAP;
+        }        
+
         public static get ALPHA_DISABLE(): number {
             return Engine._ALPHA_DISABLE;
         }