浏览代码

Some warnings review

pull/545/head
Ray 6 年前
父节点
当前提交
0b05169aa7
共有 1 个文件被更改,包括 6 次插入4 次删除
  1. +6
    -4
      src/core.c

+ 6
- 4
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);
}

正在加载...
取消
保存