Coin
4.0.3
Coin3D core library
|
The SoCallbackAction class invokes callbacks at specific nodes. More...
#include <Inventor/actions/SoCallbackAction.h>
Public Types | |
enum | Response { CONTINUE , ABORT , PRUNE } |
typedef Response | SoCallbackActionCB(void *userdata, SoCallbackAction *action, const SoNode *node) |
Public Types inherited from SoAction | |
enum | AppliedCode { NODE = 0 , PATH = 1 , PATH_LIST = 2 } |
enum | PathCode { NO_PATH = 0 , IN_PATH = 1 , BELOW_PATH = 2 , OFF_PATH = 3 } |
Static Public Member Functions | |
static void | addMethod (const SoType type, SoActionMethod method) |
static void | enableElement (const SoType type, const int stackindex) |
static SoType | getClassTypeId (void) |
static void | initClass (void) |
Static Public Member Functions inherited from SoAction | |
static SoType | getClassTypeId (void) |
static void | initClass (void) |
static void | initClasses (void) |
static void | nullAction (SoAction *action, SoNode *node) |
Protected Member Functions | |
virtual void | beginTraversal (SoNode *node) |
virtual const SoEnabledElementsList & | getEnabledElements (void) const |
Protected Member Functions inherited from SoAction | |
SoAction (void) | |
virtual void | endTraversal (SoNode *node) |
void | setTerminated (const SbBool flag) |
virtual SbBool | shouldCompactPathList (void) const |
Static Protected Member Functions | |
static SoActionMethodList * | getClassActionMethods (void) |
static SoEnabledElementsList * | getClassEnabledElements (void) |
Static Protected Member Functions inherited from SoAction | |
static SoActionMethodList * | getClassActionMethods (void) |
static SoEnabledElementsList * | getClassEnabledElements (void) |
Additional Inherited Members | |
Protected Attributes inherited from SoAction | |
SoState * | state |
SoActionMethodList * | traversalMethods |
The SoCallbackAction class invokes callbacks at specific nodes.
This action has mechanisms for tracking traversal position and traversal state. In combination with the ability to pass geometry primitives to callback actions set by the user, this does for instance make it rather straightforward to extract the geometry of a scene graph.
You should be able to use this action for most of your "simple" traversal needs, instead of cooking up your own code, as the SoCallbackAction is rather flexible.
A common use of this action is to extract geometry of non-primitive shapes as triangles. A full-fledged example that demonstrates this on a scene graph with two spheres follows:
Response SoCallbackAction::SoCallbackActionCB |
Callback functions need to be of this type. node is at the current traversal point in the scene graph.
Response values for callback function.
SoCallbackAction::SoCallbackAction | ( | void | ) |
Default constructor. Will set the viewport to a standard viewport with size 640x512.
SoCallbackAction::SoCallbackAction | ( | const SbViewportRegion & | vp | ) |
Constructor which lets you specify the viewport.
This constructor is an extension versus the Open Inventor API.
|
virtual |
Destructor.
void SoCallbackAction::addLineSegmentCallback | ( | const SoType | type, |
SoLineSegmentCB * | cb, | ||
void * | userdata ) |
Set a function cb to call when traversing a node of type which generates line primitives for rendering. cb will be called with userdata.
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Set a function cb to call when traversing a node of type which generates single point primitives for rendering. cb will be called with userdata.
void SoCallbackAction::addPostCallback | ( | const SoType | type, |
SoCallbackActionCB * | cb, | ||
void * | userdata ) |
Set a function cb to call after every node of type has been traversed. cb will be called with userdata.
void SoCallbackAction::addPostTailCallback | ( | SoCallbackActionCB * | cb, |
void * | userdata ) |
Set a function cb to call after the tail of a path has been traversed. cb will be called with userdata.
void SoCallbackAction::addPreCallback | ( | const SoType | type, |
SoCallbackActionCB * | cb, | ||
void * | userdata ) |
Set a function cb to call before every node of type is traversed. cb will be called with userdata.
void SoCallbackAction::addPreTailCallback | ( | SoCallbackActionCB * | cb, |
void * | userdata ) |
Set a function cb to call before the tail of a path is traversed. cb will be called with userdata.
void SoCallbackAction::addTriangleCallback | ( | const SoType | type, |
SoTriangleCB * | cb, | ||
void * | userdata ) |
Set a function cb to call when traversing a node of type which generates triangle primitives for rendering. cb will be called with userdata.
This virtual method is called from SoAction::apply(), and is the entry point for the actual scene graph traversal.
It can be overridden to initialize the action at traversal start, for specific initializations in the action subclasses inheriting SoAction.
Default method just calls traverse(), which any overridden implementation of the method must do too (or call SoAction::beginTraversal()) to trigger the scene graph traversal.
Reimplemented from SoAction.
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
|
staticprotected |
Returns list of action methods for this class. The enabledElements and methods variables are protected in the original OIV API. This is not such a good idea, since exposed static class member variables is a major grievance with regard to Win32 DLLs. This function is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API.
|
staticprotected |
Returns list of enabled elements for this class. The enabledElements and methods variables are protected in the original OIV API. This is not such a good idea, since exposed static class member variables is a major grievance with regard to Win32 DLLs. This function is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API.
This static method returns the SoType object associated with objects of this class.
float SoCallbackAction::getComplexity | ( | void | ) | const |
Returns current complexity setting.
SoComplexity::Type SoCallbackAction::getComplexityType | ( | void | ) | const |
Returns current complexity type setting.
Returns a coordinate triplet from the current state pool of coordinates.
Returns a coordinate quadruplet from the current state pool of coordinates.
float SoCallbackAction::getCreaseAngle | ( | void | ) | const |
Returns current crease angle setting. Please note that this is the crease angle value set by the SoShapeHints node. If you want to find the crease angle for VRML nodes you'll need to read this directly from the creaseAngle field in those nodes.
Returns the current tail of the traversal path for the callback action.
Reimplemented from SoAction.
SoCallbackAction::Response SoCallbackAction::getCurrentResponse | ( | void | ) | const |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
float SoCallbackAction::getDecimationPercentage | ( | void | ) | const |
Returns current decimation percentage setting.
SoDecimationTypeElement::Type SoCallbackAction::getDecimationType | ( | void | ) | const |
Returns current decimation type setting.
SoDrawStyle::Style SoCallbackAction::getDrawStyle | ( | void | ) | const |
Returns current draw style setting.
|
protectedvirtual |
Returns list of enabled elements.
Reimplemented from SoAction.
Reimplemented in SoVectorizeAction, and SoVectorizePSAction.
SoShapeHints::FaceType SoCallbackAction::getFaceType | ( | void | ) | const |
Returns current face type hint setting.
Please note that this is the face type set by the SoShapeHints node. If you want to find the face type for VRML nodes you'll need to read this directly from the convex field in those nodes.
float SoCallbackAction::getFocalDistance | ( | void | ) | const |
Returns current camera focal distance setting.
float SoCallbackAction::getFontSize | ( | void | ) | const |
Returns current font size setting.
Returns current light attenuation setting.
SoLightModel::Model SoCallbackAction::getLightModel | ( | void | ) | const |
Returns current light model setting.
Returns current line pattern setting.
float SoCallbackAction::getLineWidth | ( | void | ) | const |
Returns current line width setting.
void SoCallbackAction::getMaterial | ( | SbColor & | ambient, |
SbColor & | diffuse, | ||
SbColor & | specular, | ||
SbColor & | emission, | ||
float & | shininess, | ||
float & | transparency, | ||
const int | index = 0 ) const |
Returns current material settings.
SoMaterialBinding::Binding SoCallbackAction::getMaterialBinding | ( | void | ) | const |
Returns current material binding setting.
Returns the normal vectors at index from the current state.
SoNormalBinding::Binding SoCallbackAction::getNormalBinding | ( | void | ) | const |
Returns current normal binding setting.
int32_t SoCallbackAction::getNumCoordinates | ( | void | ) | const |
Returns current number of coordinates in the state.
uint32_t SoCallbackAction::getNumNormals | ( | void | ) | const |
Returns current number of normals in the state.
int32_t SoCallbackAction::getNumProfileCoordinates | ( | void | ) | const |
Returns current number of profile coordinates in the state.
int32_t SoCallbackAction::getNumTextureCoordinates | ( | void | ) | const |
Returns current number of texture coordinates in the traversal state.
SoPickStyle::Style SoCallbackAction::getPickStyle | ( | void | ) | const |
Returns current pick style setting.
float SoCallbackAction::getPointSize | ( | void | ) | const |
Returns current point size setting.
const SoNodeList & SoCallbackAction::getProfile | ( | void | ) | const |
Returns current list of profile nodes.
Returns current number of SbVec2f profile coordinates in the state.
Returns current number of SbVec3f profile coordinates in the state.
Returns current projection matrix.
SoShapeHints::ShapeType SoCallbackAction::getShapeType | ( | void | ) | const |
Returns current shape type hint setting.
Please note that this is the shape type set by the SoShapeHints node. If you want to find the shape type for VRML nodes you'll need to read this directly from the solid field in those nodes.
int32_t SoCallbackAction::getSwitch | ( | void | ) | const |
Returns last SoSwitch::whichChild setting during the traversal.
Returns current texture blend color setting.
Returns SbVec2f texture coordinate at index from the texture coordinate pool of the traversal state.
Returns SbVec4f texture coordinate at index from the texture coordinate pool of the traversal state.
SoTextureCoordinateBinding::Binding SoCallbackAction::getTextureCoordinateBinding | ( | void | ) | const |
Returns current texture coordinate binding setting.
Returns current texture image settings.
Returns current texture transformation matrix setting.
SoTexture2::Model SoCallbackAction::getTextureModel | ( | void | ) | const |
Returns current texture mapping model setting.
SoTexture2::Wrap SoCallbackAction::getTextureWrapR | ( | void | ) | const |
SoTexture2::Wrap SoCallbackAction::getTextureWrapS | ( | void | ) | const |
Returns current texture wrapping setting for the S
coordinate.
SoTexture2::Wrap SoCallbackAction::getTextureWrapT | ( | void | ) | const |
Returns current texture wrapping setting for the T
coordinate.
Returns the type identification of an object derived from a class inheriting SoAction. This is used for runtime type checking and "downward" casting.
Implements SoAction.
Reimplemented in SoVectorizeAction, and SoVectorizePSAction.
SoUnits::Units SoCallbackAction::getUnits | ( | void | ) | const |
Returns current units setting.
SoShapeHints::VertexOrdering SoCallbackAction::getVertexOrdering | ( | void | ) | const |
Returns current vertex ordering shape hint setting.
Please note that this is the vertex ordering set by the SoShapeHints node. If you want to find the vertex ordering for VRML nodes you'll need to read this directly from the ccw field in those nodes.
const SbViewportRegion & SoCallbackAction::getViewportRegion | ( | void | ) | const |
Returns current viewport region setting.
This method is an extension versus the Open Inventor API.
const SbViewVolume & SoCallbackAction::getViewVolume | ( | void | ) | const |
Returns current view volume setting.
Initializes the runtime type system for this class, and sets up the enabled elements and action method list.
void SoCallbackAction::invokeLineSegmentCallbacks | ( | const SoShape *const | shape, |
const SoPrimitiveVertex *const | v1, | ||
const SoPrimitiveVertex *const | v2 ) |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Invoke all "line segment generation" callbacks.
void SoCallbackAction::invokePointCallbacks | ( | const SoShape *const | shape, |
const SoPrimitiveVertex *const | v ) |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Invoke all "point" callbacks.
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Invoke all "post traversal" callbacks.
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Invoke all "pre traversal" callbacks.
void SoCallbackAction::invokeTriangleCallbacks | ( | const SoShape *const | shape, |
const SoPrimitiveVertex *const | v1, | ||
const SoPrimitiveVertex *const | v2, | ||
const SoPrimitiveVertex *const | v3 ) |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Invoke all "triangle generation" callbacks.
Used from nodes during traversal to keep a current node pointer in the action.
void SoCallbackAction::setViewportRegion | ( | const SbViewportRegion & | vp | ) |
Sets the viewport region for this action. When set, the viewport element is initialized right before a traversal starts, making it the current viewport.
This method is an extension versus the Open Inventor API.
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Check from the shape nodes whether or not to generate primitives from the complex shapes. If there are no callbacks attached to the node types, making the primitives would only be a waste of CPU.