Added extra convinience methods to LOD - addChild(child,min,max).

Added osganimate to test scripts.
This commit is contained in:
Robert Osfield 2002-10-07 21:23:37 +00:00
parent 41768f6824
commit 04a9a09a8b
4 changed files with 21 additions and 5 deletions

View File

@ -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

View File

@ -22,6 +22,9 @@ sgv cube_mapped_torus.osg
echo sgv Town.osg
sgv Town.osg
echo osganimate
osganimate
echo osghangglide
osghangglide

View File

@ -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<float,float> MinMaxPair;

View File

@ -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;