Hi Robert, this is really good idea .. Haven't thought of .... Thanks again
Nick On Mon, Oct 27, 2014 at 11:52 AM, Robert Osfield <[email protected]> wrote: > HI Nick, > > If you Camera that is following the main camera requires the same view > matrix then could you not simply set the Camera::ReferenceFrame to > REALATVE_TF so that it inherits the view and projection matrix from above? > > Robert. > > On 25 October 2014 08:35, Trajce Nikolov NICK < > [email protected]> wrote: > >> Hi Robert, >> >> below is my frame code, and this seam to fix it. But, just a question, >> shouldnt the main view matrix be updated by the camera manipulator prior to >> any other update (I have attached UpdateCallback to the pre render camera >> and these seam to be called before the main camera update which results in >> frame delay)? >> >> if (_viewer.valid()) >> { >> static bool firstFrame = true; >> if (firstFrame) >> { >> _viewer->frame(); >> >> firstFrame = false; >> } >> else >> { >> _viewer->advance(); >> _viewer->eventTraversal(); >> _viewer->updateTraversal(); >> >> if (_reflectionCamera.valid()) >> { >> >> _reflectionCamera->setViewMatrix(_viewer->getView(0)->getCamera()->getViewMatrix()); >> } >> _viewer->renderingTraversals(); >> } >> >> } >> >> This way it works, it gurantee the pre render camera has the updated view >> matrix >> With this update callback it is with delay >> >> class FollowMainCameraNodeCallback : public osg::NodeCallback >> { >> public: >> FollowMainCameraNodeCallback(osg::Camera* camera) >> : _camera(camera) >> { >> >> } >> >> virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) >> { >> osg::Camera* thisCamera = dynamic_cast<osg::Camera*>(node); >> if (!thisCamera) return; >> >> thisCamera->setViewMatrix(_camera->getViewMatrix()); >> >> ..... >> _reflectionCamera->setUpdateCallback(new >> FollowMainCameraNodeCallback(_viewer->getView(0)->getCamera())); >> >> Nick >> >> >> On Fri, Oct 24, 2014 at 5:31 PM, Trajce Nikolov NICK < >> [email protected]> wrote: >> >>> thanks Robert >>> >>> Nick >>> >>> On Fri, Oct 24, 2014 at 5:19 PM, Robert Osfield < >>> [email protected]> wrote: >>> >>>> Hi Nick, >>>> >>>> The update of the CameraManipulator happens at the end of >>>> VIewer::updateTraversal(). The default Viewer::frame() implementation() >>>> runs the event and then update traversal. >>>> >>>> Your own application can override any of the viewer.frame() or >>>> updateTraversal/eventTraversal() methods so if you want to take control and >>>> do things in a different from standard you can do. >>>> >>>> Robert. >>>> >>>> On 24 October 2014 16:13, Trajce Nikolov NICK < >>>> [email protected]> wrote: >>>> >>>>> Hi Community, >>>>> >>>>> I am facing the same problem for long time and always have to "hack >>>>> it". I have prerender camera that has to follow the main camera. My >>>>> pre-render camera is always a frame behind the main camera which is >>>>> updated >>>>> by a CameraManipulator. >>>>> >>>>> The update of the Pre-Render camera is done with UpdateCallback that >>>>> simply copy the ViewMatrix of the main camera, but it seam that the main >>>>> camera is updated afterwards. >>>>> >>>>> What is the order of these updates? I was expecting the main camera is >>>>> updated from the CameraMainpulator and then everything else (including the >>>>> Pre-Render cameras), but seam it is not the case? >>>>> >>>>> Any hints on this? >>>>> >>>>> Thanks a bunch as always! >>>>> >>>>> Nick >>>>> >>>>> -- >>>>> trajce nikolov nick >>>>> >>>>> _______________________________________________ >>>>> osg-users mailing list >>>>> [email protected] >>>>> >>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >>>>> >>>>> >>>> >>>> _______________________________________________ >>>> osg-users mailing list >>>> [email protected] >>>> >>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >>>> >>>> >>> >>> >>> -- >>> trajce nikolov nick >>> >> >> >> >> -- >> trajce nikolov nick >> >> _______________________________________________ >> osg-users mailing list >> [email protected] >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> >> > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > -- trajce nikolov nick
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

