OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LightPointNode.h
Go to the documentation of this file.
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 
14 #ifndef OSGSIM_LIGHTPOINTNODE
15 #define OSGSIM_LIGHTPOINTNODE 1
16 
17 #include <osgSim/Export>
18 #include <osgSim/LightPoint>
19 #include <osgSim/LightPointSystem>
20 
21 #include <osg/Node>
22 #include <osg/NodeVisitor>
23 #include <osg/BoundingBox>
24 #include <osg/Quat>
25 #include <osg/Vec4>
26 
27 #include <vector>
28 #include <set>
29 
30 namespace osgSim {
31 
32 
34 {
35  public :
36 
37  typedef std::vector< LightPoint > LightPointList;
38 
40 
43 
45 
46  virtual void traverse(osg::NodeVisitor& nv);
47 
48 
49  unsigned int getNumLightPoints() const { return _lightPointList.size(); }
50 
51 
52  unsigned int addLightPoint(const LightPoint& lp);
53 
54  void removeLightPoint(unsigned int pos);
55 
56 
57  LightPoint& getLightPoint(unsigned int pos) { return _lightPointList[pos]; }
58 
59  const LightPoint& getLightPoint(unsigned int pos) const { return _lightPointList[pos]; }
60 
61 
62  void setLightPointList(const LightPointList& lpl) { _lightPointList=lpl; }
63 
64  LightPointList& getLightPointList() { return _lightPointList; }
65 
66  const LightPointList& getLightPointList() const { return _lightPointList; }
67 
68 
69  void setMinPixelSize(float minPixelSize) { _minPixelSize = minPixelSize; }
70 
71  float getMinPixelSize() const { return _minPixelSize; }
72 
73  void setMaxPixelSize(float maxPixelSize) { _maxPixelSize = maxPixelSize; }
74 
75  float getMaxPixelSize() const { return _maxPixelSize; }
76 
77  void setMaxVisibleDistance2(float maxVisibleDistance2) { _maxVisibleDistance2 = maxVisibleDistance2; }
78 
79  float getMaxVisibleDistance2() const { return _maxVisibleDistance2; }
80 
81  void setLightPointSystem( osgSim::LightPointSystem* lps) { _lightSystem = lps; }
82 
83  osgSim::LightPointSystem* getLightPointSystem() { return _lightSystem.get(); }
84  const osgSim::LightPointSystem* getLightPointSystem() const { return _lightSystem.get(); }
85 
86  void setPointSprite(bool enable=true) { _pointSprites = enable; }
87 
88  bool getPointSprite() const { return _pointSprites; }
89 
90  virtual osg::BoundingSphere computeBound() const;
91 
92  protected:
93 
95 
96  // used to cache the bounding box of the lightpoints as a tighter
97  // view frustum check.
99 
100  LightPointList _lightPointList;
101 
105 
107 
109 
110 };
111 
112 }
113 
114 #endif
bool getPointSprite() const
void setMinPixelSize(float minPixelSize)
#define OSGSIM_EXPORT
Definition: Export.h:38
void setMaxVisibleDistance2(float maxVisibleDistance2)
float getMinPixelSize() const
osg::BoundingBox _bbox
float getMaxPixelSize() const
#define META_Node(library, name)
Definition: Node.h:59
LightPointList & getLightPointList()
void setPointSprite(bool enable=true)
LightPoint & getLightPoint(unsigned int pos)
void setLightPointList(const LightPointList &lpl)
void setLightPointSystem(osgSim::LightPointSystem *lps)
const LightPoint & getLightPoint(unsigned int pos) const
std::vector< LightPoint > LightPointList
const LightPointList & getLightPointList() const
LightPointList _lightPointList
float getMaxVisibleDistance2() const
osg::ref_ptr< osgSim::LightPointSystem > _lightSystem
Definition: Node.h:71
osgSim::LightPointSystem * getLightPointSystem()
const osgSim::LightPointSystem * getLightPointSystem() const
unsigned int getNumLightPoints() const
void setMaxPixelSize(float maxPixelSize)