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