From 04a9a09a8b1b1ac22ce07a4b980ce48bde738ef0 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 7 Oct 2002 21:23:37 +0000 Subject: [PATCH] Added extra convinience methods to LOD - addChild(child,min,max). Added osganimate to test scripts. --- Make/debugtests.bat | 4 ++++ Make/osgtests.bat | 3 +++ include/osg/LOD | 6 ++++-- src/osg/LOD.cpp | 13 ++++++++++--- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Make/debugtests.bat b/Make/debugtests.bat index 152487b3b..83c4b5b8b 100755 --- a/Make/debugtests.bat +++ b/Make/debugtests.bat @@ -34,6 +34,10 @@ echo sgv Town.osg sgv Town.osg more memleaks.log +echo osganimate +osganimate +more memleaks.log + echo osghangglide osghangglide more memleaks.log diff --git a/Make/osgtests.bat b/Make/osgtests.bat index 6736a4181..a3ad0d712 100755 --- a/Make/osgtests.bat +++ b/Make/osgtests.bat @@ -22,6 +22,9 @@ sgv cube_mapped_torus.osg echo sgv Town.osg sgv Town.osg +echo osganimate +osganimate + echo osghangglide osghangglide diff --git a/include/osg/LOD b/include/osg/LOD index fc1c84c11..f818504e3 100644 --- a/include/osg/LOD +++ b/include/osg/LOD @@ -36,9 +36,11 @@ class SG_EXPORT LOD : public Group virtual void traverse(NodeVisitor& nv); - virtual bool addChild( Node *child ); + virtual bool addChild(Node *child); - virtual bool removeChild( Node *child ); + virtual bool addChild(Node *child, float min, float max); + + virtual bool removeChild(Node *child); typedef std::pair MinMaxPair; diff --git a/src/osg/LOD.cpp b/src/osg/LOD.cpp index fbbbfa673..ed22f400e 100644 --- a/src/osg/LOD.cpp +++ b/src/osg/LOD.cpp @@ -41,12 +41,19 @@ void LOD::traverse(NodeVisitor& nv) } bool LOD::addChild( Node *child ) +{ + float maxRange = 0.0f; + if (!_rangeList.empty()) maxRange=_rangeList.back().second; + return addChild(child,maxRange,maxRange); +} + +bool LOD::addChild(Node *child, float min, float max) { if (Group::addChild(child)) { - float maxRange = 0.0f; - if (!_rangeList.empty()) maxRange=_rangeList.back().second; - if (_children.size()>_rangeList.size()) _rangeList.resize(_children.size(),MinMaxPair(maxRange,maxRange)); + if (_children.size()>_rangeList.size()) _rangeList.resize(_children.size(),MinMaxPair(min,min)); + _rangeList[_children.size()-1].first = min; + _rangeList[_children.size()-1].second = max; return true; } return false;