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_COMPILECOMPONENTTRANSFORMINST
00055
00056 #include <stdlib.h>
00057 #include <stdio.h>
00058
00059 #include <OSGConfig.h>
00060
00061 #include "OSGComponentTransformBase.h"
00062 #include "OSGComponentTransform.h"
00063
00064
00065 OSG_USING_NAMESPACE
00066
00067 const OSG::BitVector ComponentTransformBase::CenterFieldMask =
00068 (TypeTraits<BitVector>::One << ComponentTransformBase::CenterFieldId);
00069
00070 const OSG::BitVector ComponentTransformBase::RotationFieldMask =
00071 (TypeTraits<BitVector>::One << ComponentTransformBase::RotationFieldId);
00072
00073 const OSG::BitVector ComponentTransformBase::ScaleFieldMask =
00074 (TypeTraits<BitVector>::One << ComponentTransformBase::ScaleFieldId);
00075
00076 const OSG::BitVector ComponentTransformBase::ScaleOrientationFieldMask =
00077 (TypeTraits<BitVector>::One << ComponentTransformBase::ScaleOrientationFieldId);
00078
00079 const OSG::BitVector ComponentTransformBase::TranslationFieldMask =
00080 (TypeTraits<BitVector>::One << ComponentTransformBase::TranslationFieldId);
00081
00082 const OSG::BitVector ComponentTransformBase::MTInfluenceMask =
00083 (Inherited::MTInfluenceMask) |
00084 (static_cast<BitVector>(0x0) << Inherited::NextFieldId);
00085
00086
00087
00088
00105
00106
00107 FieldDescription *ComponentTransformBase::_desc[] =
00108 {
00109 new FieldDescription(SFVec3f::getClassType(),
00110 "center",
00111 CenterFieldId, CenterFieldMask,
00112 false,
00113 (FieldAccessMethod) &ComponentTransformBase::getSFCenter),
00114 new FieldDescription(SFQuaternion::getClassType(),
00115 "rotation",
00116 RotationFieldId, RotationFieldMask,
00117 false,
00118 (FieldAccessMethod) &ComponentTransformBase::getSFRotation),
00119 new FieldDescription(SFVec3f::getClassType(),
00120 "scale",
00121 ScaleFieldId, ScaleFieldMask,
00122 false,
00123 (FieldAccessMethod) &ComponentTransformBase::getSFScale),
00124 new FieldDescription(SFQuaternion::getClassType(),
00125 "scaleOrientation",
00126 ScaleOrientationFieldId, ScaleOrientationFieldMask,
00127 false,
00128 (FieldAccessMethod) &ComponentTransformBase::getSFScaleOrientation),
00129 new FieldDescription(SFVec3f::getClassType(),
00130 "translation",
00131 TranslationFieldId, TranslationFieldMask,
00132 false,
00133 (FieldAccessMethod) &ComponentTransformBase::getSFTranslation)
00134 };
00135
00136
00137 FieldContainerType ComponentTransformBase::_type(
00138 "ComponentTransform",
00139 "Transform",
00140 NULL,
00141 (PrototypeCreateF) &ComponentTransformBase::createEmpty,
00142 ComponentTransform::initMethod,
00143 _desc,
00144 sizeof(_desc));
00145
00146
00147
00148
00149
00150 FieldContainerType &ComponentTransformBase::getType(void)
00151 {
00152 return _type;
00153 }
00154
00155 const FieldContainerType &ComponentTransformBase::getType(void) const
00156 {
00157 return _type;
00158 }
00159
00160
00161 FieldContainerPtr ComponentTransformBase::shallowCopy(void) const
00162 {
00163 ComponentTransformPtr returnValue;
00164
00165 newPtr(returnValue, dynamic_cast<const ComponentTransform *>(this));
00166
00167 return returnValue;
00168 }
00169
00170 UInt32 ComponentTransformBase::getContainerSize(void) const
00171 {
00172 return sizeof(ComponentTransform);
00173 }
00174
00175
00176 #if !defined(OSG_FIXED_MFIELDSYNC)
00177 void ComponentTransformBase::executeSync( FieldContainer &other,
00178 const BitVector &whichField)
00179 {
00180 this->executeSyncImpl((ComponentTransformBase *) &other, whichField);
00181 }
00182 #else
00183 void ComponentTransformBase::executeSync( FieldContainer &other,
00184 const BitVector &whichField, const SyncInfo &sInfo )
00185 {
00186 this->executeSyncImpl((ComponentTransformBase *) &other, whichField, sInfo);
00187 }
00188 void ComponentTransformBase::execBeginEdit(const BitVector &whichField,
00189 UInt32 uiAspect,
00190 UInt32 uiContainerSize)
00191 {
00192 this->execBeginEditImpl(whichField, uiAspect, uiContainerSize);
00193 }
00194
00195 void ComponentTransformBase::onDestroyAspect(UInt32 uiId, UInt32 uiAspect)
00196 {
00197 Inherited::onDestroyAspect(uiId, uiAspect);
00198
00199 }
00200 #endif
00201
00202
00203
00204 #ifdef OSG_WIN32_ICL
00205 #pragma warning (disable : 383)
00206 #endif
00207
00208 ComponentTransformBase::ComponentTransformBase(void) :
00209 _sfCenter (),
00210 _sfRotation (),
00211 _sfScale (),
00212 _sfScaleOrientation (),
00213 _sfTranslation (),
00214 Inherited()
00215 {
00216 }
00217
00218 #ifdef OSG_WIN32_ICL
00219 #pragma warning (default : 383)
00220 #endif
00221
00222 ComponentTransformBase::ComponentTransformBase(const ComponentTransformBase &source) :
00223 _sfCenter (source._sfCenter ),
00224 _sfRotation (source._sfRotation ),
00225 _sfScale (source._sfScale ),
00226 _sfScaleOrientation (source._sfScaleOrientation ),
00227 _sfTranslation (source._sfTranslation ),
00228 Inherited (source)
00229 {
00230 }
00231
00232
00233
00234 ComponentTransformBase::~ComponentTransformBase(void)
00235 {
00236 }
00237
00238
00239
00240 UInt32 ComponentTransformBase::getBinSize(const BitVector &whichField)
00241 {
00242 UInt32 returnValue = Inherited::getBinSize(whichField);
00243
00244 if(FieldBits::NoField != (CenterFieldMask & whichField))
00245 {
00246 returnValue += _sfCenter.getBinSize();
00247 }
00248
00249 if(FieldBits::NoField != (RotationFieldMask & whichField))
00250 {
00251 returnValue += _sfRotation.getBinSize();
00252 }
00253
00254 if(FieldBits::NoField != (ScaleFieldMask & whichField))
00255 {
00256 returnValue += _sfScale.getBinSize();
00257 }
00258
00259 if(FieldBits::NoField != (ScaleOrientationFieldMask & whichField))
00260 {
00261 returnValue += _sfScaleOrientation.getBinSize();
00262 }
00263
00264 if(FieldBits::NoField != (TranslationFieldMask & whichField))
00265 {
00266 returnValue += _sfTranslation.getBinSize();
00267 }
00268
00269
00270 return returnValue;
00271 }
00272
00273 void ComponentTransformBase::copyToBin( BinaryDataHandler &pMem,
00274 const BitVector &whichField)
00275 {
00276 Inherited::copyToBin(pMem, whichField);
00277
00278 if(FieldBits::NoField != (CenterFieldMask & whichField))
00279 {
00280 _sfCenter.copyToBin(pMem);
00281 }
00282
00283 if(FieldBits::NoField != (RotationFieldMask & whichField))
00284 {
00285 _sfRotation.copyToBin(pMem);
00286 }
00287
00288 if(FieldBits::NoField != (ScaleFieldMask & whichField))
00289 {
00290 _sfScale.copyToBin(pMem);
00291 }
00292
00293 if(FieldBits::NoField != (ScaleOrientationFieldMask & whichField))
00294 {
00295 _sfScaleOrientation.copyToBin(pMem);
00296 }
00297
00298 if(FieldBits::NoField != (TranslationFieldMask & whichField))
00299 {
00300 _sfTranslation.copyToBin(pMem);
00301 }
00302
00303
00304 }
00305
00306 void ComponentTransformBase::copyFromBin( BinaryDataHandler &pMem,
00307 const BitVector &whichField)
00308 {
00309 Inherited::copyFromBin(pMem, whichField);
00310
00311 if(FieldBits::NoField != (CenterFieldMask & whichField))
00312 {
00313 _sfCenter.copyFromBin(pMem);
00314 }
00315
00316 if(FieldBits::NoField != (RotationFieldMask & whichField))
00317 {
00318 _sfRotation.copyFromBin(pMem);
00319 }
00320
00321 if(FieldBits::NoField != (ScaleFieldMask & whichField))
00322 {
00323 _sfScale.copyFromBin(pMem);
00324 }
00325
00326 if(FieldBits::NoField != (ScaleOrientationFieldMask & whichField))
00327 {
00328 _sfScaleOrientation.copyFromBin(pMem);
00329 }
00330
00331 if(FieldBits::NoField != (TranslationFieldMask & whichField))
00332 {
00333 _sfTranslation.copyFromBin(pMem);
00334 }
00335
00336
00337 }
00338
00339 #if !defined(OSG_FIXED_MFIELDSYNC)
00340 void ComponentTransformBase::executeSyncImpl( ComponentTransformBase *pOther,
00341 const BitVector &whichField)
00342 {
00343
00344 Inherited::executeSyncImpl(pOther, whichField);
00345
00346 if(FieldBits::NoField != (CenterFieldMask & whichField))
00347 _sfCenter.syncWith(pOther->_sfCenter);
00348
00349 if(FieldBits::NoField != (RotationFieldMask & whichField))
00350 _sfRotation.syncWith(pOther->_sfRotation);
00351
00352 if(FieldBits::NoField != (ScaleFieldMask & whichField))
00353 _sfScale.syncWith(pOther->_sfScale);
00354
00355 if(FieldBits::NoField != (ScaleOrientationFieldMask & whichField))
00356 _sfScaleOrientation.syncWith(pOther->_sfScaleOrientation);
00357
00358 if(FieldBits::NoField != (TranslationFieldMask & whichField))
00359 _sfTranslation.syncWith(pOther->_sfTranslation);
00360
00361
00362 }
00363 #else
00364 void ComponentTransformBase::executeSyncImpl( ComponentTransformBase *pOther,
00365 const BitVector &whichField,
00366 const SyncInfo &sInfo )
00367 {
00368
00369 Inherited::executeSyncImpl(pOther, whichField, sInfo);
00370
00371 if(FieldBits::NoField != (CenterFieldMask & whichField))
00372 _sfCenter.syncWith(pOther->_sfCenter);
00373
00374 if(FieldBits::NoField != (RotationFieldMask & whichField))
00375 _sfRotation.syncWith(pOther->_sfRotation);
00376
00377 if(FieldBits::NoField != (ScaleFieldMask & whichField))
00378 _sfScale.syncWith(pOther->_sfScale);
00379
00380 if(FieldBits::NoField != (ScaleOrientationFieldMask & whichField))
00381 _sfScaleOrientation.syncWith(pOther->_sfScaleOrientation);
00382
00383 if(FieldBits::NoField != (TranslationFieldMask & whichField))
00384 _sfTranslation.syncWith(pOther->_sfTranslation);
00385
00386
00387
00388 }
00389
00390 void ComponentTransformBase::execBeginEditImpl (const BitVector &whichField,
00391 UInt32 uiAspect,
00392 UInt32 uiContainerSize)
00393 {
00394 Inherited::execBeginEditImpl(whichField, uiAspect, uiContainerSize);
00395
00396 }
00397 #endif
00398
00399
00400
00401 #include <OSGSFieldTypeDef.inl>
00402 #include <OSGMFieldTypeDef.inl>
00403
00404 OSG_BEGIN_NAMESPACE
00405
00406 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
00407 DataType FieldDataTraits<ComponentTransformPtr>::_type("ComponentTransformPtr", "TransformPtr");
00408 #endif
00409
00410 OSG_DLLEXPORT_SFIELD_DEF1(ComponentTransformPtr, OSG_SYSTEMLIB_DLLTMPLMAPPING);
00411 OSG_DLLEXPORT_MFIELD_DEF1(ComponentTransformPtr, OSG_SYSTEMLIB_DLLTMPLMAPPING);
00412
00413 OSG_END_NAMESPACE
00414
00415
00416
00417
00418
00419 #ifdef OSG_SGI_CC
00420 #pragma set woff 1174
00421 #endif
00422
00423 #ifdef OSG_LINUX_ICC
00424 #pragma warning( disable : 177 )
00425 #endif
00426
00427 namespace
00428 {
00429 static Char8 cvsid_cpp [] = "@(#)$Id: FCBaseTemplate_cpp.h,v 1.42 2004/08/03 05:53:03 dirk Exp $";
00430 static Char8 cvsid_hpp [] = OSGCOMPONENTTRANSFORMBASE_HEADER_CVSID;
00431 static Char8 cvsid_inl [] = OSGCOMPONENTTRANSFORMBASE_INLINE_CVSID;
00432
00433 static Char8 cvsid_fields_hpp[] = OSGCOMPONENTTRANSFORMFIELDS_HEADER_CVSID;
00434 }
00435