camera->addChild(_root_group->getMatrixTransform());
- // Ensure objects are drawn in order of traversal
- camera->getOrCreateStateSet()->setBinName("TraversalOrderBin");
-
if( _texture.serviceable() )
{
setStatusFlags(STATUS_OK);
#include <osg/ShadeModel>
#include <osg/StateSet>
#include <osg/FrameBufferObject> // for GL_DEPTH_STENCIL_EXT on Windows
+#include <osgUtil/RenderBin>
#include <cassert>
namespace canvas
{
+ class PreOrderBin:
+ public osgUtil::RenderBin
+ {
+ public:
+
+ PreOrderBin()
+ {}
+ PreOrderBin( const RenderBin& rhs,
+ const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY ):
+ RenderBin(rhs, copyop)
+ {}
+
+ virtual osg::Object* cloneType() const
+ {
+ return new PreOrderBin();
+ }
+ virtual osg::Object* clone(const osg::CopyOp& copyop) const
+ {
+ return new PreOrderBin(*this,copyop);
+ }
+ virtual bool isSameKindAs(const osg::Object* obj) const
+ {
+ return dynamic_cast<const PreOrderBin*>(obj) != 0L;
+ }
+ virtual const char* className() const
+ {
+ return "PreOrderBin";
+ }
+
+ virtual void sort()
+ {
+ // Do not sort to keep traversal order...
+ }
+ };
+
+ OSG_INIT_SINGLETON_PROXY(
+ PreOrderBinProxy,
+ (osgUtil::RenderBin::addRenderBinPrototype("PreOrderBin", new PreOrderBin))
+ );
+
//----------------------------------------------------------------------------
ODGauge::ODGauge():
_size_x( -1 ),
{
addStyle("clip", "", &Element::setClip, false);
}
+
+ // Ensure elements are drawn in order they appear in the element tree
+ _transform->getOrCreateStateSet()
+ ->setRenderBinDetails
+ (
+ 0,
+ "PreOrderBin",
+ osg::StateSet::OVERRIDE_RENDERBIN_DETAILS
+ );
}
//----------------------------------------------------------------------------