Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

osg::Drawable Class Reference

Pure virtual base class for drawable Geometry. More...

Inheritance diagram for osg::Drawable:

Inheritance graph
[legend]
List of all members.

Public Types

typedef std::vector< Node * > ParentList
 A vector of osg::Node pointers which is used to store the parent(s) of drawable.

enum  AttributeType {
  VERTICES, NORMALS, COLORS, TEXTURE_COORDS,
  TEXTURE_COORDS_0 = TEXTURE_COORDS, TEXTURE_COORDS_1 = TEXTURE_COORDS_0+1, TEXTURE_COORDS_2 = TEXTURE_COORDS_0+2, TEXTURE_COORDS_3 = TEXTURE_COORDS_0+3,
  TEXTURE_COORDS_4 = TEXTURE_COORDS_0+4, TEXTURE_COORDS_5 = TEXTURE_COORDS_0+5, TEXTURE_COORDS_6 = TEXTURE_COORDS_0+6, TEXTURE_COORDS_7 = TEXTURE_COORDS_0+7
}

Public Methods

 Drawable ()
 Drawable (const Drawable &drawable, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
 Copy constructor using CopyOp to manage deep vs shallow copy.

virtual bool isSameKindAs (const Object *obj) const
virtual const char * libraryName () const
 return the name of the object's library.

virtual const char * className () const
 return the name of the object's class type.

const ParentListgetParents () const
 Get the parent list of drawable.

ParentList getParents ()
 Get the a copy of parent list of node.

NodegetParent (const unsigned int i)
 Get a single parent of Drawable.

const NodegetParent (const unsigned int i) const
 Get a single const parent of Drawable.

const unsigned int getNumParents () const
 Get the number of parents of node.

void setStateSet (StateSet *state)
 Set the StateSet attached to the Drawable.

StateSetgetStateSet ()
 Get the attached StateSet.

const StateSetgetStateSet () const
 Get the attached const StateSet.

void setSupportsDisplayList (const bool flag)
 Set the drawable to it can or cannot be used in conjunction with OpenGL display lists.

const bool getSupportsDisplayList () const
 Get whether display lists are supported for this drawable instance.

void setUseDisplayList (const bool flag)
 When set to true, force the draw method to use OpenGL Display List for rendering.

const bool getUseDisplayList () const
 Return whether OpenGL display lists are being used for rendering.

void dirtyDisplayList ()
 Force a recompile on next draw() of any OpenGL display list associated with this geoset.

void dirtyBound ()
 Dirty the bounding box, forcing a computeBound() on the next call to getBound().

const BoundingBoxgetBound () const
 get bounding box of geoset.

void draw (State &state)
 draw OpenGL primitives.

void compile (State &state)
 Immediately compile this drawable into an OpenGL Display List.

void setAppCallback (AppCallback *ac)
 Set the AppCallback which allows users to attach customize the undating of an object during the app traversal.

AppCallbackgetAppCallback ()
 Get the non const AppCallback.

const AppCallbackgetAppCallback () const
 Get the const AppCallback.

void setCullCallback (CullCallback *cc)
 Set the CullCallback which allows users to attach customize the culling of Drawable during the cull traversal.

CullCallbackgetCullCallback ()
 Get the non const CullCallback.

const CullCallbackgetCullCallback () const
 Get the const CullCallback.

void setDrawCallback (DrawCallback *dc)
 Set the DrawCallback which allows users to attach customize the drawing of existing Drawable object.

DrawCallbackgetDrawCallback ()
 Get the non const DrawCallback.

const DrawCallbackgetDrawCallback () const
 Get the const DrawCallback.

virtual void drawImmediateMode (State &state)=0
 draw directly ignoring an OpenGL display list which could be attached.

virtual void accept (AttributeFunctor &)
 accept an AttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has.

virtual void accept (PrimitiveFunctor &)
 accept a PrimtiveFunctor and call its methods to tell it about the interal primtives that this Drawable has.


Static Public Methods

void deleteDisplayList (uint contextID, uint globj)
 use deleteDisplayList instead of glDeleteList to allow OpenGL display list to cached until they can be deleted by the OpenGL context in which they were created, specified by contextID.

void flushDeletedDisplayLists (uint contextID)
 flush all the cached display list which need to be deleted in the OpenGL context related to contextID.


Protected Types

typedef std::vector< uintGLObjectList
typedef std::map< uint, std::set<
uint > > 
DeletedDisplayListCache

Protected Methods

Drawable & operator= (const Drawable &)
virtual ~Drawable ()
virtual const bool computeBound () const
 compute the bounding box of the drawable.

void addParent (osg::Node *node)
void removeParent (osg::Node *node)

Protected Attributes

ParentList _parents
ref_ptr< StateSet_dstate
bool _supportsDisplayList
bool _useDisplayList
GLObjectList _globjList
BoundingBox _bbox
bool _bbox_computed
ref_ptr< AppCallback_appCallback
ref_ptr< DrawCallback_drawCallback
ref_ptr< CullCallback_cullCallback

Static Protected Attributes

DeletedDisplayListCache s_deletedDisplayListCache

Friends

class Node
class Geode

Detailed Description

Pure virtual base class for drawable Geometry.

Contains no drawing primitives directly, these are provided by subclasses such as osg::Geometry. State attributes for a Drawable are maintained in StateSet which the Drawable maintains a referenced counted pointer to. Both Drawable's and StateSet's can be shared for optimal memory usage and graphics performance.


Member Typedef Documentation

typedef std::map<uint,std::set<uint> > osg::Drawable::DeletedDisplayListCache [protected]
 

typedef std::vector<uint> osg::Drawable::GLObjectList [protected]
 

typedef std::vector<Node*> osg::Drawable::ParentList
 

A vector of osg::Node pointers which is used to store the parent(s) of drawable.


Member Enumeration Documentation

enum osg::Drawable::AttributeType
 

Enumeration values:
VERTICES 
NORMALS 
COLORS 
TEXTURE_COORDS 
TEXTURE_COORDS_0 
TEXTURE_COORDS_1 
TEXTURE_COORDS_2 
TEXTURE_COORDS_3 
TEXTURE_COORDS_4 
TEXTURE_COORDS_5 
TEXTURE_COORDS_6 
TEXTURE_COORDS_7 


Constructor & Destructor Documentation

osg::Drawable::Drawable  
 

osg::Drawable::Drawable const Drawable &    drawable,
const CopyOp   copyop = CopyOp::SHALLOW_COPY
 

Copy constructor using CopyOp to manage deep vs shallow copy.

virtual osg::Drawable::~Drawable   [protected, virtual]
 


Member Function Documentation

virtual void osg::Drawable::accept PrimitiveFunctor   [inline, virtual]
 

accept a PrimtiveFunctor and call its methods to tell it about the interal primtives that this Drawable has.

Reimplemented in osg::Geometry, osg::GeoSet, and osg::ImpostorSprite.

virtual void osg::Drawable::accept AttributeFunctor   [inline, virtual]
 

accept an AttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has.

Reimplemented in osg::Geometry, osg::GeoSet, and osg::ImpostorSprite.

void osg::Drawable::addParent osg::Node   node [protected]
 

virtual const char* osg::Drawable::className   const [inline, virtual]
 

return the name of the object's class type.

Must be defined by derived classes.

Implements osg::Object.

Reimplemented in osg::DrawPixels, osg::Geometry, osg::GeoSet, osg::ImpostorSprite, and osgText::Text.

void osg::Drawable::compile State   state
 

Immediately compile this drawable into an OpenGL Display List.

Note I, operation is ignored if _useDisplayList to false. Note II, compile is not intended to be overridden in subclasses.

virtual const bool osg::Drawable::computeBound   const [protected, virtual]
 

compute the bounding box of the drawable.

Method must be implemented by subclasses.

Reimplemented in osg::DrawPixels, osg::GeoSet, osg::ImpostorSprite, osgParticle::ParticleSystem, and osgText::Text.

void osg::Drawable::deleteDisplayList uint    contextID,
uint    globj
[static]
 

use deleteDisplayList instead of glDeleteList to allow OpenGL display list to cached until they can be deleted by the OpenGL context in which they were created, specified by contextID.

void osg::Drawable::dirtyBound  
 

Dirty the bounding box, forcing a computeBound() on the next call to getBound().

Should be called in the internal geometry of the Drawable is modified.

void osg::Drawable::dirtyDisplayList  
 

Force a recompile on next draw() of any OpenGL display list associated with this geoset.

void osg::Drawable::draw State   state [inline]
 

draw OpenGL primitives.

If the drawable has _useDisplayList set to true then use an OpenGL display list, automatically compiling one if required. Otherwise call drawImmediateMode(). Note, draw method should *not* be overridden in subclasses as it manages the optional display list.

virtual void osg::Drawable::drawImmediateMode State   state [pure virtual]
 

draw directly ignoring an OpenGL display list which could be attached.

This is the internal draw method which does the drawing itself, and is the method to override when deriving from Drawable.

Implemented in osg::DrawPixels, osg::Geometry, osg::GeoSet, osg::ImpostorSprite, osgParticle::ParticleSystem, and osgText::Text.

void osg::Drawable::flushDeletedDisplayLists uint    contextID [static]
 

flush all the cached display list which need to be deleted in the OpenGL context related to contextID.

const AppCallback* osg::Drawable::getAppCallback   const [inline]
 

Get the const AppCallback.

AppCallback* osg::Drawable::getAppCallback   [inline]
 

Get the non const AppCallback.

const BoundingBox& osg::Drawable::getBound   const [inline]
 

get bounding box of geoset.

Note, now made virtual to make it possible to implement user-drawn objects albeit so what crudely, to be improved later.

const CullCallback* osg::Drawable::getCullCallback   const [inline]
 

Get the const CullCallback.

CullCallback* osg::Drawable::getCullCallback   [inline]
 

Get the non const CullCallback.

const DrawCallback* osg::Drawable::getDrawCallback   const [inline]
 

Get the const DrawCallback.

DrawCallback* osg::Drawable::getDrawCallback   [inline]
 

Get the non const DrawCallback.

const unsigned int osg::Drawable::getNumParents   const [inline]
 

Get the number of parents of node.

Returns:
the number of parents of this node.

const Node* osg::Drawable::getParent const unsigned int    i const [inline]
 

Get a single const parent of Drawable.

Parameters:
i  index of the parent to get.
Returns:
the parent i.

Node* osg::Drawable::getParent const unsigned int    i [inline]
 

Get a single parent of Drawable.

Parameters:
i  index of the parent to get.
Returns:
the parent i.

ParentList osg::Drawable::getParents   [inline]
 

Get the a copy of parent list of node.

A copy is returned to prevent modification of the parent list.

const ParentList& osg::Drawable::getParents   const [inline]
 

Get the parent list of drawable.

const StateSet* osg::Drawable::getStateSet   const [inline]
 

Get the attached const StateSet.

StateSet* osg::Drawable::getStateSet   [inline]
 

Get the attached StateSet.

const bool osg::Drawable::getSupportsDisplayList   const [inline]
 

Get whether display lists are supported for this drawable instance.

const bool osg::Drawable::getUseDisplayList   const [inline]
 

Return whether OpenGL display lists are being used for rendering.

virtual bool osg::Drawable::isSameKindAs const Object   obj const [inline, virtual]
 

Reimplemented from osg::Object.

Reimplemented in osg::DrawPixels, osg::Geometry, osg::GeoSet, and osg::ImpostorSprite.

virtual const char* osg::Drawable::libraryName   const [inline, virtual]
 

return the name of the object's library.

Must be defined by derived classes. The OpenSceneGraph convention the is that the namspace of a library is the same as the library name.

Implements osg::Object.

Reimplemented in osg::DrawPixels, osg::Geometry, osg::GeoSet, osg::ImpostorSprite, and osgText::Text.

Drawable& osg::Drawable::operator= const Drawable &    [inline, protected]
 

void osg::Drawable::removeParent osg::Node   node [protected]
 

void osg::Drawable::setAppCallback AppCallback   ac
 

Set the AppCallback which allows users to attach customize the undating of an object during the app traversal.

void osg::Drawable::setCullCallback CullCallback   cc [inline]
 

Set the CullCallback which allows users to attach customize the culling of Drawable during the cull traversal.

void osg::Drawable::setDrawCallback DrawCallback   dc [inline]
 

Set the DrawCallback which allows users to attach customize the drawing of existing Drawable object.

void osg::Drawable::setStateSet StateSet   state [inline]
 

Set the StateSet attached to the Drawable.

Previously attached StateSet are automatically unreferenced on assignment of a new drawstate.

void osg::Drawable::setSupportsDisplayList const bool    flag
 

Set the drawable to it can or cannot be used in conjunction with OpenGL display lists.

With set to true, calls to Drawable::setUseDisplayList, whereas when set to false, no display lists can be created and calls to setUseDisplayList are ignored, and a warning is produced. The later is typically used to guard against the switching on of display lists on objects with dynamic internal data such as continuous Level of Detail algorithms.

void osg::Drawable::setUseDisplayList const bool    flag
 

When set to true, force the draw method to use OpenGL Display List for rendering.

If false rendering directly. If the display list has not been already compile the next call to draw will automatically create the display list.


Friends And Related Function Documentation

friend class Geode [friend]
 

friend class Node [friend]
 


Member Data Documentation

ref_ptr<AppCallback> osg::Drawable::_appCallback [protected]
 

BoundingBox osg::Drawable::_bbox [protected]
 

bool osg::Drawable::_bbox_computed [protected]
 

ref_ptr<CullCallback> osg::Drawable::_cullCallback [protected]
 

ref_ptr<DrawCallback> osg::Drawable::_drawCallback [protected]
 

ref_ptr<StateSet> osg::Drawable::_dstate [protected]
 

GLObjectList osg::Drawable::_globjList [protected]
 

ParentList osg::Drawable::_parents [protected]
 

bool osg::Drawable::_supportsDisplayList [protected]
 

bool osg::Drawable::_useDisplayList [protected]
 

DeletedDisplayListCache osg::Drawable::s_deletedDisplayListCache [static, protected]
 


The documentation for this class was generated from the following file:
Generated at Wed Sep 18 13:55:28 2002 for the Open Scene Graph by doxygen 1.2.16.