From d76cef6f8e2e5d46364eeaca62c43ba9badf343e Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 9 Dec 2003 14:06:48 +0000 Subject: [PATCH] Added support for new PagedLOD Radius and NumChildrenThatCannorBeExpired variables to .osg and .ive support. --- src/osgPlugins/ive/PagedLOD.cpp | 8 ++++++++ src/osgPlugins/osg/PagedLOD.cpp | 20 ++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/osgPlugins/ive/PagedLOD.cpp b/src/osgPlugins/ive/PagedLOD.cpp index 499f4c9ab..7be915d2f 100644 --- a/src/osgPlugins/ive/PagedLOD.cpp +++ b/src/osgPlugins/ive/PagedLOD.cpp @@ -30,6 +30,11 @@ void PagedLOD::write(DataOutputStream* out){ else throw Exception("PagedLOD::write(): Could not cast this osg::PagedLOD to an osg::LOD."); + + out->writeFloat(getRadius()); + out->writeUInt(getNumChildrenThatCannotBeExpired()); + + unsigned int numChildrenToWriteOut = 0; int i; @@ -88,6 +93,9 @@ void PagedLOD::read(DataInputStream* in){ else throw Exception("Group::read(): Could not cast this osg::Group to an osg::Node."); + setRadius(in->readFloat()); + setNumChildrenThatCannotBeExpired(in->readUInt()); + // Read groups properties. // Read number of children. diff --git a/src/osgPlugins/osg/PagedLOD.cpp b/src/osgPlugins/osg/PagedLOD.cpp index 8b7c489c1..126383860 100644 --- a/src/osgPlugins/osg/PagedLOD.cpp +++ b/src/osgPlugins/osg/PagedLOD.cpp @@ -27,6 +27,22 @@ bool PagedLOD_readLocalData(Object& obj, Input& fr) PagedLOD& lod = static_cast(obj); + float radius; + if (fr[0].matchWord("Radius") && fr[1].getFloat(radius)) + { + lod.setRadius(radius); + fr+=2; + iteratorAdvanced = true; + } + + unsigned int num; + if (fr[0].matchWord("NumChildrenThatCannotBeExpired") && fr[1].getUInt(num)) + { + lod.setNumChildrenThatCannotBeExpired(num); + fr+=2; + iteratorAdvanced = true; + } + bool matchFirst; if ((matchFirst=fr.matchSequence("FileNameList {")) || fr.matchSequence("FileNameList %i {")) { @@ -91,6 +107,10 @@ bool PagedLOD_writeLocalData(const Object& obj, Output& fw) { const PagedLOD& lod = static_cast(obj); + fw.indent() << "Radius "<