Changed RenderLeaf and StateGraph so that they use ref_ptr<> by default for Drawable and StateSet.

This commit is contained in:
Robert Osfield
2007-08-31 16:05:24 +00:00
parent 99f6865d4d
commit 4ba3f3c1a1
8 changed files with 37 additions and 19 deletions

View File

@@ -1716,7 +1716,7 @@ void OverlayNode::traverse_VIEW_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY(osg::NodeVis
osgUtil::StateGraph* sg = cv->getCurrentStateGraph();
while(sg)
{
const osg::StateSet* stateset = sg->_stateset;
const osg::StateSet* stateset = sg->getStateSet();
if (stateset)
{
statesetStack.push_front(stateset);

View File

@@ -44,14 +44,14 @@ void RenderLeaf::render(osg::RenderInfo& renderInfo,RenderLeaf* previous)
StateGraph::moveStateGraph(state,prev_rg_parent,rg->_parent);
// send state changes and matrix changes to OpenGL.
state.apply(rg->_stateset);
state.apply(rg->getStateSet());
}
else if (rg!=prev_rg)
{
// send state changes and matrix changes to OpenGL.
state.apply(rg->_stateset);
state.apply(rg->getStateSet());
}
@@ -68,7 +68,7 @@ void RenderLeaf::render(osg::RenderInfo& renderInfo,RenderLeaf* previous)
// apply state if required.
StateGraph::moveStateGraph(state,NULL,_parent->_parent);
state.apply(_parent->_stateset);
state.apply(_parent->getStateSet());
// draw the drawable
_drawable->draw(renderInfo);

View File

@@ -534,8 +534,10 @@ void Viewer::startThreading()
_endRenderingDispatchBarrier = 0;
_endDynamicDrawBlock = new osg::EndOfDynamicDrawBlock(numViewerDoubleBufferedRenderingOperation);
#ifndef OSGUTIL_RENDERBACKEND_USE_REF_PTR
if (!osg::Referenced::getDeleteHandler()) osg::Referenced::setDeleteHandler(new osg::DeleteHandler(2));
else osg::Referenced::getDeleteHandler()->setNumFramesToRetainObjects(2);
#endif
}
if (numThreadsOnStartBarrier>1)

View File

@@ -56,7 +56,7 @@ BEGIN_OBJECT_REFLECTOR(osgUtil::RenderLeaf)
__C5_osg_Drawable_P1__getDrawable,
0);
I_PublicMemberProperty(osgUtil::StateGraph *, _parent);
I_PublicMemberProperty(osg::Drawable *, _drawable);
I_PublicMemberProperty(osg::ref_ptr< osg::Drawable >, _drawable);
I_PublicMemberProperty(osg::ref_ptr< osg::RefMatrix >, _projection);
I_PublicMemberProperty(osg::ref_ptr< osg::RefMatrix >, _modelview);
I_PublicMemberProperty(float, _depth);

View File

@@ -65,6 +65,11 @@ BEGIN_OBJECT_REFLECTOR(osgUtil::StateGraph)
__C5_osg_Referenced_P1__getUserData,
"",
"");
I_Method0(const osg::StateSet *, getStateSet,
Properties::NON_VIRTUAL,
__C5_osg_StateSet_P1__getStateSet,
"",
"");
I_Method0(bool, empty,
Properties::NON_VIRTUAL,
__bool__empty,
@@ -133,6 +138,9 @@ BEGIN_OBJECT_REFLECTOR(osgUtil::StateGraph)
I_SimpleProperty(float, MinimumDistance,
__float__getMinimumDistance,
0);
I_SimpleProperty(const osg::StateSet *, StateSet,
__C5_osg_StateSet_P1__getStateSet,
0);
I_SimpleProperty(osg::Referenced *, UserData,
__osg_Referenced_P1__getUserData,
__void__setUserData__osg_Referenced_P1);