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
00052
00053
00054 #define OSG_COMPILEVIEWPORTINST
00055
00056 #include <stdlib.h>
00057 #include <stdio.h>
00058
00059 #include <OSGConfig.h>
00060
00061 #include "OSGViewportBase.h"
00062 #include "OSGViewport.h"
00063
00064
00065 OSG_USING_NAMESPACE
00066
00067 const OSG::BitVector ViewportBase::LeftFieldMask =
00068 (TypeTraits<BitVector>::One << ViewportBase::LeftFieldId);
00069
00070 const OSG::BitVector ViewportBase::RightFieldMask =
00071 (TypeTraits<BitVector>::One << ViewportBase::RightFieldId);
00072
00073 const OSG::BitVector ViewportBase::BottomFieldMask =
00074 (TypeTraits<BitVector>::One << ViewportBase::BottomFieldId);
00075
00076 const OSG::BitVector ViewportBase::TopFieldMask =
00077 (TypeTraits<BitVector>::One << ViewportBase::TopFieldId);
00078
00079 const OSG::BitVector ViewportBase::ParentFieldMask =
00080 (TypeTraits<BitVector>::One << ViewportBase::ParentFieldId);
00081
00082 const OSG::BitVector ViewportBase::CameraFieldMask =
00083 (TypeTraits<BitVector>::One << ViewportBase::CameraFieldId);
00084
00085 const OSG::BitVector ViewportBase::RootFieldMask =
00086 (TypeTraits<BitVector>::One << ViewportBase::RootFieldId);
00087
00088 const OSG::BitVector ViewportBase::BackgroundFieldMask =
00089 (TypeTraits<BitVector>::One << ViewportBase::BackgroundFieldId);
00090
00091 const OSG::BitVector ViewportBase::ForegroundsFieldMask =
00092 (TypeTraits<BitVector>::One << ViewportBase::ForegroundsFieldId);
00093
00094 const OSG::BitVector ViewportBase::TravMaskFieldMask =
00095 (TypeTraits<BitVector>::One << ViewportBase::TravMaskFieldId);
00096
00097 const OSG::BitVector ViewportBase::DrawTimeFieldMask =
00098 (TypeTraits<BitVector>::One << ViewportBase::DrawTimeFieldId);
00099
00100 const OSG::BitVector ViewportBase::MTInfluenceMask =
00101 (Inherited::MTInfluenceMask) |
00102 (static_cast<BitVector>(0x0) << Inherited::NextFieldId);
00103
00104
00105
00106
00141
00142
00143 FieldDescription *ViewportBase::_desc[] =
00144 {
00145 new FieldDescription(SFReal32::getClassType(),
00146 "left",
00147 LeftFieldId, LeftFieldMask,
00148 false,
00149 (FieldAccessMethod) &ViewportBase::getSFLeft),
00150 new FieldDescription(SFReal32::getClassType(),
00151 "right",
00152 RightFieldId, RightFieldMask,
00153 false,
00154 (FieldAccessMethod) &ViewportBase::getSFRight),
00155 new FieldDescription(SFReal32::getClassType(),
00156 "bottom",
00157 BottomFieldId, BottomFieldMask,
00158 false,
00159 (FieldAccessMethod) &ViewportBase::getSFBottom),
00160 new FieldDescription(SFReal32::getClassType(),
00161 "top",
00162 TopFieldId, TopFieldMask,
00163 false,
00164 (FieldAccessMethod) &ViewportBase::getSFTop),
00165 new FieldDescription(SFWindowPtr::getClassType(),
00166 "parent",
00167 ParentFieldId, ParentFieldMask,
00168 false,
00169 (FieldAccessMethod) &ViewportBase::getSFParent),
00170 new FieldDescription(SFCameraPtr::getClassType(),
00171 "camera",
00172 CameraFieldId, CameraFieldMask,
00173 false,
00174 (FieldAccessMethod) &ViewportBase::getSFCamera),
00175 new FieldDescription(SFNodePtr::getClassType(),
00176 "root",
00177 RootFieldId, RootFieldMask,
00178 false,
00179 (FieldAccessMethod) &ViewportBase::getSFRoot),
00180 new FieldDescription(SFBackgroundPtr::getClassType(),
00181 "background",
00182 BackgroundFieldId, BackgroundFieldMask,
00183 false,
00184 (FieldAccessMethod) &ViewportBase::getSFBackground),
00185 new FieldDescription(MFForegroundPtr::getClassType(),
00186 "foregrounds",
00187 ForegroundsFieldId, ForegroundsFieldMask,
00188 false,
00189 (FieldAccessMethod) &ViewportBase::getMFForegrounds),
00190 new FieldDescription(SFUInt32::getClassType(),
00191 "travMask",
00192 TravMaskFieldId, TravMaskFieldMask,
00193 false,
00194 (FieldAccessMethod) &ViewportBase::getSFTravMask),
00195 new FieldDescription(SFReal32::getClassType(),
00196 "drawTime",
00197 DrawTimeFieldId, DrawTimeFieldMask,
00198 true,
00199 (FieldAccessMethod) &ViewportBase::getSFDrawTime)
00200 };
00201
00202
00203 FieldContainerType ViewportBase::_type(
00204 "Viewport",
00205 "AttachmentContainer",
00206 NULL,
00207 (PrototypeCreateF) &ViewportBase::createEmpty,
00208 Viewport::initMethod,
00209 _desc,
00210 sizeof(_desc));
00211
00212
00213
00214
00215
00216 FieldContainerType &ViewportBase::getType(void)
00217 {
00218 return _type;
00219 }
00220
00221 const FieldContainerType &ViewportBase::getType(void) const
00222 {
00223 return _type;
00224 }
00225
00226
00227 FieldContainerPtr ViewportBase::shallowCopy(void) const
00228 {
00229 ViewportPtr returnValue;
00230
00231 newPtr(returnValue, dynamic_cast<const Viewport *>(this));
00232
00233 return returnValue;
00234 }
00235
00236 UInt32 ViewportBase::getContainerSize(void) const
00237 {
00238 return sizeof(Viewport);
00239 }
00240
00241
00242 #if !defined(OSG_FIXED_MFIELDSYNC)
00243 void ViewportBase::executeSync( FieldContainer &other,
00244 const BitVector &whichField)
00245 {
00246 this->executeSyncImpl((ViewportBase *) &other, whichField);
00247 }
00248 #else
00249 void ViewportBase::executeSync( FieldContainer &other,
00250 const BitVector &whichField, const SyncInfo &sInfo )
00251 {
00252 this->executeSyncImpl((ViewportBase *) &other, whichField, sInfo);
00253 }
00254 void ViewportBase::execBeginEdit(const BitVector &whichField,
00255 UInt32 uiAspect,
00256 UInt32 uiContainerSize)
00257 {
00258 this->execBeginEditImpl(whichField, uiAspect, uiContainerSize);
00259 }
00260
00261 void ViewportBase::onDestroyAspect(UInt32 uiId, UInt32 uiAspect)
00262 {
00263 Inherited::onDestroyAspect(uiId, uiAspect);
00264
00265 _mfForegrounds.terminateShare(uiAspect, this->getContainerSize());
00266 }
00267 #endif
00268
00269
00270
00271 #ifdef OSG_WIN32_ICL
00272 #pragma warning (disable : 383)
00273 #endif
00274
00275 ViewportBase::ViewportBase(void) :
00276 _sfLeft (),
00277 _sfRight (),
00278 _sfBottom (),
00279 _sfTop (),
00280 _sfParent (),
00281 _sfCamera (),
00282 _sfRoot (),
00283 _sfBackground (),
00284 _mfForegrounds (),
00285 _sfTravMask (UInt32(TypeTraits<UInt32>::getMax())),
00286 _sfDrawTime (Real32(0.0f)),
00287 Inherited()
00288 {
00289 }
00290
00291 #ifdef OSG_WIN32_ICL
00292 #pragma warning (default : 383)
00293 #endif
00294
00295 ViewportBase::ViewportBase(const ViewportBase &source) :
00296 _sfLeft (source._sfLeft ),
00297 _sfRight (source._sfRight ),
00298 _sfBottom (source._sfBottom ),
00299 _sfTop (source._sfTop ),
00300 _sfParent (source._sfParent ),
00301 _sfCamera (source._sfCamera ),
00302 _sfRoot (source._sfRoot ),
00303 _sfBackground (source._sfBackground ),
00304 _mfForegrounds (source._mfForegrounds ),
00305 _sfTravMask (source._sfTravMask ),
00306 _sfDrawTime (source._sfDrawTime ),
00307 Inherited (source)
00308 {
00309 }
00310
00311
00312
00313 ViewportBase::~ViewportBase(void)
00314 {
00315 }
00316
00317
00318
00319 UInt32 ViewportBase::getBinSize(const BitVector &whichField)
00320 {
00321 UInt32 returnValue = Inherited::getBinSize(whichField);
00322
00323 if(FieldBits::NoField != (LeftFieldMask & whichField))
00324 {
00325 returnValue += _sfLeft.getBinSize();
00326 }
00327
00328 if(FieldBits::NoField != (RightFieldMask & whichField))
00329 {
00330 returnValue += _sfRight.getBinSize();
00331 }
00332
00333 if(FieldBits::NoField != (BottomFieldMask & whichField))
00334 {
00335 returnValue += _sfBottom.getBinSize();
00336 }
00337
00338 if(FieldBits::NoField != (TopFieldMask & whichField))
00339 {
00340 returnValue += _sfTop.getBinSize();
00341 }
00342
00343 if(FieldBits::NoField != (ParentFieldMask & whichField))
00344 {
00345 returnValue += _sfParent.getBinSize();
00346 }
00347
00348 if(FieldBits::NoField != (CameraFieldMask & whichField))
00349 {
00350 returnValue += _sfCamera.getBinSize();
00351 }
00352
00353 if(FieldBits::NoField != (RootFieldMask & whichField))
00354 {
00355 returnValue += _sfRoot.getBinSize();
00356 }
00357
00358 if(FieldBits::NoField != (BackgroundFieldMask & whichField))
00359 {
00360 returnValue += _sfBackground.getBinSize();
00361 }
00362
00363 if(FieldBits::NoField != (ForegroundsFieldMask & whichField))
00364 {
00365 returnValue += _mfForegrounds.getBinSize();
00366 }
00367
00368 if(FieldBits::NoField != (TravMaskFieldMask & whichField))
00369 {
00370 returnValue += _sfTravMask.getBinSize();
00371 }
00372
00373 if(FieldBits::NoField != (DrawTimeFieldMask & whichField))
00374 {
00375 returnValue += _sfDrawTime.getBinSize();
00376 }
00377
00378
00379 return returnValue;
00380 }
00381
00382 void ViewportBase::copyToBin( BinaryDataHandler &pMem,
00383 const BitVector &whichField)
00384 {
00385 Inherited::copyToBin(pMem, whichField);
00386
00387 if(FieldBits::NoField != (LeftFieldMask & whichField))
00388 {
00389 _sfLeft.copyToBin(pMem);
00390 }
00391
00392 if(FieldBits::NoField != (RightFieldMask & whichField))
00393 {
00394 _sfRight.copyToBin(pMem);
00395 }
00396
00397 if(FieldBits::NoField != (BottomFieldMask & whichField))
00398 {
00399 _sfBottom.copyToBin(pMem);
00400 }
00401
00402 if(FieldBits::NoField != (TopFieldMask & whichField))
00403 {
00404 _sfTop.copyToBin(pMem);
00405 }
00406
00407 if(FieldBits::NoField != (ParentFieldMask & whichField))
00408 {
00409 _sfParent.copyToBin(pMem);
00410 }
00411
00412 if(FieldBits::NoField != (CameraFieldMask & whichField))
00413 {
00414 _sfCamera.copyToBin(pMem);
00415 }
00416
00417 if(FieldBits::NoField != (RootFieldMask & whichField))
00418 {
00419 _sfRoot.copyToBin(pMem);
00420 }
00421
00422 if(FieldBits::NoField != (BackgroundFieldMask & whichField))
00423 {
00424 _sfBackground.copyToBin(pMem);
00425 }
00426
00427 if(FieldBits::NoField != (ForegroundsFieldMask & whichField))
00428 {
00429 _mfForegrounds.copyToBin(pMem);
00430 }
00431
00432 if(FieldBits::NoField != (TravMaskFieldMask & whichField))
00433 {
00434 _sfTravMask.copyToBin(pMem);
00435 }
00436
00437 if(FieldBits::NoField != (DrawTimeFieldMask & whichField))
00438 {
00439 _sfDrawTime.copyToBin(pMem);
00440 }
00441
00442
00443 }
00444
00445 void ViewportBase::copyFromBin( BinaryDataHandler &pMem,
00446 const BitVector &whichField)
00447 {
00448 Inherited::copyFromBin(pMem, whichField);
00449
00450 if(FieldBits::NoField != (LeftFieldMask & whichField))
00451 {
00452 _sfLeft.copyFromBin(pMem);
00453 }
00454
00455 if(FieldBits::NoField != (RightFieldMask & whichField))
00456 {
00457 _sfRight.copyFromBin(pMem);
00458 }
00459
00460 if(FieldBits::NoField != (BottomFieldMask & whichField))
00461 {
00462 _sfBottom.copyFromBin(pMem);
00463 }
00464
00465 if(FieldBits::NoField != (TopFieldMask & whichField))
00466 {
00467 _sfTop.copyFromBin(pMem);
00468 }
00469
00470 if(FieldBits::NoField != (ParentFieldMask & whichField))
00471 {
00472 _sfParent.copyFromBin(pMem);
00473 }
00474
00475 if(FieldBits::NoField != (CameraFieldMask & whichField))
00476 {
00477 _sfCamera.copyFromBin(pMem);
00478 }
00479
00480 if(FieldBits::NoField != (RootFieldMask & whichField))
00481 {
00482 _sfRoot.copyFromBin(pMem);
00483 }
00484
00485 if(FieldBits::NoField != (BackgroundFieldMask & whichField))
00486 {
00487 _sfBackground.copyFromBin(pMem);
00488 }
00489
00490 if(FieldBits::NoField != (ForegroundsFieldMask & whichField))
00491 {
00492 _mfForegrounds.copyFromBin(pMem);
00493 }
00494
00495 if(FieldBits::NoField != (TravMaskFieldMask & whichField))
00496 {
00497 _sfTravMask.copyFromBin(pMem);
00498 }
00499
00500 if(FieldBits::NoField != (DrawTimeFieldMask & whichField))
00501 {
00502 _sfDrawTime.copyFromBin(pMem);
00503 }
00504
00505
00506 }
00507
00508 #if !defined(OSG_FIXED_MFIELDSYNC)
00509 void ViewportBase::executeSyncImpl( ViewportBase *pOther,
00510 const BitVector &whichField)
00511 {
00512
00513 Inherited::executeSyncImpl(pOther, whichField);
00514
00515 if(FieldBits::NoField != (LeftFieldMask & whichField))
00516 _sfLeft.syncWith(pOther->_sfLeft);
00517
00518 if(FieldBits::NoField != (RightFieldMask & whichField))
00519 _sfRight.syncWith(pOther->_sfRight);
00520
00521 if(FieldBits::NoField != (BottomFieldMask & whichField))
00522 _sfBottom.syncWith(pOther->_sfBottom);
00523
00524 if(FieldBits::NoField != (TopFieldMask & whichField))
00525 _sfTop.syncWith(pOther->_sfTop);
00526
00527 if(FieldBits::NoField != (ParentFieldMask & whichField))
00528 _sfParent.syncWith(pOther->_sfParent);
00529
00530 if(FieldBits::NoField != (CameraFieldMask & whichField))
00531 _sfCamera.syncWith(pOther->_sfCamera);
00532
00533 if(FieldBits::NoField != (RootFieldMask & whichField))
00534 _sfRoot.syncWith(pOther->_sfRoot);
00535
00536 if(FieldBits::NoField != (BackgroundFieldMask & whichField))
00537 _sfBackground.syncWith(pOther->_sfBackground);
00538
00539 if(FieldBits::NoField != (ForegroundsFieldMask & whichField))
00540 _mfForegrounds.syncWith(pOther->_mfForegrounds);
00541
00542 if(FieldBits::NoField != (TravMaskFieldMask & whichField))
00543 _sfTravMask.syncWith(pOther->_sfTravMask);
00544
00545 if(FieldBits::NoField != (DrawTimeFieldMask & whichField))
00546 _sfDrawTime.syncWith(pOther->_sfDrawTime);
00547
00548
00549 }
00550 #else
00551 void ViewportBase::executeSyncImpl( ViewportBase *pOther,
00552 const BitVector &whichField,
00553 const SyncInfo &sInfo )
00554 {
00555
00556 Inherited::executeSyncImpl(pOther, whichField, sInfo);
00557
00558 if(FieldBits::NoField != (LeftFieldMask & whichField))
00559 _sfLeft.syncWith(pOther->_sfLeft);
00560
00561 if(FieldBits::NoField != (RightFieldMask & whichField))
00562 _sfRight.syncWith(pOther->_sfRight);
00563
00564 if(FieldBits::NoField != (BottomFieldMask & whichField))
00565 _sfBottom.syncWith(pOther->_sfBottom);
00566
00567 if(FieldBits::NoField != (TopFieldMask & whichField))
00568 _sfTop.syncWith(pOther->_sfTop);
00569
00570 if(FieldBits::NoField != (ParentFieldMask & whichField))
00571 _sfParent.syncWith(pOther->_sfParent);
00572
00573 if(FieldBits::NoField != (CameraFieldMask & whichField))
00574 _sfCamera.syncWith(pOther->_sfCamera);
00575
00576 if(FieldBits::NoField != (RootFieldMask & whichField))
00577 _sfRoot.syncWith(pOther->_sfRoot);
00578
00579 if(FieldBits::NoField != (BackgroundFieldMask & whichField))
00580 _sfBackground.syncWith(pOther->_sfBackground);
00581
00582 if(FieldBits::NoField != (TravMaskFieldMask & whichField))
00583 _sfTravMask.syncWith(pOther->_sfTravMask);
00584
00585 if(FieldBits::NoField != (DrawTimeFieldMask & whichField))
00586 _sfDrawTime.syncWith(pOther->_sfDrawTime);
00587
00588
00589 if(FieldBits::NoField != (ForegroundsFieldMask & whichField))
00590 _mfForegrounds.syncWith(pOther->_mfForegrounds, sInfo);
00591
00592
00593 }
00594
00595 void ViewportBase::execBeginEditImpl (const BitVector &whichField,
00596 UInt32 uiAspect,
00597 UInt32 uiContainerSize)
00598 {
00599 Inherited::execBeginEditImpl(whichField, uiAspect, uiContainerSize);
00600
00601 if(FieldBits::NoField != (ForegroundsFieldMask & whichField))
00602 _mfForegrounds.beginEdit(uiAspect, uiContainerSize);
00603
00604 }
00605 #endif
00606
00607
00608
00609 #include <OSGSFieldTypeDef.inl>
00610 #include <OSGMFieldTypeDef.inl>
00611
00612 OSG_BEGIN_NAMESPACE
00613
00614 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
00615 DataType FieldDataTraits<ViewportPtr>::_type("ViewportPtr", "AttachmentContainerPtr");
00616 #endif
00617
00618 OSG_DLLEXPORT_SFIELD_DEF1(ViewportPtr, OSG_SYSTEMLIB_DLLTMPLMAPPING);
00619 OSG_DLLEXPORT_MFIELD_DEF1(ViewportPtr, OSG_SYSTEMLIB_DLLTMPLMAPPING);
00620
00621 OSG_END_NAMESPACE
00622
00623
00624
00625
00626
00627 #ifdef OSG_SGI_CC
00628 #pragma set woff 1174
00629 #endif
00630
00631 #ifdef OSG_LINUX_ICC
00632 #pragma warning( disable : 177 )
00633 #endif
00634
00635 namespace
00636 {
00637 static Char8 cvsid_cpp [] = "@(#)$Id: FCBaseTemplate_cpp.h,v 1.45 2005/07/20 00:10:14 vossg Exp $";
00638 static Char8 cvsid_hpp [] = OSGVIEWPORTBASE_HEADER_CVSID;
00639 static Char8 cvsid_inl [] = OSGVIEWPORTBASE_INLINE_CVSID;
00640
00641 static Char8 cvsid_fields_hpp[] = OSGVIEWPORTFIELDS_HEADER_CVSID;
00642 }
00643