DisplacementMappingTechnique 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2014 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 OSGTERRAIN_DISPLACEMENTMAPPINGTECHNIQUE
  14. #define OSGTERRAIN_DISPLACEMENTMAPPINGTECHNIQUE
  15. #include <OpenThreads/Mutex>
  16. #include <osg/MatrixTransform>
  17. #include <osg/Program>
  18. #include <osgTerrain/GeometryTechnique>
  19. namespace osgTerrain
  20. {
  21. class OSGTERRAIN_EXPORT DisplacementMappingTechnique : public osgTerrain::TerrainTechnique
  22. {
  23. public:
  24. DisplacementMappingTechnique();
  25. DisplacementMappingTechnique(const DisplacementMappingTechnique&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
  26. META_Object(osgTerrain, DisplacementMappingTechnique);
  27. virtual void init(int dirtyMask, bool assumeMultiThreaded);
  28. virtual void update(osgUtil::UpdateVisitor* uv);
  29. virtual void cull(osgUtil::CullVisitor* cv);
  30. virtual void traverse(osg::NodeVisitor& nv);
  31. virtual void cleanSceneGraph();
  32. virtual void releaseGLObjects(osg::State* state) const;
  33. protected:
  34. virtual ~DisplacementMappingTechnique();
  35. mutable OpenThreads::Mutex _traversalMutex;
  36. mutable OpenThreads::Mutex _transformMutex;
  37. osg::ref_ptr<osg::MatrixTransform> _transform;
  38. OpenThreads::Atomic _currentTraversalCount;
  39. };
  40. }
  41. #endif