mirror of https://github.com/bjornbytes/lovr.git
Fix bug with mesh divisors;
This commit is contained in:
parent
0d81745282
commit
6f20126020
|
@ -46,6 +46,7 @@ typedef struct {
|
|||
Material* material;
|
||||
map_attribute_t attributes;
|
||||
MeshAttribute layout[MAX_ATTRIBUTES];
|
||||
uint16_t divisors[MAX_ATTRIBUTES];
|
||||
GPU_MESH_FIELDS
|
||||
} Mesh;
|
||||
|
||||
|
|
|
@ -504,7 +504,9 @@ static void lovrGpuBindMesh(Mesh* mesh, Shader* shader, int divisorMultiplier) {
|
|||
lovrBufferFlush(current.buffer);
|
||||
}
|
||||
|
||||
if (!memcmp(&previous, ¤t, sizeof(MeshAttribute))) {
|
||||
uint16_t divisor = current.divisor * divisorMultiplier;
|
||||
|
||||
if (!memcmp(&previous, ¤t, sizeof(MeshAttribute)) && mesh->divisors[i] == divisor) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -518,8 +520,9 @@ static void lovrGpuBindMesh(Mesh* mesh, Shader* shader, int divisorMultiplier) {
|
|||
}
|
||||
}
|
||||
|
||||
if (previous.divisor != current.divisor) {
|
||||
glVertexAttribDivisor(i, current.divisor * divisorMultiplier);
|
||||
if (mesh->divisors[i] != divisor) {
|
||||
glVertexAttribDivisor(i, divisor);
|
||||
mesh->divisors[i] = divisor;
|
||||
}
|
||||
|
||||
bool changed =
|
||||
|
|
Loading…
Reference in New Issue