StackedQuaternionElement 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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_STACKED_QUATERNION_ELEMENT
  15. #define OSGANIMATION_STACKED_QUATERNION_ELEMENT 1
  16. #include <osgAnimation/Export>
  17. #include <osgAnimation/StackedTransformElement>
  18. #include <osgAnimation/Target>
  19. namespace osgAnimation
  20. {
  21. class OSGANIMATION_EXPORT StackedQuaternionElement : public StackedTransformElement
  22. {
  23. public:
  24. META_Object(osgAnimation, StackedQuaternionElement);
  25. StackedQuaternionElement();
  26. StackedQuaternionElement(const StackedQuaternionElement&, const osg::CopyOp&);
  27. StackedQuaternionElement(const std::string&, const osg::Quat& q = osg::Quat(0,0,0,1));
  28. StackedQuaternionElement(const osg::Quat&);
  29. void applyToMatrix(osg::Matrix& matrix) const;
  30. osg::Matrix getAsMatrix() const;
  31. bool isIdentity() const;
  32. void update(float t = 0.0);
  33. const osg::Quat& getQuaternion() const;
  34. void setQuaternion(const osg::Quat&);
  35. virtual Target* getOrCreateTarget();
  36. virtual Target* getTarget();
  37. virtual const Target* getTarget() const;
  38. protected:
  39. osg::Quat _quaternion;
  40. osg::ref_ptr<QuatTarget> _target;
  41. };
  42. }
  43. #endif