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_COMPILESHLCHUNKINST
00055
00056 #include <stdlib.h>
00057 #include <stdio.h>
00058
00059 #include <OSGConfig.h>
00060
00061 #include "OSGSHLChunkBase.h"
00062 #include "OSGSHLChunk.h"
00063
00064 #include <OSGGL.h>
00065
00066 OSG_BEGIN_NAMESPACE
00067
00068 const OSG::BitVector SHLChunkBase::CgFrontEndFieldMask =
00069 (TypeTraits<BitVector>::One << SHLChunkBase::CgFrontEndFieldId);
00070
00071 const OSG::BitVector SHLChunkBase::PointSizeFieldMask =
00072 (TypeTraits<BitVector>::One << SHLChunkBase::PointSizeFieldId);
00073
00074 const OSG::BitVector SHLChunkBase::ProgramParameterNamesFieldMask =
00075 (TypeTraits<BitVector>::One << SHLChunkBase::ProgramParameterNamesFieldId);
00076
00077 const OSG::BitVector SHLChunkBase::ProgramParameterValuesFieldMask =
00078 (TypeTraits<BitVector>::One << SHLChunkBase::ProgramParameterValuesFieldId);
00079
00080 const OSG::BitVector SHLChunkBase::GLIdFieldMask =
00081 (TypeTraits<BitVector>::One << SHLChunkBase::GLIdFieldId);
00082
00083 const OSG::BitVector SHLChunkBase::IgnoreGLForAspectFieldMask =
00084 (TypeTraits<BitVector>::One << SHLChunkBase::IgnoreGLForAspectFieldId);
00085
00086 const OSG::BitVector SHLChunkBase::MTInfluenceMask =
00087 (Inherited::MTInfluenceMask) |
00088 (static_cast<BitVector>(0x0) << Inherited::NextFieldId);
00089
00090
00091
00092
00112
00113
00114 FieldDescription *SHLChunkBase::_desc[] =
00115 {
00116 new FieldDescription(SFBool::getClassType(),
00117 "cgFrontEnd",
00118 CgFrontEndFieldId, CgFrontEndFieldMask,
00119 false,
00120 (FieldAccessMethod) &SHLChunkBase::getSFCgFrontEnd),
00121 new FieldDescription(SFBool::getClassType(),
00122 "pointSize",
00123 PointSizeFieldId, PointSizeFieldMask,
00124 false,
00125 (FieldAccessMethod) &SHLChunkBase::getSFPointSize),
00126 new FieldDescription(MFGLenum::getClassType(),
00127 "programParameterNames",
00128 ProgramParameterNamesFieldId, ProgramParameterNamesFieldMask,
00129 false,
00130 (FieldAccessMethod) &SHLChunkBase::getMFProgramParameterNames),
00131 new FieldDescription(MFUInt32::getClassType(),
00132 "programParameterValues",
00133 ProgramParameterValuesFieldId, ProgramParameterValuesFieldMask,
00134 false,
00135 (FieldAccessMethod) &SHLChunkBase::getMFProgramParameterValues),
00136 new FieldDescription(SFUInt32::getClassType(),
00137 "GLId",
00138 GLIdFieldId, GLIdFieldMask,
00139 true,
00140 (FieldAccessMethod) &SHLChunkBase::getSFGLId),
00141 new FieldDescription(SFInt32::getClassType(),
00142 "IgnoreGLForAspect",
00143 IgnoreGLForAspectFieldId, IgnoreGLForAspectFieldMask,
00144 true,
00145 (FieldAccessMethod) &SHLChunkBase::getSFIgnoreGLForAspect)
00146 };
00147
00148
00149 FieldContainerType SHLChunkBase::_type(
00150 "SHLChunk",
00151 "ShaderChunk",
00152 NULL,
00153 (PrototypeCreateF) &SHLChunkBase::createEmpty,
00154 SHLChunk::initMethod,
00155 _desc,
00156 sizeof(_desc));
00157
00158
00159
00160
00161
00162 FieldContainerType &SHLChunkBase::getType(void)
00163 {
00164 return _type;
00165 }
00166
00167 const FieldContainerType &SHLChunkBase::getType(void) const
00168 {
00169 return _type;
00170 }
00171
00172
00173 FieldContainerPtr SHLChunkBase::shallowCopy(void) const
00174 {
00175 SHLChunkPtr returnValue;
00176
00177 newPtr(returnValue, dynamic_cast<const SHLChunk *>(this));
00178
00179 return returnValue;
00180 }
00181
00182 UInt32 SHLChunkBase::getContainerSize(void) const
00183 {
00184 return sizeof(SHLChunk);
00185 }
00186
00187
00188 #if !defined(OSG_FIXED_MFIELDSYNC)
00189 void SHLChunkBase::executeSync( FieldContainer &other,
00190 const BitVector &whichField)
00191 {
00192 this->executeSyncImpl((SHLChunkBase *) &other, whichField);
00193 }
00194 #else
00195 void SHLChunkBase::executeSync( FieldContainer &other,
00196 const BitVector &whichField, const SyncInfo &sInfo )
00197 {
00198 this->executeSyncImpl((SHLChunkBase *) &other, whichField, sInfo);
00199 }
00200 void SHLChunkBase::execBeginEdit(const BitVector &whichField,
00201 UInt32 uiAspect,
00202 UInt32 uiContainerSize)
00203 {
00204 this->execBeginEditImpl(whichField, uiAspect, uiContainerSize);
00205 }
00206
00207 void SHLChunkBase::onDestroyAspect(UInt32 uiId, UInt32 uiAspect)
00208 {
00209 Inherited::onDestroyAspect(uiId, uiAspect);
00210
00211 _mfProgramParameterNames.terminateShare(uiAspect, this->getContainerSize());
00212 _mfProgramParameterValues.terminateShare(uiAspect, this->getContainerSize());
00213 }
00214 #endif
00215
00216
00217
00218 #ifdef OSG_WIN32_ICL
00219 #pragma warning (disable : 383)
00220 #endif
00221
00222 SHLChunkBase::SHLChunkBase(void) :
00223 _sfCgFrontEnd (bool(false)),
00224 _sfPointSize (bool(false)),
00225 _mfProgramParameterNames (),
00226 _mfProgramParameterValues (),
00227 _sfGLId (),
00228 _sfIgnoreGLForAspect (Int32(-1)),
00229 Inherited()
00230 {
00231 }
00232
00233 #ifdef OSG_WIN32_ICL
00234 #pragma warning (default : 383)
00235 #endif
00236
00237 SHLChunkBase::SHLChunkBase(const SHLChunkBase &source) :
00238 _sfCgFrontEnd (source._sfCgFrontEnd ),
00239 _sfPointSize (source._sfPointSize ),
00240 _mfProgramParameterNames (source._mfProgramParameterNames ),
00241 _mfProgramParameterValues (source._mfProgramParameterValues ),
00242 _sfGLId (source._sfGLId ),
00243 _sfIgnoreGLForAspect (source._sfIgnoreGLForAspect ),
00244 Inherited (source)
00245 {
00246 }
00247
00248
00249
00250 SHLChunkBase::~SHLChunkBase(void)
00251 {
00252 }
00253
00254
00255
00256 UInt32 SHLChunkBase::getBinSize(const BitVector &whichField)
00257 {
00258 UInt32 returnValue = Inherited::getBinSize(whichField);
00259
00260 if(FieldBits::NoField != (CgFrontEndFieldMask & whichField))
00261 {
00262 returnValue += _sfCgFrontEnd.getBinSize();
00263 }
00264
00265 if(FieldBits::NoField != (PointSizeFieldMask & whichField))
00266 {
00267 returnValue += _sfPointSize.getBinSize();
00268 }
00269
00270 if(FieldBits::NoField != (ProgramParameterNamesFieldMask & whichField))
00271 {
00272 returnValue += _mfProgramParameterNames.getBinSize();
00273 }
00274
00275 if(FieldBits::NoField != (ProgramParameterValuesFieldMask & whichField))
00276 {
00277 returnValue += _mfProgramParameterValues.getBinSize();
00278 }
00279
00280 if(FieldBits::NoField != (GLIdFieldMask & whichField))
00281 {
00282 returnValue += _sfGLId.getBinSize();
00283 }
00284
00285 if(FieldBits::NoField != (IgnoreGLForAspectFieldMask & whichField))
00286 {
00287 returnValue += _sfIgnoreGLForAspect.getBinSize();
00288 }
00289
00290
00291 return returnValue;
00292 }
00293
00294 void SHLChunkBase::copyToBin( BinaryDataHandler &pMem,
00295 const BitVector &whichField)
00296 {
00297 Inherited::copyToBin(pMem, whichField);
00298
00299 if(FieldBits::NoField != (CgFrontEndFieldMask & whichField))
00300 {
00301 _sfCgFrontEnd.copyToBin(pMem);
00302 }
00303
00304 if(FieldBits::NoField != (PointSizeFieldMask & whichField))
00305 {
00306 _sfPointSize.copyToBin(pMem);
00307 }
00308
00309 if(FieldBits::NoField != (ProgramParameterNamesFieldMask & whichField))
00310 {
00311 _mfProgramParameterNames.copyToBin(pMem);
00312 }
00313
00314 if(FieldBits::NoField != (ProgramParameterValuesFieldMask & whichField))
00315 {
00316 _mfProgramParameterValues.copyToBin(pMem);
00317 }
00318
00319 if(FieldBits::NoField != (GLIdFieldMask & whichField))
00320 {
00321 _sfGLId.copyToBin(pMem);
00322 }
00323
00324 if(FieldBits::NoField != (IgnoreGLForAspectFieldMask & whichField))
00325 {
00326 _sfIgnoreGLForAspect.copyToBin(pMem);
00327 }
00328
00329
00330 }
00331
00332 void SHLChunkBase::copyFromBin( BinaryDataHandler &pMem,
00333 const BitVector &whichField)
00334 {
00335 Inherited::copyFromBin(pMem, whichField);
00336
00337 if(FieldBits::NoField != (CgFrontEndFieldMask & whichField))
00338 {
00339 _sfCgFrontEnd.copyFromBin(pMem);
00340 }
00341
00342 if(FieldBits::NoField != (PointSizeFieldMask & whichField))
00343 {
00344 _sfPointSize.copyFromBin(pMem);
00345 }
00346
00347 if(FieldBits::NoField != (ProgramParameterNamesFieldMask & whichField))
00348 {
00349 _mfProgramParameterNames.copyFromBin(pMem);
00350 }
00351
00352 if(FieldBits::NoField != (ProgramParameterValuesFieldMask & whichField))
00353 {
00354 _mfProgramParameterValues.copyFromBin(pMem);
00355 }
00356
00357 if(FieldBits::NoField != (GLIdFieldMask & whichField))
00358 {
00359 _sfGLId.copyFromBin(pMem);
00360 }
00361
00362 if(FieldBits::NoField != (IgnoreGLForAspectFieldMask & whichField))
00363 {
00364 _sfIgnoreGLForAspect.copyFromBin(pMem);
00365 }
00366
00367
00368 }
00369
00370 #if !defined(OSG_FIXED_MFIELDSYNC)
00371 void SHLChunkBase::executeSyncImpl( SHLChunkBase *pOther,
00372 const BitVector &whichField)
00373 {
00374
00375 Inherited::executeSyncImpl(pOther, whichField);
00376
00377 if(FieldBits::NoField != (CgFrontEndFieldMask & whichField))
00378 _sfCgFrontEnd.syncWith(pOther->_sfCgFrontEnd);
00379
00380 if(FieldBits::NoField != (PointSizeFieldMask & whichField))
00381 _sfPointSize.syncWith(pOther->_sfPointSize);
00382
00383 if(FieldBits::NoField != (ProgramParameterNamesFieldMask & whichField))
00384 _mfProgramParameterNames.syncWith(pOther->_mfProgramParameterNames);
00385
00386 if(FieldBits::NoField != (ProgramParameterValuesFieldMask & whichField))
00387 _mfProgramParameterValues.syncWith(pOther->_mfProgramParameterValues);
00388
00389 if(FieldBits::NoField != (GLIdFieldMask & whichField))
00390 _sfGLId.syncWith(pOther->_sfGLId);
00391
00392 if(FieldBits::NoField != (IgnoreGLForAspectFieldMask & whichField))
00393 _sfIgnoreGLForAspect.syncWith(pOther->_sfIgnoreGLForAspect);
00394
00395
00396 }
00397 #else
00398 void SHLChunkBase::executeSyncImpl( SHLChunkBase *pOther,
00399 const BitVector &whichField,
00400 const SyncInfo &sInfo )
00401 {
00402
00403 Inherited::executeSyncImpl(pOther, whichField, sInfo);
00404
00405 if(FieldBits::NoField != (CgFrontEndFieldMask & whichField))
00406 _sfCgFrontEnd.syncWith(pOther->_sfCgFrontEnd);
00407
00408 if(FieldBits::NoField != (PointSizeFieldMask & whichField))
00409 _sfPointSize.syncWith(pOther->_sfPointSize);
00410
00411 if(FieldBits::NoField != (GLIdFieldMask & whichField))
00412 _sfGLId.syncWith(pOther->_sfGLId);
00413
00414 if(FieldBits::NoField != (IgnoreGLForAspectFieldMask & whichField))
00415 _sfIgnoreGLForAspect.syncWith(pOther->_sfIgnoreGLForAspect);
00416
00417
00418 if(FieldBits::NoField != (ProgramParameterNamesFieldMask & whichField))
00419 _mfProgramParameterNames.syncWith(pOther->_mfProgramParameterNames, sInfo);
00420
00421 if(FieldBits::NoField != (ProgramParameterValuesFieldMask & whichField))
00422 _mfProgramParameterValues.syncWith(pOther->_mfProgramParameterValues, sInfo);
00423
00424
00425 }
00426
00427 void SHLChunkBase::execBeginEditImpl (const BitVector &whichField,
00428 UInt32 uiAspect,
00429 UInt32 uiContainerSize)
00430 {
00431 Inherited::execBeginEditImpl(whichField, uiAspect, uiContainerSize);
00432
00433 if(FieldBits::NoField != (ProgramParameterNamesFieldMask & whichField))
00434 _mfProgramParameterNames.beginEdit(uiAspect, uiContainerSize);
00435
00436 if(FieldBits::NoField != (ProgramParameterValuesFieldMask & whichField))
00437 _mfProgramParameterValues.beginEdit(uiAspect, uiContainerSize);
00438
00439 }
00440 #endif
00441
00442
00443
00444 OSG_END_NAMESPACE
00445
00446 #include <OSGSFieldTypeDef.inl>
00447 #include <OSGMFieldTypeDef.inl>
00448
00449 OSG_BEGIN_NAMESPACE
00450
00451 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
00452 DataType FieldDataTraits<SHLChunkPtr>::_type("SHLChunkPtr", "ShaderChunkPtr");
00453 #endif
00454
00455 OSG_DLLEXPORT_SFIELD_DEF1(SHLChunkPtr, OSG_SYSTEMLIB_DLLTMPLMAPPING);
00456 OSG_DLLEXPORT_MFIELD_DEF1(SHLChunkPtr, OSG_SYSTEMLIB_DLLTMPLMAPPING);
00457
00458
00459
00460
00461
00462 #ifdef OSG_SGI_CC
00463 #pragma set woff 1174
00464 #endif
00465
00466 #ifdef OSG_LINUX_ICC
00467 #pragma warning( disable : 177 )
00468 #endif
00469
00470 namespace
00471 {
00472 static Char8 cvsid_cpp [] = "@(#)$Id: OSGSHLChunkBase.cpp,v 1.14 2006/11/17 17:16:04 a-m-z Exp $";
00473 static Char8 cvsid_hpp [] = OSGSHLCHUNKBASE_HEADER_CVSID;
00474 static Char8 cvsid_inl [] = OSGSHLCHUNKBASE_INLINE_CVSID;
00475
00476 static Char8 cvsid_fields_hpp[] = OSGSHLCHUNKFIELDS_HEADER_CVSID;
00477 }
00478
00479 OSG_END_NAMESPACE
00480