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_COMPILESHADERPARAMETERCHUNKINST
00055
00056 #include <stdlib.h>
00057 #include <stdio.h>
00058
00059 #include <OSGConfig.h>
00060
00061 #include "OSGShaderParameterChunkBase.h"
00062 #include "OSGShaderParameterChunk.h"
00063
00064
00065 OSG_USING_NAMESPACE
00066
00067 const OSG::BitVector ShaderParameterChunkBase::ParametersFieldMask =
00068 (TypeTraits<BitVector>::One << ShaderParameterChunkBase::ParametersFieldId);
00069
00070 const OSG::BitVector ShaderParameterChunkBase::MTInfluenceMask =
00071 (Inherited::MTInfluenceMask) |
00072 (static_cast<BitVector>(0x0) << Inherited::NextFieldId);
00073
00074
00075
00076
00081
00082
00083 FieldDescription *ShaderParameterChunkBase::_desc[] =
00084 {
00085 new FieldDescription(MFShaderParameterPtr::getClassType(),
00086 "parameters",
00087 ParametersFieldId, ParametersFieldMask,
00088 false,
00089 (FieldAccessMethod) &ShaderParameterChunkBase::getMFParameters)
00090 };
00091
00092
00093 FieldContainerType ShaderParameterChunkBase::_type(
00094 "ShaderParameterChunk",
00095 "StateChunk",
00096 NULL,
00097 NULL,
00098 ShaderParameterChunk::initMethod,
00099 _desc,
00100 sizeof(_desc));
00101
00102
00103
00104
00105
00106 FieldContainerType &ShaderParameterChunkBase::getType(void)
00107 {
00108 return _type;
00109 }
00110
00111 const FieldContainerType &ShaderParameterChunkBase::getType(void) const
00112 {
00113 return _type;
00114 }
00115
00116
00117 UInt32 ShaderParameterChunkBase::getContainerSize(void) const
00118 {
00119 return sizeof(ShaderParameterChunk);
00120 }
00121
00122
00123 #if !defined(OSG_FIXED_MFIELDSYNC)
00124 void ShaderParameterChunkBase::executeSync( FieldContainer &other,
00125 const BitVector &whichField)
00126 {
00127 this->executeSyncImpl((ShaderParameterChunkBase *) &other, whichField);
00128 }
00129 #else
00130 void ShaderParameterChunkBase::executeSync( FieldContainer &other,
00131 const BitVector &whichField, const SyncInfo &sInfo )
00132 {
00133 this->executeSyncImpl((ShaderParameterChunkBase *) &other, whichField, sInfo);
00134 }
00135 void ShaderParameterChunkBase::execBeginEdit(const BitVector &whichField,
00136 UInt32 uiAspect,
00137 UInt32 uiContainerSize)
00138 {
00139 this->execBeginEditImpl(whichField, uiAspect, uiContainerSize);
00140 }
00141
00142 void ShaderParameterChunkBase::onDestroyAspect(UInt32 uiId, UInt32 uiAspect)
00143 {
00144 Inherited::onDestroyAspect(uiId, uiAspect);
00145
00146 _mfParameters.terminateShare(uiAspect, this->getContainerSize());
00147 }
00148 #endif
00149
00150
00151
00152 #ifdef OSG_WIN32_ICL
00153 #pragma warning (disable : 383)
00154 #endif
00155
00156 ShaderParameterChunkBase::ShaderParameterChunkBase(void) :
00157 _mfParameters (),
00158 Inherited()
00159 {
00160 }
00161
00162 #ifdef OSG_WIN32_ICL
00163 #pragma warning (default : 383)
00164 #endif
00165
00166 ShaderParameterChunkBase::ShaderParameterChunkBase(const ShaderParameterChunkBase &source) :
00167 _mfParameters (source._mfParameters ),
00168 Inherited (source)
00169 {
00170 }
00171
00172
00173
00174 ShaderParameterChunkBase::~ShaderParameterChunkBase(void)
00175 {
00176 }
00177
00178
00179
00180 UInt32 ShaderParameterChunkBase::getBinSize(const BitVector &whichField)
00181 {
00182 UInt32 returnValue = Inherited::getBinSize(whichField);
00183
00184 if(FieldBits::NoField != (ParametersFieldMask & whichField))
00185 {
00186 returnValue += _mfParameters.getBinSize();
00187 }
00188
00189
00190 return returnValue;
00191 }
00192
00193 void ShaderParameterChunkBase::copyToBin( BinaryDataHandler &pMem,
00194 const BitVector &whichField)
00195 {
00196 Inherited::copyToBin(pMem, whichField);
00197
00198 if(FieldBits::NoField != (ParametersFieldMask & whichField))
00199 {
00200 _mfParameters.copyToBin(pMem);
00201 }
00202
00203
00204 }
00205
00206 void ShaderParameterChunkBase::copyFromBin( BinaryDataHandler &pMem,
00207 const BitVector &whichField)
00208 {
00209 Inherited::copyFromBin(pMem, whichField);
00210
00211 if(FieldBits::NoField != (ParametersFieldMask & whichField))
00212 {
00213 _mfParameters.copyFromBin(pMem);
00214 }
00215
00216
00217 }
00218
00219 #if !defined(OSG_FIXED_MFIELDSYNC)
00220 void ShaderParameterChunkBase::executeSyncImpl( ShaderParameterChunkBase *pOther,
00221 const BitVector &whichField)
00222 {
00223
00224 Inherited::executeSyncImpl(pOther, whichField);
00225
00226 if(FieldBits::NoField != (ParametersFieldMask & whichField))
00227 _mfParameters.syncWith(pOther->_mfParameters);
00228
00229
00230 }
00231 #else
00232 void ShaderParameterChunkBase::executeSyncImpl( ShaderParameterChunkBase *pOther,
00233 const BitVector &whichField,
00234 const SyncInfo &sInfo )
00235 {
00236
00237 Inherited::executeSyncImpl(pOther, whichField, sInfo);
00238
00239
00240 if(FieldBits::NoField != (ParametersFieldMask & whichField))
00241 _mfParameters.syncWith(pOther->_mfParameters, sInfo);
00242
00243
00244 }
00245
00246 void ShaderParameterChunkBase::execBeginEditImpl (const BitVector &whichField,
00247 UInt32 uiAspect,
00248 UInt32 uiContainerSize)
00249 {
00250 Inherited::execBeginEditImpl(whichField, uiAspect, uiContainerSize);
00251
00252 if(FieldBits::NoField != (ParametersFieldMask & whichField))
00253 _mfParameters.beginEdit(uiAspect, uiContainerSize);
00254
00255 }
00256 #endif
00257
00258
00259
00260 #include <OSGSFieldTypeDef.inl>
00261 #include <OSGMFieldTypeDef.inl>
00262
00263 OSG_BEGIN_NAMESPACE
00264
00265 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
00266 DataType FieldDataTraits<ShaderParameterChunkPtr>::_type("ShaderParameterChunkPtr", "StateChunkPtr");
00267 #endif
00268
00269 OSG_DLLEXPORT_SFIELD_DEF1(ShaderParameterChunkPtr, OSG_SYSTEMLIB_DLLTMPLMAPPING);
00270 OSG_DLLEXPORT_MFIELD_DEF1(ShaderParameterChunkPtr, OSG_SYSTEMLIB_DLLTMPLMAPPING);
00271
00272 OSG_END_NAMESPACE
00273
00274
00275
00276
00277
00278 #ifdef OSG_SGI_CC
00279 #pragma set woff 1174
00280 #endif
00281
00282 #ifdef OSG_LINUX_ICC
00283 #pragma warning( disable : 177 )
00284 #endif
00285
00286 namespace
00287 {
00288 static Char8 cvsid_cpp [] = "@(#)$Id: OSGShaderParameterChunkBase.cpp,v 1.5 2005/07/20 00:08:59 vossg Exp $";
00289 static Char8 cvsid_hpp [] = OSGSHADERPARAMETERCHUNKBASE_HEADER_CVSID;
00290 static Char8 cvsid_inl [] = OSGSHADERPARAMETERCHUNKBASE_INLINE_CVSID;
00291
00292 static Char8 cvsid_fields_hpp[] = OSGSHADERPARAMETERCHUNKFIELDS_HEADER_CVSID;
00293 }
00294