I'm having some troubles setting the translation of a bounding box for view frustum culling (as in I can't see a single thing being drawn). Here's the code:
[code]
bool isQuadVisible(SViewFrustrum *cam, QuadNode *node)
{
aabbox3d<f32> pointBox(node->vertices[4]->Pos);
pointBox.addInternalPoint(node->vertices[0]->Pos);
pointBox.addInternalPoint(node->vertices[1]->Pos);
pointBox.addInternalPoint(node->vertices[2]->Pos);
pointBox.addInternalPoint(node->vertices[3]->Pos);
matrix4 trans(AbsoluteTransformation);
trans.transformBox(pointBox);
for(s32 i = 0; i < 6; i++)
{
if(pointBox.classifyPlaneRelation(cam->planes[i]) != ISREL3D_BACK)
continue;
return false;
}
return true;
}
[/code]
What i'm trying to do is to build a bounding box made out of the node's vertices, translate the box to its position in the world, and check if it's within the view frustum. Help anyone?
Moving a bounding box
-
- Posts: 3
- Joined: Wed Jun 29, 2005 6:10 pm
- Contact: