From: James W. W. <jww...@us...> - 2007-06-02 22:51:58
|
Update of /cvsroot/quesa/quesa/Development/Source/Renderers/OpenGL In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26777/quesa/Development/Source/Renderers/OpenGL Modified Files: QOGeometry.cpp Log Message: New IsBoundsVisible method for TriMesh-level visibility culling. Index: QOGeometry.cpp =================================================================== RCS file: /cvsroot/quesa/quesa/Development/Source/Renderers/OpenGL/QOGeometry.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** QOGeometry.cpp 30 May 2007 19:28:49 -0000 1.19 --- QOGeometry.cpp 2 Jun 2007 22:51:52 -0000 1.20 *************** *** 55,58 **** --- 55,59 ---- #include "E3Memory.h" #include "E3View.h" + #include "E3Math.h" *************** *** 1317,1320 **** --- 1318,1338 ---- } + + /*! + @function IsBoundsVisible + @abstract Test whether a bounding box may be visible, for culling. + */ + bool QORenderer::Renderer::IsBoundsVisible( const TQ3BoundingBox& inLocalBox ) const + { + TQ3BoundingBox frustumBox; + E3BoundingBox_Transform( &inLocalBox, &mMatrixState.GetLocalToFrustum(), + &frustumBox ); + + return (frustumBox.min.x < 1.0f) && + (frustumBox.max.x > -1.0f) && + (frustumBox.min.y < 1.0f) && + (frustumBox.max.y > -1.0f); + } + /*! @function SubmitTriMesh *************** *** 1339,1342 **** --- 1357,1366 ---- } + // Visibility culling + if ( ! IsBoundsVisible( inGeomData->bBox )) + { + return true; + } + bool didHandle = false; |