From Leandro Motta Barros, doxygen comments

This commit is contained in:
Robert Osfield 2005-01-27 13:15:21 +00:00
parent 75175ecb48
commit 7e75997db0
3 changed files with 278 additions and 230 deletions

View File

@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
* *
* This library is open source and may be redistributed and/or modified under * This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details. * OpenSceneGraph Public License for more details.
*/ */
@ -33,7 +33,7 @@
typedef int GLintptrARB; typedef int GLintptrARB;
typedef int GLsizeiptrARB; typedef int GLsizeiptrARB;
#endif #endif
#define GL_ARRAY_BUFFER_ARB 0x8892 #define GL_ARRAY_BUFFER_ARB 0x8892
#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893 #define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893
#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894 #define GL_ARRAY_BUFFER_BINDING_ARB 0x8894
@ -101,17 +101,28 @@ class Geometry;
// this is defined to alter the way display lists are compiled inside the // this is defined to alter the way display lists are compiled inside the
// the draw method, it has been found that the NVidia drivers fail completely // the draw method, it has been found that the NVidia drivers fail completely
// to optimize COMPILE_AND_EXECUTE in fact make it go slower than for no display // to optimize COMPILE_AND_EXECUTE in fact make it go slower than for no display
// lists, but optimize a separate COMPILE very well?! Define it as default // lists, but optimize a separate COMPILE very well?! Define it as default
// the use of a separate COMPILE, then glCallList rather than use COMPILE_AND_EXECUTE. // the use of a separate COMPILE, then glCallList rather than use COMPILE_AND_EXECUTE.
#define USE_SEPARATE_COMPILE_AND_EXECUTE #define USE_SEPARATE_COMPILE_AND_EXECUTE
/** Pure virtual base class for drawable Geometry. Contains no drawing primitives /** Pure virtual base class for drawable geometry. In OSG, everything that can
directly, these are provided by subclasses such as osg::Geometry. State attributes * be rendered is implemented as a class derived from \c Drawable. The
for a Drawable are maintained in StateSet which the Drawable maintains * \c Drawable class contains no drawing primitives, since these are provided
a referenced counted pointer to. Both Drawable's and StateSet's can * by subclasses such as \c osg::Geometry.
be shared for optimal memory usage and graphics performance. * <p>Notice that a \c Drawable is not a \c Node, and therefore it cannot be
* directly added to a scene graph. Instead, <tt>Drawable</tt>s are attached to
* <tt>Geode</tt>s, which are scene graph nodes.
* <p>The OpenGL state that must be used when rendering a \c Drawable is
* represented by a \c StateSet. Since a \c Drawable has a reference
* (\c osg::ref_ptr) to a \c StateSet, <tt>StateSet</tt>s can be shared between
* different <tt>Drawable</tt>s. In fact, sharing <tt>StateSet</tt>s is a good
* way to improve performance, since this allows OSG to reduce the number of
* expensive changes in the OpenGL state.
* <p>Finally, <tt>Drawable</tt>s can also be shared between different
* <tt>Geode</tt>s, so that the same geometry (loaded to memory just once) can
* be used in different parts of the scene graph.
*/ */
class SG_EXPORT Drawable : public Object class SG_EXPORT Drawable : public Object
{ {
@ -130,10 +141,10 @@ class SG_EXPORT Drawable : public Object
virtual const char* libraryName() const { return "osg"; } virtual const char* libraryName() const { return "osg"; }
virtual const char* className() const { return "Drawable"; } virtual const char* className() const { return "Drawable"; }
/** convert 'this' into a Geometry pointer if Drawable is a Geometry, otherwise return 0. /** Convert 'this' into a Geometry pointer if Drawable is a Geometry, otherwise return 0.
* Equivalent to dynamic_cast<Geometry*>(this).*/ * Equivalent to dynamic_cast<Geometry*>(this).*/
virtual Geometry* asGeometry() { return 0; } virtual Geometry* asGeometry() { return 0; }
/** convert 'const this' into a const Geometry pointer if Drawable is a Geometry, otherwise return 0. /** Convert 'const this' into a const Geometry pointer if Drawable is a Geometry, otherwise return 0.
* Equivalent to dynamic_cast<const Geometry*>(this).*/ * Equivalent to dynamic_cast<const Geometry*>(this).*/
virtual const Geometry* asGeometry() const { return 0; } virtual const Geometry* asGeometry() const { return 0; }
@ -144,7 +155,7 @@ class SG_EXPORT Drawable : public Object
/** Get the parent list of drawable. */ /** Get the parent list of drawable. */
inline const ParentList& getParents() const { return _parents; } inline const ParentList& getParents() const { return _parents; }
/** Get the a copy of parent list of node. A copy is returned to /** Get the a copy of parent list of node. A copy is returned to
* prevent modification of the parent list.*/ * prevent modification of the parent list.*/
inline ParentList getParents() { return _parents; } inline ParentList getParents() { return _parents; }
@ -168,28 +179,28 @@ class SG_EXPORT Drawable : public Object
/** Set the StateSet attached to the Drawable. /** Set the StateSet attached to the Drawable.
Previously attached StateSet are automatically unreferenced on Previously attached StateSet are automatically unreferenced on
assignment of a new drawstate.*/ assignment of a new drawstate.*/
inline void setStateSet(StateSet *state) { _stateset = state; } inline void setStateSet(StateSet *state) { _stateset = state; }
/** Get the attached StateSet.*/ /** Get the attached StateSet.*/
inline StateSet* getStateSet() { return _stateset.get();} inline StateSet* getStateSet() { return _stateset.get();}
/** Get the attached const StateSet.*/ /** Get the attached const StateSet.*/
inline const StateSet* getStateSet() const { return _stateset.get();} inline const StateSet* getStateSet() const { return _stateset.get();}
/** Get the attached const StateSet, /** Get the attached const StateSet,
* if one is not already attached create one, * if one is not already attached create one,
* attach it to the drawable and return a pointer to it.*/ * attach it to the drawable and return a pointer to it.*/
StateSet* getOrCreateStateSet(); StateSet* getOrCreateStateSet();
/** Dirty the bounding box, forcing a computeBound() on the next call /** Dirty the bounding box, forcing a computeBound() on the next call
* to getBound(). Should be called in the internal geometry of the Drawable * to getBound(). Should be called in the internal geometry of the Drawable
* is modified.*/ * is modified.*/
void dirtyBound(); void dirtyBound();
/** get bounding box of geoset. /** get bounding box of geoset.
* Note, now made virtual to make it possible to implement user-drawn * Note, now made virtual to make it possible to implement user-drawn
* objects albeit somewhat crudely, to be improved later. * objects albeit somewhat crudely, to be improved later.
*/ */
@ -201,14 +212,16 @@ class SG_EXPORT Drawable : public Object
} }
/** Set the Shape of the drawable. The shape can be used to /** Set the Shape of the \c Drawable. The shape can be used to
* speed up collision detection or as a guide for procedural * speed up collision detection or as a guide for procedural
* geometry generation - see osg::Shape.*/ * geometry generation.
* @see osg::Shape.
*/
inline void setShape(Shape* shape) { _shape = shape; } inline void setShape(Shape* shape) { _shape = shape; }
/** Get the Shape of the Drawable.*/ /** Get the Shape of the Drawable.*/
inline Shape* getShape() { return _shape.get(); } inline Shape* getShape() { return _shape.get(); }
/** Get the const Shape of the const Drawable.*/ /** Get the const Shape of the const Drawable.*/
inline const Shape* getShape() const { return _shape.get(); } inline const Shape* getShape() const { return _shape.get(); }
@ -222,8 +235,8 @@ class SG_EXPORT Drawable : public Object
* on objects with dynamic internal data such as continuous Level of Detail * on objects with dynamic internal data such as continuous Level of Detail
* algorithms.*/ * algorithms.*/
void setSupportsDisplayList(bool flag); void setSupportsDisplayList(bool flag);
/** Get whether display lists are supported for this drawable instance.*/ /** Get whether display lists are supported for this drawable instance.*/
inline bool getSupportsDisplayList() const { return _supportsDisplayList; } inline bool getSupportsDisplayList() const { return _supportsDisplayList; }
@ -253,23 +266,27 @@ class SG_EXPORT Drawable : public Object
/** draw OpenGL primitives. /** Draw OpenGL primitives.
* If the drawable has _useDisplayList set to true then use an OpenGL display * If the \c Drawable has \c _useDisplayList set to \c true, then use
* list, automatically compiling one if required. * an OpenGL display list, automatically compiling one if required.
* Otherwise call drawImplementation(). * Otherwise, call \c drawImplementation().
* Note, draw method should *not* be overridden in subclasses as it * @note This method should \e not be overridden in subclasses, as it
* manages the optional display list. * manages the optional display list (notice this is not even
* \c virtual). Subclasses should override
* \c drawImplementation() instead.
*/ */
inline void draw(State& state) const; inline void draw(State& state) const;
/** Immediately compile this drawable into an OpenGL Display List. /** Immediately compile this \c Drawable into an OpenGL Display List.
Note I, operation is ignored if _useDisplayList to false. * @note Operation is ignored if \c _useDisplayList is \c false.
Note II, compile is not intended to be overridden in subclasses.*/ * @note This member function is not intended to be overridden in
* subclasses (notice that it is not even \c virtual).
*/
virtual void compileGLObjects(State& state) const; virtual void compileGLObjects(State& state) const;
/** /**
if osg::State object is supplied: release any OpenGL display lists associated with graphics context specified if osg::State object is supplied: release any OpenGL display lists associated with graphics context specified
or or
if state pointer is NULL: release all display lists for all graphics contexts */ if state pointer is NULL: release all display lists for all graphics contexts */
virtual void releaseGLObjects(State* state=0) const; virtual void releaseGLObjects(State* state=0) const;
@ -284,16 +301,16 @@ class SG_EXPORT Drawable : public Object
/** do customized update code.*/ /** do customized update code.*/
virtual void update(osg::NodeVisitor*, osg::Drawable*) {} virtual void update(osg::NodeVisitor*, osg::Drawable*) {}
}; };
/** Set the UpdateCallback which allows users to attach customize the updating of an object during the update traversal.*/ /** Set the UpdateCallback which allows users to attach customize the updating of an object during the update traversal.*/
virtual void setUpdateCallback(UpdateCallback* ac); virtual void setUpdateCallback(UpdateCallback* ac);
/** Get the non const UpdateCallback.*/ /** Get the non const UpdateCallback.*/
UpdateCallback* getUpdateCallback() { return _updateCallback.get(); } UpdateCallback* getUpdateCallback() { return _updateCallback.get(); }
/** Get the const UpdateCallback.*/ /** Get the const UpdateCallback.*/
const UpdateCallback* getUpdateCallback() const { return _updateCallback.get(); } const UpdateCallback* getUpdateCallback() const { return _updateCallback.get(); }
struct CullCallback : public virtual osg::Object struct CullCallback : public virtual osg::Object
{ {
@ -309,14 +326,14 @@ class SG_EXPORT Drawable : public Object
/** Set the CullCallback which allows users to customize the culling of Drawable during the cull traversal.*/ /** Set the CullCallback which allows users to customize the culling of Drawable during the cull traversal.*/
virtual void setCullCallback(CullCallback* cc) { _cullCallback=cc; } virtual void setCullCallback(CullCallback* cc) { _cullCallback=cc; }
/** Get the non const CullCallback.*/ /** Get the non const CullCallback.*/
CullCallback* getCullCallback() { return _cullCallback.get(); } CullCallback* getCullCallback() { return _cullCallback.get(); }
/** Get the const CullCallback.*/ /** Get the const CullCallback.*/
const CullCallback* getCullCallback() const { return _cullCallback.get(); } const CullCallback* getCullCallback() const { return _cullCallback.get(); }
/** Callback attached to an Drawable which allows the users to customize the drawing of an exist Drawable object. /** Callback attached to an Drawable which allows the users to customize the drawing of an exist Drawable object.
@ -338,18 +355,20 @@ class SG_EXPORT Drawable : public Object
/** Set the DrawCallback which allows users to attach customize the drawing of existing Drawable object.*/ /** Set the DrawCallback which allows users to attach customize the drawing of existing Drawable object.*/
virtual void setDrawCallback(DrawCallback* dc) { _drawCallback=dc; dirtyDisplayList(); } virtual void setDrawCallback(DrawCallback* dc) { _drawCallback=dc; dirtyDisplayList(); }
/** Get the non const DrawCallback.*/ /** Get the non const DrawCallback.*/
DrawCallback* getDrawCallback() { return _drawCallback.get(); } DrawCallback* getDrawCallback() { return _drawCallback.get(); }
/** Get the const DrawCallback.*/ /** Get the const DrawCallback.*/
const DrawCallback* getDrawCallback() const { return _drawCallback.get(); } const DrawCallback* getDrawCallback() const { return _drawCallback.get(); }
/** draw directly ignoring an OpenGL display list which could be attached. /** Draw the \c Geometry "directly", that is, by issuing all the OpenGL
* This is the internal draw method which does the drawing itself, * calls needed to draw it. Contrast this with \c draw(), that can
* and is the method to override when deriving from Drawable. * compile and use an OpenGL display list to do the rendering.
* <p> This is the internal draw method which does the drawing itself,
* and is the method to override when deriving from \c Drawable.
*/ */
virtual void drawImplementation(State& state) const = 0; virtual void drawImplementation(State& state) const = 0;
@ -363,32 +382,32 @@ class SG_EXPORT Drawable : public Object
/** Get the minimum number of display lists to retain in the deleted display list cache. */ /** Get the minimum number of display lists to retain in the deleted display list cache. */
static unsigned int getMinimumNumberOfDisplayListsToRetainInCache(); static unsigned int getMinimumNumberOfDisplayListsToRetainInCache();
/** use deleteDisplayList instead of glDeleteList to allow /** Use deleteDisplayList instead of glDeleteList to allow
* OpenGL display list to be cached until they can be deleted * OpenGL display list to be cached until they can be deleted
* by the OpenGL context in which they were created, specified * by the OpenGL context in which they were created, specified
* by contextID.*/ * by contextID.*/
static void deleteDisplayList(unsigned int contextID,GLuint globj, unsigned int sizeHint = 0); static void deleteDisplayList(unsigned int contextID,GLuint globj, unsigned int sizeHint = 0);
/** flush all the cached display list which need to be deleted /** Flush all the cached display list which need to be deleted
* in the OpenGL context related to contextID.*/ * in the OpenGL context related to contextID.*/
static void flushAllDeletedDisplayLists(unsigned int contextID); static void flushAllDeletedDisplayLists(unsigned int contextID);
/** flush the cached display list which need to be deleted /** Flush the cached display list which need to be deleted
* in the OpenGL context related to contextID.*/ * in the OpenGL context related to contextID.*/
static void flushDeletedDisplayLists(unsigned int contextID,double& availableTime); static void flushDeletedDisplayLists(unsigned int contextID,double& availableTime);
/** use deleteVertexBufferObject instead of glDeleteList to allow /** Use deleteVertexBufferObject instead of glDeleteList to allow
* OpenGL buffer objects to be cached until they can be deleted * OpenGL buffer objects to be cached until they can be deleted
* by the OpenGL context in which they were created, specified * by the OpenGL context in which they were created, specified
* by contextID.*/ * by contextID.*/
static void deleteVertexBufferObject(unsigned int contextID,GLuint globj); static void deleteVertexBufferObject(unsigned int contextID,GLuint globj);
/** flush all the cached vertex buffer objects which need to be deleted /** Flush all the cached vertex buffer objects which need to be deleted
* in the OpenGL context related to contextID.*/ * in the OpenGL context related to contextID.*/
static void flushDeletedVertexBufferObjects(unsigned int contextID,double currentTime, double& availableTime); static void flushDeletedVertexBufferObjects(unsigned int contextID,double currentTime, double& availableTime);
typedef unsigned int AttributeType; typedef unsigned int AttributeType;
enum AttributeTypes enum AttributeTypes
{ {
VERTICES = 0, VERTICES = 0,
@ -407,17 +426,16 @@ class SG_EXPORT Drawable : public Object
TEXTURE_COORDS_4 = TEXTURE_COORDS_0+4, TEXTURE_COORDS_4 = TEXTURE_COORDS_0+4,
TEXTURE_COORDS_5 = TEXTURE_COORDS_0+5, TEXTURE_COORDS_5 = TEXTURE_COORDS_0+5,
TEXTURE_COORDS_6 = TEXTURE_COORDS_0+6, TEXTURE_COORDS_6 = TEXTURE_COORDS_0+6,
TEXTURE_COORDS_7 = TEXTURE_COORDS_0+7 TEXTURE_COORDS_7 = TEXTURE_COORDS_0+7
// only eight texture coord examples provided here, but underlying code can handle any no of texure units, // only eight texture coord examples provided here, but underlying code can handle any no of texure units,
// simply co them as (TEXTURE_COORDS_0+unit). // simply co them as (TEXTURE_COORDS_0+unit).
}; };
class AttributeFunctor class AttributeFunctor
{ {
public: public:
virtual ~AttributeFunctor() {} virtual ~AttributeFunctor() {}
virtual void apply(AttributeType,unsigned int,GLbyte*) {} virtual void apply(AttributeType,unsigned int,GLbyte*) {}
virtual void apply(AttributeType,unsigned int,GLshort*) {} virtual void apply(AttributeType,unsigned int,GLshort*) {}
virtual void apply(AttributeType,unsigned int,GLint*) {} virtual void apply(AttributeType,unsigned int,GLint*) {}
@ -432,23 +450,23 @@ class SG_EXPORT Drawable : public Object
virtual void apply(AttributeType,unsigned int,Vec4*) {} virtual void apply(AttributeType,unsigned int,Vec4*) {}
virtual void apply(AttributeType,unsigned int,UByte4*) {} virtual void apply(AttributeType,unsigned int,UByte4*) {}
}; };
/** return true if the Drawable subclass supports accept(AttributeFunctor&).*/ /** Return true if the Drawable subclass supports accept(AttributeFunctor&).*/
virtual bool supports(AttributeFunctor&) const { return false; } virtual bool supports(AttributeFunctor&) const { return false; }
/** accept an AttributeFunctor and call its methods to tell it about the internal attributes that this Drawable has. /** accept an AttributeFunctor and call its methods to tell it about the internal attributes that this Drawable has.
* return true if functor handled by drawable, * return true if functor handled by drawable,
* return false on failure of drawable to generate functor calls.*/ * return false on failure of drawable to generate functor calls.*/
virtual void accept(AttributeFunctor&) {} virtual void accept(AttributeFunctor&) {}
class ConstAttributeFunctor class ConstAttributeFunctor
{ {
public: public:
virtual ~ConstAttributeFunctor() {} virtual ~ConstAttributeFunctor() {}
virtual void apply(AttributeType,const unsigned int,const GLbyte*) {} virtual void apply(AttributeType,const unsigned int,const GLbyte*) {}
virtual void apply(AttributeType,const unsigned int,const GLshort*) {} virtual void apply(AttributeType,const unsigned int,const GLshort*) {}
virtual void apply(AttributeType,const unsigned int,const GLint*) {} virtual void apply(AttributeType,const unsigned int,const GLint*) {}
@ -464,11 +482,11 @@ class SG_EXPORT Drawable : public Object
virtual void apply(AttributeType,const unsigned int,const UByte4*) {} virtual void apply(AttributeType,const unsigned int,const UByte4*) {}
}; };
/** return true if the Drawable subclass supports accept(ConstAttributeFunctor&).*/ /** Return true if the Drawable subclass supports accept(ConstAttributeFunctor&).*/
virtual bool supports(ConstAttributeFunctor&) const { return false; } virtual bool supports(ConstAttributeFunctor&) const { return false; }
/** accept an AttributeFunctor and call its methods to tell it about the internal attributes that this Drawable has. /** Accept an AttributeFunctor and call its methods to tell it about the internal attributes that this Drawable has.
* return true if functor handled by drawable, * return true if functor handled by drawable,
* return false on failure of drawable to generate functor calls.*/ * return false on failure of drawable to generate functor calls.*/
virtual void accept(ConstAttributeFunctor&) const {} virtual void accept(ConstAttributeFunctor&) const {}
@ -476,18 +494,18 @@ class SG_EXPORT Drawable : public Object
class PrimitiveFunctor class PrimitiveFunctor
{ {
public: public:
virtual ~PrimitiveFunctor() {} virtual ~PrimitiveFunctor() {}
virtual void setVertexArray(unsigned int count,const Vec2* vertices) = 0; virtual void setVertexArray(unsigned int count,const Vec2* vertices) = 0;
virtual void setVertexArray(unsigned int count,const Vec3* vertices) = 0; virtual void setVertexArray(unsigned int count,const Vec3* vertices) = 0;
virtual void setVertexArray(unsigned int count,const Vec4* vertices) = 0; virtual void setVertexArray(unsigned int count,const Vec4* vertices) = 0;
virtual void drawArrays(GLenum mode,GLint first,GLsizei count) = 0; virtual void drawArrays(GLenum mode,GLint first,GLsizei count) = 0;
virtual void drawElements(GLenum mode,GLsizei count,const GLubyte* indices) = 0; virtual void drawElements(GLenum mode,GLsizei count,const GLubyte* indices) = 0;
virtual void drawElements(GLenum mode,GLsizei count,const GLushort* indices) = 0; virtual void drawElements(GLenum mode,GLsizei count,const GLushort* indices) = 0;
virtual void drawElements(GLenum mode,GLsizei count,const GLuint* indices) = 0; virtual void drawElements(GLenum mode,GLsizei count,const GLuint* indices) = 0;
virtual void begin(GLenum mode) = 0; virtual void begin(GLenum mode) = 0;
virtual void vertex(const Vec2& vert) = 0; virtual void vertex(const Vec2& vert) = 0;
virtual void vertex(const Vec3& vert) = 0; virtual void vertex(const Vec3& vert) = 0;
@ -496,43 +514,41 @@ class SG_EXPORT Drawable : public Object
virtual void vertex(float x,float y,float z) = 0; virtual void vertex(float x,float y,float z) = 0;
virtual void vertex(float x,float y,float z,float w) = 0; virtual void vertex(float x,float y,float z,float w) = 0;
virtual void end() = 0; virtual void end() = 0;
}; };
class PrimitiveIndexFunctor class PrimitiveIndexFunctor
{ {
public: public:
virtual ~PrimitiveIndexFunctor() {} virtual ~PrimitiveIndexFunctor() {}
virtual void setVertexArray(unsigned int count,const Vec2* vertices) = 0; virtual void setVertexArray(unsigned int count,const Vec2* vertices) = 0;
virtual void setVertexArray(unsigned int count,const Vec3* vertices) = 0; virtual void setVertexArray(unsigned int count,const Vec3* vertices) = 0;
virtual void setVertexArray(unsigned int count,const Vec4* vertices) = 0; virtual void setVertexArray(unsigned int count,const Vec4* vertices) = 0;
virtual void drawArrays(GLenum mode,GLint first,GLsizei count) = 0; virtual void drawArrays(GLenum mode,GLint first,GLsizei count) = 0;
virtual void drawElements(GLenum mode,GLsizei count,const GLubyte* indices) = 0; virtual void drawElements(GLenum mode,GLsizei count,const GLubyte* indices) = 0;
virtual void drawElements(GLenum mode,GLsizei count,const GLushort* indices) = 0; virtual void drawElements(GLenum mode,GLsizei count,const GLushort* indices) = 0;
virtual void drawElements(GLenum mode,GLsizei count,const GLuint* indices) = 0; virtual void drawElements(GLenum mode,GLsizei count,const GLuint* indices) = 0;
virtual void begin(GLenum mode) = 0; virtual void begin(GLenum mode) = 0;
virtual void vertex(unsigned int pos) = 0; virtual void vertex(unsigned int pos) = 0;
virtual void end() = 0; virtual void end() = 0;
}; };
/** return true if the Drawable subclass supports accept(PrimitiveFunctor&).*/ /** Return true if the Drawable subclass supports accept(PrimitiveFunctor&).*/
virtual bool supports(PrimitiveFunctor&) const { return false; } virtual bool supports(PrimitiveFunctor&) const { return false; }
/** accept a PrimitiveFunctor and call its methods to tell it about the internal primitives that this Drawable has. /** Accept a PrimitiveFunctor and call its methods to tell it about the internal primitives that this Drawable has.
* return true if functor handled by drawable, return false on failure of drawable to generate functor calls. * return true if functor handled by drawable, return false on failure of drawable to generate functor calls.
* Note, PrimtiveFunctor only provides const access of the primitives, as primitives may be procedurally generated * Note, PrimtiveFunctor only provides const access of the primitives, as primitives may be procedurally generated
* so one cannot modify it.*/ * so one cannot modify it.*/
virtual void accept(PrimitiveFunctor&) const {} virtual void accept(PrimitiveFunctor&) const {}
/** return true if the Drawable subclass supports accept(PrimitiveIndexFunctor&).*/ /** Return true if the Drawable subclass supports accept(PrimitiveIndexFunctor&).*/
virtual bool supports(PrimitiveIndexFunctor&) const { return false; } virtual bool supports(PrimitiveIndexFunctor&) const { return false; }
/** accept a PrimitiveIndexFunctor and call its methods to tell it about the internal primitives that this Drawable has. /** Accept a PrimitiveIndexFunctor and call its methods to tell it about the internal primitives that this Drawable has.
* return true if functor handled by drawable, return false on failure of drawable to generate functor calls. * return true if functor handled by drawable, return false on failure of drawable to generate functor calls.
* Note, PrimtiveIndexFunctor only provide const access of the primitives, as primitives may be procedurally generated * Note, PrimtiveIndexFunctor only provide const access of the primitives, as primitives may be procedurally generated
* so one cannot modify it.*/ * so one cannot modify it.*/
@ -540,8 +556,8 @@ class SG_EXPORT Drawable : public Object
/** Extensions class which encapsulates the querying of extensions and /** Extensions class which encapsulates the querying of extensions and
* associated function pointers, and provide convenience wrappers to * associated function pointers, and provide convenience wrappers to
* check for the extensions or use the associated functions.*/ * check for the extensions or use the associated functions.*/
class SG_EXPORT Extensions : public osg::Referenced class SG_EXPORT Extensions : public osg::Referenced
{ {
public: public:
@ -721,13 +737,13 @@ class SG_EXPORT Drawable : public Object
virtual ~Drawable(); virtual ~Drawable();
/** compute the bounding box of the drawable. Method must be /** Compute the bounding box of the drawable. Method must be
implemented by subclasses.*/ implemented by subclasses.*/
virtual bool computeBound() const; virtual bool computeBound() const;
/** set the bounding box .*/ /** set the bounding box .*/
void setBound(const BoundingBox& bb) const; void setBound(const BoundingBox& bb) const;
void addParent(osg::Node* node); void addParent(osg::Node* node);
void removeParent(osg::Node* node); void removeParent(osg::Node* node);
@ -739,7 +755,7 @@ class SG_EXPORT Drawable : public Object
mutable BoundingBox _bbox; mutable BoundingBox _bbox;
mutable bool _bbox_computed; mutable bool _bbox_computed;
ref_ptr<Shape> _shape; ref_ptr<Shape> _shape;
bool _supportsDisplayList; bool _supportsDisplayList;
@ -754,15 +770,13 @@ class SG_EXPORT Drawable : public Object
ref_ptr<UpdateCallback> _updateCallback; ref_ptr<UpdateCallback> _updateCallback;
ref_ptr<CullCallback> _cullCallback; ref_ptr<CullCallback> _cullCallback;
ref_ptr<DrawCallback> _drawCallback; ref_ptr<DrawCallback> _drawCallback;
}; };
inline void Drawable::draw(State& state) const inline void Drawable::draw(State& state) const
{ {
if (_useDisplayList && !(_supportsVertexBufferObjects && _useVertexBufferObjects && state.isVertexBufferObjectSupported())) if (_useDisplayList && !(_supportsVertexBufferObjects && _useVertexBufferObjects && state.isVertexBufferObjectSupported()))
{ {
// get the contextID (user defined ID of 0 upwards) for the // get the contextID (user defined ID of 0 upwards) for the
// current OpenGL context. // current OpenGL context.
unsigned int contextID = state.getContextID(); unsigned int contextID = state.getContextID();
@ -781,22 +795,22 @@ inline void Drawable::draw(State& state) const
glNewList( globj, GL_COMPILE ); glNewList( globj, GL_COMPILE );
if (_drawCallback.valid()) if (_drawCallback.valid())
_drawCallback->drawImplementation(state,this); _drawCallback->drawImplementation(state,this);
else else
drawImplementation(state); drawImplementation(state);
glEndList(); glEndList();
glCallList( globj); glCallList( globj);
#else #else
globj = generateDisplayList(contextID, getGLObjectSizeHint()); globj = generateDisplayList(contextID, getGLObjectSizeHint());
glNewList( globj, GL_COMPILE_AND_EXECUTE ); glNewList( globj, GL_COMPILE_AND_EXECUTE );
if (_drawCallback.valid()) if (_drawCallback.valid())
_drawCallback->drawImplementation(state,this); _drawCallback->drawImplementation(state,this);
else else
drawImplementation(state); drawImplementation(state);
glEndList(); glEndList();
#endif #endif
} }
return; return;
} }
@ -804,7 +818,7 @@ inline void Drawable::draw(State& state) const
// draw object as nature intended.. // draw object as nature intended..
if (_drawCallback.valid()) if (_drawCallback.valid())
_drawCallback->drawImplementation(state,this); _drawCallback->drawImplementation(state,this);
else else
drawImplementation(state); drawImplementation(state);
}; };

View File

@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
* *
* This library is open source and may be redistributed and/or modified under * This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details. * OpenSceneGraph Public License for more details.
*/ */
@ -20,7 +20,11 @@
namespace osg { namespace osg {
/** Leaf Node for grouping Drawables.*/ /** A \c Geode is a "geometry node", that is, a leaf node on the scene graph
* that can have "renderable things" attached to it. In OSG, renderable things
* are represented by objects from the \c Drawable class, so a \c Geode is a
* \c Node whose purpose is grouping <tt>Drawable</tt>s.
*/
class SG_EXPORT Geode : public Node class SG_EXPORT Geode : public Node
{ {
public: public:
@ -34,51 +38,66 @@ class SG_EXPORT Geode : public Node
META_Node(osg, Geode); META_Node(osg, Geode);
/** Add Drawable to Geode. /** Add a \c Drawable to the \c Geode.
* If drawable is not NULL and is not contained in Geode then increment its * If \c drawable is not \c NULL and is not contained in the \c Geode
* reference count, add it to the drawables list and dirty the bounding * then increment its reference count, add it to the drawables list and
* sphere to force it to recompute on next getBound() and return true for success. * dirty the bounding sphere to force it to be recomputed on the next
* Otherwise return false. * call to \c getBound().
*/ * @param drawable The \c Drawable to be added to the \c Geode.
* @return \c true for success; \c false otherwise.
*/
virtual bool addDrawable( Drawable *drawable ); virtual bool addDrawable( Drawable *drawable );
/** Remove Drawable from Geode. /** Remove a \c Drawable from the \c Geode.
* Equivalent to setDrawable(getDrawableIndex(originChild),node), * Equivalent to <tt>removeDrawable(getDrawableIndex(drawable)</tt>.
* see docs for setNode for further details on implementation.*/ * @param drawable The drawable to be removed.
* @return \c true if at least one \c Drawable was removed. \c false
* otherwise.
*/
virtual bool removeDrawable( Drawable *drawable ); virtual bool removeDrawable( Drawable *drawable );
/** Remove drawable(s) from the specified position in Geode's drawable list.*/ /** Remove <tt>Drawable</tt>(s) from the specified position in
* <tt>Geode</tt>'s drawable list.
* @param i The index of the first \c Drawable to remove.
* @param numDrawablesToRemove The number of <tt>Drawable</tt> to
* remove.
* @return \c true if at least one \c Drawable was removed. \c false
* otherwise.
*/
virtual bool removeDrawable(unsigned int i,unsigned int numDrawablesToRemove=1); virtual bool removeDrawable(unsigned int i,unsigned int numDrawablesToRemove=1);
/** Replace specified Drawable with another Drawable. /** Replace specified Drawable with another Drawable.
* Equivalent to setDrawable(getDrawableIndex(originChild),node), * Equivalent to <tt>setDrawable(getDrawableIndex(origDraw),newDraw)</tt>,
* see docs for setDrawable for further details on implementation.*/ * see docs for \c setDrawable() for further details on implementation.
*/
virtual bool replaceDrawable( Drawable *origDraw, Drawable *newDraw ); virtual bool replaceDrawable( Drawable *origDraw, Drawable *newDraw );
/** set drawable at position i. /** Set \c Drawable at position \c i.
* return true if set correctly, false on failure (if node==NULL || i is out of range). * Decrement the reference count origGSet and increments the
* Decrement the reference count origGSet and increments the * reference count of newGset, and dirty the bounding sphere
* reference count of newGset, and dirty the bounding sphere * to force it to recompute on next getBound() and returns true.
* to force it to recompute on next getBound() and returns true. * If origDrawable is not found then return false and do not
* If origDrawable is not found then return false and do not * add newGset. If newGset is NULL then return false and do
* add newGset. If newGset is NULL then return false and do * not remove origGset.
* not remove origGset. * @return \c true if set correctly, \c false on failure
*/ * (if node==NULL || i is out of range).
*/
virtual bool setDrawable( unsigned int i, Drawable* drawable ); virtual bool setDrawable( unsigned int i, Drawable* drawable );
/** return the number of drawables.*/ /** Return the number of <tt>Drawable</tt>s currently attached to the
* \c Geode.
*/
inline unsigned int getNumDrawables() const { return _drawables.size(); } inline unsigned int getNumDrawables() const { return _drawables.size(); }
/** return drawable at position i.*/ /** Return the \c Drawable at position \c i.*/
inline Drawable* getDrawable( unsigned int i ) { return _drawables[i].get(); } inline Drawable* getDrawable( unsigned int i ) { return _drawables[i].get(); }
/** return drawable at position i.*/ /** Return the \c Drawable at position \c i.*/
inline const Drawable* getDrawable( unsigned int i ) const { return _drawables[i].get(); } inline const Drawable* getDrawable( unsigned int i ) const { return _drawables[i].get(); }
/** return true if drawable is contained within Geode.*/ /** Return \c true if a given \c Drawable is contained within \c Geode.*/
inline bool containsDrawable(const Drawable* gset) const inline bool containsDrawable(const Drawable* gset) const
{ {
for (DrawableList::const_iterator itr=_drawables.begin(); for (DrawableList::const_iterator itr=_drawables.begin();
itr!=_drawables.end(); itr!=_drawables.end();
++itr) ++itr)
@ -88,29 +107,31 @@ class SG_EXPORT Geode : public Node
return false; return false;
} }
/** Get the index number of drawable, return a value between /** Get the index number of \c drawable.
* 0 and _drawables.size()-1 if found, if not found then * @return A value between 0 and <tt>getNumDrawables()-1</tt> if
* return _drawables.size().*/ * \c drawable is found; if not found, then
inline unsigned int getDrawableIndex( const Drawable* node ) const * <tt>getNumDrawables()</tt> is returned.
*/
inline unsigned int getDrawableIndex( const Drawable* drawable ) const
{ {
for (unsigned int drawableNum=0;drawableNum<_drawables.size();++drawableNum) for (unsigned int drawableNum=0;drawableNum<_drawables.size();++drawableNum)
{ {
if (_drawables[drawableNum]==node) return drawableNum; if (_drawables[drawableNum]==drawable) return drawableNum;
} }
return _drawables.size(); // node not found. return _drawables.size(); // drawable not found.
} }
/** compile OpenGL Display List for each drawable.*/ /** Compile OpenGL Display List for each drawable.*/
void compileDrawables(State& state); void compileDrawables(State& state);
/** return the Geode's bounding box, which is the union of all the /** Return the Geode's bounding box, which is the union of all the
* bounding boxes of the geode's drawables.*/ * bounding boxes of the geode's drawables.*/
inline const BoundingBox& getBoundingBox() const inline const BoundingBox& getBoundingBox() const
{ {
if(!_bsphere_computed) computeBound(); if(!_bsphere_computed) computeBound();
return _bbox; return _bbox;
} }
protected: protected:
virtual ~Geode(); virtual ~Geode();

View File

@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
* *
* This library is open source and may be redistributed and/or modified under * This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details. * OpenSceneGraph Public License for more details.
*/ */
@ -23,145 +23,158 @@
namespace osg { namespace osg {
/** Describe several hints that can be passed to a tesselator (like the one used
* by \c ShapeDrawable) as a mean to try to influence the way it works.
*/
class TessellationHints : public Object class TessellationHints : public Object
{ {
public: public:
TessellationHints(): TessellationHints():
_TessellationMode(USE_SHAPE_DEFAULTS), _TessellationMode(USE_SHAPE_DEFAULTS),
_detailRatio(1.0f), _detailRatio(1.0f),
_targetNumFaces(100), _targetNumFaces(100),
_createFrontFace(true), _createFrontFace(true),
_createBackFace(false), _createBackFace(false),
_createNormals(true), _createNormals(true),
_createTextureCoords(false), _createTextureCoords(false),
_createTop(true), _createTop(true),
_createBody(true), _createBody(true),
_createBottom(true) {} _createBottom(true) {}
TessellationHints(const TessellationHints& tess, const CopyOp& copyop=CopyOp::SHALLOW_COPY):
Object(tess,copyop), TessellationHints(const TessellationHints& tess, const CopyOp& copyop=CopyOp::SHALLOW_COPY):
_TessellationMode(tess._TessellationMode), Object(tess,copyop),
_TessellationMode(tess._TessellationMode),
_detailRatio(tess._detailRatio), _detailRatio(tess._detailRatio),
_targetNumFaces(tess._targetNumFaces), _targetNumFaces(tess._targetNumFaces),
_createFrontFace(tess._createFrontFace), _createFrontFace(tess._createFrontFace),
_createBackFace(tess._createBackFace), _createBackFace(tess._createBackFace),
_createNormals(tess._createNormals), _createNormals(tess._createNormals),
_createTextureCoords(tess._createTextureCoords), _createTextureCoords(tess._createTextureCoords),
_createTop(tess._createTop), _createTop(tess._createTop),
_createBody(tess._createBody), _createBody(tess._createBody),
_createBottom(tess._createBottom) {} _createBottom(tess._createBottom) {}
META_Object(osg,TessellationHints); META_Object(osg,TessellationHints);
enum TessellationMode
{
USE_SHAPE_DEFAULTS,
USE_TARGET_NUM_FACES
};
inline void setTessellationMode(TessellationMode mode) { _TessellationMode=mode; }
inline TessellationMode getTessellationMode() const { return _TessellationMode; } enum TessellationMode
{
USE_SHAPE_DEFAULTS,
USE_TARGET_NUM_FACES
};
inline void setTessellationMode(TessellationMode mode) { _TessellationMode=mode; }
inline TessellationMode getTessellationMode() const { return _TessellationMode; }
inline void setDetailRatio(float ratio) { _detailRatio = ratio; } inline void setDetailRatio(float ratio) { _detailRatio = ratio; }
inline float getDetailRatio() const { return _detailRatio; } inline float getDetailRatio() const { return _detailRatio; }
inline void setTargetNumFaces(unsigned int target) { _targetNumFaces=target; } inline void setTargetNumFaces(unsigned int target) { _targetNumFaces=target; }
inline unsigned int getTargetNumFaces() const { return _targetNumFaces; } inline unsigned int getTargetNumFaces() const { return _targetNumFaces; }
inline void setCreateFrontFace(bool on) { _createFrontFace=on; } inline void setCreateFrontFace(bool on) { _createFrontFace=on; }
inline bool getCreateFrontFace() const { return _createFrontFace; } inline bool getCreateFrontFace() const { return _createFrontFace; }
inline void setCreateBackFace(bool on) { _createBackFace=on; } inline void setCreateBackFace(bool on) { _createBackFace=on; }
inline bool getCreateBackFace() const { return _createBackFace; } inline bool getCreateBackFace() const { return _createBackFace; }
inline void setCreateNormals(bool on) { _createNormals=on; } inline void setCreateNormals(bool on) { _createNormals=on; }
inline bool getCreateNormals() const { return _createNormals; } inline bool getCreateNormals() const { return _createNormals; }
inline void setCreateTextureCoords(bool on) { _createTextureCoords=on; } inline void setCreateTextureCoords(bool on) { _createTextureCoords=on; }
inline bool getCreateTextureCoords() const { return _createTextureCoords; } inline bool getCreateTextureCoords() const { return _createTextureCoords; }
inline void setCreateTop(bool on) { _createTop=on; } inline void setCreateTop(bool on) { _createTop=on; }
inline bool getCreateTop() const { return _createTop; } inline bool getCreateTop() const { return _createTop; }
inline void setCreateBody(bool on) { _createBody=on; } inline void setCreateBody(bool on) { _createBody=on; }
inline bool getCreateBody() const { return _createBody; } inline bool getCreateBody() const { return _createBody; }
inline void setCreateBottom(bool on) { _createBottom=on; } inline void setCreateBottom(bool on) { _createBottom=on; }
inline bool getCreateBottom() const { return _createBottom; } inline bool getCreateBottom() const { return _createBottom; }
protected: protected:
~TessellationHints() {}
~TessellationHints() {}
TessellationMode _TessellationMode;
TessellationMode _TessellationMode;
float _detailRatio; float _detailRatio;
unsigned int _targetNumFaces; unsigned int _targetNumFaces;
bool _createFrontFace; bool _createFrontFace;
bool _createBackFace; bool _createBackFace;
bool _createNormals; bool _createNormals;
bool _createTextureCoords; bool _createTextureCoords;
bool _createTop; bool _createTop;
bool _createBody; bool _createBody;
bool _createBottom; bool _createBottom;
}; };
/** Allow the use of <tt>Shape</tt>s as <tt>Drawable</tt>s, so that they can
* be rendered with reduced effort. The implementation of \c ShapeDrawable is
* not geared to efficiency; it's better to think of it as a convenience to
* render <tt>Shape</tt>s easily (perhaps for test or debugging purposes) than
* as the right way to render basic shapes in some efficiency-critical section
* of code.
* @todo \c ShapeDrawable currently doesn't render <tt>InfinitePlane</tt>s.
*/
class SG_EXPORT ShapeDrawable : public Drawable class SG_EXPORT ShapeDrawable : public Drawable
{ {
public: public:
ShapeDrawable(); ShapeDrawable();
ShapeDrawable(Shape* shape,TessellationHints* hints=0); ShapeDrawable(Shape* shape, TessellationHints* hints=0);
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/ /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
ShapeDrawable(const ShapeDrawable& pg,const CopyOp& copyop=CopyOp::SHALLOW_COPY); ShapeDrawable(const ShapeDrawable& pg,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
virtual Object* cloneType() const { return new ShapeDrawable(); } virtual Object* cloneType() const { return new ShapeDrawable(); }
virtual Object* clone(const CopyOp& copyop) const { return new ShapeDrawable(*this,copyop); } virtual Object* clone(const CopyOp& copyop) const { return new ShapeDrawable(*this,copyop); }
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const ShapeDrawable*>(obj)!=NULL; } virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const ShapeDrawable*>(obj)!=NULL; }
virtual const char* libraryName() const { return "osg"; } virtual const char* libraryName() const { return "osg"; }
virtual const char* className() const { return "ShapeDrawable"; } virtual const char* className() const { return "ShapeDrawable"; }
/** set the color of the shape.*/ /** Set the color of the shape.*/
void setColor(const Vec4& color) { _color = color; } void setColor(const Vec4& color) { _color = color; }
/** get the color of the shape.*/ /** Get the color of the shape.*/
const Vec4& getColor() const { return _color; } const Vec4& getColor() const { return _color; }
void setTessellationHints(TessellationHints* hints) { _tessellationHints = hints; } void setTessellationHints(TessellationHints* hints) { _tessellationHints = hints; }
TessellationHints* getTessellationHints() { return _tessellationHints.get(); } TessellationHints* getTessellationHints() { return _tessellationHints.get(); }
const TessellationHints* getTessellationHints() const { return _tessellationHints.get(); } const TessellationHints* getTessellationHints() const { return _tessellationHints.get(); }
/** draw ShapeDrawable directly ignoring an OpenGL display list which could be attached. /** Draw ShapeDrawable directly ignoring an OpenGL display list which
* This is the internal draw method which does the drawing itself, * could be attached. This is the internal draw method which does the
* and is the method to override when deriving from ShapeDrawable for user-drawn objects. * drawing itself, and is the method to override when deriving from
*/ * ShapeDrawable for user-drawn objects.
*/
virtual void drawImplementation(State& state) const; virtual void drawImplementation(State& state) const;
/** return false, osg::ShapeDrawable does not support accept(AttributeFunctor&).*/ /** Return false, osg::ShapeDrawable does not support accept(AttributeFunctor&).*/
virtual bool supports(AttributeFunctor&) const { return false; } virtual bool supports(AttributeFunctor&) const { return false; }
/** return true, osg::ShapeDrawable does support accept(ConstAttributeFunctor&).*/ /** Return true, osg::ShapeDrawable does support accept(ConstAttributeFunctor&).*/
virtual bool supports(ConstAttributeFunctor&) const { return true; } virtual bool supports(ConstAttributeFunctor&) const { return true; }
/** accept a ConstAttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has.*/ /** Accept a ConstAttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has.*/
virtual void accept(ConstAttributeFunctor& af) const; virtual void accept(ConstAttributeFunctor& af) const;
/** return true, osg::ShapeDrawable does support accept(PrimitiveFunctor&) .*/ /** Return true, osg::ShapeDrawable does support accept(PrimitiveFunctor&) .*/
virtual bool supports(PrimitiveFunctor&) const { return true; } virtual bool supports(PrimitiveFunctor&) const { return true; }
/** accept a PrimtiveFunctor and call its methods to tell it about the internal primitives that this Drawable has.*/ /** Accept a PrimitiveFunctor and call its methods to tell it about the internal primitives that this Drawable has.*/
virtual void accept(PrimitiveFunctor& pf) const; virtual void accept(PrimitiveFunctor& pf) const;
protected: protected:
@ -169,12 +182,12 @@ class SG_EXPORT ShapeDrawable : public Drawable
ShapeDrawable& operator = (const ShapeDrawable&) { return *this;} ShapeDrawable& operator = (const ShapeDrawable&) { return *this;}
virtual ~ShapeDrawable(); virtual ~ShapeDrawable();
virtual bool computeBound() const; virtual bool computeBound() const;
Vec4 _color; Vec4 _color;
ref_ptr<TessellationHints> _tessellationHints; ref_ptr<TessellationHints> _tessellationHints;
}; };