SpiecsEngine
 
Loading...
Searching...
No Matches

◆ PerspectiveMatrixInverseZ()

glm::mat4 Spices::PerspectiveMatrixInverseZ ( float fov,
float nearPlane,
float aspectRatio )

Calculate Perspective Matrix(reverse z version).

Parameters
[in]fov.
[in]nearPlane.
[in]aspectRatio.
Returns
Returns Perspective Matrix(reverse z version).

Definition at line 127 of file Math.cpp.

128 {
129 const float tanHalfFovy = tan(glm::radians(fov) / 2.0f);
130
131 glm::mat4 mat = glm::mat4{ 0.0f };
132 mat[0][0] = 1.0f / (aspectRatio * tanHalfFovy);
133 mat[1][1] = 1.0f / tanHalfFovy;
134 mat[2][2] = 0.0f;
135 mat[2][3] = 1.0f;
136 mat[3][2] = nearPlane;
137
138 return mat;
139 }