diff options
| author | Max Danielsson <[email protected]> | 2018-03-27 21:16:25 +0200 |
|---|---|---|
| committer | Max Danielsson <[email protected]> | 2018-03-27 21:16:25 +0200 |
| commit | 42e64e931b27a27795f471817dc93551f4f752e8 (patch) | |
| tree | ef634e5b50bba3e9267255cad4f53b5984981a09 | |
| parent | 6c049fdd76296cb321761b6fa430c9addf58e02b (diff) | |
| download | raylib-42e64e931b27a27795f471817dc93551f4f752e8.tar.gz raylib-42e64e931b27a27795f471817dc93551f4f752e8.zip | |
Simplify camera data switch in orthographic 3d example
| -rw-r--r-- | examples/models/models_orthographic_projection.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/examples/models/models_orthographic_projection.c b/examples/models/models_orthographic_projection.c index b28aa0ae..2c2a89d1 100644 --- a/examples/models/models_orthographic_projection.c +++ b/examples/models/models_orthographic_projection.c @@ -13,6 +13,9 @@ #include "raylib.h" +#define FOVY_PERSPECTIVE 45.0f +#define WIDTH_ORTHOGRAPHIC 10.0f + int main() { // Initialization @@ -22,10 +25,8 @@ int main() InitWindow(screenWidth, screenHeight, "raylib [models] example - geometric shapes"); - const Camera perspective_camera = (Camera){{ 0.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f, CAMERA_PERSPECTIVE }; - const Camera orthographic_camera = (Camera){{ 0.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 10.0f, CAMERA_ORTHOGRAPHIC }; // Define the camera to look into our 3d world - Camera camera = perspective_camera; + Camera camera = {{ 0.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, FOVY_PERSPECTIVE, CAMERA_PERSPECTIVE }; SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- @@ -45,11 +46,13 @@ int main() { if(camera.type == CAMERA_PERSPECTIVE) { - camera = orthographic_camera; + camera.fovy = WIDTH_ORTHOGRAPHIC; + camera.type = CAMERA_ORTHOGRAPHIC; } else { - camera = perspective_camera; + camera.fovy = FOVY_PERSPECTIVE; + camera.type = CAMERA_PERSPECTIVE; } } |
