OpenSceneGraph 3.6.5
PagedLOD
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_PagedLOD
15#define OSG_PagedLOD 1
16
17#include <osg/LOD>
18
19namespace osg {
20
23class OSG_EXPORT PagedLOD : public LOD
24{
25 public :
26
40
43
45
46 virtual void traverse(NodeVisitor& nv);
47
49
50 virtual bool addChild(Node *child);
51
52 virtual bool addChild(Node *child, float rmin, float rmax);
53
54 template<class T> bool addChild( const ref_ptr<T>& child, float rmin, float rmax) { return addChild(child.get(), rmin, rmax); }
55
56 virtual bool addChild(Node *child, float rmin, float rmax, const std::string& filename, float priorityOffset=0.0f, float priorityScale=1.0f);
57
58 template<class T> bool addChild( const ref_ptr<T>& child, float rmin, float rmax, const std::string& filename, float priorityOffset=0.0f, float priorityScale=1.0f) { return addChild(child.get(), rmin, rmax, filename, priorityOffset, priorityScale); }
59
60 virtual bool removeChildren(unsigned int pos,unsigned int numChildrenToRemove=1);
61
62
65
68
70 const osg::Referenced* getDatabaseOptions() const { return _databaseOptions.get(); }
71
72
74 void setDatabasePath(const std::string& path);
75
77 inline const std::string& getDatabasePath() const { return _databasePath; }
78
79
96
97 typedef std::vector<PerRangeData> PerRangeDataList;
98
99 void setFileName(unsigned int childNo, const std::string& filename) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._filename=filename; }
100 const std::string& getFileName(unsigned int childNo) const { return _perRangeDataList[childNo]._filename; }
101 unsigned int getNumFileNames() const { return static_cast<unsigned int>(_perRangeDataList.size()); }
102
103
104 void setPriorityOffset(unsigned int childNo, float priorityOffset) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._priorityOffset=priorityOffset; }
105 float getPriorityOffset(unsigned int childNo) const { return _perRangeDataList[childNo]._priorityOffset; }
106 unsigned int getNumPriorityOffsets() const { return static_cast<unsigned int>(_perRangeDataList.size()); }
107
108 void setPriorityScale(unsigned int childNo, float priorityScale) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._priorityScale=priorityScale; }
109 float getPriorityScale(unsigned int childNo) const { return _perRangeDataList[childNo]._priorityScale; }
110 unsigned int getNumPriorityScales() const { return static_cast<unsigned int>(_perRangeDataList.size()); }
111
113 void setMinimumExpiryTime(unsigned int childNo, double minTime) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._minExpiryTime=minTime; }
114 double getMinimumExpiryTime(unsigned int childNo) const { return _perRangeDataList[childNo]._minExpiryTime; }
115 unsigned int getNumMinimumExpiryTimes() const { return static_cast<unsigned int>(_perRangeDataList.size()); }
116
118 void setMinimumExpiryFrames(unsigned int childNo, unsigned int minFrames) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._minExpiryFrames=minFrames; }
119 unsigned int getMinimumExpiryFrames(unsigned int childNo) const { return _perRangeDataList[childNo]._minExpiryFrames; }
120 unsigned int getNumMinimumExpiryFrames() const { return static_cast<unsigned int>(_perRangeDataList.size()); }
121
122
123 void setTimeStamp(unsigned int childNo, double timeStamp) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._timeStamp=timeStamp; }
124 double getTimeStamp(unsigned int childNo) const { return _perRangeDataList[childNo]._timeStamp; }
125 unsigned int getNumTimeStamps() const { return static_cast<unsigned int>(_perRangeDataList.size()); }
126
127 void setFrameNumber(unsigned int childNo, unsigned int frameNumber) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._frameNumber=frameNumber; }
128 unsigned getFrameNumber(unsigned int childNo) const { return _perRangeDataList[childNo]._frameNumber; }
129 unsigned int getNumFrameNumbers() const { return static_cast<unsigned int>(_perRangeDataList.size()); }
130
131
136 osg::ref_ptr<osg::Referenced>& getDatabaseRequest(unsigned int childNo) { return _perRangeDataList[childNo]._databaseRequest; }
137
139 const osg::ref_ptr<osg::Referenced>& getDatabaseRequest(unsigned int childNo) const { return _perRangeDataList[childNo]._databaseRequest; }
140
141
145 inline void setFrameNumberOfLastTraversal(unsigned int frameNumber) { _frameNumberOfLastTraversal=frameNumber; }
146
148 inline unsigned int getFrameNumberOfLastTraversal() const { return _frameNumberOfLastTraversal; }
149
150
153
156
159
161
162
163
168 virtual bool removeExpiredChildren(double expiryTime, unsigned int expiryFrame, NodeList& removedChildren);
169
170 protected :
171
172 virtual ~PagedLOD();
173
174 void expandPerRangeDataTo(unsigned int pos);
175
177 std::string _databasePath;
178
182
184};
185
186}
187
188#endif
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
std::vector< ref_ptr< Node > > NodeList
Definition Group:22
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.
LOD()
Default constructor The default constructor sets.
Base class for all internal nodes in the scene graph.
Definition Node:72
Visitor for type safe operations on osg::Nodes.
Definition NodeVisitor:82
std::string _databasePath
Definition PagedLOD:177
PagedLOD()
Default constructor The default constructor sets.
osg::ref_ptr< osg::Referenced > & getDatabaseRequest(unsigned int childNo)
Return the DatabaseRequest object used by the DatabasePager to keep track of file load requests being...
Definition PagedLOD:136
void setFileName(unsigned int childNo, const std::string &filename)
Definition PagedLOD:99
PagedLOD(const PagedLOD &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
osg::Referenced * getDatabaseOptions()
Get the optional database osgDB::Options object used when reading children.
Definition PagedLOD:67
virtual ~PagedLOD()
virtual bool addChild(Node *child, float rmin, float rmax, const std::string &filename, float priorityOffset=0.0f, float priorityScale=1.0f)
void setFrameNumber(unsigned int childNo, unsigned int frameNumber)
Definition PagedLOD:127
bool addChild(const ref_ptr< T > &child, float rmin, float rmax, const std::string &filename, float priorityOffset=0.0f, float priorityScale=1.0f)
Definition PagedLOD:58
float getPriorityOffset(unsigned int childNo) const
Definition PagedLOD:105
void expandPerRangeDataTo(unsigned int pos)
bool getDisableExternalChildrenPaging() const
Definition PagedLOD:160
void setDatabaseOptions(osg::Referenced *options)
Set the optional database osgDB::Options object to use when reading children.
Definition PagedLOD:64
const osg::ref_ptr< osg::Referenced > & getDatabaseRequest(unsigned int childNo) const
Return the const DatabaseRequest object.
Definition PagedLOD:139
META_Node(osg, PagedLOD)
unsigned int getNumPriorityOffsets() const
Definition PagedLOD:106
void setPriorityOffset(unsigned int childNo, float priorityOffset)
Definition PagedLOD:104
const std::string & getDatabasePath() const
Get the database path used to prepend to children's filenames.
Definition PagedLOD:77
unsigned int getMinimumExpiryFrames(unsigned int childNo) const
Definition PagedLOD:119
float getPriorityScale(unsigned int childNo) const
Definition PagedLOD:109
double getTimeStamp(unsigned int childNo) const
Definition PagedLOD:124
unsigned int getNumTimeStamps() const
Definition PagedLOD:125
bool addChild(const ref_ptr< T > &child, float rmin, float rmax)
Definition PagedLOD:54
void setFrameNumberOfLastTraversal(unsigned int frameNumber)
Set the frame number of the last time that this PageLOD node was traversed.
Definition PagedLOD:145
const std::string & getFileName(unsigned int childNo) const
Definition PagedLOD:100
void setMinimumExpiryTime(unsigned int childNo, double minTime)
Sets the minimum amount of time, in seconds, that must pass without a child being traversed before it...
Definition PagedLOD:113
double getMinimumExpiryTime(unsigned int childNo) const
Definition PagedLOD:114
void setDisableExternalChildrenPaging(bool flag)
Set whether you want to disable the paging in of external nodes.
Definition PagedLOD:158
virtual bool addChild(Node *child, float rmin, float rmax)
PerRangeDataList _perRangeDataList
Definition PagedLOD:183
bool _disableExternalChildrenPaging
Definition PagedLOD:181
void setTimeStamp(unsigned int childNo, double timeStamp)
Definition PagedLOD:123
unsigned int _frameNumberOfLastTraversal
Definition PagedLOD:179
unsigned int _numChildrenThatCannotBeExpired
Definition PagedLOD:180
unsigned int getNumMinimumExpiryTimes() const
Definition PagedLOD:115
unsigned int getNumPriorityScales() const
Definition PagedLOD:110
virtual bool addChild(Node *child)
Add Node to Group.
void setMinimumExpiryFrames(unsigned int childNo, unsigned int minFrames)
Sets the minimum number of frames that must be rendered without a child being traversed before it can...
Definition PagedLOD:118
unsigned getFrameNumber(unsigned int childNo) const
Definition PagedLOD:128
std::vector< PerRangeData > PerRangeDataList
Definition PagedLOD:97
virtual bool removeExpiredChildren(double expiryTime, unsigned int expiryFrame, NodeList &removedChildren)
Remove the children from the PagedLOD which haven't been visited since specified expiry time and expi...
unsigned int getFrameNumberOfLastTraversal() const
Get the frame number of the last time that this PageLOD node was traversed.
Definition PagedLOD:148
unsigned int getNumFrameNumbers() const
Definition PagedLOD:129
void setPriorityScale(unsigned int childNo, float priorityScale)
Definition PagedLOD:108
void setDatabasePath(const std::string &path)
Set the database path to prepend to children's filenames.
unsigned int getNumFileNames() const
Definition PagedLOD:101
unsigned int getNumChildrenThatCannotBeExpired() const
Get the number of children that the PagedLOD must keep around, even if they are older than their expi...
Definition PagedLOD:155
const osg::Referenced * getDatabaseOptions() const
Get the optional database osgDB::Options object used when reading children.
Definition PagedLOD:70
virtual void traverse(NodeVisitor &nv)
Traverse downwards : calls children's accept method with NodeVisitor.
virtual bool removeChildren(unsigned int pos, unsigned int numChildrenToRemove=1)
Remove children from Group.
unsigned int getNumMinimumExpiryFrames() const
Definition PagedLOD:120
void setNumChildrenThatCannotBeExpired(unsigned int num)
Set the number of children that the PagedLOD must keep around, even if they are older than their expi...
Definition PagedLOD:152
ref_ptr< Referenced > _databaseOptions
Definition PagedLOD:176
unsigned int _frameNumberOfLastReleaseGLObjects
Definition PagedLOD:93
double _minExpiryTime
Definition PagedLOD:89
float _priorityScale
Definition PagedLOD:88
unsigned int _minExpiryFrames
Definition PagedLOD:90
osg::ref_ptr< osg::Referenced > _databaseRequest
Definition PagedLOD:94
float _priorityOffset
Definition PagedLOD:87
unsigned int _frameNumber
Definition PagedLOD:92
std::string _filename
Definition PagedLOD:86
PerRangeData(const PerRangeData &prd)
double _timeStamp
Definition PagedLOD:91
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
T * get() const
Definition ref_ptr:117
Base class for providing reference counted objects.
Definition Referenced:44
#define OSG_EXPORT
Definition Export:39

osg logo
Generated at Sun Jul 20 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.