MCPcopy Index your code
hub / github.com/HandmadeMath/HandmadeMath / HMM_Perspective_RH_ZO

Function HMM_Perspective_RH_ZO

HandmadeMath.h:1817–1834  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1815
1816COVERAGE(HMM_Perspective_RH_ZO, 1)
1817static inline HMM_Mat4 HMM_Perspective_RH_ZO(float FOV, float AspectRatio, float Near, float Far)
1818{
1819 ASSERT_COVERED(HMM_Perspective_RH_ZO);
1820
1821 HMM_Mat4 Result = {0};
1822
1823 // See https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluPerspective.xml
1824
1825 float Cotangent = 1.0f / HMM_TanF(FOV / 2.0f);
1826 Result.Elements[0][0] = Cotangent / AspectRatio;
1827 Result.Elements[1][1] = Cotangent;
1828 Result.Elements[2][3] = -1.0f;
1829
1830 Result.Elements[2][2] = (Far) / (Near - Far);
1831 Result.Elements[3][2] = (Near * Far) / (Near - Far);
1832
1833 return Result;
1834}
1835
1836COVERAGE(HMM_Perspective_LH_NO, 1)
1837static inline HMM_Mat4 HMM_Perspective_LH_NO(float FOV, float AspectRatio, float Near, float Far)

Callers 3

HMM_Perspective_LH_ZOFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85

Calls 1

HMM_TanFFunction · 0.85

Tested by

no test coverage detected