SpiecsEngine
Loading...
Searching...
No Matches
◆
PerspectiveMatrix()
glm::mat4 Spices::PerspectiveMatrix
(
float
fov
,
float
nearPlane
,
float
farPlane
,
float
aspectRatio
)
Calculate Perspective Matrix.
Parameters
[in]
fov
.
[in]
nearPlane
.
[in]
farPlane
.
[in]
aspectRatio
.
Returns
Returns Perspective Matrix.
Definition at line
100
of file
Math.cpp
.
101
{
102
const
float
tanHalfFovy = tan(glm::radians(fov) / 2.0f);
103
104
glm::mat4 mat = glm::mat4{ 0.0f };
105
mat[0][0] = 1.0f / (aspectRatio * tanHalfFovy);
106
mat[1][1] = 1.0f / tanHalfFovy;
107
mat[2][2] = farPlane / (farPlane - nearPlane);
108
mat[2][3] = 1.0f;
109
mat[3][2] = -(farPlane * nearPlane) / (farPlane - nearPlane);
110
111
return
mat;
112
}
Spices
Generated on Sun Mar 8 2026 10:24:48 for SpiecsEngine by
1.10.0