Added an implemention of basic state sorting to the RenderBin, but have commented

out the sort operation as Peformance benifit is currently negligable, will need
to improve on the sort functor to see real benifits.
This commit is contained in:
Robert Osfield 2001-10-04 14:35:42 +00:00
parent c614c2f622
commit d5ed4e2305
2 changed files with 20 additions and 1 deletions

View File

@ -47,7 +47,7 @@ class OSGUTIL_EXPORT RenderBin : public osg::Object
void sort();
virtual void sort_local() {}
virtual void sort_local();
virtual void draw(osg::State& state,RenderLeaf*& previous);

View File

@ -1,6 +1,8 @@
#include <osgUtil/RenderBin>
#include <osgUtil/RenderStage>
#include <algorithm>
using namespace osg;
using namespace osgUtil;
@ -71,6 +73,23 @@ void RenderBin::sort()
sort_local();
}
struct StateSortFunctor
{
const bool operator() (const RenderGraph* lhs,const RenderGraph* rhs)
{
return (*(lhs->_stateset)<*(rhs->_stateset));
}
};
void RenderBin::sort_local()
{
// now sort the list into acending depth order.
// std::sort(_renderGraphList.begin(),_renderGraphList.end(),StateSortFunctor());
}
RenderBin* RenderBin::find_or_insert(int binNum,const std::string& binName)
{
// search for appropriate bin.