PagedLOD
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_PagedLOD
#define OSG_PagedLOD 1
#include <osg/LOD>
namespace osg {
class OSG_EXPORT PagedLOD : public LOD
{
public :
PagedLOD();
PagedLOD(const PagedLOD&,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
META_Node(osg, PagedLOD);
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 addChild(Node *child, float rmin, float rmax, const std::string& filename, float priorityOffset=0.0f, float priorityScale=1.0f);
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); }
virtual bool removeChildren(unsigned int pos,unsigned int numChildrenToRemove=1);
void setDatabaseOptions(osg::Referenced* options) { _databaseOptions = options; }
osg::Referenced* getDatabaseOptions() { return _databaseOptions.get(); }
const osg::Referenced* getDatabaseOptions() const { return _databaseOptions.get(); }
void setDatabasePath(const std::string& path);
inline const std::string& getDatabasePath() const { return _databasePath; }
struct OSG_EXPORT PerRangeData
{
PerRangeData();
PerRangeData(const PerRangeData& prd);
PerRangeData& operator = (const PerRangeData& prd);
std::string _filename;
float _priorityOffset;
float _priorityScale;
double _minExpiryTime;
unsigned int _minExpiryFrames;
double _timeStamp;
unsigned int _frameNumber;
unsigned int _frameNumberOfLastReleaseGLObjects;
osg::ref_ptr<osg::Referenced> _databaseRequest;
};
typedef std::vector<PerRangeData> PerRangeDataList;
void setFileName(unsigned int childNo, const std::string& filename) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._filename=filename; }
const std::string& getFileName(unsigned int childNo) const { return _perRangeDataList[childNo]._filename; }
unsigned int getNumFileNames() const { return static_cast<unsigned int>(_perRangeDataList.size()); }
void setPriorityOffset(unsigned int childNo, float priorityOffset) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._priorityOffset=priorityOffset; }
float getPriorityOffset(unsigned int childNo) const { return _perRangeDataList[childNo]._priorityOffset; }
unsigned int getNumPriorityOffsets() const { return static_cast<unsigned int>(_perRangeDataList.size()); }
void setPriorityScale(unsigned int childNo, float priorityScale) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._priorityScale=priorityScale; }
float getPriorityScale(unsigned int childNo) const { return _perRangeDataList[childNo]._priorityScale; }
unsigned int getNumPriorityScales() const { return static_cast<unsigned int>(_perRangeDataList.size()); }
void setMinimumExpiryTime(unsigned int childNo, double minTime) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._minExpiryTime=minTime; }
double getMinimumExpiryTime(unsigned int childNo) const { return _perRangeDataList[childNo]._minExpiryTime; }
unsigned int getNumMinimumExpiryTimes() const { return static_cast<unsigned int>(_perRangeDataList.size()); }
void setMinimumExpiryFrames(unsigned int childNo, unsigned int minFrames) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._minExpiryFrames=minFrames; }
unsigned int getMinimumExpiryFrames(unsigned int childNo) const { return _perRangeDataList[childNo]._minExpiryFrames; }
unsigned int getNumMinimumExpiryFrames() const { return static_cast<unsigned int>(_perRangeDataList.size()); }
void setTimeStamp(unsigned int childNo, double timeStamp) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._timeStamp=timeStamp; }
double getTimeStamp(unsigned int childNo) const { return _perRangeDataList[childNo]._timeStamp; }
unsigned int getNumTimeStamps() const { return static_cast<unsigned int>(_perRangeDataList.size()); }
void setFrameNumber(unsigned int childNo, unsigned int frameNumber) { expandPerRangeDataTo(childNo); _perRangeDataList[childNo]._frameNumber=frameNumber; }
unsigned getFrameNumber(unsigned int childNo) const { return _perRangeDataList[childNo]._frameNumber; }
unsigned int getNumFrameNumbers() const { return static_cast<unsigned int>(_perRangeDataList.size()); }
osg::ref_ptr<osg::Referenced>& getDatabaseRequest(unsigned int childNo) { return _perRangeDataList[childNo]._databaseRequest; }
const osg::ref_ptr<osg::Referenced>& getDatabaseRequest(unsigned int childNo) const { return _perRangeDataList[childNo]._databaseRequest; }
inline void setFrameNumberOfLastTraversal(unsigned int frameNumber) { _frameNumberOfLastTraversal=frameNumber; }
inline unsigned int getFrameNumberOfLastTraversal() const { return _frameNumberOfLastTraversal; }
inline void setNumChildrenThatCannotBeExpired(unsigned int num) { _numChildrenThatCannotBeExpired = num; }
unsigned int getNumChildrenThatCannotBeExpired() const { return _numChildrenThatCannotBeExpired; }
void setDisableExternalChildrenPaging(bool flag) { _disableExternalChildrenPaging = flag; }
bool getDisableExternalChildrenPaging() const { return _disableExternalChildrenPaging; }
virtual bool removeExpiredChildren(double expiryTime, unsigned int expiryFrame, NodeList& removedChildren);
protected :
virtual ~PagedLOD();
void expandPerRangeDataTo(unsigned int pos);
ref_ptr<Referenced> _databaseOptions;
std::string _databasePath;
unsigned int _frameNumberOfLastTraversal;
unsigned int _numChildrenThatCannotBeExpired;
bool _disableExternalChildrenPaging;
PerRangeDataList _perRangeDataList;
};
}
#endif
LOD
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::Group::addChild
virtual bool addChild(Node *child)
osg::LOD::LOD
LOD()
osg::NodeVisitor
Definition NodeVisitor:82
osg::Node
Definition Node:72
osg::PagedLOD::_databasePath
std::string _databasePath
Definition PagedLOD:177
osg::PagedLOD::PagedLOD
PagedLOD()
osg::PagedLOD::getDatabaseRequest
osg::ref_ptr< osg::Referenced > & getDatabaseRequest(unsigned int childNo)
Definition PagedLOD:136
osg::PagedLOD::setFileName
void setFileName(unsigned int childNo, const std::string &filename)
Definition PagedLOD:99
osg::PagedLOD::PagedLOD
PagedLOD(const PagedLOD &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
osg::PagedLOD::getDatabaseOptions
osg::Referenced * getDatabaseOptions()
Definition PagedLOD:67
osg::PagedLOD::~PagedLOD
virtual ~PagedLOD()
osg::PagedLOD::addChild
virtual bool addChild(Node *child, float rmin, float rmax, const std::string &filename, float priorityOffset=0.0f, float priorityScale=1.0f)
osg::PagedLOD::setFrameNumber
void setFrameNumber(unsigned int childNo, unsigned int frameNumber)
Definition PagedLOD:127
osg::PagedLOD::addChild
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
osg::PagedLOD::getPriorityOffset
float getPriorityOffset(unsigned int childNo) const
Definition PagedLOD:105
osg::PagedLOD::expandPerRangeDataTo
void expandPerRangeDataTo(unsigned int pos)
osg::PagedLOD::getDisableExternalChildrenPaging
bool getDisableExternalChildrenPaging() const
Definition PagedLOD:160
osg::PagedLOD::setDatabaseOptions
void setDatabaseOptions(osg::Referenced *options)
Definition PagedLOD:64
osg::PagedLOD::getDatabaseRequest
const osg::ref_ptr< osg::Referenced > & getDatabaseRequest(unsigned int childNo) const
Definition PagedLOD:139
osg::PagedLOD::META_Node
META_Node(osg, PagedLOD)
osg::PagedLOD::getNumPriorityOffsets
unsigned int getNumPriorityOffsets() const
Definition PagedLOD:106
osg::PagedLOD::setPriorityOffset
void setPriorityOffset(unsigned int childNo, float priorityOffset)
Definition PagedLOD:104
osg::PagedLOD::getDatabasePath
const std::string & getDatabasePath() const
Definition PagedLOD:77
osg::PagedLOD::getMinimumExpiryFrames
unsigned int getMinimumExpiryFrames(unsigned int childNo) const
Definition PagedLOD:119
osg::PagedLOD::getPriorityScale
float getPriorityScale(unsigned int childNo) const
Definition PagedLOD:109
osg::PagedLOD::getTimeStamp
double getTimeStamp(unsigned int childNo) const
Definition PagedLOD:124
osg::PagedLOD::getNumTimeStamps
unsigned int getNumTimeStamps() const
Definition PagedLOD:125
osg::PagedLOD::addChild
bool addChild(const ref_ptr< T > &child, float rmin, float rmax)
Definition PagedLOD:54
osg::PagedLOD::setFrameNumberOfLastTraversal
void setFrameNumberOfLastTraversal(unsigned int frameNumber)
Definition PagedLOD:145
osg::PagedLOD::getFileName
const std::string & getFileName(unsigned int childNo) const
Definition PagedLOD:100
osg::PagedLOD::setMinimumExpiryTime
void setMinimumExpiryTime(unsigned int childNo, double minTime)
Definition PagedLOD:113
osg::PagedLOD::getMinimumExpiryTime
double getMinimumExpiryTime(unsigned int childNo) const
Definition PagedLOD:114
osg::PagedLOD::setDisableExternalChildrenPaging
void setDisableExternalChildrenPaging(bool flag)
Definition PagedLOD:158
osg::PagedLOD::addChild
virtual bool addChild(Node *child, float rmin, float rmax)
osg::PagedLOD::_perRangeDataList
PerRangeDataList _perRangeDataList
Definition PagedLOD:183
osg::PagedLOD::_disableExternalChildrenPaging
bool _disableExternalChildrenPaging
Definition PagedLOD:181
osg::PagedLOD::setTimeStamp
void setTimeStamp(unsigned int childNo, double timeStamp)
Definition PagedLOD:123
osg::PagedLOD::_frameNumberOfLastTraversal
unsigned int _frameNumberOfLastTraversal
Definition PagedLOD:179
osg::PagedLOD::_numChildrenThatCannotBeExpired
unsigned int _numChildrenThatCannotBeExpired
Definition PagedLOD:180
osg::PagedLOD::getNumMinimumExpiryTimes
unsigned int getNumMinimumExpiryTimes() const
Definition PagedLOD:115
osg::PagedLOD::getNumPriorityScales
unsigned int getNumPriorityScales() const
Definition PagedLOD:110
osg::PagedLOD::addChild
virtual bool addChild(Node *child)
osg::PagedLOD::setMinimumExpiryFrames
void setMinimumExpiryFrames(unsigned int childNo, unsigned int minFrames)
Definition PagedLOD:118
osg::PagedLOD::getFrameNumber
unsigned getFrameNumber(unsigned int childNo) const
Definition PagedLOD:128
osg::PagedLOD::PerRangeDataList
std::vector< PerRangeData > PerRangeDataList
Definition PagedLOD:97
osg::PagedLOD::removeExpiredChildren
virtual bool removeExpiredChildren(double expiryTime, unsigned int expiryFrame, NodeList &removedChildren)
osg::PagedLOD::getFrameNumberOfLastTraversal
unsigned int getFrameNumberOfLastTraversal() const
Definition PagedLOD:148
osg::PagedLOD::getNumFrameNumbers
unsigned int getNumFrameNumbers() const
Definition PagedLOD:129
osg::PagedLOD::setPriorityScale
void setPriorityScale(unsigned int childNo, float priorityScale)
Definition PagedLOD:108
osg::PagedLOD::setDatabasePath
void setDatabasePath(const std::string &path)
osg::PagedLOD::getNumFileNames
unsigned int getNumFileNames() const
Definition PagedLOD:101
osg::PagedLOD::getNumChildrenThatCannotBeExpired
unsigned int getNumChildrenThatCannotBeExpired() const
Definition PagedLOD:155
osg::PagedLOD::getDatabaseOptions
const osg::Referenced * getDatabaseOptions() const
Definition PagedLOD:70
osg::PagedLOD::traverse
virtual void traverse(NodeVisitor &nv)
osg::PagedLOD::removeChildren
virtual bool removeChildren(unsigned int pos, unsigned int numChildrenToRemove=1)
osg::PagedLOD::getNumMinimumExpiryFrames
unsigned int getNumMinimumExpiryFrames() const
Definition PagedLOD:120
osg::PagedLOD::setNumChildrenThatCannotBeExpired
void setNumChildrenThatCannotBeExpired(unsigned int num)
Definition PagedLOD:152
osg::PagedLOD::_databaseOptions
ref_ptr< Referenced > _databaseOptions
Definition PagedLOD:176
osg::Referenced
Definition Referenced:44
osg::ref_ptr
Definition ref_ptr:32
osg::ref_ptr::get
T * get() const
Definition ref_ptr:117
osg
Definition AlphaFunc:19
osg::NodeList
std::vector< ref_ptr< Node > > NodeList
Definition Group:22
OSG_EXPORT
#define OSG_EXPORT
Definition osg/Export:39
osg::PagedLOD::PerRangeData::_frameNumberOfLastReleaseGLObjects
unsigned int _frameNumberOfLastReleaseGLObjects
Definition PagedLOD:93
osg::PagedLOD::PerRangeData::_minExpiryTime
double _minExpiryTime
Definition PagedLOD:89
osg::PagedLOD::PerRangeData::_priorityScale
float _priorityScale
Definition PagedLOD:88
osg::PagedLOD::PerRangeData::_minExpiryFrames
unsigned int _minExpiryFrames
Definition PagedLOD:90
osg::PagedLOD::PerRangeData::PerRangeData
PerRangeData()
osg::PagedLOD::PerRangeData::_databaseRequest
osg::ref_ptr< osg::Referenced > _databaseRequest
Definition PagedLOD:94
osg::PagedLOD::PerRangeData::_priorityOffset
float _priorityOffset
Definition PagedLOD:87
osg::PagedLOD::PerRangeData::_frameNumber
unsigned int _frameNumber
Definition PagedLOD:92
osg::PagedLOD::PerRangeData::_filename
std::string _filename
Definition PagedLOD:86
osg::PagedLOD::PerRangeData::PerRangeData
PerRangeData(const PerRangeData &prd)
osg::PagedLOD::PerRangeData::_timeStamp
double _timeStamp
Definition PagedLOD:91