Further work on Occlusion Culling. Most of work is complete, just debugging

required now.
This commit is contained in:
Robert Osfield
2002-06-13 16:21:00 +00:00
parent 8dcb26967c
commit 0ebe473eb5
13 changed files with 335 additions and 55 deletions

View File

@@ -109,13 +109,28 @@ void CullStack::pushProjectionMatrix(Matrix* matrix)
_projectionStack.push_back(matrix);
osg::CullingSet* cullingSet = osgNew osg::CullingSet();
// set up view frustum.
cullingSet->getFrustum().setToUnitFrustumWithoutNearFar();
cullingSet->getFrustum().transformProvidingInverse(*matrix);
// set the small feature culling.
cullingSet->setSmallFeatureCullingPixelSize(_smallFeatureCullingPixelSize);
_projectionCullingStack.push_back(cullingSet);
// set up the relevant occluders which a related to this projection.
for(ShadowVolumeOccluderList::iterator itr=_occluderList.begin();
itr!=_occluderList.end();
++itr)
{
//std::cout << " ** testing occluder"<<std::endl;
if (itr->matchProjectionMatrix(*matrix))
{
//std::cout << " ** activating occluder"<<std::endl;
cullingSet->addOccluder(*itr);
}
}
//_projectionCullingStack.push_back(osgNew osg::CullingSet(*_clipspaceCullingStack.back(),*matrix));
_projectionCullingStack.push_back(cullingSet);
pushCullingSet();