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