|
Revision 13041, 2.1 kB
(checked in by robert, 14 months ago)
|
|
Ran script to remove trailing spaces and tabs
|
-
Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | #include <osgAnimation/StackedRotateAxisElement> |
|---|
| 16 | |
|---|
| 17 | using namespace osgAnimation; |
|---|
| 18 | |
|---|
| 19 | StackedRotateAxisElement::StackedRotateAxisElement(const std::string& name, const osg::Vec3& axis, double angle) : StackedTransformElement(), _axis(axis), _angle(angle) { setName(name); } |
|---|
| 20 | StackedRotateAxisElement::StackedRotateAxisElement(const osg::Vec3& axis, double angle) : _axis(axis), _angle(angle) { setName("rotateaxis"); } |
|---|
| 21 | StackedRotateAxisElement::StackedRotateAxisElement() {} |
|---|
| 22 | StackedRotateAxisElement::StackedRotateAxisElement(const StackedRotateAxisElement& rhs, const osg::CopyOp&) : StackedTransformElement(rhs), _axis(rhs._axis), _angle(rhs._angle) |
|---|
| 23 | { |
|---|
| 24 | if (rhs._target.valid()) |
|---|
| 25 | _target = new FloatTarget(*rhs._target); |
|---|
| 26 | } |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | osg::Matrix StackedRotateAxisElement::getAsMatrix() const { return osg::Matrix::rotate(osg::Quat(_angle, _axis)); } |
|---|
| 30 | void StackedRotateAxisElement::update(float t) |
|---|
| 31 | { |
|---|
| 32 | if (_target.valid()) |
|---|
| 33 | _angle = _target->getValue(); |
|---|
| 34 | } |
|---|
| 35 | |
|---|
| 36 | const osg::Vec3& StackedRotateAxisElement::getAxis() const { return _axis; } |
|---|
| 37 | double StackedRotateAxisElement::getAngle() const { return _angle; } |
|---|
| 38 | void StackedRotateAxisElement::setAxis(const osg::Vec3& axis) |
|---|
| 39 | { |
|---|
| 40 | _axis = axis; |
|---|
| 41 | } |
|---|
| 42 | |
|---|
| 43 | void StackedRotateAxisElement::setAngle(double angle) |
|---|
| 44 | { |
|---|
| 45 | _angle = angle; |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | Target* StackedRotateAxisElement::getOrCreateTarget() |
|---|
| 49 | { |
|---|
| 50 | if (!_target.valid()) |
|---|
| 51 | _target = new FloatTarget(_angle); |
|---|
| 52 | return _target.get(); |
|---|
| 53 | } |
|---|
| 54 | |
|---|
| 55 | void StackedRotateAxisElement::applyToMatrix(osg::Matrix& matrix) const { matrix.preMultRotate(osg::Quat(_angle, _axis)); } |
|---|