|
本帖最后由 真奇不姓妙 于 2015-7-28 18:09 编辑
首先 我只设置了观察矩阵setViewMatrixAsLookAt,场景显示是正常的,如图1所示
while(!viewer.done())
{
osg::ref_ptr<osg::Camera> camera=viewer.getCamera();
camera->setViewMatrixAsLookAt(osg::Vec3(0.f,-30.f,5.f),osg::Vec3(0.f,0.f,0.f),osg::Vec3(0.f,0.f,1.f));
viewer.frame();
}
但是,之后我又设置了透视投影矩阵,模型光照就变的黑黑的,下面的立方体和人物裙角那里也感觉错位了,如图2。
while(!viewer.done())
{
osg::ref_ptr<osg::Camera> camera=viewer.getCamera();
camera->setProjectionMatrixAsPerspective(30,width/height,-20,100);
camera->setViewMatrixAsLookAt(osg::Vec3(0.f,-30.f,5.f),osg::Vec3(0.f,0.f,0.f),osg::Vec3(0.f,0.f,1.f));
viewer.frame();
}
请问,这是为什么啊?要怎么解决呢?谢谢! |
-
图1
-
|