TexGenNode 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 OSG_TexGenNode
  14. #define OSG_TexGenNode 1
  15. #include <osg/Group>
  16. #include <osg/TexGen>
  17. namespace osg {
  18. /** Node for defining the position of TexGen in the scene. */
  19. class OSG_EXPORT TexGenNode : public Group
  20. {
  21. public:
  22. TexGenNode();
  23. TexGenNode(TexGen* texgen);
  24. TexGenNode(const TexGenNode& tgb, const CopyOp& copyop=CopyOp::SHALLOW_COPY);
  25. META_Node(osg, TexGenNode);
  26. enum ReferenceFrame
  27. {
  28. RELATIVE_RF,
  29. ABSOLUTE_RF
  30. };
  31. /** Set the TexGenNode's ReferenceFrame, either to be relative to its
  32. * parent reference frame. */
  33. void setReferenceFrame(ReferenceFrame rf);
  34. /** Get the TexGenNode's ReferenceFrame.*/
  35. ReferenceFrame getReferenceFrame() const { return _referenceFrame; }
  36. /** Set the texture unit that this TexGenNode is associated with.*/
  37. void setTextureUnit(unsigned int textureUnit) { _textureUnit = textureUnit; }
  38. unsigned int getTextureUnit() const { return _textureUnit; }
  39. /** Set the TexGen. */
  40. void setTexGen(TexGen* texgen);
  41. /** Get the TexGen. */
  42. inline TexGen* getTexGen() { return _texgen.get(); }
  43. /** Get the const TexGen. */
  44. inline const TexGen* getTexGen() const { return _texgen.get(); }
  45. /** Set whether to use a mutex to ensure ref() and unref() are thread safe.*/
  46. virtual void setThreadSafeRefUnref(bool threadSafe);
  47. protected:
  48. virtual ~TexGenNode();
  49. unsigned int _textureUnit;
  50. osg::ref_ptr<TexGen> _texgen;
  51. ReferenceFrame _referenceFrame;
  52. };
  53. }
  54. #endif