summaryrefslogtreecommitdiffhomepage
path: root/src/core.c
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 /src/core.c
parentd4e2c331b1a751dd02cac36502bbb161406b0d80 (diff)
downloadraylib-07d82a91c5e710bae05525b7a053893ff3771767.tar.gz
raylib-07d82a91c5e710bae05525b7a053893ff3771767.zip
WARNING: BREAKING: RENAMED: camera.type to camera.projection
Diffstat (limited to 'src/core.c')
-rw-r--r--src/core.c18
1 files changed, 9 insertions, 9 deletions
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;