Version 2 (modified by martin, 7 years ago)

--

Changes To Drawable

The following changes are essential to make to affected code, otherwise your original draw methods won't ever be called, so if you subclass from Drawable or Drawable::DrawCallback.

To enable more data about the current rendering traversal to be passed in the Drawable draw callbacks and subclasses drawImplementation method a new data strcture osg::RenderInfo has been introduced, and is now passed into the drawImplementation(..) method instead of osg::State&. RenderInfo "has a" osg::State object so you can get this simply and use as before.

Your sublcasses from osg::Drawable will need to changed from:

class MyDrawable : public osg::Drawable
{
   ...
   
   void drawImplementation(osg::State& state) const;

};

To

class MyDrawable : public osg::Drawable
{
   ...
   
   void drawImplementation(osg::RenderInfo& renderInfo) const;

};

The implementation of drawImplementation can be amended a bit to get back the osg::State object if you use it.

void MyDrawable::drawImplementation(osg::RenderInfo& renderInfo) const
{
    osg::State& state = *renderInfo.getState();

    ... // code as before, no other changes required.
}

Similar changes are required from Drawable::DrawCallback.