summaryrefslogtreecommitdiffhomepage
path: root/examples/models/models_mesh_generation.c
diff options
context:
space:
mode:
authorRay <[email protected]>2019-03-29 20:22:50 +0100
committerRay <[email protected]>2019-03-29 20:22:50 +0100
commitbe6d237b9ebbe245de4384c17b84e75dab0f4981 (patch)
treedf451509352e1c197c28dc94e9211468a1124540 /examples/models/models_mesh_generation.c
parenta197f40bb4bd5a644ad54bef756d7f435977df9d (diff)
downloadraylib-be6d237b9ebbe245de4384c17b84e75dab0f4981.tar.gz
raylib-be6d237b9ebbe245de4384c17b84e75dab0f4981.zip
Review models examples
Diffstat (limited to 'examples/models/models_mesh_generation.c')
-rw-r--r--examples/models/models_mesh_generation.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/examples/models/models_mesh_generation.c b/examples/models/models_mesh_generation.c
index d64889bd..2b4b75ab 100644
--- a/examples/models/models_mesh_generation.c
+++ b/examples/models/models_mesh_generation.c
@@ -39,7 +39,7 @@ int main()
models[7] = LoadModelFromMesh(GenMeshPoly(5, 2.0f));
// Set checked texture as default diffuse component for all models material
- for (int i = 0; i < NUM_MODELS; i++) models[i].material.maps[MAP_DIFFUSE].texture = texture;
+ for (int i = 0; i < NUM_MODELS; i++) models[i].materials[0].maps[MAP_DIFFUSE].texture = texture;
// Define the camera to look into our 3d world
Camera camera = {{ 5.0f, 5.0f, 5.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f, 0 };
@@ -65,6 +65,17 @@ int main()
{
currentModel = (currentModel + 1)%NUM_MODELS; // Cycle between the textures
}
+
+ if (IsKeyPressed(KEY_RIGHT))
+ {
+ currentModel++;
+ if (currentModel >= NUM_MODELS) currentModel = 0;
+ }
+ else if (IsKeyPressed(KEY_LEFT))
+ {
+ currentModel--;
+ if (currentModel < 0) currentModel = NUM_MODELS - 1;
+ }
//----------------------------------------------------------------------------------
// Draw