【文章內(nèi)容簡(jiǎn)介】
matrix:translate(), rotate(),scale(). osg::Matrix osg::Matrix mat1=osg::Matrix::scale(sx,sy,sz)。 osg::Matrix mat2=osg::Matrix::translate(tx,ty,tz)。 osg::Matrix resultMat=mat1*mat2。 osg::MatrixTransform osg::MatrixTransform is also a node in scene. It can manipulate the position and attitude of a model by internally applied 4*4 matrix. two member functions: void setMatrix()。 osg::Matrix getMatrix()。 osg::PositionAttitudeTransform類 :直接設(shè)置平移、旋轉(zhuǎn)和縮放值,比較直觀。 //設(shè)置和獲取平移的距離 void setPosition(const Vec3amp。)。 const Vec3amp。 getPosition()const。 //設(shè)置和獲取旋轉(zhuǎn)的四元數(shù) void setAttitude(const Quatamp。 quat)。 const Quatamp。 getAttitude()const。 osg::PositoinAttitude in the development practice, osg::MatrixTransform is not easy to use. So we have osg::PositionAttitude. this class provides several public member funcitons: void setPosition()。 void setScale()。 void setAttitude()。 the first two require osg::Vec3 as input value. osg::PositoinAttitude setAttitude() uses osg::Quat variable as the parameter. osg::Quat is a quaternion, wh