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_COMPILECHUNKMATERIALINST
00055
00056 #include <stdlib.h>
00057 #include <stdio.h>
00058
00059 #include <OSGConfig.h>
00060
00061 #include "OSGChunkMaterialBase.h"
00062 #include "OSGChunkMaterial.h"
00063
00064
00065 OSG_USING_NAMESPACE
00066
00067 const OSG::BitVector ChunkMaterialBase::ChunksFieldMask =
00068 (TypeTraits<BitVector>::One << ChunkMaterialBase::ChunksFieldId);
00069
00070 const OSG::BitVector ChunkMaterialBase::SlotsFieldMask =
00071 (TypeTraits<BitVector>::One << ChunkMaterialBase::SlotsFieldId);
00072
00073 const OSG::BitVector ChunkMaterialBase::MTInfluenceMask =
00074 (Inherited::MTInfluenceMask) |
00075 (static_cast<BitVector>(0x0) << Inherited::NextFieldId);
00076
00077
00078
00079
00087
00088
00089 FieldDescription *ChunkMaterialBase::_desc[] =
00090 {
00091 new FieldDescription(MFStateChunkPtr::getClassType(),
00092 "chunks",
00093 ChunksFieldId, ChunksFieldMask,
00094 false,
00095 (FieldAccessMethod) &ChunkMaterialBase::getMFChunks),
00096 new FieldDescription(MFInt32::getClassType(),
00097 "slots",
00098 SlotsFieldId, SlotsFieldMask,
00099 false,
00100 (FieldAccessMethod) &ChunkMaterialBase::getMFSlots)
00101 };
00102
00103
00104 FieldContainerType ChunkMaterialBase::_type(
00105 "ChunkMaterial",
00106 "Material",
00107 NULL,
00108 (PrototypeCreateF) &ChunkMaterialBase::createEmpty,
00109 ChunkMaterial::initMethod,
00110 _desc,
00111 sizeof(_desc));
00112
00113
00114
00115
00116
00117 FieldContainerType &ChunkMaterialBase::getType(void)
00118 {
00119 return _type;
00120 }
00121
00122 const FieldContainerType &ChunkMaterialBase::getType(void) const
00123 {
00124 return _type;
00125 }
00126
00127
00128 FieldContainerPtr ChunkMaterialBase::shallowCopy(void) const
00129 {
00130 ChunkMaterialPtr returnValue;
00131
00132 newPtr(returnValue, dynamic_cast<const ChunkMaterial *>(this));
00133
00134 return returnValue;
00135 }
00136
00137 UInt32 ChunkMaterialBase::getContainerSize(void) const
00138 {
00139 return sizeof(ChunkMaterial);
00140 }
00141
00142
00143 #if !defined(OSG_FIXED_MFIELDSYNC)
00144 void ChunkMaterialBase::executeSync( FieldContainer &other,
00145 const BitVector &whichField)
00146 {
00147 this->executeSyncImpl((ChunkMaterialBase *) &other, whichField);
00148 }
00149 #else
00150 void ChunkMaterialBase::executeSync( FieldContainer &other,
00151 const BitVector &whichField, const SyncInfo &sInfo )
00152 {
00153 this->executeSyncImpl((ChunkMaterialBase *) &other, whichField, sInfo);
00154 }
00155 void ChunkMaterialBase::execBeginEdit(const BitVector &whichField,
00156 UInt32 uiAspect,
00157 UInt32 uiContainerSize)
00158 {
00159 this->execBeginEditImpl(whichField, uiAspect, uiContainerSize);
00160 }
00161
00162 void ChunkMaterialBase::onDestroyAspect(UInt32 uiId, UInt32 uiAspect)
00163 {
00164 Inherited::onDestroyAspect(uiId, uiAspect);
00165
00166 _mfChunks.terminateShare(uiAspect, this->getContainerSize());
00167 _mfSlots.terminateShare(uiAspect, this->getContainerSize());
00168 }
00169 #endif
00170
00171
00172
00173 #ifdef OSG_WIN32_ICL
00174 #pragma warning (disable : 383)
00175 #endif
00176
00177 ChunkMaterialBase::ChunkMaterialBase(void) :
00178 _mfChunks (),
00179 _mfSlots (),
00180 Inherited()
00181 {
00182 }
00183
00184 #ifdef OSG_WIN32_ICL
00185 #pragma warning (default : 383)
00186 #endif
00187
00188 ChunkMaterialBase::ChunkMaterialBase(const ChunkMaterialBase &source) :
00189 _mfChunks (source._mfChunks ),
00190 _mfSlots (source._mfSlots ),
00191 Inherited (source)
00192 {
00193 }
00194
00195
00196
00197 ChunkMaterialBase::~ChunkMaterialBase(void)
00198 {
00199 }
00200
00201
00202
00203 UInt32 ChunkMaterialBase::getBinSize(const BitVector &whichField)
00204 {
00205 UInt32 returnValue = Inherited::getBinSize(whichField);
00206
00207 if(FieldBits::NoField != (ChunksFieldMask & whichField))
00208 {
00209 returnValue += _mfChunks.getBinSize();
00210 }
00211
00212 if(FieldBits::NoField != (SlotsFieldMask & whichField))
00213 {
00214 returnValue += _mfSlots.getBinSize();
00215 }
00216
00217
00218 return returnValue;
00219 }
00220
00221 void ChunkMaterialBase::copyToBin( BinaryDataHandler &pMem,
00222 const BitVector &whichField)
00223 {
00224 Inherited::copyToBin(pMem, whichField);
00225
00226 if(FieldBits::NoField != (ChunksFieldMask & whichField))
00227 {
00228 _mfChunks.copyToBin(pMem);
00229 }
00230
00231 if(FieldBits::NoField != (SlotsFieldMask & whichField))
00232 {
00233 _mfSlots.copyToBin(pMem);
00234 }
00235
00236
00237 }
00238
00239 void ChunkMaterialBase::copyFromBin( BinaryDataHandler &pMem,
00240 const BitVector &whichField)
00241 {
00242 Inherited::copyFromBin(pMem, whichField);
00243
00244 if(FieldBits::NoField != (ChunksFieldMask & whichField))
00245 {
00246 _mfChunks.copyFromBin(pMem);
00247 }
00248
00249 if(FieldBits::NoField != (SlotsFieldMask & whichField))
00250 {
00251 _mfSlots.copyFromBin(pMem);
00252 }
00253
00254
00255 }
00256
00257 #if !defined(OSG_FIXED_MFIELDSYNC)
00258 void ChunkMaterialBase::executeSyncImpl( ChunkMaterialBase *pOther,
00259 const BitVector &whichField)
00260 {
00261
00262 Inherited::executeSyncImpl(pOther, whichField);
00263
00264 if(FieldBits::NoField != (ChunksFieldMask & whichField))
00265 _mfChunks.syncWith(pOther->_mfChunks);
00266
00267 if(FieldBits::NoField != (SlotsFieldMask & whichField))
00268 _mfSlots.syncWith(pOther->_mfSlots);
00269
00270
00271 }
00272 #else
00273 void ChunkMaterialBase::executeSyncImpl( ChunkMaterialBase *pOther,
00274 const BitVector &whichField,
00275 const SyncInfo &sInfo )
00276 {
00277
00278 Inherited::executeSyncImpl(pOther, whichField, sInfo);
00279
00280
00281 if(FieldBits::NoField != (ChunksFieldMask & whichField))
00282 _mfChunks.syncWith(pOther->_mfChunks, sInfo);
00283
00284 if(FieldBits::NoField != (SlotsFieldMask & whichField))
00285 _mfSlots.syncWith(pOther->_mfSlots, sInfo);
00286
00287
00288 }
00289
00290 void ChunkMaterialBase::execBeginEditImpl (const BitVector &whichField,
00291 UInt32 uiAspect,
00292 UInt32 uiContainerSize)
00293 {
00294 Inherited::execBeginEditImpl(whichField, uiAspect, uiContainerSize);
00295
00296 if(FieldBits::NoField != (ChunksFieldMask & whichField))
00297 _mfChunks.beginEdit(uiAspect, uiContainerSize);
00298
00299 if(FieldBits::NoField != (SlotsFieldMask & whichField))
00300 _mfSlots.beginEdit(uiAspect, uiContainerSize);
00301
00302 }
00303 #endif
00304
00305
00306
00307 #include <OSGSFieldTypeDef.inl>
00308 #include <OSGMFieldTypeDef.inl>
00309
00310 OSG_BEGIN_NAMESPACE
00311
00312 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
00313 DataType FieldDataTraits<ChunkMaterialPtr>::_type("ChunkMaterialPtr", "MaterialPtr");
00314 #endif
00315
00316 OSG_DLLEXPORT_SFIELD_DEF1(ChunkMaterialPtr, OSG_SYSTEMLIB_DLLTMPLMAPPING);
00317 OSG_DLLEXPORT_MFIELD_DEF1(ChunkMaterialPtr, OSG_SYSTEMLIB_DLLTMPLMAPPING);
00318
00319 OSG_END_NAMESPACE
00320
00321
00322
00323
00324
00325 #ifdef OSG_SGI_CC
00326 #pragma set woff 1174
00327 #endif
00328
00329 #ifdef OSG_LINUX_ICC
00330 #pragma warning( disable : 177 )
00331 #endif
00332
00333 namespace
00334 {
00335 static Char8 cvsid_cpp [] = "@(#)$Id: FCBaseTemplate_cpp.h,v 1.42 2004/08/03 05:53:03 dirk Exp $";
00336 static Char8 cvsid_hpp [] = OSGCHUNKMATERIALBASE_HEADER_CVSID;
00337 static Char8 cvsid_inl [] = OSGCHUNKMATERIALBASE_INLINE_CVSID;
00338
00339 static Char8 cvsid_fields_hpp[] = OSGCHUNKMATERIALFIELDS_HEADER_CVSID;
00340 }
00341