MCPcopy Create free account
hub / github.com/Panzerschrek/Chasm-Reverse / BuildViewMatrix

Function BuildViewMatrix

PanzerChasm/client/minimap_state.cpp:20–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18static const unsigned int g_view_buffer_size= GameConstants::min_screen_width;
19
20static void BuildViewMatrix(
21 const m_Vec2& camera_position,
22 const float view_angle_z,
23 const float fov,
24 m_Mat4& out_matrix )
25{
26 m_Mat4 translate, rotate, perspective, basis_change;
27 translate.Translate( m_Vec3( -camera_position, 0.0f ) );
28 rotate.RotateZ( -view_angle_z );
29 perspective.PerspectiveProjection( 1.0f, fov, g_z_near, 128.0f );
30
31 basis_change.Identity();
32 basis_change[5]= 0.0f;
33 basis_change[6]= 1.0f;
34 basis_change[9]= 1.0f;
35 basis_change[10]= 0.0f;
36
37 out_matrix= translate * rotate * basis_change * perspective;
38}
39
40// Returns -1, if fully clipped
41// Returns +1, if fully accepted

Callers 1

UpdateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected