Use Group nodes. One child is a Geode for the handlebars, the other children
are the attachments. This doesn't seem clumsy to me, this seems clean and
straightforward.
 
If you want to derive your own class from Group that has a built-in Geode
member variable, this is also an option, and useful in some cases. For
example, I have a "HandNode" that derives from Transform and displays an
articulatable hand model. The hand is a scene graph that is owned by the
HandNode, but not exposed other than via an interface for articulating the
fingers. Because HandNode is a Transform, you can add children, which are
then transformed as the hand is transformed (position and orientation in
space), useful for adding a text label or debugging/visualization aids.
Traversing both the hand subgraph and the actual children is handled by
overriding the traverse() method.
 
However, I'd never do something like this for the general-purpose case you
describe with the handlebars and attachments; just use off-the-shelf OSG for
that and save yourself a code maintenance headache.
 
Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com <http://www.skew-matrix.com/> 
+1 303 859 9466
 

  _____  

From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Cory
Riddell
Sent: Tuesday, February 03, 2009 1:09 PM
To: OpenSceneGraph Users
Subject: [osg-users] modelling geodes with children?


I'm looking for advice on typical patterns when modeling something that has
attachments (which may in turn have other attachments). I first looked for a
node type that was a composition of Geode and Group but of course I didn't
find anything. 

An example might help here. Say I want to model bicycle handlebars. Attached
to the handlebar are grips, a light, and a bell. Attached to the grips are
streamers.

So, the handlebars have geometry and has children (grips, light, and bell).
The light and bell have geometry, but no children. The grips though, have
geometry and a child (the streamers). The streamers have geometry only.

How could I model this? I thought about using a group node for any item that
has both a geometry and children, but that seems clumsy (see the attached
pic). I have a feeling that there is a simple solution that I'm just not
seeing here.

Cory



_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to