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:
parent
c614c2f622
commit
d5ed4e2305
@ -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);
|
||||
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user