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

Function HMM_Perspective_RH_NO

HandmadeMath.h:1797–1814  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1795
1796COVERAGE(HMM_Perspective_RH_NO, 1)
1797static inline HMM_Mat4 HMM_Perspective_RH_NO(float FOV, float AspectRatio, float Near, float Far)
1798{
1799 ASSERT_COVERED(HMM_Perspective_RH_NO);
1800
1801 HMM_Mat4 Result = {0};
1802
1803 // See https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluPerspective.xml
1804
1805 float Cotangent = 1.0f / HMM_TanF(FOV / 2.0f);
1806 Result.Elements[0][0] = Cotangent / AspectRatio;
1807 Result.Elements[1][1] = Cotangent;
1808 Result.Elements[2][3] = -1.0f;
1809
1810 Result.Elements[2][2] = (Near + Far) / (Near - Far);
1811 Result.Elements[3][2] = (2.0f * Near * Far) / (Near - Far);
1812
1813 return Result;
1814}
1815
1816COVERAGE(HMM_Perspective_RH_ZO, 1)
1817static inline HMM_Mat4 HMM_Perspective_RH_ZO(float FOV, float AspectRatio, float Near, float Far)

Callers 3

HMM_Perspective_LH_NOFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85

Calls 1

HMM_TanFFunction · 0.85

Tested by

no test coverage detected