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