summaryrefslogtreecommitdiffhomepage
path: root/examples/models
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2021-03-28 20:15:57 +0200
committerraysan5 <[email protected]>2021-03-28 20:15:57 +0200
commit8f3e91ae832be95f9c882eaeb39c0af4c4cc8046 (patch)
tree34c0519503181f818bd01264c8b1e3887e347040 /examples/models
parent23a764190e9c8604975f92f02e0fdbb72fce9935 (diff)
downloadraylib-8f3e91ae832be95f9c882eaeb39c0af4c4cc8046.tar.gz
raylib-8f3e91ae832be95f9c882eaeb39c0af4c4cc8046.zip
REVIEWED: models_gltf_model #1684
Diffstat (limited to 'examples/models')
-rw-r--r--examples/models/models_gltf_model.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/examples/models/models_gltf_model.c b/examples/models/models_gltf_model.c
index d515c652..24996e5c 100644
--- a/examples/models/models_gltf_model.c
+++ b/examples/models/models_gltf_model.c
@@ -21,6 +21,8 @@
#include <stdlib.h>
+#define MAX_MODELS 6
+
int main(void)
{
// Initialization
@@ -38,18 +40,16 @@ int main(void)
camera.fovy = 45.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
- Model model[7];
+ Model model[MAX_MODELS] = { 0 };
model[0] = LoadModel("resources/gltf/raylib_32x32.glb");
model[1] = LoadModel("resources/gltf/rigged_figure.glb");
- model[2] = LoadModel("resources/gltf/Avocado.glb");
- model[3] = LoadModel("resources/gltf/GearboxAssy.glb");
- model[4] = LoadModel("resources/gltf/BoxAnimated.glb");
- model[5] = LoadModel("resources/gltf/AnimatedTriangle.gltf");
- model[6] = LoadModel("resources/gltf/AnimatedMorphCube.glb");
+ model[2] = LoadModel("resources/gltf/GearboxAssy.glb");
+ model[3] = LoadModel("resources/gltf/BoxAnimated.glb");
+ model[4] = LoadModel("resources/gltf/AnimatedTriangle.gltf");
+ model[5] = LoadModel("resources/gltf/AnimatedMorphCube.glb");
int currentModel = 0;
- int modelCount = 7;
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
@@ -68,13 +68,13 @@ int main(void)
if (IsKeyReleased(KEY_RIGHT))
{
currentModel++;
- if (currentModel == modelCount) currentModel = 0;
+ if (currentModel == MAX_MODELS) currentModel = 0;
}
if (IsKeyReleased(KEY_LEFT))
{
currentModel--;
- if (currentModel < 0) currentModel = modelCount - 1;
+ if (currentModel < 0) currentModel = MAX_MODELS - 1;
}
// Draw
@@ -97,7 +97,7 @@ int main(void)
// De-Initialization
//--------------------------------------------------------------------------------------
- for(int i = 0; i < modelCount; i++) UnloadModel(model[i]); // Unload models
+ for(int i = 0; i < MAX_MODELS; i++) UnloadModel(model[i]); // Unload models
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------