Changed osgAnimation::StackedTransform::update(t). It can now be used for custom usage
This commit is contained in:
@@ -39,7 +39,7 @@ namespace osgAnimation
|
||||
const osg::Matrix& getMatrix() const { return _matrix;}
|
||||
void setMatrix(const osg::Matrix& matrix) { _matrix = matrix;}
|
||||
bool isIdentity() const { return _matrix.isIdentity(); }
|
||||
void update();
|
||||
void update(float t = 0.0);
|
||||
virtual Target* getOrCreateTarget();
|
||||
virtual Target* getTarget() {return _target.get();}
|
||||
virtual const Target* getTarget() const {return _target.get();}
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace osgAnimation
|
||||
void applyToMatrix(osg::Matrix& matrix) const;
|
||||
osg::Matrix getAsMatrix() const;
|
||||
bool isIdentity() const;
|
||||
void update();
|
||||
void update(float t = 0.0);
|
||||
|
||||
const osg::Quat& getQuaternion() const;
|
||||
void setQuaternion(const osg::Quat&);
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace osgAnimation
|
||||
void applyToMatrix(osg::Matrix& matrix) const;
|
||||
osg::Matrix getAsMatrix() const;
|
||||
bool isIdentity() const { return (_angle == 0); }
|
||||
void update();
|
||||
void update(float t = 0.0);
|
||||
|
||||
const osg::Vec3& getAxis() const;
|
||||
double getAngle() const;
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace osgAnimation
|
||||
void applyToMatrix(osg::Matrix& matrix) const;
|
||||
osg::Matrix getAsMatrix() const;
|
||||
bool isIdentity() const;
|
||||
void update();
|
||||
void update(float t = 0.0);
|
||||
const osg::Vec3& getScale() const;
|
||||
void setScale(const osg::Vec3& scale);
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace osgAnimation
|
||||
StackedTransform();
|
||||
StackedTransform(const StackedTransform&, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
|
||||
|
||||
void update();
|
||||
void update(float t = 0.0);
|
||||
const osg::Matrix& getMatrix() const;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace osgAnimation
|
||||
virtual void applyToMatrix(osg::Matrix& matrix) const = 0;
|
||||
virtual osg::Matrix getAsMatrix() const = 0;
|
||||
virtual bool isIdentity() const = 0;
|
||||
virtual void update() = 0;
|
||||
virtual void update(float t) = 0;
|
||||
virtual Target* getOrCreateTarget() {return 0;}
|
||||
virtual Target* getTarget() {return 0;}
|
||||
virtual const Target* getTarget() const {return 0;}
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace osgAnimation
|
||||
void applyToMatrix(osg::Matrix& matrix) const;
|
||||
osg::Matrix getAsMatrix() const;
|
||||
bool isIdentity() const;
|
||||
void update();
|
||||
void update(float t = 0.0);
|
||||
|
||||
const osg::Vec3& getTranslate() const;
|
||||
void setTranslate(const osg::Vec3& );
|
||||
|
||||
@@ -33,7 +33,7 @@ Target* StackedMatrixElement::getOrCreateTarget()
|
||||
return _target.get();
|
||||
}
|
||||
|
||||
void StackedMatrixElement::update()
|
||||
void StackedMatrixElement::update(float t)
|
||||
{
|
||||
if (_target.valid())
|
||||
_matrix = _target->getValue();
|
||||
|
||||
@@ -37,7 +37,7 @@ void StackedQuaternionElement::applyToMatrix(osg::Matrix& matrix) const {matrix.
|
||||
osg::Matrix StackedQuaternionElement::getAsMatrix() const { return osg::Matrix(_quaternion); }
|
||||
bool StackedQuaternionElement::isIdentity() const { return (_quaternion[0] == 0 && _quaternion[1] == 0 && _quaternion[2] == 0 && _quaternion[3] == 1.0); }
|
||||
|
||||
void StackedQuaternionElement::update()
|
||||
void StackedQuaternionElement::update(float t)
|
||||
{
|
||||
if (_target.valid())
|
||||
_quaternion = _target->getValue();
|
||||
|
||||
@@ -27,7 +27,7 @@ StackedRotateAxisElement::StackedRotateAxisElement(const StackedRotateAxisElemen
|
||||
|
||||
|
||||
osg::Matrix StackedRotateAxisElement::getAsMatrix() const { return osg::Matrix::rotate(osg::Quat(_angle, _axis)); }
|
||||
void StackedRotateAxisElement::update()
|
||||
void StackedRotateAxisElement::update(float t)
|
||||
{
|
||||
if (_target.valid())
|
||||
_angle = _target->getValue();
|
||||
|
||||
@@ -42,7 +42,7 @@ StackedScaleElement::StackedScaleElement()
|
||||
_scale = osg::Vec3(1,1,1);
|
||||
}
|
||||
|
||||
void StackedScaleElement::update()
|
||||
void StackedScaleElement::update(float t)
|
||||
{
|
||||
if (_target.valid())
|
||||
_scale = _target->getValue();
|
||||
|
||||
@@ -30,21 +30,21 @@ StackedTransform::StackedTransform(const StackedTransform& rhs, const osg::CopyO
|
||||
}
|
||||
|
||||
|
||||
void StackedTransform::update()
|
||||
void StackedTransform::update(float t)
|
||||
{
|
||||
int dirty = 0;
|
||||
for (StackedTransform::iterator it = begin(); it != end(); ++it)
|
||||
{
|
||||
|
||||
StackedTransformElement* element = it->get();
|
||||
if (!element)
|
||||
continue;
|
||||
// update and check if there are changes
|
||||
element->update();
|
||||
element->update(t);
|
||||
if (element->isIdentity())
|
||||
continue;
|
||||
dirty++;
|
||||
}
|
||||
|
||||
if (!dirty)
|
||||
return;
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ Target* StackedTranslateElement::getOrCreateTarget()
|
||||
Target* StackedTranslateElement::getTarget() {return _target.get();}
|
||||
const Target* StackedTranslateElement::getTarget() const {return _target.get();}
|
||||
|
||||
void StackedTranslateElement::update()
|
||||
void StackedTranslateElement::update(float t)
|
||||
{
|
||||
if (_target.valid())
|
||||
_translate = _target->getValue();
|
||||
|
||||
Reference in New Issue
Block a user