SoCallbackAction — performs a generic traversal of the scene graph
Contents
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), linesegment 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.
Inherits From
SoAction > SoCallbackAction
Methods
SoCallbackAction()
The constructor.
voidaddPreCallback(SoTypetype,SoCallbackActionCB*cb,void*data)voidaddPostCallback(SoTypetype,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.
voidaddPreTailCallback(SoCallbackActionCB*cb,void*data)voidaddPostTailCallback(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.
voidaddTriangleCallback(SoTypetype,SoTriangleCB*cb,void*data)voidaddLineSegmentCallback(SoTypetype,SoLineSegmentCB*cb,void*data)voidaddPointCallback(SoTypetype,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.
floatgetComplexity()constSoComplexity::TypegetComplexityType()const
Returns complexity information from the state.
int32_tgetNumCoordinates()constconstSbVec3f&getCoordinate3(intindex)constconstSbVec4f&getCoordinate4(intindex)const
Returns the current coordinates from the state.
SoDrawStyle::StylegetDrawStyle()constunsignedshortgetLinePattern()constfloatgetLineWidth()constfloatgetPointSize()const
Returns the current drawing style information from the state.
constSbName&getFontName()constfloatgetFontSize()const
Returns the current font information from the state.
SoLightModel::ModelgetLightModel()constconstSbVec3f&getLightAttenuation()const
Returns the current lighting model information from the state.
voidgetMaterial(SbColor&ambient,SbColor&diffuse,SbColor&specular,SbColor&emission,float&shininess,float&transparency,intmtlIndex=0)constSoMaterialBinding::BindinggetMaterialBinding()const
Returns the current material information from the state. Providing a mtlIndex will return the material
defined for that index.
longgetNumNormals()constconstSbVec3f&getNormal(intindex)constSoNormalBinding::BindinggetNormalBinding()const
Returns the current normal information from the state.
int32_tgetNumProfileCoordinates()constconstSbVec2f&getProfileCoordinate2(intindex)constconstSbVec3f&getProfileCoordinate3(intindex)constconstSoNodeList&getProfile()const
Returns the current profiles and their coordinates from the state.
SoShapeHints::VertexOrderinggetVertexOrdering()constSoShapeHints::ShapeTypegetShapeType()constSoShapeHints::FaceTypegetFaceType()constfloatgetCreaseAngle()const
Returns the current shape hints from the state.
int32_tgetNumTextureCoordinates()constconstSbVec2f&getTextureCoordinate2(intindex)constconstSbVec4f&getTextureCoordinate4(intindex)constSoTextureCoordinateBinding::BindinggetTextureCoordinateBinding()constconstSbColor&getTextureBlendColor()constconstunsignedchar*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.
constSbMatrix&getTextureMatrix()constSoTexture2::ModelgetTextureModel()constSoTexture2::WrapgetTextureWrapS()constSoTexture2::WrapgetTextureWrapT()const
Returns the current texture mapping information from the state.
constSbMatrix&getModelMatrix()constSoUnits::UnitsgetUnits()const
Returns the current modeling transformation and the current units from the state.
floatgetFocalDistance()constconstSbMatrix&getProjectionMatrix()constconstSbMatrix&getViewingMatrix()constconstSbViewVolume&getViewVolume()const
Returns the current camera and viewing information from the state.
SoPickStyle::StylegetPickStyle()const
Returns the current picking style.
int32_tgetSwitch()const
Returns the current switch value.
Name
SoCallbackAction — performs a generic traversal of the scene graph
See Also
SoCallback,SoEventCallback,SoShapeSoCallbackAction(3IV)()
Synopsis
#include<Inventor/actions/SoCallbackAction.h>typedefvoidSoTriangleCB(void*userData,SoCallbackAction*action,constSoPrimitiveVertex*v1,constSoPrimitiveVertex*v2,constSoPrimitiveVertex*v3)typedefvoidSoLineSegmentCB(void*userData,SoCallbackAction*action,constSoPrimitiveVertex*v1,constSoPrimitiveVertex*v2)typedefvoidSoPointCB(void*userData,SoCallbackAction*action,constSoPrimitiveVertex*v)typedefSoCallbackAction::ResponseSoCallbackActionCB(void*userData,SoCallbackAction*action,constSoNode*node)enumResponse{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()voidaddPreCallback(SoTypetype,SoCallbackActionCB*cb,void*data)voidaddPostCallback(SoTypetype,SoCallbackActionCB*cb,void*data)voidaddPreTailCallback(SoCallbackActionCB*cb,void*data)voidaddPostTailCallback(SoCallbackActionCB*cb,void*data)voidaddTriangleCallback(SoTypetype,SoTriangleCB*cb,void*data)voidaddLineSegmentCallback(SoTypetype,SoLineSegmentCB*cb,void*data)voidaddPointCallback(SoTypetype,SoPointCB*cb,void*data)floatgetComplexity()constSoComplexity::TypegetComplexityType()constint32_tgetNumCoordinates()constconstSbVec3f&getCoordinate3(intindex)constconstSbVec4f&getCoordinate4(intindex)constSoDrawStyle::StylegetDrawStyle()constunsignedshortgetLinePattern()constfloatgetLineWidth()constfloatgetPointSize()constconstSbName&getFontName()constfloatgetFontSize()constSoLightModel::ModelgetLightModel()constconstSbVec3f&getLightAttenuation()constvoidgetMaterial(SbColor&ambient,SbColor&diffuse,SbColor&specular,SbColor&emission,float&shininess,float&transparency,intmtlIndex=0)constSoMaterialBinding::BindinggetMaterialBinding()constlonggetNumNormals()constconstSbVec3f&getNormal(intindex)constSoNormalBinding::BindinggetNormalBinding()constint32_tgetNumProfileCoordinates()constconstSbVec2f&getProfileCoordinate2(intindex)constconstSbVec3f&getProfileCoordinate3(intindex)constconstSoNodeList&getProfile()constSoShapeHints::VertexOrderinggetVertexOrdering()constSoShapeHints::ShapeTypegetShapeType()constSoShapeHints::FaceTypegetFaceType()constfloatgetCreaseAngle()constint32_tgetNumTextureCoordinates()constconstSbVec2f&getTextureCoordinate2(intindex)constconstSbVec4f&getTextureCoordinate4(intindex)constSoTextureCoordinateBinding::BindinggetTextureCoordinateBinding()constconstSbColor&getTextureBlendColor()constconstunsignedchar*getTextureImage(SbVec2s&size,int&numComps)constconstSbMatrix&getTextureMatrix()constSoTexture2::ModelgetTextureModel()constSoTexture2::WrapgetTextureWrapS()constSoTexture2::WrapgetTextureWrapT()constconstSbMatrix&getModelMatrix()constSoUnits::UnitsgetUnits()constfloatgetFocalDistance()constconstSbMatrix&getProjectionMatrix()constconstSbMatrix&getViewingMatrix()constconstSbViewVolume&getViewVolume()constSoPickStyle::StylegetPickStyle()constint32_tgetSwitch()const
Methods from class SoAction:
virtualvoidapply(SoNode*node)virtualvoidapply(SoPath*path)virtualvoidapply(constSoPathList&pathList,SbBoolobeysRules=FALSE)staticSoTypegetClassTypeId()virtualSoTypegetTypeId()virtualSbBoolisOfType(SoTypetype)virtualvoidinvalidateState()