summaryrefslogtreecommitdiffhomepage
path: root/examples/models_heightmap.c
diff options
context:
space:
mode:
authorvictorfisac <[email protected]>2016-02-26 14:32:30 +0100
committervictorfisac <[email protected]>2016-02-26 14:32:30 +0100
commitce56fcb1eda06385b88c1a906f0968d742ff8130 (patch)
tree4c82fa8ce61db1ae4af3ab1e174dd8c7d5918919 /examples/models_heightmap.c
parentf582ab06add085594f2579ee6e7d625212abd204 (diff)
parent75a73d94171051037fcf670852877977d9251520 (diff)
downloadraylib-ce56fcb1eda06385b88c1a906f0968d742ff8130.tar.gz
raylib-ce56fcb1eda06385b88c1a906f0968d742ff8130.zip
Merge remote-tracking branch 'refs/remotes/raysan5/master'
Diffstat (limited to 'examples/models_heightmap.c')
-rw-r--r--examples/models_heightmap.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/examples/models_heightmap.c b/examples/models_heightmap.c
index fec3f5e6..f1da3301 100644
--- a/examples/models_heightmap.c
+++ b/examples/models_heightmap.c
@@ -21,13 +21,13 @@ int main()
InitWindow(screenWidth, screenHeight, "raylib [models] example - heightmap loading and drawing");
// Define our custom camera to look into our 3d world
- Camera camera = {{ 24.0, 18.0, 24.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
+ Camera camera = {{ 18.0f, 16.0f, 18.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }};
- Image image = LoadImage("resources/heightmap.png"); // Load heightmap image (RAM)
- Texture2D texture = LoadTextureFromImage(image); // Convert image to texture (VRAM)
- Model map = LoadHeightmap(image, 32); // Load heightmap model
- SetModelTexture(&map, texture); // Bind texture to model
- Vector3 mapPosition = { -16, 0.0, -16 }; // Set model position (depends on model scaling!)
+ Image image = LoadImage("resources/heightmap.png"); // Load heightmap image (RAM)
+ Texture2D texture = LoadTextureFromImage(image); // Convert image to texture (VRAM)
+ Model map = LoadHeightmap(image, (Vector3){ 16, 8, 16 }); // Load heightmap model with defined size
+ SetModelTexture(&map, texture); // Bind texture to model
+ Vector3 mapPosition = { -8.0f, 0.0f, -8.0f }; // Set model position (depends on model scaling!)
UnloadImage(image); // Unload heightmap image from RAM, already uploaded to VRAM
@@ -54,7 +54,9 @@ int main()
Begin3dMode(camera);
// NOTE: Model is scaled to 1/4 of its original size (128x128 units)
- DrawModel(map, mapPosition, 1/4.0f, RED);
+ DrawModel(map, mapPosition, 1.0f, RED);
+
+ DrawGrid(20, 1.0f);
End3dMode();