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_COMPILEPOLYGONBACKGROUNDINST
00055
00056 #include <stdlib.h>
00057 #include <stdio.h>
00058
00059 #include <OSGConfig.h>
00060
00061 #include "OSGPolygonBackgroundBase.h"
00062 #include "OSGPolygonBackground.h"
00063
00064
00065 OSG_BEGIN_NAMESPACE
00066
00067 const OSG::BitVector PolygonBackgroundBase::MaterialFieldMask =
00068 (TypeTraits<BitVector>::One << PolygonBackgroundBase::MaterialFieldId);
00069
00070 const OSG::BitVector PolygonBackgroundBase::TexCoordsFieldMask =
00071 (TypeTraits<BitVector>::One << PolygonBackgroundBase::TexCoordsFieldId);
00072
00073 const OSG::BitVector PolygonBackgroundBase::PositionsFieldMask =
00074 (TypeTraits<BitVector>::One << PolygonBackgroundBase::PositionsFieldId);
00075
00076 const OSG::BitVector PolygonBackgroundBase::NormalizedXFieldMask =
00077 (TypeTraits<BitVector>::One << PolygonBackgroundBase::NormalizedXFieldId);
00078
00079 const OSG::BitVector PolygonBackgroundBase::NormalizedYFieldMask =
00080 (TypeTraits<BitVector>::One << PolygonBackgroundBase::NormalizedYFieldId);
00081
00082 const OSG::BitVector PolygonBackgroundBase::AspectHeightFieldMask =
00083 (TypeTraits<BitVector>::One << PolygonBackgroundBase::AspectHeightFieldId);
00084
00085 const OSG::BitVector PolygonBackgroundBase::AspectWidthFieldMask =
00086 (TypeTraits<BitVector>::One << PolygonBackgroundBase::AspectWidthFieldId);
00087
00088 const OSG::BitVector PolygonBackgroundBase::ScaleFieldMask =
00089 (TypeTraits<BitVector>::One << PolygonBackgroundBase::ScaleFieldId);
00090
00091 const OSG::BitVector PolygonBackgroundBase::ClearStencilBitFieldMask =
00092 (TypeTraits<BitVector>::One << PolygonBackgroundBase::ClearStencilBitFieldId);
00093
00094 const OSG::BitVector PolygonBackgroundBase::CleanupFieldMask =
00095 (TypeTraits<BitVector>::One << PolygonBackgroundBase::CleanupFieldId);
00096
00097 const OSG::BitVector PolygonBackgroundBase::TileFieldMask =
00098 (TypeTraits<BitVector>::One << PolygonBackgroundBase::TileFieldId);
00099
00100 const OSG::BitVector PolygonBackgroundBase::MTInfluenceMask =
00101 (Inherited::MTInfluenceMask) |
00102 (static_cast<BitVector>(0x0) << Inherited::NextFieldId);
00103
00104
00105
00106
00141
00142
00143 FieldDescription *PolygonBackgroundBase::_desc[] =
00144 {
00145 new FieldDescription(SFMaterialPtr::getClassType(),
00146 "material",
00147 MaterialFieldId, MaterialFieldMask,
00148 false,
00149 (FieldAccessMethod) &PolygonBackgroundBase::getSFMaterial),
00150 new FieldDescription(MFVec3f::getClassType(),
00151 "texCoords",
00152 TexCoordsFieldId, TexCoordsFieldMask,
00153 false,
00154 (FieldAccessMethod) &PolygonBackgroundBase::getMFTexCoords),
00155 new FieldDescription(MFPnt2f::getClassType(),
00156 "positions",
00157 PositionsFieldId, PositionsFieldMask,
00158 false,
00159 (FieldAccessMethod) &PolygonBackgroundBase::getMFPositions),
00160 new FieldDescription(SFBool::getClassType(),
00161 "normalizedX",
00162 NormalizedXFieldId, NormalizedXFieldMask,
00163 false,
00164 (FieldAccessMethod) &PolygonBackgroundBase::getSFNormalizedX),
00165 new FieldDescription(SFBool::getClassType(),
00166 "normalizedY",
00167 NormalizedYFieldId, NormalizedYFieldMask,
00168 false,
00169 (FieldAccessMethod) &PolygonBackgroundBase::getSFNormalizedY),
00170 new FieldDescription(SFUInt16::getClassType(),
00171 "aspectHeight",
00172 AspectHeightFieldId, AspectHeightFieldMask,
00173 false,
00174 (FieldAccessMethod) &PolygonBackgroundBase::getSFAspectHeight),
00175 new FieldDescription(SFUInt16::getClassType(),
00176 "aspectWidth",
00177 AspectWidthFieldId, AspectWidthFieldMask,
00178 false,
00179 (FieldAccessMethod) &PolygonBackgroundBase::getSFAspectWidth),
00180 new FieldDescription(SFReal32::getClassType(),
00181 "scale",
00182 ScaleFieldId, ScaleFieldMask,
00183 false,
00184 (FieldAccessMethod) &PolygonBackgroundBase::getSFScale),
00185 new FieldDescription(SFInt32::getClassType(),
00186 "clearStencilBit",
00187 ClearStencilBitFieldId, ClearStencilBitFieldMask,
00188 false,
00189 (FieldAccessMethod) &PolygonBackgroundBase::getSFClearStencilBit),
00190 new FieldDescription(SFBool::getClassType(),
00191 "cleanup",
00192 CleanupFieldId, CleanupFieldMask,
00193 false,
00194 (FieldAccessMethod) &PolygonBackgroundBase::getSFCleanup),
00195 new FieldDescription(SFBool::getClassType(),
00196 "tile",
00197 TileFieldId, TileFieldMask,
00198 false,
00199 (FieldAccessMethod) &PolygonBackgroundBase::getSFTile)
00200 };
00201
00202
00203 FieldContainerType PolygonBackgroundBase::_type(
00204 "PolygonBackground",
00205 "Background",
00206 NULL,
00207 (PrototypeCreateF) &PolygonBackgroundBase::createEmpty,
00208 PolygonBackground::initMethod,
00209 _desc,
00210 sizeof(_desc));
00211
00212
00213
00214
00215
00216 FieldContainerType &PolygonBackgroundBase::getType(void)
00217 {
00218 return _type;
00219 }
00220
00221 const FieldContainerType &PolygonBackgroundBase::getType(void) const
00222 {
00223 return _type;
00224 }
00225
00226
00227 FieldContainerPtr PolygonBackgroundBase::shallowCopy(void) const
00228 {
00229 PolygonBackgroundPtr returnValue;
00230
00231 newPtr(returnValue, dynamic_cast<const PolygonBackground *>(this));
00232
00233 return returnValue;
00234 }
00235
00236 UInt32 PolygonBackgroundBase::getContainerSize(void) const
00237 {
00238 return sizeof(PolygonBackground);
00239 }
00240
00241
00242 #if !defined(OSG_FIXED_MFIELDSYNC)
00243 void PolygonBackgroundBase::executeSync( FieldContainer &other,
00244 const BitVector &whichField)
00245 {
00246 this->executeSyncImpl((PolygonBackgroundBase *) &other, whichField);
00247 }
00248 #else
00249 void PolygonBackgroundBase::executeSync( FieldContainer &other,
00250 const BitVector &whichField, const SyncInfo &sInfo )
00251 {
00252 this->executeSyncImpl((PolygonBackgroundBase *) &other, whichField, sInfo);
00253 }
00254 void PolygonBackgroundBase::execBeginEdit(const BitVector &whichField,
00255 UInt32 uiAspect,
00256 UInt32 uiContainerSize)
00257 {
00258 this->execBeginEditImpl(whichField, uiAspect, uiContainerSize);
00259 }
00260
00261 void PolygonBackgroundBase::onDestroyAspect(UInt32 uiId, UInt32 uiAspect)
00262 {
00263 Inherited::onDestroyAspect(uiId, uiAspect);
00264
00265 _mfTexCoords.terminateShare(uiAspect, this->getContainerSize());
00266 _mfPositions.terminateShare(uiAspect, this->getContainerSize());
00267 }
00268 #endif
00269
00270
00271
00272 #ifdef OSG_WIN32_ICL
00273 #pragma warning (disable : 383)
00274 #endif
00275
00276 PolygonBackgroundBase::PolygonBackgroundBase(void) :
00277 _sfMaterial (),
00278 _mfTexCoords (),
00279 _mfPositions (),
00280 _sfNormalizedX (bool(true)),
00281 _sfNormalizedY (bool(true)),
00282 _sfAspectHeight (UInt16(0)),
00283 _sfAspectWidth (UInt16(0)),
00284 _sfScale (Real32(1.0)),
00285 _sfClearStencilBit (Int32(-1)),
00286 _sfCleanup (bool(true)),
00287 _sfTile (bool(true)),
00288 Inherited()
00289 {
00290 }
00291
00292 #ifdef OSG_WIN32_ICL
00293 #pragma warning (default : 383)
00294 #endif
00295
00296 PolygonBackgroundBase::PolygonBackgroundBase(const PolygonBackgroundBase &source) :
00297 _sfMaterial (source._sfMaterial ),
00298 _mfTexCoords (source._mfTexCoords ),
00299 _mfPositions (source._mfPositions ),
00300 _sfNormalizedX (source._sfNormalizedX ),
00301 _sfNormalizedY (source._sfNormalizedY ),
00302 _sfAspectHeight (source._sfAspectHeight ),
00303 _sfAspectWidth (source._sfAspectWidth ),
00304 _sfScale (source._sfScale ),
00305 _sfClearStencilBit (source._sfClearStencilBit ),
00306 _sfCleanup (source._sfCleanup ),
00307 _sfTile (source._sfTile ),
00308 Inherited (source)
00309 {
00310 }
00311
00312
00313
00314 PolygonBackgroundBase::~PolygonBackgroundBase(void)
00315 {
00316 }
00317
00318
00319
00320 UInt32 PolygonBackgroundBase::getBinSize(const BitVector &whichField)
00321 {
00322 UInt32 returnValue = Inherited::getBinSize(whichField);
00323
00324 if(FieldBits::NoField != (MaterialFieldMask & whichField))
00325 {
00326 returnValue += _sfMaterial.getBinSize();
00327 }
00328
00329 if(FieldBits::NoField != (TexCoordsFieldMask & whichField))
00330 {
00331 returnValue += _mfTexCoords.getBinSize();
00332 }
00333
00334 if(FieldBits::NoField != (PositionsFieldMask & whichField))
00335 {
00336 returnValue += _mfPositions.getBinSize();
00337 }
00338
00339 if(FieldBits::NoField != (NormalizedXFieldMask & whichField))
00340 {
00341 returnValue += _sfNormalizedX.getBinSize();
00342 }
00343
00344 if(FieldBits::NoField != (NormalizedYFieldMask & whichField))
00345 {
00346 returnValue += _sfNormalizedY.getBinSize();
00347 }
00348
00349 if(FieldBits::NoField != (AspectHeightFieldMask & whichField))
00350 {
00351 returnValue += _sfAspectHeight.getBinSize();
00352 }
00353
00354 if(FieldBits::NoField != (AspectWidthFieldMask & whichField))
00355 {
00356 returnValue += _sfAspectWidth.getBinSize();
00357 }
00358
00359 if(FieldBits::NoField != (ScaleFieldMask & whichField))
00360 {
00361 returnValue += _sfScale.getBinSize();
00362 }
00363
00364 if(FieldBits::NoField != (ClearStencilBitFieldMask & whichField))
00365 {
00366 returnValue += _sfClearStencilBit.getBinSize();
00367 }
00368
00369 if(FieldBits::NoField != (CleanupFieldMask & whichField))
00370 {
00371 returnValue += _sfCleanup.getBinSize();
00372 }
00373
00374 if(FieldBits::NoField != (TileFieldMask & whichField))
00375 {
00376 returnValue += _sfTile.getBinSize();
00377 }
00378
00379
00380 return returnValue;
00381 }
00382
00383 void PolygonBackgroundBase::copyToBin( BinaryDataHandler &pMem,
00384 const BitVector &whichField)
00385 {
00386 Inherited::copyToBin(pMem, whichField);
00387
00388 if(FieldBits::NoField != (MaterialFieldMask & whichField))
00389 {
00390 _sfMaterial.copyToBin(pMem);
00391 }
00392
00393 if(FieldBits::NoField != (TexCoordsFieldMask & whichField))
00394 {
00395 _mfTexCoords.copyToBin(pMem);
00396 }
00397
00398 if(FieldBits::NoField != (PositionsFieldMask & whichField))
00399 {
00400 _mfPositions.copyToBin(pMem);
00401 }
00402
00403 if(FieldBits::NoField != (NormalizedXFieldMask & whichField))
00404 {
00405 _sfNormalizedX.copyToBin(pMem);
00406 }
00407
00408 if(FieldBits::NoField != (NormalizedYFieldMask & whichField))
00409 {
00410 _sfNormalizedY.copyToBin(pMem);
00411 }
00412
00413 if(FieldBits::NoField != (AspectHeightFieldMask & whichField))
00414 {
00415 _sfAspectHeight.copyToBin(pMem);
00416 }
00417
00418 if(FieldBits::NoField != (AspectWidthFieldMask & whichField))
00419 {
00420 _sfAspectWidth.copyToBin(pMem);
00421 }
00422
00423 if(FieldBits::NoField != (ScaleFieldMask & whichField))
00424 {
00425 _sfScale.copyToBin(pMem);
00426 }
00427
00428 if(FieldBits::NoField != (ClearStencilBitFieldMask & whichField))
00429 {
00430 _sfClearStencilBit.copyToBin(pMem);
00431 }
00432
00433 if(FieldBits::NoField != (CleanupFieldMask & whichField))
00434 {
00435 _sfCleanup.copyToBin(pMem);
00436 }
00437
00438 if(FieldBits::NoField != (TileFieldMask & whichField))
00439 {
00440 _sfTile.copyToBin(pMem);
00441 }
00442
00443
00444 }
00445
00446 void PolygonBackgroundBase::copyFromBin( BinaryDataHandler &pMem,
00447 const BitVector &whichField)
00448 {
00449 Inherited::copyFromBin(pMem, whichField);
00450
00451 if(FieldBits::NoField != (MaterialFieldMask & whichField))
00452 {
00453 _sfMaterial.copyFromBin(pMem);
00454 }
00455
00456 if(FieldBits::NoField != (TexCoordsFieldMask & whichField))
00457 {
00458 _mfTexCoords.copyFromBin(pMem);
00459 }
00460
00461 if(FieldBits::NoField != (PositionsFieldMask & whichField))
00462 {
00463 _mfPositions.copyFromBin(pMem);
00464 }
00465
00466 if(FieldBits::NoField != (NormalizedXFieldMask & whichField))
00467 {
00468 _sfNormalizedX.copyFromBin(pMem);
00469 }
00470
00471 if(FieldBits::NoField != (NormalizedYFieldMask & whichField))
00472 {
00473 _sfNormalizedY.copyFromBin(pMem);
00474 }
00475
00476 if(FieldBits::NoField != (AspectHeightFieldMask & whichField))
00477 {
00478 _sfAspectHeight.copyFromBin(pMem);
00479 }
00480
00481 if(FieldBits::NoField != (AspectWidthFieldMask & whichField))
00482 {
00483 _sfAspectWidth.copyFromBin(pMem);
00484 }
00485
00486 if(FieldBits::NoField != (ScaleFieldMask & whichField))
00487 {
00488 _sfScale.copyFromBin(pMem);
00489 }
00490
00491 if(FieldBits::NoField != (ClearStencilBitFieldMask & whichField))
00492 {
00493 _sfClearStencilBit.copyFromBin(pMem);
00494 }
00495
00496 if(FieldBits::NoField != (CleanupFieldMask & whichField))
00497 {
00498 _sfCleanup.copyFromBin(pMem);
00499 }
00500
00501 if(FieldBits::NoField != (TileFieldMask & whichField))
00502 {
00503 _sfTile.copyFromBin(pMem);
00504 }
00505
00506
00507 }
00508
00509 #if !defined(OSG_FIXED_MFIELDSYNC)
00510 void PolygonBackgroundBase::executeSyncImpl( PolygonBackgroundBase *pOther,
00511 const BitVector &whichField)
00512 {
00513
00514 Inherited::executeSyncImpl(pOther, whichField);
00515
00516 if(FieldBits::NoField != (MaterialFieldMask & whichField))
00517 _sfMaterial.syncWith(pOther->_sfMaterial);
00518
00519 if(FieldBits::NoField != (TexCoordsFieldMask & whichField))
00520 _mfTexCoords.syncWith(pOther->_mfTexCoords);
00521
00522 if(FieldBits::NoField != (PositionsFieldMask & whichField))
00523 _mfPositions.syncWith(pOther->_mfPositions);
00524
00525 if(FieldBits::NoField != (NormalizedXFieldMask & whichField))
00526 _sfNormalizedX.syncWith(pOther->_sfNormalizedX);
00527
00528 if(FieldBits::NoField != (NormalizedYFieldMask & whichField))
00529 _sfNormalizedY.syncWith(pOther->_sfNormalizedY);
00530
00531 if(FieldBits::NoField != (AspectHeightFieldMask & whichField))
00532 _sfAspectHeight.syncWith(pOther->_sfAspectHeight);
00533
00534 if(FieldBits::NoField != (AspectWidthFieldMask & whichField))
00535 _sfAspectWidth.syncWith(pOther->_sfAspectWidth);
00536
00537 if(FieldBits::NoField != (ScaleFieldMask & whichField))
00538 _sfScale.syncWith(pOther->_sfScale);
00539
00540 if(FieldBits::NoField != (ClearStencilBitFieldMask & whichField))
00541 _sfClearStencilBit.syncWith(pOther->_sfClearStencilBit);
00542
00543 if(FieldBits::NoField != (CleanupFieldMask & whichField))
00544 _sfCleanup.syncWith(pOther->_sfCleanup);
00545
00546 if(FieldBits::NoField != (TileFieldMask & whichField))
00547 _sfTile.syncWith(pOther->_sfTile);
00548
00549
00550 }
00551 #else
00552 void PolygonBackgroundBase::executeSyncImpl( PolygonBackgroundBase *pOther,
00553 const BitVector &whichField,
00554 const SyncInfo &sInfo )
00555 {
00556
00557 Inherited::executeSyncImpl(pOther, whichField, sInfo);
00558
00559 if(FieldBits::NoField != (MaterialFieldMask & whichField))
00560 _sfMaterial.syncWith(pOther->_sfMaterial);
00561
00562 if(FieldBits::NoField != (NormalizedXFieldMask & whichField))
00563 _sfNormalizedX.syncWith(pOther->_sfNormalizedX);
00564
00565 if(FieldBits::NoField != (NormalizedYFieldMask & whichField))
00566 _sfNormalizedY.syncWith(pOther->_sfNormalizedY);
00567
00568 if(FieldBits::NoField != (AspectHeightFieldMask & whichField))
00569 _sfAspectHeight.syncWith(pOther->_sfAspectHeight);
00570
00571 if(FieldBits::NoField != (AspectWidthFieldMask & whichField))
00572 _sfAspectWidth.syncWith(pOther->_sfAspectWidth);
00573
00574 if(FieldBits::NoField != (ScaleFieldMask & whichField))
00575 _sfScale.syncWith(pOther->_sfScale);
00576
00577 if(FieldBits::NoField != (ClearStencilBitFieldMask & whichField))
00578 _sfClearStencilBit.syncWith(pOther->_sfClearStencilBit);
00579
00580 if(FieldBits::NoField != (CleanupFieldMask & whichField))
00581 _sfCleanup.syncWith(pOther->_sfCleanup);
00582
00583 if(FieldBits::NoField != (TileFieldMask & whichField))
00584 _sfTile.syncWith(pOther->_sfTile);
00585
00586
00587 if(FieldBits::NoField != (TexCoordsFieldMask & whichField))
00588 _mfTexCoords.syncWith(pOther->_mfTexCoords, sInfo);
00589
00590 if(FieldBits::NoField != (PositionsFieldMask & whichField))
00591 _mfPositions.syncWith(pOther->_mfPositions, sInfo);
00592
00593
00594 }
00595
00596 void PolygonBackgroundBase::execBeginEditImpl (const BitVector &whichField,
00597 UInt32 uiAspect,
00598 UInt32 uiContainerSize)
00599 {
00600 Inherited::execBeginEditImpl(whichField, uiAspect, uiContainerSize);
00601
00602 if(FieldBits::NoField != (TexCoordsFieldMask & whichField))
00603 _mfTexCoords.beginEdit(uiAspect, uiContainerSize);
00604
00605 if(FieldBits::NoField != (PositionsFieldMask & whichField))
00606 _mfPositions.beginEdit(uiAspect, uiContainerSize);
00607
00608 }
00609 #endif
00610
00611
00612
00613 OSG_END_NAMESPACE
00614
00615 #include <OSGSFieldTypeDef.inl>
00616 #include <OSGMFieldTypeDef.inl>
00617
00618 OSG_BEGIN_NAMESPACE
00619
00620 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
00621 DataType FieldDataTraits<PolygonBackgroundPtr>::_type("PolygonBackgroundPtr", "BackgroundPtr");
00622 #endif
00623
00624 OSG_DLLEXPORT_SFIELD_DEF1(PolygonBackgroundPtr, OSG_SYSTEMLIB_DLLTMPLMAPPING);
00625 OSG_DLLEXPORT_MFIELD_DEF1(PolygonBackgroundPtr, OSG_SYSTEMLIB_DLLTMPLMAPPING);
00626
00627
00628
00629
00630
00631 #ifdef OSG_SGI_CC
00632 #pragma set woff 1174
00633 #endif
00634
00635 #ifdef OSG_LINUX_ICC
00636 #pragma warning( disable : 177 )
00637 #endif
00638
00639 namespace
00640 {
00641 static Char8 cvsid_cpp [] = "@(#)$Id: OSGPolygonBackgroundBase.cpp,v 1.9 2007/03/09 16:59:50 yjung Exp $";
00642 static Char8 cvsid_hpp [] = OSGPOLYGONBACKGROUNDBASE_HEADER_CVSID;
00643 static Char8 cvsid_inl [] = OSGPOLYGONBACKGROUNDBASE_INLINE_CVSID;
00644
00645 static Char8 cvsid_fields_hpp[] = OSGPOLYGONBACKGROUNDFIELDS_HEADER_CVSID;
00646 }
00647
00648 OSG_END_NAMESPACE
00649