void SetOrtho( Mat4 proj )
{
Mat4 inv = proj.Inverse();
// NEAR corners
Vec3 bln = inv * Vec4( Vec3( -1.0f, -1.0f, -1.0f ), 1.0f );
Vec3 brn = inv * Vec4( Vec3( 1.0f, -1.0f, -1.0f ), 1.0f );
Vec3 tln = inv * Vec4( Vec3( -1.0f, 1.0f, -1.0f ), 1.0f );
Vec3 trn = inv * Vec4( Vec3( 1.0f, 1.0f, -1.0f ), 1.0f );
// FAR corners
Vec3 blf = inv * Vec4( Vec3( -1.0f, -1.0f, 1.0f ), 1.0f );
Vec3 brf = inv * Vec4( Vec3( 1.0f, -1.0f, 1.0f ), 1.0f );
Vec3 tlf = inv * Vec4( Vec3( -1.0f, 1.0f, 1.0f ), 1.0f );
Vec3 trf = inv * Vec4( Vec3( 1.0f, 1.0f, 1.0f ), 1.0f );
Vec3 verts[] =
{
Vec3( tln ),
Vec3( trn ),
Vec3( brn ),
Vec3( bln ),
Vec3( tlf ),
Vec3( trf ),
Vec3( brf ),
Vec3( blf )
};
GLuint indexes[] =
{
// front
0, 1,
1, 2,
2, 3,
3, 0,
// back
4, 5,
5, 6,
6, 7,
7, 4,
// union
0, 4,
1, 5,
2, 6,
3, 7
};
Prana::SurfaceData *data = this->GetData();
data->mIndices.SaveData( indexes, 24 );
data->GetVBO( Prana::VBO_ID::INDEXES ).SetUpdated( false );
data->mVerts.SaveData( verts, 8 );
data->GetVBO( Prana::VBO_ID::VERTS ).SetUpdated( false );
data->CreateGL_VAO();
}