From f68d88937fb54a44d30213ec7b4be25ddc452faa Mon Sep 17 00:00:00 2001 From: MeFisto94 Date: Sat, 4 Apr 2020 14:07:58 +0200 Subject: [PATCH] GLSLCompat: The Matrix3 Sub-Constructor is called mat3_sub and defers to the builtin mat3 if available. --- .../src/main/resources/Common/ShaderLib/GLSLCompat.glsllib | 4 +++- jme3-core/src/main/resources/Common/ShaderLib/PBR.glsllib | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/jme3-core/src/main/resources/Common/ShaderLib/GLSLCompat.glsllib b/jme3-core/src/main/resources/Common/ShaderLib/GLSLCompat.glsllib index c8eddf308..180559562 100644 --- a/jme3-core/src/main/resources/Common/ShaderLib/GLSLCompat.glsllib +++ b/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 diff --git a/jme3-core/src/main/resources/Common/ShaderLib/PBR.glsllib b/jme3-core/src/main/resources/Common/ShaderLib/PBR.glsllib index bf23d547d..d27c0222f 100644 --- a/jme3-core/src/main/resources/Common/ShaderLib/PBR.glsllib +++ b/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