1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
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.
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.
14#ifndef OSGSIM_LIGHTPOINTNODE
15#define OSGSIM_LIGHTPOINTNODE 1
17#include <osgSim/Export>
18#include <osgSim/LightPoint>
19#include <osgSim/LightPointSystem>
22#include <osg/NodeVisitor>
23#include <osg/BoundingBox>
33class OSGSIM_EXPORT LightPointNode : public osg::Node
37 typedef std::vector< LightPoint > LightPointList;
41 /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
42 LightPointNode(const LightPointNode&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
44 META_Node(osgSim,LightPointNode);
46 virtual void traverse(osg::NodeVisitor& nv);
49 unsigned int getNumLightPoints() const { return _lightPointList.size(); }
52 unsigned int addLightPoint(const LightPoint& lp);
54 void removeLightPoint(unsigned int pos);
57 LightPoint& getLightPoint(unsigned int pos) { return _lightPointList[pos]; }
59 const LightPoint& getLightPoint(unsigned int pos) const { return _lightPointList[pos]; }
62 void setLightPointList(const LightPointList& lpl) { _lightPointList=lpl; }
64 LightPointList& getLightPointList() { return _lightPointList; }
66 const LightPointList& getLightPointList() const { return _lightPointList; }
69 void setMinPixelSize(float minPixelSize) { _minPixelSize = minPixelSize; }
71 float getMinPixelSize() const { return _minPixelSize; }
73 void setMaxPixelSize(float maxPixelSize) { _maxPixelSize = maxPixelSize; }
75 float getMaxPixelSize() const { return _maxPixelSize; }
77 void setMaxVisibleDistance2(float maxVisibleDistance2) { _maxVisibleDistance2 = maxVisibleDistance2; }
79 float getMaxVisibleDistance2() const { return _maxVisibleDistance2; }
81 void setLightPointSystem( osgSim::LightPointSystem* lps) { _lightSystem = lps; }
83 osgSim::LightPointSystem* getLightPointSystem() { return _lightSystem.get(); }
84 const osgSim::LightPointSystem* getLightPointSystem() const { return _lightSystem.get(); }
86 void setPointSprite(bool enable=true) { _pointSprites = enable; }
88 bool getPointSprite() const { return _pointSprites; }
90 virtual osg::BoundingSphere computeBound() const;
96 // used to cache the bounding box of the lightpoints as a tighter
97 // view frustum check.
98 mutable osg::BoundingBox _bbox;
100 LightPointList _lightPointList;
104 float _maxVisibleDistance2;
106 osg::ref_ptr<osgSim::LightPointSystem> _lightSystem;