1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 /*****************************************************************************\
40 *****************************************************************************
42 ** This file is automatically generated. **
44 ** Any changes made to this file WILL be lost when it is **
45 ** regenerated, which can become necessary at any time. **
47 ** Do not change this file, changes should be done in the derived **
48 ** class ComputeShaderChunk
50 *****************************************************************************
51 \*****************************************************************************/
54 #ifndef _OSGCOMPUTESHADERCHUNKBASE_H_
55 #define _OSGCOMPUTESHADERCHUNKBASE_H_
61 #include "OSGConfig.h"
62 #include "OSGContribComputeBaseDef.h"
64 //#include "OSGBaseTypes.h"
66 #include "OSGStateChunk.h" // Parent
68 #include "OSGShaderProgramFields.h" // ComputeShader type
69 #include "OSGBaseFields.h" // ComputeProgram type
70 #include "OSGShaderProgramVariablesFields.h" // Variables type
71 #include "OSGSysFields.h" // VariableLocations type
73 #include "OSGComputeShaderChunkFields.h"
78 class ComputeShaderChunk
;
80 //! \brief ComputeShaderChunk Base Class.
82 class OSG_CONTRIBCOMPUTEBASE_DLLMAPPING ComputeShaderChunkBase
: public StateChunk
86 typedef StateChunk Inherited
;
87 typedef StateChunk ParentContainer
;
89 typedef Inherited::TypeObject TypeObject
;
90 typedef TypeObject::InitPhase InitPhase
;
92 OSG_GEN_INTERNALPTR(ComputeShaderChunk
);
94 /*========================== PUBLIC =================================*/
100 ComputeShaderFieldId
= Inherited::NextFieldId
,
101 ComputeProgramFieldId
= ComputeShaderFieldId
+ 1,
102 VariablesFieldId
= ComputeProgramFieldId
+ 1,
103 VariableLocationsFieldId
= VariablesFieldId
+ 1,
104 ProceduralVariableLocationsFieldId
= VariableLocationsFieldId
+ 1,
105 GLIdFieldId
= ProceduralVariableLocationsFieldId
+ 1,
106 NextFieldId
= GLIdFieldId
+ 1
109 static const OSG::BitVector ComputeShaderFieldMask
=
110 (TypeTraits
<BitVector
>::One
<< ComputeShaderFieldId
);
111 static const OSG::BitVector ComputeProgramFieldMask
=
112 (TypeTraits
<BitVector
>::One
<< ComputeProgramFieldId
);
113 static const OSG::BitVector VariablesFieldMask
=
114 (TypeTraits
<BitVector
>::One
<< VariablesFieldId
);
115 static const OSG::BitVector VariableLocationsFieldMask
=
116 (TypeTraits
<BitVector
>::One
<< VariableLocationsFieldId
);
117 static const OSG::BitVector ProceduralVariableLocationsFieldMask
=
118 (TypeTraits
<BitVector
>::One
<< ProceduralVariableLocationsFieldId
);
119 static const OSG::BitVector GLIdFieldMask
=
120 (TypeTraits
<BitVector
>::One
<< GLIdFieldId
);
121 static const OSG::BitVector NextFieldMask
=
122 (TypeTraits
<BitVector
>::One
<< NextFieldId
);
124 typedef MFUnrecShaderProgramPtr MFComputeShaderType
;
125 typedef SFString SFComputeProgramType
;
126 typedef SFUnrecChildShaderProgramVariablesPtr SFVariablesType
;
127 typedef MFInt32 MFVariableLocationsType
;
128 typedef MFInt32 MFProceduralVariableLocationsType
;
129 typedef SFUInt32 SFGLIdType
;
131 /*---------------------------------------------------------------------*/
132 /*! \name Class Get */
135 static FieldContainerType
&getClassType (void);
136 static UInt32
getClassTypeId (void);
137 static UInt16
getClassGroupId(void);
140 /*---------------------------------------------------------------------*/
141 /*! \name FieldContainer Get */
144 virtual FieldContainerType
&getType (void);
145 virtual const FieldContainerType
&getType (void) const;
147 virtual UInt32
getContainerSize(void) const;
150 /*---------------------------------------------------------------------*/
151 /*! \name Field Get */
154 const MFUnrecShaderProgramPtr
*getMFComputeShader (void) const;
155 MFUnrecShaderProgramPtr
*editMFComputeShader (void);
157 SFString
*editSFComputeProgram (void);
158 const SFString
*getSFComputeProgram (void) const;
159 const SFUnrecChildShaderProgramVariablesPtr
*getSFVariables (void) const;
160 SFUnrecChildShaderProgramVariablesPtr
*editSFVariables (void);
162 SFUInt32
*editSFGLId (void);
163 const SFUInt32
*getSFGLId (void) const;
166 ShaderProgram
* getComputeShader (const UInt32 index
) const;
168 std::string
&editComputeProgram (void);
169 const std::string
&getComputeProgram (void) const;
171 ShaderProgramVariables
* getVariables (void) const;
173 UInt32
&editGLId (void);
174 UInt32
getGLId (void) const;
177 /*---------------------------------------------------------------------*/
178 /*! \name Field Set */
181 void setComputeProgram (const std::string
&value
);
182 void setVariables (ShaderProgramVariables
* const value
);
183 void setGLId (const UInt32 value
);
186 /*---------------------------------------------------------------------*/
187 /*! \name Ptr Field Set */
191 /*---------------------------------------------------------------------*/
192 /*! \name Ptr MField Set */
195 void addComputeShader (ShaderProgram
* const value
);
196 void assignComputeShader (const MFUnrecShaderProgramPtr
&value
);
197 void subComputeShader (UInt32 uiIndex
);
198 void removeObjFromComputeShader(ShaderProgram
* const value
);
199 void clearComputeShaders (void );
202 /*---------------------------------------------------------------------*/
203 /*! \name Binary Access */
206 virtual SizeT
getBinSize (ConstFieldMaskArg whichField
);
207 virtual void copyToBin (BinaryDataHandler
&pMem
,
208 ConstFieldMaskArg whichField
);
209 virtual void copyFromBin(BinaryDataHandler
&pMem
,
210 ConstFieldMaskArg whichField
);
214 /*---------------------------------------------------------------------*/
215 /*! \name Construction */
218 static ComputeShaderChunkTransitPtr
create (void);
219 static ComputeShaderChunk
*createEmpty (void);
221 static ComputeShaderChunkTransitPtr
createLocal (
222 BitVector bFlags
= FCLocal::All
);
224 static ComputeShaderChunk
*createEmptyLocal(
225 BitVector bFlags
= FCLocal::All
);
227 static ComputeShaderChunkTransitPtr
createDependent (BitVector bFlags
);
230 /*---------------------------------------------------------------------*/
234 virtual FieldContainerTransitPtr
shallowCopy (void) const;
235 virtual FieldContainerTransitPtr
shallowCopyLocal(
236 BitVector bFlags
= FCLocal::All
) const;
237 virtual FieldContainerTransitPtr
shallowCopyDependent(
238 BitVector bFlags
) const;
241 /*========================= PROTECTED ===============================*/
245 static TypeObject _type
;
247 static void classDescInserter(TypeObject
&oType
);
248 static const Char8
*getClassname (void );
250 /*---------------------------------------------------------------------*/
254 MFUnrecShaderProgramPtr _mfComputeShader
;
255 SFString _sfComputeProgram
;
256 SFUnrecChildShaderProgramVariablesPtr _sfVariables
;
257 MFInt32 _mfVariableLocations
;
258 MFInt32 _mfProceduralVariableLocations
;
262 /*---------------------------------------------------------------------*/
263 /*! \name Constructors */
266 ComputeShaderChunkBase(void);
267 ComputeShaderChunkBase(const ComputeShaderChunkBase
&source
);
270 /*---------------------------------------------------------------------*/
271 /*! \name Destructors */
274 virtual ~ComputeShaderChunkBase(void);
277 /*---------------------------------------------------------------------*/
278 /*! \name onCreate */
281 void onCreate(const ComputeShaderChunk
*source
= NULL
);
284 /*---------------------------------------------------------------------*/
285 /*! \name Child linking */
288 virtual bool unlinkChild(FieldContainer
* const pChild
,
289 UInt16
const childFieldId
);
292 /*---------------------------------------------------------------------*/
293 /*! \name Generic Field Access */
296 GetFieldHandlePtr
getHandleComputeShader (void) const;
297 EditFieldHandlePtr
editHandleComputeShader (void);
298 GetFieldHandlePtr
getHandleComputeProgram (void) const;
299 EditFieldHandlePtr
editHandleComputeProgram (void);
300 GetFieldHandlePtr
getHandleVariables (void) const;
301 EditFieldHandlePtr
editHandleVariables (void);
302 GetFieldHandlePtr
getHandleVariableLocations (void) const;
303 EditFieldHandlePtr
editHandleVariableLocations(void);
304 GetFieldHandlePtr
getHandleProceduralVariableLocations (void) const;
305 EditFieldHandlePtr
editHandleProceduralVariableLocations(void);
306 GetFieldHandlePtr
getHandleGLId (void) const;
307 EditFieldHandlePtr
editHandleGLId (void);
310 /*---------------------------------------------------------------------*/
311 /*! \name Field Get */
315 MFInt32
*editMFVariableLocations(void);
316 const MFInt32
*getMFVariableLocations (void) const;
318 MFInt32
*editMFProceduralVariableLocations(void);
319 const MFInt32
*getMFProceduralVariableLocations (void) const;
322 MFInt32 ::reference
editVariableLocations(const UInt32 index
);
323 Int32
getVariableLocations (const UInt32 index
) const;
325 MFInt32 ::reference
editProceduralVariableLocations(const UInt32 index
);
326 Int32
getProceduralVariableLocations (const UInt32 index
) const;
329 /*---------------------------------------------------------------------*/
330 /*! \name Field Set */
335 /*---------------------------------------------------------------------*/
336 /*! \name Ptr MField Set */
340 /*---------------------------------------------------------------------*/
344 #ifdef OSG_MT_CPTR_ASPECT
345 virtual void execSyncV( FieldContainer
&oFrom
,
346 ConstFieldMaskArg whichField
,
347 AspectOffsetStore
&oOffsets
,
348 ConstFieldMaskArg syncMode
,
349 const UInt32 uiSyncInfo
);
351 void execSync ( ComputeShaderChunkBase
*pFrom
,
352 ConstFieldMaskArg whichField
,
353 AspectOffsetStore
&oOffsets
,
354 ConstFieldMaskArg syncMode
,
355 const UInt32 uiSyncInfo
);
359 /*---------------------------------------------------------------------*/
364 /*---------------------------------------------------------------------*/
365 /*! \name Aspect Create */
368 #ifdef OSG_MT_CPTR_ASPECT
369 virtual FieldContainer
*createAspectCopy(
370 const FieldContainer
*pRefAspect
) const;
374 /*---------------------------------------------------------------------*/
378 /*---------------------------------------------------------------------*/
382 virtual void resolveLinks(void);
385 /*========================== PRIVATE ================================*/
388 /*---------------------------------------------------------------------*/
390 // prohibit default functions (move to 'public' if you need one)
391 void operator =(const ComputeShaderChunkBase
&source
);
394 typedef ComputeShaderChunkBase
*ComputeShaderChunkBaseP
;
398 #endif /* _OSGCOMPUTESHADERCHUNKBASE_H_ */