OSG 如何像HOOPS一样 设置前后左右上下视图

来源:互联网 发布:疯狂淘宝李涛收费 编辑:程序博客网 时间:2024/06/10 08:37
//设置正面视图,具体参考osg坐标系,需要的话可以封装成hoops的6个视图
osg::Vec3d *eye = new osg::Vec3d(geode->getBound().center().x(), geode->getBound().center().y() - geode->getBound().radius(), geode->getBound().center().z());

mViewer->getCamera()->setViewMatrixAsLookAt(*eye, osg::Vec3d(geode->getBound().center().x(), geode->getBound().center().y(), geode->getBound().center().y()), osg::Vec3d(0.0, 0.0, 0.0));


如果想设置一个geode的视图,条用 setViewMatrixAsLookAt()函数,第一个参数是眼睛的位置,第二个参数是眼镜看的中心位置,第三个参数应该是偏移位置吧,本文第三参数为0,0,0。


如果想得到理想的视图,我们可以通过geode的包围核来设置,眼镜的位置在包围核中心-包围核半径,为前视图,中心点在包围核中心~

0 0
原创粉丝点击