ActionStripAnimation 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* -*-c++-*-
  2. * Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
  3. *
  4. * This library is open source and may be redistributed and/or modified under
  5. * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
  6. * (at your option) any later version. The full license is in LICENSE file
  7. * included with this distribution, and on the openscenegraph.org website.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * OpenSceneGraph Public License for more details.
  13. */
  14. #ifndef OSGANIMATION_ACTION_STRIPANIMATION_H
  15. #define OSGANIMATION_ACTION_STRIPANIMATION_H
  16. #include <osgAnimation/Action>
  17. #include <osgAnimation/Export>
  18. #include <osgAnimation/FrameAction>
  19. #include <osgAnimation/ActionBlendIn>
  20. #include <osgAnimation/ActionBlendOut>
  21. #include <osgAnimation/ActionAnimation>
  22. namespace osgAnimation
  23. {
  24. // encapsulate animation with blend in blend out for classic usage
  25. class OSGANIMATION_EXPORT ActionStripAnimation : public Action
  26. {
  27. public:
  28. META_Action(osgAnimation, ActionStripAnimation);
  29. ActionStripAnimation() {}
  30. ActionStripAnimation(const ActionStripAnimation& a, const osg::CopyOp& c);
  31. ActionStripAnimation(Animation* animation, double blendInDuration = 0.0, double blendOutDuration = 0.0, double blendInWeightTarget = 1.0 );
  32. ActionAnimation* getAnimation();
  33. ActionBlendIn* getBlendIn();
  34. ActionBlendOut* getBlendOut();
  35. const ActionAnimation* getAnimation() const;
  36. const ActionBlendIn* getBlendIn() const;
  37. const ActionBlendOut* getBlendOut() const;
  38. unsigned int getBlendOutStartFrame() const;
  39. unsigned int getLoop() const;
  40. void setLoop(unsigned int loop);
  41. void traverse(ActionVisitor& visitor);
  42. protected:
  43. typedef std::pair<unsigned int, osg::ref_ptr<ActionBlendOut> > FrameBlendOut;
  44. osg::ref_ptr<ActionBlendIn> _blendIn;
  45. FrameBlendOut _blendOut;
  46. osg::ref_ptr<ActionAnimation> _animation;
  47. };
  48. }
  49. #endif