Using mul for matrix x vector multiplications.

This commit is contained in:
Rinnegatamante
2020-10-17 20:54:10 +02:00
parent d0c7629b63
commit f0471b3be2
9 changed files with 29 additions and 27 deletions
+3 -3
View File
@@ -18,9 +18,9 @@ void main(
float out v_fog : FOG,
float4 out gl_Position : POSITION
) {
float4 Vertex = u_world * float4(in_pos, 1.0);
gl_Position = u_proj * u_view * Vertex;
float3 Normal = float3x3(u_world) * in_normal;
float4 Vertex = mul(u_world, float4(in_pos, 1.0));
gl_Position = mul(u_proj, mul(u_view, Vertex));
float3 Normal = mul(float3x3(u_world), in_normal);
v_tex0 = in_tex0;
+3 -3
View File
@@ -19,9 +19,9 @@ const char *default_vert_src =
" float out v_fog : FOG,\n"
" float4 out gl_Position : POSITION\n"
") {\n"
" float4 Vertex = u_world * float4(in_pos, 1.0);\n"
" gl_Position = u_proj * u_view * Vertex;\n"
" float3 Normal = float3x3(u_world) * in_normal;\n"
" float4 Vertex = mul(u_world, float4(in_pos, 1.0));\n"
" gl_Position = mul(u_proj, mul(u_view, Vertex));\n"
" float3 Normal = mul(float3x3(u_world), in_normal);\n"
" v_tex0 = in_tex0;\n"
+3 -3
View File
@@ -11,9 +11,9 @@ void main(
float out v_fog : FOG,
float4 out gl_Position : POSITION
) {
float4 Vertex = u_world * float4(in_pos, 1.0);
float4 CamVertex = u_view * Vertex;
gl_Position = u_proj * CamVertex;
float4 Vertex = mul(u_world, float4(in_pos, 1.0));
float4 CamVertex = mul(u_view, Vertex);
gl_Position = mul(u_proj, CamVertex);
v_color = in_color;
v_tex0 = in_tex0;
v_fog = DoFog(gl_Position.w, u_fogData);
+3 -3
View File
@@ -12,9 +12,9 @@ const char *im3d_vert_src =
" float out v_fog : FOG,\n"
" float4 out gl_Position : POSITION\n"
") {\n"
" float4 Vertex = u_world * float4(in_pos, 1.0);\n"
" float4 CamVertex = u_view * Vertex;\n"
" gl_Position = u_proj * CamVertex;\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"
" v_color = in_color;\n"
" v_tex0 = in_tex0;\n"
" v_fog = DoFog(gl_Position.w, u_fogData);\n"
+3 -3
View File
@@ -20,9 +20,9 @@ void main(
float out v_fog : FOG,
float4 out gl_Position : POSITION
) {
float4 Vertex = u_world * float4(in_pos, 1.0);
gl_Position = u_proj * u_view * Vertex;
float3 Normal = float3x3(u_world) * in_normal;
float4 Vertex = mul(u_world, float4(in_pos, 1.0));
gl_Position = mul(u_proj, mul(u_view, Vertex));
float3 Normal = mul(float3x3(u_world), in_normal);
v_tex0 = in_tex0;
v_tex1 = (u_texMatrix * float4(Normal, 1.0)).xy;
+3 -3
View File
@@ -21,9 +21,9 @@ const char *matfx_env_vert_src =
" float out v_fog : FOG,\n"
" float4 out gl_Position : POSITION\n"
") {\n"
" float4 Vertex = u_world * float4(in_pos, 1.0);\n"
" gl_Position = u_proj * u_view * Vertex;\n"
" float3 Normal = float3x3(u_world) * in_normal;\n"
" float4 Vertex = mul(u_world, float4(in_pos, 1.0));\n"
" gl_Position = mul(u_proj, mul(u_view, Vertex));\n"
" float3 Normal = mul(float3x3(u_world), in_normal);\n"
" v_tex0 = in_tex0;\n"
" v_tex1 = (u_texMatrix * float4(Normal, 1.0)).xy;\n"
+3 -1
View File
@@ -11,4 +11,6 @@ const char *simple_frag_src =
" DoAlphaTest(color.a, u_alphaRef);\n"
" \n"
" return color;\n"
"}\n";
"}\n"
;
+4 -4
View File
@@ -16,7 +16,7 @@ void main(
uniform float4 u_lightParams[MAX_LIGHTS],
uniform float4 u_lightDirection[MAX_LIGHTS],
uniform float4 u_lightColor[MAX_LIGHTS],
uniform float4x3 u_boneMatrices[64],
uniform float4x4 u_boneMatrices[64],
float4 out v_color : COLOR0,
float2 out v_tex0 : TEXCOORD0,
float out v_fog : FOG,
@@ -29,9 +29,9 @@ void main(
SkinNormal += (float3x3(u_boneMatrices[int(in_indices[i])]) * in_normal) * in_weights[i];
}
float4 Vertex = u_world * float4(SkinVertex, 1.0);
gl_Position = u_proj * u_view * Vertex;
float3 Normal = mat3(u_world) * SkinNormal;
float4 Vertex = mul(u_world, float4(SkinVertex, 1.0));
gl_Position = u_proj * mul(u_view, Vertex);
float3 Normal = mul(float3x3(u_world), SkinNormal);
v_tex0 = in_tex0;
+4 -4
View File
@@ -17,7 +17,7 @@ const char *skin_vert_src =
" uniform float4 u_lightParams[MAX_LIGHTS],\n"
" uniform float4 u_lightDirection[MAX_LIGHTS],\n"
" uniform float4 u_lightColor[MAX_LIGHTS],\n"
" uniform float4x3 u_boneMatrices[64],\n"
" uniform float4x4 u_boneMatrices[64],\n"
" float4 out v_color : COLOR0,\n"
" float2 out v_tex0 : TEXCOORD0,\n"
" float out v_fog : FOG,\n"
@@ -30,9 +30,9 @@ const char *skin_vert_src =
" SkinNormal += (float3x3(u_boneMatrices[int(in_indices[i])]) * in_normal) * in_weights[i];\n"
" }\n"
" float4 Vertex = u_world * float4(SkinVertex, 1.0);\n"
" gl_Position = u_proj * u_view * Vertex;\n"
" float3 Normal = mat3(u_world) * SkinNormal;\n"
" float4 Vertex = mul(u_world, float4(SkinVertex, 1.0));\n"
" gl_Position = u_proj * mul(u_view, Vertex);\n"
" float3 Normal = mul(float3x3(u_world), SkinNormal);\n"
" v_tex0 = in_tex0;\n"