table of contents
SoCallbackAction(3IV)() | SoCallbackAction(3IV)() |
NAME¶
SoCallbackAction — performs a generic traversal of the scene graph
INHERITS FROM¶
SoAction > SoCallbackAction
SYNOPSIS¶
#include <Inventor/actions/SoCallbackAction.h>
typedef void SoTriangleCB(void *userData,
SoCallbackAction *action,
const SoPrimitiveVertex *v1,
const SoPrimitiveVertex *v2,
const SoPrimitiveVertex *v3)
typedef void SoLineSegmentCB(void *userData,
SoCallbackAction *action,
const SoPrimitiveVertex *v1,
const SoPrimitiveVertex *v2)
typedef void SoPointCB(void *userData,
SoCallbackAction *action,
const SoPrimitiveVertex *v)
typedef SoCallbackAction::Response SoCallbackActionCB(void
*userData,
SoCallbackAction *action,
const SoNode *node)
enum Response {
SoCallbackAction::CONTINUE Continue traversal as if nothing happened
SoCallbackAction::ABORT Abort traversal
SoCallbackAction::PRUNE Do not traverse node's children, but continue
traversal
}
Methods from class SoCallbackAction:
SoCallbackAction()
void addPreCallback(SoType type, SoCallbackActionCB
*cb, void *data)
void addPostCallback(SoType type, SoCallbackActionCB
*cb, void *data)
void addPreTailCallback(SoCallbackActionCB *cb, void
*data)
void addPostTailCallback(SoCallbackActionCB *cb, void
*data)
void addTriangleCallback(SoType type, SoTriangleCB
*cb, void *data)
void addLineSegmentCallback(SoType type,
SoLineSegmentCB *cb, void *data)
void addPointCallback(SoType type, SoPointCB *cb, void
*data)
float getComplexity() const
SoComplexity::Type getComplexityType() const
int32_t getNumCoordinates() const
const SbVec3f & getCoordinate3(int index)
const
const SbVec4f & getCoordinate4(int index)
const
SoDrawStyle::Style getDrawStyle() const
unsigned short getLinePattern() const
float getLineWidth() const
float getPointSize() const
const SbName & getFontName() const
float getFontSize() const
SoLightModel::Model getLightModel() const
const SbVec3f & getLightAttenuation() const
void getMaterial(SbColor &ambient, SbColor
&diffuse, SbColor &specular, SbColor &emission, float
&shininess, float &transparency, int mtlIndex = 0) const
SoMaterialBinding::Binding getMaterialBinding()
const
long getNumNormals() const
const SbVec3f & getNormal(int index) const
SoNormalBinding::Binding getNormalBinding() const
int32_t getNumProfileCoordinates() const
const SbVec2f & getProfileCoordinate2(int index)
const
const SbVec3f & getProfileCoordinate3(int index)
const
const SoNodeList & getProfile() const
SoShapeHints::VertexOrdering getVertexOrdering() const
SoShapeHints::ShapeType getShapeType() const
SoShapeHints::FaceType getFaceType() const
float getCreaseAngle() const
int32_t getNumTextureCoordinates() const
const SbVec2f & getTextureCoordinate2(int index)
const
const SbVec4f & getTextureCoordinate4(int index)
const
SoTextureCoordinateBinding::Binding
getTextureCoordinateBinding() const
const SbColor & getTextureBlendColor() const
const unsigned char * getTextureImage(SbVec2s
&size, int &numComps) const
const SbMatrix & getTextureMatrix() const
SoTexture2::Model getTextureModel() const
SoTexture2::Wrap getTextureWrapS() const
SoTexture2::Wrap getTextureWrapT() const
const SbMatrix & getModelMatrix() const
SoUnits::Units getUnits() const
float getFocalDistance() const
const SbMatrix & getProjectionMatrix() const
const SbMatrix & getViewingMatrix() const
const SbViewVolume & getViewVolume() const
SoPickStyle::Style getPickStyle() const
int32_t getSwitch() const
Methods from class SoAction:
virtual void apply(SoNode *node)
virtual void apply(SoPath *path)
virtual void apply(const SoPathList &pathList,
SbBool obeysRules = FALSE)
static SoType getClassTypeId()
virtual SoType getTypeId()
virtual SbBool isOfType(SoType type)
virtual void invalidateState()
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.
METHODS¶
SoCallbackAction()
The constructor.
void addPreCallback(SoType type, SoCallbackActionCB
*cb, void *data)
void addPostCallback(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 addPreTailCallback(SoCallbackActionCB *cb, void
*data)
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. The functions are called just before or after the node at
the tail of the path is traversed.
void addTriangleCallback(SoType type, SoTriangleCB
*cb, void *data)
void addLineSegmentCallback(SoType type,
SoLineSegmentCB *cb, void *data)
void addPointCallback(SoType type, SoPointCB *cb, void
*data)
Routines to add callbacks for generated primitives (triangles, line segments,
and points) for all shapes of the given type. The callback function will be
called for each primitive generated for all shapes of or derived from that
type.
float getComplexity() const
SoComplexity::Type getComplexityType() const
Returns complexity information from the state.
int32_t getNumCoordinates() const
const SbVec3f & getCoordinate3(int index)
const
const SbVec4f & getCoordinate4(int index)
const
Returns the current coordinates from the state.
SoDrawStyle::Style getDrawStyle() const
unsigned short getLinePattern() const
float getLineWidth() const
float getPointSize() const
Returns the current drawing style information from the state.
const SbName & getFontName() const
float getFontSize() const
Returns the current font information from the state.
SoLightModel::Model getLightModel() const
const SbVec3f & getLightAttenuation() 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
SoMaterialBinding::Binding getMaterialBinding()
const
Returns the current material information from the state. Providing a
mtlIndex will return the material defined for that index.
long getNumNormals() const
const SbVec3f & getNormal(int index) const
SoNormalBinding::Binding getNormalBinding() const
Returns the current normal information from the state.
int32_t getNumProfileCoordinates() const
const SbVec2f & getProfileCoordinate2(int index)
const
const SbVec3f & getProfileCoordinate3(int index)
const
const SoNodeList & getProfile() 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
const SbVec2f & getTextureCoordinate2(int index)
const
const SbVec4f & getTextureCoordinate4(int index)
const
SoTextureCoordinateBinding::Binding
getTextureCoordinateBinding() const
const SbColor & getTextureBlendColor() const
const unsigned char * getTextureImage(SbVec2s
&size, int &numComps) const
Returns texture information from the state. getNumTextureCoordinates()
returns 0 if texture coordinates are generated by a function.
getTextureImage() returns NULL if no texture is enabled.
const SbMatrix & getTextureMatrix() const
SoTexture2::Model getTextureModel() const
SoTexture2::Wrap getTextureWrapS() const
SoTexture2::Wrap getTextureWrapT() const
Returns the current texture mapping information from the state.
const SbMatrix & getModelMatrix() const
SoUnits::Units getUnits() const
Returns the current modeling transformation and the current units from the
state.
float getFocalDistance() const
const SbMatrix & getProjectionMatrix() const
const SbMatrix & getViewingMatrix() const
const SbViewVolume & getViewVolume() const
Returns the current camera and viewing information from the state.
SoPickStyle::Style getPickStyle() const
Returns the current picking style.
int32_t getSwitch() const
Returns the current switch value.
SEE ALSO¶
SoCallback, SoEventCallback, SoShape