aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorraysan5 <raysan5@gmail.com>2016-09-25 14:28:24 +0200
committerraysan5 <raysan5@gmail.com>2016-09-25 14:28:24 +0200
commit753b549aa5c6a010fc4de8acc2f64afdfce69cee (patch)
treed391bf49f41c39a2d720d1bab632bef936b3fbc2 /examples
parent87fc7254e725f4e5c5137b31d1dfe56be8e22cf0 (diff)
downloadraylib-753b549aa5c6a010fc4de8acc2f64afdfce69cee.tar.gz
raylib-753b549aa5c6a010fc4de8acc2f64afdfce69cee.zip
Improving camera system -IN PROGRESS-
Diffstat (limited to 'examples')
-rw-r--r--examples/core_3d_camera_first_person.c9
-rw-r--r--examples/core_3d_camera_free.c5
-rw-r--r--examples/models_cubicmap.c10
3 files changed, 8 insertions, 16 deletions
diff --git a/examples/core_3d_camera_first_person.c b/examples/core_3d_camera_first_person.c
index 56e38a23..3675d46a 100644
--- a/examples/core_3d_camera_first_person.c
+++ b/examples/core_3d_camera_first_person.c
@@ -23,7 +23,7 @@ int main()
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera first person");
// Define the camera to look into our 3d world (position, target, up vector)
- Camera camera = {{ 0.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 60.0f };
+ Camera camera = {{ 4.0f, 2.0f, 4.0f }, { 0.0f, 2.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 60.0f };
// Generates some random columns
float heights[MAX_COLUMNS];
@@ -37,10 +37,7 @@ int main()
colors[i] = (Color){ GetRandomValue(20, 255), GetRandomValue(10, 55), 30, 255 };
}
- Vector3 playerPosition = { 4.0f, 2.0f, 4.0f }; // Define player position
-
- SetCameraMode(CAMERA_FIRST_PERSON); // Set a first person camera mode
- SetCameraFovy(camera.fovy); // Set internal camera field-of-view Y
+ SetCameraMode(camera, CAMERA_FIRST_PERSON); // Set a first person camera mode
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
@@ -50,7 +47,7 @@ int main()
{
// Update
//----------------------------------------------------------------------------------
- UpdateCameraPlayer(&camera, &playerPosition); // Update camera and player position
+ UpdateCamera(&camera); // Update camera and player position
//----------------------------------------------------------------------------------
// Draw
diff --git a/examples/core_3d_camera_free.c b/examples/core_3d_camera_free.c
index fa7ad85f..257bb789 100644
--- a/examples/core_3d_camera_free.c
+++ b/examples/core_3d_camera_free.c
@@ -29,10 +29,7 @@ int main()
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
- SetCameraTarget(camera.target); // Set internal camera target to match our camera target
- SetCameraFovy(camera.fovy); // Set internal camera field-of-view Y
+ SetCameraMode(camera, CAMERA_FREE); // Set a free camera mode
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
diff --git a/examples/models_cubicmap.c b/examples/models_cubicmap.c
index 89bc75cf..df700d65 100644
--- a/examples/models_cubicmap.c
+++ b/examples/models_cubicmap.c
@@ -35,19 +35,17 @@ int main()
UnloadImage(image); // Unload cubesmap image from RAM, already uploaded to VRAM
- SetCameraMode(CAMERA_ORBITAL); // Set an orbital camera mode
- SetCameraPosition(camera.position); // Set internal camera position to match our custom camera position
- SetCameraFovy(camera.fovy); // Set internal camera field-of-view Y
+ SetCameraMode(camera, CAMERA_ORBITAL); // Set an orbital camera mode
- SetTargetFPS(60); // Set our game to run at 60 frames-per-second
+ SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
- while (!WindowShouldClose()) // Detect window close button or ESC key
+ while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
- UpdateCamera(&camera); // Update internal camera and our camera
+ UpdateCamera(&camera); // Update internal camera and our camera
//----------------------------------------------------------------------------------
// Draw