ProjectionUtils ​
Functions ​
Name | |
---|---|
std::array< glm::mat4, 2 > | constructZFlippedProjection(const glm::mat4 & m, bool flipX) |
std::array< float, 6 > | decomposePerspective(const glm::mat4 & m)<br>Decomposes the standard OpenGL perspective projection matrix into 6 frustum parameters. |
std::array< glm::mat4, 5 > | decomposePerspectiveBrown(const glm::mat4 & m)<br>Decomposition of an OpenGL perspective matrix into 4 submatrices described by Wayne Brown at https://learnwebgl.brown37.net/08_projections/projections_perspective.html#the-perspective-calculation. |
std::array< glm::mat4, 3 > | decomposePerspectiveShirley(const glm::mat4 & m)<br>Decomposition of an OpenGL perspective matrix into 3 submatrices described in the book Fundamentals of computer graphics, chapter 7 pg. |
glm::vec4 | divide(const glm::vec4 & v) |
void | extractZNearZFar(const glm::mat4 & projection, float & zNear, float & zFar) |
glm::mat4 | viewport(float x, float y, float width, float height, float n, float f) |
glm::mat4 | viewportVulkan(float x, float y, float width, float height, float n, float f) |
Functions Documentation ​
function constructZFlippedProjection ​
cpp
std::array< glm::mat4, 2 > constructZFlippedProjection(
const glm::mat4 & m,
bool flipX
)
std::array< glm::mat4, 2 > constructZFlippedProjection(
const glm::mat4 & m,
bool flipX
)
function decomposePerspective ​
cpp
std::array< float, 6 > decomposePerspective(
const glm::mat4 & m
)
std::array< float, 6 > decomposePerspective(
const glm::mat4 & m
)
Decomposes the standard OpenGL perspective projection matrix into 6 frustum parameters.
Parameters:
- m The perspective matrix
Return: Returns array of L,R,B,T,N,F
m[0,0] = 2n/(R-L) m[1,1] = 2n/(T-B) m[2,0] = (R+L)/(R-L) m[2,1] = (T+B)/(T-B) m[2,2] = -(f+n)/(f-n) = A (-1 for infinity f) m[3,2] = -(2fn)/(f-n) = B (-2n for infinity f) m[2,3] = -1
function decomposePerspectiveBrown ​
cpp
std::array< glm::mat4, 5 > decomposePerspectiveBrown(
const glm::mat4 & m
)
std::array< glm::mat4, 5 > decomposePerspectiveBrown(
const glm::mat4 & m
)
Decomposition of an OpenGL perspective matrix into 4 submatrices described by Wayne Brown at https://learnwebgl.brown37.net/08_projections/projections_perspective.html#the-perspective-calculation.
function decomposePerspectiveShirley ​
cpp
std::array< glm::mat4, 3 > decomposePerspectiveShirley(
const glm::mat4 & m
)
std::array< glm::mat4, 3 > decomposePerspectiveShirley(
const glm::mat4 & m
)
Decomposition of an OpenGL perspective matrix into 3 submatrices described in the book Fundamentals of computer graphics, chapter 7 pg.
- (SHIRLEY, Peter; ASHIKHMIN, Michael; MARSCHNER, Steve.)
function divide ​
cpp
glm::vec4 divide(
const glm::vec4 & v
)
glm::vec4 divide(
const glm::vec4 & v
)
function extractZNearZFar ​
cpp
void extractZNearZFar(
const glm::mat4 & projection,
float & zNear,
float & zFar
)
void extractZNearZFar(
const glm::mat4 & projection,
float & zNear,
float & zFar
)
function viewport ​
cpp
glm::mat4 viewport(
float x,
float y,
float width,
float height,
float n,
float f
)
glm::mat4 viewport(
float x,
float y,
float width,
float height,
float n,
float f
)
function viewportVulkan ​
cpp
glm::mat4 viewportVulkan(
float x,
float y,
float width,
float height,
float n,
float f
)
glm::mat4 viewportVulkan(
float x,
float y,
float width,
float height,
float n,
float f
)
Updated on 2025-05-31 at 12:55:31 +0000