Coin Logo http://www.sim.no
http://www.coin3d.org

SoNode.h
1#ifndef COIN_SONODE_H
2#define COIN_SONODE_H
3
4/**************************************************************************\
5 *
6 * This file is part of the Coin 3D visualization library.
7 * Copyright (C) 1998-2007 by Systems in Motion. All rights reserved.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * ("GPL") version 2 as published by the Free Software Foundation.
12 * See the file LICENSE.GPL at the root directory of this source
13 * distribution for additional information about the GNU GPL.
14 *
15 * For using Coin with software that can not be combined with the GNU
16 * GPL, and for taking advantage of the additional benefits of our
17 * support services, please contact Systems in Motion about acquiring
18 * a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
23 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24 *
25\**************************************************************************/
26
27#include <Inventor/fields/SoFieldContainer.h>
28
29class SoAction;
31class SoChildList;
37class SoNodeList;
38class SoNotList;
39class SoOutput;
40class SoPickAction;
41class SoRayPickAction;
42class SoSearchAction;
43class SoWriteAction;
45class SbDict;
46
47class COIN_DLL_API SoNode : public SoFieldContainer {
49
50public:
51 // Probably not interesting for the application programmer..?
52#ifndef DOXYGEN_SKIP_THIS
53 enum Stage { FIRST_INSTANCE, PROTO_INSTANCE, OTHER_INSTANCE };
54#endif // !DOXYGEN_SKIP_THIS
55
56 void setOverride(const SbBool state);
57 SbBool isOverride(void) const;
58
59 enum NodeType {
60 INVENTOR = 0x0000,
61 VRML1 = 0x0001,
62 VRML2 = 0x0002,
63 INVENTOR_1 = 0x0004,
64 INVENTOR_2_0 = 0x0008,
65 INVENTOR_2_1 = 0x0010,
66 INVENTOR_2_5 = 0x0020,
67 INVENTOR_2_6 = 0x0040,
68 COIN_1_0 = 0x0080,
69 COIN_2_0 = 0x0100,
70 EXTENSION = 0x0200,
71 COIN_2_2 = 0x0400,
72 COIN_2_3 = 0x0800,
73 COIN_2_4 = 0x1000,
74 INVENTOR_5_0 = 0x2000,
75 COIN_2_5 = 0x4000
76 };
77
78 static uint32_t getCompatibilityTypes(const SoType & nodetype);
79 void setNodeType(const NodeType type);
80 NodeType getNodeType(void) const;
81
82 virtual SoNode * copy(SbBool copyconnections = FALSE) const;
83 virtual SbBool affectsState(void) const;
84
85 virtual void doAction(SoAction * action);
86 virtual void GLRender(SoGLRenderAction * action);
87 virtual void GLRenderBelowPath(SoGLRenderAction * action);
88 virtual void GLRenderInPath(SoGLRenderAction * action);
89 virtual void GLRenderOffPath(SoGLRenderAction * action);
90 virtual void callback(SoCallbackAction * action);
91 virtual void getBoundingBox(SoGetBoundingBoxAction * action);
92 virtual void getMatrix(SoGetMatrixAction * action);
93 virtual void handleEvent(SoHandleEventAction * action);
94 virtual void pick(SoPickAction * action);
95 virtual void rayPick(SoRayPickAction * action);
96 virtual void search(SoSearchAction * action);
97 virtual void write(SoWriteAction * action);
98 virtual void audioRender(SoAudioRenderAction * action);
99 virtual void getPrimitiveCount(SoGetPrimitiveCountAction * action);
100
101 virtual void grabEventsSetup(void);
102 virtual void grabEventsCleanup(void);
103
104 virtual void startNotify(void);
105 virtual void notify(SoNotList * l);
106
107 uint32_t getNodeId(void) const;
108 virtual SoChildList * getChildren(void) const;
109
110 virtual void writeInstance(SoOutput * out);
111 virtual SoNode * addToCopyDict(void) const;
112 virtual void copyContents(const SoFieldContainer * from,
113 SbBool copyconnections);
114 virtual SoFieldContainer * copyThroughConnection(void) const;
115
116
117 static SoType getClassTypeId(void);
118 static SoNode * getByName(const SbName & name);
119 static int getByName(const SbName & name, SoNodeList & l);
120
121 static void initClass(void);
122 static void initClasses(void);
123
124 static uint32_t getNextNodeId(void);
125 static int getActionMethodIndex(const SoType type);
126
127 static void getBoundingBoxS(SoAction * action, SoNode * node);
128 static void GLRenderS(SoAction * action, SoNode * node);
129 static void callbackS(SoAction * action, SoNode * node);
130 static void getMatrixS(SoAction * action, SoNode * node);
131 static void handleEventS(SoAction * action, SoNode * node);
132 static void pickS(SoAction * action, SoNode * node);
133 static void rayPickS(SoAction * action, SoNode * node);
134 static void searchS(SoAction * action, SoNode * node);
135 static void writeS(SoAction * action, SoNode * node);
136 static void audioRenderS(SoAction * action, SoNode * node);
137 static void getPrimitiveCountS(SoAction * action, SoNode * node);
138
139protected:
140 SoNode(void);
141 virtual ~SoNode();
142
143 virtual SbBool readInstance(SoInput * in, unsigned short flags);
144
145 static const SoFieldData ** getFieldDataPtr(void);
146
147 // These are necessary to avoid problems with us not exporting the
148 // nextActionMethodIndex member into Win32 DLLs (we'll get
149 // unresolved symbol for extension node classes if the SoSubNode
150 // macros accesses the nextActionMethodIndex directly).
151 static void setNextActionMethodIndex(int index);
152 static int getNextActionMethodIndex(void);
153 static void incNextActionMethodIndex(void);
154
155 static void setCompatibilityTypes(const SoType & nodetype, const uint32_t bitmask);
156
157 uint32_t uniqueId;
158 static uint32_t nextUniqueId;
160
161private:
162 static SoType classTypeId;
163 uint32_t stateflags;
164 void clearStateFlags(const unsigned int bits);
165 void setStateFlags(const unsigned int bits);
166 SbBool getState(const unsigned int bits) const;
167 // OBSOLETE, only kept for Coin 2.x ABI compatibility.
168 static SbDict * compatibilitydict;
169
170 static void cleanupClass(void);
171};
172
173#ifndef COIN_INTERNAL
174// For SGI / TGS Open Inventor compile-time compatibility.
175#include <Inventor/SoLists.h>
176#endif // COIN_INTERNAL
177
178#endif // !COIN_SONODE_H
The SbDict class organizes a dictionary of keys and values.
Definition SbDict.h:47
The SbName class stores strings by reference.
Definition SbName.h:31
The SoAction class is the base class for all traversal actions.
Definition SoAction.h:67
The SoAudioRenderAction class renders the aural parts of the scene graph.
Definition SoAudioRenderAction.h:30
virtual void startNotify(void)
Definition SoBase.cpp:857
The SoCallbackAction class invokes callbacks at specific nodes.
Definition SoCallbackAction.h:70
The SoChildList class is a container for node children.
Definition SoChildList.h:33
The SoFieldContainer class is a base class for all classes that contain fields.
Definition SoFieldContainer.h:35
virtual void writeInstance(SoOutput *out)
Definition SoFieldContainer.cpp:640
virtual void notify(SoNotList *l)
Definition SoFieldContainer.cpp:562
virtual SoFieldContainer * copyThroughConnection(void) const
Definition SoFieldContainer.cpp:728
virtual SbBool readInstance(SoInput *in, unsigned short flags)
Definition SoFieldContainer.cpp:953
virtual void copyContents(const SoFieldContainer *from, SbBool copyconnections)
Definition SoFieldContainer.cpp:711
The SoFieldData class is a container for a prototype set of fields.
Definition SoFieldData.h:39
The SoGLRenderAction class renders the scene graph with OpenGL calls.
Definition SoGLRenderAction.h:39
The SoGetBoundingBoxAction class calculates bounding boxes for nodes and subgraphs.
Definition SoGetBoundingBoxAction.h:34
The SoGetMatrixAction class is an action for accumulating the transformation matrix of a subgraph.
Definition SoGetMatrixAction.h:35
The SoGetPrimitiveCountAction class counts the primitives in a scene.
Definition SoGetPrimitiveCountAction.h:32
The SoHandleEventAction class distributes user events to the scene.
Definition SoHandleEventAction.h:36
The SoInput class is an abstraction of file import functionality.
Definition SoInput.h:55
The SoNodeList class is a container for pointers to SoNode objects.
Definition SoNodeList.h:31
The SoNode class is the base class for nodes used in scene graphs.
Definition SoNode.h:47
uint32_t uniqueId
Definition SoNode.h:157
static uint32_t nextUniqueId
Definition SoNode.h:158
static int nextActionMethodIndex
Definition SoNode.h:159
NodeType
Definition SoNode.h:59
The SoNotList class is a list of SoNotRec notification records.
Definition SoNotification.h:34
The SoOutput class is an abstraction of an output stream.
Definition SoOutput.h:42
The SoPickAction class is the base class for picking actions.
Definition SoPickAction.h:32
The SoRayPickAction class does ray intersection with scene graphs.
Definition SoRayPickAction.h:40
The SoSearchAction class provides methods for searching through scene graphs.
Definition SoSearchAction.h:32
The SoType class is the basis for the run-time type system in Coin.
Definition SoType.h:50
The SoWriteAction class writes a scene graph to file.
Definition SoWriteAction.h:31

Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.

Generated on Wed Jul 17 2024 for Coin by Doxygen. 1.12.0