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 #ifndef _OSGSHADERCHUNKBASE_H_
00055 #define _OSGSHADERCHUNKBASE_H_
00056 #ifdef __sgi
00057 #pragma once
00058 #endif
00059
00060
00061 #include <OSGConfig.h>
00062 #include <OSGSystemDef.h>
00063
00064 #include <OSGBaseTypes.h>
00065 #include <OSGRefPtr.h>
00066 #include <OSGCoredNodePtr.h>
00067
00068 #include <OSGShaderParameterChunk.h>
00069
00070 #include <OSGStringFields.h>
00071 #include <OSGStringFields.h>
00072 #include <OSGStringFields.h>
00073
00074 #include <OSGShaderChunkFields.h>
00075
00076 OSG_BEGIN_NAMESPACE
00077
00078 class ShaderChunk;
00079 class BinaryDataHandler;
00080
00082
00083 class OSG_SYSTEMLIB_DLLMAPPING ShaderChunkBase : public ShaderParameterChunk
00084 {
00085 private:
00086
00087 typedef ShaderParameterChunk Inherited;
00088
00089
00090 public:
00091
00092 typedef ShaderChunkPtr Ptr;
00093
00094 enum
00095 {
00096 VertexProgramFieldId = Inherited::NextFieldId,
00097 FragmentProgramFieldId = VertexProgramFieldId + 1,
00098 GeometryProgramFieldId = FragmentProgramFieldId + 1,
00099 NextFieldId = GeometryProgramFieldId + 1
00100 };
00101
00102 static const OSG::BitVector VertexProgramFieldMask;
00103 static const OSG::BitVector FragmentProgramFieldMask;
00104 static const OSG::BitVector GeometryProgramFieldMask;
00105
00106
00107 static const OSG::BitVector MTInfluenceMask;
00108
00109
00113 static FieldContainerType &getClassType (void);
00114 static UInt32 getClassTypeId (void);
00115
00117
00121 virtual FieldContainerType &getType (void);
00122 virtual const FieldContainerType &getType (void) const;
00123
00124 virtual UInt32 getContainerSize(void) const;
00125
00127
00131 SFString *getSFVertexProgram (void);
00132 SFString *getSFFragmentProgram(void);
00133 SFString *getSFGeometryProgram(void);
00134
00135 std::string &getVertexProgram (void);
00136 const std::string &getVertexProgram (void) const;
00137 std::string &getFragmentProgram(void);
00138 const std::string &getFragmentProgram(void) const;
00139 std::string &getGeometryProgram(void);
00140 const std::string &getGeometryProgram(void) const;
00141
00143
00147 void setVertexProgram ( const std::string &value );
00148 void setFragmentProgram( const std::string &value );
00149 void setGeometryProgram( const std::string &value );
00150
00152
00157
00161 virtual UInt32 getBinSize (const BitVector &whichField);
00162 virtual void copyToBin ( BinaryDataHandler &pMem,
00163 const BitVector &whichField);
00164 virtual void copyFromBin( BinaryDataHandler &pMem,
00165 const BitVector &whichField);
00166
00167
00169
00170 protected:
00171
00172
00176 SFString _sfVertexProgram;
00177 SFString _sfFragmentProgram;
00178 SFString _sfGeometryProgram;
00179
00181
00185 ShaderChunkBase(void);
00186 ShaderChunkBase(const ShaderChunkBase &source);
00187
00189
00193 virtual ~ShaderChunkBase(void);
00194
00196
00200 #if !defined(OSG_FIXED_MFIELDSYNC)
00201 void executeSyncImpl( ShaderChunkBase *pOther,
00202 const BitVector &whichField);
00203
00204 virtual void executeSync( FieldContainer &other,
00205 const BitVector &whichField);
00206 #else
00207 void executeSyncImpl( ShaderChunkBase *pOther,
00208 const BitVector &whichField,
00209 const SyncInfo &sInfo );
00210
00211 virtual void executeSync( FieldContainer &other,
00212 const BitVector &whichField,
00213 const SyncInfo &sInfo);
00214
00215 virtual void execBeginEdit (const BitVector &whichField,
00216 UInt32 uiAspect,
00217 UInt32 uiContainerSize);
00218
00219 void execBeginEditImpl (const BitVector &whichField,
00220 UInt32 uiAspect,
00221 UInt32 uiContainerSize);
00222
00223 virtual void onDestroyAspect(UInt32 uiId, UInt32 uiAspect);
00224 #endif
00225
00227
00228 private:
00229
00230 friend class FieldContainer;
00231
00232 static FieldDescription *_desc[];
00233 static FieldContainerType _type;
00234
00235
00236
00237 void operator =(const ShaderChunkBase &source);
00238 };
00239
00240
00241
00242
00243
00244
00245 typedef ShaderChunkBase *ShaderChunkBaseP;
00246
00247 typedef osgIF<ShaderChunkBase::isNodeCore,
00248 CoredNodePtr<ShaderChunk>,
00249 FieldContainer::attempt_to_create_CoredNodePtr_on_non_NodeCore_FC
00250 >::_IRet ShaderChunkNodePtr;
00251
00252 typedef RefPtr<ShaderChunkPtr> ShaderChunkRefPtr;
00253
00254 OSG_END_NAMESPACE
00255
00256 #define OSGSHADERCHUNKBASE_HEADER_CVSID "@(#)$Id: OSGShaderChunkBase.h,v 1.8 2006/11/17 17:16:04 a-m-z Exp $"
00257
00258 #endif