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_COMPILETEXTUREBACKGROUNDINST
00055
00056 #include <stdlib.h>
00057 #include <stdio.h>
00058
00059 #include <OSGConfig.h>
00060
00061 #include "OSGTextureBackgroundBase.h"
00062 #include "OSGTextureBackground.h"
00063
00064
00065 OSG_BEGIN_NAMESPACE
00066
00067 const OSG::BitVector TextureBackgroundBase::ColorFieldMask =
00068 (TypeTraits<BitVector>::One << TextureBackgroundBase::ColorFieldId);
00069
00070 const OSG::BitVector TextureBackgroundBase::TextureFieldMask =
00071 (TypeTraits<BitVector>::One << TextureBackgroundBase::TextureFieldId);
00072
00073 const OSG::BitVector TextureBackgroundBase::TexCoordsFieldMask =
00074 (TypeTraits<BitVector>::One << TextureBackgroundBase::TexCoordsFieldId);
00075
00076 const OSG::BitVector TextureBackgroundBase::RadialDistortionFieldMask =
00077 (TypeTraits<BitVector>::One << TextureBackgroundBase::RadialDistortionFieldId);
00078
00079 const OSG::BitVector TextureBackgroundBase::CenterOfDistortionFieldMask =
00080 (TypeTraits<BitVector>::One << TextureBackgroundBase::CenterOfDistortionFieldId);
00081
00082 const OSG::BitVector TextureBackgroundBase::HorFieldMask =
00083 (TypeTraits<BitVector>::One << TextureBackgroundBase::HorFieldId);
00084
00085 const OSG::BitVector TextureBackgroundBase::VertFieldMask =
00086 (TypeTraits<BitVector>::One << TextureBackgroundBase::VertFieldId);
00087
00088 const OSG::BitVector TextureBackgroundBase::ClearStencilBitFieldMask =
00089 (TypeTraits<BitVector>::One << TextureBackgroundBase::ClearStencilBitFieldId);
00090
00091 const OSG::BitVector TextureBackgroundBase::MTInfluenceMask =
00092 (Inherited::MTInfluenceMask) |
00093 (static_cast<BitVector>(0x0) << Inherited::NextFieldId);
00094
00095
00096
00097
00123
00124
00125 FieldDescription *TextureBackgroundBase::_desc[] =
00126 {
00127 new FieldDescription(SFColor4f::getClassType(),
00128 "color",
00129 ColorFieldId, ColorFieldMask,
00130 false,
00131 (FieldAccessMethod) &TextureBackgroundBase::getSFColor),
00132 new FieldDescription(SFTextureChunkPtr::getClassType(),
00133 "texture",
00134 TextureFieldId, TextureFieldMask,
00135 false,
00136 (FieldAccessMethod) &TextureBackgroundBase::getSFTexture),
00137 new FieldDescription(MFPnt2f::getClassType(),
00138 "texCoords",
00139 TexCoordsFieldId, TexCoordsFieldMask,
00140 false,
00141 (FieldAccessMethod) &TextureBackgroundBase::getMFTexCoords),
00142 new FieldDescription(SFReal32::getClassType(),
00143 "radialDistortion",
00144 RadialDistortionFieldId, RadialDistortionFieldMask,
00145 false,
00146 (FieldAccessMethod) &TextureBackgroundBase::getSFRadialDistortion),
00147 new FieldDescription(SFVec2f::getClassType(),
00148 "centerOfDistortion",
00149 CenterOfDistortionFieldId, CenterOfDistortionFieldMask,
00150 false,
00151 (FieldAccessMethod) &TextureBackgroundBase::getSFCenterOfDistortion),
00152 new FieldDescription(SFUInt16::getClassType(),
00153 "hor",
00154 HorFieldId, HorFieldMask,
00155 false,
00156 (FieldAccessMethod) &TextureBackgroundBase::getSFHor),
00157 new FieldDescription(SFUInt16::getClassType(),
00158 "vert",
00159 VertFieldId, VertFieldMask,
00160 false,
00161 (FieldAccessMethod) &TextureBackgroundBase::getSFVert),
00162 new FieldDescription(SFInt32::getClassType(),
00163 "clearStencilBit",
00164 ClearStencilBitFieldId, ClearStencilBitFieldMask,
00165 false,
00166 (FieldAccessMethod) &TextureBackgroundBase::getSFClearStencilBit)
00167 };
00168
00169
00170 FieldContainerType TextureBackgroundBase::_type(
00171 "TextureBackground",
00172 "Background",
00173 NULL,
00174 (PrototypeCreateF) &TextureBackgroundBase::createEmpty,
00175 TextureBackground::initMethod,
00176 _desc,
00177 sizeof(_desc));
00178
00179
00180
00181
00182
00183 FieldContainerType &TextureBackgroundBase::getType(void)
00184 {
00185 return _type;
00186 }
00187
00188 const FieldContainerType &TextureBackgroundBase::getType(void) const
00189 {
00190 return _type;
00191 }
00192
00193
00194 FieldContainerPtr TextureBackgroundBase::shallowCopy(void) const
00195 {
00196 TextureBackgroundPtr returnValue;
00197
00198 newPtr(returnValue, dynamic_cast<const TextureBackground *>(this));
00199
00200 return returnValue;
00201 }
00202
00203 UInt32 TextureBackgroundBase::getContainerSize(void) const
00204 {
00205 return sizeof(TextureBackground);
00206 }
00207
00208
00209 #if !defined(OSG_FIXED_MFIELDSYNC)
00210 void TextureBackgroundBase::executeSync( FieldContainer &other,
00211 const BitVector &whichField)
00212 {
00213 this->executeSyncImpl((TextureBackgroundBase *) &other, whichField);
00214 }
00215 #else
00216 void TextureBackgroundBase::executeSync( FieldContainer &other,
00217 const BitVector &whichField, const SyncInfo &sInfo )
00218 {
00219 this->executeSyncImpl((TextureBackgroundBase *) &other, whichField, sInfo);
00220 }
00221 void TextureBackgroundBase::execBeginEdit(const BitVector &whichField,
00222 UInt32 uiAspect,
00223 UInt32 uiContainerSize)
00224 {
00225 this->execBeginEditImpl(whichField, uiAspect, uiContainerSize);
00226 }
00227
00228 void TextureBackgroundBase::onDestroyAspect(UInt32 uiId, UInt32 uiAspect)
00229 {
00230 Inherited::onDestroyAspect(uiId, uiAspect);
00231
00232 _mfTexCoords.terminateShare(uiAspect, this->getContainerSize());
00233 }
00234 #endif
00235
00236
00237
00238 #ifdef OSG_WIN32_ICL
00239 #pragma warning (disable : 383)
00240 #endif
00241
00242 TextureBackgroundBase::TextureBackgroundBase(void) :
00243 _sfColor (),
00244 _sfTexture (),
00245 _mfTexCoords (),
00246 _sfRadialDistortion (Real32(0)),
00247 _sfCenterOfDistortion (Vec2f(0.5, 0.5)),
00248 _sfHor (UInt16(2)),
00249 _sfVert (UInt16(2)),
00250 _sfClearStencilBit (Int32(-1)),
00251 Inherited()
00252 {
00253 }
00254
00255 #ifdef OSG_WIN32_ICL
00256 #pragma warning (default : 383)
00257 #endif
00258
00259 TextureBackgroundBase::TextureBackgroundBase(const TextureBackgroundBase &source) :
00260 _sfColor (source._sfColor ),
00261 _sfTexture (source._sfTexture ),
00262 _mfTexCoords (source._mfTexCoords ),
00263 _sfRadialDistortion (source._sfRadialDistortion ),
00264 _sfCenterOfDistortion (source._sfCenterOfDistortion ),
00265 _sfHor (source._sfHor ),
00266 _sfVert (source._sfVert ),
00267 _sfClearStencilBit (source._sfClearStencilBit ),
00268 Inherited (source)
00269 {
00270 }
00271
00272
00273
00274 TextureBackgroundBase::~TextureBackgroundBase(void)
00275 {
00276 }
00277
00278
00279
00280 UInt32 TextureBackgroundBase::getBinSize(const BitVector &whichField)
00281 {
00282 UInt32 returnValue = Inherited::getBinSize(whichField);
00283
00284 if(FieldBits::NoField != (ColorFieldMask & whichField))
00285 {
00286 returnValue += _sfColor.getBinSize();
00287 }
00288
00289 if(FieldBits::NoField != (TextureFieldMask & whichField))
00290 {
00291 returnValue += _sfTexture.getBinSize();
00292 }
00293
00294 if(FieldBits::NoField != (TexCoordsFieldMask & whichField))
00295 {
00296 returnValue += _mfTexCoords.getBinSize();
00297 }
00298
00299 if(FieldBits::NoField != (RadialDistortionFieldMask & whichField))
00300 {
00301 returnValue += _sfRadialDistortion.getBinSize();
00302 }
00303
00304 if(FieldBits::NoField != (CenterOfDistortionFieldMask & whichField))
00305 {
00306 returnValue += _sfCenterOfDistortion.getBinSize();
00307 }
00308
00309 if(FieldBits::NoField != (HorFieldMask & whichField))
00310 {
00311 returnValue += _sfHor.getBinSize();
00312 }
00313
00314 if(FieldBits::NoField != (VertFieldMask & whichField))
00315 {
00316 returnValue += _sfVert.getBinSize();
00317 }
00318
00319 if(FieldBits::NoField != (ClearStencilBitFieldMask & whichField))
00320 {
00321 returnValue += _sfClearStencilBit.getBinSize();
00322 }
00323
00324
00325 return returnValue;
00326 }
00327
00328 void TextureBackgroundBase::copyToBin( BinaryDataHandler &pMem,
00329 const BitVector &whichField)
00330 {
00331 Inherited::copyToBin(pMem, whichField);
00332
00333 if(FieldBits::NoField != (ColorFieldMask & whichField))
00334 {
00335 _sfColor.copyToBin(pMem);
00336 }
00337
00338 if(FieldBits::NoField != (TextureFieldMask & whichField))
00339 {
00340 _sfTexture.copyToBin(pMem);
00341 }
00342
00343 if(FieldBits::NoField != (TexCoordsFieldMask & whichField))
00344 {
00345 _mfTexCoords.copyToBin(pMem);
00346 }
00347
00348 if(FieldBits::NoField != (RadialDistortionFieldMask & whichField))
00349 {
00350 _sfRadialDistortion.copyToBin(pMem);
00351 }
00352
00353 if(FieldBits::NoField != (CenterOfDistortionFieldMask & whichField))
00354 {
00355 _sfCenterOfDistortion.copyToBin(pMem);
00356 }
00357
00358 if(FieldBits::NoField != (HorFieldMask & whichField))
00359 {
00360 _sfHor.copyToBin(pMem);
00361 }
00362
00363 if(FieldBits::NoField != (VertFieldMask & whichField))
00364 {
00365 _sfVert.copyToBin(pMem);
00366 }
00367
00368 if(FieldBits::NoField != (ClearStencilBitFieldMask & whichField))
00369 {
00370 _sfClearStencilBit.copyToBin(pMem);
00371 }
00372
00373
00374 }
00375
00376 void TextureBackgroundBase::copyFromBin( BinaryDataHandler &pMem,
00377 const BitVector &whichField)
00378 {
00379 Inherited::copyFromBin(pMem, whichField);
00380
00381 if(FieldBits::NoField != (ColorFieldMask & whichField))
00382 {
00383 _sfColor.copyFromBin(pMem);
00384 }
00385
00386 if(FieldBits::NoField != (TextureFieldMask & whichField))
00387 {
00388 _sfTexture.copyFromBin(pMem);
00389 }
00390
00391 if(FieldBits::NoField != (TexCoordsFieldMask & whichField))
00392 {
00393 _mfTexCoords.copyFromBin(pMem);
00394 }
00395
00396 if(FieldBits::NoField != (RadialDistortionFieldMask & whichField))
00397 {
00398 _sfRadialDistortion.copyFromBin(pMem);
00399 }
00400
00401 if(FieldBits::NoField != (CenterOfDistortionFieldMask & whichField))
00402 {
00403 _sfCenterOfDistortion.copyFromBin(pMem);
00404 }
00405
00406 if(FieldBits::NoField != (HorFieldMask & whichField))
00407 {
00408 _sfHor.copyFromBin(pMem);
00409 }
00410
00411 if(FieldBits::NoField != (VertFieldMask & whichField))
00412 {
00413 _sfVert.copyFromBin(pMem);
00414 }
00415
00416 if(FieldBits::NoField != (ClearStencilBitFieldMask & whichField))
00417 {
00418 _sfClearStencilBit.copyFromBin(pMem);
00419 }
00420
00421
00422 }
00423
00424 #if !defined(OSG_FIXED_MFIELDSYNC)
00425 void TextureBackgroundBase::executeSyncImpl( TextureBackgroundBase *pOther,
00426 const BitVector &whichField)
00427 {
00428
00429 Inherited::executeSyncImpl(pOther, whichField);
00430
00431 if(FieldBits::NoField != (ColorFieldMask & whichField))
00432 _sfColor.syncWith(pOther->_sfColor);
00433
00434 if(FieldBits::NoField != (TextureFieldMask & whichField))
00435 _sfTexture.syncWith(pOther->_sfTexture);
00436
00437 if(FieldBits::NoField != (TexCoordsFieldMask & whichField))
00438 _mfTexCoords.syncWith(pOther->_mfTexCoords);
00439
00440 if(FieldBits::NoField != (RadialDistortionFieldMask & whichField))
00441 _sfRadialDistortion.syncWith(pOther->_sfRadialDistortion);
00442
00443 if(FieldBits::NoField != (CenterOfDistortionFieldMask & whichField))
00444 _sfCenterOfDistortion.syncWith(pOther->_sfCenterOfDistortion);
00445
00446 if(FieldBits::NoField != (HorFieldMask & whichField))
00447 _sfHor.syncWith(pOther->_sfHor);
00448
00449 if(FieldBits::NoField != (VertFieldMask & whichField))
00450 _sfVert.syncWith(pOther->_sfVert);
00451
00452 if(FieldBits::NoField != (ClearStencilBitFieldMask & whichField))
00453 _sfClearStencilBit.syncWith(pOther->_sfClearStencilBit);
00454
00455
00456 }
00457 #else
00458 void TextureBackgroundBase::executeSyncImpl( TextureBackgroundBase *pOther,
00459 const BitVector &whichField,
00460 const SyncInfo &sInfo )
00461 {
00462
00463 Inherited::executeSyncImpl(pOther, whichField, sInfo);
00464
00465 if(FieldBits::NoField != (ColorFieldMask & whichField))
00466 _sfColor.syncWith(pOther->_sfColor);
00467
00468 if(FieldBits::NoField != (TextureFieldMask & whichField))
00469 _sfTexture.syncWith(pOther->_sfTexture);
00470
00471 if(FieldBits::NoField != (RadialDistortionFieldMask & whichField))
00472 _sfRadialDistortion.syncWith(pOther->_sfRadialDistortion);
00473
00474 if(FieldBits::NoField != (CenterOfDistortionFieldMask & whichField))
00475 _sfCenterOfDistortion.syncWith(pOther->_sfCenterOfDistortion);
00476
00477 if(FieldBits::NoField != (HorFieldMask & whichField))
00478 _sfHor.syncWith(pOther->_sfHor);
00479
00480 if(FieldBits::NoField != (VertFieldMask & whichField))
00481 _sfVert.syncWith(pOther->_sfVert);
00482
00483 if(FieldBits::NoField != (ClearStencilBitFieldMask & whichField))
00484 _sfClearStencilBit.syncWith(pOther->_sfClearStencilBit);
00485
00486
00487 if(FieldBits::NoField != (TexCoordsFieldMask & whichField))
00488 _mfTexCoords.syncWith(pOther->_mfTexCoords, sInfo);
00489
00490
00491 }
00492
00493 void TextureBackgroundBase::execBeginEditImpl (const BitVector &whichField,
00494 UInt32 uiAspect,
00495 UInt32 uiContainerSize)
00496 {
00497 Inherited::execBeginEditImpl(whichField, uiAspect, uiContainerSize);
00498
00499 if(FieldBits::NoField != (TexCoordsFieldMask & whichField))
00500 _mfTexCoords.beginEdit(uiAspect, uiContainerSize);
00501
00502 }
00503 #endif
00504
00505
00506
00507 OSG_END_NAMESPACE
00508
00509 #include <OSGSFieldTypeDef.inl>
00510
00511 OSG_BEGIN_NAMESPACE
00512
00513 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
00514 DataType FieldDataTraits<TextureBackgroundPtr>::_type("TextureBackgroundPtr", "BackgroundPtr");
00515 #endif
00516
00517 OSG_DLLEXPORT_SFIELD_DEF1(TextureBackgroundPtr, OSG_SYSTEMLIB_DLLTMPLMAPPING);
00518
00519
00520
00521
00522
00523 #ifdef OSG_SGI_CC
00524 #pragma set woff 1174
00525 #endif
00526
00527 #ifdef OSG_LINUX_ICC
00528 #pragma warning( disable : 177 )
00529 #endif
00530
00531 namespace
00532 {
00533 static Char8 cvsid_cpp [] = "@(#)$Id: OSGTextureBackgroundBase.cpp,v 1.8 2006/09/08 13:45:30 yjung Exp $";
00534 static Char8 cvsid_hpp [] = OSGTEXTUREBACKGROUNDBASE_HEADER_CVSID;
00535 static Char8 cvsid_inl [] = OSGTEXTUREBACKGROUNDBASE_INLINE_CVSID;
00536
00537 static Char8 cvsid_fields_hpp[] = OSGTEXTUREBACKGROUNDFIELDS_HEADER_CVSID;
00538 }
00539
00540 OSG_END_NAMESPACE
00541