Coin Logo http://www.coin3d.org/
http://www.kongsberg.com/kogt/

SoNode.h
1 #ifndef COIN_SONODE_H
2 #define COIN_SONODE_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 #include <Inventor/fields/SoFieldContainer.h>
37 
38 class SoAction;
39 class SoCallbackAction;
40 class SoChildList;
41 class SoGLRenderAction;
43 class SoGetMatrixAction;
46 class SoNodeList;
47 class SoNotList;
48 class SoOutput;
49 class SoPickAction;
50 class SoRayPickAction;
51 class SoSearchAction;
52 class SoWriteAction;
54 class SbDict;
55 
56 class COIN_DLL_API SoNode : public SoFieldContainer {
58 
59 public:
60  // Probably not interesting for the application programmer..?
61 #ifndef DOXYGEN_SKIP_THIS
62  enum Stage { FIRST_INSTANCE, PROTO_INSTANCE, OTHER_INSTANCE };
63 #endif // !DOXYGEN_SKIP_THIS
64 
65  void setOverride(const SbBool state);
66  SbBool isOverride(void) const;
67 
68  enum NodeType {
69  INVENTOR = 0x0000,
70  VRML1 = 0x0001,
71  VRML2 = 0x0002,
72  INVENTOR_1 = 0x0004,
73  INVENTOR_2_0 = 0x0008,
74  INVENTOR_2_1 = 0x0010,
75  INVENTOR_2_5 = 0x0020,
76  INVENTOR_2_6 = 0x0040,
77  COIN_1_0 = 0x0080,
78  COIN_2_0 = 0x0100,
79  EXTENSION = 0x0200,
80  COIN_2_2 = 0x0400,
81  COIN_2_3 = 0x0800,
82  COIN_2_4 = 0x1000,
83  INVENTOR_5_0 = 0x2000,
84  COIN_2_5 = 0x4000,
85  COIN_3_0 = 0x8000,
86  INVENTOR_6_0 = 0x10000,
87  COIN_4_0 = 0x20000
88  };
89 
90  static uint32_t getCompatibilityTypes(const SoType & nodetype);
91  void setNodeType(const NodeType type);
92  NodeType getNodeType(void) const;
93 
94  virtual SoNode * copy(SbBool copyconnections = FALSE) const;
95  virtual SbBool affectsState(void) const;
96 
97  virtual void doAction(SoAction * action);
98  virtual void GLRender(SoGLRenderAction * action);
99  virtual void GLRenderBelowPath(SoGLRenderAction * action);
100  virtual void GLRenderInPath(SoGLRenderAction * action);
101  virtual void GLRenderOffPath(SoGLRenderAction * action);
102  virtual void callback(SoCallbackAction * action);
103  virtual void getBoundingBox(SoGetBoundingBoxAction * action);
104  virtual void getMatrix(SoGetMatrixAction * action);
105  virtual void handleEvent(SoHandleEventAction * action);
106  virtual void pick(SoPickAction * action);
107  virtual void rayPick(SoRayPickAction * action);
108  virtual void search(SoSearchAction * action);
109  virtual void write(SoWriteAction * action);
110  virtual void audioRender(SoAudioRenderAction * action);
111  virtual void getPrimitiveCount(SoGetPrimitiveCountAction * action);
112 
113  virtual void grabEventsSetup(void);
114  virtual void grabEventsCleanup(void);
115 
116  virtual void startNotify(void);
117  virtual void notify(SoNotList * l);
118 
119  uint32_t getNodeId(void) const;
120  virtual SoChildList * getChildren(void) const;
121 
122  virtual void writeInstance(SoOutput * out);
123  virtual SoNode * addToCopyDict(void) const;
124  virtual void copyContents(const SoFieldContainer * from,
125  SbBool copyconnections);
126  virtual SoFieldContainer * copyThroughConnection(void) const;
127 
128 
129  static SoType getClassTypeId(void);
130  static SoNode * getByName(const SbName & name);
131  static int getByName(const SbName & name, SoNodeList & l);
132 
133  static void initClass(void);
134  static void initClasses(void);
135 
136  static uint32_t getNextNodeId(void);
137  static int getActionMethodIndex(const SoType type);
138 
139  static void getBoundingBoxS(SoAction * action, SoNode * node);
140  static void GLRenderS(SoAction * action, SoNode * node);
141  static void callbackS(SoAction * action, SoNode * node);
142  static void getMatrixS(SoAction * action, SoNode * node);
143  static void handleEventS(SoAction * action, SoNode * node);
144  static void pickS(SoAction * action, SoNode * node);
145  static void rayPickS(SoAction * action, SoNode * node);
146  static void searchS(SoAction * action, SoNode * node);
147  static void writeS(SoAction * action, SoNode * node);
148  static void audioRenderS(SoAction * action, SoNode * node);
149  static void getPrimitiveCountS(SoAction * action, SoNode * node);
150 
151 protected:
152  SoNode(void);
153  virtual ~SoNode();
154 
155  virtual SbBool readInstance(SoInput * in, unsigned short flags);
156 
157  static const SoFieldData ** getFieldDataPtr(void);
158 
159  // These are necessary to avoid problems with us not exporting the
160  // nextActionMethodIndex member into Win32 DLLs (we'll get
161  // unresolved symbol for extension node classes if the SoSubNode
162  // macros accesses the nextActionMethodIndex directly).
163  static void setNextActionMethodIndex(int index);
164  static int getNextActionMethodIndex(void);
165  static void incNextActionMethodIndex(void);
166 
167  static void setCompatibilityTypes(const SoType & nodetype, const uint32_t bitmask);
168 
169  uint32_t uniqueId;
170  static uint32_t nextUniqueId;
172 
173 private:
174  static SoType classTypeId;
175  uint32_t stateflags;
176  void clearStateFlags(const unsigned int bits);
177  void setStateFlags(const unsigned int bits);
178  SbBool getState(const unsigned int bits) const;
179  static void cleanupClass(void);
180 };
181 
182 #ifndef COIN_INTERNAL
183 // For SGI / TGS Open Inventor compile-time compatibility.
184 #include <Inventor/SoLists.h>
185 #endif // COIN_INTERNAL
186 
187 #endif // !COIN_SONODE_H
virtual void writeInstance(SoOutput *out)
Definition: SoFieldContainer.cpp:724
The SoBase class is the top-level superclass for a number of class-hierarchies.SoBase provides the ba...
Definition: SoBase.h:45
The SoRayPickAction class does ray intersection with scene graphs.For interaction with the scene grap...
Definition: SoRayPickAction.h:50
The SoOutput class is an abstraction of an output stream.SoOutput offers the ability to write basic t...
Definition: SoOutput.h:51
The SoGetMatrixAction class is an action for accumulating the transformation matrix of a subgraph...
Definition: SoGetMatrixAction.h:46
The SoFieldContainer class is a base class for all classes that contain fields.The classes containing...
Definition: SoFieldContainer.h:43
The SoSearchAction class provides methods for searching through scene graphs.Nodes can be searched fo...
Definition: SoSearchAction.h:44
virtual void copyContents(const SoFieldContainer *from, SbBool copyconnections)
Definition: SoFieldContainer.cpp:795
The SoPickAction class is the base class for picking actions.The basis for all interaction features t...
Definition: SoPickAction.h:43
virtual SoFieldContainer * copyThroughConnection(void) const
Definition: SoFieldContainer.cpp:813
The SoNode class is the base class for nodes used in scene graphs.Coin is a retained mode 3D visualiz...
Definition: SoNode.h:56
The SbDict class organizes a dictionary of keys and values.It uses hashing to quickly insert and find...
Definition: SbDict.h:63
The SoChildList class is a container for node children.This class does automatic notification on the ...
Definition: SoChildList.h:42
static int nextActionMethodIndex
Definition: SoNode.h:171
The SoAudioRenderAction class renders the aural parts of the scene graph.Applying this method at a ro...
Definition: SoAudioRenderAction.h:42
virtual void notify(SoNotList *l)
Definition: SoFieldContainer.cpp:645
The SoAction class is the base class for all traversal actions.Applying actions is the basic mechanis...
Definition: SoAction.h:77
The SoHandleEventAction class distributes user events to the scene.This is the action used by the GUI...
Definition: SoHandleEventAction.h:46
The SoGetPrimitiveCountAction class counts the primitives in a scene.Apply this action to a scene if ...
Definition: SoGetPrimitiveCountAction.h:44
The SoGetBoundingBoxAction class calculates bounding boxes for nodes and subgraphs.If this action is applied to a path or scene graph root, it will calculate the bounding box and the center point of the geometry contained within the scene.
Definition: SoGetBoundingBoxAction.h:45
virtual SbBool readInstance(SoInput *in, unsigned short flags)
Definition: SoFieldContainer.cpp:1040
virtual void startNotify(void)
Definition: SoBase.cpp:782
static uint32_t nextUniqueId
Definition: SoNode.h:170
The SoCallbackAction class invokes callbacks at specific nodes.This action has mechanisms for trackin...
Definition: SoCallbackAction.h:80
The SoNodeList class is a container for pointers to SoNode objects.
Definition: SoNodeList.h:40
The SoWriteAction class writes a scene graph to file.When applied to a scene, this action writes its ...
Definition: SoWriteAction.h:42
The SoInput class is an abstraction of file import functionality.This class takes care of most of the...
Definition: SoInput.h:61
uint32_t uniqueId
Definition: SoNode.h:169
The SoFieldData class is a container for a prototype set of fields.This class is instantiated once fo...
Definition: SoFieldData.h:48
The SoNotList class is a list of SoNotRec notification records.
Definition: SoNotification.h:43
The SoType class is the basis for the run-time type system in Coin.Many of the classes in the Coin li...
Definition: SoType.h:59
NodeType
Definition: SoNode.h:68
The SbName class stores strings by reference.The class is used by Coin for storing keywords...
Definition: SbName.h:40
The SoGLRenderAction class renders the scene graph with OpenGL calls.Applying this method at a root n...
Definition: SoGLRenderAction.h:50

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

Generated for Coin by Doxygen