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 _OSGPROGRAMCHUNKBASE_H_
00055 #define _OSGPROGRAMCHUNKBASE_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 <OSGStateChunk.h>
00069
00070 #include <OSGStringFields.h>
00071 #include <OSGVec4fFields.h>
00072 #include <OSGStringFields.h>
00073 #include <OSGUInt32Fields.h>
00074
00075 #include <OSGProgramChunkFields.h>
00076
00077 OSG_BEGIN_NAMESPACE
00078
00079 class ProgramChunk;
00080 class BinaryDataHandler;
00081
00083
00084 class OSG_SYSTEMLIB_DLLMAPPING ProgramChunkBase : public StateChunk
00085 {
00086 private:
00087
00088 typedef StateChunk Inherited;
00089
00090
00091 public:
00092
00093 typedef ProgramChunkPtr Ptr;
00094
00095 enum
00096 {
00097 ProgramFieldId = Inherited::NextFieldId,
00098 ParamValuesFieldId = ProgramFieldId + 1,
00099 ParamNamesFieldId = ParamValuesFieldId + 1,
00100 GLIdFieldId = ParamNamesFieldId + 1,
00101 NextFieldId = GLIdFieldId + 1
00102 };
00103
00104 static const OSG::BitVector ProgramFieldMask;
00105 static const OSG::BitVector ParamValuesFieldMask;
00106 static const OSG::BitVector ParamNamesFieldMask;
00107 static const OSG::BitVector GLIdFieldMask;
00108
00109
00110 static const OSG::BitVector MTInfluenceMask;
00111
00112
00116 static FieldContainerType &getClassType (void);
00117 static UInt32 getClassTypeId (void);
00118
00120
00124 virtual FieldContainerType &getType (void);
00125 virtual const FieldContainerType &getType (void) const;
00126
00127 virtual UInt32 getContainerSize(void) const;
00128
00130
00134 SFString *getSFProgram (void);
00135 MFVec4f *getMFParamValues (void);
00136 MFString *getMFParamNames (void);
00137
00138 std::string &getProgram (void);
00139 const std::string &getProgram (void) const;
00140 Vec4f &getParamValues (const UInt32 index);
00141 MFVec4f &getParamValues (void);
00142 const MFVec4f &getParamValues (void) const;
00143 std::string &getParamNames (const UInt32 index);
00144 MFString &getParamNames (void);
00145 const MFString &getParamNames (void) const;
00146
00148
00152 void setProgram ( const std::string &value );
00153
00155
00160
00164 virtual UInt32 getBinSize (const BitVector &whichField);
00165 virtual void copyToBin ( BinaryDataHandler &pMem,
00166 const BitVector &whichField);
00167 virtual void copyFromBin( BinaryDataHandler &pMem,
00168 const BitVector &whichField);
00169
00170
00172
00173 protected:
00174
00175
00179 SFString _sfProgram;
00180 MFVec4f _mfParamValues;
00181 MFString _mfParamNames;
00182 SFUInt32 _sfGLId;
00183
00185
00189 ProgramChunkBase(void);
00190 ProgramChunkBase(const ProgramChunkBase &source);
00191
00193
00197 virtual ~ProgramChunkBase(void);
00198
00200
00204 SFUInt32 *getSFGLId (void);
00205
00206 UInt32 &getGLId (void);
00207 const UInt32 &getGLId (void) const;
00208
00210
00214 void setGLId (const UInt32 &value);
00215
00217
00221 #if !defined(OSG_FIXED_MFIELDSYNC)
00222 void executeSyncImpl( ProgramChunkBase *pOther,
00223 const BitVector &whichField);
00224
00225 virtual void executeSync( FieldContainer &other,
00226 const BitVector &whichField);
00227 #else
00228 void executeSyncImpl( ProgramChunkBase *pOther,
00229 const BitVector &whichField,
00230 const SyncInfo &sInfo );
00231
00232 virtual void executeSync( FieldContainer &other,
00233 const BitVector &whichField,
00234 const SyncInfo &sInfo);
00235
00236 virtual void execBeginEdit (const BitVector &whichField,
00237 UInt32 uiAspect,
00238 UInt32 uiContainerSize);
00239
00240 void execBeginEditImpl (const BitVector &whichField,
00241 UInt32 uiAspect,
00242 UInt32 uiContainerSize);
00243
00244 virtual void onDestroyAspect(UInt32 uiId, UInt32 uiAspect);
00245 #endif
00246
00248
00249 private:
00250
00251 friend class FieldContainer;
00252
00253 static FieldDescription *_desc[];
00254 static FieldContainerType _type;
00255
00256
00257
00258 void operator =(const ProgramChunkBase &source);
00259 };
00260
00261
00262
00263
00264
00265
00266 typedef ProgramChunkBase *ProgramChunkBaseP;
00267
00268 typedef osgIF<ProgramChunkBase::isNodeCore,
00269 CoredNodePtr<ProgramChunk>,
00270 FieldContainer::attempt_to_create_CoredNodePtr_on_non_NodeCore_FC
00271 >::_IRet ProgramChunkNodePtr;
00272
00273 typedef RefPtr<ProgramChunkPtr> ProgramChunkRefPtr;
00274
00275 OSG_END_NAMESPACE
00276
00277 #define OSGPROGRAMCHUNKBASE_HEADER_CVSID "@(#)$Id: FCBaseTemplate_h.h,v 1.40 2005/07/20 00:10:14 vossg Exp $"
00278
00279 #endif