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_COMPILEBILLBOARDINST
00055
00056 #include <stdlib.h>
00057 #include <stdio.h>
00058
00059 #include <OSGConfig.h>
00060
00061 #include "OSGBillboardBase.h"
00062 #include "OSGBillboard.h"
00063
00064
00065 OSG_USING_NAMESPACE
00066
00067 const OSG::BitVector BillboardBase::AxisOfRotationFieldMask =
00068 (TypeTraits<BitVector>::One << BillboardBase::AxisOfRotationFieldId);
00069
00070 const OSG::BitVector BillboardBase::FocusOnCameraFieldMask =
00071 (TypeTraits<BitVector>::One << BillboardBase::FocusOnCameraFieldId);
00072
00073 const OSG::BitVector BillboardBase::AlignToScreenFieldMask =
00074 (TypeTraits<BitVector>::One << BillboardBase::AlignToScreenFieldId);
00075
00076 const OSG::BitVector BillboardBase::MinAngleFieldMask =
00077 (TypeTraits<BitVector>::One << BillboardBase::MinAngleFieldId);
00078
00079 const OSG::BitVector BillboardBase::MaxAngleFieldMask =
00080 (TypeTraits<BitVector>::One << BillboardBase::MaxAngleFieldId);
00081
00082 const OSG::BitVector BillboardBase::MTInfluenceMask =
00083 (Inherited::MTInfluenceMask) |
00084 (static_cast<BitVector>(0x0) << Inherited::NextFieldId);
00085
00086
00087
00088
00105
00106
00107 FieldDescription *BillboardBase::_desc[] =
00108 {
00109 new FieldDescription(SFVec3f::getClassType(),
00110 "axisOfRotation",
00111 AxisOfRotationFieldId, AxisOfRotationFieldMask,
00112 true,
00113 (FieldAccessMethod) &BillboardBase::getSFAxisOfRotation),
00114 new FieldDescription(SFBool::getClassType(),
00115 "focusOnCamera",
00116 FocusOnCameraFieldId, FocusOnCameraFieldMask,
00117 true,
00118 (FieldAccessMethod) &BillboardBase::getSFFocusOnCamera),
00119 new FieldDescription(SFBool::getClassType(),
00120 "alignToScreen",
00121 AlignToScreenFieldId, AlignToScreenFieldMask,
00122 true,
00123 (FieldAccessMethod) &BillboardBase::getSFAlignToScreen),
00124 new FieldDescription(SFReal32::getClassType(),
00125 "minAngle",
00126 MinAngleFieldId, MinAngleFieldMask,
00127 true,
00128 (FieldAccessMethod) &BillboardBase::getSFMinAngle),
00129 new FieldDescription(SFReal32::getClassType(),
00130 "maxAngle",
00131 MaxAngleFieldId, MaxAngleFieldMask,
00132 true,
00133 (FieldAccessMethod) &BillboardBase::getSFMaxAngle)
00134 };
00135
00136
00137 FieldContainerType BillboardBase::_type(
00138 "Billboard",
00139 "Group",
00140 NULL,
00141 (PrototypeCreateF) &BillboardBase::createEmpty,
00142 Billboard::initMethod,
00143 _desc,
00144 sizeof(_desc));
00145
00146
00147
00148
00149
00150 FieldContainerType &BillboardBase::getType(void)
00151 {
00152 return _type;
00153 }
00154
00155 const FieldContainerType &BillboardBase::getType(void) const
00156 {
00157 return _type;
00158 }
00159
00160
00161 FieldContainerPtr BillboardBase::shallowCopy(void) const
00162 {
00163 BillboardPtr returnValue;
00164
00165 newPtr(returnValue, dynamic_cast<const Billboard *>(this));
00166
00167 return returnValue;
00168 }
00169
00170 UInt32 BillboardBase::getContainerSize(void) const
00171 {
00172 return sizeof(Billboard);
00173 }
00174
00175
00176 #if !defined(OSG_FIXED_MFIELDSYNC)
00177 void BillboardBase::executeSync( FieldContainer &other,
00178 const BitVector &whichField)
00179 {
00180 this->executeSyncImpl((BillboardBase *) &other, whichField);
00181 }
00182 #else
00183 void BillboardBase::executeSync( FieldContainer &other,
00184 const BitVector &whichField, const SyncInfo &sInfo )
00185 {
00186 this->executeSyncImpl((BillboardBase *) &other, whichField, sInfo);
00187 }
00188 void BillboardBase::execBeginEdit(const BitVector &whichField,
00189 UInt32 uiAspect,
00190 UInt32 uiContainerSize)
00191 {
00192 this->execBeginEditImpl(whichField, uiAspect, uiContainerSize);
00193 }
00194
00195 void BillboardBase::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 BillboardBase::BillboardBase(void) :
00209 _sfAxisOfRotation (Vec3f(0.f, 1.f, 0.f)),
00210 _sfFocusOnCamera (bool(true)),
00211 _sfAlignToScreen (bool(false)),
00212 _sfMinAngle (Real32(0.0f)),
00213 _sfMaxAngle (Real32(-1.0f)),
00214 Inherited()
00215 {
00216 }
00217
00218 #ifdef OSG_WIN32_ICL
00219 #pragma warning (default : 383)
00220 #endif
00221
00222 BillboardBase::BillboardBase(const BillboardBase &source) :
00223 _sfAxisOfRotation (source._sfAxisOfRotation ),
00224 _sfFocusOnCamera (source._sfFocusOnCamera ),
00225 _sfAlignToScreen (source._sfAlignToScreen ),
00226 _sfMinAngle (source._sfMinAngle ),
00227 _sfMaxAngle (source._sfMaxAngle ),
00228 Inherited (source)
00229 {
00230 }
00231
00232
00233
00234 BillboardBase::~BillboardBase(void)
00235 {
00236 }
00237
00238
00239
00240 UInt32 BillboardBase::getBinSize(const BitVector &whichField)
00241 {
00242 UInt32 returnValue = Inherited::getBinSize(whichField);
00243
00244 if(FieldBits::NoField != (AxisOfRotationFieldMask & whichField))
00245 {
00246 returnValue += _sfAxisOfRotation.getBinSize();
00247 }
00248
00249 if(FieldBits::NoField != (FocusOnCameraFieldMask & whichField))
00250 {
00251 returnValue += _sfFocusOnCamera.getBinSize();
00252 }
00253
00254 if(FieldBits::NoField != (AlignToScreenFieldMask & whichField))
00255 {
00256 returnValue += _sfAlignToScreen.getBinSize();
00257 }
00258
00259 if(FieldBits::NoField != (MinAngleFieldMask & whichField))
00260 {
00261 returnValue += _sfMinAngle.getBinSize();
00262 }
00263
00264 if(FieldBits::NoField != (MaxAngleFieldMask & whichField))
00265 {
00266 returnValue += _sfMaxAngle.getBinSize();
00267 }
00268
00269
00270 return returnValue;
00271 }
00272
00273 void BillboardBase::copyToBin( BinaryDataHandler &pMem,
00274 const BitVector &whichField)
00275 {
00276 Inherited::copyToBin(pMem, whichField);
00277
00278 if(FieldBits::NoField != (AxisOfRotationFieldMask & whichField))
00279 {
00280 _sfAxisOfRotation.copyToBin(pMem);
00281 }
00282
00283 if(FieldBits::NoField != (FocusOnCameraFieldMask & whichField))
00284 {
00285 _sfFocusOnCamera.copyToBin(pMem);
00286 }
00287
00288 if(FieldBits::NoField != (AlignToScreenFieldMask & whichField))
00289 {
00290 _sfAlignToScreen.copyToBin(pMem);
00291 }
00292
00293 if(FieldBits::NoField != (MinAngleFieldMask & whichField))
00294 {
00295 _sfMinAngle.copyToBin(pMem);
00296 }
00297
00298 if(FieldBits::NoField != (MaxAngleFieldMask & whichField))
00299 {
00300 _sfMaxAngle.copyToBin(pMem);
00301 }
00302
00303
00304 }
00305
00306 void BillboardBase::copyFromBin( BinaryDataHandler &pMem,
00307 const BitVector &whichField)
00308 {
00309 Inherited::copyFromBin(pMem, whichField);
00310
00311 if(FieldBits::NoField != (AxisOfRotationFieldMask & whichField))
00312 {
00313 _sfAxisOfRotation.copyFromBin(pMem);
00314 }
00315
00316 if(FieldBits::NoField != (FocusOnCameraFieldMask & whichField))
00317 {
00318 _sfFocusOnCamera.copyFromBin(pMem);
00319 }
00320
00321 if(FieldBits::NoField != (AlignToScreenFieldMask & whichField))
00322 {
00323 _sfAlignToScreen.copyFromBin(pMem);
00324 }
00325
00326 if(FieldBits::NoField != (MinAngleFieldMask & whichField))
00327 {
00328 _sfMinAngle.copyFromBin(pMem);
00329 }
00330
00331 if(FieldBits::NoField != (MaxAngleFieldMask & whichField))
00332 {
00333 _sfMaxAngle.copyFromBin(pMem);
00334 }
00335
00336
00337 }
00338
00339 #if !defined(OSG_FIXED_MFIELDSYNC)
00340 void BillboardBase::executeSyncImpl( BillboardBase *pOther,
00341 const BitVector &whichField)
00342 {
00343
00344 Inherited::executeSyncImpl(pOther, whichField);
00345
00346 if(FieldBits::NoField != (AxisOfRotationFieldMask & whichField))
00347 _sfAxisOfRotation.syncWith(pOther->_sfAxisOfRotation);
00348
00349 if(FieldBits::NoField != (FocusOnCameraFieldMask & whichField))
00350 _sfFocusOnCamera.syncWith(pOther->_sfFocusOnCamera);
00351
00352 if(FieldBits::NoField != (AlignToScreenFieldMask & whichField))
00353 _sfAlignToScreen.syncWith(pOther->_sfAlignToScreen);
00354
00355 if(FieldBits::NoField != (MinAngleFieldMask & whichField))
00356 _sfMinAngle.syncWith(pOther->_sfMinAngle);
00357
00358 if(FieldBits::NoField != (MaxAngleFieldMask & whichField))
00359 _sfMaxAngle.syncWith(pOther->_sfMaxAngle);
00360
00361
00362 }
00363 #else
00364 void BillboardBase::executeSyncImpl( BillboardBase *pOther,
00365 const BitVector &whichField,
00366 const SyncInfo &sInfo )
00367 {
00368
00369 Inherited::executeSyncImpl(pOther, whichField, sInfo);
00370
00371 if(FieldBits::NoField != (AxisOfRotationFieldMask & whichField))
00372 _sfAxisOfRotation.syncWith(pOther->_sfAxisOfRotation);
00373
00374 if(FieldBits::NoField != (FocusOnCameraFieldMask & whichField))
00375 _sfFocusOnCamera.syncWith(pOther->_sfFocusOnCamera);
00376
00377 if(FieldBits::NoField != (AlignToScreenFieldMask & whichField))
00378 _sfAlignToScreen.syncWith(pOther->_sfAlignToScreen);
00379
00380 if(FieldBits::NoField != (MinAngleFieldMask & whichField))
00381 _sfMinAngle.syncWith(pOther->_sfMinAngle);
00382
00383 if(FieldBits::NoField != (MaxAngleFieldMask & whichField))
00384 _sfMaxAngle.syncWith(pOther->_sfMaxAngle);
00385
00386
00387
00388 }
00389
00390 void BillboardBase::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<BillboardPtr>::_type("BillboardPtr", "GroupPtr");
00408 #endif
00409
00410 OSG_DLLEXPORT_SFIELD_DEF1(BillboardPtr, OSG_SYSTEMLIB_DLLTMPLMAPPING);
00411 OSG_DLLEXPORT_MFIELD_DEF1(BillboardPtr, 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.45 2005/07/20 00:10:14 vossg Exp $";
00430 static Char8 cvsid_hpp [] = OSGBILLBOARDBASE_HEADER_CVSID;
00431 static Char8 cvsid_inl [] = OSGBILLBOARDBASE_INLINE_CVSID;
00432
00433 static Char8 cvsid_fields_hpp[] = OSGBILLBOARDFIELDS_HEADER_CVSID;
00434 }
00435