HI Lionel,

On 13 May 2014 16:56, Lionel Lagarde <[email protected]> wrote:
> Wonderful. Our code is full of:
>   if the object is a drawable then
>     do something for the drawable
>   else
>     do something for the node

This is one of the benefits.  The existence of Geode and Drawable not
being a Node is actually a hang up of the very early days of the OSG.
Attempting to promote Drawable to Node and sucumvent the need for
using Geode is something I've been pondering for a very long time as
it simplifies usage of the scene graph in a number of cases, but
always known that some bits of the changes might be painful.

I think I've solved most of the painful bits already but I'm stuck
trying to find a way to keep end user code compiling when they use
const BoundingBox& bb = drawable->getBound().

> For the getBound problem, I think there is no solution. The return type
> is not included in the function prototype.

The straight forward interpretation of C++ suggests this, and that the
only way to differentiate will be to have a different method name as I
have done the work I have done so far.  However, I know that C++ is
quite a rich language and there are sometimes "clever" ways to solve
certain problems, so I'm not giving up right away.

I'm currently wondering if a helper Bound class might be able to help,
with it providing automatic type conversion to BoundingSphere or
BoundingBox, the Node::getBound() would then return a Bound object,
that gets automatically cast to the type the user is using.

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to