Added support for DOFTransforms into .osg format, and add pivot point support

to the PositionAttitudeTransform .osg support.

Removed a double light reference in the osglight demo.
This commit is contained in:
Robert Osfield
2002-08-27 20:18:43 +00:00
parent 1f7b133eff
commit 55d4affded
6 changed files with 175 additions and 46 deletions

View File

@@ -42,43 +42,63 @@ class SG_EXPORT DOFTransform : public Transform
virtual void traverse(NodeVisitor& nv);
void setMinHPR(const Vec3& hpr) {_minHPR = hpr;}
void setMinHPR(const Vec3& hpr) { _minHPR = hpr;}
const Vec3& getMinHPR() const { return _minHPR;}
void setMaxHPR(const Vec3& hpr) {_maxHPR = hpr;}
void setCurrentHPR(const Vec3& hpr) {_currentHPR = hpr;}
const Vec3& getMaxHPR() const { return _maxHPR;}
void setIncrementHPR(const Vec3& hpr) {_incrementHPR = hpr;}
const Vec3& getIncrementHPR() const { return _incrementHPR;}
void setCurrentHPR(const Vec3& hpr) {_currentHPR = hpr;}
const Vec3& getCurrentHPR() const {return _currentHPR;}
void updateCurrentHPR(const Vec3& hpr);
void setMinTranslate(const Vec3& translate) {_minTranslate = translate;}
const Vec3& getMinTranslate() const { return _minTranslate;}
void setMaxTranslate(const Vec3& translate) {_maxTranslate = translate;}
void setCurrentTranslate(const Vec3& translate){_currentTranslate = translate;}
void setIncrementTranslate(const Vec3& translate) {_incrementTranslate = translate;}
const Vec3& getMaxTranslate() const { return _maxTranslate;}
void setIncrementTranslate(const Vec3& translate) { _incrementTranslate = translate;}
const Vec3& getIncrementTranslate() const { return _incrementTranslate;}
void setCurrentTranslate(const Vec3& translate){ _currentTranslate = translate;}
inline const Vec3& getCurrentTranslate() const { return _currentTranslate;}
void updateCurrentTranslate(const Vec3& translate);
void setMinScale(const Vec3& scale) {_minScale = scale;}
void setMaxScale(const Vec3& scale) {_maxScale = scale;}
void setCurrentScale(const Vec3& scale) {_currentScale = scale;}
void setIncrementScale(const Vec3& scale) {_incrementScale = scale;}
void setMinScale(const Vec3& scale) { _minScale = scale;}
const Vec3& getMinScale() const { return _minScale;}
void setMaxScale(const Vec3& scale) { _maxScale = scale;}
const Vec3& getMaxScale() const { return _maxScale;}
void setIncrementScale(const Vec3& scale) { _incrementScale = scale;}
const Vec3& getIncrementScale() const { return _incrementScale;}
void setCurrentScale(const Vec3& scale) { _currentScale = scale;}
inline const Vec3& getCurrentScale() const { return _currentScale;}
void updateCurrentScale(const Vec3& scale);
void setPutMatrix(const Matrix& put) {_Put = put;}
void setInversePutMatrix(const Matrix& inversePut) {_inversePut = inversePut;}
void setLimitationFlags(const unsigned long flags) {_limitationFlags = flags;}
inline const Vec3& getCurrentHPR() const {return _currentHPR;}
inline const Vec3& getCurrentTranslate() const {return _currentTranslate;}
inline const Vec3& getCurrentScale() const {return _currentScale;}
void setPutMatrix(const Matrix& put) { _Put = put;}
inline const Matrix& getPutMatrix() const {return _Put;}
void setInversePutMatrix(const Matrix& inversePut) { _inversePut = inversePut;}
inline const Matrix& getInversePutMatrix() const {return _inversePut;}
inline const unsigned long getLimitationFlags() const {return _limitationFlags;}
void setLimitationFlags(unsigned long flags) { _limitationFlags = flags;}
inline unsigned long getLimitationFlags() const {return _limitationFlags;}
inline void setAnimationOn(bool do_animate) {_animationOn = do_animate;}
inline const bool animationOn() const {return _animationOn;}
inline bool getAnimationOn() const {return _animationOn;}
void animate();

View File

@@ -42,7 +42,7 @@ class SG_EXPORT PositionAttitudeTransform : public Transform
void setPivotPoint(const Vec3& pivot) { _pivotPoint = pivot; dirtyBound(); }
const Vec3& setPivotPoint() const { return _pivotPoint; }
const Vec3& getPivotPoint() const { return _pivotPoint; }
virtual const bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor* nv) const;

View File

@@ -61,6 +61,18 @@ class SG_EXPORT Quat
_fv = v;
}
inline float& operator [] (int i) { return _fv[i]; }
inline float operator [] (int i) const { return _fv[i]; }
inline float& x() { return _fv[0]; }
inline float& y() { return _fv[1]; }
inline float& z() { return _fv[2]; }
inline float& w() { return _fv[3]; }
inline float x() const { return _fv[0]; }
inline float y() const { return _fv[1]; }
inline float z() const { return _fv[2]; }
inline float w() const { return _fv[3]; }
/* -------------------------------------------------------------
BASIC ARITHMETIC METHODS
@@ -105,29 +117,6 @@ class SG_EXPORT Quat
return (*this); // enable nesting
}
// /// Binary multiply
// inline const Quat operator*(const Quat& rhs) const
// {
// return Quat( _fv[3]*rhs._fv[0] + _fv[0]*rhs._fv[3] + _fv[1]*rhs._fv[2] - _fv[2]*rhs._fv[1],
// _fv[3]*rhs._fv[1] - _fv[0]*rhs._fv[2] + _fv[1]*rhs._fv[3] + _fv[2]*rhs._fv[0],
// _fv[3]*rhs._fv[2] + _fv[0]*rhs._fv[1] - _fv[1]*rhs._fv[0] + _fv[2]*rhs._fv[3],
// _fv[3]*rhs._fv[3] - _fv[0]*rhs._fv[0] - _fv[1]*rhs._fv[1] - _fv[2]*rhs._fv[2] );
// }
//
// /// Unary multiply
// inline Quat& operator*=(const Quat& rhs)
// {
// float x = _fv[3]*rhs._fv[0] + _fv[0]*rhs._fv[3] + _fv[1]*rhs._fv[2] - _fv[2]*rhs._fv[1];
// float y = _fv[3]*rhs._fv[1] - _fv[0]*rhs._fv[2] + _fv[1]*rhs._fv[3] + _fv[2]*rhs._fv[0];
// float z = _fv[3]*rhs._fv[2] + _fv[0]*rhs._fv[1] - _fv[1]*rhs._fv[0] + _fv[2]*rhs._fv[3];
// _fv[3] = _fv[3]*rhs._fv[3] - _fv[0]*rhs._fv[0] - _fv[1]*rhs._fv[1] - _fv[2]*rhs._fv[2];
//
// _fv[2] = z;
// _fv[1] = y;
// _fv[0] = x;
//
// return (*this); // enable nesting
// }
/// Divide by scalar
inline const Quat operator / (const float& rhs) const