Added the ability to turn off the external paging in of PagedLOD children.
This commit is contained in:
@@ -126,6 +126,13 @@ class OSG_EXPORT PagedLOD : public LOD
|
||||
/** Get the number of children that the PagedLOD must keep around, even if they are older than their expiry time.*/
|
||||
unsigned int getNumChildrenThatCannotBeExpired() const { return _numChildrenThatCannotBeExpired; }
|
||||
|
||||
/** Set wether you want to disable the paging in of external nodes.*/
|
||||
void setDisableExternalChildrenPaging(bool flag) { _disableExternalChildrenPaging = flag; }
|
||||
|
||||
bool getDisableExternalChildrenPaging() const { return _disableExternalChildrenPaging; }
|
||||
|
||||
|
||||
|
||||
/** Remove the children from the PagedLOD which haven't been visited since specified expiry time and expiry frame number.
|
||||
* The removed children are added to the removeChildren list passed into the method,
|
||||
* this allows the children to be deleted later at the caller's discretion.
|
||||
@@ -147,6 +154,8 @@ class OSG_EXPORT PagedLOD : public LOD
|
||||
|
||||
int _frameNumberOfLastTraversal;
|
||||
unsigned int _numChildrenThatCannotBeExpired;
|
||||
bool _disableExternalChildrenPaging;
|
||||
|
||||
PerRangeDataList _perRangeDataList;
|
||||
};
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ PagedLOD::PagedLOD()
|
||||
_centerMode = USER_DEFINED_CENTER;
|
||||
_radius = -1;
|
||||
_numChildrenThatCannotBeExpired = 0;
|
||||
_disableExternalChildrenPaging = false;
|
||||
}
|
||||
|
||||
PagedLOD::PagedLOD(const PagedLOD& plod,const CopyOp& copyop):
|
||||
@@ -62,6 +63,7 @@ PagedLOD::PagedLOD(const PagedLOD& plod,const CopyOp& copyop):
|
||||
_databasePath(plod._databasePath),
|
||||
_frameNumberOfLastTraversal(plod._frameNumberOfLastTraversal),
|
||||
_numChildrenThatCannotBeExpired(plod._numChildrenThatCannotBeExpired),
|
||||
_disableExternalChildrenPaging(plod._disableExternalChildrenPaging),
|
||||
_perRangeDataList(plod._perRangeDataList)
|
||||
{
|
||||
}
|
||||
@@ -198,7 +200,9 @@ void PagedLOD::traverse(NodeVisitor& nv)
|
||||
}
|
||||
|
||||
// now request the loading of the next unloaded child.
|
||||
if (nv.getDatabaseRequestHandler() && numChildren<_perRangeDataList.size())
|
||||
if (!_disableExternalChildrenPaging &&
|
||||
nv.getDatabaseRequestHandler() &&
|
||||
numChildren<_perRangeDataList.size())
|
||||
{
|
||||
// compute priority from where abouts in the required range the distance falls.
|
||||
float priority = (_rangeList[numChildren].second-required_range)/(_rangeList[numChildren].second-_rangeList[numChildren].first);
|
||||
|
||||
@@ -49,8 +49,9 @@
|
||||
#define VERSION_0038 38
|
||||
#define VERSION_0039 39
|
||||
#define VERSION_0040 40
|
||||
#define VERSION_0041 41
|
||||
|
||||
#define VERSION VERSION_0040
|
||||
#define VERSION VERSION_0041
|
||||
|
||||
/* The BYTE_SEX tag is used to check the endian
|
||||
of the IVE file being read in. The IVE format
|
||||
|
||||
@@ -37,6 +37,10 @@ void PagedLOD::write(DataOutputStream* out)
|
||||
out->writeFloat(getRadius());
|
||||
out->writeUInt(getNumChildrenThatCannotBeExpired());
|
||||
|
||||
if ( out->getVersion() >= VERSION_0041 )
|
||||
{
|
||||
out->writeBool(getDisableExternalChildrenPaging());
|
||||
}
|
||||
|
||||
unsigned int numChildrenToWriteOut = 0;
|
||||
|
||||
@@ -140,6 +144,11 @@ void PagedLOD::read(DataInputStream* in)
|
||||
setRadius(in->readFloat());
|
||||
setNumChildrenThatCannotBeExpired(in->readUInt());
|
||||
|
||||
if ( in->getVersion() >= VERSION_0041 )
|
||||
{
|
||||
setDisableExternalChildrenPaging(in->readBool());
|
||||
}
|
||||
|
||||
|
||||
// Read groups properties.
|
||||
// Read number of children.
|
||||
|
||||
@@ -53,6 +53,13 @@ bool PagedLOD_readLocalData(Object& obj, Input& fr)
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
bool flag;
|
||||
if (fr.read("DisableExternalChildrenPaging", flag))
|
||||
{
|
||||
lod.setDisableExternalChildrenPaging(flag);
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
bool matchFirst;
|
||||
if ((matchFirst=fr.matchSequence("FileNameList {")) || fr.matchSequence("FileNameList %i {"))
|
||||
{
|
||||
@@ -122,6 +129,9 @@ bool PagedLOD_writeLocalData(const Object& obj, Output& fw)
|
||||
|
||||
fw.indent() << "NumChildrenThatCannotBeExpired "<<lod.getNumChildrenThatCannotBeExpired()<<std::endl;
|
||||
|
||||
fw.indent() << "DisableExternalChildrenPaging "<<lod.getDisableExternalChildrenPaging()<<std::endl;
|
||||
|
||||
|
||||
fw.indent() << "FileNameList "<<lod.getNumFileNames()<<" {"<< std::endl;
|
||||
fw.moveIn();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user