aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRay <raysan5@gmail.com>2018-05-17 00:58:58 +0200
committerRay <raysan5@gmail.com>2018-05-17 00:58:58 +0200
commit0b05169aa74e7c298f44e214f2cf5aeed82f11cb (patch)
treec98fa376ed5031ab697d3a4bfdfd71e074da39ab /src
parent88c2337225e04cc8e9d412155e97df1ffedf1bae (diff)
downloadraylib-0b05169aa74e7c298f44e214f2cf5aeed82f11cb.tar.gz
raylib-0b05169aa74e7c298f44e214f2cf5aeed82f11cb.zip
Some warnings review
Diffstat (limited to 'src')
-rw-r--r--src/core.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/core.c b/src/core.c
index cae9a1c8..5cd9bfd4 100644
--- a/src/core.c
+++ b/src/core.c
@@ -1026,7 +1026,7 @@ Ray GetMouseRay(Vector2 mousePosition, Camera camera)
// Calculate view matrix from camera look at
Matrix matView = MatrixLookAt(camera.position, camera.target, camera.up);
- Matrix matProj;
+ Matrix matProj = MatrixIdentity();
if (camera.type == CAMERA_PERSPECTIVE)
{
@@ -1038,6 +1038,7 @@ Ray GetMouseRay(Vector2 mousePosition, Camera camera)
float aspect = (float)screenWidth/(float)screenHeight;
double top = camera.fovy/2.0;
double right = top*aspect;
+
// Calculate projection matrix from orthographic
matProj = MatrixOrtho(-right, right, -top, top, 0.01, 1000.0);
}
@@ -1067,18 +1068,19 @@ Ray GetMouseRay(Vector2 mousePosition, Camera camera)
Vector2 GetWorldToScreen(Vector3 position, Camera camera)
{
// Calculate projection matrix (from perspective instead of frustum
- Matrix matProj;
+ Matrix matProj = MatrixIdentity();
- if(camera.type == CAMERA_PERSPECTIVE)
+ if (camera.type == CAMERA_PERSPECTIVE)
{
// Calculate projection matrix from perspective
matProj = MatrixPerspective(camera.fovy*DEG2RAD, ((double)GetScreenWidth()/(double)GetScreenHeight()), 0.01, 1000.0);
}
- else if(camera.type == CAMERA_ORTHOGRAPHIC)
+ else if (camera.type == CAMERA_ORTHOGRAPHIC)
{
float aspect = (float)screenWidth/(float)screenHeight;
double top = camera.fovy/2.0;
double right = top*aspect;
+
// Calculate projection matrix from orthographic
matProj = MatrixOrtho(-right, right, -top, top, 0.01, 1000.0);
}