Minor formating tweaks

This commit is contained in:
Ray 2022-11-10 12:03:17 +01:00
parent 3888299bf5
commit 31edd13a72
3 changed files with 20 additions and 18 deletions

View file

@ -2117,13 +2117,14 @@ void UpdateModelAnimation(Model model, ModelAnimation anim, int frame)
for (int m = 0; m < model.meshCount; m++) for (int m = 0; m < model.meshCount; m++)
{ {
Mesh mesh = model.meshes[m]; Mesh mesh = model.meshes[m];
if (mesh.boneIds == NULL || mesh.boneWeights == NULL) if (mesh.boneIds == NULL || mesh.boneWeights == NULL)
{ {
TRACELOG(LOG_WARNING, "MODEL: UpdateModelAnimation Mesh %i has no connection to bones",m); TRACELOG(LOG_WARNING, "MODEL: UpdateModelAnimation(): Mesh %i has no connection to bones", m);
continue; continue;
} }
bool updated = false; // set to true when anim vertex information is updated bool updated = false; // Flag to check when anim vertex information is updated
Vector3 animVertex = { 0 }; Vector3 animVertex = { 0 };
Vector3 animNormal = { 0 }; Vector3 animNormal = { 0 };
@ -2157,11 +2158,10 @@ void UpdateModelAnimation(Model model, ModelAnimation anim, int frame)
for (int j = 0; j < 4; j++, boneCounter++) for (int j = 0; j < 4; j++, boneCounter++)
{ {
boneWeight = mesh.boneWeights[boneCounter]; boneWeight = mesh.boneWeights[boneCounter];
// early stop when no transformation will be applied
if (boneWeight == 0.0f) // Early stop when no transformation will be applied
{ if (boneWeight == 0.0f) continue;
continue;
}
boneId = mesh.boneIds[boneCounter]; boneId = mesh.boneIds[boneCounter];
//int boneIdParent = model.bones[boneId].parent; //int boneIdParent = model.bones[boneId].parent;
inTranslation = model.bindPose[boneId].translation; inTranslation = model.bindPose[boneId].translation;
@ -2198,8 +2198,9 @@ void UpdateModelAnimation(Model model, ModelAnimation anim, int frame)
} }
// Upload new vertex data to GPU for model drawing // Upload new vertex data to GPU for model drawing
// Only update data when values changed. // NOTE: Only update data when values changed
if (updated){ if (updated)
{
rlUpdateVertexBuffer(mesh.vboId[0], mesh.animVertices, mesh.vertexCount*3*sizeof(float), 0); // Update vertex position rlUpdateVertexBuffer(mesh.vboId[0], mesh.animVertices, mesh.vertexCount*3*sizeof(float), 0); // Update vertex position
rlUpdateVertexBuffer(mesh.vboId[2], mesh.animNormals, mesh.vertexCount*3*sizeof(float), 0); // Update vertex normals rlUpdateVertexBuffer(mesh.vboId[2], mesh.animNormals, mesh.vertexCount*3*sizeof(float), 0); // Update vertex normals
} }

View file

@ -1297,6 +1297,7 @@ Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Co
TRACELOG(LOG_INFO, "IMAGE: Text scaled by factor: %f", scaleFactor); TRACELOG(LOG_INFO, "IMAGE: Text scaled by factor: %f", scaleFactor);
// Using nearest-neighbor scaling algorithm for default font // Using nearest-neighbor scaling algorithm for default font
// TODO: Allow defining the preferred scaling mechanism externally
// WARNING: Module required: rtext // WARNING: Module required: rtext
if (font.texture.id == GetFontDefault().texture.id) ImageResizeNN(&imText, (int)(imSize.x*scaleFactor), (int)(imSize.y*scaleFactor)); if (font.texture.id == GetFontDefault().texture.id) ImageResizeNN(&imText, (int)(imSize.x*scaleFactor), (int)(imSize.y*scaleFactor));
else ImageResize(&imText, (int)(imSize.x*scaleFactor), (int)(imSize.y*scaleFactor)); else ImageResize(&imText, (int)(imSize.x*scaleFactor), (int)(imSize.y*scaleFactor));