mirror of
https://github.com/raysan5/raylib.git
synced 2026-01-09 21:18:44 +01:00
Fix DrawMeshInstanced breaking if instanceTransform is unused (#5469)
This commit is contained in:
@ -1762,11 +1762,14 @@ void DrawMeshInstanced(Mesh mesh, Material material, const Matrix *transforms, i
|
||||
instancesVboId = rlLoadVertexBuffer(instanceTransforms, instances*sizeof(float16), false);
|
||||
|
||||
// Instances transformation matrices are sent to shader attribute location: SHADER_LOC_VERTEX_INSTANCE_TX
|
||||
for (unsigned int i = 0; i < 4; i++)
|
||||
if (material.shader.locs[SHADER_LOC_VERTEX_INSTANCE_TX] != -1)
|
||||
{
|
||||
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_INSTANCE_TX] + i);
|
||||
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_INSTANCE_TX] + i, 4, RL_FLOAT, 0, sizeof(Matrix), i*sizeof(Vector4));
|
||||
rlSetVertexAttributeDivisor(material.shader.locs[SHADER_LOC_VERTEX_INSTANCE_TX] + i, 1);
|
||||
for (unsigned int i = 0; i < 4; i++)
|
||||
{
|
||||
rlEnableVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_INSTANCE_TX] + i);
|
||||
rlSetVertexAttribute(material.shader.locs[SHADER_LOC_VERTEX_INSTANCE_TX] + i, 4, RL_FLOAT, 0, sizeof(Matrix), i*sizeof(Vector4));
|
||||
rlSetVertexAttributeDivisor(material.shader.locs[SHADER_LOC_VERTEX_INSTANCE_TX] + i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
rlDisableVertexBuffer();
|
||||
|
||||
Reference in New Issue
Block a user