LOD
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSG_LOD
#define OSG_LOD 1
#include <osg/Group>
namespace osg {
class OSG_EXPORT LOD : public Group
{
public :
LOD();
LOD(const LOD&,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
META_Node(osg, LOD);
typedef osg::BoundingSphere::vec_type vec_type;
typedef osg::BoundingSphere::value_type value_type;
virtual void traverse(NodeVisitor& nv);
using osg::Group::addChild;
virtual bool addChild(Node *child);
virtual bool addChild(Node *child, float rmin, float rmax);
template<class T> bool addChild( const ref_ptr<T>& child, float rmin, float rmax) { return addChild(child.get(), rmin, rmax); }
virtual bool removeChildren(unsigned int pos,unsigned int numChildrenToRemove=1);
typedef std::pair<float,float> MinMaxPair;
typedef std::vector<MinMaxPair> RangeList;
enum CenterMode
{
USE_BOUNDING_SPHERE_CENTER,
USER_DEFINED_CENTER,
UNION_OF_BOUNDING_SPHERE_AND_USER_DEFINED
};
void setCenterMode(CenterMode mode) { _centerMode=mode; }
CenterMode getCenterMode() const { return _centerMode; }
inline void setCenter(const vec_type& center) { if (_centerMode!=UNION_OF_BOUNDING_SPHERE_AND_USER_DEFINED) { _centerMode=USER_DEFINED_CENTER; } _userDefinedCenter = center; }
inline const vec_type& getCenter() const { if ((_centerMode==USER_DEFINED_CENTER)||(_centerMode==UNION_OF_BOUNDING_SPHERE_AND_USER_DEFINED)) return _userDefinedCenter; else return getBound().center(); }
inline void setRadius(value_type radius) { _radius = radius; }
inline value_type getRadius() const { return _radius; }
enum RangeMode
{
DISTANCE_FROM_EYE_POINT,
PIXEL_SIZE_ON_SCREEN
};
void setRangeMode(RangeMode mode) { _rangeMode = mode; }
RangeMode getRangeMode() const { return _rangeMode; }
void setRange(unsigned int childNo, float min,float max);
inline float getMinRange(unsigned int childNo) const { return _rangeList[childNo].first; }
inline float getMaxRange(unsigned int childNo) const { return _rangeList[childNo].second; }
inline unsigned int getNumRanges() const { return static_cast<unsigned int>(_rangeList.size()); }
inline void setRangeList(const RangeList& rangeList) { _rangeList=rangeList; }
inline const RangeList& getRangeList() const { return _rangeList; }
virtual BoundingSphere computeBound() const;
protected :
virtual ~LOD() {}
CenterMode _centerMode;
vec_type _userDefinedCenter;
value_type _radius;
RangeMode _rangeMode;
RangeList _rangeList;
};
}
#endif
Group
osg::BoundingSphereImpl< Vec3d >::vec_type
Vec3d vec_type
Definition BoundingSphere:37
osg::BoundingSphereImpl< Vec3d >::value_type
Vec3d::value_type value_type
Definition BoundingSphere:38
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::Group::addChild
virtual bool addChild(Node *child)
osg::Group::Group
Group()
osg::LOD::setCenterMode
void setCenterMode(CenterMode mode)
Definition LOD:79
osg::LOD::_rangeMode
RangeMode _rangeMode
Definition LOD:148
osg::LOD::addChild
virtual bool addChild(Node *child)
osg::LOD::getCenter
const vec_type & getCenter() const
Definition LOD:92
osg::LOD::RangeMode
RangeMode
Definition LOD:107
osg::LOD::PIXEL_SIZE_ON_SCREEN
@ PIXEL_SIZE_ON_SCREEN
Definition LOD:109
osg::LOD::DISTANCE_FROM_EYE_POINT
@ DISTANCE_FROM_EYE_POINT
Definition LOD:108
osg::LOD::_rangeList
RangeList _rangeList
Definition LOD:149
osg::LOD::removeChildren
virtual bool removeChildren(unsigned int pos, unsigned int numChildrenToRemove=1)
osg::LOD::getRangeList
const RangeList & getRangeList() const
Definition LOD:137
osg::LOD::getRadius
value_type getRadius() const
Definition LOD:103
osg::LOD::LOD
LOD()
osg::LOD::setCenter
void setCenter(const vec_type &center)
Definition LOD:89
osg::LOD::addChild
virtual bool addChild(Node *child, float rmin, float rmax)
osg::LOD::getRangeMode
RangeMode getRangeMode() const
Definition LOD:116
osg::LOD::~LOD
virtual ~LOD()
Definition LOD:142
osg::LOD::MinMaxPair
std::pair< float, float > MinMaxPair
Definition LOD:66
osg::LOD::setRange
void setRange(unsigned int childNo, float min, float max)
osg::LOD::computeBound
virtual BoundingSphere computeBound() const
osg::LOD::vec_type
osg::BoundingSphere::vec_type vec_type
Definition LOD:51
osg::LOD::getMinRange
float getMinRange(unsigned int childNo) const
Definition LOD:124
osg::LOD::_centerMode
CenterMode _centerMode
Definition LOD:144
osg::LOD::getMaxRange
float getMaxRange(unsigned int childNo) const
Definition LOD:127
osg::LOD::LOD
LOD(const LOD &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
osg::LOD::setRangeMode
void setRangeMode(RangeMode mode)
Definition LOD:113
osg::LOD::getNumRanges
unsigned int getNumRanges() const
Definition LOD:131
osg::LOD::setRadius
void setRadius(value_type radius)
Definition LOD:100
osg::LOD::value_type
osg::BoundingSphere::value_type value_type
Definition LOD:52
osg::LOD::setRangeList
void setRangeList(const RangeList &rangeList)
Definition LOD:134
osg::LOD::CenterMode
CenterMode
Definition LOD:72
osg::LOD::USER_DEFINED_CENTER
@ USER_DEFINED_CENTER
Uses the user defined center as the center of object; the bounding sphere is determined by the user d...
Definition LOD:74
osg::LOD::UNION_OF_BOUNDING_SPHERE_AND_USER_DEFINED
@ UNION_OF_BOUNDING_SPHERE_AND_USER_DEFINED
Uses the user defined center as the center of object; the bounding sphere is the user defined boundin...
Definition LOD:75
osg::LOD::USE_BOUNDING_SPHERE_CENTER
@ USE_BOUNDING_SPHERE_CENTER
Uses the bounding sphere's center as the center of object and the geometrical bounding sphere of the ...
Definition LOD:73
osg::LOD::META_Node
META_Node(osg, LOD)
osg::LOD::getCenterMode
CenterMode getCenterMode() const
Definition LOD:82
osg::LOD::addChild
bool addChild(const ref_ptr< T > &child, float rmin, float rmax)
Definition LOD:62
osg::LOD::traverse
virtual void traverse(NodeVisitor &nv)
osg::LOD::_userDefinedCenter
vec_type _userDefinedCenter
Definition LOD:145
osg::LOD::RangeList
std::vector< MinMaxPair > RangeList
Definition LOD:67
osg::LOD::_radius
value_type _radius
Definition LOD:146
osg::NodeVisitor
Definition NodeVisitor:82
osg::Node
Definition Node:72
osg::Node::getBound
const BoundingSphere & getBound() const
Definition Node:425
osg::ref_ptr
Definition ref_ptr:32
osg::ref_ptr::get
T * get() const
Definition ref_ptr:117
osg
Definition AlphaFunc:19
osg::BoundingSphere
BoundingSphered BoundingSphere
Definition BoundingSphere:314
OSG_EXPORT
#define OSG_EXPORT
Definition osg/Export:39