소스 검색

compat webgl1

Benjamin Guignabert 4 년 전
부모
커밋
1d46eff72f
4개의 변경된 파일15개의 추가작업 그리고 9개의 파일을 삭제
  1. 0 1
      materialsLibrary/src/mix/mixMaterial.ts
  2. 7 5
      src/Shaders/ShadersInclude/prePassDeclaration.fx
  3. 4 1
      src/Shaders/default.fragment.fx
  4. 4 2
      src/Shaders/pbr.fragment.fx

+ 0 - 1
materialsLibrary/src/mix/mixMaterial.ts

@@ -249,7 +249,6 @@ export class MixMaterial extends PushMaterial {
 
             defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;
 
-
             //Attributes
             var attribs = [VertexBuffer.PositionKind];
 

+ 7 - 5
src/Shaders/ShadersInclude/prePassDeclaration.fx

@@ -1,14 +1,16 @@
 #ifdef PREPASS
 #extension GL_EXT_draw_buffers : require
-layout(location = 0) out vec4 glFragData[{X}];
-vec4 gl_FragColor;
+#ifdef WEBGL2
+layout(location = 0) out highp vec4 glFragData[{X}];
+highp vec4 gl_FragColor;
+#endif
 
 #ifdef PREPASS_DEPTHNORMAL
-    varying vec3 vViewPos;
+    varying highp vec3 vViewPos;
 #endif
 #ifdef PREPASS_VELOCITY
-    varying vec4 vCurrentPosition;
-    varying vec4 vPreviousPosition;
+    varying highp vec4 vCurrentPosition;
+    varying highp vec4 vPreviousPosition;
 #endif
 
 #endif

+ 4 - 1
src/Shaders/default.fragment.fx

@@ -512,6 +512,9 @@ color.rgb = max(color.rgb, 0.);
         #endif
     #endif
 #endif
-	gl_FragColor = color;
+
+#if !defined(PREPASS) || defined(WEBGL2) 
+	gl_FragColor = finalColor;
+#endif
 
 }

+ 4 - 2
src/Shaders/pbr.fragment.fx

@@ -12,10 +12,10 @@
 #extension GL_EXT_frag_depth : enable
 #endif
 
-precision highp float;
-
 #include<prePassDeclaration>[SCENE_MRT_COUNT]
 
+precision highp float;
+
 // Forces linear space for image processing
 #ifndef FROMLINEARSPACE
     #define FROMLINEARSPACE
@@ -554,6 +554,8 @@ void main(void) {
     #endif
 #endif
 
+#if !defined(PREPASS) || defined(WEBGL2) 
     gl_FragColor = finalColor;
+#endif
     #include<pbrDebug>
 }