diff --git a/src/graphics/graphics.c b/src/graphics/graphics.c index ac4602bd..84c9860a 100644 --- a/src/graphics/graphics.c +++ b/src/graphics/graphics.c @@ -424,9 +424,8 @@ void lovrGraphicsDraw(DrawCommand* draw) { lovrShaderSetMatrices(shader, "lovrNormalMatrices", normalMatrices, 0, 18); } - float* pose = lovrMeshGetPose(mesh); - if (pose) { - lovrShaderSetMatrices(shader, "lovrPose", pose, 0, MAX_BONES * 16); + if (draw->pose) { + lovrShaderSetMatrices(shader, "lovrPose", draw->pose, 0, MAX_BONES * 16); } else { lovrShaderSetMatrices(shader, "lovrPose", (float[16]) MAT4_IDENTITY, 0, 16); } diff --git a/src/graphics/graphics.h b/src/graphics/graphics.h index eb21754d..8cb3d234 100644 --- a/src/graphics/graphics.h +++ b/src/graphics/graphics.h @@ -134,6 +134,7 @@ typedef struct { mat4 transform; bool forceMono; int instances; + float* pose; } DrawCommand; typedef struct { diff --git a/src/graphics/mesh.h b/src/graphics/mesh.h index bd771e00..0b406c15 100644 --- a/src/graphics/mesh.h +++ b/src/graphics/mesh.h @@ -35,8 +35,6 @@ void lovrMeshGetDrawRange(Mesh* mesh, uint32_t* start, uint32_t* count); void lovrMeshSetDrawRange(Mesh* mesh, uint32_t start, uint32_t count); Material* lovrMeshGetMaterial(Mesh* mesh); void lovrMeshSetMaterial(Mesh* mesh, Material* material); -float* lovrMeshGetPose(Mesh* mesh); -void lovrMeshSetPose(Mesh* mesh, float* pose); VertexPointer lovrMeshMapVertices(Mesh* mesh, uint32_t start, uint32_t count, bool read, bool write); void lovrMeshUnmapVertices(Mesh* mesh); IndexPointer lovrMeshReadIndices(Mesh* mesh, uint32_t* count, size_t* size); diff --git a/src/graphics/model.c b/src/graphics/model.c index ca07b36d..625a68c0 100644 --- a/src/graphics/model.c +++ b/src/graphics/model.c @@ -39,12 +39,12 @@ static void renderNode(Model* model, int nodeIndex, int instances) { } lovrMeshSetDrawRange(model->mesh, primitive->drawStart, primitive->drawCount); - lovrMeshSetPose(model->mesh, (float*) model->pose); lovrGraphicsDraw(&(DrawCommand) { .transform = model->nodeTransforms[nodeIndex], .mesh = model->mesh, .material = lovrMeshGetMaterial(model->mesh), - .instances = instances + .instances = instances, + .pose = (float*) model->pose }); } } @@ -180,7 +180,6 @@ void lovrModelDraw(Model* model, mat4 transform, int instances) { lovrGraphicsMatrixTransform(transform); renderNode(model, 0, instances); lovrGraphicsPop(); - lovrMeshSetPose(model->mesh, NULL); } Animator* lovrModelGetAnimator(Model* model) { diff --git a/src/graphics/opengl.c b/src/graphics/opengl.c index b9c4ba0e..854df133 100644 --- a/src/graphics/opengl.c +++ b/src/graphics/opengl.c @@ -168,7 +168,6 @@ struct Mesh { GLuint vbo; GLuint ibo; Material* material; - float* pose; map_attachment_t attachments; MeshAttachment layout[MAX_ATTACHMENTS]; bool isAttachment; @@ -2404,14 +2403,6 @@ void lovrMeshSetMaterial(Mesh* mesh, Material* material) { } } -float* lovrMeshGetPose(Mesh* mesh) { - return mesh->pose; -} - -void lovrMeshSetPose(Mesh* mesh, float* pose) { - mesh->pose = pose; -} - VertexPointer lovrMeshMapVertices(Mesh* mesh, uint32_t start, uint32_t count, bool read, bool write) { if (write) { mesh->dirtyStart = MIN(mesh->dirtyStart, start);