Added extra convinience methods to LOD - addChild(child,min,max).
Added osganimate to test scripts.
This commit is contained in:
parent
41768f6824
commit
04a9a09a8b
@ -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
|
||||
|
@ -22,6 +22,9 @@ sgv cube_mapped_torus.osg
|
||||
echo sgv Town.osg
|
||||
sgv Town.osg
|
||||
|
||||
echo osganimate
|
||||
osganimate
|
||||
|
||||
echo osghangglide
|
||||
osghangglide
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user