Use animation vertices on initial load if possible.
This commit is contained in:
parent
c9c84c8279
commit
8f491d88dd
|
|
@ -844,7 +844,8 @@ void UploadMesh(Mesh *mesh, bool dynamic)
|
||||||
// NOTE: Attributes must be uploaded considering default locations points
|
// NOTE: Attributes must be uploaded considering default locations points
|
||||||
|
|
||||||
// Enable vertex attributes: position (shader-location = 0)
|
// Enable vertex attributes: position (shader-location = 0)
|
||||||
mesh->vboId[0] = rlLoadVertexBuffer(mesh->vertices, mesh->vertexCount*3*sizeof(float), dynamic);
|
void* vertices = mesh->animVertices != NULL ? mesh->animVertices : mesh->vertices;
|
||||||
|
mesh->vboId[0] = rlLoadVertexBuffer(vertices, mesh->vertexCount*3*sizeof(float), dynamic);
|
||||||
rlSetVertexAttribute(0, 3, RL_FLOAT, 0, 0, 0);
|
rlSetVertexAttribute(0, 3, RL_FLOAT, 0, 0, 0);
|
||||||
rlEnableVertexAttribute(0);
|
rlEnableVertexAttribute(0);
|
||||||
|
|
||||||
|
|
@ -856,7 +857,8 @@ void UploadMesh(Mesh *mesh, bool dynamic)
|
||||||
if (mesh->normals != NULL)
|
if (mesh->normals != NULL)
|
||||||
{
|
{
|
||||||
// Enable vertex attributes: normals (shader-location = 2)
|
// Enable vertex attributes: normals (shader-location = 2)
|
||||||
mesh->vboId[2] = rlLoadVertexBuffer(mesh->normals, mesh->vertexCount*3*sizeof(float), dynamic);
|
void* normals = mesh->animNormals != NULL ? mesh->animNormals : mesh->vertices;
|
||||||
|
mesh->vboId[2] = rlLoadVertexBuffer(normals, mesh->vertexCount*3*sizeof(float), dynamic);
|
||||||
rlSetVertexAttribute(2, 3, RL_FLOAT, 0, 0, 0);
|
rlSetVertexAttribute(2, 3, RL_FLOAT, 0, 0, 0);
|
||||||
rlEnableVertexAttribute(2);
|
rlEnableVertexAttribute(2);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user