summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRay <[email protected]>2021-03-19 13:56:46 +0100
committerRay <[email protected]>2021-03-19 13:56:46 +0100
commit07d82a91c5e710bae05525b7a053893ff3771767 (patch)
treee9d5d2ba4a4ceb7de35a7853c38508eff413a4bd
parentd4e2c331b1a751dd02cac36502bbb161406b0d80 (diff)
downloadraylib-07d82a91c5e710bae05525b7a053893ff3771767.tar.gz
raylib-07d82a91c5e710bae05525b7a053893ff3771767.zip
WARNING: BREAKING: RENAMED: camera.type to camera.projection
-rw-r--r--examples/core/core_3d_camera_first_person.c2
-rw-r--r--examples/core/core_3d_camera_free.c2
-rw-r--r--examples/core/core_3d_camera_mode.c2
-rw-r--r--examples/core/core_3d_picking.c2
-rw-r--r--examples/core/core_quat_conversion.c2
-rw-r--r--examples/core/core_vr_simulator.c2
-rw-r--r--examples/core/core_world_screen.c2
-rw-r--r--examples/models/models_animation.c2
-rw-r--r--examples/models/models_billboard.c2
-rw-r--r--examples/models/models_geometric_shapes.c2
-rw-r--r--examples/models/models_gltf_animation.c2
-rw-r--r--examples/models/models_gltf_model.c2
-rw-r--r--examples/models/models_loading.c2
-rw-r--r--examples/models/models_material_pbr.c2
-rw-r--r--examples/models/models_mesh_picking.c2
-rw-r--r--examples/models/models_orthographic_projection.c10
-rw-r--r--projects/VSCode/main.c2
-rw-r--r--projects/VSCode_tcc_win/main.c2
-rw-r--r--src/core.c18
-rw-r--r--src/raylib.h2
20 files changed, 32 insertions, 32 deletions
diff --git a/examples/core/core_3d_camera_first_person.c b/examples/core/core_3d_camera_first_person.c
index 3377aeaf..59fc8307 100644
--- a/examples/core/core_3d_camera_first_person.c
+++ b/examples/core/core_3d_camera_first_person.c
@@ -28,7 +28,7 @@ int main(void)
camera.target = (Vector3){ 0.0f, 1.8f, 0.0f };
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f };
camera.fovy = 60.0f;
- camera.type = CAMERA_PERSPECTIVE;
+ camera.projection = CAMERA_PERSPECTIVE;
// Generates some random columns
float heights[MAX_COLUMNS] = { 0 };
diff --git a/examples/core/core_3d_camera_free.c b/examples/core/core_3d_camera_free.c
index 5053fd63..f469d121 100644
--- a/examples/core/core_3d_camera_free.c
+++ b/examples/core/core_3d_camera_free.c
@@ -26,7 +26,7 @@ int main(void)
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)
camera.fovy = 45.0f; // Camera field-of-view Y
- camera.type = CAMERA_PERSPECTIVE; // Camera mode type
+ camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
diff --git a/examples/core/core_3d_camera_mode.c b/examples/core/core_3d_camera_mode.c
index eae6c888..48bac9d7 100644
--- a/examples/core/core_3d_camera_mode.c
+++ b/examples/core/core_3d_camera_mode.c
@@ -26,7 +26,7 @@ int main(void)
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)
camera.fovy = 45.0f; // Camera field-of-view Y
- camera.type = CAMERA_PERSPECTIVE; // Camera mode type
+ camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
diff --git a/examples/core/core_3d_picking.c b/examples/core/core_3d_picking.c
index 1360f006..99b681e3 100644
--- a/examples/core/core_3d_picking.c
+++ b/examples/core/core_3d_picking.c
@@ -26,7 +26,7 @@ int main(void)
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)
camera.fovy = 45.0f; // Camera field-of-view Y
- camera.type = CAMERA_PERSPECTIVE; // Camera mode type
+ camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
Vector3 cubePosition = { 0.0f, 1.0f, 0.0f };
Vector3 cubeSize = { 2.0f, 2.0f, 2.0f };
diff --git a/examples/core/core_quat_conversion.c b/examples/core/core_quat_conversion.c
index cd7777e6..a7ea8247 100644
--- a/examples/core/core_quat_conversion.c
+++ b/examples/core/core_quat_conversion.c
@@ -32,7 +32,7 @@ int main(void)
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)
camera.fovy = 45.0f; // Camera field-of-view Y
- camera.type = CAMERA_PERSPECTIVE; // Camera mode type
+ camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
Mesh mesh = GenMeshCylinder(0.2f, 1.0f, 32);
Model model = LoadModelFromMesh(mesh);
diff --git a/examples/core/core_vr_simulator.c b/examples/core/core_vr_simulator.c
index 8d24983c..8d0247f8 100644
--- a/examples/core/core_vr_simulator.c
+++ b/examples/core/core_vr_simulator.c
@@ -66,7 +66,7 @@ int main(void)
camera.target = (Vector3){ 0.0f, 2.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 60.0f; // Camera field-of-view Y
- camera.type = CAMERA_PERSPECTIVE; // Camera type
+ camera.projection = CAMERA_PERSPECTIVE; // Camera type
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
diff --git a/examples/core/core_world_screen.c b/examples/core/core_world_screen.c
index be1a96b9..d951c922 100644
--- a/examples/core/core_world_screen.c
+++ b/examples/core/core_world_screen.c
@@ -26,7 +26,7 @@ int main(void)
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f };
camera.fovy = 45.0f;
- camera.type = CAMERA_PERSPECTIVE;
+ camera.projection = CAMERA_PERSPECTIVE;
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
Vector2 cubeScreenPosition = { 0.0f, 0.0f };
diff --git a/examples/models/models_animation.c b/examples/models/models_animation.c
index a80c8c96..778e347e 100644
--- a/examples/models/models_animation.c
+++ b/examples/models/models_animation.c
@@ -37,7 +37,7 @@ int main(void)
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)
camera.fovy = 45.0f; // Camera field-of-view Y
- camera.type = CAMERA_PERSPECTIVE; // Camera mode type
+ camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
Model model = LoadModel("resources/guy/guy.iqm"); // Load the animated model mesh and basic data
Texture2D texture = LoadTexture("resources/guy/guytex.png"); // Load model texture and set material
diff --git a/examples/models/models_billboard.c b/examples/models/models_billboard.c
index 597e9a60..0a7e878b 100644
--- a/examples/models/models_billboard.c
+++ b/examples/models/models_billboard.c
@@ -26,7 +26,7 @@ int main(void)
camera.target = (Vector3){ 0.0f, 2.0f, 0.0f };
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f };
camera.fovy = 45.0f;
- camera.type = CAMERA_PERSPECTIVE;
+ camera.projection = CAMERA_PERSPECTIVE;
Texture2D bill = LoadTexture("resources/billboard.png"); // Our texture billboard
Vector3 billPosition = { 0.0f, 2.0f, 0.0f }; // Position where draw billboard
diff --git a/examples/models/models_geometric_shapes.c b/examples/models/models_geometric_shapes.c
index 39477927..c1feb802 100644
--- a/examples/models/models_geometric_shapes.c
+++ b/examples/models/models_geometric_shapes.c
@@ -26,7 +26,7 @@ int main(void)
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f };
camera.fovy = 45.0f;
- camera.type = CAMERA_PERSPECTIVE;
+ camera.projection = CAMERA_PERSPECTIVE;
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
diff --git a/examples/models/models_gltf_animation.c b/examples/models/models_gltf_animation.c
index 0efced5e..8bd812d6 100644
--- a/examples/models/models_gltf_animation.c
+++ b/examples/models/models_gltf_animation.c
@@ -37,7 +37,7 @@ int main(void)
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)
camera.fovy = 45.0f; // Camera field-of-view Y
- camera.type = CAMERA_PERSPECTIVE; // Camera mode type
+ camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
Model model = LoadModel("resources/gltf/rigged_figure.glb"); // Load the animated model mesh and
// basic data
diff --git a/examples/models/models_gltf_model.c b/examples/models/models_gltf_model.c
index 2e9e8456..3940315a 100644
--- a/examples/models/models_gltf_model.c
+++ b/examples/models/models_gltf_model.c
@@ -37,7 +37,7 @@ int main(void)
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)
camera.fovy = 45.0f; // Camera field-of-view Y
- camera.type = CAMERA_PERSPECTIVE; // Camera mode type
+ camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
Model model[7];
diff --git a/examples/models/models_loading.c b/examples/models/models_loading.c
index 951aee5d..2af80c97 100644
--- a/examples/models/models_loading.c
+++ b/examples/models/models_loading.c
@@ -35,7 +35,7 @@ int main(void)
camera.target = (Vector3){ 0.0f, 10.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y
- camera.type = CAMERA_PERSPECTIVE; // Camera mode type
+ camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
Model model = LoadModel("resources/models/castle.obj"); // Load model
Texture2D texture = LoadTexture("resources/models/castle_diffuse.png"); // Load model texture
diff --git a/examples/models/models_material_pbr.c b/examples/models/models_material_pbr.c
index 4155a6b1..fb3f9569 100644
--- a/examples/models/models_material_pbr.c
+++ b/examples/models/models_material_pbr.c
@@ -46,7 +46,7 @@ int main(void)
camera.target = (Vector3){ 0.0f, 0.5f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y
- camera.type = CAMERA_PERSPECTIVE; // Camera mode type
+ camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
// Load model and PBR material
Model model = LoadModel("resources/pbr/trooper.obj");
diff --git a/examples/models/models_mesh_picking.c b/examples/models/models_mesh_picking.c
index 41710189..8ade0b06 100644
--- a/examples/models/models_mesh_picking.c
+++ b/examples/models/models_mesh_picking.c
@@ -31,7 +31,7 @@ int main(void)
camera.target = (Vector3){ 0.0f, 8.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.6f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y
- camera.type = CAMERA_PERSPECTIVE; // Camera mode type
+ camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
Ray ray = { 0 }; // Picking ray
diff --git a/examples/models/models_orthographic_projection.c b/examples/models/models_orthographic_projection.c
index 8c9b5b1c..7dd5fde2 100644
--- a/examples/models/models_orthographic_projection.c
+++ b/examples/models/models_orthographic_projection.c
@@ -40,15 +40,15 @@ int main(void)
//----------------------------------------------------------------------------------
if (IsKeyPressed(KEY_SPACE))
{
- if (camera.type == CAMERA_PERSPECTIVE)
+ if (camera.projection == CAMERA_PERSPECTIVE)
{
camera.fovy = WIDTH_ORTHOGRAPHIC;
- camera.type = CAMERA_ORTHOGRAPHIC;
+ camera.projection = CAMERA_ORTHOGRAPHIC;
}
else
{
camera.fovy = FOVY_PERSPECTIVE;
- camera.type = CAMERA_PERSPECTIVE;
+ camera.projection = CAMERA_PERSPECTIVE;
}
}
//----------------------------------------------------------------------------------
@@ -81,8 +81,8 @@ int main(void)
DrawText("Press Spacebar to switch camera type", 10, GetScreenHeight() - 30, 20, DARKGRAY);
- if (camera.type == CAMERA_ORTHOGRAPHIC) DrawText("ORTHOGRAPHIC", 10, 40, 20, BLACK);
- else if (camera.type == CAMERA_PERSPECTIVE) DrawText("PERSPECTIVE", 10, 40, 20, BLACK);
+ if (camera.projection == CAMERA_ORTHOGRAPHIC) DrawText("ORTHOGRAPHIC", 10, 40, 20, BLACK);
+ else if (camera.projection == CAMERA_PERSPECTIVE) DrawText("PERSPECTIVE", 10, 40, 20, BLACK);
DrawFPS(10, 10);
diff --git a/projects/VSCode/main.c b/projects/VSCode/main.c
index 88f356ea..835b4b08 100644
--- a/projects/VSCode/main.c
+++ b/projects/VSCode/main.c
@@ -35,7 +35,7 @@ int main()
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f };
camera.fovy = 60.0f;
- camera.type = CAMERA_PERSPECTIVE;
+ camera.projection = CAMERA_PERSPECTIVE;
SetCameraMode(camera, CAMERA_ORBITAL);
diff --git a/projects/VSCode_tcc_win/main.c b/projects/VSCode_tcc_win/main.c
index 7a68a373..ed1bbcfd 100644
--- a/projects/VSCode_tcc_win/main.c
+++ b/projects/VSCode_tcc_win/main.c
@@ -36,7 +36,7 @@ int main()
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f };
camera.fovy = 60.0f;
- camera.type = CAMERA_PERSPECTIVE;
+ camera.projection = CAMERA_PERSPECTIVE;
SetCameraMode(camera, CAMERA_ORBITAL);
diff --git a/src/core.c b/src/core.c
index d01032ac..6e427ef3 100644
--- a/src/core.c
+++ b/src/core.c
@@ -1914,10 +1914,10 @@ void BeginMode3D(Camera3D camera)
float aspect = (float)CORE.Window.currentFbo.width/(float)CORE.Window.currentFbo.height;
double top = 0;
- if (camera.type == CAMERA_PERSPECTIVE) top = RL_CULL_DISTANCE_NEAR*tan(camera.fovy*0.5*DEG2RAD);
- else if (camera.type == CAMERA_ORTHOGRAPHIC) top = camera.fovy/2.0;
+ if (camera.projection == CAMERA_PERSPECTIVE) top = RL_CULL_DISTANCE_NEAR*tan(camera.fovy*0.5*DEG2RAD);
+ else if (camera.projection == CAMERA_ORTHOGRAPHIC) top = camera.fovy/2.0;
- rlFrustum(-right, top*aspect, -top, top, RL_CULL_DISTANCE_NEAR, RL_CULL_DISTANCE_FAR);
+ rlFrustum(-top*aspect, top*aspect, -top, top, RL_CULL_DISTANCE_NEAR, RL_CULL_DISTANCE_FAR);
// NOTE: zNear and zFar values are important when computing depth buffer values
@@ -2026,12 +2026,12 @@ Ray GetMouseRay(Vector2 mouse, Camera camera)
Matrix matProj = MatrixIdentity();
- if (camera.type == CAMERA_PERSPECTIVE)
+ if (camera.projection == CAMERA_PERSPECTIVE)
{
// Calculate projection matrix from perspective
matProj = MatrixPerspective(camera.fovy*DEG2RAD, ((double)GetScreenWidth()/(double)GetScreenHeight()), RL_CULL_DISTANCE_NEAR, RL_CULL_DISTANCE_FAR);
}
- else if (camera.type == CAMERA_ORTHOGRAPHIC)
+ else if (camera.projection == CAMERA_ORTHOGRAPHIC)
{
float aspect = (float)CORE.Window.screen.width/(float)CORE.Window.screen.height;
double top = camera.fovy/2.0;
@@ -2053,8 +2053,8 @@ Ray GetMouseRay(Vector2 mouse, Camera camera)
// Calculate normalized direction vector
Vector3 direction = Vector3Normalize(Vector3Subtract(farPoint, nearPoint));
- if (camera.type == CAMERA_PERSPECTIVE) ray.position = camera.position;
- else if (camera.type == CAMERA_ORTHOGRAPHIC) ray.position = cameraPlanePointerPos;
+ if (camera.projection == CAMERA_PERSPECTIVE) ray.position = camera.position;
+ else if (camera.projection == CAMERA_ORTHOGRAPHIC) ray.position = cameraPlanePointerPos;
// Apply calculated vectors to ray
ray.direction = direction;
@@ -2110,12 +2110,12 @@ Vector2 GetWorldToScreenEx(Vector3 position, Camera camera, int width, int heigh
// Calculate projection matrix (from perspective instead of frustum
Matrix matProj = MatrixIdentity();
- if (camera.type == CAMERA_PERSPECTIVE)
+ if (camera.projection == CAMERA_PERSPECTIVE)
{
// Calculate projection matrix from perspective
matProj = MatrixPerspective(camera.fovy * DEG2RAD, ((double)width/(double)height), RL_CULL_DISTANCE_NEAR, RL_CULL_DISTANCE_FAR);
}
- else if (camera.type == CAMERA_ORTHOGRAPHIC)
+ else if (camera.projection == CAMERA_ORTHOGRAPHIC)
{
float aspect = (float)CORE.Window.screen.width/(float)CORE.Window.screen.height;
double top = camera.fovy/2.0;
diff --git a/src/raylib.h b/src/raylib.h
index 3efaf039..ae1b494e 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -293,7 +293,7 @@ typedef struct Camera3D {
Vector3 target; // Camera target it looks-at
Vector3 up; // Camera up vector (rotation over its axis)
float fovy; // Camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic
- int type; // Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC
+ int projection; // Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC
} Camera3D;
typedef Camera3D Camera; // Camera type fallback, defaults to Camera3D