00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 #ifndef _SO_NODE_
00052 #define _SO_NODE_
00053
00054 #include <Inventor/fields/SoFieldContainer.h>
00055 #include <Inventor/nodes/SoSubNode.h>
00056 #include <Inventor/SoLists.h>
00057 #include <Inventor/SbString.h>
00058 #include <Inventor/SoType.h>
00059 #include <Inventor/sensors/SoDataSensor.h>
00060 #include <Inventor/STL/vector>
00061
00062 class SoNodeList;
00063 class SoAction;
00064 class SoCallbackAction;
00065 class SoChildList;
00066 class SoFieldData;
00067 class SoGLRenderAction;
00068 class SoGetBoundingBoxAction;
00069 class SoGetMatrixAction;
00070 class SoHandleEventAction;
00071 class SoInput;
00072 class SoOutput;
00073 class SoPickAction;
00074 class SoRayPickAction;
00075 class SoSearchAction;
00076 class SoWriteAction;
00077 class SbProjectionCoordinates;
00078 class SoGetPrimitiveCountAction;
00079 class SoComputeRenderUnitIDAction;
00080 class SoNodeImpl;
00081 class SoDistributeAction;
00082 class SoState;
00083
00085
00086
00087
00088
00089
00091
00092
00122 class SoNode : public SoFieldContainer {
00123
00124 SO_NODE_ABSTRACT_HEADER(SoNode);
00125
00126 public:
00127
00175 inline virtual void setOverride(const SbBool state);
00176
00180 inline virtual SbBool isOverride() const;
00181
00195 virtual SoNode * copy(SbBool copyConnections = FALSE) const;
00196
00202 virtual SbBool affectsState() const;
00203
00209 static SoNode * getByName(const SbName &name);
00210
00217 static int getByName(const SbName &name, SoNodeList &list);
00218
00219 virtual void touch();
00220
00221 private:
00222
00235 inline virtual SoNode* getAlternateRep(SoAction* action);
00236
00243 inline virtual SbBool isBoundingBoxIgnoring() const;
00244
00245
00246
00247 virtual void doAction(SoAction *action);
00248
00249
00250
00251 virtual void GLRender(SoGLRenderAction *action);
00252 virtual void callback(SoCallbackAction *action);
00253 virtual void getBoundingBox(SoGetBoundingBoxAction *action);
00254 virtual void getMatrix(SoGetMatrixAction *action);
00255 virtual void handleEvent(SoHandleEventAction *action);
00256 virtual void pick(SoPickAction *action);
00257 virtual void rayPick(SoRayPickAction *action);
00258 virtual void search(SoSearchAction *action);
00259 virtual void write(SoWriteAction *action);
00260 virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action);
00261 virtual void distribute(SoDistributeAction *action);
00262
00263
00264
00265
00266 virtual void GLRenderBelowPath(SoGLRenderAction *action);
00267 virtual void GLRenderInPath(SoGLRenderAction *action);
00268 virtual void GLRenderOffPath(SoGLRenderAction *action);
00269
00270
00271
00272
00273 virtual void grabEventsSetup();
00274 virtual void grabEventsCleanup();
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289 virtual int32_t getRenderUnitID() const;
00290
00291 private:
00292
00293
00294
00295
00296 SoNode * copyForPROTO(SbBool copyConnections = FALSE) const;
00297 enum Stage {
00298 FIRST_INSTANCE,
00299 PROTO_INSTANCE,
00300 OTHER_INSTANCE
00301 };
00302
00303
00304 static void initClass();
00305 static void exitClass();
00306
00307
00308 static void initClasses();
00309 static void exitClasses();
00310
00311
00312 virtual void startNotify();
00313
00314
00315 virtual void notify(SoNotList *list);
00316
00317
00318 uint64_t getNodeId() const { return m_uniqueId; }
00319
00320
00321 static uint64_t getNextNodeId();
00322
00323
00324 virtual SoChildList *getChildren() const;
00325 virtual bool isSynchronizingContentOnly() { return FALSE; }
00326 virtual SoChildList *internalGetChildren() const;
00327
00328 virtual void internalRemoveChild(int);
00329 virtual void internalRemoveChild(SoNode *);
00330 virtual void internalRemoveAllChildren();
00334 virtual void internalAddChild(SoNode *);
00335 virtual int internalFindChild(const SoNode *) const;
00336 virtual void internalInsertChild(SoNode *, int);
00337 virtual SoNode *internalGetChild( int ) const;
00338 virtual void internalReplaceChild(int, SoNode *);
00339 virtual void internalReplaceChild(SoNode *, SoNode *);
00340 virtual int internalGetNumChildren();
00341
00342
00343 SoNode* getChangedChild() const;
00344 int getChangedIndex() const;
00345 SoDataSensor::ChangeType getChangeType() const;
00346
00347
00348 virtual void writeInstance(SoOutput *out);
00349
00350
00351
00352 static int getActionMethodIndex(SoType t);
00353
00354
00355
00356 virtual SoNode * addToCopyDict() const;
00357
00358
00359
00360 virtual void copyContents(const SoFieldContainer *fromFC,
00361 SbBool copyConnections);
00362
00363
00364 virtual SoFieldContainer * copyThroughConnection() const;
00365
00366
00367 void setNodeImpl(SoNodeImpl *nodeImpl);
00368
00369
00370 template <typename T>
00371 inline T* getNodeImpl() const
00372 {
00373 #if defined(_DEBUG)
00374 T* implNode = dynamic_cast<T*>(m_soNodeImpl);
00375 assert(implNode);
00376 #endif
00377 return static_cast<T*>(m_soNodeImpl);
00378 }
00379
00380
00381
00382 SoNode* getCachedAlternateRep(SoAction* action, SbBool doCache = FALSE);
00383
00389 virtual bool affectsPath() const;
00390
00397 void setChildrenSameFieldsValueNotificationEnabled(SbBool value);
00398
00399
00400 virtual void GLRenderP(SoGLRenderAction *action);
00401
00402 private:
00403
00404 static void setNextActionMethodIndex(int index);
00405 static int getNextActionMethodIndex();
00406 static void incNextActionMethodIndex();
00407
00408
00409 SoNode();
00410 virtual ~SoNode();
00411
00412 private:
00413
00414 uint64_t m_uniqueId;
00415
00416
00417 static int nextActionMethodIndex;
00418
00419
00420
00421 static void callbackS(SoAction *, SoNode *);
00422 static void GLRenderS(SoAction *, SoNode *);
00423 static void getBoundingBoxS(SoAction *, SoNode *);
00424 static void getMatrixS(SoAction *, SoNode *);
00425 static void handleEventS(SoAction *, SoNode *);
00426 static void pickS(SoAction *, SoNode *);
00427 static void rayPickS(SoAction *, SoNode *);
00428 static void searchS(SoAction *, SoNode *);
00429 static void writeS(SoAction *, SoNode *);
00430 static void getPrimitiveCountS(SoAction *, SoNode *);
00431
00432 static void distributeS(SoAction *, SoNode *);
00433
00434
00435 template < class SPEC_ACTION >
00436 static void forwardTraversalS(SoAction *action, SoNode *node);
00437
00438 SoNode* getNodeToTraverse(SoAction* action, bool force = false);
00439
00440 SoNode* m_cachedAlternateRep;
00441
00442 private:
00443
00444
00445
00446
00447
00448
00449 void* m_directVizObjects;
00450
00451
00452 void addDirectVizObject( void *directVizObject );
00453
00454
00455 void* getDirectVizObject( unsigned int pos );
00456
00457
00458 int getNumDirectVizObjects();
00459
00460
00461 void clearDirectVizObjects();
00462
00463
00464
00465 SbProjectionCoordinates *getProjectionCoordinates(){return m_projCoords;}
00466
00467 void setProjectionCoordinates(SbProjectionCoordinates *projCoords){
00468 m_projCoords = projCoords;
00469 }
00470
00471
00472 private:
00473 SbProjectionCoordinates *m_projCoords;
00474
00475 private:
00476
00477 SoNodeImpl* m_soNodeImpl;
00478
00479
00480 static bool s_catchGLError;
00481 friend class SoLightPath;
00482 };
00483
00484 SoNode*
00485 SoNode::getAlternateRep(SoAction*)
00486 {
00487 return this;
00488 }
00489
00490 SbBool
00491 SoNode::isBoundingBoxIgnoring() const
00492 {
00493 return FALSE;
00494 }
00495
00496 void
00497 SoNode::setOverride(const SbBool)
00498 {
00499 #if defined(_DEBUG)
00500 SoDebugError::postWarning("SoNode::setOverride","not reimplemented and supported for this inherited node");
00501 #endif
00502 }
00503
00504 SbBool
00505 SoNode::isOverride() const
00506 {
00507 return FALSE;
00508 }
00509
00510 #endif
00511
00512