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