| | 61 | |
|---|
| | 62 | class OSG_SYSTEM_DLLMAPPING Node : public AttachmentContainer |
|---|
| | 63 | { |
|---|
| | 64 | /*========================== PUBLIC =================================*/ |
|---|
| | 65 | public: |
|---|
| | 66 | /*---------------------------------------------------------------------*/ |
|---|
| | 67 | /*! \name Public Types */ |
|---|
| | 68 | /*! \{ */ |
|---|
| | 69 | |
|---|
| | 70 | typedef AttachmentContainer Inherited; |
|---|
| | 71 | typedef AttachmentContainer ParentContainer; |
|---|
| | 72 | |
|---|
| | 73 | typedef Inherited::TypeObject TypeObject; |
|---|
| | 74 | typedef TypeObject::InitPhase InitPhase; |
|---|
| | 75 | |
|---|
| | 76 | typedef SFDynamicVolume VolumeFieldType; |
|---|
| | 77 | typedef SFUInt32 TravMaskFieldType; |
|---|
| | 78 | typedef SFNodeParentPtr ParentFieldType; |
|---|
| | 79 | typedef MFNodeChildPtr ChildrenFieldType; |
|---|
| | 80 | typedef SFNodeCoreChildPtr CoreFieldType; |
|---|
| | 81 | |
|---|
| | 82 | OSG_GEN_INTERNALPTR(Node); |
|---|
| | 83 | |
|---|
| | 84 | typedef MTRefCountPtrBuilder <Node>::Ptr ObjMTRefPtr; |
|---|
| | 85 | typedef GlobalMTRefCountPtrBuilder<Node>::Ptr ObjGlobalMTRefPtr; |
|---|
| | 86 | typedef RefCountPtrBuilder <Node>::Ptr ObjRefPtr; |
|---|
| | 87 | typedef GlobalRefCountPtrBuilder <Node>::Ptr ObjGlobalRefPtr; |
|---|
| | 88 | typedef ParentPtrBuilder <Node>::Ptr ObjParentPtr; |
|---|
| | 89 | typedef WeakRefCountPtrBuilder <Node>::Ptr ObjWeakRefPtr; |
|---|
| | 90 | typedef InternalRefCountPtrBuilder<Node>::Ptr ObjInternalRefPtr; |
|---|
| | 91 | typedef TransitPtrBuilder <Node>::Ptr ObjTransitPtr; |
|---|
| | 92 | |
|---|
| | 93 | /*! \} */ |
|---|
| | 94 | /*---------------------------------------------------------------------*/ |
|---|
| | 95 | /*! \name Constants */ |
|---|
| | 96 | /*! \{ */ |
|---|
| | 97 | |
|---|
| | 98 | enum |
|---|
| | 99 | { |
|---|
| | 100 | VolumeFieldId = Inherited::NextFieldId, |
|---|
| | 101 | TravMaskFieldId = VolumeFieldId + 1, |
|---|
| | 102 | ParentFieldId = TravMaskFieldId + 1, |
|---|
| | 103 | ChildrenFieldId = ParentFieldId + 1, |
|---|
| | 104 | CoreFieldId = ChildrenFieldId + 1, |
|---|
| | 105 | NextFieldId = CoreFieldId + 1 |
|---|
| | 106 | }; |
|---|
| | 107 | |
|---|
| | 108 | static const OSG::BitVector VolumeFieldMask = |
|---|
| | 109 | (TypeTraits<BitVector>::One << VolumeFieldId); |
|---|
| | 110 | static const OSG::BitVector TravMaskFieldMask = |
|---|
| | 111 | (TypeTraits<BitVector>::One << TravMaskFieldId); |
|---|
| | 112 | static const OSG::BitVector ParentFieldMask = |
|---|
| | 113 | (TypeTraits<BitVector>::One << ParentFieldId); |
|---|
| | 114 | static const OSG::BitVector ChildrenFieldMask = |
|---|
| | 115 | (TypeTraits<BitVector>::One << ChildrenFieldId); |
|---|
| | 116 | static const OSG::BitVector CoreFieldMask = |
|---|
| | 117 | (TypeTraits<BitVector>::One << CoreFieldId); |
|---|
| | 118 | static const OSG::BitVector NextFieldMask = |
|---|
| | 119 | (TypeTraits<BitVector>::One << NextFieldId); |
|---|
| | 120 | |
|---|
| | 121 | /*! \} */ |
|---|
| | 122 | /*---------------------------------------------------------------------*/ |
|---|
| | 123 | /*! \name Class Get */ |
|---|
| | 124 | /*! \{ */ |
|---|
| | 125 | |
|---|
| | 126 | static FieldContainerType &getClassType (void); |
|---|
| | 127 | static UInt32 getClassTypeId (void); |
|---|
| | 128 | static UInt16 getClassGroupId(void); |
|---|
| | 129 | |
|---|
| | 130 | /*! \} */ |
|---|
| | 131 | /*---------------------------------------------------------------------*/ |
|---|
| | 132 | /*! \name FieldContainer Get */ |
|---|
| | 133 | /*! \{ */ |
|---|
| | 134 | |
|---|
| | 135 | virtual FieldContainerType &getType (void); |
|---|
| | 136 | virtual FieldContainerType const &getType (void) const; |
|---|
| | 137 | |
|---|
| | 138 | virtual UInt32 getContainerSize(void) const; |
|---|
| | 139 | |
|---|
| | 140 | /*! \} */ |
|---|
| | 141 | /*---------------------------------------------------------------------*/ |
|---|
| | 142 | /*! \name Field SFVolume */ |
|---|
| | 143 | /*! \{ */ |
|---|
| | 144 | |
|---|
| | 145 | SFDynamicVolume *editSFVolume(bool update = false); |
|---|
| | 146 | SFDynamicVolume const *getSFVolume (bool update = false); |
|---|
| | 147 | #ifdef OSG_1_GET_COMPAT |
|---|
| | 148 | SFDynamicVolume *getSFVolume (bool update = false); |
|---|
| | 149 | #endif |
|---|
| | 150 | SFDynamicVolume::reference editVolume(bool update = false); |
|---|
| | 151 | SFDynamicVolume::const_reference getVolume (bool update = false); |
|---|
| | 152 | #ifdef OSG_1_GET_COMPAT |
|---|
| | 153 | SFDynamicVolume::reference getVolume (bool update = false); |
|---|
| | 154 | #endif |
|---|
| | 155 | void setVolume(SFDynamicVolume::ArgumentType value); |
|---|
| | 156 | |
|---|
| | 157 | |
|---|
| | 158 | void getWorldVolume (DynamicVolume &result); |
|---|
| | 159 | |
|---|
| | 160 | void updateVolume (void ); |
|---|
| | 161 | virtual void invalidateVolume(void ); |
|---|
| | 162 | |
|---|
| | 163 | /*! \} */ |
|---|
| | 164 | /*---------------------------------------------------------------------*/ |
|---|
| | 165 | /*! \name Field SFTravMask */ |
|---|
| | 166 | /*! \{ */ |
|---|
| | 167 | |
|---|
| | 168 | SFUInt32 *editSFTravMask(void); |
|---|
| | 169 | SFUInt32 const *getSFTravMask (void) const; |
|---|
| | 170 | #ifdef OSG_1_GET_COMPAT |
|---|
| | 171 | SFUInt32 *getSFTravMask (void); |
|---|
| | 172 | #endif |
|---|
| | 173 | SFUInt32::reference editTravMask(void); |
|---|
| | 174 | SFUInt32::const_reference getTravMask (void) const; |
|---|
| | 175 | #ifdef OSG_1_GET_COMPAT |
|---|
| | 176 | SFUInt32::reference getTravMask (void); |
|---|
| | 177 | #endif |
|---|
| | 178 | void setTravMask(SFUInt32::ArgumentType value); |
|---|
| | 179 | |
|---|
| | 180 | #ifdef OSG_1_COMPAT |
|---|
| | 181 | bool getActive (void ) const; |
|---|
| | 182 | void setActive (bool val); |
|---|
| | 183 | |
|---|
| | 184 | void setOcclusionMask(UInt8 val); |
|---|
| | 185 | UInt8 getOcclusionMask(void ) const; |
|---|
| | 186 | #endif |
|---|
| | 187 | |
|---|
| | 188 | /*! \} */ |
|---|
| | 189 | /*---------------------------------------------------------------------*/ |
|---|
| | 190 | /*! \name Field SFParent */ |
|---|
| | 191 | /*! \{ */ |
|---|
| | 192 | |
|---|
| | 193 | SFNodeParentPtr const *getSFParent(void) const; |
|---|
| | 194 | SFNodeParentPtr::const_reference getParent(void) const; |
|---|
| | 195 | |
|---|
| | 196 | /*! \} */ |
|---|
| | 197 | /*---------------------------------------------------------------------*/ |
|---|
| | 198 | /*! \name Field MFChildren */ |
|---|
| | 199 | /*! \{ */ |
|---|
| | 200 | |
|---|
| | 201 | MFNodeChildPtr *editMFChildren(void); |
|---|
| | 202 | MFNodeChildPtr const *getMFChildren(void) const; |
|---|
| | 203 | #ifdef OSG_1_GET_COMPAT |
|---|
| | 204 | MFNodeChildPtr *getMFChildren (void); |
|---|
| | 205 | #endif |
|---|
| | 206 | |
|---|
| | 207 | MFNodeChildPtr &editChildren(void); |
|---|
| | 208 | MFNodeChildPtr const &getChildren (void) const; |
|---|
| | 209 | MFNodeChildPtr::reference editChildren(UInt32 const index); |
|---|
| | 210 | MFNodeChildPtr::const_reference getChildren (UInt32 const index) const; |
|---|
| | 211 | #ifdef OSG_1_GET_COMPAT |
|---|
| | 212 | MFNodeChildPtr::const_reference getChildren (UInt32 const index); |
|---|
| | 213 | MFNodeChildPtr &getChildren(void); |
|---|
| | 214 | #endif |
|---|
| | 215 | |
|---|
| | 216 | void addChildren(MFNodeChildPtr::ArgumentType value); |
|---|
| | 217 | void assignChildren(MFNodeChildPtr const &value); |
|---|
| | 218 | void insertChildren( |
|---|
| | 219 | UInt32 const uiIndex, |
|---|
| | 220 | MFNodeChildPtr::ArgumentType value); |
|---|
| | 221 | void replaceChildren( |
|---|
| | 222 | UInt32 const uiIndex, |
|---|
| | 223 | MFNodeChildPtr::ArgumentType value); |
|---|
| | 224 | bool replaceChildren( |
|---|
| | 225 | MFNodeChildPtr::ArgumentType pOldElem, |
|---|
| | 226 | MFNodeChildPtr::ArgumentType pNewElem ); |
|---|
| | 227 | void subChildren(UInt32 const uiIndex); |
|---|
| | 228 | bool subChildren(MFNodeChildPtr::ArgumentType value); |
|---|
| | 229 | void clearChildren(void); |
|---|
| | 230 | |
|---|
| | 231 | // This is the old (handwritten) interface: |
|---|
| | 232 | UInt32 getNChildren (void ) const; |
|---|
| | 233 | |
|---|
| | 234 | void addChild (NodePtrConstArg childP ); |
|---|
| | 235 | |
|---|
| | 236 | void insertChild (UInt32 childIndex, |
|---|
| | 237 | NodePtrConstArg childP ); |
|---|
| | 238 | |
|---|
| | 239 | void replaceChild (UInt32 childIndex, |
|---|
| | 240 | NodePtrConstArg childP ); |
|---|
| | 241 | |
|---|
| | 242 | bool replaceChildBy(NodePtrConstArg childP, |
|---|
| | 243 | NodePtrConstArg newChildP ); |
|---|
| | 244 | |
|---|
| | 245 | Int32 findChild (NodePtrConstArg childP ) const; |
|---|
| | 246 | |
|---|
| | 247 | bool subChild (NodePtrConstArg childP ); |
|---|
| | 248 | void subChild (UInt32 childIndex); |
|---|
| | 249 | |
|---|
| | 250 | NodePtr getChild (UInt32 childIndex) const; |
|---|
| | 251 | |
|---|
| | 252 | /*! \} */ |
|---|
| | 253 | /*---------------------------------------------------------------------*/ |
|---|
| | 254 | /*! \name Field SFCore */ |
|---|
| | 255 | /*! \{ */ |
|---|
| | 256 | |
|---|
| | 257 | SFNodeCoreChildPtr *editSFCore(void); |
|---|
| | 258 | SFNodeCoreChildPtr const *getSFCore (void) const; |
|---|
| | 259 | #ifdef OSG_1_GET_COMPAT |
|---|
| | 260 | SFNodeCoreChildPtr *getSFCore (void); |
|---|
| | 261 | #endif |
|---|
| | 262 | SFNodeCoreChildPtr::reference editCore(void); |
|---|
| | 263 | SFNodeCoreChildPtr::const_reference getCore (void) const; |
|---|
| | 264 | #ifdef OSG_1_GET_COMPAT |
|---|
| | 265 | SFNodeCoreChildPtr::reference getCore (void); |
|---|
| | 266 | #endif |
|---|
| | 267 | void setCore(SFNodeCoreChildPtr::ArgumentType value); |
|---|
| | 268 | |
|---|
| | 269 | /*! \} */ |
|---|
| | 270 | /*---------------------------------------------------------------------*/ |
|---|
| | 271 | /*! \name Transformation Access */ |
|---|
| | 272 | /*! \{ */ |
|---|
| | 273 | |
|---|
| | 274 | Matrixr getToWorld(void ); |
|---|
| | 275 | void getToWorld(Matrixr &result); |
|---|
| | 276 | |
|---|
| | 277 | /*! \} */ |
|---|
| | 278 | /*---------------------------------------------------------------------*/ |
|---|
| | 279 | /*! \name Changed */ |
|---|
| | 280 | /*! \{ */ |
|---|
| | 281 | |
|---|
| | 282 | virtual void changed(ConstFieldMaskArg whichField, |
|---|
| | 283 | UInt32 origin, |
|---|
| | 284 | BitVector details); |
|---|
| | 285 | |
|---|
| | 286 | /*! \} */ |
|---|
| | 287 | /*---------------------------------------------------------------------*/ |
|---|
| | 288 | /*! \name Dump */ |
|---|
| | 289 | /*! \{ */ |
|---|
| | 290 | |
|---|
| | 291 | virtual void dump( UInt32 uiIndent = 0, |
|---|
| | 292 | const BitVector bvFlags = 0) const; |
|---|
| | 293 | |
|---|
| | 294 | /*! \} */ |
|---|
| | 295 | /*---------------------------------------------------------------------*/ |
|---|
| | 296 | /*! \name Binary Access */ |
|---|
| | 297 | /*! \{ */ |
|---|
| | 298 | |
|---|
| | 299 | virtual UInt32 getBinSize (ConstFieldMaskArg whichField); |
|---|
| | 300 | virtual void copyToBin (BinaryDataHandler &pMem, |
|---|
| | 301 | ConstFieldMaskArg whichField); |
|---|
| | 302 | virtual void copyFromBin(BinaryDataHandler &pMem, |
|---|
| | 303 | ConstFieldMaskArg whichField); |
|---|
| | 304 | |
|---|
| | 305 | /*! \} */ |
|---|
| | 306 | /*---------------------------------------------------------------------*/ |
|---|
| | 307 | /*! \name Parent linking */ |
|---|
| | 308 | /*! \{ */ |
|---|
| | 309 | |
|---|
| | 310 | virtual bool linkParent (ReflexiveContainer * const pParent, |
|---|
| | 311 | UInt16 const childrenFieldId, |
|---|
| | 312 | UInt16 const parentFieldId ); |
|---|
| | 313 | virtual bool unlinkParent(ReflexiveContainer * const pParent, |
|---|
| | 314 | UInt16 const childrenFieldId, |
|---|
| | 315 | UInt16 const parentFieldId ); |
|---|
| | 316 | |
|---|
| | 317 | /*! \} */ |
|---|
| | 318 | /*---------------------------------------------------------------------*/ |
|---|
| | 319 | /*! \name Child linking */ |
|---|
| | 320 | /*! \{ */ |
|---|
| | 321 | |
|---|
| | 322 | virtual bool unlinkChild(ReflexiveContainer * const pChild, |
|---|
| | 323 | UInt16 const childrenFieldId); |
|---|
| | 324 | |
|---|
| | 325 | /*! \} */ |
|---|
| | 326 | /*---------------------------------------------------------------------*/ |
|---|
| | 327 | /*! \name Construction */ |
|---|
| | 328 | /*! \{ */ |
|---|
| | 329 | |
|---|
| | 330 | static ObjTransitPtr create (void); |
|---|
| | 331 | static NodePtr createEmpty(void); |
|---|
| | 332 | |
|---|
| | 333 | /*! \} */ |
|---|
| | 334 | /*---------------------------------------------------------------------*/ |
|---|
| | 335 | /*! \name Copy */ |
|---|
| | 336 | /*! \{ */ |
|---|
| | 337 | |
|---|
| | 338 | virtual FieldContainerTransitPtr shallowCopy(void) const; |
|---|
| | 339 | |
|---|
| | 340 | /*! \} */ |
|---|
| | 341 | /*========================= PROTECTED ===============================*/ |
|---|
| | 342 | protected: |
|---|
| | 343 | |
|---|
| | 344 | static TypeObject _type; |
|---|
| | 345 | |
|---|
| | 346 | static void classDescInserter(TypeObject &oType); |
|---|
| | 347 | static Char8 const *getClassname (void ); |
|---|
| | 348 | |
|---|
| | 349 | /*---------------------------------------------------------------------*/ |
|---|
| | 350 | /*! \name Fields */ |
|---|
| | 351 | /*! \{ */ |
|---|
| | 352 | |
|---|
| | 353 | SFDynamicVolume _sfVolume; |
|---|
| | 354 | SFUInt32 _sfTravMask; |
|---|
| | 355 | SFNodeParentPtr _sfParent; |
|---|
| | 356 | MFNodeChildPtr _mfChildren; |
|---|
| | 357 | SFNodeCoreChildPtr _sfCore; |
|---|
| | 358 | |
|---|
| | 359 | #ifdef OSG_1_COMPAT |
|---|
| | 360 | UInt8 _occlusionMask; |
|---|
| | 361 | #endif |
|---|
| | 362 | |
|---|
| | 363 | /*! \} */ |
|---|
| | 364 | /*---------------------------------------------------------------------*/ |
|---|
| | 365 | /*! \name Constructors */ |
|---|
| | 366 | /*! \{ */ |
|---|
| | 367 | |
|---|
| | 368 | Node(void); |
|---|
| | 369 | Node(Node const &source); |
|---|
| | 370 | |
|---|
| | 371 | /*! \} */ |
|---|
| | 372 | /*---------------------------------------------------------------------*/ |
|---|
| | 373 | /*! \name Destructors */ |
|---|
| | 374 | /*! \{ */ |
|---|
| | 375 | |
|---|
| | 376 | virtual ~Node(void); |
|---|
| | 377 | |
|---|
| | 378 | /*! \} */ |
|---|
| | 379 | /*---------------------------------------------------------------------*/ |
|---|
| | 380 | /*! \name onCreate */ |
|---|
| | 381 | /*! \{ */ |
|---|
| | 382 | |
|---|
| | 383 | void onCreate(Node const *source = NULL); |
|---|
| | 384 | |
|---|
| | 385 | /*! \} */ |
|---|
| | 386 | /*---------------------------------------------------------------------*/ |
|---|
| | 387 | /*! \name Generic Field Access */ |
|---|
| | 388 | /*! \{ */ |
|---|
| | 389 | |
|---|
| | 390 | GetFieldHandlePtr getHandleVolume (void) const; |
|---|
| | 391 | EditFieldHandlePtr editHandleVolume (void); |
|---|
| | 392 | GetFieldHandlePtr getHandleTravMask (void) const; |
|---|
| | 393 | EditFieldHandlePtr editHandleTravMask (void); |
|---|
| | 394 | GetFieldHandlePtr getHandleParent (void) const; |
|---|
| | 395 | GetFieldHandlePtr getHandleChildren (void) const; |
|---|
| | 396 | EditFieldHandlePtr editHandleChildren (void); |
|---|
| | 397 | GetFieldHandlePtr getHandleCore (void) const; |
|---|
| | 398 | EditFieldHandlePtr editHandleCore (void); |
|---|
| | 399 | |
|---|
| | 400 | /*! \} */ |
|---|
| | 401 | /*---------------------------------------------------------------------*/ |
|---|
| | 402 | /*! \name Sync */ |
|---|
| | 403 | /*! \{ */ |
|---|
| | 404 | |
|---|
| | 405 | #ifdef OSG_MT_CPTR_ASPECT |
|---|
| | 406 | virtual void execSyncV(FieldContainer &oFrom, |
|---|
| | 407 | ConstFieldMaskArg whichField, |
|---|
| | 408 | AspectOffsetStore &oOffsets, |
|---|
| | 409 | ConstFieldMaskArg syncMode, |
|---|
| | 410 | UInt32 const uiSyncInfo); |
|---|
| | 411 | |
|---|
| | 412 | void execSync (Node *pFrom, |
|---|
| | 413 | ConstFieldMaskArg whichField, |
|---|
| | 414 | AspectOffsetStore &oOffsets, |
|---|
| | 415 | ConstFieldMaskArg syncMode, |
|---|
| | 416 | UInt32 const uiSyncInfo); |
|---|
| | 417 | #endif |
|---|
| | 418 | |
|---|
| | 419 | /*! \} */ |
|---|
| | 420 | /*---------------------------------------------------------------------*/ |
|---|
| | 421 | /*! \name Aspect Create */ |
|---|
| | 422 | /*! \{ */ |
|---|
| | 423 | |
|---|
| | 424 | #ifdef OSG_MT_CPTR_ASPECT |
|---|
| | 425 | virtual FieldContainerPtr createAspectCopy(void) const; |
|---|
| | 426 | #endif |
|---|
| | 427 | |
|---|
| | 428 | /*! \} */ |
|---|
| | 429 | /*---------------------------------------------------------------------*/ |
|---|
| | 430 | /*! \name Sync */ |
|---|
| | 431 | /*! \{ */ |
|---|
| | 432 | |
|---|
| | 433 | virtual void resolveLinks(void); |
|---|
| | 434 | |
|---|
| | 435 | /*! \} */ |
|---|
| | 436 | /*========================== PRIVATE ================================*/ |
|---|
| | 437 | private: |
|---|
| | 438 | friend class FieldContainer; |
|---|
| | 439 | |
|---|
| | 440 | friend struct PointerFuncs; |
|---|
| | 441 | friend struct CPointerFuncs; |
|---|
| | 442 | |
|---|
| | 443 | // prohibit default functions (move to 'public' if you need one) |
|---|
| | 444 | void operator =(const Node &source); |
|---|
| | 445 | }; |
|---|
| | 446 | |
|---|
| | 447 | typedef Node::ObjRefPtr NodeRefPtr; |
|---|
| | 448 | typedef Node::ObjGlobalRefPtr NodeGlobalRefPtr; |
|---|
| | 449 | typedef Node::ObjMTRefPtr NodeMTRefPtr; |
|---|
| | 450 | typedef Node::ObjGlobalMTRefPtr NodeGlobalMTRefPtr; |
|---|
| | 451 | typedef Node::ObjWeakRefPtr NodeWeakRefPtr; |
|---|
| | 452 | typedef Node::ObjParentPtr NodeParentPtr; |
|---|
| | 453 | typedef Node::ObjInternalRefPtr NodeInternalRefPtr; |
|---|
| | 454 | typedef Node::ObjTransitPtr NodeTransitPtr; |
|---|
| | 455 | |
|---|
| | 456 | |
|---|
| | 457 | |
|---|
| | 458 | |
|---|
| | 459 | #if 0 |
|---|