summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRay <[email protected]>2022-11-10 12:03:17 +0100
committerRay <[email protected]>2022-11-10 12:03:17 +0100
commit31edd13a72edd69993074941e013cbeff475f782 (patch)
tree2dc1e6ba56f33d7ad23cecab71e31d203a39586b /src
parent3888299bf5f50a828a26ce52e29db41a8764a193 (diff)
downloadraylib-31edd13a72edd69993074941e013cbeff475f782.tar.gz
raylib-31edd13a72edd69993074941e013cbeff475f782.zip
Minor formating tweaks
Diffstat (limited to 'src')
-rw-r--r--src/raylib.h6
-rw-r--r--src/rmodels.c31
-rw-r--r--src/rtextures.c1
3 files changed, 20 insertions, 18 deletions
diff --git a/src/raylib.h b/src/raylib.h
index 6e549208..bebd3e01 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -1439,11 +1439,11 @@ RLAPI void UnloadModelKeepMeshes(Model model);
RLAPI BoundingBox GetModelBoundingBox(Model model); // Compute model bounding box limits (considers all meshes)
// Model drawing functions
-RLAPI void DrawModel(Model model, Vector3 position, float scale, Color tint); // Draw a model (with texture if set)
+RLAPI void DrawModel(Model model, Vector3 position, float scale, Color tint); // Draw a model (with texture if set)
RLAPI void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model with extended parameters
-RLAPI void DrawModelWires(Model model, Vector3 position, float scale, Color tint); // Draw a model wires (with texture if set)
+RLAPI void DrawModelWires(Model model, Vector3 position, float scale, Color tint); // Draw a model wires (with texture if set)
RLAPI void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model wires (with texture if set) with extended parameters
-RLAPI void DrawBoundingBox(BoundingBox box, Color color); // Draw bounding box (wires)
+RLAPI void DrawBoundingBox(BoundingBox box, Color color); // Draw bounding box (wires)
RLAPI void DrawBillboard(Camera camera, Texture2D texture, Vector3 position, float size, Color tint); // Draw a billboard texture
RLAPI void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector2 size, Color tint); // Draw a billboard texture defined by source
RLAPI void DrawBillboardPro(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector3 up, Vector2 size, Vector2 origin, float rotation, Color tint); // Draw a billboard texture defined by source and rotation
diff --git a/src/rmodels.c b/src/rmodels.c
index 80205d49..2ca5ef09 100644
--- a/src/rmodels.c
+++ b/src/rmodels.c
@@ -2117,13 +2117,14 @@ void UpdateModelAnimation(Model model, ModelAnimation anim, int frame)
for (int m = 0; m < model.meshCount; m++)
{
Mesh mesh = model.meshes[m];
+
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;
}
- 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 animNormal = { 0 };
@@ -2140,13 +2141,13 @@ void UpdateModelAnimation(Model model, ModelAnimation anim, int frame)
float boneWeight = 0.0;
const int vValues = mesh.vertexCount*3;
- for (int vCounter = 0; vCounter < vValues; vCounter+=3)
+ for (int vCounter = 0; vCounter < vValues; vCounter += 3)
{
mesh.animVertices[vCounter] = 0;
mesh.animVertices[vCounter + 1] = 0;
mesh.animVertices[vCounter + 2] = 0;
- if (mesh.animNormals!=NULL)
+ if (mesh.animNormals != NULL)
{
mesh.animNormals[vCounter] = 0;
mesh.animNormals[vCounter + 1] = 0;
@@ -2157,16 +2158,15 @@ void UpdateModelAnimation(Model model, ModelAnimation anim, int frame)
for (int j = 0; j < 4; j++, boneCounter++)
{
boneWeight = mesh.boneWeights[boneCounter];
- // early stop when no transformation will be applied
- if (boneWeight == 0.0f)
- {
- continue;
- }
+
+ // Early stop when no transformation will be applied
+ if (boneWeight == 0.0f) continue;
+
boneId = mesh.boneIds[boneCounter];
//int boneIdParent = model.bones[boneId].parent;
inTranslation = model.bindPose[boneId].translation;
inRotation = model.bindPose[boneId].rotation;
- // inScale = model.bindPose[boneId].scale;
+ //inScale = model.bindPose[boneId].scale;
outTranslation = anim.framePoses[frame][boneId].translation;
outRotation = anim.framePoses[frame][boneId].rotation;
outScale = anim.framePoses[frame][boneId].scale;
@@ -2178,7 +2178,7 @@ void UpdateModelAnimation(Model model, ModelAnimation anim, int frame)
animVertex = Vector3Subtract(animVertex, inTranslation);
animVertex = Vector3RotateByQuaternion(animVertex, QuaternionMultiply(outRotation, QuaternionInvert(inRotation)));
animVertex = Vector3Add(animVertex, outTranslation);
-// animVertex = Vector3Transform(animVertex, model.transform);
+ //animVertex = Vector3Transform(animVertex, model.transform);
mesh.animVertices[vCounter] += animVertex.x*boneWeight;
mesh.animVertices[vCounter + 1] += animVertex.y*boneWeight;
mesh.animVertices[vCounter + 2] += animVertex.z*boneWeight;
@@ -2198,10 +2198,11 @@ void UpdateModelAnimation(Model model, ModelAnimation anim, int frame)
}
// Upload new vertex data to GPU for model drawing
- // Only update data when values changed.
- if (updated){
- 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
+ // NOTE: Only update data when values changed
+ if (updated)
+ {
+ 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
}
}
}
diff --git a/src/rtextures.c b/src/rtextures.c
index a23224a0..6b8af71d 100644
--- a/src/rtextures.c
+++ b/src/rtextures.c
@@ -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);
// Using nearest-neighbor scaling algorithm for default font
+ // TODO: Allow defining the preferred scaling mechanism externally
// WARNING: Module required: rtext
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));