MCPcopy Create free account
hub / github.com/OneLoneCoder/olcPixelGameEngine / Mat_MakeProjection

Method Mat_MakeProjection

extensions/olcPGEX_Graphics3D.h:361–372  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

359 }
360
361 olc::GFX3D::mat4x4 olc::GFX3D::Math::Mat_MakeProjection(float fFovDegrees, float fAspectRatio, float fNear, float fFar)
362 {
363 float fFovRad = 1.0f / tanf(fFovDegrees * 0.5f / 180.0f * 3.14159f);
364 olc::GFX3D::mat4x4 matrix;
365 matrix.m[0][0] = fAspectRatio * fFovRad;
366 matrix.m[1][1] = fFovRad;
367 matrix.m[2][2] = fFar / (fFar - fNear);
368 matrix.m[3][2] = (-fFar * fNear) / (fFar - fNear);
369 matrix.m[2][3] = 1.0f;
370 matrix.m[3][3] = 0.0f;
371 return matrix;
372 }
373
374 olc::GFX3D::mat4x4 olc::GFX3D::Math::Mat_MultiplyMatrix(olc::GFX3D::mat4x4 &m1, olc::GFX3D::mat4x4 &m2)
375 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected