Максим Гаммер wrote:
> //передвигаем камеру в соответствии с координатами пользователя и 
> направлением его взгляда
> //следующие объявления отвечают за создание пользовательской камеры
> osg::Matrixd myCameraMatrix;
> osg::Matrixd cameraRotation;
> osg::Matrixd cameraTrans;
> 
> float xtrans = BodyX;
> float ztrans = BodyY;
> float ytrans = BodyZ;
> float xrotate = 360.0f - HeadX;
> float yrotate = HeadY;//UserInput->getYrotate();
> float zrotate = HeadZ;
> 
> cameraRotation.makeRotate(
> osg::DegreesToRadians(zrotate), osg::Vec3(0,1,0), // roll
> osg::DegreesToRadians(yrotate), osg::Vec3(1,0,0) , // pitch
> osg::DegreesToRadians(xrotate), osg::Vec3(0,0,1) ); // heading 
> 
> cameraTrans.makeTranslate( xtrans,ztrans,ytrans );
> myCameraMatrix = cameraRotation * cameraTrans;
> 
> osg::Matrixd i = myCameraMatrix.inverse(myCameraMatrix);
> UserOutput->getViewer()->getCamera()->setViewMatrix((osg::Matrixd(i.ptr()))* 
> osg::Matrixd::rotate( -3.14f / 2.0, 1, 0, 0 ));
> 
> 
> MAX,
> 
> 2009/2/21 Alexey Yurov <>
> 
> >  Hi all, it's my first expirience in openscenegraph (v2.6), and i need ur 
> > help plz. In my application i need to get camera position every frame, i 
> > try do this:
> > 
> > Code:
> > 
> > while(!viewer.done())
> > {
> > viewer.getCamera()->getViewMatrixAsLookAt(eye, center, up);
> > //eye hold camera pos???
> > viewer.frame();
> > }
> > 
> > 
> > 
> > or there is another way to get it?
> > 
> > ------------------
> > Read this topic online here:
> > http://forum.openscenegraph.org/viewtopic.php?p=7145#7145 
> > (http://forum.openscenegraph.org/viewtopic.php?p=7145#7145)
> > 
> > 
> > 
> > 
> > 
> > _______________________________________________
> > osg-users mailing list
> >  ()
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org 
> > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org)
> > 
> 
> 
> 
> -- 
> Гаммер Максим Дмитриевич
> Начальник отдела ИТ НИИ ЭОР
> 
>  ------------------
> Post generated by Mail2Forum

Я использую TrackballManipulator и мне из viwera' нужно каждый кадр извлекать 
позицию камеры

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





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to