Bläddra i källkod

Fix type of samplers depending on reflection type

Popov72 5 år sedan
förälder
incheckning
7efaec08b0

+ 7 - 2
src/Shaders/ShadersInclude/pbrBlockClearcoat.fx

@@ -75,8 +75,13 @@ struct clearcoatOutParams
             const in sampler2D reflectionSampler,
         #endif
         #ifndef LODBASEDMICROSFURACE
-            const in sampler2D reflectionSamplerLow,
-            const in sampler2D reflectionSamplerHigh,
+            #ifdef REFLECTIONMAP_3D
+                const in samplerCube reflectionSamplerLow,
+                const in samplerCube reflectionSamplerHigh,
+            #else
+                const in sampler2D reflectionSamplerLow,
+                const in sampler2D reflectionSamplerHigh,
+            #endif
         #endif
     #endif
     #if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)

+ 22 - 0
src/Shaders/ShadersInclude/pbrBlockReflection.fx

@@ -69,6 +69,15 @@
         const in sampler2D reflectionSampler,
         const vec2 reflectionCoords,
     #endif
+    #ifndef LODBASEDMICROSFURACE
+        #ifdef REFLECTIONMAP_3D
+            const in samplerCube reflectionSamplerLow,
+            const in samplerCube reflectionSamplerHigh,
+        #else
+            const in sampler2D reflectionSamplerLow,
+            const in sampler2D reflectionSamplerHigh,
+        #endif
+    #endif
         out vec4 environmentRadiance
     )
     {
@@ -171,6 +180,15 @@
             const in sampler2D irradianceSampler,
         #endif
     #endif
+    #ifndef LODBASEDMICROSFURACE
+        #ifdef REFLECTIONMAP_3D
+            const in samplerCube reflectionSamplerLow,
+            const in samplerCube reflectionSamplerHigh,
+        #else
+            const in sampler2D reflectionSamplerLow,
+            const in sampler2D reflectionSamplerHigh,
+        #endif
+    #endif
         out reflectionOutParams outParams
     )
     {
@@ -209,6 +227,10 @@
             reflectionSampler,
             reflectionCoords,
         #endif
+        #ifndef LODBASEDMICROSFURACE
+            reflectionSamplerLow,
+            reflectionSamplerHigh,
+        #endif
             environmentRadiance
         );
 

+ 11 - 2
src/Shaders/ShadersInclude/pbrBlockSheen.fx

@@ -52,8 +52,13 @@
         #endif
         const in float NdotVUnclamped,
         #ifndef LODBASEDMICROSFURACE
-            const in sampler2D reflectionSamplerLow,
-            const in sampler2D reflectionSamplerHigh,
+            #ifdef REFLECTIONMAP_3D
+                const in samplerCube reflectionSamplerLow,
+                const in samplerCube reflectionSamplerHigh,
+            #else
+                const in sampler2D reflectionSamplerLow,
+                const in sampler2D reflectionSamplerHigh,
+            #endif
         #endif
         #if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)
             const in float seo,
@@ -135,6 +140,10 @@
             #endif
                 reflectionSampler,
                 reflectionCoords,
+            #ifndef LODBASEDMICROSFURACE
+                reflectionSamplerLow,
+                reflectionSamplerHigh,
+            #endif
                 environmentSheenRadiance
             );
 

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

@@ -240,6 +240,10 @@ void main(void) {
         #ifdef USEIRRADIANCEMAP
             irradianceSampler,
         #endif
+        #ifndef LODBASEDMICROSFURACE
+            reflectionSamplerLow,
+            reflectionSamplerHigh,
+        #endif
             reflectionOut
         );
     #endif