TransformAttributeFunctor 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
  2. *
  3. * This library is open source and may be redistributed and/or modified under
  4. * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
  5. * (at your option) any later version. The full license is in LICENSE file
  6. * included with this distribution, and on the openscenegraph.org website.
  7. *
  8. * This library is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * OpenSceneGraph Public License for more details.
  12. */
  13. #ifndef OSGUTIL_TRANSFORMATTRIBUTEFUNCTOR
  14. #define OSGUTIL_TRANSFORMATTRIBUTEFUNCTOR 1
  15. #include <osg/Drawable>
  16. #include <osg/Notify>
  17. #include <osgUtil/Export>
  18. namespace osgUtil {
  19. /** Functor for transforming a drawable's vertex and normal attributes by specified matrix.
  20. * typically used for flattening transform down onto drawable leaves. */
  21. class OSGUTIL_EXPORT TransformAttributeFunctor : public osg::Drawable::AttributeFunctor
  22. {
  23. public:
  24. /** Construct a functor to transform a drawable's vertex and normal attributes by specified matrix.*/
  25. TransformAttributeFunctor(const osg::Matrix& m);
  26. virtual ~TransformAttributeFunctor();
  27. /** Do the work of transforming vertex and normal attributes. */
  28. virtual void apply(osg::Drawable::AttributeType type,unsigned int count,osg::Vec3* begin);
  29. virtual void apply(osg::Drawable::AttributeType type,unsigned int count,osg::Vec3d* begin);
  30. osg::Matrix _m;
  31. osg::Matrix _im;
  32. };
  33. }
  34. #endif