Add mtxFromCols3/4 as macros to allow for const global matrices. (#1934)

This commit is contained in:
Martijn Courteaux 2019-11-04 01:49:07 +01:00 committed by Бранимир Караџић
parent 3a78f007ef
commit f3ca372d85

View File

@ -593,7 +593,6 @@ mat4 mtxFromRows(vec4 _0, vec4 _1, vec4 _2, vec4 _3)
return mat4(_0, _1, _2, _3);
#endif // BGFX_SHADER_LANGUAGE_GLSL
}
mat4 mtxFromCols(vec4 _0, vec4 _1, vec4 _2, vec4 _3)
{
#if BGFX_SHADER_LANGUAGE_GLSL
@ -602,7 +601,14 @@ mat4 mtxFromCols(vec4 _0, vec4 _1, vec4 _2, vec4 _3)
return transpose(mat4(_0, _1, _2, _3) );
#endif // BGFX_SHADER_LANGUAGE_GLSL
}
mat3 mtxFromRows(vec3 _0, vec3 _1, vec3 _2)
{
#if BGFX_SHADER_LANGUAGE_GLSL
return transpose(mat3(_0, _1, _2) );
#else
return mat3(_0, _1, _2);
#endif // BGFX_SHADER_LANGUAGE_GLSL
}
mat3 mtxFromCols(vec3 _0, vec3 _1, vec3 _2)
{
#if BGFX_SHADER_LANGUAGE_GLSL
@ -612,6 +618,30 @@ mat3 mtxFromCols(vec3 _0, vec3 _1, vec3 _2)
#endif // BGFX_SHADER_LANGUAGE_GLSL
}
#if BGFX_SHADER_LANGUAGE_GLSL
#define mtxFromRows4(_0, _1, _2, _3) transpose(mat4(_0, _1, _2, _3))
#else
#define mtxFromRows4(_0, _1, _2, _3) mat4(_0, _1, _2, _3)
#endif // BGFX_SHADER_LANGUAGE_GLSL
#if BGFX_SHADER_LANGUAGE_GLSL
#define mtxFromRows3(_0, _1, _2) transpose(mat3(_0, _1, _2))
#else
#define mtxFromRows3(_0, _1, _2) mat3(_0, _1, _2)
#endif // BGFX_SHADER_LANGUAGE_GLSL
#if BGFX_SHADER_LANGUAGE_GLSL
#define mtxFromCols4(_0, _1, _2, _3) mat4(_0, _1, _2, _3)
#else
#define mtxFromCols4(_0, _1, _2, _3) transpose(mat4(_0, _1, _2, _3))
#endif // BGFX_SHADER_LANGUAGE_GLSL
#if BGFX_SHADER_LANGUAGE_GLSL
#define mtxFromCols3(_0, _1, _2) mat3(_0, _1, _2)
#else
#define mtxFromCols3(_0, _1, _2) transpose(mat3(_0, _1, _2))
#endif // BGFX_SHADER_LANGUAGE_GLSL
uniform vec4 u_viewRect;
uniform vec4 u_viewTexel;
uniform mat4 u_view;