UpdateMaterial 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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_UPDATE_MATERIAL
  15. #define OSGANIMATION_UPDATE_MATERIAL 1
  16. #include <osgAnimation/AnimationUpdateCallback>
  17. #include <osgAnimation/Export>
  18. #include <osg/StateAttribute>
  19. #include <osg/Material>
  20. namespace osgAnimation
  21. {
  22. class OSGANIMATION_EXPORT UpdateMaterial : public AnimationUpdateCallback<osg::StateAttributeCallback>
  23. {
  24. protected:
  25. osg::ref_ptr<Vec4Target> _diffuse;
  26. public:
  27. META_Object(osgAnimation, UpdateMaterial);
  28. UpdateMaterial(const std::string& name = "");
  29. UpdateMaterial(const UpdateMaterial& apc,const osg::CopyOp& copyop);
  30. /** Callback method called by the NodeVisitor when visiting a node.*/
  31. virtual void operator () (osg::StateAttribute*, osg::NodeVisitor*);
  32. void update(osg::Material& material);
  33. bool link(Channel* channel);
  34. Vec4Target* getDiffuse();
  35. };
  36. }
  37. #endif