| 18 | static const unsigned int g_view_buffer_size= GameConstants::min_screen_width; |
| 19 | |
| 20 | static 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 |