MCPcopy Create free account
hub / github.com/carbonengine/trinity / UpdateProjectionParameters

Function UpdateProjectionParameters

trinity/Tr2Renderer.cpp:71–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69float s_orthoHeight = 0.0f;
70
71void UpdateProjectionParameters( const Matrix& proj )
72{
73 // Use the fact that:
74 // aspect = m_22 / m_11;
75 // m_33 = z_f/(z_f-z_n), m_43 = -z_n*z_f/(z_f-z_n)
76 // => front = z_n = -m_43/m_33
77 // => back = z_f = -m_43/(1+m_43/z_n)
78 // m_22 = cotan(fov/2) = 1 / tan(fov/2)
79 // => fov = 2*tan(1/m_22)
80 s_aspectRatio = ( proj._11 ? proj._22 / proj._11 : 0.0f );
81 s_fieldOfView = ( proj._22 ? 2.0f * atan( 1.0f / proj._22 ) : 0.0f );
82 s_frontClip = ( proj._33 ? proj._43 / proj._33 : 0.0f );
83 s_backClip = proj._43 / ( 1.0f + proj._33 );
84}
85
86Matrix s_worldTransform;
87Matrix s_inverseWorldTransform;

Callers 3

PopProjectionMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected