Coin  4.0.3
Coin3D core library
Loading...
Searching...
No Matches
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;
61class SoCallbackActionP;
62class SoCallbackData;
64class SoShape;
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
80class 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);
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:
193 friend class SoCallbackActionP;
194
196 SoCallbackAction & operator = (const SoCallbackAction & rhs);
197}; // SoCallbackAction
198
199#endif // !COIN_SOCALLBACKACTION_H
The SbColor class contains the red, green and blue components which make up a color value.
Definition SbColor.h:39
The SbMatrix class is a 4x4 dimensional representation of a matrix.
Definition SbMatrix.h:47
The SbName class stores strings by reference.
Definition SbName.h:40
Definition SbPimplPtr.h:55
The SbVec2f class is a 2 dimensional vector with floating point coordinates.
Definition SbVec2f.h:49
The SbVec2s class is a 2 dimensional vector with short integer coordinates.
Definition SbVec2s.h:51
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition SbVec3f.h:51
The SbVec3s class is a 3 dimensional vector with short integer coordinates.
Definition SbVec3s.h:51
The SbVec4f class is a 4 dimensional vector with floating point coordinates.
Definition SbVec4f.h:49
The SbViewVolume class is a viewing volume in 3D space.
Definition SbViewVolume.h:50
The SbViewportRegion class is a viewport within a full window.
Definition SbViewportRegion.h:40
The SoAction class is the base class for all traversal actions.
Definition SoAction.h:77
virtual SoNode * getCurPathTail(void)
Definition SoAction.cpp:1117
static void initClass(void)
Definition SoAction.cpp:370
virtual void beginTraversal(SoNode *node)
Definition SoAction.cpp:1269
The SoCallbackAction class invokes callbacks at specific nodes.
Definition SoCallbackAction.h:80
Response
Definition SoCallbackAction.h:94
@ ABORT
Definition SoCallbackAction.h:94
Response SoCallbackActionCB(void *userdata, SoCallbackAction *action, const SoNode *node)
Definition SoCallbackAction.h:96
Type
Definition SoComplexity.h:50
Type
Definition SoDecimationTypeElement.h:48
Style
Definition SoDrawStyle.h:52
Model
Definition SoLightModel.h:49
Binding
Definition SoMaterialBinding.h:49
The SoNodeList class is a container for pointers to SoNode objects.
Definition SoNodeList.h:40
The SoNode class is the base class for nodes used in scene graphs.
Definition SoNode.h:56
Binding
Definition SoNormalBinding.h:49
Style
Definition SoPickStyle.h:49
The SoPrimitiveVertex class represents a single vertex of a generated primitive.
Definition SoPrimitiveVertex.h:43
FaceType
Definition SoShapeHints.h:62
VertexOrdering
Definition SoShapeHints.h:51
ShapeType
Definition SoShapeHints.h:57
The SoShape class is the superclass for geometry shapes.
Definition SoShape.h:52
Wrap
Definition SoTexture2.h:65
Model
Definition SoTexture2.h:58
Binding
Definition SoTextureCoordinateBinding.h:49
The SoType class is the basis for the runtime type system in Coin.
Definition SoType.h:59
Units
Definition SoUnits.h:51