Added osg::Geometry::setPrimtiveSet,removePrimtiiveSet, insertPrimitiveSet

and getPrimitiveSetIndex().

Renamed osg::Group::findChildNum(..) to getChildIndex().

Renamed osg::Geode::findDrawableNum(..) to getDrawableIndex().
This commit is contained in:
Robert Osfield
2002-11-21 09:07:11 +00:00
parent f2fc281b00
commit 5ddcd5d878
8 changed files with 109 additions and 14 deletions

View File

@@ -34,13 +34,13 @@ class SG_EXPORT Geode : public Node
virtual bool addDrawable( Drawable *drawable );
/** Remove Drawable from Geode.
* Equivalent to setDrawabke(findDrawableNum(orignChild),node),
* Equivalent to setDrawabke(getDrawableIndex(orignChild),node),
* see docs for setNode for futher details on implementation.*/
virtual bool removeDrawable( Drawable *drawable );
/** Replace specified Drawable with another Drawable.
* Equivalent to setDrawable(findDrawableNum(orignChild),node),
* Equivalent to setDrawable(getDrawableIndex(orignChild),node),
* see docs for setDrawable for futher details on implementation.*/
virtual bool replaceDrawable( Drawable *origDraw, Drawable *newDraw );
@@ -107,10 +107,10 @@ class SG_EXPORT Geode : public Node
return _drawables.end();
}
/** Find the index number of drawable, return a value between
/** Get the index number of drawable, return a value between
* 0 and _drawables.size()-1 if found, if not found then
* return _drawables.size().*/
inline unsigned int findDrawableNum( const Drawable* node ) const
inline unsigned int getDrawableIndex( const Drawable* node ) const
{
for (unsigned int drawableNum=0;drawableNum<_drawables.size();++drawableNum)
{

View File

@@ -128,7 +128,22 @@ class SG_EXPORT Geometry : public Drawable
PrimitiveSet* getPrimitiveSet(unsigned int pos) { return _primitives[pos].get(); }
const PrimitiveSet* getPrimitiveSet(unsigned int pos) const { return _primitives[pos].get(); }
void addPrimitiveSet(PrimitiveSet* primitive) { if (primitive) _primitives.push_back(primitive); dirtyDisplayList(); dirtyBound(); }
/** Add a primtive set to the geometry.*/
bool addPrimitiveSet(PrimitiveSet* primitiveset);
/** Set a primtive set to the specified position in geometry's primtive set list.*/
bool setPrimitiveSet(unsigned int i,PrimitiveSet* primitiveset);
/** Insert a primtive set to the specified position in geometry's primtive set list.*/
bool insertPrimitiveSet(unsigned int i,PrimitiveSet* primitiveset);
/** Remove primtive set(s) from the specified position in geometry's primtive set list.*/
bool removePrimitiveSet(unsigned int i,unsigned int numElementsToRemove=1);
/** Get the index number of a primitive set, return a value between
* 0 and getNumPrimitiveSet()-1 if found, if not found then return getNumPrimitiveSet().
* When checking for a valid find value use if ((value=geoemtry->getPrimitiveSetIndex(primitive))!=geometry.getNumPrimitiveSet()) as*/
unsigned int getPrimitiveSetIndex(const PrimitiveSet* primitiveset) const;
/** return true if OpenGL fast paths will be used with drawing this Geometry.

View File

@@ -50,7 +50,7 @@ class SG_EXPORT Group : public Node
virtual bool removeChild( Node *child );
/** Replace specified Node with another Node.
* Equivalent to setChild(findChildNum(orignChild),node),
* Equivalent to setChild(getChildIndex(orignChild),node),
* see docs for setChild for futher details on implementation.*/
virtual bool replaceChild( Node *origChild, Node* newChild );
@@ -116,10 +116,10 @@ class SG_EXPORT Group : public Node
return _children.end();
}
/** Find the index number of child, return a value between
/** Get the index number of child, return a value between
* 0 and _children.size()-1 if found, if not found then
* return _children.size().*/
inline unsigned int findChildNum( const Node* node ) const
inline unsigned int getChildIndex( const Node* node ) const
{
for (unsigned int childNum=0;childNum<_children.size();++childNum)
{