Преглед изворни кода

REVIEWED: models_gltf_model #1684

pull/1695/head
raysan5 пре 3 година
родитељ
комит
8f3e91ae83
1 измењених фајлова са 10 додато и 10 уклоњено
  1. +10
    -10
      examples/models/models_gltf_model.c

+ 10
- 10
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[mi">7];
Model model[n">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
//--------------------------------------------------------------------------------------

Loading…
Откажи
Сачувај