diff options
| author | Ray <[email protected]> | 2017-07-17 00:33:40 +0200 |
|---|---|---|
| committer | Ray <[email protected]> | 2017-07-17 00:33:40 +0200 |
| commit | 6546474fa45234ed0a84f62be705d9a9aee43079 (patch) | |
| tree | 7373f17e2a875a95e1844bca20b28d1a7a052fb9 /examples/models/models_cubicmap.c | |
| parent | 025dab990770a0adc65f07399c6a106d59d24e46 (diff) | |
| download | raylib-6546474fa45234ed0a84f62be705d9a9aee43079.tar.gz raylib-6546474fa45234ed0a84f62be705d9a9aee43079.zip | |
Manual integration of material-pbr into develop
Diffstat (limited to 'examples/models/models_cubicmap.c')
| -rw-r--r-- | examples/models/models_cubicmap.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/examples/models/models_cubicmap.c b/examples/models/models_cubicmap.c index 0e613029..ceef6378 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, VectorOne()); + Model model = LoadModelFromMesh(mesh, false); // 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[TEXMAP_DIFFUSE].tex = 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 //-------------------------------------------------------------------------------------- |
