16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-19 15:49:19 +02:00

ui panels continued, early matrix stack work

This commit is contained in:
tmj-fstate
2017-03-14 16:44:17 +01:00
parent e0bde30ee4
commit ae39c824bb
14 changed files with 368 additions and 171 deletions

View File

@@ -11,15 +11,30 @@ http://mozilla.org/MPL/2.0/.
#include "frustum.h"
void
cFrustum::calculate() {
cFrustum::calculate( glm::mat4 &Projection, glm::mat4 &Modelview ) {
/*
float proj[ 16 ];
*/
float modl[ 16 ];
float clip[ 16 ];
float *proj = &Projection[ 0 ][ 0 ];
/*
float *modl = &Modelview[ 0 ][ 0 ];
*/
float clip[ 16 ];
/*
glGetFloatv( GL_PROJECTION_MATRIX, proj );
*/
glGetFloatv( GL_MODELVIEW_MATRIX, modl );
glm::mat4 modelview = glm::make_mat4( modl );
for( int col = 0; col < 4; ++col )
for( int row = 0; row < 4; ++row ) {
auto difference = modelview[ col ][ row ] - Modelview[ col ][ row ];
// assert( difference <= 0.01f );
}
// multiply the matrices to retrieve clipping planes
clip[ 0 ] = modl[ 0 ] * proj[ 0 ] + modl[ 1 ] * proj[ 4 ] + modl[ 2 ] * proj[ 8 ] + modl[ 3 ] * proj[ 12 ];
clip[ 1 ] = modl[ 0 ] * proj[ 1 ] + modl[ 1 ] * proj[ 5 ] + modl[ 2 ] * proj[ 9 ] + modl[ 3 ] * proj[ 13 ];