Hi Pavel,

The RefererenceFrame in Transform is widely used and does work robust
with ABSOLTE_RF - this is how most users with do HUDs (Camera is a
subclass from Transform.)

Just becuase the view matrix is identity doesn't mean that any
subgraph underneath will be visible, far from it, the subgraph will
only be visible if the objects local coordinates place it in front of
the camera.  In your transform set up code place add a query of the
center of the subgraph and then create a transform that takes this to
a position in front of the eye point.

Robert.

On Tue, Jan 27, 2009 at 8:49 AM, Pavel Domša <pdo...@seznam.cz> wrote:
>
> Hi all,
>
> i have an issue with osg::TransformMatrix::SetReferenceFrame and it's either
> bug or my misunderstanding. Documentation on osg::Transform explains
> difference between ABSOLUTE_RF and RELATIVE_RF pretty well. Also
> MatrixTransform.cpp shows how localToWorld transformations are being handled
> for both and code is clear and understandable.
>
> To demonstrate issue i've created simpliest scenario. Hierarchy is
> root->MatrixTransform->ModelNode(cow). Transformation is identity. By
> default reference frame is RELATIVE_RF and cow is clearly visible. But when
> reference frame is set to ABSOLUTE_RF nothing is being rendered at all. I
> believe that for ABSOLUTE_RF  cow should be visible as well since
> transformation is still identity.
>
> I googled a lot but it seems that ABSOLUTE_RF is being used only for
> osg::Camera settings and i couldn't find any piece of code where it's set on
> MatrixTransform.
>
> So is SetReferenceFrame supposed to work on osg::MatrixTransform as well? i
> believe it should because it's very handy to share states and attributes
> from hierarchy above but be able to do transformation in world coords.
>
> Demo is attached.
>
> Thanks
>
> Pavel Domsa
>
>
> #include <osg/Node>
> #include <osg/MatrixTransform>
> #include <osg/Group>
> #include <osg/BlendFunc>
> #include <osg/Geometry>
>
> #include <osgText/Text>
> #include <osgViewer/Viewer>
>
> #include <osgGA/TrackballManipulator>
> #include <osgDB/ReadFile>
> #include <osgViewer/ViewerEventHandlers>
>
>
>
> int main( int argc, char **argv )
> {
>  osg::Referenced::setThreadSafeReferenceCounting(true);
>
>  int rval = -1;
>  osg::ArgumentParser args( &argc, argv );
>
>  osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(args);
>  if(!loadedModel)
>  {
>    loadedModel = osgDB::readNodeFile("cow.osg");
>  }
>
>  std::string filename;
>
>  osgViewer::Viewer viewer;
>  viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);
>
>  viewer.addEventHandler(new osgViewer::WindowSizeHandler);
>  viewer.addEventHandler(new osgViewer::StatsHandler);
>
>  osg::ref_ptr< osg::Group > scene = new osg::Group;
>  viewer.setSceneData( scene.get() );
>
>  osg::ref_ptr<osg::MatrixTransform>  mxt = new osg::MatrixTransform;
>
>  mxt->addChild(loadedModel.get());
>
> //  mxt->setReferenceFrame(osg::Transform::ABSOLUTE_RF); // uncomment here
>
>  scene->addChild(mxt.get());
>
>  viewer.setCameraManipulator(new osgGA::TrackballManipulator());
>
>  viewer.run();
>
>  return( rval );
> }
>
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to