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 #ifndef _OSGNODEIMPL_INL_
00038 #define _OSGNODEIMPL_INL_
00039
00040 #ifdef OSG_DOC_FILES_IN_MODULE
00041
00044 #endif
00045
00046 #include <stdlib.h>
00047 #include <stdio.h>
00048
00049 #include "OSGConfig.h"
00050
00051 OSG_BEGIN_NAMESPACE
00052
00053
00054
00055
00056 inline
00057 const DynamicVolume &Node::getVolume(void) const
00058 {
00059 return _sfVolume.getValue();
00060 }
00061
00062 inline
00063 DynamicVolume &Node::getVolume(bool update)
00064 {
00065 if(update == true)
00066 updateVolume();
00067
00068 return _sfVolume.getValue();
00069 }
00070
00071 inline
00072 NodePtr Node::getParent(void)
00073 {
00074 return _sfParent.getValue();
00075 }
00076
00077 inline
00078 UInt32 Node::getNChildren(void) const
00079 {
00080 return _mfChildren.size();
00081 }
00082
00083 inline
00084 NodePtr Node::getChild(UInt32 childIndex)
00085 {
00086 OSG_ASSERT((childIndex < _mfChildren.size()));
00087
00088 return _mfChildren[childIndex];
00089 }
00090
00091
00092 inline
00093 UInt32 Node::getTravMask(void) const
00094 {
00095 return _sfTravMask.getValue();
00096 }
00097
00098 inline
00099 void Node::setTravMask(UInt32 val)
00100 {
00101 _sfTravMask.setValue(val);
00102 }
00103
00104 inline
00105 bool Node::getActive(void) const
00106 {
00107 return getTravMask() == TypeTraits<UInt32>::getMax();
00108 }
00109
00110 inline
00111 void Node::setActive(bool val)
00112 {
00113 _sfTravMask.setValue(val ? TypeTraits<UInt32>::getMax() :
00114 TypeTraits<UInt32>::getZeroElement() );
00115 }
00116
00117 inline
00118 void Node::setOcclusionMask(UInt8 val)
00119 {
00120 _occlusionMask = val;
00121 }
00122
00123 inline
00124 UInt8 Node::getOcclusionMask(void) const
00125 {
00126 return _occlusionMask;
00127 }
00128
00129
00130
00131
00132 inline
00133 SFDynamicVolume *Node::getSFVolume(void)
00134 {
00135 return &_sfVolume;
00136 }
00137
00138 inline
00139 SFUInt32 *Node::getSFTravMask(void)
00140 {
00141 return &_sfTravMask;
00142 }
00143
00144 inline
00145 SFNodePtr *Node::getSFParent(void)
00146 {
00147 return &_sfParent;
00148 }
00149
00150 inline
00151 SFNodeCorePtr *Node::getSFCore(void)
00152 {
00153 return &_sfCore;
00154 }
00155
00156 inline
00157 MFNodePtr *Node::getMFChildren(void)
00158 {
00159 return &_mfChildren;
00160 }
00161
00162
00163
00164
00165
00166 inline
00167 void Node::changed(BitVector whichField,
00168 UInt32 origin )
00169 {
00170 Inherited::changed(whichField, origin);
00171
00172 if(whichField & CoreFieldMask)
00173 {
00174 invalidateVolume();
00175
00176 if(origin & ChangedOrigin::Abstract)
00177 {
00178 if(origin & ChangedOrigin::AbstrIncRefCount)
00179 {
00180 addRefCP(_sfCore.getValue());
00181 }
00182 }
00183 }
00184
00185 if(whichField & TravMaskFieldMask)
00186 {
00187 beginEditCP(getParent(), Node::VolumeFieldMask);
00188 if(getParent() != NullFC)
00189 {
00190 getParent()->invalidateVolume();
00191 }
00192 else
00193 {
00194 invalidateVolume();
00195 }
00196 endEditCP(getParent(), Node::VolumeFieldMask);
00197 }
00198
00199 if(whichField & ChildrenFieldMask)
00200 {
00201 invalidateVolume();
00202
00203 if(origin & ChangedOrigin::Abstract)
00204 {
00205 if(origin & ChangedOrigin::AbstrIncRefCount)
00206 {
00207 MFNodePtr::iterator vChildIt = _mfChildren.begin();
00208 MFNodePtr::const_iterator endChildren = _mfChildren.end ();
00209
00210 while(vChildIt != endChildren)
00211 {
00212 addRefCP(*vChildIt);
00213
00214 ++vChildIt;
00215 }
00216 }
00217 }
00218 }
00219 }
00220
00221
00222
00223
00224 inline
00225 UInt32 Node::getBinSize(const BitVector &whichField)
00226 {
00227 UInt32 returnValue = Inherited::getBinSize(whichField);
00228
00229 if(FieldBits::NoField != (VolumeFieldMask & whichField))
00230 {
00231 returnValue += _sfVolume .getBinSize();
00232 }
00233
00234 if(FieldBits::NoField != (TravMaskFieldMask & whichField))
00235 {
00236 returnValue += _sfTravMask .getBinSize();
00237 }
00238
00239 if(FieldBits::NoField != (ParentFieldMask & whichField))
00240 {
00241 returnValue += _sfParent .getBinSize();
00242 }
00243
00244 if(FieldBits::NoField != (ChildrenFieldMask & whichField))
00245 {
00246 returnValue += _mfChildren .getBinSize();
00247 }
00248
00249 if(FieldBits::NoField != (CoreFieldMask & whichField))
00250 {
00251 returnValue += _sfCore .getBinSize();
00252 }
00253
00254 return returnValue;
00255 }
00256
00257 inline
00258 void Node::copyToBin( BinaryDataHandler &pMem,
00259 const BitVector &whichField)
00260 {
00261 Inherited::copyToBin(pMem, whichField);
00262
00263 if(FieldBits::NoField != (VolumeFieldMask & whichField))
00264 {
00265 _sfVolume.copyToBin(pMem);
00266 }
00267
00268 if(FieldBits::NoField != (TravMaskFieldMask & whichField))
00269 {
00270 _sfTravMask.copyToBin(pMem);
00271 }
00272
00273 if(FieldBits::NoField != (ParentFieldMask & whichField))
00274 {
00275 _sfParent.copyToBin(pMem);
00276 }
00277
00278 if(FieldBits::NoField != (ChildrenFieldMask & whichField))
00279 {
00280 _mfChildren.copyToBin(pMem);
00281 }
00282
00283 if(FieldBits::NoField != (CoreFieldMask & whichField))
00284 {
00285 _sfCore.copyToBin(pMem);
00286 }
00287 }
00288
00289 inline
00290 void Node::copyFromBin( BinaryDataHandler &pMem,
00291 const BitVector &whichField)
00292 {
00293 Inherited::copyFromBin(pMem, whichField);
00294
00295 if(FieldBits::NoField != (VolumeFieldMask & whichField))
00296 {
00297 _sfVolume.copyFromBin(pMem);
00298 }
00299
00300 if(FieldBits::NoField != (TravMaskFieldMask & whichField))
00301 {
00302 _sfTravMask.copyFromBin(pMem);
00303 }
00304
00305 if(FieldBits::NoField != (ParentFieldMask & whichField))
00306 {
00307 _sfParent.copyFromBin(pMem);
00308 }
00309
00310 if(FieldBits::NoField != (ChildrenFieldMask & whichField))
00311 {
00312 _mfChildren.copyFromBin(pMem);
00313 }
00314
00315 if(FieldBits::NoField != (CoreFieldMask & whichField))
00316 {
00317 _sfCore.copyFromBin(pMem);
00318 }
00319 }
00320
00321
00322
00323
00324
00325 inline
00326 void Node::setParent(const NodePtr &parent)
00327 {
00328 _sfParent.setValue(parent);
00329 }
00330
00331
00332
00333
00334 #if !defined(OSG_FIXED_MFIELDSYNC)
00335 inline
00336 void Node::executeSyncImpl( Node *pOther,
00337 const BitVector &whichField)
00338 {
00339 Inherited::executeSyncImpl(pOther, whichField);
00340
00341 if (FieldBits::NoField != (VolumeFieldMask & whichField))
00342 {
00343 _sfVolume.syncWith(pOther->_sfVolume);
00344 }
00345
00346 if (FieldBits::NoField != (TravMaskFieldMask & whichField))
00347 {
00348 _sfTravMask.syncWith(pOther->_sfTravMask);
00349 }
00350
00351 if (FieldBits::NoField != (ParentFieldMask & whichField))
00352 {
00353 _sfParent.syncWith(pOther->_sfParent);
00354 }
00355
00356 if (FieldBits::NoField != (ChildrenFieldMask & whichField))
00357 {
00358 _mfChildren.syncWith(pOther->_mfChildren);
00359 }
00360
00361 if (FieldBits::NoField != (CoreFieldMask & whichField))
00362 {
00363 _sfCore.syncWith(pOther->_sfCore);
00364 }
00365 }
00366
00367 inline
00368 void Node::executeSync( FieldContainer &other,
00369 const BitVector &whichField)
00370 {
00371 this->executeSyncImpl((Node *) &other, whichField);
00372 }
00373 #else
00374 inline
00375 void Node::executeSyncImpl( Node *pOther,
00376 const BitVector &whichField,
00377 const SyncInfo &sInfo )
00378 {
00379 Inherited::executeSyncImpl(pOther, whichField, sInfo);
00380
00381 if (FieldBits::NoField != (VolumeFieldMask & whichField))
00382 {
00383 _sfVolume.syncWith(pOther->_sfVolume);
00384 }
00385
00386 if (FieldBits::NoField != (TravMaskFieldMask & whichField))
00387 {
00388 _sfTravMask.syncWith(pOther->_sfTravMask);
00389 }
00390
00391 if (FieldBits::NoField != (ParentFieldMask & whichField))
00392 {
00393 _sfParent.syncWith(pOther->_sfParent);
00394 }
00395
00396 if (FieldBits::NoField != (ChildrenFieldMask & whichField))
00397 {
00398 _mfChildren.syncWith(pOther->_mfChildren, sInfo);
00399 }
00400
00401 if (FieldBits::NoField != (CoreFieldMask & whichField))
00402 {
00403 _sfCore.syncWith(pOther->_sfCore);
00404 }
00405 }
00406
00407 inline
00408 void Node::executeSync( FieldContainer &other,
00409 const BitVector &whichField,
00410 const SyncInfo &sInfo )
00411 {
00412 this->executeSyncImpl((Node *) &other, whichField, sInfo);
00413 }
00414
00415 inline
00416 void Node::execBeginEditImpl (const BitVector &whichField,
00417 UInt32 uiAspect,
00418 UInt32 uiContainerSize)
00419 {
00420 Inherited::execBeginEditImpl(whichField, uiAspect, uiContainerSize);
00421
00422 if (FieldBits::NoField != (ChildrenFieldMask & whichField))
00423 {
00424 _mfChildren.beginEdit(uiAspect, uiContainerSize);
00425 }
00426 }
00427
00428 inline
00429 void Node::execBeginEdit(const BitVector &whichField,
00430 UInt32 uiAspect,
00431 UInt32 uiContainerSize)
00432 {
00433 this->execBeginEditImpl(whichField, uiAspect, uiContainerSize);
00434 }
00435
00436
00437 #endif
00438
00439 OSG_END_NAMESPACE
00440
00441 #define OSGNODE_INLINE_CVSID "@(#)$Id: $"
00442
00443 #endif