|
@@ -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
|
|
|
//--------------------------------------------------------------------------------------
|