Robert, do you see this impacting the concept of data variance, which has
traditionally had different semantics for a Drawable versus a Node?

Glenn Waldron / @glennwaldron


On Tue, May 13, 2014 at 11:13 AM, Robert Osfield
<[email protected]>wrote:

> Hi All,
>
> Over the last day I have been experimenting with changing
> osg::Drawable so that it is subclassed from osg::Node rather than
> osg::Object.  The motivation behind this change is to make it simpler
> to build scene graphs that only contain a single geometry and enabling
> one to just directly attach a Geometry to the scene graph, without the
> need for decorating it with a Geode first.
>
> I have got the OSG build and running fine with this change, but I had
> to make more changes to code that accessed Drawable than I'd have
> liked, and this concerns me about the impact it may have on end users
> that will be forced to update their code toI  ideally I'd get things
> to a point where very few users need to do anything more than a
> recompile against the new version of the OSG.  With this goal in mind
> I'd like feedback from the community about what solutions
>
> The problem area is the overlap between the Node::getBound() that
> returns a BoundingSphere and the Drawable::getBound() that returns a
> BoundingBox.  Any code that gets the bounding box from the Drawable
> using the getBound() method will now fail to compile as it'll be
> getting a BoundingSphere back in place.  My current workaround to this
> is to have a Drawable::getBoundingBox() method that the can be used to
> directly access the Drawable's BoundingBox.   This tweak is perfectly
> valid implementation but it does require calling code to be modified.
>
> Might there be alternatives that C++ can help us with?  In a perfect
> world we'd be able to select the appropriate getBound() implementation
> depending upon what type it's being assigned to ie.:
>
>     // get the bounding sphere of the Drawable
>     const BoundingSphere& bs = drawable->getBound();
>
>     // but we also want the old code to keep compiling where we want
> the bounding box
>     const BoundingBox& bb = drawable->getBound();
>
> I'm currently trying to think of ways to solve this conundrum.  There
> might be a simple C++ trick that I've overlooked, which is why having
> a nice big community of C++ programmers is an asset :-)
>
> So.... what's solutions can you think of?
>
> Robert.
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to