summaryrefslogtreecommitdiffhomepage
path: root/examples/core_3d_camera_free.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/core_3d_camera_free.c')
-rw-r--r--examples/core_3d_camera_free.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/examples/core_3d_camera_free.c b/examples/core_3d_camera_free.c
index cca9cfd5..4b45373d 100644
--- a/examples/core_3d_camera_free.c
+++ b/examples/core_3d_camera_free.c
@@ -21,9 +21,12 @@ int main()
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free");
// Define the camera to look into our 3d world
- Camera camera = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
-
- Vector3 cubePosition = { 0.0, 0.0, 0.0 };
+ Camera camera;
+ camera.position = (Vector3){ 0.0f, 10.0f, 10.0f }; // Camera position
+ camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
+ camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
+
+ Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
SetCameraMode(CAMERA_FREE); // Set a free camera mode
SetCameraPosition(camera.position); // Set internal camera position to match our camera position
@@ -44,14 +47,14 @@ int main()
//----------------------------------------------------------------------------------
BeginDrawing();
- ClearBackground(WHITE);
+ ClearBackground(RAYWHITE);
Begin3dMode(camera);
- DrawCube(cubePosition, 2, 2, 2, RED);
- DrawCubeWires(cubePosition, 2, 2, 2, MAROON);
+ DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
+ DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
- DrawGrid(10.0, 1.0);
+ DrawGrid(10, 1.0f);
End3dMode();