Skip to content

Commit 646e674

Browse files
committed
GLSLCompat: The Matrix3 Sub-Constructor is called mat3_sub and defers to the builtin mat3 if available.
1 parent 2276197 commit 646e674

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ out vec4 outFragColor;
4343
#endif
4444

4545
#if __VERSION__ == 110
46-
mat3 mat3(mat4 m) {
46+
mat3 mat3_sub(mat4 m) {
4747
return mat3(m[0].xyz, m[1].xyz, m[2].xyz);
4848
}
49+
#else
50+
#define mat3_sub mat3
4951
#endif
5052

5153
#if __VERSION__ <= 140

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ float renderProbe(vec3 viewDir, vec3 worldPos, vec3 normal, vec3 norm, float Rou
143143

144144
if(lightProbeData[0][3] != 0.0){
145145
// oriented box probe
146-
mat3 wToLocalRot = inverse(mat3(lightProbeData));
146+
// mat3_sub our compat wrapper for mat3(mat4)
147+
mat3 wToLocalRot = inverse(mat3_sub(lightProbeData));
147148

148149
vec3 scale = vec3(lightProbeData[0][3], lightProbeData[1][3], lightProbeData[2][3]);
149150
#if NB_PROBES >= 2

0 commit comments

Comments
 (0)