Coin: SoCallbackAction.h Source File

| Coin3D is Free Software, published under the BSD 3-clause license. | https://coin3d.github.io https://www.kongsberg.com/en/kogt/

SoCallbackAction.h
1#ifndef COIN_SOCALLBACKACTION_H
2#define COIN_SOCALLBACKACTION_H
3
4/**************************************************************************\
5 * Copyright (c) Kongsberg Oil & Gas Technologies AS
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 *
12 * Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * Neither the name of the copyright holder nor the names of its
20 * contributors may be used to endorse or promote products derived from
21 * this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34\**************************************************************************/
35
36// FIXME: Support getTextureFilename[s]() ? (kintel 20011205)
37
38#include <Inventor/actions/SoAction.h>
39#include <Inventor/actions/SoSubAction.h>
40#include <Inventor/elements/SoDecimationTypeElement.h>
41#include <Inventor/lists/SbList.h>
42#include <Inventor/nodes/SoComplexity.h>
43#include <Inventor/nodes/SoDrawStyle.h>
44#include <Inventor/nodes/SoLightModel.h>
45#include <Inventor/nodes/SoMaterialBinding.h>
46#include <Inventor/nodes/SoNormalBinding.h>
47#include <Inventor/nodes/SoPickStyle.h>
48#include <Inventor/nodes/SoShapeHints.h>
49#include <Inventor/nodes/SoTexture2.h>
50#include <Inventor/nodes/SoTextureCoordinateBinding.h>
51#include <Inventor/nodes/SoUnits.h>
52
53class SbColor;
54class SbMatrix;
55class SbVec2f;
56class SbVec2s;
57class SbVec3f;
58class SbVec4f;
59class SbViewVolume;
60class SoCallbackAction;
61class SoCallbackActionP;
62class SoCallbackData;
63class SoPrimitiveVertex;
64class SoShape;
65class SbViewportRegion;
66
67typedef void SoTriangleCB(void * userdata, SoCallbackAction * action,
68 const SoPrimitiveVertex * v1,
69 const SoPrimitiveVertex * v2,
70 const SoPrimitiveVertex * v3);
71
72typedef void SoLineSegmentCB(void * userdata, SoCallbackAction * action,
73 const SoPrimitiveVertex * v1,
74 const SoPrimitiveVertex * v2);
75
76typedef void SoPointCB(void * userdata, SoCallbackAction * action,
77 const SoPrimitiveVertex * v);
78
79
80 class COIN_DLL_API SoCallbackAction : public SoAction {
81 typedef SoAction inherited;
82
83 SO_ACTION_HEADER(SoCallbackAction);
84
85public:
86 static void initClass(void);
87
88 SoCallbackAction(void);
89 SoCallbackAction(const SbViewportRegion & vp);
90 virtual ~SoCallbackAction(void);
91
92 void setViewportRegion(const SbViewportRegion & vp);
93
94 enum Response { CONTINUE, ABORT, PRUNE };
95
96 typedef Response SoCallbackActionCB(void * userdata,
97 SoCallbackAction * action,
98 const SoNode * node);
99
100 void addPreCallback(const SoType type, SoCallbackActionCB * cb, void * userdata);
101 void addPostCallback(const SoType type, SoCallbackActionCB * cb, void * userdata);
102
103 void addPreTailCallback(SoCallbackActionCB * cb, void * userdata);
104 void addPostTailCallback(SoCallbackActionCB * cb, void * userdata);
105
106 void addTriangleCallback(const SoType type, SoTriangleCB * cb, void * userdata);
107 void addLineSegmentCallback(const SoType type, SoLineSegmentCB * cb, void * userdata);
108 void addPointCallback(const SoType type, SoPointCB * cb, void * userdata);
109
110 SoDecimationTypeElement::Type getDecimationType(void) const;
111 float getDecimationPercentage(void) const;
112 float getComplexity(void) const;
113 SoComplexity::Type getComplexityType(void) const;
114 int32_t getNumCoordinates(void) const;
115 const SbVec3f & getCoordinate3(const int index) const;
116 const SbVec4f & getCoordinate4(const int index) const;
117 SoDrawStyle::Style getDrawStyle(void) const;
118 unsigned short getLinePattern(void) const;
119 float getLineWidth(void) const;
120 float getPointSize(void) const;
121 const SbName & getFontName(void) const;
122 float getFontSize(void) const;
123 SoLightModel::Model getLightModel(void) const;
124 const SbVec3f & getLightAttenuation(void) const;
125 void getMaterial(SbColor & ambient, SbColor & diffuse,
126 SbColor & specular, SbColor & emission,
127 float & shininess, float & transparency,
128 const int index = 0) const;
129 SoMaterialBinding::Binding getMaterialBinding(void) const;
130 uint32_t getNumNormals(void) const;
131 const SbVec3f & getNormal(const int index) const;
132 SoNormalBinding::Binding getNormalBinding(void) const;
133 int32_t getNumProfileCoordinates(void) const;
134 const SbVec2f & getProfileCoordinate2(const int index) const;
135 const SbVec3f & getProfileCoordinate3(const int index) const;
136 const SoNodeList & getProfile(void) const;
137 SoShapeHints::VertexOrdering getVertexOrdering(void) const;
138 SoShapeHints::ShapeType getShapeType(void) const;
139 SoShapeHints::FaceType getFaceType(void) const;
140 float getCreaseAngle(void) const;
141 int32_t getNumTextureCoordinates(void) const;
142 const SbVec2f & getTextureCoordinate2(const int index) const;
143 const SbVec3f & getTextureCoordinate3(const int index) const;
144 const SbVec4f & getTextureCoordinate4(const int index) const;
145 SoTextureCoordinateBinding::Binding getTextureCoordinateBinding(void) const;
146 const SbColor & getTextureBlendColor(void) const;
147 const unsigned char * getTextureImage(SbVec2s & size, int & numcomps) const;
148 const unsigned char * getTextureImage(SbVec3s & size, int & numcomps) const;
149 const SbMatrix & getTextureMatrix(void) const;
150 SoTexture2::Model getTextureModel(void) const;
151 SoTexture2::Wrap getTextureWrapS(void) const;
152 SoTexture2::Wrap getTextureWrapT(void) const;
153 SoTexture2::Wrap getTextureWrapR(void) const;
154 const SbMatrix & getModelMatrix(void) const;
155 SoUnits::Units getUnits(void) const;
156 float getFocalDistance(void) const;
157 const SbMatrix & getProjectionMatrix(void) const;
158 const SbMatrix & getViewingMatrix(void) const;
159 const SbViewVolume & getViewVolume(void) const;
160 const SbViewportRegion & getViewportRegion(void) const;
161 SoPickStyle::Style getPickStyle(void) const;
162 int32_t getSwitch(void) const;
163
164 Response getCurrentResponse(void) const;
165 void invokePreCallbacks(const SoNode * const node);
166 void invokePostCallbacks(const SoNode * const node);
167 void invokeTriangleCallbacks(const SoShape * const shape,
168 const SoPrimitiveVertex * const v1,
169 const SoPrimitiveVertex * const v2,
170 const SoPrimitiveVertex * const v3);
171 void invokeLineSegmentCallbacks(const SoShape * const shape,
172 const SoPrimitiveVertex * const v1,
173 const SoPrimitiveVertex * const v2);
174 void invokePointCallbacks(const SoShape * const shape,
175 const SoPrimitiveVertex * const v);
176
177 SbBool shouldGeneratePrimitives(const SoShape * shape) const;
178
179 virtual SoNode * getCurPathTail(void);
180 void setCurrentNode(SoNode * const node);
181
182 void setCallbackAll(SbBool callbackall);
183 SbBool isCallbackAll(void) const;
184
185protected:
186 virtual void beginTraversal(SoNode * node);
187
188private:
189 void commonConstructor(void);
190
191private:
192 SbPimplPtr<SoCallbackActionP> pimpl;
193 friend class SoCallbackActionP;
194
195 SoCallbackAction(const SoCallbackAction & rhs);
196 SoCallbackAction & operator = (const SoCallbackAction & rhs);
197}; // SoCallbackAction
198
199#endif // !COIN_SOCALLBACKACTION_H
SbColor
The SbColor class contains the red, green and blue components which make up a color value.
Definition SbColor.h:39
SbMatrix
The SbMatrix class is a 4x4 dimensional representation of a matrix.
Definition SbMatrix.h:47
SbName
The SbName class stores strings by reference.
Definition SbName.h:40
SbPimplPtr
Definition SbPimplPtr.h:55
SbVec2f
The SbVec2f class is a 2 dimensional vector with floating point coordinates.
Definition SbVec2f.h:49
SbVec2s
The SbVec2s class is a 2 dimensional vector with short integer coordinates.
Definition SbVec2s.h:51
SbVec3f
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition SbVec3f.h:51
SbVec3s
The SbVec3s class is a 3 dimensional vector with short integer coordinates.
Definition SbVec3s.h:51
SbVec4f
The SbVec4f class is a 4 dimensional vector with floating point coordinates.
Definition SbVec4f.h:49
SbViewVolume
The SbViewVolume class is a viewing volume in 3D space.
Definition SbViewVolume.h:50
SbViewportRegion
The SbViewportRegion class is a viewport within a full window.
Definition SbViewportRegion.h:40
SoAction::getCurPathTail
virtual SoNode * getCurPathTail(void)
Definition SoAction.cpp:1117
SoAction::initClass
static void initClass(void)
Definition SoAction.cpp:370
SoAction::SoAction
SoAction(void)
Definition SoAction.cpp:337
SoAction::beginTraversal
virtual void beginTraversal(SoNode *node)
Definition SoAction.cpp:1269
SoCallbackAction
The SoCallbackAction class invokes callbacks at specific nodes.
Definition SoCallbackAction.h:80
SoCallbackAction::getTextureCoordinate3
const SbVec3f & getTextureCoordinate3(const int index) const
Definition SoCallbackAction.cpp:926
SoCallbackAction::getTextureWrapT
SoTexture2::Wrap getTextureWrapT(void) const
Definition SoCallbackAction.cpp:1014
SoCallbackAction::Response
Response
Definition SoCallbackAction.h:94
SoCallbackAction::PRUNE
@ PRUNE
Definition SoCallbackAction.h:94
SoCallbackAction::CONTINUE
@ CONTINUE
Definition SoCallbackAction.h:94
SoCallbackAction::ABORT
@ ABORT
Definition SoCallbackAction.h:94
SoCallbackAction::getVertexOrdering
SoShapeHints::VertexOrdering getVertexOrdering(void) const
Definition SoCallbackAction.cpp:845
SoCallbackAction::setViewportRegion
void setViewportRegion(const SbViewportRegion &vp)
Definition SoCallbackAction.cpp:455
SoCallbackAction::getNumTextureCoordinates
int32_t getNumTextureCoordinates(void) const
Definition SoCallbackAction.cpp:902
SoCallbackAction::getViewingMatrix
const SbMatrix & getViewingMatrix(void) const
Definition SoCallbackAction.cpp:1072
SoCallbackAction::getProfileCoordinate3
const SbVec3f & getProfileCoordinate3(const int index) const
Definition SoCallbackAction.cpp:822
SoCallbackAction::getFontSize
float getFontSize(void) const
Definition SoCallbackAction.cpp:719
SoCallbackAction::getTextureMatrix
const SbMatrix & getTextureMatrix(void) const
Definition SoCallbackAction.cpp:987
SoCallbackAction::getNormalBinding
SoNormalBinding::Binding getNormalBinding(void) const
Definition SoCallbackAction.cpp:793
SoCallbackAction::getComplexityType
SoComplexity::Type getComplexityType(void) const
Definition SoCallbackAction.cpp:636
SoCallbackAction::getPointSize
float getPointSize(void) const
Definition SoCallbackAction.cpp:701
SoCallbackAction::SoCallbackActionCB
Response SoCallbackActionCB(void *userdata, SoCallbackAction *action, const SoNode *node)
Definition SoCallbackAction.h:96
SoCallbackAction::getTextureBlendColor
const SbColor & getTextureBlendColor(void) const
Definition SoCallbackAction.cpp:956
SoCallbackAction::getFocalDistance
float getFocalDistance(void) const
Definition SoCallbackAction.cpp:1054
SoCallbackAction::invokePostCallbacks
void invokePostCallbacks(const SoNode *const node)
Definition SoCallbackAction.cpp:1165
SoCallbackAction::getTextureCoordinate4
const SbVec4f & getTextureCoordinate4(const int index) const
Definition SoCallbackAction.cpp:936
SoCallbackAction::getCreaseAngle
float getCreaseAngle(void) const
Definition SoCallbackAction.cpp:892
SoCallbackAction::getProfileCoordinate2
const SbVec2f & getProfileCoordinate2(const int index) const
Definition SoCallbackAction.cpp:813
SoCallbackAction::getFaceType
SoShapeHints::FaceType getFaceType(void) const
Definition SoCallbackAction.cpp:878
SoCallbackAction::getNumProfileCoordinates
int32_t getNumProfileCoordinates(void) const
Definition SoCallbackAction.cpp:804
SoCallbackAction::addTriangleCallback
void addTriangleCallback(const SoType type, SoTriangleCB *cb, void *userdata)
Definition SoCallbackAction.cpp:573
SoCallbackAction::getNumCoordinates
int32_t getNumCoordinates(void) const
Definition SoCallbackAction.cpp:645
SoCallbackAction::getCoordinate4
const SbVec4f & getCoordinate4(const int index) const
Definition SoCallbackAction.cpp:665
SoCallbackAction::getPickStyle
SoPickStyle::Style getPickStyle(void) const
Definition SoCallbackAction.cpp:1101
SoCallbackAction::getUnits
SoUnits::Units getUnits(void) const
Definition SoCallbackAction.cpp:1045
SoCallbackAction::getNormal
const SbVec3f & getNormal(const int index) const
Definition SoCallbackAction.cpp:784
SoCallbackAction::getTextureCoordinateBinding
SoTextureCoordinateBinding::Binding getTextureCoordinateBinding(void) const
Definition SoCallbackAction.cpp:945
SoCallbackAction::getLinePattern
unsigned short getLinePattern(void) const
Definition SoCallbackAction.cpp:683
SoCallbackAction::getProjectionMatrix
const SbMatrix & getProjectionMatrix(void) const
Definition SoCallbackAction.cpp:1063
SoCallbackAction::getFontName
const SbName & getFontName(void) const
Definition SoCallbackAction.cpp:710
SoCallbackAction::getLineWidth
float getLineWidth(void) const
Definition SoCallbackAction.cpp:692
SoCallbackAction::getMaterialBinding
SoMaterialBinding::Binding getMaterialBinding(void) const
Definition SoCallbackAction.cpp:764
SoCallbackAction::getDrawStyle
SoDrawStyle::Style getDrawStyle(void) const
Definition SoCallbackAction.cpp:674
SoCallbackAction::getTextureWrapR
SoTexture2::Wrap getTextureWrapR(void) const
Definition SoCallbackAction.cpp:1027
SoCallbackAction::addPreTailCallback
void addPreTailCallback(SoCallbackActionCB *cb, void *userdata)
Definition SoCallbackAction.cpp:546
SoCallbackAction::getTextureWrapS
SoTexture2::Wrap getTextureWrapS(void) const
Definition SoCallbackAction.cpp:1005
SoCallbackAction::getTextureCoordinate2
const SbVec2f & getTextureCoordinate2(const int index) const
Definition SoCallbackAction.cpp:912
SoCallbackAction::setCurrentNode
void setCurrentNode(SoNode *const node)
Definition SoCallbackAction.cpp:1271
SoCallbackAction::getShapeType
SoShapeHints::ShapeType getShapeType(void) const
Definition SoCallbackAction.cpp:861
SoCallbackAction::getTextureModel
SoTexture2::Model getTextureModel(void) const
Definition SoCallbackAction.cpp:996
SoCallbackAction::getViewportRegion
const SbViewportRegion & getViewportRegion(void) const
Definition SoCallbackAction.cpp:1092
SoCallbackAction::addPointCallback
void addPointCallback(const SoType type, SoPointCB *cb, void *userdata)
Definition SoCallbackAction.cpp:597
SoCallbackAction::shouldGeneratePrimitives
SbBool shouldGeneratePrimitives(const SoShape *shape) const
Definition SoCallbackAction.cpp:1244
SoCallbackAction::getSwitch
int32_t getSwitch(void) const
Definition SoCallbackAction.cpp:1110
SoCallbackAction::addPreCallback
void addPreCallback(const SoType type, SoCallbackActionCB *cb, void *userdata)
Definition SoCallbackAction.cpp:524
SoCallbackAction::getDecimationPercentage
float getDecimationPercentage(void) const
Definition SoCallbackAction.cpp:618
SoCallbackAction::getCurrentResponse
Response getCurrentResponse(void) const
Definition SoCallbackAction.cpp:1121
SoCallbackAction::getLightModel
SoLightModel::Model getLightModel(void) const
Definition SoCallbackAction.cpp:728
SoCallbackAction::getProfile
const SoNodeList & getProfile(void) const
Definition SoCallbackAction.cpp:831
SoCallbackAction::invokeLineSegmentCallbacks
void invokeLineSegmentCallbacks(const SoShape *const shape, const SoPrimitiveVertex *const v1, const SoPrimitiveVertex *const v2)
Definition SoCallbackAction.cpp:1213
SoCallbackAction::invokeTriangleCallbacks
void invokeTriangleCallbacks(const SoShape *const shape, const SoPrimitiveVertex *const v1, const SoPrimitiveVertex *const v2, const SoPrimitiveVertex *const v3)
Definition SoCallbackAction.cpp:1197
SoCallbackAction::getModelMatrix
const SbMatrix & getModelMatrix(void) const
Definition SoCallbackAction.cpp:1036
SoCallbackAction::getViewVolume
const SbViewVolume & getViewVolume(void) const
Definition SoCallbackAction.cpp:1081
SoCallbackAction::SoCallbackAction
SoCallbackAction(void)
Definition SoCallbackAction.cpp:419
SoCallbackAction::getDecimationType
SoDecimationTypeElement::Type getDecimationType(void) const
Definition SoCallbackAction.cpp:609
SoCallbackAction::addPostCallback
void addPostCallback(const SoType type, SoCallbackActionCB *cb, void *userdata)
Definition SoCallbackAction.cpp:535
SoCallbackAction::invokePreCallbacks
void invokePreCallbacks(const SoNode *const node)
Definition SoCallbackAction.cpp:1132
SoCallbackAction::addLineSegmentCallback
void addLineSegmentCallback(const SoType type, SoLineSegmentCB *cb, void *userdata)
Definition SoCallbackAction.cpp:585
SoCallbackAction::addPostTailCallback
void addPostTailCallback(SoCallbackActionCB *cb, void *userdata)
Definition SoCallbackAction.cpp:559
SoCallbackAction::getMaterial
void getMaterial(SbColor &ambient, SbColor &diffuse, SbColor &specular, SbColor &emission, float &shininess, float &transparency, const int index=0) const
Definition SoCallbackAction.cpp:747
SoCallbackAction::getNumNormals
uint32_t getNumNormals(void) const
Definition SoCallbackAction.cpp:775
SoCallbackAction::getComplexity
float getComplexity(void) const
Definition SoCallbackAction.cpp:627
SoCallbackAction::getLightAttenuation
const SbVec3f & getLightAttenuation(void) const
Definition SoCallbackAction.cpp:737
SoCallbackAction::getTextureImage
const unsigned char * getTextureImage(SbVec2s &size, int &numcomps) const
Definition SoCallbackAction.cpp:965
SoCallbackAction::getCoordinate3
const SbVec3f & getCoordinate3(const int index) const
Definition SoCallbackAction.cpp:655
SoCallbackAction::invokePointCallbacks
void invokePointCallbacks(const SoShape *const shape, const SoPrimitiveVertex *const v)
Definition SoCallbackAction.cpp:1228
SoComplexity::Type
Type
Definition SoComplexity.h:50
SoDecimationTypeElement::Type
Type
Definition SoDecimationTypeElement.h:48
SoDrawStyle::Style
Style
Definition SoDrawStyle.h:52
SoLightModel::Model
Model
Definition SoLightModel.h:49
SoMaterialBinding::Binding
Binding
Definition SoMaterialBinding.h:49
SoNodeList
The SoNodeList class is a container for pointers to SoNode objects.
Definition SoNodeList.h:40
SoNode
The SoNode class is the base class for nodes used in scene graphs.
Definition SoNode.h:56
SoNormalBinding::Binding
Binding
Definition SoNormalBinding.h:49
SoPickStyle::Style
Style
Definition SoPickStyle.h:49
SoPrimitiveVertex
The SoPrimitiveVertex class represents a single vertex of a generated primitive.
Definition SoPrimitiveVertex.h:43
SoShapeHints::FaceType
FaceType
Definition SoShapeHints.h:62
SoShapeHints::VertexOrdering
VertexOrdering
Definition SoShapeHints.h:51
SoShapeHints::ShapeType
ShapeType
Definition SoShapeHints.h:57
SoShape
The SoShape class is the superclass for geometry shapes.
Definition SoShape.h:52
SoTexture2::Wrap
Wrap
Definition SoTexture2.h:65
SoTexture2::Model
Model
Definition SoTexture2.h:58
SoTextureCoordinateBinding::Binding
Binding
Definition SoTextureCoordinateBinding.h:49
SoType
The SoType class is the basis for the runtime type system in Coin.
Definition SoType.h:59
SoUnits::Units
Units
Definition SoUnits.h:51