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 #include <Inventor/SbPImpl.h>
00062 #include <bitset>
00063
00064 #ifdef _WIN32
00065 #pragma warning(push)
00066 #pragma warning(disable:4251)
00067 #endif
00068
00069 class SoNodeList;
00070 class SoAction;
00071 class SoCallbackAction;
00072 class SoChildList;
00073 class SoFieldData;
00074 class SoGLRenderAction;
00075 class SoGetBoundingBoxAction;
00076 class SoGetMatrixAction;
00077 class SoHandleEventAction;
00078 class SoInput;
00079 class SoOutput;
00080 class SoPickAction;
00081 class SoRayPickAction;
00082 class SoSearchAction;
00083 class SoWriteAction;
00084 class SbProjectionCoordinates;
00085 class SoGetPrimitiveCountAction;
00086 class SoComputeRenderUnitIDAction;
00087 class SoDistributeAction;
00088 class SoState;
00089
00090 namespace inventor
00091 {
00092 namespace impl
00093 {
00094 class SoCachedGroupImpl;
00095 }
00096 namespace node
00097 {
00098 class SoConstNode;
00099 }
00100 }
00101
00102 SO_PIMPL_BASE_PUBLIC_DECLARATION(SoNode)
00103
00104
00105
00106
00107
00108
00109
00111
00112
00113
00143 class SoNode : public SoFieldContainer {
00144
00145 SO_NODE_ABSTRACT_HEADER(SoNode);
00146 SO_PIMPL_BASE_PUBLIC_HEADER(SoNode)
00147
00148 public:
00149
00196 inline virtual void setOverride(const SbBool state);
00197
00201 inline virtual SbBool isOverride() const;
00202
00210 virtual SoNode * copy(SbBool copyConnections = FALSE) const;
00211
00217 virtual SbBool affectsState() const;
00218
00224 static SoNode * getByName(const SbName &name);
00225
00232 static int getByName(const SbName &name, SoNodeList &list);
00233
00234 virtual void touch();
00235
00236 private:
00237
00250 inline virtual SoNode* getAlternateRep(SoAction* action);
00251
00258 inline virtual SbBool isBoundingBoxIgnoring() const;
00259
00260
00261
00262 virtual void doAction(SoAction *action);
00263
00264
00265
00266 virtual void GLRender(SoGLRenderAction *action);
00267 virtual void callback(SoCallbackAction *action);
00268 virtual void getBoundingBox(SoGetBoundingBoxAction *action);
00269 virtual void getMatrix(SoGetMatrixAction *action);
00270 virtual void handleEvent(SoHandleEventAction *action);
00271 virtual void pick(SoPickAction *action);
00272 virtual void rayPick(SoRayPickAction *action);
00273 virtual void search(SoSearchAction *action);
00274 virtual void write(SoWriteAction *action);
00275 virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action);
00276 virtual void distribute(SoDistributeAction *action);
00277
00278
00279
00280
00281 virtual void GLRenderBelowPath(SoGLRenderAction *action);
00282 virtual void GLRenderInPath(SoGLRenderAction *action);
00283 virtual void GLRenderOffPath(SoGLRenderAction *action);
00284
00285
00286
00287
00288 virtual void grabEventsSetup();
00289 virtual void grabEventsCleanup();
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304 virtual int32_t getRenderUnitID() const;
00305
00306 private:
00307
00308
00309
00310
00311 SoNode * copyForPROTO(SbBool copyConnections = FALSE) const;
00312 enum Stage {
00313 FIRST_INSTANCE,
00314 PROTO_INSTANCE,
00315 OTHER_INSTANCE
00316 };
00317
00318
00319 static void initClass();
00320 static void exitClass();
00321
00322
00323 static void initClasses();
00324 static void exitClasses();
00325
00326
00327 virtual void startNotify();
00328
00329
00330 virtual void notify(SoNotList *list);
00331
00332
00333 uint64_t getNodeId() const { return m_uniqueId; }
00334
00335
00336 static uint64_t getNextNodeId();
00337
00338
00339 virtual SoChildList *getChildren() const;
00340 virtual bool isSynchronizingContentOnly() { return FALSE; }
00341 virtual SoChildList *internalGetChildren() const;
00342
00343 virtual void internalRemoveChild(int);
00344 virtual void internalRemoveChild(SoNode *);
00345 virtual void internalRemoveAllChildren();
00349 virtual void internalAddChild(SoNode *);
00350 virtual int internalFindChild(const SoNode *) const;
00351 virtual void internalInsertChild(SoNode *, int);
00352 virtual SoNode *internalGetChild( int ) const;
00353 virtual void internalReplaceChild(int, SoNode *);
00354 virtual void internalReplaceChild(SoNode *, SoNode *);
00355 virtual int internalGetNumChildren();
00356
00357
00358 SoNode* getChangedChild() const;
00359 int getChangedIndex() const;
00360 SoDataSensor::ChangeType getChangeType() const;
00361
00362
00363 virtual void writeInstance(SoOutput *out);
00364
00365
00366
00367 static int getActionMethodIndex(SoType t);
00368
00369
00370
00371 virtual SoNode * addToCopyDict() const;
00372
00373
00374
00375 virtual void copyContents(const SoFieldContainer *fromFC,
00376 SbBool copyConnections);
00377
00378
00379 virtual SoFieldContainer * copyThroughConnection() const;
00380
00381
00382
00383 SoNode* getCachedAlternateRep(SoAction* action, SbBool doCache = FALSE);
00384
00390 virtual bool affectsPath() const;
00391
00392
00393 virtual void GLRenderP(SoGLRenderAction *action);
00394
00395 private:
00396
00397 static void setNextActionMethodIndex(int index);
00398 static int getNextActionMethodIndex();
00399 static void incNextActionMethodIndex();
00400
00401
00402 SoNode();
00403 virtual ~SoNode();
00404
00405 private:
00406
00407 uint64_t m_uniqueId;
00408
00409
00410 static int nextActionMethodIndex;
00411
00412
00413
00414 static void callbackS(SoAction *, SoNode *);
00415 static void GLRenderS(SoAction *, SoNode *);
00416 static void getBoundingBoxS(SoAction *, SoNode *);
00417 static void getMatrixS(SoAction *, SoNode *);
00418 static void handleEventS(SoAction *, SoNode *);
00419 static void pickS(SoAction *, SoNode *);
00420 static void rayPickS(SoAction *, SoNode *);
00421 static void searchS(SoAction *, SoNode *);
00422 static void writeS(SoAction *, SoNode *);
00423 static void getPrimitiveCountS(SoAction *, SoNode *);
00424
00425 static void distributeS(SoAction *, SoNode *);
00426
00427 void commonConstructor();
00428
00429
00430 template < class SPEC_ACTION >
00431 static void traverseS(SoAction *action, SoNode *node);
00432
00433 SoNode* getNodeToTraverse(SoAction* action, bool force = false);
00434
00435 SoNode* m_cachedAlternateRep;
00436
00437 private:
00438
00439
00440
00441 SbProjectionCoordinates *getProjectionCoordinates(){return m_projCoords;}
00442
00443 void setProjectionCoordinates(SbProjectionCoordinates *projCoords){
00444 m_projCoords = projCoords;
00445 }
00446
00447
00448 private:
00449 SbProjectionCoordinates *m_projCoords;
00450
00451 private:
00452
00453
00454 static bool s_catchGLError;
00455
00456
00457 friend class SoTraversalPassImpl;
00458 friend class SoLdmValuationAction;
00459 friend class SoPath;
00460 friend class SoLightPath;
00461 friend class SoAction;
00462 friend class StringConcatCallback;
00463 friend class SoChildList;
00464 friend class SoCacheElement;
00465 friend class inventor::impl::SoCachedGroupImpl;
00466 friend class inventor::node::SoConstNode;
00467 };
00468
00469 SoNode*
00470 SoNode::getAlternateRep(SoAction*)
00471 {
00472 return this;
00473 }
00474
00475 SbBool
00476 SoNode::isBoundingBoxIgnoring() const
00477 {
00478 return FALSE;
00479 }
00480
00481 void
00482 SoNode::setOverride(const SbBool)
00483 {
00484 #if defined(_DEBUG)
00485 SoDebugError::postWarning("SoNode::setOverride","not reimplemented and supported for this inherited node");
00486 #endif
00487 }
00488
00489 SbBool
00490 SoNode::isOverride() const
00491 {
00492 return FALSE;
00493 }
00494
00495 #ifdef _WIN32
00496 #pragma warning(pop)
00497 #endif
00498
00499 #endif
00500
00501