Further updates to the occlusion culling code, also adding missing OccludeNode
file the .osg plugin.
This commit is contained in:
parent
61df1ed6b7
commit
d7760fbbd4
39
src/osgPlugins/osg/OccluderNode.cpp
Normal file
39
src/osgPlugins/osg/OccluderNode.cpp
Normal file
@ -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<OccluderNode&>(obj);
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
|
||||
bool OccluderNode_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const OccluderNode& occludenode = static_cast<const OccluderNode&>(obj);
|
||||
|
||||
return true;
|
||||
}
|
@ -156,6 +156,10 @@ void CullVisitor::popProjectionMatrix()
|
||||
|
||||
double min_near_plane = _computed_zfar*0.0005f;
|
||||
if (desired_znear<min_near_plane) desired_znear=min_near_plane;
|
||||
|
||||
// assign the clamped values back to the computed values.
|
||||
_computed_znear = desired_znear;
|
||||
_computed_zfar = desired_zfar;
|
||||
|
||||
double trans_near_plane = (-desired_znear*projection(2,2)+projection(3,2))/(-desired_znear*projection(2,3)+projection(3,3));
|
||||
double trans_far_plane = (-desired_zfar*projection(2,2)+projection(3,2))/(-desired_zfar*projection(2,3)+projection(3,3));
|
||||
|
@ -261,11 +261,11 @@ void SceneView::cull()
|
||||
cullStage(projectionRight.get(),modelviewRight.get(),_cullVisitorRight.get(),_rendergraphRight.get(),_renderStageRight.get());
|
||||
|
||||
|
||||
// if (_camera.valid())
|
||||
// {
|
||||
// // clamp the camera to the near/far computed in cull traversal.
|
||||
// _camera->setNearFar(_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
|
||||
|
Loading…
Reference in New Issue
Block a user