summaryrefslogtreecommitdiffhomepage
path: root/examples/src/models/models_cubicmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/src/models/models_cubicmap.c')
-rw-r--r--examples/src/models/models_cubicmap.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/examples/src/models/models_cubicmap.c b/examples/src/models/models_cubicmap.c
index 0e61302..d8be932 100644
--- a/examples/src/models/models_cubicmap.c
+++ b/examples/src/models/models_cubicmap.c
@@ -2,7 +2,7 @@
*
* raylib [models] example - Cubicmap loading and drawing
*
-* This example has been created using raylib 1.3 (www.raylib.com)
+* This example has been created using raylib 1.8 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
@@ -25,11 +25,13 @@ int main()
Image image = LoadImage("resources/cubicmap.png"); // Load cubicmap image (RAM)
Texture2D cubicmap = LoadTextureFromImage(image); // Convert image to texture to display (VRAM)
- Model map = LoadCubicmap(image); // Load cubicmap model (generate model from image)
+
+ Mesh mesh = GenMeshCubicmap(image, (Vector3){ 1.0f, 1.0f, 1.0f });
+ Model model = LoadModelFromMesh(mesh);
// NOTE: By default each cube is mapped to one part of texture atlas
Texture2D texture = LoadTexture("resources/cubicmap_atlas.png"); // Load map texture
- map.material.texDiffuse = texture; // Set map diffuse texture
+ model.material.maps[MAP_DIFFUSE].texture = texture; // Set map diffuse texture
Vector3 mapPosition = { -16.0f, 0.0f, -8.0f }; // Set model position
@@ -56,7 +58,7 @@ int main()
Begin3dMode(camera);
- DrawModel(map, mapPosition, 1.0f, WHITE);
+ DrawModel(model, mapPosition, 1.0f, WHITE);
End3dMode();
@@ -76,7 +78,7 @@ int main()
//--------------------------------------------------------------------------------------
UnloadTexture(cubicmap); // Unload cubicmap texture
UnloadTexture(texture); // Unload map texture
- UnloadModel(map); // Unload map model
+ UnloadModel(model); // Unload map model
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------