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) by Kongsberg Oil & Gas Technologies.
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 Kongsberg Oil & Gas Technologies
18 * about acquiring a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, 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 COIN_3_0 = 0x8000,
77 INVENTOR_6_0 = 0x10000
78 };
79
80 static uint32_t getCompatibilityTypes(const SoType & nodetype);
81 void setNodeType(const NodeType type);
82 NodeType getNodeType(void) const;
83
84 virtual SoNode * copy(SbBool copyconnections = FALSE) const;
85 virtual SbBool affectsState(void) const;
86
87 virtual void doAction(SoAction * action);
88 virtual void GLRender(SoGLRenderAction * action);
89 virtual void GLRenderBelowPath(SoGLRenderAction * action);
90 virtual void GLRenderInPath(SoGLRenderAction * action);
91 virtual void GLRenderOffPath(SoGLRenderAction * action);
92 virtual void callback(SoCallbackAction * action);
93 virtual void getBoundingBox(SoGetBoundingBoxAction * action);
94 virtual void getMatrix(SoGetMatrixAction * action);
95 virtual void handleEvent(SoHandleEventAction * action);
96 virtual void pick(SoPickAction * action);
97 virtual void rayPick(SoRayPickAction * action);
98 virtual void search(SoSearchAction * action);
99 virtual void write(SoWriteAction * action);
100 virtual void audioRender(SoAudioRenderAction * action);
101 virtual void getPrimitiveCount(SoGetPrimitiveCountAction * action);
102
103 virtual void grabEventsSetup(void);
104 virtual void grabEventsCleanup(void);
105
106 virtual void startNotify(void);
107 virtual void notify(SoNotList * l);
108
109 uint32_t getNodeId(void) const;
110 virtual SoChildList * getChildren(void) const;
111
112 virtual void writeInstance(SoOutput * out);
113 virtual SoNode * addToCopyDict(void) const;
114 virtual void copyContents(const SoFieldContainer * from,
115 SbBool copyconnections);
116 virtual SoFieldContainer * copyThroughConnection(void) const;
117
118
119 static SoType getClassTypeId(void);
120 static SoNode * getByName(const SbName & name);
121 static int getByName(const SbName & name, SoNodeList & l);
122
123 static void initClass(void);
124 static void initClasses(void);
125
126 static uint32_t getNextNodeId(void);
127 static int getActionMethodIndex(const SoType type);
128
129 static void getBoundingBoxS(SoAction * action, SoNode * node);
130 static void GLRenderS(SoAction * action, SoNode * node);
131 static void callbackS(SoAction * action, SoNode * node);
132 static void getMatrixS(SoAction * action, SoNode * node);
133 static void handleEventS(SoAction * action, SoNode * node);
134 static void pickS(SoAction * action, SoNode * node);
135 static void rayPickS(SoAction * action, SoNode * node);
136 static void searchS(SoAction * action, SoNode * node);
137 static void writeS(SoAction * action, SoNode * node);
138 static void audioRenderS(SoAction * action, SoNode * node);
139 static void getPrimitiveCountS(SoAction * action, SoNode * node);
140
141protected:
142 SoNode(void);
143 virtual ~SoNode();
144
145 virtual SbBool readInstance(SoInput * in, unsigned short flags);
146
147 static const SoFieldData ** getFieldDataPtr(void);
148
149 // These are necessary to avoid problems with us not exporting the
150 // nextActionMethodIndex member into Win32 DLLs (we'll get
151 // unresolved symbol for extension node classes if the SoSubNode
152 // macros accesses the nextActionMethodIndex directly).
153 static void setNextActionMethodIndex(int index);
154 static int getNextActionMethodIndex(void);
155 static void incNextActionMethodIndex(void);
156
157 static void setCompatibilityTypes(const SoType & nodetype, const uint32_t bitmask);
158
159 uint32_t uniqueId;
160 static uint32_t nextUniqueId;
162
163private:
164 static SoType classTypeId;
165 uint32_t stateflags;
166 void clearStateFlags(const unsigned int bits);
167 void setStateFlags(const unsigned int bits);
168 SbBool getState(const unsigned int bits) const;
169 static void cleanupClass(void);
170};
171
172#ifndef COIN_INTERNAL
173// For SGI / TGS Open Inventor compile-time compatibility.
174#include <Inventor/SoLists.h>
175#endif // COIN_INTERNAL
176
177#endif // !COIN_SONODE_H
The SbDict class organizes a dictionary of keys and values.
Definition SbDict.h:54
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:68
The SoAudioRenderAction class renders the aural parts of the scene graph.
Definition SoAudioRenderAction.h:33
virtual void startNotify(void)
Definition SoBase.cpp:762
The SoCallbackAction class invokes callbacks at specific nodes.
Definition SoCallbackAction.h:71
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:34
virtual void writeInstance(SoOutput *out)
Definition SoFieldContainer.cpp:715
virtual void notify(SoNotList *l)
Definition SoFieldContainer.cpp:636
virtual SoFieldContainer * copyThroughConnection(void) const
Definition SoFieldContainer.cpp:804
virtual SbBool readInstance(SoInput *in, unsigned short flags)
Definition SoFieldContainer.cpp:1038
virtual void copyContents(const SoFieldContainer *from, SbBool copyconnections)
Definition SoFieldContainer.cpp:786
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:41
The SoGetBoundingBoxAction class calculates bounding boxes for nodes and subgraphs.
Definition SoGetBoundingBoxAction.h:36
The SoGetMatrixAction class is an action for accumulating the transformation matrix of a subgraph.
Definition SoGetMatrixAction.h:37
The SoGetPrimitiveCountAction class counts the primitives in a scene.
Definition SoGetPrimitiveCountAction.h:34
The SoHandleEventAction class distributes user events to the scene.
Definition SoHandleEventAction.h:37
The SoInput class is an abstraction of file import functionality.
Definition SoInput.h:52
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:159
static uint32_t nextUniqueId
Definition SoNode.h:160
static int nextActionMethodIndex
Definition SoNode.h:161
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:34
The SoRayPickAction class does ray intersection with scene graphs.
Definition SoRayPickAction.h:41
The SoSearchAction class provides methods for searching through scene graphs.
Definition SoSearchAction.h:35
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:33

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.

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