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