summaryrefslogtreecommitdiffhomepage
path: root/examples/models/models_cubicmap.c
diff options
context:
space:
mode:
authorRay <[email protected]>2017-08-25 01:53:15 +0200
committerGitHub <[email protected]>2017-08-25 01:53:15 +0200
commitc074783861994fb9f3bcc618b776a41dc57b50d0 (patch)
tree63fdca2144cd13f6a537e76d6a3f8712ae106ead /examples/models/models_cubicmap.c
parent910b4b5d53d9a904070807de5e8a66edadd939e3 (diff)
parent0fc1323c80c2501c36741c05fd771ac1d001d049 (diff)
downloadraylib-c074783861994fb9f3bcc618b776a41dc57b50d0.tar.gz
raylib-c074783861994fb9f3bcc618b776a41dc57b50d0.zip
Merge pull request #346 from raysan5/develop
Integrate Develop branch
Diffstat (limited to 'examples/models/models_cubicmap.c')
-rw-r--r--examples/models/models_cubicmap.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/examples/models/models_cubicmap.c b/examples/models/models_cubicmap.c
index 0e613029..a8faa7c0 100644
--- a/examples/models/models_cubicmap.c
+++ b/examples/models/models_cubicmap.c
@@ -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
//--------------------------------------------------------------------------------------