Kaynağa Gözat

GLSLCompat: The Matrix3 Sub-Constructor is called mat3_sub and defers to the builtin mat3 if available.

MeFisto94 5 yıl önce
ebeveyn
işleme
646e6741b9

+ 3 - 1
jme3-core/src/main/resources/Common/ShaderLib/GLSLCompat.glsllib

@@ -43,9 +43,11 @@ out vec4 outFragColor;
 #endif
 
 #if __VERSION__ == 110
-mat3 mat3(mat4 m) {
+mat3 mat3_sub(mat4 m) {
   return mat3(m[0].xyz, m[1].xyz, m[2].xyz);
 }
+#else
+ #define mat3_sub mat3
 #endif
 
 #if __VERSION__ <= 140

+ 2 - 1
jme3-core/src/main/resources/Common/ShaderLib/PBR.glsllib

@@ -143,7 +143,8 @@ float renderProbe(vec3 viewDir, vec3 worldPos, vec3 normal, vec3 norm, float Rou
 
     if(lightProbeData[0][3] != 0.0){
         // oriented box probe
-        mat3 wToLocalRot = inverse(mat3(lightProbeData));
+        // mat3_sub our compat wrapper for mat3(mat4)
+        mat3 wToLocalRot = inverse(mat3_sub(lightProbeData));
 
         vec3 scale = vec3(lightProbeData[0][3], lightProbeData[1][3], lightProbeData[2][3]);
         #if NB_PROBES >= 2