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 reinterpret_cast<FieldAccessMethod>(&ColorDisplayFilterBase::editSFGamma)),
00120 new FieldDescription(SFMatrix::getClassType(),
00121 "matrix",
00122 MatrixFieldId, MatrixFieldMask,
00123 false,
00124 reinterpret_cast<FieldAccessMethod>(&ColorDisplayFilterBase::editSFMatrix)),
00125 new FieldDescription(SFUInt32::getClassType(),
00126 "width",
00127 WidthFieldId, WidthFieldMask,
00128 false,
00129 reinterpret_cast<FieldAccessMethod>(&ColorDisplayFilterBase::editSFWidth)),
00130 new FieldDescription(SFUInt32::getClassType(),
00131 "height",
00132 HeightFieldId, HeightFieldMask,
00133 false,
00134 reinterpret_cast<FieldAccessMethod>(&ColorDisplayFilterBase::editSFHeight)),
00135 new FieldDescription(SFUInt32::getClassType(),
00136 "depth",
00137 DepthFieldId, DepthFieldMask,
00138 false,
00139 reinterpret_cast<FieldAccessMethod>(&ColorDisplayFilterBase::editSFDepth)),
00140 new FieldDescription(MFColor3f::getClassType(),
00141 "table",
00142 TableFieldId, TableFieldMask,
00143 false,
00144 reinterpret_cast<FieldAccessMethod>(&ColorDisplayFilterBase::editMFTable))
00145 };
00146
00147
00148 FieldContainerType ColorDisplayFilterBase::_type(
00149 "ColorDisplayFilter",
00150 "DisplayFilter",
00151 NULL,
00152 reinterpret_cast<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(static_cast<ColorDisplayFilterBase *>(&other),
00192 whichField);
00193 }
00194 #else
00195 void ColorDisplayFilterBase::executeSync( FieldContainer &other,
00196 const BitVector &whichField, const SyncInfo &sInfo )
00197 {
00198 this->executeSyncImpl((ColorDisplayFilterBase *) &other, whichField, sInfo);
00199 }
00200 void ColorDisplayFilterBase::execBeginEdit(const BitVector &whichField,
00201 UInt32 uiAspect,
00202 UInt32 uiContainerSize)
00203 {
00204 this->execBeginEditImpl(whichField, uiAspect, uiContainerSize);
00205 }
00206
00207 void ColorDisplayFilterBase::onDestroyAspect(UInt32 uiId, UInt32 uiAspect)
00208 {
00209 Inherited::onDestroyAspect(uiId, uiAspect);
00210
00211 _mfTable.terminateShare(uiAspect, this->getContainerSize());
00212 }
00213 #endif
00214
00215
00216
00217 #ifdef OSG_WIN32_ICL
00218 #pragma warning (disable : 383)
00219 #endif
00220
00221 ColorDisplayFilterBase::ColorDisplayFilterBase(void) :
00222 _sfGamma (Real32(2.4)),
00223 _sfMatrix (),
00224 _sfWidth (UInt32(1)),
00225 _sfHeight (UInt32(1)),
00226 _sfDepth (UInt32(2)),
00227 _mfTable (),
00228 Inherited()
00229 {
00230 }
00231
00232 #ifdef OSG_WIN32_ICL
00233 #pragma warning (default : 383)
00234 #endif
00235
00236 ColorDisplayFilterBase::ColorDisplayFilterBase(const ColorDisplayFilterBase &source) :
00237 _sfGamma (source._sfGamma ),
00238 _sfMatrix (source._sfMatrix ),
00239 _sfWidth (source._sfWidth ),
00240 _sfHeight (source._sfHeight ),
00241 _sfDepth (source._sfDepth ),
00242 _mfTable (source._mfTable ),
00243 Inherited (source)
00244 {
00245 }
00246
00247
00248
00249 ColorDisplayFilterBase::~ColorDisplayFilterBase(void)
00250 {
00251 }
00252
00253
00254
00255 UInt32 ColorDisplayFilterBase::getBinSize(const BitVector &whichField)
00256 {
00257 UInt32 returnValue = Inherited::getBinSize(whichField);
00258
00259 if(FieldBits::NoField != (GammaFieldMask & whichField))
00260 {
00261 returnValue += _sfGamma.getBinSize();
00262 }
00263
00264 if(FieldBits::NoField != (MatrixFieldMask & whichField))
00265 {
00266 returnValue += _sfMatrix.getBinSize();
00267 }
00268
00269 if(FieldBits::NoField != (WidthFieldMask & whichField))
00270 {
00271 returnValue += _sfWidth.getBinSize();
00272 }
00273
00274 if(FieldBits::NoField != (HeightFieldMask & whichField))
00275 {
00276 returnValue += _sfHeight.getBinSize();
00277 }
00278
00279 if(FieldBits::NoField != (DepthFieldMask & whichField))
00280 {
00281 returnValue += _sfDepth.getBinSize();
00282 }
00283
00284 if(FieldBits::NoField != (TableFieldMask & whichField))
00285 {
00286 returnValue += _mfTable.getBinSize();
00287 }
00288
00289
00290 return returnValue;
00291 }
00292
00293 void ColorDisplayFilterBase::copyToBin( BinaryDataHandler &pMem,
00294 const BitVector &whichField)
00295 {
00296 Inherited::copyToBin(pMem, whichField);
00297
00298 if(FieldBits::NoField != (GammaFieldMask & whichField))
00299 {
00300 _sfGamma.copyToBin(pMem);
00301 }
00302
00303 if(FieldBits::NoField != (MatrixFieldMask & whichField))
00304 {
00305 _sfMatrix.copyToBin(pMem);
00306 }
00307
00308 if(FieldBits::NoField != (WidthFieldMask & whichField))
00309 {
00310 _sfWidth.copyToBin(pMem);
00311 }
00312
00313 if(FieldBits::NoField != (HeightFieldMask & whichField))
00314 {
00315 _sfHeight.copyToBin(pMem);
00316 }
00317
00318 if(FieldBits::NoField != (DepthFieldMask & whichField))
00319 {
00320 _sfDepth.copyToBin(pMem);
00321 }
00322
00323 if(FieldBits::NoField != (TableFieldMask & whichField))
00324 {
00325 _mfTable.copyToBin(pMem);
00326 }
00327
00328
00329 }
00330
00331 void ColorDisplayFilterBase::copyFromBin( BinaryDataHandler &pMem,
00332 const BitVector &whichField)
00333 {
00334 Inherited::copyFromBin(pMem, whichField);
00335
00336 if(FieldBits::NoField != (GammaFieldMask & whichField))
00337 {
00338 _sfGamma.copyFromBin(pMem);
00339 }
00340
00341 if(FieldBits::NoField != (MatrixFieldMask & whichField))
00342 {
00343 _sfMatrix.copyFromBin(pMem);
00344 }
00345
00346 if(FieldBits::NoField != (WidthFieldMask & whichField))
00347 {
00348 _sfWidth.copyFromBin(pMem);
00349 }
00350
00351 if(FieldBits::NoField != (HeightFieldMask & whichField))
00352 {
00353 _sfHeight.copyFromBin(pMem);
00354 }
00355
00356 if(FieldBits::NoField != (DepthFieldMask & whichField))
00357 {
00358 _sfDepth.copyFromBin(pMem);
00359 }
00360
00361 if(FieldBits::NoField != (TableFieldMask & whichField))
00362 {
00363 _mfTable.copyFromBin(pMem);
00364 }
00365
00366
00367 }
00368
00369 #if !defined(OSG_FIXED_MFIELDSYNC)
00370 void ColorDisplayFilterBase::executeSyncImpl( ColorDisplayFilterBase *pOther,
00371 const BitVector &whichField)
00372 {
00373
00374 Inherited::executeSyncImpl(pOther, whichField);
00375
00376 if(FieldBits::NoField != (GammaFieldMask & whichField))
00377 _sfGamma.syncWith(pOther->_sfGamma);
00378
00379 if(FieldBits::NoField != (MatrixFieldMask & whichField))
00380 _sfMatrix.syncWith(pOther->_sfMatrix);
00381
00382 if(FieldBits::NoField != (WidthFieldMask & whichField))
00383 _sfWidth.syncWith(pOther->_sfWidth);
00384
00385 if(FieldBits::NoField != (HeightFieldMask & whichField))
00386 _sfHeight.syncWith(pOther->_sfHeight);
00387
00388 if(FieldBits::NoField != (DepthFieldMask & whichField))
00389 _sfDepth.syncWith(pOther->_sfDepth);
00390
00391 if(FieldBits::NoField != (TableFieldMask & whichField))
00392 _mfTable.syncWith(pOther->_mfTable);
00393
00394
00395 }
00396 #else
00397 void ColorDisplayFilterBase::executeSyncImpl( ColorDisplayFilterBase *pOther,
00398 const BitVector &whichField,
00399 const SyncInfo &sInfo )
00400 {
00401
00402 Inherited::executeSyncImpl(pOther, whichField, sInfo);
00403
00404 if(FieldBits::NoField != (GammaFieldMask & whichField))
00405 _sfGamma.syncWith(pOther->_sfGamma);
00406
00407 if(FieldBits::NoField != (MatrixFieldMask & whichField))
00408 _sfMatrix.syncWith(pOther->_sfMatrix);
00409
00410 if(FieldBits::NoField != (WidthFieldMask & whichField))
00411 _sfWidth.syncWith(pOther->_sfWidth);
00412
00413 if(FieldBits::NoField != (HeightFieldMask & whichField))
00414 _sfHeight.syncWith(pOther->_sfHeight);
00415
00416 if(FieldBits::NoField != (DepthFieldMask & whichField))
00417 _sfDepth.syncWith(pOther->_sfDepth);
00418
00419
00420 if(FieldBits::NoField != (TableFieldMask & whichField))
00421 _mfTable.syncWith(pOther->_mfTable, sInfo);
00422
00423
00424 }
00425
00426 void ColorDisplayFilterBase::execBeginEditImpl (const BitVector &whichField,
00427 UInt32 uiAspect,
00428 UInt32 uiContainerSize)
00429 {
00430 Inherited::execBeginEditImpl(whichField, uiAspect, uiContainerSize);
00431
00432 if(FieldBits::NoField != (TableFieldMask & whichField))
00433 _mfTable.beginEdit(uiAspect, uiContainerSize);
00434
00435 }
00436 #endif
00437
00438
00439
00440 OSG_END_NAMESPACE
00441
00442 #include <OSGSFieldTypeDef.inl>
00443 #include <OSGMFieldTypeDef.inl>
00444
00445 OSG_BEGIN_NAMESPACE
00446
00447 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
00448 DataType FieldDataTraits<ColorDisplayFilterPtr>::_type("ColorDisplayFilterPtr", "DisplayFilterPtr");
00449 #endif
00450
00451 OSG_DLLEXPORT_SFIELD_DEF1(ColorDisplayFilterPtr, OSG_SYSTEMLIB_DLLTMPLMAPPING);
00452 OSG_DLLEXPORT_MFIELD_DEF1(ColorDisplayFilterPtr, OSG_SYSTEMLIB_DLLTMPLMAPPING);
00453
00454
00455
00456
00457
00458 #ifdef OSG_SGI_CC
00459 #pragma set woff 1174
00460 #endif
00461
00462 #ifdef OSG_LINUX_ICC
00463 #pragma warning( disable : 177 )
00464 #endif
00465
00466 namespace
00467 {
00468 static Char8 cvsid_cpp [] = "@(#)$Id: FCBaseTemplate_cpp.h,v 1.49 2008/06/09 07:30:44 vossg Exp $";
00469 static Char8 cvsid_hpp [] = OSGCOLORDISPLAYFILTERBASE_HEADER_CVSID;
00470 static Char8 cvsid_inl [] = OSGCOLORDISPLAYFILTERBASE_INLINE_CVSID;
00471
00472 static Char8 cvsid_fields_hpp[] = OSGCOLORDISPLAYFILTERFIELDS_HEADER_CVSID;
00473 }
00474
00475 OSG_END_NAMESPACE
00476