OpenSceneGraph 3.6.5
LOD
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 OSG_LOD
15#define OSG_LOD 1
16
17#include <osg/Group>
18
19namespace osg {
20
35class OSG_EXPORT LOD : public Group
36{
37 public :
38
44 LOD();
45
47 LOD(const LOD&,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
48
50
53
54 virtual void traverse(NodeVisitor& nv);
55
57
58 virtual bool addChild(Node *child);
59
60 virtual bool addChild(Node *child, float rmin, float rmax);
61
62 template<class T> bool addChild( const ref_ptr<T>& child, float rmin, float rmax) { return addChild(child.get(), rmin, rmax); }
63
64 virtual bool removeChildren(unsigned int pos,unsigned int numChildrenToRemove=1);
65
66 typedef std::pair<float,float> MinMaxPair;
67 typedef std::vector<MinMaxPair> RangeList;
68
77
80
83
90
93
94
100 inline void setRadius(value_type radius) { _radius = radius; }
101
103 inline value_type getRadius() const { return _radius; }
104
111
113 void setRangeMode(RangeMode mode) { _rangeMode = mode; }
114
117
118
121 void setRange(unsigned int childNo, float min,float max);
122
124 inline float getMinRange(unsigned int childNo) const { return _rangeList[childNo].first; }
125
127 inline float getMaxRange(unsigned int childNo) const { return _rangeList[childNo].second; }
128
131 inline unsigned int getNumRanges() const { return static_cast<unsigned int>(_rangeList.size()); }
132
134 inline void setRangeList(const RangeList& rangeList) { _rangeList=rangeList; }
135
137 inline const RangeList& getRangeList() const { return _rangeList; }
138
140
141 protected :
142 virtual ~LOD() {}
143
147
150
151};
152
153}
154
155#endif
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
BoundingSphered BoundingSphere
Definition BoundingSphere:308
Vec3d vec_type
Definition BoundingSphere:37
Vec3d::value_type value_type
Definition BoundingSphere:38
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
virtual bool addChild(Node *child)
Add Node to Group.
void setCenterMode(CenterMode mode)
Set how the center of object should be determined when computing which child is active.
Definition LOD:79
RangeMode _rangeMode
Definition LOD:148
virtual bool addChild(Node *child)
Add Node to Group.
const vec_type & getCenter() const
return the LOD center point.
Definition LOD:92
RangeMode
Modes that control how the range values should be interpreted when computing which child is active.
Definition LOD:107
@ PIXEL_SIZE_ON_SCREEN
Definition LOD:109
@ DISTANCE_FROM_EYE_POINT
Definition LOD:108
RangeList _rangeList
Definition LOD:149
virtual bool removeChildren(unsigned int pos, unsigned int numChildrenToRemove=1)
Remove children from Group.
const RangeList & getRangeList() const
return the list of MinMax ranges for each child.
Definition LOD:137
value_type getRadius() const
Get the object-space radius of the volume enclosed by the LOD.
Definition LOD:103
LOD()
Default constructor The default constructor sets.
void setCenter(const vec_type &center)
Sets the object-space point which defines the center of the osg::LOD.
Definition LOD:89
virtual bool addChild(Node *child, float rmin, float rmax)
RangeMode getRangeMode() const
Get how the range values should be interpreted when computing which child is active.
Definition LOD:116
virtual ~LOD()
Definition LOD:142
std::pair< float, float > MinMaxPair
Definition LOD:66
void setRange(unsigned int childNo, float min, float max)
Sets the min and max visible ranges of range of specific child.
virtual BoundingSphere computeBound() const
Compute the bounding sphere around Node's geometry or children.
osg::BoundingSphere::vec_type vec_type
Definition LOD:51
float getMinRange(unsigned int childNo) const
returns the min visible range for specified child.
Definition LOD:124
CenterMode _centerMode
Definition LOD:144
float getMaxRange(unsigned int childNo) const
returns the max visible range for specified child.
Definition LOD:127
LOD(const LOD &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
void setRangeMode(RangeMode mode)
Set how the range values should be interpreted when computing which child is active.
Definition LOD:113
unsigned int getNumRanges() const
returns the number of ranges currently set.
Definition LOD:131
void setRadius(value_type radius)
Set the object-space reference radius of the volume enclosed by the LOD.
Definition LOD:100
osg::BoundingSphere::value_type value_type
Definition LOD:52
void setRangeList(const RangeList &rangeList)
set the list of MinMax ranges for each child.
Definition LOD:134
CenterMode
Modes which control how the center of object should be determined when computing which child is activ...
Definition LOD:72
@ 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
@ 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
@ 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
META_Node(osg, LOD)
CenterMode getCenterMode() const
Get how the center of object should be determined when computing which child is active.
Definition LOD:82
bool addChild(const ref_ptr< T > &child, float rmin, float rmax)
Definition LOD:62
virtual void traverse(NodeVisitor &nv)
Traverse downwards : calls children's accept method with NodeVisitor.
vec_type _userDefinedCenter
Definition LOD:145
std::vector< MinMaxPair > RangeList
Definition LOD:67
value_type _radius
Definition LOD:146
Base class for all internal nodes in the scene graph.
Definition Node:72
const BoundingSphere & getBound() const
Definition Node:425
Visitor for type safe operations on osg::Nodes.
Definition NodeVisitor:82
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
T * get() const
Definition ref_ptr:117
#define OSG_EXPORT
Definition Export:39

osg logo
Generated at Wed Jul 23 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.