From d7760fbbd4f004f91933311a662c373539ed143f Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 14 Jun 2002 08:45:28 +0000 Subject: [PATCH] Further updates to the occlusion culling code, also adding missing OccludeNode file the .osg plugin. --- src/osgPlugins/osg/OccluderNode.cpp | 39 +++++++++++++++++++++++++++++ src/osgUtil/CullVisitor.cpp | 4 +++ src/osgUtil/SceneView.cpp | 10 ++++---- 3 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 src/osgPlugins/osg/OccluderNode.cpp diff --git a/src/osgPlugins/osg/OccluderNode.cpp b/src/osgPlugins/osg/OccluderNode.cpp new file mode 100644 index 000000000..6d9e635ec --- /dev/null +++ b/src/osgPlugins/osg/OccluderNode.cpp @@ -0,0 +1,39 @@ +#include "osg/OccluderNode" + +#include "osgDB/Registry" +#include "osgDB/Input" +#include "osgDB/Output" + +using namespace osg; +using namespace osgDB; + +// forward declare functions to use later. +bool OccluderNode_readLocalData(Object& obj, Input& fr); +bool OccluderNode_writeLocalData(const Object& obj, Output& fw); + +// register the read and write functions with the osgDB::Registry. +RegisterDotOsgWrapperProxy g_OccluderNodeProxy +( + osgNew osg::OccluderNode, + "OccluderNode", + "Object Node Group OccluderNode", + &OccluderNode_readLocalData, + &OccluderNode_writeLocalData +); + +bool OccluderNode_readLocalData(Object& obj, Input& fr) +{ + bool iteratorAdvanced = false; + + OccluderNode& occludernode = static_cast(obj); + + return iteratorAdvanced; +} + + +bool OccluderNode_writeLocalData(const Object& obj, Output& fw) +{ + const OccluderNode& occludenode = static_cast(obj); + + return true; +} diff --git a/src/osgUtil/CullVisitor.cpp b/src/osgUtil/CullVisitor.cpp index 1a7030e37..e61b72b18 100644 --- a/src/osgUtil/CullVisitor.cpp +++ b/src/osgUtil/CullVisitor.cpp @@ -156,6 +156,10 @@ void CullVisitor::popProjectionMatrix() double min_near_plane = _computed_zfar*0.0005f; if (desired_znearsetNearFar(_cullVisitorRight->getCalculatedNearPlane(),_cullVisitorRight->getCalculatedFarPlane()); -// } + if (_camera.valid()) + { + // clamp the camera to the near/far computed in cull traversal. + _camera->setNearFar(_cullVisitorRight->getCalculatedNearPlane(),_cullVisitorRight->getCalculatedFarPlane()); + } } else