Minor improvements for non-instanced shaders

This commit is contained in:
Benau 2016-12-23 19:22:30 +08:00
parent 989234a0ba
commit 15d6c7207a
5 changed files with 5 additions and 5 deletions

View File

@ -15,7 +15,7 @@ out vec2 uv_bis;
out float camdist; out float camdist;
void main() { void main() {
gl_Position = ProjectionMatrix * ViewMatrix * ModelMatrix * vec4(Position, 1.); gl_Position = ProjectionViewMatrix * ModelMatrix * vec4(Position, 1.);
uv = Texcoord; uv = Texcoord;
uv_bis = SecondTexcoord; uv_bis = SecondTexcoord;
camdist = length(ViewMatrix * ModelMatrix * vec4(Position, 1.)); camdist = length(ViewMatrix * ModelMatrix * vec4(Position, 1.));

View File

@ -28,7 +28,7 @@ void main()
// affects "nor" which is later only * 0.1 by scattering // affects "nor" which is later only * 0.1 by scattering
new_inverse_model_matrix[3].xyz -= windDir * Color.r; new_inverse_model_matrix[3].xyz -= windDir * Color.r;
mat4 ModelViewProjectionMatrix = ProjectionMatrix * ViewMatrix * new_model_matrix; mat4 ModelViewProjectionMatrix = ProjectionViewMatrix * new_model_matrix;
mat4 TransposeInverseModelView = transpose(InverseViewMatrix * new_inverse_model_matrix); mat4 TransposeInverseModelView = transpose(InverseViewMatrix * new_inverse_model_matrix);
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.); gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
nor = (TransposeInverseModelView * vec4(Normal, 0.)).xyz; nor = (TransposeInverseModelView * vec4(Normal, 0.)).xyz;

View File

@ -46,7 +46,7 @@ out vec4 color;
void main(void) void main(void)
{ {
color = Color.zyxw; color = Color.zyxw;
mat4 ModelViewProjectionMatrix = ProjectionMatrix * ViewMatrix * ModelMatrix; mat4 ModelViewProjectionMatrix = ProjectionViewMatrix * ModelMatrix;
mat4 TransposeInverseModelView = transpose(InverseModelMatrix * InverseViewMatrix); mat4 TransposeInverseModelView = transpose(InverseModelMatrix * InverseViewMatrix);
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.); gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
// Keep orthogonality // Keep orthogonality

View File

@ -14,7 +14,7 @@ void main(void)
float gz = int(gl_VertexID >> 9) & (resolution.z - 1); float gz = int(gl_VertexID >> 9) & (resolution.z - 1);
uvw = vec3(gx, gy, gz) / vec3(resolution); uvw = vec3(gx, gy, gz) / vec3(resolution);
vec3 WorldPos = (2. * uvw - 1.) * extents; vec3 WorldPos = (2. * uvw - 1.) * extents;
gl_Position = ProjectionMatrix * ViewMatrix * RHMatrix * vec4(WorldPos, 1.); gl_Position = ProjectionViewMatrix * RHMatrix * vec4(WorldPos, 1.);
gl_PointSize = 500. / gl_Position.w; gl_PointSize = 500. / gl_Position.w;
} }

View File

@ -69,7 +69,7 @@ void main(void)
skinned_bitangent += Weight[i] * single_bone_influenced_bitangent; skinned_bitangent += Weight[i] * single_bone_influenced_bitangent;
} }
gl_Position = ProjectionMatrix * ViewMatrix * ModelMatrix * skinned_position; gl_Position = ProjectionViewMatrix * ModelMatrix * skinned_position;
// Keep orthogonality // Keep orthogonality
nor = (TransposeInverseModelView * skinned_normal).xyz; nor = (TransposeInverseModelView * skinned_normal).xyz;
// Keep direction // Keep direction