Skip to content

Commit de3dc94

Browse files
author
Asdqwe
authored
Fix example/models/models_loading_m3d.c controls (#3269)
1 parent 9393500 commit de3dc94

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

examples/models/models_loading_m3d.c

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ int main(void)
4040
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
4141

4242
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
43-
43+
4444
char modelFileName[128] = "resources/models/m3d/cesium_man.m3d";
4545
bool drawMesh = 1;
4646
bool drawSkeleton = 1;
@@ -72,27 +72,27 @@ int main(void)
7272
if (IsKeyDown(KEY_SPACE) || IsKeyPressed(KEY_N))
7373
{
7474
animFrameCounter++;
75-
75+
7676
if (animFrameCounter >= anims[animId].frameCount) animFrameCounter = 0;
77-
77+
7878
UpdateModelAnimation(model, anims[animId], animFrameCounter);
7979
animPlaying = true;
8080
}
81-
82-
// Select animation by pressing A
83-
if (IsKeyPressed(KEY_A))
81+
82+
// Select animation by pressing C
83+
if (IsKeyPressed(KEY_C))
8484
{
8585
animFrameCounter = 0;
8686
animId++;
87-
87+
8888
if (animId >= animsCount) animId = 0;
8989
UpdateModelAnimation(model, anims[animId], 0);
9090
animPlaying = true;
9191
}
9292
}
93-
93+
9494
// Toggle skeleton drawing
95-
if (IsKeyPressed(KEY_S)) drawSkeleton ^= 1;
95+
if (IsKeyPressed(KEY_B)) drawSkeleton ^= 1;
9696

9797
// Toggle mesh drawing
9898
if (IsKeyPressed(KEY_M)) drawMesh ^= 1;
@@ -112,19 +112,19 @@ int main(void)
112112
// Draw the animated skeleton
113113
if (drawSkeleton)
114114
{
115-
// Loop to (boneCount - 1) because the last one is a special "no bone" bone,
115+
// Loop to (boneCount - 1) because the last one is a special "no bone" bone,
116116
// needed to workaround buggy models
117117
// without a -1, we would always draw a cube at the origin
118118
for (int i = 0; i < model.boneCount - 1; i++)
119119
{
120-
// By default the model is loaded in bind-pose by LoadModel().
121-
// But if UpdateModelAnimation() has been called at least once
120+
// By default the model is loaded in bind-pose by LoadModel().
121+
// But if UpdateModelAnimation() has been called at least once
122122
// then the model is already in animation pose, so we need the animated skeleton
123123
if (!animPlaying || !animsCount)
124124
{
125125
// Display the bind-pose skeleton
126126
DrawCube(model.bindPose[i].translation, 0.04f, 0.04f, 0.04f, RED);
127-
127+
128128
if (model.bones[i].parent >= 0)
129129
{
130130
DrawLine3D(model.bindPose[i].translation,
@@ -135,7 +135,7 @@ int main(void)
135135
{
136136
// Display the frame-pose skeleton
137137
DrawCube(anims[animId].framePoses[animFrameCounter][i].translation, 0.05f, 0.05f, 0.05f, RED);
138-
138+
139139
if (anims[animId].bones[i].parent >= 0)
140140
{
141141
DrawLine3D(anims[animId].framePoses[animFrameCounter][i].translation,
@@ -149,9 +149,10 @@ int main(void)
149149

150150
EndMode3D();
151151

152-
DrawText("PRESS SPACE to PLAY MODEL ANIMATION", 10, GetScreenHeight() - 60, 10, MAROON);
153-
DrawText("PRESS A to CYCLE THROUGH ANIMATIONS", 10, GetScreenHeight() - 40, 10, DARKGRAY);
154-
DrawText("PRESS M to toggle MESH, S to toggle SKELETON DRAWING", 10, GetScreenHeight() - 20, 10, DARKGRAY);
152+
DrawText("PRESS SPACE to PLAY MODEL ANIMATION", 10, GetScreenHeight() - 80, 10, MAROON);
153+
DrawText("PRESS N to STEP ONE ANIMATION FRAME", 10, GetScreenHeight() - 60, 10, DARKGRAY);
154+
DrawText("PRESS C to CYCLE THROUGH ANIMATIONS", 10, GetScreenHeight() - 40, 10, DARKGRAY);
155+
DrawText("PRESS M to toggle MESH, B to toggle SKELETON DRAWING", 10, GetScreenHeight() - 20, 10, DARKGRAY);
155156
DrawText("(c) CesiumMan model by KhronosGroup", GetScreenWidth() - 210, GetScreenHeight() - 20, 10, GRAY);
156157

157158
EndDrawing();

0 commit comments

Comments
 (0)