Added sorting and clearing of pre and post RenderStages stored in RenderStage,
and added some debugging comments which are currently commented out from compilation - these are left in just in case future debug work requires them.
This commit is contained in:
@@ -97,7 +97,7 @@ class OSGUTIL_EXPORT RenderBin : public osg::Object
|
||||
_stateGraphList.push_back(rg);
|
||||
}
|
||||
|
||||
void sort();
|
||||
virtual void sort();
|
||||
|
||||
virtual void sortImplementation();
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ class OSGUTIL_EXPORT RenderLeaf : public osg::Referenced
|
||||
|
||||
public:
|
||||
|
||||
StateGraph* _parent;
|
||||
StateGraph* _parent;
|
||||
osg::Drawable* _drawable;
|
||||
osg::ref_ptr<osg::RefMatrix> _projection;
|
||||
osg::ref_ptr<osg::RefMatrix> _modelview;
|
||||
|
||||
@@ -179,6 +179,8 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin
|
||||
|
||||
void copyTexture(osg::State& state);
|
||||
|
||||
virtual void sort();
|
||||
|
||||
virtual void drawPreRenderStages(osg::State& state,RenderLeaf*& previous);
|
||||
|
||||
virtual void draw(osg::State& state,RenderLeaf*& previous);
|
||||
|
||||
@@ -346,6 +346,8 @@ void RenderBin::draw(osg::State& state,RenderLeaf*& previous)
|
||||
|
||||
void RenderBin::drawImplementation(osg::State& state,RenderLeaf*& previous)
|
||||
{
|
||||
// osg::notify(osg::NOTICE)<<"begin RenderBin::drawImplementation "<<className()<<" sortMode "<<getSortMode()<<std::endl;
|
||||
|
||||
// draw first set of draw bins.
|
||||
RenderBinList::iterator rbitr;
|
||||
for(rbitr = _bins.begin();
|
||||
@@ -393,7 +395,7 @@ void RenderBin::drawImplementation(osg::State& state,RenderLeaf*& previous)
|
||||
rbitr->second->draw(state,previous);
|
||||
}
|
||||
|
||||
|
||||
//osg::notify(osg::NOTICE)<<"end RenderBin::drawImplementation "<<className()<<std::endl;
|
||||
}
|
||||
|
||||
// stats
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
#include <osgUtil/RenderLeaf>
|
||||
#include <osgUtil/StateGraph>
|
||||
#include <osg/Notify>
|
||||
|
||||
using namespace osg;
|
||||
using namespace osgUtil;
|
||||
@@ -63,11 +64,13 @@ void RenderLeaf::render(State& state,RenderLeaf* previous)
|
||||
state.applyModelViewMatrix(_modelview.get());
|
||||
|
||||
// apply state if required.
|
||||
StateGraph::moveStateGraph(state,NULL,_parent->_parent);
|
||||
StateGraph::moveStateGraph(state,NULL,_parent->_parent);
|
||||
|
||||
state.apply(_parent->_stateset);
|
||||
|
||||
// draw the drawable
|
||||
_drawable->draw(state);
|
||||
}
|
||||
|
||||
// osg::notify(osg::NOTICE)<<"RenderLeaf "<<_drawable->getName()<<" "<<_depth<<std::endl;
|
||||
}
|
||||
|
||||
@@ -112,12 +112,47 @@ RenderStage::~RenderStage()
|
||||
|
||||
void RenderStage::reset()
|
||||
{
|
||||
_preRenderList.clear();
|
||||
_stageDrawnThisFrame = false;
|
||||
|
||||
if (_renderStageLighting.valid()) _renderStageLighting->reset();
|
||||
|
||||
for(RenderStageList::iterator pre_itr = _preRenderList.begin();
|
||||
pre_itr != _preRenderList.end();
|
||||
++pre_itr)
|
||||
{
|
||||
(*pre_itr)->reset();
|
||||
}
|
||||
|
||||
RenderBin::reset();
|
||||
|
||||
for(RenderStageList::iterator post_itr = _postRenderList.begin();
|
||||
post_itr != _postRenderList.end();
|
||||
++post_itr)
|
||||
{
|
||||
(*post_itr)->reset();
|
||||
}
|
||||
|
||||
_preRenderList.clear();
|
||||
_postRenderList.clear();
|
||||
}
|
||||
|
||||
void RenderStage::sort()
|
||||
{
|
||||
for(RenderStageList::iterator pre_itr = _preRenderList.begin();
|
||||
pre_itr != _preRenderList.end();
|
||||
++pre_itr)
|
||||
{
|
||||
(*pre_itr)->sort();
|
||||
}
|
||||
|
||||
RenderBin::sort();
|
||||
|
||||
for(RenderStageList::iterator post_itr = _postRenderList.begin();
|
||||
post_itr != _postRenderList.end();
|
||||
++post_itr)
|
||||
{
|
||||
(*post_itr)->sort();
|
||||
}
|
||||
}
|
||||
|
||||
void RenderStage::addPreRenderStage(RenderStage* rs)
|
||||
|
||||
@@ -582,6 +582,7 @@ void SceneView::cullStage(const osg::Matrixd& projection,const osg::Matrixd& mod
|
||||
osg::ref_ptr<RefMatrix> proj = new osg::RefMatrix(projection);
|
||||
osg::ref_ptr<RefMatrix> mv = new osg::RefMatrix(modelview);
|
||||
|
||||
|
||||
// collect any occluder in the view frustum.
|
||||
if (_camera->containsOccluderNodes())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user