|
Revision 13041, 1.4 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/ActionBlendOut> |
|---|
| 16 | |
|---|
| 17 | using namespace osgAnimation; |
|---|
| 18 | |
|---|
| 19 | ActionBlendOut::ActionBlendOut() : _weight(0) {} |
|---|
| 20 | ActionBlendOut::ActionBlendOut(const ActionBlendOut& a, const osg::CopyOp& c) : Action(a,c) |
|---|
| 21 | { |
|---|
| 22 | _weight = a._weight; |
|---|
| 23 | _animation = a._animation; |
|---|
| 24 | } |
|---|
| 25 | |
|---|
| 26 | ActionBlendOut::ActionBlendOut(Animation* animation, double duration) |
|---|
| 27 | { |
|---|
| 28 | _animation = animation; |
|---|
| 29 | float d = duration * _fps; |
|---|
| 30 | setNumFrames(static_cast<unsigned int>(floor(d) + 1)); |
|---|
| 31 | _weight = 1.0; |
|---|
| 32 | setName("BlendOut"); |
|---|
| 33 | } |
|---|
| 34 | |
|---|
| 35 | void ActionBlendOut::computeWeight(unsigned int frame) |
|---|
| 36 | { |
|---|
| 37 | double ratio = ( (frame+1) * 1.0 / (getNumFrames()) ); |
|---|
| 38 | double w = _weight * (1.0-ratio); |
|---|
| 39 | OSG_DEBUG << getName() << " BlendOut frame " << frame << " weight " << w << std::endl; |
|---|
| 40 | _animation->setWeight(w); |
|---|
| 41 | } |
|---|