mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-28 05:58:30 +00:00
Fix fragPosition using wrong matrix in lighting_instancing.vs (#4056)
fragPosition was multiplied by mvp*instanceTransform, but it should only be multiplied by instanceTransform. Compare to lighting.vs, there we only use mvp for gl_Position, but matModel for the fragPosition.
This commit is contained in:
@@ -22,15 +22,12 @@ out vec3 fragNormal;
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
// Compute MVP for current instance
|
|
||||||
mat4 mvpi = mvp*instanceTransform;
|
|
||||||
|
|
||||||
// Send vertex attributes to fragment shader
|
// Send vertex attributes to fragment shader
|
||||||
fragPosition = vec3(mvpi*vec4(vertexPosition, 1.0));
|
fragPosition = vec3(instanceTransform*vec4(vertexPosition, 1.0));
|
||||||
fragTexCoord = vertexTexCoord;
|
fragTexCoord = vertexTexCoord;
|
||||||
//fragColor = vertexColor;
|
//fragColor = vertexColor;
|
||||||
fragNormal = normalize(vec3(matNormal*vec4(vertexNormal, 1.0)));
|
fragNormal = normalize(vec3(matNormal*vec4(vertexNormal, 1.0)));
|
||||||
|
|
||||||
// Calculate final vertex position
|
// Calculate final vertex position, note that we multiply mvp by instanceTransform
|
||||||
gl_Position = mvpi*vec4(vertexPosition, 1.0);
|
gl_Position = mvp*instanceTransform*vec4(vertexPosition, 1.0);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user