Skip to content

Commit

Permalink
Reviewed parameter names to avoid issues #3159
Browse files Browse the repository at this point in the history
  • Loading branch information
raysan5 committed Jul 10, 2023
1 parent bc40012 commit 2061bfc
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/raymath.h
Original file line number Diff line number Diff line change
Expand Up @@ -1509,39 +1509,39 @@ RMAPI Matrix MatrixFrustum(double left, double right, double bottom, double top,

// Get perspective projection matrix
// NOTE: Fovy angle must be provided in radians
RMAPI Matrix MatrixPerspective(double fovy, double aspect, double near, double far)
RMAPI Matrix MatrixPerspective(double fovY, double aspect, double nearPlane, double farPlane)
{
Matrix result = { 0 };

double top = near*tan(fovy*0.5);
double top = nearPlane*tan(fovY*0.5);
double bottom = -top;
double right = top*aspect;
double left = -right;

// MatrixFrustum(-right, right, -top, top, near, far);
float rl = (float)(right - left);
float tb = (float)(top - bottom);
float fn = (float)(far - near);
float fn = (float)(farPlane - nearPlane);

result.m0 = ((float)near*2.0f)/rl;
result.m5 = ((float)near*2.0f)/tb;
result.m0 = ((float)nearPlane*2.0f)/rl;
result.m5 = ((float)nearPlane*2.0f)/tb;
result.m8 = ((float)right + (float)left)/rl;
result.m9 = ((float)top + (float)bottom)/tb;
result.m10 = -((float)far + (float)near)/fn;
result.m10 = -((float)farPlane + (float)nearPlane)/fn;
result.m11 = -1.0f;
result.m14 = -((float)far*(float)near*2.0f)/fn;
result.m14 = -((float)farPlane*(float)nearPlane*2.0f)/fn;

return result;
}

// Get orthographic projection matrix
RMAPI Matrix MatrixOrtho(double left, double right, double bottom, double top, double near, double far)
RMAPI Matrix MatrixOrtho(double left, double right, double bottom, double top, double nearPlane, double farPlane)
{
Matrix result = { 0 };

float rl = (float)(right - left);
float tb = (float)(top - bottom);
float fn = (float)(far - near);
float fn = (float)(farPlane - nearPlane);

result.m0 = 2.0f/rl;
result.m1 = 0.0f;
Expand All @@ -1557,7 +1557,7 @@ RMAPI Matrix MatrixOrtho(double left, double right, double bottom, double top, d
result.m11 = 0.0f;
result.m12 = -((float)left + (float)right)/rl;
result.m13 = -((float)top + (float)bottom)/tb;
result.m14 = -((float)far + (float)near)/fn;
result.m14 = -((float)farPlane + (float)nearPlane)/fn;
result.m15 = 1.0f;

return result;
Expand Down

0 comments on commit 2061bfc

Please sign in to comment.