Made the following name changes to Matrix and Quat to clean them up and make

the functionality clear given the name.  This will break user code unfortunately
so please be away of the following mapping.

  osg::Matrix::makeTrans(..)?\026 -> osg::Matrix::makeTranslate(..)
  osg::Matrix::makeRot(..)?\026   -> osg::Matrix::makeRotate(..)
  osg::Matrix::trans(..)?\026     -> osg::Matrix::translate(..)

  osg::Quat::makeRot(..)?\026     -> osg::Quat::makeRotate(..)

Also updated the rest of the OSG distribution to use the new names, and
have removed the old deprecated Matrix methods too.
This commit is contained in:
Robert Osfield 2001-12-12 20:29:10 +00:00
parent 79c1fb531d
commit f848c54ba3
21 changed files with 71 additions and 240 deletions

View File

@ -7,8 +7,6 @@
#include <math.h>
// #define USE_DEGREES_INTERNALLY
#if defined(WIN32) || defined (macintosh)
#include <float.h>
#define M_E 2.7182818284590452354
@ -70,13 +68,8 @@
namespace osg {
#ifdef USE_DEGREES_INTERNALLY
inline double inDegrees(double angle) { return angle; }
inline double inRadians(double angle) { return angle*180.0/M_PI; }
#else
inline double inDegrees(double angle) { return angle*M_PI/180.0; }
inline double inRadians(double angle) { return angle; }
#endif
inline double inDegrees(double angle) { return angle*M_PI/180.0; }
inline double inRadians(double angle) { return angle; }
inline double DegreesToRadians(double angle) { return angle*M_PI/180.0; }
inline double RadiansToDegrees(double angle) { return angle*180.0/M_PI; }

View File

@ -17,9 +17,6 @@ using std::ostream;
using std::endl;
#endif
// temporary #define to keep backwards compatibility.
//#define USE_DEPRECATED_MATRIX_METHODS
namespace osg {
class Quat;
@ -71,17 +68,17 @@ class SG_EXPORT Matrix : public Object
void makeScale( const Vec3& );
void makeScale( float, float, float );
void makeTrans( const Vec3& );
void makeTrans( float, float, float );
void makeTranslate( const Vec3& );
void makeTranslate( float, float, float );
//TODO: original preTrans was optimized (M=Tr*M)
// but also has the assumption that M (this) is an affine transformation Matrix
// can I still do something to optimize the same case now?
void makeRot( const Vec3& from, const Vec3& to );
void makeRot( float angle, const Vec3& axis );
void makeRot( float angle, float x, float y, float z );
void makeRot( const Quat& );
void makeRot( float, float, float ); //Euler angles
void makeRotate( const Vec3& from, const Vec3& to );
void makeRotate( float angle, const Vec3& axis );
void makeRotate( float angle, float x, float y, float z );
void makeRotate( const Quat& );
void makeRotate( float, float, float ); //Euler angles
bool invert( const Matrix& );
bool invertAffine( const Matrix& );
@ -90,8 +87,8 @@ class SG_EXPORT Matrix : public Object
inline static Matrix identity( void );
inline static Matrix scale( const Vec3& );
inline static Matrix scale( float, float, float );
inline static Matrix trans( const Vec3& );
inline static Matrix trans( float, float, float );
inline static Matrix translate( const Vec3& );
inline static Matrix translate( float, float, float );
inline static Matrix rotate( const Vec3&, const Vec3& );
inline static Matrix rotate( float, float, float, float );
inline static Matrix rotate( float angle, const Vec3& axis);
@ -108,32 +105,10 @@ class SG_EXPORT Matrix : public Object
void setTrans( const Vec3& v );
Vec3 getTrans() const { ensureRealized(); return Vec3(_mat[3][0],_mat[3][1],_mat[3][2]); }
#ifdef USE_DEPRECATED_MATRIX_METHODS
void copy( const Matrix& );
void preScale( float sx, float sy, float sz, const Matrix& m );
void postScale( const Matrix& m, float sx, float sy, float sz );
void preScale( float sx, float sy, float sz );
void postScale( float sx, float sy, float sz );
void preTrans( float tx, float ty, float tz, const Matrix& m );
void postTrans( const Matrix& m, float tx, float ty, float tz );
void preTrans( float tx, float ty, float tz);
void postTrans( float tx, float ty, float tz );
void preRot( float deg, float x, float y, float z, const Matrix& m );
void postRot( const Matrix& m, float deg, float x, float y, float z );
void preRot( float deg, float x, float y, float z );
void postRot( float deg, float x, float y, float z );
#endif
/** apply apply an 3x3 transform of v*M[0..2,0..2] */
inline static Vec3 transform3x3(const Vec3& v,const Matrix& m);
/** apply apply an 3x3 transform of M[0..2,0..2]*v */
inline static Vec3 transform3x3(const Matrix& m,const Vec3& v);
//end of Deprecated methods
// basic Matrix multiplication, our workhorse methods.
@ -201,40 +176,40 @@ inline Matrix Matrix::scale(const Vec3& v )
return scale(v.x(), v.y(), v.z() );
}
inline Matrix Matrix::trans(float tx, float ty, float tz)
inline Matrix Matrix::translate(float tx, float ty, float tz)
{
Matrix m;
m.makeTrans(tx,ty,tz);
m.makeTranslate(tx,ty,tz);
return m;
}
inline Matrix Matrix::trans(const Vec3& v )
inline Matrix Matrix::translate(const Vec3& v )
{
return trans(v.x(), v.y(), v.z() );
return translate(v.x(), v.y(), v.z() );
}
inline Matrix Matrix::rotate( const Quat& q )
{
Matrix m;
m.makeRot( q );
m.makeRotate( q );
return m;
}
inline Matrix Matrix::rotate(float angle, float x, float y, float z )
{
Matrix m;
m.makeRot(angle,x,y,z);
m.makeRotate(angle,x,y,z);
return m;
}
inline Matrix Matrix::rotate(float angle, const Vec3& axis )
{
Matrix m;
m.makeRot(angle,axis);
m.makeRotate(angle,axis);
return m;
}
inline Matrix Matrix::rotate(const Vec3& from, const Vec3& to )
{
Matrix m;
m.makeRot(from,to);
m.makeRotate(from,to);
return m;
}

View File

@ -199,16 +199,16 @@ class SG_EXPORT Quat
Not inlined - see the Quat.cpp file for implementation
-------------------------------------------------------- */
void makeRot ( const float angle,
void makeRotate ( const float angle,
const float x, const float y, const float z );
void makeRot ( const float angle, const Vec3& vec );
void makeRotate ( const float angle, const Vec3& vec );
/** Make a rotation Quat which will rotate vec1 to vec2.
Generally take adot product to get the angle between these
and then use a cross product to get the rotation axis
Watch out for the two special cases of when the vectors
are co-incident or opposite in direction.*/
void makeRot( const Vec3& vec1, const Vec3& vec2 );
void makeRotate( const Vec3& vec1, const Vec3& vec2 );
/** Return the angle and vector components represented by the quaternion.*/
void getRot ( float& angle, float& x, float& y, float& z ) const;

View File

@ -63,12 +63,6 @@ class SG_EXPORT Transform : public Group
(*_matrix) = (*_matrix) * mat;
dirtyBound();
}
#ifdef USE_DEPRECATED_MATRIX_METHODS
void preScale( const float sx, const float sy, const float sz );
void preTranslate( const float tx, const float ty, const float tz );
void preRotate( const float deg, const float x, const float y, const float z );
#endif
protected :

View File

@ -208,7 +208,7 @@ bool GliderManipulator::calcMovement()
float roll = inDegrees(dx*0.1f*dt);
osg::Matrix mat;
mat.makeTrans(-center);
mat.makeTranslate(-center);
mat *= Matrix::rotate(pitch,sv.x(),sv.y(),sv.z());
mat *= Matrix::rotate(roll,lv.x(),lv.y(),lv.z());
if (_yawMode==YAW_AUTOMATICALLY_WHEN_BANKED)
@ -220,7 +220,7 @@ bool GliderManipulator::calcMovement()
lv *= (_velocity*dt);
mat *= Matrix::trans(center + lv);
mat *= Matrix::translate(center + lv);
_camera->transformLookAt(mat);

View File

@ -43,7 +43,7 @@ class CameraPacket {
osg::Vec3 lv = _center-_eye;
osg::Matrix matrix;
matrix.makeIdent();
matrix.makeRot(angle_offset,_up.x(),_up.y(),_up.z());
matrix.makeRotate(angle_offset,_up.x(),_up.y(),_up.z());
lv = lv*matrix;
camera.setLookAt(_eye,_eye+lv,_up);

View File

@ -24,7 +24,7 @@ void OrientationConverter::setRotation( const Vec3 &from, const Vec3 &to )
void OrientationConverter::setTranslation( const Vec3 &trans )
{
T = Matrix::trans(trans);
T = Matrix::translate(trans);
_trans_set = true;
}
@ -45,9 +45,9 @@ void OrientationConverter::convert( Node &node )
// else
// - translate back to model's original origin.
BoundingSphere bs = node.getBound();
Matrix C = Matrix::trans( Vec3(0,0,0) - bs.center() );
Matrix C = Matrix::translate( Vec3(0,0,0) - bs.center() );
if( _trans_set == false )
T = Matrix::trans( bs.center() );
T = Matrix::translate( bs.center() );
_cv.setMatrix( C * R * S * T );
node.accept(_cv);

View File

@ -45,8 +45,8 @@ class MyTransformCallback : public osg::NodeCallback{
float delta_angle = _angular_velocity*_timer.delta_s(_orig_t,new_t);
osg::Matrix matrix;
matrix.makeRot(delta_angle,1.0f,1.0f,1.0f);
matrix *= osg::Matrix::trans(1.0f,0.0f,0.0f);
matrix.makeRotate(delta_angle,1.0f,1.0f,1.0f);
matrix *= osg::Matrix::translate(1.0f,0.0f,0.0f);
matrix *= osg::Matrix::rotate(delta_angle,0.0f,0.0f,1.0f);
_nodeToOperateOn->setMatrix(matrix);

View File

@ -367,9 +367,9 @@ int main( int argc, char **argv )
osg::Transform* dcs = new osg::Transform;
dcs->setStateSet(dstate);
dcs->preMult(osg::Matrix::trans(0.0f,0.0f,-z)*
dcs->preMult(osg::Matrix::translate(0.0f,0.0f,-z)*
osg::Matrix::scale(1.0f,1.0f,-1.0f)*
osg::Matrix::trans(0.0f,0.0f,z));
osg::Matrix::translate(0.0f,0.0f,z));
dcs->addChild(loadedModelTransform);

View File

@ -115,7 +115,7 @@ osg::Node* createTexturedItem(const osg::Vec3& offset,osg::Texture* texture,osg:
// place and also to add individual texture set to it, so that
// that state is inherited down to its children.
osg::Transform* local_transform = new osg::Transform;
local_transform->postMult(osg::Matrix::trans(offset));
local_transform->postMult(osg::Matrix::translate(offset));
// create the StateSet to store the texture data
osg::StateSet* stateset = new osg::StateSet;
@ -140,7 +140,7 @@ osg::Node* createLayer(const osg::Vec3& offset,osg::Image* image,osg::Node* geom
if (image==NULL) return NULL;
osg::Transform* top_transform = new osg::Transform;
top_transform->postMult(osg::Matrix::trans(offset));
top_transform->postMult(osg::Matrix::translate(offset));
osg::Vec3 local_offset(0.0f,0.0f,0.0f);
osg::Vec3 local_delta(3.0f,0.0f,0.0f);

View File

@ -84,7 +84,7 @@ void Billboard::calcRotation(const Vec3& eye_local, const Vec3& pos_local,Matrix
{
mat.makeIdent();
//float rotation_zrotation_z = atan2f(ev.x(),ev.y());
//mat.makeRot(inRadians(rotation_z),0.0f,0.0f,1.0f);
//mat.makeRotate(inRadians(rotation_z),0.0f,0.0f,1.0f);
float inv = 1.0f/ev_length;
float c = ev.y()*inv;
float s = ev.x()*inv;
@ -122,7 +122,7 @@ void Billboard::calcRotation(const Vec3& eye_local, const Vec3& pos_local,Matrix
cp /= cp_len;
float rotation_cp = acosf(dot);
mat.makeRot(inRadians(rotation_cp),cp[0],cp[1],cp[2]);
mat.makeRotate(inRadians(rotation_cp),cp[0],cp[1],cp[2]);
}
}
break;
@ -133,7 +133,7 @@ void Billboard::calcRotation(const Vec3& eye_local, const Vec3& pos_local,Matrix
void Billboard::calcTransform(const Vec3& eye_local, const Vec3& pos_local,Matrix& mat) const
{
// mat.makeTrans(pos_local[0],pos_local[1],pos_local[2]);
// mat.makeTranslate(pos_local[0],pos_local[1],pos_local[2]);
// mat.makeIdent();
calcRotation(eye_local,pos_local,mat);

View File

@ -678,7 +678,7 @@ void Camera::calculateMatricesAndClippingVolume() const
s[2], u[2], -f[2], 0.0f,
0.0f, 0.0f, 0.0f, 1.0f);
(*matrix) = Matrix::trans(-_eye[0], -_eye[1], -_eye[2]) * (*matrix);
(*matrix) = Matrix::translate(-_eye[0], -_eye[1], -_eye[2]) * (*matrix);
if (_modelToEyeTransform.valid())
{
@ -696,7 +696,7 @@ void Camera::calculateMatricesAndClippingVolume() const
if (_useEyeOffset)
{
(*_modelViewMatrix) = (*_modelViewMatrix) * Matrix::trans(-_eyeOffset*_focalLength/_screenDistance);
(*_modelViewMatrix) = (*_modelViewMatrix) * Matrix::translate(-_eyeOffset*_focalLength/_screenDistance);
}

View File

@ -8,31 +8,9 @@
using namespace osg;
#define DEG2RAD(x) ((x)*M_PI/180.0)
#define RAD2DEG(x) ((x)*180.0/M_PI)
// temporary #define's for warning that deprecated methods are being
// used which should be replaced by the new variants.
#define WARN_DEPRECATED
//#define ABORT_DEPRECATED
#ifdef WARN_DEPRECATED
#ifdef ABORT_DEPRECATED
#define DEPRECATED(message) \
notify(NOTICE) << message<<endl; \
abort();
#else
#define DEPRECATED(message) \
notify(NOTICE) << message<<endl;
#endif
#else
#define DEPRECATED(message)
#endif
#define SET_ROW(row, v1, v2, v3, v4 ) \
_mat[(row)][0] = (v1); \
_mat[(row)][1] = (v2); \
@ -142,12 +120,12 @@ void Matrix::makeScale( float x, float y, float z )
fully_realized = true;
}
void Matrix::makeTrans( const Vec3& v )
void Matrix::makeTranslate( const Vec3& v )
{
makeTrans( v[0], v[1], v[2] );
makeTranslate( v[0], v[1], v[2] );
}
void Matrix::makeTrans( float x, float y, float z )
void Matrix::makeTranslate( float x, float y, float z )
{
SET_ROW(0, 1, 0, 0, 0 )
SET_ROW(1, 0, 1, 0, 0 )
@ -157,40 +135,35 @@ void Matrix::makeTrans( float x, float y, float z )
fully_realized = true;
}
void Matrix::makeRot( const Vec3& from, const Vec3& to )
void Matrix::makeRotate( const Vec3& from, const Vec3& to )
{
Quat quat;
quat.makeRot(from,to);
quat.makeRotate(from,to);
quat.get(*this);
}
void Matrix::makeRot( float angle, const Vec3& axis )
void Matrix::makeRotate( float angle, const Vec3& axis )
{
Quat quat;
quat.makeRot( angle, axis);
quat.makeRotate( angle, axis);
quat.get(*this);
}
void Matrix::makeRot( float angle, float x, float y, float z )
void Matrix::makeRotate( float angle, float x, float y, float z )
{
Quat quat;
quat.makeRot( angle, x, y, z);
quat.makeRotate( angle, x, y, z);
quat.get(*this);
}
void Matrix::makeRot( const Quat& q )
void Matrix::makeRotate( const Quat& q )
{
q.get(*this);
fully_realized = true;
}
void Matrix::makeRot( float yaw, float pitch, float roll)
void Matrix::makeRotate( float yaw, float pitch, float roll)
{
#ifdef USE_DEGREES_INTERNALLY
yaw = DEG2RAD(yaw);
pitch = DEG2RAD(pitch);
roll = DEG2RAD(roll);
#endif
// lifted straight from SOLID library v1.01 Quaternion.h
// available from http://www.win.tue.nl/~gino/solid/
@ -467,87 +440,3 @@ bool Matrix::invertAffine( const Matrix& _m )
return true;
}
#ifdef USE_DEPRECATED_MATRIX_METHODS
//Deprecated methods
void Matrix::copy( const Matrix& other)
{
DEPRECATED("Matrix::copy is deprecated. Use = instead.")
(*this) = other;
}
void Matrix::preScale( float sx, float sy, float sz, const Matrix& m )
{
DEPRECATED("Matrix::preScale is deprecated. Use result = (Matrix::scale * m) instead.")
(*this) = ( scale(sx,sy,sz) * m );
}
void Matrix::postScale( const Matrix& m, float sx, float sy, float sz )
{
DEPRECATED("Matrix::postScale is deprecated. Use result = (m * Matrix::scale()) instead.")
(*this) = ( m * scale(sx,sy,sz) );
}
void Matrix::preScale( float sx, float sy, float sz )
{
DEPRECATED("Matrix::preScale is deprecated. Use M.preMult( Matrix::scale ) instead.")
preMult( scale(sx,sy,sz) );
}
void Matrix::postScale( float sx, float sy, float sz )
{
DEPRECATED("Matrix::postScale is deprecated. Use M.postMult( Matrix::scale ) instead.")
postMult( scale(sx,sy,sz) );
}
void Matrix::preTrans( float tx, float ty, float tz, const Matrix& m )
{
DEPRECATED("Matrix::preTrans is deprecated. Use result = Matrix::trans * m instead.")
(*this) = trans(tx,ty,tz) * m;
}
void Matrix::postTrans( const Matrix& m, float tx, float ty, float tz )
{
DEPRECATED("Matrix::postTrans is deprecated. Use result = m * Matrix::trans instead.")
(*this) = m * trans(tx,ty,tz);
}
void Matrix::preTrans( float tx, float ty, float tz )
{
DEPRECATED("Matrix::preTrans is deprecated. Use result = Matrix::trans * m instead.")
preMult( trans(tx,ty,tz) );
}
void Matrix::postTrans( float sx, float sy, float sz )
{
DEPRECATED("Matrix::postTrans is deprecated. Use result = m * Matrix::trans instead.")
postMult( trans(sx,sy,sz) );
}
void Matrix::preRot( float deg, float x, float y, float z, const Matrix& m )
{
DEPRECATED("Matrix::preRot is deprecated. Use result = Matrix::rot * m instead.")
(*this) = rotate(deg,x,y,z) * m;
}
void Matrix::postRot( const Matrix& m, float deg, float x, float y, float z )
{
DEPRECATED("Matrix::postRot is deprecated. Use result = m * Matrix::rotate instead.")
(*this) = m * rotate(deg,x,y,z);
}
void Matrix::preRot( float deg, float x, float y, float z )
{
DEPRECATED("Matrix::preRot is deprecated. Use m.preMult( Matrix::rotate ) instead.")
preMult( rotate(deg,x,y,z) );
}
void Matrix::postRot( float deg, float x, float y, float z )
{
DEPRECATED("Matrix::postRot is deprecated. Use m.postMult( Matrix::rotate ) instead.")
postMult( rotate(deg,x,y,z) );
}
#endif

View File

@ -15,7 +15,7 @@ using namespace osg;
/// Set the elements of the Quat to represent a rotation of angle
/// (radians) around the axis (x,y,z)
void Quat::makeRot( const float angle,
void Quat::makeRotate( const float angle,
const float x,
const float y,
const float z )
@ -31,9 +31,9 @@ const float z )
}
void Quat::makeRot( const float angle, const Vec3& vec )
void Quat::makeRotate( const float angle, const Vec3& vec )
{
makeRot( angle, vec[0], vec[1], vec[2] );
makeRotate( angle, vec[0], vec[1], vec[2] );
}
@ -42,7 +42,7 @@ void Quat::makeRot( const float angle, const Vec3& vec )
// and then use a cross product to get the rotation axis
// Watch out for the two special cases of when the vectors
// are co-incident or opposite in direction.
void Quat::makeRot( const Vec3& from, const Vec3& to )
void Quat::makeRotate( const Vec3& from, const Vec3& to )
{
const float epsilon = 0.00001f;
@ -57,7 +57,7 @@ void Quat::makeRot( const Vec3& from, const Vec3& to )
// cosangle is close to 1, so the vectors are close to being coincident
// Need to generate an angle of zero with any vector we like
// We'll choose (1,0,0)
makeRot( 0.0, 1.0, 0.0, 0.0 );
makeRotate( 0.0, 1.0, 0.0, 0.0 );
}
else
if ( fabs(cosangle + 1.0) < epsilon )
@ -87,7 +87,7 @@ void Quat::makeRot( const Vec3& from, const Vec3& to )
// and that is the axis around which to rotate.
Vec3 axis(from^to);
float angle = acos( cosangle );
makeRot( angle, axis );
makeRotate( angle, axis );
}
}

View File

@ -21,26 +21,6 @@ Transform::~Transform()
{
}
#ifdef USE_DEPRECATED_MATRIX_METHODS
void Transform::preScale( const float sx, const float sy, const float sz )
{
(*_matrix) = Matrix::scale( sx, sy, sz ) * (*_matrix);
dirtyBound();
}
void Transform::preTranslate( const float tx, const float ty, const float tz )
{
(*_matrix) = Matrix::trans( tx, ty, tz ) * (*_matrix);
dirtyBound();
}
void Transform::preRotate( const float deg, const float x, const float y, const float z )
{
(*_matrix) = Matrix::rotate( deg, x, y, z ) * (*_matrix);
dirtyBound();
}
#endif
const bool Transform::computeBound() const
{
if (!Group::computeBound()) return false;

View File

@ -1103,9 +1103,9 @@ osg::Node* ConvertFromFLT::visitMatrix(osg::Group* osgParent, MatrixRecord* rec)
// scale position.
// BJ Don't know if this should be done if version > 12
osg::Vec3 pos = m.getTrans();
m *= osg::Matrix::trans(-pos.x(),-pos.y(),-pos.z());
m *= osg::Matrix::translate(-pos.x(),-pos.y(),-pos.z());
pos *= (float)_unitScale;
m *= osg::Matrix::trans(pos);
m *= osg::Matrix::translate(pos);
dcs->setMatrix(m);
osgParent->addChild(dcs);

View File

@ -157,7 +157,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterOBJ::readNode(const std::string& fil
// note obj_x -> osg_x,
// obj_y -> osg_z,
// obj_z -> osg_y,
xform->setMatrix(osg::Matrix::trans(obj->position[0], obj->position[2], obj->position[1]));
xform->setMatrix(osg::Matrix::translate(obj->position[0], obj->position[2], obj->position[1]));
osg_top = xform;
}
else

View File

@ -408,9 +408,9 @@ bool DriveManipulator::calcMovement()
float yaw = -inDegrees(dx*0.1f*dt);
osg::Matrix mat;
mat.makeTrans(-center.x(),-center.y(),-center.z());
mat.makeTranslate(-center.x(),-center.y(),-center.z());
mat *= Matrix::rotate(yaw,uv.x(),uv.y(),uv.z());
mat *= Matrix::trans(center.x(),center.y(),center.z());
mat *= Matrix::translate(center.x(),center.y(),center.z());
center = _camera->getEyePoint();
uv = _camera->getUpVector();

View File

@ -205,7 +205,7 @@ bool FlightManipulator::calcMovement()
float roll = inDegrees(dx*0.1f*dt);
osg::Matrix mat;
mat.makeTrans(-center);
mat.makeTranslate(-center);
mat *= Matrix::rotate(pitch,sv.x(),sv.y(),sv.z());
mat *= Matrix::rotate(roll,lv.x(),lv.y(),lv.z());
if (_yawMode==YAW_AUTOMATICALLY_WHEN_BANKED)
@ -217,7 +217,7 @@ bool FlightManipulator::calcMovement()
lv *= (_velocity*dt);
mat *= Matrix::trans(center+lv);
mat *= Matrix::translate(center+lv);
_camera->transformLookAt(mat);

View File

@ -215,9 +215,9 @@ bool TrackballManipulator::calcMovement()
trackball(axis,angle,px1,py1,px0,py0);
osg::Matrix mat;
mat.makeTrans(-center.x(),-center.y(),-center.z());
mat.makeTranslate(-center.x(),-center.y(),-center.z());
mat *= Matrix::rotate(angle,axis.x(),axis.y(),axis.z());
mat *= Matrix::trans(center.x(),center.y(),center.z());
mat *= Matrix::translate(center.x(),center.y(),center.z());
_camera->transformLookAt(mat);
@ -237,7 +237,7 @@ bool TrackballManipulator::calcMovement()
osg::Vec3 dv = uv*(dy*scale)-sv*(dx*scale);
osg::Matrix mat;
mat.makeTrans(dv.x(),dv.y(),dv.z());
mat.makeTranslate(dv.x(),dv.y(),dv.z());
_camera->transformLookAt(mat);
@ -257,9 +257,9 @@ bool TrackballManipulator::calcMovement()
osg::Vec3 center = _camera->getCenterPoint();
osg::Matrix mat;
mat.makeTrans(-center.x(),-center.y(),-center.z());
mat.makeTranslate(-center.x(),-center.y(),-center.z());
mat *= Matrix::scale(scale,scale,scale);
mat *= Matrix::trans(center.x(),center.y(),center.z());
mat *= Matrix::translate(center.x(),center.y(),center.z());
_camera->transformLookAt(mat);
@ -273,7 +273,7 @@ bool TrackballManipulator::calcMovement()
osg::Vec3 dv = _camera->getLookVector()*(dy*scale);
osg::Matrix mat;
mat.makeTrans(dv.x(),dv.y(),dv.z());
mat.makeTranslate(dv.x(),dv.y(),dv.z());
_camera->transformLookAt(mat);

View File

@ -32,9 +32,9 @@ void TransformCallback::operator() (osg::Node* node, osg::NodeVisitor* nv)
double newTime = fs->getReferenceTime();
float delta_angle = _angular_velocity*(newTime-_previousTime);
osg::Matrix mat = osg::Matrix::trans(-_pivot)*
osg::Matrix mat = osg::Matrix::translate(-_pivot)*
osg::Matrix::rotate(delta_angle,_axis)*
osg::Matrix::trans(_pivot);
osg::Matrix::translate(_pivot);
// update the specified transform