[osg-users] update slave camera with frame scheme ON_DEMAND

Gianni Ambrosio g.ambrosio+osg at gmail.com
Wed Aug 5 07:25:04 PDT 2015


Thank you Robert for the explanation.

Please don't blame me if I have a couple of questions.

First of all, debugging the updateTraversal() implementation it seems the AxesCameraUpdateCallback is called twice: one in

scene->updateSceneGraph(*_updateVisitor);

and the second time in

camera->accept(*_updateVisitor);

I guess this is an expected behavior.

Second, you say "The master Camera's value can depend upon values in the scene graph". But isn't the scene updated in updateSceneGraph call? While the slave cameras are updated in a couple of following for loops? I mean, couldn't the main camera view matrix be updated, I agree after the updateSceneGraph() call, but before the slave cameras? Or at least move the slave cameras with "_useMastersSceneData=false" after the main camera? Something like:

Code:

        if (view->getCameraManipulator())
        {
            view->setFusionDistance( view->getCameraManipulator()->getFusionDistanceMode(),
                                    view->getCameraManipulator()->getFusionDistanceValue() );

            view->getCamera()->setViewMatrix( view->getCameraManipulator()->getInverseMatrix());
        }

         // Do UpdateTraversal for slaves with their own subgraph
         for(unsigned int i=0; i<view->getNumSlaves(); ++i)
         {
               osg::View::Slave& slave = view->getSlave(i);
               osg::Camera* camera = slave._camera.get();
               if(camera && !slave._useMastersSceneData)
               {
                  camera->accept(*_updateVisitor);
               }
         }

        view->updateSlaves();




Regards,
Gianni

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=64631#64631








More information about the osg-users mailing list