|
楼主 |
发表于 2009-11-24 11:28:14
|
显示全部楼层
恩就是我的回调是这样写的,达不到我要的效果,大家能帮我改一下吗。万分感谢!
class SetCameraPosMatrixHandler : public osgGA::GUIEventHandler
{
public:
float _eyeData[5][3];
float _centerData[5][3];
osgViewer::Viewer* _viewer;
SetCameraPosMatrixHandler( osgViewer::Viewer* viewer ,float eyeData[5][3],float centerData[5][3] )
{
_viewer=viewer;
for (int i=0;i<5;i++)
{
for (int j=0;j<3;j++)
{
_eyeData[i][j]=eyeData[i][j];
_centerData[i][j]=centerData[i][j];
}
}
}
bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
{
int i=0;
osg::Vec3 eye, center,up;
up=osg::Vec3(0,1,0);
if(ea.getEventType()==ea.FRAME)
{
osg::Vec3 eye=osg::Vec3(_eyeData[i][0],_eyeData[i][1],_eyeData[i][2]);
osg::Vec3 center=osg::Vec3(_centerData[i][0],_centerData[i][1],_centerData[i][2]);
_viewer->getCamera()->setViewMatrixAsLookAt(eye,center,up)
i++;
}
return false;
}
}; |
|