On 10/3/2010 10:46 AM, Fred Smith wrote:
So why would I want to define a custom scene graph for a slave camera,
The decorator pattern is certainly one example. You'd use two slave Cameras to
view the same scene two ways using a decorator node.
and how do I do that anyway?
Camera::addChild( root.get() ).
2) I am not used to doing this (usually I just create a Camera and add it to a
View, the Camera is never referenced anywhere else), but I understand that, as
per their osg::Node object model inheritance, Cameras can be added to scene
graphs, I guess to position them physically in the 3D space.
When physically present in the scene graph, how are they being rendered, are
they just processed as a regular osg::Group, or is there something else I am
missing?
During cull, Cameras insert a RenderStage into the render graph. See
CullVisitor::apply(Camera&), and RenderStage, in the osgUtil library. All of the
Camera's child state and Drawables are listed under that RenderStage. Take a
look at RenderStage::draw(). This gets executed during draw for every Camera in
your scene graph, it's where the child Drawables and state are rendered / applied.
3) osg::Camera indirectly derives from osg::Group. This means I can add child
nodes to a Camera. I might sound stupid here but I've never done that. Could
you describe to me a usage scenario? If my camera is moving in a car, my car is
most likely going to have a top-level group, and my camera will be declared as
a leaf node in there... but won't have child nodes. When would a camera have
child nodes? Spectacles in front of the field of view? Just want to know if I'm
missing something here too.
I'd like to correct you: if you have done any OSG rendering at all, you _have_
added child nodes to a Camera. When you call Viewer::setSceneData(), you are
adding a child subgraph to the Viewer's Camera. The Camera's view and projection
matrices control how its children appear. In your car example, the whole scene
is a child of the Camera, and you modify the Camera's view matrix in sync with
the vehicle motion.
Not sure about your last question; perhaps the info above will answer it for
you, or give you enough info to ask it more clearly.
--
-Paul Martz Skew Matrix Software
http://www.skew-matrix.com/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org