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_COMPILECOLORDISPLAYFILTERINST
00055
00056 #include <stdlib.h>
00057 #include <stdio.h>
00058
00059 #include <OSGConfig.h>
00060
00061 #include "OSGColorDisplayFilterBase.h"
00062 #include "OSGColorDisplayFilter.h"
00063
00064
00065 OSG_BEGIN_NAMESPACE
00066
00067 const OSG::BitVector ColorDisplayFilterBase::GammaFieldMask =
00068 (TypeTraits<BitVector>::One << ColorDisplayFilterBase::GammaFieldId);
00069
00070 const OSG::BitVector ColorDisplayFilterBase::MatrixFieldMask =
00071 (TypeTraits<BitVector>::One << ColorDisplayFilterBase::MatrixFieldId);
00072
00073 const OSG::BitVector ColorDisplayFilterBase::WidthFieldMask =
00074 (TypeTraits<BitVector>::One << ColorDisplayFilterBase::WidthFieldId);
00075
00076 const OSG::BitVector ColorDisplayFilterBase::HeightFieldMask =
00077 (TypeTraits<BitVector>::One << ColorDisplayFilterBase::HeightFieldId);
00078
00079 const OSG::BitVector ColorDisplayFilterBase::DepthFieldMask =
00080 (TypeTraits<BitVector>::One << ColorDisplayFilterBase::DepthFieldId);
00081
00082 const OSG::BitVector ColorDisplayFilterBase::TableFieldMask =
00083 (TypeTraits<BitVector>::One << ColorDisplayFilterBase::TableFieldId);
00084
00085 const OSG::BitVector ColorDisplayFilterBase::MTInfluenceMask =
00086 (Inherited::MTInfluenceMask) |
00087 (static_cast<BitVector>(0x0) << Inherited::NextFieldId);
00088
00089
00090
00091
00111
00112
00113 FieldDescription *ColorDisplayFilterBase::_desc[] =
00114 {
00115 new FieldDescription(SFReal32::getClassType(),
00116 "gamma",
00117 GammaFieldId, GammaFieldMask,
00118 false,
00119 (FieldAccessMethod) &ColorDisplayFilterBase::getSFGamma),
00120 new FieldDescription(SFMatrix::getClassType(),
00121 "matrix",
00122 MatrixFieldId, MatrixFieldMask,
00123 false,
00124 (FieldAccessMethod) &ColorDisplayFilterBase::getSFMatrix),
00125 new FieldDescription(SFUInt32::getClassType(),
00126 "width",
00127 WidthFieldId, WidthFieldMask,
00128 false,
00129 (FieldAccessMethod) &ColorDisplayFilterBase::getSFWidth),
00130 new FieldDescription(SFUInt32::getClassType(),
00131 "height",
00132 HeightFieldId, HeightFieldMask,
00133 false,
00134 (FieldAccessMethod) &ColorDisplayFilterBase::getSFHeight),
00135 new FieldDescription(SFUInt32::getClassType(),
00136 "depth",
00137 DepthFieldId, DepthFieldMask,
00138 false,
00139 (FieldAccessMethod) &ColorDisplayFilterBase::getSFDepth),
00140 new FieldDescription(MFColor3f::getClassType(),
00141 "table",
00142 TableFieldId, TableFieldMask,
00143 false,
00144 (FieldAccessMethod) &ColorDisplayFilterBase::getMFTable)
00145 };
00146
00147
00148 FieldContainerType ColorDisplayFilterBase::_type(
00149 "ColorDisplayFilter",
00150 "DisplayFilter",
00151 NULL,
00152 (PrototypeCreateF) &ColorDisplayFilterBase::createEmpty,
00153 ColorDisplayFilter::initMethod,
00154 _desc,
00155 sizeof(_desc));
00156
00157
00158
00159
00160
00161 FieldContainerType &ColorDisplayFilterBase::getType(void)
00162 {
00163 return _type;
00164 }
00165
00166 const FieldContainerType &ColorDisplayFilterBase::getType(void) const
00167 {
00168 return _type;
00169 }
00170
00171
00172 FieldContainerPtr ColorDisplayFilterBase::shallowCopy(void) const
00173 {
00174 ColorDisplayFilterPtr returnValue;
00175
00176 newPtr(returnValue, dynamic_cast<const ColorDisplayFilter *>(this));
00177
00178 return returnValue;
00179 }
00180
00181 UInt32 ColorDisplayFilterBase::getContainerSize(void) const
00182 {
00183 return sizeof(ColorDisplayFilter);
00184 }
00185
00186
00187 #if !defined(OSG_FIXED_MFIELDSYNC)
00188 void ColorDisplayFilterBase::executeSync( FieldContainer &other,
00189 const BitVector &whichField)
00190 {
00191 this->executeSyncImpl((ColorDisplayFilterBase *) &other, whichField);
00192 }
00193 #else
00194 void ColorDisplayFilterBase::executeSync( FieldContainer &other,
00195 const BitVector &whichField, const SyncInfo &sInfo )
00196 {
00197 this->executeSyncImpl((ColorDisplayFilterBase *) &other, whichField, sInfo);
00198 }
00199 void ColorDisplayFilterBase::execBeginEdit(const BitVector &whichField,
00200 UInt32 uiAspect,
00201 UInt32 uiContainerSize)
00202 {
00203 this->execBeginEditImpl(whichField, uiAspect, uiContainerSize);
00204 }
00205
00206 void ColorDisplayFilterBase::onDestroyAspect(UInt32 uiId, UInt32 uiAspect)
00207 {
00208 Inherited::onDestroyAspect(uiId, uiAspect);
00209
00210 _mfTable.terminateShare(uiAspect, this->getContainerSize());
00211 }
00212 #endif
00213
00214
00215
00216 #ifdef OSG_WIN32_ICL
00217 #pragma warning (disable : 383)
00218 #endif
00219
00220 ColorDisplayFilterBase::ColorDisplayFilterBase(void) :
00221 _sfGamma (Real32(2.4)),
00222 _sfMatrix (),
00223 _sfWidth (UInt32(1)),
00224 _sfHeight (UInt32(1)),
00225 _sfDepth (UInt32(2)),
00226 _mfTable (),
00227 Inherited()
00228 {
00229 }
00230
00231 #ifdef OSG_WIN32_ICL
00232 #pragma warning (default : 383)
00233 #endif
00234
00235 ColorDisplayFilterBase::ColorDisplayFilterBase(const ColorDisplayFilterBase &source) :
00236 _sfGamma (source._sfGamma ),
00237 _sfMatrix (source._sfMatrix ),
00238 _sfWidth (source._sfWidth ),
00239 _sfHeight (source._sfHeight ),
00240 _sfDepth (source._sfDepth ),
00241 _mfTable (source._mfTable ),
00242 Inherited (source)
00243 {
00244 }
00245
00246
00247
00248 ColorDisplayFilterBase::~ColorDisplayFilterBase(void)
00249 {
00250 }
00251
00252
00253
00254 UInt32 ColorDisplayFilterBase::getBinSize(const BitVector &whichField)
00255 {
00256 UInt32 returnValue = Inherited::getBinSize(whichField);
00257
00258 if(FieldBits::NoField != (GammaFieldMask & whichField))
00259 {
00260 returnValue += _sfGamma.getBinSize();
00261 }
00262
00263 if(FieldBits::NoField != (MatrixFieldMask & whichField))
00264 {
00265 returnValue += _sfMatrix.getBinSize();
00266 }
00267
00268 if(FieldBits::NoField != (WidthFieldMask & whichField))
00269 {
00270 returnValue += _sfWidth.getBinSize();
00271 }
00272
00273 if(FieldBits::NoField != (HeightFieldMask & whichField))
00274 {
00275 returnValue += _sfHeight.getBinSize();
00276 }
00277
00278 if(FieldBits::NoField != (DepthFieldMask & whichField))
00279 {
00280 returnValue += _sfDepth.getBinSize();
00281 }
00282
00283 if(FieldBits::NoField != (TableFieldMask & whichField))
00284 {
00285 returnValue += _mfTable.getBinSize();
00286 }
00287
00288
00289 return returnValue;
00290 }
00291
00292 void ColorDisplayFilterBase::copyToBin( BinaryDataHandler &pMem,
00293 const BitVector &whichField)
00294 {
00295 Inherited::copyToBin(pMem, whichField);
00296
00297 if(FieldBits::NoField != (GammaFieldMask & whichField))
00298 {
00299 _sfGamma.copyToBin(pMem);
00300 }
00301
00302 if(FieldBits::NoField != (MatrixFieldMask & whichField))
00303 {
00304 _sfMatrix.copyToBin(pMem);
00305 }
00306
00307 if(FieldBits::NoField != (WidthFieldMask & whichField))
00308 {
00309 _sfWidth.copyToBin(pMem);
00310 }
00311
00312 if(FieldBits::NoField != (HeightFieldMask & whichField))
00313 {
00314 _sfHeight.copyToBin(pMem);
00315 }
00316
00317 if(FieldBits::NoField != (DepthFieldMask & whichField))
00318 {
00319 _sfDepth.copyToBin(pMem);
00320 }
00321
00322 if(FieldBits::NoField != (TableFieldMask & whichField))
00323 {
00324 _mfTable.copyToBin(pMem);
00325 }
00326
00327
00328 }
00329
00330 void ColorDisplayFilterBase::copyFromBin( BinaryDataHandler &pMem,
00331 const BitVector &whichField)
00332 {
00333 Inherited::copyFromBin(pMem, whichField);
00334
00335 if(FieldBits::NoField != (GammaFieldMask & whichField))
00336 {
00337 _sfGamma.copyFromBin(pMem);
00338 }
00339
00340 if(FieldBits::NoField != (MatrixFieldMask & whichField))
00341 {
00342 _sfMatrix.copyFromBin(pMem);
00343 }
00344
00345 if(FieldBits::NoField != (WidthFieldMask & whichField))
00346 {
00347 _sfWidth.copyFromBin(pMem);
00348 }
00349
00350 if(FieldBits::NoField != (HeightFieldMask & whichField))
00351 {
00352 _sfHeight.copyFromBin(pMem);
00353 }
00354
00355 if(FieldBits::NoField != (DepthFieldMask & whichField))
00356 {
00357 _sfDepth.copyFromBin(pMem);
00358 }
00359
00360 if(FieldBits::NoField != (TableFieldMask & whichField))
00361 {
00362 _mfTable.copyFromBin(pMem);
00363 }
00364
00365
00366 }
00367
00368 #if !defined(OSG_FIXED_MFIELDSYNC)
00369 void ColorDisplayFilterBase::executeSyncImpl( ColorDisplayFilterBase *pOther,
00370 const BitVector &whichField)
00371 {
00372
00373 Inherited::executeSyncImpl(pOther, whichField);
00374
00375 if(FieldBits::NoField != (GammaFieldMask & whichField))
00376 _sfGamma.syncWith(pOther->_sfGamma);
00377
00378 if(FieldBits::NoField != (MatrixFieldMask & whichField))
00379 _sfMatrix.syncWith(pOther->_sfMatrix);
00380
00381 if(FieldBits::NoField != (WidthFieldMask & whichField))
00382 _sfWidth.syncWith(pOther->_sfWidth);
00383
00384 if(FieldBits::NoField != (HeightFieldMask & whichField))
00385 _sfHeight.syncWith(pOther->_sfHeight);
00386
00387 if(FieldBits::NoField != (DepthFieldMask & whichField))
00388 _sfDepth.syncWith(pOther->_sfDepth);
00389
00390 if(FieldBits::NoField != (TableFieldMask & whichField))
00391 _mfTable.syncWith(pOther->_mfTable);
00392
00393
00394 }
00395 #else
00396 void ColorDisplayFilterBase::executeSyncImpl( ColorDisplayFilterBase *pOther,
00397 const BitVector &whichField,
00398 const SyncInfo &sInfo )
00399 {
00400
00401 Inherited::executeSyncImpl(pOther, whichField, sInfo);
00402
00403 if(FieldBits::NoField != (GammaFieldMask & whichField))
00404 _sfGamma.syncWith(pOther->_sfGamma);
00405
00406 if(FieldBits::NoField != (MatrixFieldMask & whichField))
00407 _sfMatrix.syncWith(pOther->_sfMatrix);
00408
00409 if(FieldBits::NoField != (WidthFieldMask & whichField))
00410 _sfWidth.syncWith(pOther->_sfWidth);
00411
00412 if(FieldBits::NoField != (HeightFieldMask & whichField))
00413 _sfHeight.syncWith(pOther->_sfHeight);
00414
00415 if(FieldBits::NoField != (DepthFieldMask & whichField))
00416 _sfDepth.syncWith(pOther->_sfDepth);
00417
00418
00419 if(FieldBits::NoField != (TableFieldMask & whichField))
00420 _mfTable.syncWith(pOther->_mfTable, sInfo);
00421
00422
00423 }
00424
00425 void ColorDisplayFilterBase::execBeginEditImpl (const BitVector &whichField,
00426 UInt32 uiAspect,
00427 UInt32 uiContainerSize)
00428 {
00429 Inherited::execBeginEditImpl(whichField, uiAspect, uiContainerSize);
00430
00431 if(FieldBits::NoField != (TableFieldMask & whichField))
00432 _mfTable.beginEdit(uiAspect, uiContainerSize);
00433
00434 }
00435 #endif
00436
00437
00438
00439 OSG_END_NAMESPACE
00440
00441 #include <OSGSFieldTypeDef.inl>
00442 #include <OSGMFieldTypeDef.inl>
00443
00444 OSG_BEGIN_NAMESPACE
00445
00446 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
00447 DataType FieldDataTraits<ColorDisplayFilterPtr>::_type("ColorDisplayFilterPtr", "DisplayFilterPtr");
00448 #endif
00449
00450 OSG_DLLEXPORT_SFIELD_DEF1(ColorDisplayFilterPtr, OSG_SYSTEMLIB_DLLTMPLMAPPING);
00451 OSG_DLLEXPORT_MFIELD_DEF1(ColorDisplayFilterPtr, OSG_SYSTEMLIB_DLLTMPLMAPPING);
00452
00453
00454
00455
00456
00457 #ifdef OSG_SGI_CC
00458 #pragma set woff 1174
00459 #endif
00460
00461 #ifdef OSG_LINUX_ICC
00462 #pragma warning( disable : 177 )
00463 #endif
00464
00465 namespace
00466 {
00467 static Char8 cvsid_cpp [] = "@(#)$Id: FCBaseTemplate_cpp.h,v 1.46 2006/03/16 17:01:53 dirk Exp $";
00468 static Char8 cvsid_hpp [] = OSGCOLORDISPLAYFILTERBASE_HEADER_CVSID;
00469 static Char8 cvsid_inl [] = OSGCOLORDISPLAYFILTERBASE_INLINE_CVSID;
00470
00471 static Char8 cvsid_fields_hpp[] = OSGCOLORDISPLAYFILTERFIELDS_HEADER_CVSID;
00472 }
00473
00474 OSG_END_NAMESPACE
00475