LightPointSystem 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 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 OSGSIM_LIGHTPOINTSYSTEM
  14. #define OSGSIM_LIGHTPOINTSYSTEM 1
  15. #include <osg/Object>
  16. namespace osgSim {
  17. /*
  18. * LightPointSYSTEM encapsulates animation and intensity state in a single object
  19. * that can be shared by several osgSim::LightPointNodes, thereby allowing an
  20. * application to efficiently control the animation/intensity state of
  21. * several LightPointNodes.
  22. */
  23. class LightPointSystem : public osg::Object
  24. {
  25. public :
  26. LightPointSystem() : _intensity( 1.f ), _animationState( ANIMATION_ON )
  27. { }
  28. /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
  29. LightPointSystem( const LightPointSystem& lps, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY ) :
  30. osg::Object( lps, copyop ), _intensity( lps._intensity ), _animationState( lps._animationState )
  31. { }
  32. META_Object( osgSim, LightPointSystem );
  33. typedef enum {
  34. ANIMATION_ON,
  35. ANIMATION_OFF,
  36. ANIMATION_RANDOM
  37. } AnimationState;
  38. void setIntensity( float intensity ) { _intensity = intensity; }
  39. float getIntensity() const { return _intensity; }
  40. void setAnimationState( LightPointSystem::AnimationState state ) { _animationState = state; }
  41. LightPointSystem::AnimationState getAnimationState() const { return _animationState; }
  42. protected:
  43. ~LightPointSystem() {}
  44. float _intensity;
  45. AnimationState _animationState;
  46. };
  47. }
  48. #endif