Open Inventor Reference
SoCallbackAction Class Reference

Performs a generic traversal of the scene graph. More...

#include <Inventor/actions/SoCallbackAction.h>

Inheritance diagram for SoCallbackAction:
SoAction

List of all members.

Public Types

enum  Response { CONTINUE, ABORT, PRUNE }
 Possible responses from a pre or post callback. More...
typedef Response SoCallbackActionCB (void *userData, SoCallbackAction *action, const SoNode *node)
 The SoCallbackActionCB typedef is defined within the class, since it needs to refer to the Response enumerated type.

Public Member Functions

 SoCallbackAction ()
 The constructor.
virtual ~SoCallbackAction ()
 Destructor.
void addPreCallback (SoType type, SoCallbackActionCB *cb, void *data)
 Adding callback functions:
void addPostCallback (SoType type, SoCallbackActionCB *cb, void *data)
void addPreTailCallback (SoCallbackActionCB *cb, void *data)
 These can be used to set up callback functions to call when the action is applied to a path.
void addPostTailCallback (SoCallbackActionCB *cb, void *data)
 These can be used to set up callback functions to call when the action is applied to a path.
void addTriangleCallback (SoType type, SoTriangleCB *cb, void *data)
 Routines to add callbacks for generated primitives (triangles, line segments, and points) for all shapes of the given type.
void addLineSegmentCallback (SoType type, SoLineSegmentCB *cb, void *data)
void addPointCallback (SoType type, SoPointCB *cb, void *data)
float getComplexity () const
 Accessing state information from callbacks.
SoComplexity::Type getComplexityType () const
int32_t getNumCoordinates () const
 Returns the current coordinates from the state.
const SbVec3fgetCoordinate3 (int index) const
 Returns the current coordinates from the state.
const SbVec4fgetCoordinate4 (int index) const
 Returns the current coordinates from the state.
SoDrawStyle::Style getDrawStyle () const
u_short getLinePattern () const
 Returns the current drawing style information from the state.
float getLineWidth () const
 Returns the current drawing style information from the state.
float getPointSize () const
 Returns the current drawing style information from the state.
const SbNamegetFontName () const
 Returns the current font information from the state.
float getFontSize () const
 Returns the current font information from the state.
SoLightModel::Model getLightModel () const
const SbVec3fgetLightAttenuation () const
 Returns the current lighting model information from the state.
void getMaterial (SbColor &ambient, SbColor &diffuse, SbColor &specular, SbColor &emission, float &shininess, float &transparency, int mtlIndex=0) const
 Returns the current material information from the state.
SoMaterialBinding::Binding getMaterialBinding () const
int32_t getNumNormals () const
 Returns the current normal information from the state.
const SbVec3fgetNormal (int index) const
 Returns the current normal information from the state.
SoNormalBinding::Binding getNormalBinding () const
int32_t getNumProfileCoordinates () const
 Returns the current profiles and their coordinates from the state.
const SbVec2fgetProfileCoordinate2 (int index) const
 Returns the current profiles and their coordinates from the state.
const SbVec3fgetProfileCoordinate3 (int index) const
 Returns the current profiles and their coordinates from the state.
const SoNodeListgetProfile () const
 Returns the current profiles and their coordinates from the state.
SoShapeHints::VertexOrdering getVertexOrdering () const
SoShapeHints::ShapeType getShapeType () const
SoShapeHints::FaceType getFaceType () const
float getCreaseAngle () const
 Returns the current shape hints from the state.
int32_t getNumTextureCoordinates () const
 Returns 0 if texture coordinates are generated by a function.
const SbVec2fgetTextureCoordinate2 (int index) const
 Returns texture information from the state.
const SbVec4fgetTextureCoordinate4 (int index) const
 Returns texture information from the state.
SoTextureCoordinateBinding::Binding getTextureCoordinateBinding () const
const SbColorgetTextureBlendColor () const
 Returns texture information from the state.
const unsigned char * getTextureImage (SbVec2s &size, int &numComps) const
 Returns texture information from the state.
const SbMatrixgetTextureMatrix () const
 Returns the current texture mapping information from the state.
SoTexture2::Model getTextureModel () const
SoTexture2::Wrap getTextureWrapS () const
SoTexture2::Wrap getTextureWrapT () const
const SbMatrixgetModelMatrix () const
 Returns the current modeling transformation and the current units from the state.
SoUnits::Units getUnits () const
float getFocalDistance () const
 Returns the current camera and viewing information from the state.
const SbMatrixgetProjectionMatrix () const
 Returns the current camera and viewing information from the state.
const SbMatrixgetViewingMatrix () const
 Returns the current camera and viewing information from the state.
const SbViewVolumegetViewVolume () const
 Returns the current camera and viewing information from the state.
SoPickStyle::Style getPickStyle () const
int32_t getSwitch () const
 Returns the current switch value.
Response getCurrentResponse () const
 Returns the current response.
void invokePreCallbacks (const SoNode *node)
 Call the pre-callbacks and post-callbacks.
void invokePostCallbacks (const SoNode *node)
void invokeTriangleCallbacks (const SoShape *shape, const SoPrimitiveVertex *v1, const SoPrimitiveVertex *v2, const SoPrimitiveVertex *v3)
 Call the primitive callbacks.
void invokeLineSegmentCallbacks (const SoShape *shape, const SoPrimitiveVertex *v1, const SoPrimitiveVertex *v2)
void invokePointCallbacks (const SoShape *shape, const SoPrimitiveVertex *v)
SbBool shouldGeneratePrimitives (const SoShape *shape) const
 Should primitives be generated for this shape?
virtual SoNodegetCurPathTail ()
 Returns the node that caused the callback:
void setCurrentNode (SoNode *node)
 Set the current node during traversal:

Static Public Member Functions

static void initClass ()

Protected Member Functions

virtual void beginTraversal (SoNode *node)
 Initiates action on graph.

Detailed Description

This action defines a generic traversal of the scene graph. The user can specify callback functions for node types or paths; when those node types or paths are encountered during traversal, the user's callback function is called.

In addition, callback functions can be registered for primitives generated by shapes in the scene graph. Most shape types can generate primitives that represent or approximate their geometries. Triangle primitives are used for all surfaces (such as cubes, face sets, or 3D text), line segment primitives are used for line shapes, and point primitives are used for point shapes. Note that the type of primitives generated for a shape is the same, regardless of drawing style or other properties.

Most of the methods on this class access information from the traversal state. They should be called only by callback functions that are invoked during traversal, so there is a valid state to work with.

See Also
SoCallback, SoEventCallback, SoShape

Definition at line 126 of file SoCallbackAction.h.


Member Typedef Documentation

typedef Response SoCallbackAction::SoCallbackActionCB(void *userData, SoCallbackAction *action, const SoNode *node)

The first argument is the data pointer that the user supplied when the callback was registered. The second argument is the action, from which the state can be extracted. The third argument is the node that the callback is called from.

Definition at line 145 of file SoCallbackAction.h.


Member Enumeration Documentation

Enumerator:
CONTINUE 

Continue as usual.

ABORT 

Stop traversing the rest of the graph.

PRUNE 

Do not traverse children of this node.

Definition at line 133 of file SoCallbackAction.h.


Constructor & Destructor Documentation

SoCallbackAction::SoCallbackAction ( )
virtual SoCallbackAction::~SoCallbackAction ( ) [virtual]

Member Function Documentation

void SoCallbackAction::addLineSegmentCallback ( SoType  type,
SoLineSegmentCB cb,
void *  data 
)
void SoCallbackAction::addPointCallback ( SoType  type,
SoPointCB cb,
void *  data 
)
void SoCallbackAction::addPostCallback ( SoType  type,
SoCallbackActionCB cb,
void *  data 
)
void SoCallbackAction::addPostTailCallback ( SoCallbackActionCB cb,
void *  data 
)

The functions are called just after the node at the tail of the path is traversed.

void SoCallbackAction::addPreCallback ( SoType  type,
SoCallbackActionCB cb,
void *  data 
)

These add a callback function to call when a node of the given type is encountered during traversal. The PreCallback is called just before the node is traversed, and the PostCallback is called just after. The value returned by a callback function indicates whether the action should continue with the traversal.

void SoCallbackAction::addPreTailCallback ( SoCallbackActionCB cb,
void *  data 
)

The functions are called just before the node at the tail of the path is traversed.

void SoCallbackAction::addTriangleCallback ( SoType  type,
SoTriangleCB cb,
void *  data 
)

The callback function will be called for each primitive generated for all shapes of or derived from that type.

virtual void SoCallbackAction::beginTraversal ( SoNode node) [protected, virtual]

Reimplemented from SoAction.

float SoCallbackAction::getComplexity ( ) const

Non-obvious return values are documented. Returns complexity information from the state.

SoComplexity::Type SoCallbackAction::getComplexityType ( ) const
const SbVec3f& SoCallbackAction::getCoordinate3 ( int  index) const
const SbVec4f& SoCallbackAction::getCoordinate4 ( int  index) const
float SoCallbackAction::getCreaseAngle ( ) const
virtual SoNode* SoCallbackAction::getCurPathTail ( ) [virtual]

Reimplemented from SoAction.

Response SoCallbackAction::getCurrentResponse ( ) const [inline]

Definition at line 321 of file SoCallbackAction.h.

SoDrawStyle::Style SoCallbackAction::getDrawStyle ( ) const
SoShapeHints::FaceType SoCallbackAction::getFaceType ( ) const
float SoCallbackAction::getFocalDistance ( ) const
const SbName& SoCallbackAction::getFontName ( ) const
float SoCallbackAction::getFontSize ( ) const
const SbVec3f& SoCallbackAction::getLightAttenuation ( ) const
SoLightModel::Model SoCallbackAction::getLightModel ( ) const
u_short SoCallbackAction::getLinePattern ( ) const
float SoCallbackAction::getLineWidth ( ) const
void SoCallbackAction::getMaterial ( SbColor ambient,
SbColor diffuse,
SbColor specular,
SbColor emission,
float &  shininess,
float &  transparency,
int  mtlIndex = 0 
) const

Providing a mtlIndex will return the material defined for that index.

SoMaterialBinding::Binding SoCallbackAction::getMaterialBinding ( ) const
const SbMatrix& SoCallbackAction::getModelMatrix ( ) const
const SbVec3f& SoCallbackAction::getNormal ( int  index) const
SoNormalBinding::Binding SoCallbackAction::getNormalBinding ( ) const
int32_t SoCallbackAction::getNumCoordinates ( ) const
int32_t SoCallbackAction::getNumNormals ( ) const
int32_t SoCallbackAction::getNumProfileCoordinates ( ) const
int32_t SoCallbackAction::getNumTextureCoordinates ( ) const
SoPickStyle::Style SoCallbackAction::getPickStyle ( ) const
float SoCallbackAction::getPointSize ( ) const
const SoNodeList& SoCallbackAction::getProfile ( ) const
const SbVec2f& SoCallbackAction::getProfileCoordinate2 ( int  index) const
const SbVec3f& SoCallbackAction::getProfileCoordinate3 ( int  index) const
const SbMatrix& SoCallbackAction::getProjectionMatrix ( ) const
SoShapeHints::ShapeType SoCallbackAction::getShapeType ( ) const
int32_t SoCallbackAction::getSwitch ( ) const
const SbColor& SoCallbackAction::getTextureBlendColor ( ) const
const SbVec2f& SoCallbackAction::getTextureCoordinate2 ( int  index) const
const SbVec4f& SoCallbackAction::getTextureCoordinate4 ( int  index) const
SoTextureCoordinateBinding::Binding SoCallbackAction::getTextureCoordinateBinding ( ) const
const unsigned char* SoCallbackAction::getTextureImage ( SbVec2s size,
int &  numComps 
) const

returns NULL if no texture is enabled.

const SbMatrix& SoCallbackAction::getTextureMatrix ( ) const
SoTexture2::Model SoCallbackAction::getTextureModel ( ) const
SoTexture2::Wrap SoCallbackAction::getTextureWrapS ( ) const
SoTexture2::Wrap SoCallbackAction::getTextureWrapT ( ) const
SoUnits::Units SoCallbackAction::getUnits ( ) const
SoShapeHints::VertexOrdering SoCallbackAction::getVertexOrdering ( ) const
const SbMatrix& SoCallbackAction::getViewingMatrix ( ) const
const SbViewVolume& SoCallbackAction::getViewVolume ( ) const
static void SoCallbackAction::initClass ( ) [static]

Reimplemented from SoAction.

void SoCallbackAction::invokeLineSegmentCallbacks ( const SoShape shape,
const SoPrimitiveVertex v1,
const SoPrimitiveVertex v2 
)
void SoCallbackAction::invokePointCallbacks ( const SoShape shape,
const SoPrimitiveVertex v 
)
void SoCallbackAction::invokePostCallbacks ( const SoNode node)
void SoCallbackAction::invokePreCallbacks ( const SoNode node)
void SoCallbackAction::invokeTriangleCallbacks ( const SoShape shape,
const SoPrimitiveVertex v1,
const SoPrimitiveVertex v2,
const SoPrimitiveVertex v3 
)
void SoCallbackAction::setCurrentNode ( SoNode node) [inline]

Definition at line 348 of file SoCallbackAction.h.

SbBool SoCallbackAction::shouldGeneratePrimitives ( const SoShape shape) const

The documentation for this class was generated from the following file: