|
楼主 |
发表于 2011-6-3 16:43:58
|
显示全部楼层
谢谢大家 回答。我看了osg的例子,做天空盒 用 这个类是什么作用呢?
class MoveEarthySkyWithEyePointTransform : public osg::Transform
{
public:
virtual bool computeLocalToWorldMatrix(osg::Matrix& matrix,osg::NodeVisitor* nv) const
{
osgUtil::CullVisitor* cv = dynamic_cast<osgUtil::CullVisitor*>(nv);
if (cv)
{
osg::Vec3 eyePointLocal = cv->getEyeLocal();
matrix.preMultTranslate(eyePointLocal);
}
return true;
}
virtual bool computeWorldToLocalMatrix(osg::Matrix& matrix,osg::NodeVisitor* nv) const
{
osgUtil::CullVisitor* cv = dynamic_cast<osgUtil::CullVisitor*>(nv);
if (cv)
{
osg::Vec3 eyePointLocal = cv->getEyeLocal();
matrix.postMultTranslate(-eyePointLocal);
}
return true;
}
}; |
|