diff --git a/src/gl/shaders/default.vert b/src/gl/shaders/default.vert index 889bd82..71b3d5f 100644 --- a/src/gl/shaders/default.vert +++ b/src/gl/shaders/default.vert @@ -18,9 +18,9 @@ void main( float out v_fog : FOG, float4 out gl_Position : POSITION ) { - float4 Vertex = mul(u_world, float4(in_pos, 1.0)); - gl_Position = mul(u_proj * u_view, Vertex); - float3 Normal = mul(float3x3(u_world), in_normal); + float4 Vertex = mul(float4(in_pos, 1.0), u_world); + gl_Position = mul(Vertex, u_view * u_proj); + float3 Normal = mul(in_normal, float3x3(u_world)); v_tex0 = in_tex0; diff --git a/src/gl/shaders/default_vs_gl3.inc b/src/gl/shaders/default_vs_gl3.inc index 7adbc56..9624d97 100644 --- a/src/gl/shaders/default_vs_gl3.inc +++ b/src/gl/shaders/default_vs_gl3.inc @@ -19,9 +19,9 @@ const char *default_vert_src = " float out v_fog : FOG,\n" " float4 out gl_Position : POSITION\n" ") {\n" -" float4 Vertex = mul(u_world, float4(in_pos, 1.0));\n" -" gl_Position = mul(u_proj * u_view, Vertex);\n" -" float3 Normal = mul(float3x3(u_world), in_normal);\n" +" float4 Vertex = mul(float4(in_pos, 1.0), u_world);\n" +" gl_Position = mul(Vertex, u_view * u_proj);\n" +" float3 Normal = mul(in_normal, float3x3(u_world));\n" " v_tex0 = in_tex0;\n" diff --git a/src/gl/shaders/im3d.vert b/src/gl/shaders/im3d.vert index 7368f3e..c616e3a 100644 --- a/src/gl/shaders/im3d.vert +++ b/src/gl/shaders/im3d.vert @@ -11,9 +11,9 @@ void main( float out v_fog : FOG, float4 out gl_Position : POSITION ) { - float4 Vertex = mul(u_world, float4(in_pos, 1.0)); - float4 CamVertex = mul(u_view, Vertex); - gl_Position = mul(u_proj, CamVertex); + float4 Vertex = mul(float4(in_pos, 1.0), u_world); + float4 CamVertex = mul(Vertex, u_view); + gl_Position = mul(CamVertex, u_proj); v_color = in_color; v_tex0 = in_tex0; v_fog = DoFog(gl_Position.w, u_fogData); diff --git a/src/gl/shaders/im3d_gl3.inc b/src/gl/shaders/im3d_gl3.inc index 54ceea4..26d811a 100644 --- a/src/gl/shaders/im3d_gl3.inc +++ b/src/gl/shaders/im3d_gl3.inc @@ -12,9 +12,9 @@ const char *im3d_vert_src = " float out v_fog : FOG,\n" " float4 out gl_Position : POSITION\n" ") {\n" -" float4 Vertex = mul(u_world, float4(in_pos, 1.0));\n" -" float4 CamVertex = mul(u_view, Vertex);\n" -" gl_Position = mul(u_proj, CamVertex);\n" +" float4 Vertex = mul(float4(in_pos, 1.0), u_world);\n" +" float4 CamVertex = mul(Vertex, u_view);\n" +" gl_Position = mul(CamVertex, u_proj);\n" " v_color = in_color;\n" " v_tex0 = in_tex0;\n" " v_fog = DoFog(gl_Position.w, u_fogData);\n" diff --git a/src/gl/shaders/matfx_env.vert b/src/gl/shaders/matfx_env.vert index 1cc2567..014884d 100644 --- a/src/gl/shaders/matfx_env.vert +++ b/src/gl/shaders/matfx_env.vert @@ -20,12 +20,12 @@ void main( float out v_fog : FOG, float4 out gl_Position : POSITION ) { - float4 Vertex = mul(u_world, float4(in_pos, 1.0)); - gl_Position = mul(u_proj * u_view, Vertex); - float3 Normal = mul(float3x3(u_world), in_normal); + float4 Vertex = mul(float4(in_pos, 1.0), u_world); + gl_Position = mul(Vertex, u_view * u_proj); + float3 Normal = mul(in_normal, float3x3(u_world)); v_tex0 = in_tex0; - v_tex1 = (mul(u_texMatrix, float4(Normal, 1.0))).xy; + v_tex1 = (mul(float4(Normal, 1.0), u_texMatrix)).xy; v_color = in_color; v_color.rgb += u_ambLight.rgb*surfAmbient; diff --git a/src/gl/shaders/matfx_gl3.inc b/src/gl/shaders/matfx_gl3.inc index 78a1c55..babf1b1 100644 --- a/src/gl/shaders/matfx_gl3.inc +++ b/src/gl/shaders/matfx_gl3.inc @@ -21,12 +21,12 @@ const char *matfx_env_vert_src = " float out v_fog : FOG,\n" " float4 out gl_Position : POSITION\n" ") {\n" -" float4 Vertex = mul(u_world, float4(in_pos, 1.0));\n" -" gl_Position = mul(u_proj * u_view, Vertex);\n" -" float3 Normal = mul(float3x3(u_world), in_normal);\n" +" float4 Vertex = mul(float4(in_pos, 1.0), u_world);\n" +" gl_Position = mul(Vertex, u_view * u_proj);\n" +" float3 Normal = mul(in_normal, float3x3(u_world));\n" " v_tex0 = in_tex0;\n" -" v_tex1 = (mul(u_texMatrix, float4(Normal, 1.0))).xy;\n" +" v_tex1 = (mul(float4(Normal, 1.0), u_texMatrix)).xy;\n" " v_color = in_color;\n" " v_color.rgb += u_ambLight.rgb*surfAmbient;\n" diff --git a/src/gl/shaders/skin.vert b/src/gl/shaders/skin.vert index 5b76d23..5235353 100644 --- a/src/gl/shaders/skin.vert +++ b/src/gl/shaders/skin.vert @@ -25,13 +25,13 @@ void main( float3 SkinVertex = float3(0.0, 0.0, 0.0); float3 SkinNormal = float3(0.0, 0.0, 0.0); for(int i = 0; i < 4; i++){ - SkinVertex += (mul(u_boneMatrices[int(in_indices[i])], float4(in_pos, 1.0))).xyz * in_weights[i]; - SkinNormal += (mul(float3x3(u_boneMatrices[int(in_indices[i])]), in_normal)) * in_weights[i]; + SkinVertex += (mul(float4(in_pos, 1.0), u_boneMatrices[int(in_indices[i])])).xyz * in_weights[i]; + SkinNormal += mul(in_normal, float3x3(u_boneMatrices[int(in_indices[i])])) * in_weights[i]; } - - float4 Vertex = mul(u_world, float4(SkinVertex, 1.0)); - gl_Position = mul(u_proj * u_view, Vertex); - float3 Normal = mul(float3x3(u_world), SkinNormal); + + float4 Vertex = mul(float4(SkinVertex, 1.0), u_world); + gl_Position = mul(Vertex, u_view * u_proj); + float3 Normal = mul(SkinNormal, float3x3(u_world)); v_tex0 = in_tex0; diff --git a/src/gl/shaders/skin_gl3.inc b/src/gl/shaders/skin_gl3.inc index 74229b5..dae7bbc 100644 --- a/src/gl/shaders/skin_gl3.inc +++ b/src/gl/shaders/skin_gl3.inc @@ -26,13 +26,13 @@ const char *skin_vert_src = " float3 SkinVertex = float3(0.0, 0.0, 0.0);\n" " float3 SkinNormal = float3(0.0, 0.0, 0.0);\n" " for(int i = 0; i < 4; i++){\n" -" SkinVertex += (mul(u_boneMatrices[int(in_indices[i])], float4(in_pos, 1.0))).xyz * in_weights[i];\n" -" SkinNormal += (mul(float3x3(u_boneMatrices[int(in_indices[i])]), in_normal)) * in_weights[i];\n" +" SkinVertex += (mul(float4(in_pos, 1.0), u_boneMatrices[int(in_indices[i])])).xyz * in_weights[i];\n" +" SkinNormal += mul(in_normal, float3x3(u_boneMatrices[int(in_indices[i])])) * in_weights[i];\n" " }\n" - -" float4 Vertex = mul(u_world, float4(SkinVertex, 1.0));\n" -" gl_Position = mul(u_proj * u_view, Vertex);\n" -" float3 Normal = mul(float3x3(u_world), SkinNormal);\n" +" \n" +" float4 Vertex = mul(float4(SkinVertex, 1.0), u_world);\n" +" gl_Position = mul(Vertex, u_view * u_proj);\n" +" float3 Normal = mul(SkinNormal, float3x3(u_world));\n" " v_tex0 = in_tex0;\n"