Further work on occludision code.

This commit is contained in:
Robert Osfield
2002-06-12 09:22:30 +00:00
parent fa13d948b5
commit c7e99ff77a
9 changed files with 145 additions and 5 deletions

View File

@@ -100,14 +100,23 @@ void CollectOccludersVisitor::apply(osg::OccluderNode& node)
// list, if so disable the appropriate ShadowOccluderVolume
disableOccluder(_nodePath);
std::cout<<"CollectOccludersVisitor:: We have found an Occlusion node in frustum"<<&node<<std::endl;
if (isCulled(node)) return;
std::cout<<"CollectOccludersVisitor:: We have found an Occlusion node in frustum"<<&node<<std::endl;
// push the culling mode.
pushCurrentMask();
if (node.getOccluder()&& !isCulled(node.getOccluder()->getOccluder().getVertexList()))
{
// need to test occluder against view frustum.
std::cout << " adding in Occluder"<<std::endl;
_occluderList.push_back(ShadowVolumeOccluder(_nodePath, *node.getOccluder(), getModelViewMatrix()));
}
traverse(node);
// pop the culling mode.

View File

@@ -58,7 +58,7 @@ CXXFILES =\
Projection.cpp\
Quat.cpp\
ShadeModel.cpp\
ShadowOccluderVolume.cpp\
ShadowVolumeOccluder.cpp\
State.cpp\
StateSet.cpp\
Stencil.cpp\

View File

@@ -5,6 +5,22 @@ using namespace osg;
void ShadowVolumeOccluder::computeOccluder(const NodePath& nodePath,const ConvexPlanerOccluder& occluder,const Matrix& MVP)
{
std::cout<<" Computing Occluder"<<std::endl;
}
bool ShadowVolumeOccluder::contains(const std::vector<Vec3>& vertices)
{
if (_occluderVolume.containsAllOf(vertices))
{
for(HoleList::iterator itr=_holeList.begin();
itr!=_holeList.end();
++itr)
{
if (itr->contains(vertices)) return false;
}
return true;
}
return false;
}
bool ShadowVolumeOccluder::contains(const BoundingSphere& bound)