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_COMPILEPOLYGONCHUNKINST
00055
00056 #include <stdlib.h>
00057 #include <stdio.h>
00058
00059 #include <OSGConfig.h>
00060
00061 #include "OSGPolygonChunkBase.h"
00062 #include "OSGPolygonChunk.h"
00063
00064 #include <OSGGL.h>
00065 #include <OSGGL.h>
00066 #include <OSGGL.h>
00067 #include <OSGGL.h>
00068 #include <OSGGL.h>
00069 #include <OSGGL.h>
00070 #include <OSGGL.h>
00071 #include <OSGGL.h>
00072
00073 OSG_USING_NAMESPACE
00074
00075 const OSG::BitVector PolygonChunkBase::CullFaceFieldMask =
00076 (TypeTraits<BitVector>::One << PolygonChunkBase::CullFaceFieldId);
00077
00078 const OSG::BitVector PolygonChunkBase::FrontFaceFieldMask =
00079 (TypeTraits<BitVector>::One << PolygonChunkBase::FrontFaceFieldId);
00080
00081 const OSG::BitVector PolygonChunkBase::FrontModeFieldMask =
00082 (TypeTraits<BitVector>::One << PolygonChunkBase::FrontModeFieldId);
00083
00084 const OSG::BitVector PolygonChunkBase::BackModeFieldMask =
00085 (TypeTraits<BitVector>::One << PolygonChunkBase::BackModeFieldId);
00086
00087 const OSG::BitVector PolygonChunkBase::SmoothFieldMask =
00088 (TypeTraits<BitVector>::One << PolygonChunkBase::SmoothFieldId);
00089
00090 const OSG::BitVector PolygonChunkBase::OffsetFactorFieldMask =
00091 (TypeTraits<BitVector>::One << PolygonChunkBase::OffsetFactorFieldId);
00092
00093 const OSG::BitVector PolygonChunkBase::OffsetBiasFieldMask =
00094 (TypeTraits<BitVector>::One << PolygonChunkBase::OffsetBiasFieldId);
00095
00096 const OSG::BitVector PolygonChunkBase::OffsetPointFieldMask =
00097 (TypeTraits<BitVector>::One << PolygonChunkBase::OffsetPointFieldId);
00098
00099 const OSG::BitVector PolygonChunkBase::OffsetLineFieldMask =
00100 (TypeTraits<BitVector>::One << PolygonChunkBase::OffsetLineFieldId);
00101
00102 const OSG::BitVector PolygonChunkBase::OffsetFillFieldMask =
00103 (TypeTraits<BitVector>::One << PolygonChunkBase::OffsetFillFieldId);
00104
00105 const OSG::BitVector PolygonChunkBase::StippleFieldMask =
00106 (TypeTraits<BitVector>::One << PolygonChunkBase::StippleFieldId);
00107
00108 const OSG::BitVector PolygonChunkBase::MTInfluenceMask =
00109 (Inherited::MTInfluenceMask) |
00110 (static_cast<BitVector>(0x0) << Inherited::NextFieldId);
00111
00112
00113
00114
00149
00150
00151 FieldDescription *PolygonChunkBase::_desc[] =
00152 {
00153 new FieldDescription(SFGLenum::getClassType(),
00154 "cullFace",
00155 CullFaceFieldId, CullFaceFieldMask,
00156 false,
00157 (FieldAccessMethod) &PolygonChunkBase::getSFCullFace),
00158 new FieldDescription(SFGLenum::getClassType(),
00159 "frontFace",
00160 FrontFaceFieldId, FrontFaceFieldMask,
00161 false,
00162 (FieldAccessMethod) &PolygonChunkBase::getSFFrontFace),
00163 new FieldDescription(SFGLenum::getClassType(),
00164 "frontMode",
00165 FrontModeFieldId, FrontModeFieldMask,
00166 false,
00167 (FieldAccessMethod) &PolygonChunkBase::getSFFrontMode),
00168 new FieldDescription(SFGLenum::getClassType(),
00169 "backMode",
00170 BackModeFieldId, BackModeFieldMask,
00171 false,
00172 (FieldAccessMethod) &PolygonChunkBase::getSFBackMode),
00173 new FieldDescription(SFBool::getClassType(),
00174 "smooth",
00175 SmoothFieldId, SmoothFieldMask,
00176 false,
00177 (FieldAccessMethod) &PolygonChunkBase::getSFSmooth),
00178 new FieldDescription(SFReal32::getClassType(),
00179 "offsetFactor",
00180 OffsetFactorFieldId, OffsetFactorFieldMask,
00181 false,
00182 (FieldAccessMethod) &PolygonChunkBase::getSFOffsetFactor),
00183 new FieldDescription(SFReal32::getClassType(),
00184 "offsetBias",
00185 OffsetBiasFieldId, OffsetBiasFieldMask,
00186 false,
00187 (FieldAccessMethod) &PolygonChunkBase::getSFOffsetBias),
00188 new FieldDescription(SFBool::getClassType(),
00189 "offsetPoint",
00190 OffsetPointFieldId, OffsetPointFieldMask,
00191 false,
00192 (FieldAccessMethod) &PolygonChunkBase::getSFOffsetPoint),
00193 new FieldDescription(SFBool::getClassType(),
00194 "offsetLine",
00195 OffsetLineFieldId, OffsetLineFieldMask,
00196 false,
00197 (FieldAccessMethod) &PolygonChunkBase::getSFOffsetLine),
00198 new FieldDescription(SFBool::getClassType(),
00199 "offsetFill",
00200 OffsetFillFieldId, OffsetFillFieldMask,
00201 false,
00202 (FieldAccessMethod) &PolygonChunkBase::getSFOffsetFill),
00203 new FieldDescription(MFInt32::getClassType(),
00204 "stipple",
00205 StippleFieldId, StippleFieldMask,
00206 false,
00207 (FieldAccessMethod) &PolygonChunkBase::getMFStipple)
00208 };
00209
00210
00211 FieldContainerType PolygonChunkBase::_type(
00212 "PolygonChunk",
00213 "StateChunk",
00214 NULL,
00215 (PrototypeCreateF) &PolygonChunkBase::createEmpty,
00216 PolygonChunk::initMethod,
00217 _desc,
00218 sizeof(_desc));
00219
00220
00221
00222
00223
00224 FieldContainerType &PolygonChunkBase::getType(void)
00225 {
00226 return _type;
00227 }
00228
00229 const FieldContainerType &PolygonChunkBase::getType(void) const
00230 {
00231 return _type;
00232 }
00233
00234
00235 FieldContainerPtr PolygonChunkBase::shallowCopy(void) const
00236 {
00237 PolygonChunkPtr returnValue;
00238
00239 newPtr(returnValue, dynamic_cast<const PolygonChunk *>(this));
00240
00241 return returnValue;
00242 }
00243
00244 UInt32 PolygonChunkBase::getContainerSize(void) const
00245 {
00246 return sizeof(PolygonChunk);
00247 }
00248
00249
00250 #if !defined(OSG_FIXED_MFIELDSYNC)
00251 void PolygonChunkBase::executeSync( FieldContainer &other,
00252 const BitVector &whichField)
00253 {
00254 this->executeSyncImpl((PolygonChunkBase *) &other, whichField);
00255 }
00256 #else
00257 void PolygonChunkBase::executeSync( FieldContainer &other,
00258 const BitVector &whichField, const SyncInfo &sInfo )
00259 {
00260 this->executeSyncImpl((PolygonChunkBase *) &other, whichField, sInfo);
00261 }
00262 void PolygonChunkBase::execBeginEdit(const BitVector &whichField,
00263 UInt32 uiAspect,
00264 UInt32 uiContainerSize)
00265 {
00266 this->execBeginEditImpl(whichField, uiAspect, uiContainerSize);
00267 }
00268
00269 void PolygonChunkBase::onDestroyAspect(UInt32 uiId, UInt32 uiAspect)
00270 {
00271 Inherited::onDestroyAspect(uiId, uiAspect);
00272
00273 _mfStipple.terminateShare(uiAspect, this->getContainerSize());
00274 }
00275 #endif
00276
00277
00278
00279 #ifdef OSG_WIN32_ICL
00280 #pragma warning (disable : 383)
00281 #endif
00282
00283 PolygonChunkBase::PolygonChunkBase(void) :
00284 _sfCullFace (GLenum(GL_NONE)),
00285 _sfFrontFace (GLenum(GL_CCW)),
00286 _sfFrontMode (GLenum(GL_FILL)),
00287 _sfBackMode (GLenum(GL_FILL)),
00288 _sfSmooth (bool(GL_FALSE)),
00289 _sfOffsetFactor (Real32(0)),
00290 _sfOffsetBias (Real32(0)),
00291 _sfOffsetPoint (bool(GL_FALSE)),
00292 _sfOffsetLine (bool(GL_FALSE)),
00293 _sfOffsetFill (bool(GL_FALSE)),
00294 _mfStipple (),
00295 Inherited()
00296 {
00297 }
00298
00299 #ifdef OSG_WIN32_ICL
00300 #pragma warning (default : 383)
00301 #endif
00302
00303 PolygonChunkBase::PolygonChunkBase(const PolygonChunkBase &source) :
00304 _sfCullFace (source._sfCullFace ),
00305 _sfFrontFace (source._sfFrontFace ),
00306 _sfFrontMode (source._sfFrontMode ),
00307 _sfBackMode (source._sfBackMode ),
00308 _sfSmooth (source._sfSmooth ),
00309 _sfOffsetFactor (source._sfOffsetFactor ),
00310 _sfOffsetBias (source._sfOffsetBias ),
00311 _sfOffsetPoint (source._sfOffsetPoint ),
00312 _sfOffsetLine (source._sfOffsetLine ),
00313 _sfOffsetFill (source._sfOffsetFill ),
00314 _mfStipple (source._mfStipple ),
00315 Inherited (source)
00316 {
00317 }
00318
00319
00320
00321 PolygonChunkBase::~PolygonChunkBase(void)
00322 {
00323 }
00324
00325
00326
00327 UInt32 PolygonChunkBase::getBinSize(const BitVector &whichField)
00328 {
00329 UInt32 returnValue = Inherited::getBinSize(whichField);
00330
00331 if(FieldBits::NoField != (CullFaceFieldMask & whichField))
00332 {
00333 returnValue += _sfCullFace.getBinSize();
00334 }
00335
00336 if(FieldBits::NoField != (FrontFaceFieldMask & whichField))
00337 {
00338 returnValue += _sfFrontFace.getBinSize();
00339 }
00340
00341 if(FieldBits::NoField != (FrontModeFieldMask & whichField))
00342 {
00343 returnValue += _sfFrontMode.getBinSize();
00344 }
00345
00346 if(FieldBits::NoField != (BackModeFieldMask & whichField))
00347 {
00348 returnValue += _sfBackMode.getBinSize();
00349 }
00350
00351 if(FieldBits::NoField != (SmoothFieldMask & whichField))
00352 {
00353 returnValue += _sfSmooth.getBinSize();
00354 }
00355
00356 if(FieldBits::NoField != (OffsetFactorFieldMask & whichField))
00357 {
00358 returnValue += _sfOffsetFactor.getBinSize();
00359 }
00360
00361 if(FieldBits::NoField != (OffsetBiasFieldMask & whichField))
00362 {
00363 returnValue += _sfOffsetBias.getBinSize();
00364 }
00365
00366 if(FieldBits::NoField != (OffsetPointFieldMask & whichField))
00367 {
00368 returnValue += _sfOffsetPoint.getBinSize();
00369 }
00370
00371 if(FieldBits::NoField != (OffsetLineFieldMask & whichField))
00372 {
00373 returnValue += _sfOffsetLine.getBinSize();
00374 }
00375
00376 if(FieldBits::NoField != (OffsetFillFieldMask & whichField))
00377 {
00378 returnValue += _sfOffsetFill.getBinSize();
00379 }
00380
00381 if(FieldBits::NoField != (StippleFieldMask & whichField))
00382 {
00383 returnValue += _mfStipple.getBinSize();
00384 }
00385
00386
00387 return returnValue;
00388 }
00389
00390 void PolygonChunkBase::copyToBin( BinaryDataHandler &pMem,
00391 const BitVector &whichField)
00392 {
00393 Inherited::copyToBin(pMem, whichField);
00394
00395 if(FieldBits::NoField != (CullFaceFieldMask & whichField))
00396 {
00397 _sfCullFace.copyToBin(pMem);
00398 }
00399
00400 if(FieldBits::NoField != (FrontFaceFieldMask & whichField))
00401 {
00402 _sfFrontFace.copyToBin(pMem);
00403 }
00404
00405 if(FieldBits::NoField != (FrontModeFieldMask & whichField))
00406 {
00407 _sfFrontMode.copyToBin(pMem);
00408 }
00409
00410 if(FieldBits::NoField != (BackModeFieldMask & whichField))
00411 {
00412 _sfBackMode.copyToBin(pMem);
00413 }
00414
00415 if(FieldBits::NoField != (SmoothFieldMask & whichField))
00416 {
00417 _sfSmooth.copyToBin(pMem);
00418 }
00419
00420 if(FieldBits::NoField != (OffsetFactorFieldMask & whichField))
00421 {
00422 _sfOffsetFactor.copyToBin(pMem);
00423 }
00424
00425 if(FieldBits::NoField != (OffsetBiasFieldMask & whichField))
00426 {
00427 _sfOffsetBias.copyToBin(pMem);
00428 }
00429
00430 if(FieldBits::NoField != (OffsetPointFieldMask & whichField))
00431 {
00432 _sfOffsetPoint.copyToBin(pMem);
00433 }
00434
00435 if(FieldBits::NoField != (OffsetLineFieldMask & whichField))
00436 {
00437 _sfOffsetLine.copyToBin(pMem);
00438 }
00439
00440 if(FieldBits::NoField != (OffsetFillFieldMask & whichField))
00441 {
00442 _sfOffsetFill.copyToBin(pMem);
00443 }
00444
00445 if(FieldBits::NoField != (StippleFieldMask & whichField))
00446 {
00447 _mfStipple.copyToBin(pMem);
00448 }
00449
00450
00451 }
00452
00453 void PolygonChunkBase::copyFromBin( BinaryDataHandler &pMem,
00454 const BitVector &whichField)
00455 {
00456 Inherited::copyFromBin(pMem, whichField);
00457
00458 if(FieldBits::NoField != (CullFaceFieldMask & whichField))
00459 {
00460 _sfCullFace.copyFromBin(pMem);
00461 }
00462
00463 if(FieldBits::NoField != (FrontFaceFieldMask & whichField))
00464 {
00465 _sfFrontFace.copyFromBin(pMem);
00466 }
00467
00468 if(FieldBits::NoField != (FrontModeFieldMask & whichField))
00469 {
00470 _sfFrontMode.copyFromBin(pMem);
00471 }
00472
00473 if(FieldBits::NoField != (BackModeFieldMask & whichField))
00474 {
00475 _sfBackMode.copyFromBin(pMem);
00476 }
00477
00478 if(FieldBits::NoField != (SmoothFieldMask & whichField))
00479 {
00480 _sfSmooth.copyFromBin(pMem);
00481 }
00482
00483 if(FieldBits::NoField != (OffsetFactorFieldMask & whichField))
00484 {
00485 _sfOffsetFactor.copyFromBin(pMem);
00486 }
00487
00488 if(FieldBits::NoField != (OffsetBiasFieldMask & whichField))
00489 {
00490 _sfOffsetBias.copyFromBin(pMem);
00491 }
00492
00493 if(FieldBits::NoField != (OffsetPointFieldMask & whichField))
00494 {
00495 _sfOffsetPoint.copyFromBin(pMem);
00496 }
00497
00498 if(FieldBits::NoField != (OffsetLineFieldMask & whichField))
00499 {
00500 _sfOffsetLine.copyFromBin(pMem);
00501 }
00502
00503 if(FieldBits::NoField != (OffsetFillFieldMask & whichField))
00504 {
00505 _sfOffsetFill.copyFromBin(pMem);
00506 }
00507
00508 if(FieldBits::NoField != (StippleFieldMask & whichField))
00509 {
00510 _mfStipple.copyFromBin(pMem);
00511 }
00512
00513
00514 }
00515
00516 #if !defined(OSG_FIXED_MFIELDSYNC)
00517 void PolygonChunkBase::executeSyncImpl( PolygonChunkBase *pOther,
00518 const BitVector &whichField)
00519 {
00520
00521 Inherited::executeSyncImpl(pOther, whichField);
00522
00523 if(FieldBits::NoField != (CullFaceFieldMask & whichField))
00524 _sfCullFace.syncWith(pOther->_sfCullFace);
00525
00526 if(FieldBits::NoField != (FrontFaceFieldMask & whichField))
00527 _sfFrontFace.syncWith(pOther->_sfFrontFace);
00528
00529 if(FieldBits::NoField != (FrontModeFieldMask & whichField))
00530 _sfFrontMode.syncWith(pOther->_sfFrontMode);
00531
00532 if(FieldBits::NoField != (BackModeFieldMask & whichField))
00533 _sfBackMode.syncWith(pOther->_sfBackMode);
00534
00535 if(FieldBits::NoField != (SmoothFieldMask & whichField))
00536 _sfSmooth.syncWith(pOther->_sfSmooth);
00537
00538 if(FieldBits::NoField != (OffsetFactorFieldMask & whichField))
00539 _sfOffsetFactor.syncWith(pOther->_sfOffsetFactor);
00540
00541 if(FieldBits::NoField != (OffsetBiasFieldMask & whichField))
00542 _sfOffsetBias.syncWith(pOther->_sfOffsetBias);
00543
00544 if(FieldBits::NoField != (OffsetPointFieldMask & whichField))
00545 _sfOffsetPoint.syncWith(pOther->_sfOffsetPoint);
00546
00547 if(FieldBits::NoField != (OffsetLineFieldMask & whichField))
00548 _sfOffsetLine.syncWith(pOther->_sfOffsetLine);
00549
00550 if(FieldBits::NoField != (OffsetFillFieldMask & whichField))
00551 _sfOffsetFill.syncWith(pOther->_sfOffsetFill);
00552
00553 if(FieldBits::NoField != (StippleFieldMask & whichField))
00554 _mfStipple.syncWith(pOther->_mfStipple);
00555
00556
00557 }
00558 #else
00559 void PolygonChunkBase::executeSyncImpl( PolygonChunkBase *pOther,
00560 const BitVector &whichField,
00561 const SyncInfo &sInfo )
00562 {
00563
00564 Inherited::executeSyncImpl(pOther, whichField, sInfo);
00565
00566 if(FieldBits::NoField != (CullFaceFieldMask & whichField))
00567 _sfCullFace.syncWith(pOther->_sfCullFace);
00568
00569 if(FieldBits::NoField != (FrontFaceFieldMask & whichField))
00570 _sfFrontFace.syncWith(pOther->_sfFrontFace);
00571
00572 if(FieldBits::NoField != (FrontModeFieldMask & whichField))
00573 _sfFrontMode.syncWith(pOther->_sfFrontMode);
00574
00575 if(FieldBits::NoField != (BackModeFieldMask & whichField))
00576 _sfBackMode.syncWith(pOther->_sfBackMode);
00577
00578 if(FieldBits::NoField != (SmoothFieldMask & whichField))
00579 _sfSmooth.syncWith(pOther->_sfSmooth);
00580
00581 if(FieldBits::NoField != (OffsetFactorFieldMask & whichField))
00582 _sfOffsetFactor.syncWith(pOther->_sfOffsetFactor);
00583
00584 if(FieldBits::NoField != (OffsetBiasFieldMask & whichField))
00585 _sfOffsetBias.syncWith(pOther->_sfOffsetBias);
00586
00587 if(FieldBits::NoField != (OffsetPointFieldMask & whichField))
00588 _sfOffsetPoint.syncWith(pOther->_sfOffsetPoint);
00589
00590 if(FieldBits::NoField != (OffsetLineFieldMask & whichField))
00591 _sfOffsetLine.syncWith(pOther->_sfOffsetLine);
00592
00593 if(FieldBits::NoField != (OffsetFillFieldMask & whichField))
00594 _sfOffsetFill.syncWith(pOther->_sfOffsetFill);
00595
00596
00597 if(FieldBits::NoField != (StippleFieldMask & whichField))
00598 _mfStipple.syncWith(pOther->_mfStipple, sInfo);
00599
00600
00601 }
00602
00603 void PolygonChunkBase::execBeginEditImpl (const BitVector &whichField,
00604 UInt32 uiAspect,
00605 UInt32 uiContainerSize)
00606 {
00607 Inherited::execBeginEditImpl(whichField, uiAspect, uiContainerSize);
00608
00609 if(FieldBits::NoField != (StippleFieldMask & whichField))
00610 _mfStipple.beginEdit(uiAspect, uiContainerSize);
00611
00612 }
00613 #endif
00614
00615
00616
00617 #include <OSGSFieldTypeDef.inl>
00618 #include <OSGMFieldTypeDef.inl>
00619
00620 OSG_BEGIN_NAMESPACE
00621
00622 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
00623 DataType FieldDataTraits<PolygonChunkPtr>::_type("PolygonChunkPtr", "StateChunkPtr");
00624 #endif
00625
00626 OSG_DLLEXPORT_SFIELD_DEF1(PolygonChunkPtr, OSG_SYSTEMLIB_DLLTMPLMAPPING);
00627 OSG_DLLEXPORT_MFIELD_DEF1(PolygonChunkPtr, OSG_SYSTEMLIB_DLLTMPLMAPPING);
00628
00629 OSG_END_NAMESPACE
00630
00631
00632
00633
00634
00635 #ifdef OSG_SGI_CC
00636 #pragma set woff 1174
00637 #endif
00638
00639 #ifdef OSG_LINUX_ICC
00640 #pragma warning( disable : 177 )
00641 #endif
00642
00643 namespace
00644 {
00645 static Char8 cvsid_cpp [] = "@(#)$Id: FCBaseTemplate_cpp.h,v 1.45 2005/07/20 00:10:14 vossg Exp $";
00646 static Char8 cvsid_hpp [] = OSGPOLYGONCHUNKBASE_HEADER_CVSID;
00647 static Char8 cvsid_inl [] = OSGPOLYGONCHUNKBASE_INLINE_CVSID;
00648
00649 static Char8 cvsid_fields_hpp[] = OSGPOLYGONCHUNKFIELDS_HEADER_CVSID;
00650 }
00651