Forráskód Böngészése

Set position.y *= -1 back in the shaders - avoid to update the post process shaders

Popov72 4 éve
szülő
commit
6bffc288a9

+ 1 - 1
src/Engines/WebGPU/webgpuShaderProcessors.ts

@@ -233,7 +233,7 @@ export class WebGPUShaderProcessor implements IShaderProcessor {
         if (!isFragment) {
             const lastClosingCurly = code.lastIndexOf("}");
             code = code.substring(0, lastClosingCurly);
-            code += "/*gl_Position.y *= -1.;*/\ngl_Position.z = (gl_Position.z + gl_Position.w) / 2.0; }";
+            code += "gl_Position.y *= -1.;\ngl_Position.z = (gl_Position.z + gl_Position.w) / 2.0; }";
         }
 
         let sci = new ShaderCodeInliner(code);

+ 5 - 2
src/Engines/webgpuEngine.ts

@@ -259,6 +259,9 @@ export class WebGPUEngine extends Engine {
         this._mainPassSampleCount = options.antialiasing ? this._defaultSampleCount : 1;
 
         this._sharedInit(canvas, !!options.doNotHandleTouchAction, options.audioEngine);
+
+        // TODO. WEBGPU. Use real way to do it.
+        this._canvas.style.transform = "scaleY(-1)";
     }
 
     //------------------------------------------------------------------------------
@@ -2251,9 +2254,9 @@ export class WebGPUEngine extends Engine {
     private _getFrontFace(): GPUFrontFace {
         switch (this._depthCullingState.frontFace) {
             case 1:
-                return WebGPUConstants.FrontFace.CW;
-            default:
                 return WebGPUConstants.FrontFace.CCW;
+            default:
+                return WebGPUConstants.FrontFace.CW;
         }
     }