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 ShaderExecutableChunk
50 *****************************************************************************
51 \*****************************************************************************/
54 #ifndef _OSGSHADEREXECUTABLECHUNKBASE_H_
55 #define _OSGSHADEREXECUTABLECHUNKBASE_H_
61 #include "OSGConfig.h"
62 #include "OSGSystemDef.h"
64 //#include "OSGBaseTypes.h"
66 #include "OSGStateChunk.h" // Parent
68 #include "OSGShaderProgramFields.h" // VertexShader type
69 #include "OSGShaderProgramVariablesFields.h" // Variables type
70 #include "OSGSysFields.h" // VariableLocations type
71 #include "OSGBaseFields.h" // GeometryInputType type
72 #include "OSGShaderAttributeFields.h" // Attributes type
74 #include "OSGShaderExecutableChunkFields.h"
79 class ShaderExecutableChunk
;
81 //! \brief ShaderExecutableChunk Base Class.
83 class OSG_SYSTEM_DLLMAPPING ShaderExecutableChunkBase
: public StateChunk
87 typedef StateChunk Inherited
;
88 typedef StateChunk ParentContainer
;
90 typedef Inherited::TypeObject TypeObject
;
91 typedef TypeObject::InitPhase InitPhase
;
93 OSG_GEN_INTERNALPTR(ShaderExecutableChunk
);
95 /*========================== PUBLIC =================================*/
101 VertexShaderFieldId
= Inherited::NextFieldId
,
102 TessControlShaderFieldId
= VertexShaderFieldId
+ 1,
103 TessEvaluationShaderFieldId
= TessControlShaderFieldId
+ 1,
104 GeometryShaderFieldId
= TessEvaluationShaderFieldId
+ 1,
105 FragmentShaderFieldId
= GeometryShaderFieldId
+ 1,
106 VariablesFieldId
= FragmentShaderFieldId
+ 1,
107 VariableLocationsFieldId
= VariablesFieldId
+ 1,
108 ProceduralVariableLocationsFieldId
= VariableLocationsFieldId
+ 1,
109 GeometryVerticesOutFieldId
= ProceduralVariableLocationsFieldId
+ 1,
110 GeometryInputTypeFieldId
= GeometryVerticesOutFieldId
+ 1,
111 GeometryOutputTypeFieldId
= GeometryInputTypeFieldId
+ 1,
112 AttributesFieldId
= GeometryOutputTypeFieldId
+ 1,
113 GLIdFieldId
= AttributesFieldId
+ 1,
114 PointSizeFieldId
= GLIdFieldId
+ 1,
115 NextFieldId
= PointSizeFieldId
+ 1
118 static const OSG::BitVector VertexShaderFieldMask
=
119 (TypeTraits
<BitVector
>::One
<< VertexShaderFieldId
);
120 static const OSG::BitVector TessControlShaderFieldMask
=
121 (TypeTraits
<BitVector
>::One
<< TessControlShaderFieldId
);
122 static const OSG::BitVector TessEvaluationShaderFieldMask
=
123 (TypeTraits
<BitVector
>::One
<< TessEvaluationShaderFieldId
);
124 static const OSG::BitVector GeometryShaderFieldMask
=
125 (TypeTraits
<BitVector
>::One
<< GeometryShaderFieldId
);
126 static const OSG::BitVector FragmentShaderFieldMask
=
127 (TypeTraits
<BitVector
>::One
<< FragmentShaderFieldId
);
128 static const OSG::BitVector VariablesFieldMask
=
129 (TypeTraits
<BitVector
>::One
<< VariablesFieldId
);
130 static const OSG::BitVector VariableLocationsFieldMask
=
131 (TypeTraits
<BitVector
>::One
<< VariableLocationsFieldId
);
132 static const OSG::BitVector ProceduralVariableLocationsFieldMask
=
133 (TypeTraits
<BitVector
>::One
<< ProceduralVariableLocationsFieldId
);
134 static const OSG::BitVector GeometryVerticesOutFieldMask
=
135 (TypeTraits
<BitVector
>::One
<< GeometryVerticesOutFieldId
);
136 static const OSG::BitVector GeometryInputTypeFieldMask
=
137 (TypeTraits
<BitVector
>::One
<< GeometryInputTypeFieldId
);
138 static const OSG::BitVector GeometryOutputTypeFieldMask
=
139 (TypeTraits
<BitVector
>::One
<< GeometryOutputTypeFieldId
);
140 static const OSG::BitVector AttributesFieldMask
=
141 (TypeTraits
<BitVector
>::One
<< AttributesFieldId
);
142 static const OSG::BitVector GLIdFieldMask
=
143 (TypeTraits
<BitVector
>::One
<< GLIdFieldId
);
144 static const OSG::BitVector PointSizeFieldMask
=
145 (TypeTraits
<BitVector
>::One
<< PointSizeFieldId
);
146 static const OSG::BitVector NextFieldMask
=
147 (TypeTraits
<BitVector
>::One
<< NextFieldId
);
149 typedef MFUncountedShaderProgramPtr MFVertexShaderType
;
150 typedef MFUncountedShaderProgramPtr MFTessControlShaderType
;
151 typedef MFUncountedShaderProgramPtr MFTessEvaluationShaderType
;
152 typedef MFUncountedShaderProgramPtr MFGeometryShaderType
;
153 typedef MFUncountedShaderProgramPtr MFFragmentShaderType
;
154 typedef SFUnrecChildShaderProgramVariablesPtr SFVariablesType
;
155 typedef MFInt32 MFVariableLocationsType
;
156 typedef MFInt32 MFProceduralVariableLocationsType
;
157 typedef SFUInt32 SFGeometryVerticesOutType
;
158 typedef SFGLenum SFGeometryInputTypeType
;
159 typedef SFGLenum SFGeometryOutputTypeType
;
160 typedef MFShaderAttribute MFAttributesType
;
161 typedef SFUInt32 SFGLIdType
;
162 typedef SFBool SFPointSizeType
;
164 /*---------------------------------------------------------------------*/
165 /*! \name Class Get */
168 static FieldContainerType
&getClassType (void);
169 static UInt32
getClassTypeId (void);
170 static UInt16
getClassGroupId(void);
173 /*---------------------------------------------------------------------*/
174 /*! \name FieldContainer Get */
177 virtual FieldContainerType
&getType (void);
178 virtual const FieldContainerType
&getType (void) const;
180 virtual UInt32
getContainerSize(void) const;
183 /*---------------------------------------------------------------------*/
184 /*! \name Field Get */
187 const SFUnrecChildShaderProgramVariablesPtr
*getSFVariables (void) const;
188 SFUnrecChildShaderProgramVariablesPtr
*editSFVariables (void);
190 SFUInt32
*editSFGeometryVerticesOut(void);
191 const SFUInt32
*getSFGeometryVerticesOut (void) const;
193 SFGLenum
*editSFGeometryInputType(void);
194 const SFGLenum
*getSFGeometryInputType (void) const;
196 SFGLenum
*editSFGeometryOutputType(void);
197 const SFGLenum
*getSFGeometryOutputType (void) const;
199 MFShaderAttribute
*editMFAttributes (void);
200 const MFShaderAttribute
*getMFAttributes (void) const;
202 SFUInt32
*editSFGLId (void);
203 const SFUInt32
*getSFGLId (void) const;
205 SFBool
*editSFPointSize (void);
206 const SFBool
*getSFPointSize (void) const;
209 ShaderProgramVariables
* getVariables (void) const;
211 UInt32
&editGeometryVerticesOut(void);
212 UInt32
getGeometryVerticesOut (void) const;
214 GLenum
&editGeometryInputType(void);
215 const GLenum
&getGeometryInputType (void) const;
217 GLenum
&editGeometryOutputType(void);
218 const GLenum
&getGeometryOutputType (void) const;
220 MFShaderAttribute ::reference
editAttributes (const UInt32 index
);
221 const ShaderAttribute
&getAttributes (const UInt32 index
) const;
223 UInt32
&editGLId (void);
224 UInt32
getGLId (void) const;
226 bool &editPointSize (void);
227 bool getPointSize (void) const;
230 /*---------------------------------------------------------------------*/
231 /*! \name Field Set */
234 void setVariables (ShaderProgramVariables
* const value
);
235 void setGeometryVerticesOut(const UInt32 value
);
236 void setGeometryInputType(const GLenum
&value
);
237 void setGeometryOutputType(const GLenum
&value
);
238 void setGLId (const UInt32 value
);
239 void setPointSize (const bool value
);
242 /*---------------------------------------------------------------------*/
243 /*! \name Ptr Field Set */
247 /*---------------------------------------------------------------------*/
248 /*! \name Ptr MField Set */
252 /*---------------------------------------------------------------------*/
253 /*! \name Binary Access */
256 virtual SizeT
getBinSize (ConstFieldMaskArg whichField
);
257 virtual void copyToBin (BinaryDataHandler
&pMem
,
258 ConstFieldMaskArg whichField
);
259 virtual void copyFromBin(BinaryDataHandler
&pMem
,
260 ConstFieldMaskArg whichField
);
264 /*---------------------------------------------------------------------*/
265 /*! \name Construction */
268 static ShaderExecutableChunkTransitPtr
create (void);
269 static ShaderExecutableChunk
*createEmpty (void);
271 static ShaderExecutableChunkTransitPtr
createLocal (
272 BitVector bFlags
= FCLocal::All
);
274 static ShaderExecutableChunk
*createEmptyLocal(
275 BitVector bFlags
= FCLocal::All
);
277 static ShaderExecutableChunkTransitPtr
createDependent (BitVector bFlags
);
280 /*---------------------------------------------------------------------*/
284 virtual FieldContainerTransitPtr
shallowCopy (void) const;
285 virtual FieldContainerTransitPtr
shallowCopyLocal(
286 BitVector bFlags
= FCLocal::All
) const;
287 virtual FieldContainerTransitPtr
shallowCopyDependent(
288 BitVector bFlags
) const;
291 /*========================= PROTECTED ===============================*/
295 static TypeObject _type
;
297 static void classDescInserter(TypeObject
&oType
);
298 static const Char8
*getClassname (void );
300 /*---------------------------------------------------------------------*/
304 MFUncountedShaderProgramPtr _mfVertexShader
;
305 MFUncountedShaderProgramPtr _mfTessControlShader
;
306 MFUncountedShaderProgramPtr _mfTessEvaluationShader
;
307 MFUncountedShaderProgramPtr _mfGeometryShader
;
308 MFUncountedShaderProgramPtr _mfFragmentShader
;
309 SFUnrecChildShaderProgramVariablesPtr _sfVariables
;
310 MFInt32 _mfVariableLocations
;
311 MFInt32 _mfProceduralVariableLocations
;
312 SFUInt32 _sfGeometryVerticesOut
;
313 SFGLenum _sfGeometryInputType
;
314 SFGLenum _sfGeometryOutputType
;
315 MFShaderAttribute _mfAttributes
;
320 /*---------------------------------------------------------------------*/
321 /*! \name Constructors */
324 ShaderExecutableChunkBase(void);
325 ShaderExecutableChunkBase(const ShaderExecutableChunkBase
&source
);
328 /*---------------------------------------------------------------------*/
329 /*! \name Destructors */
332 virtual ~ShaderExecutableChunkBase(void);
335 /*---------------------------------------------------------------------*/
336 /*! \name onCreate */
339 void onCreate(const ShaderExecutableChunk
*source
= NULL
);
342 /*---------------------------------------------------------------------*/
343 /*! \name Child linking */
346 virtual bool unlinkChild(FieldContainer
* const pChild
,
347 UInt16
const childFieldId
);
350 /*---------------------------------------------------------------------*/
351 /*! \name Generic Field Access */
354 GetFieldHandlePtr
getHandleVertexShader (void) const;
355 EditFieldHandlePtr
editHandleVertexShader (void);
356 GetFieldHandlePtr
getHandleTessControlShader (void) const;
357 EditFieldHandlePtr
editHandleTessControlShader(void);
358 GetFieldHandlePtr
getHandleTessEvaluationShader (void) const;
359 EditFieldHandlePtr
editHandleTessEvaluationShader(void);
360 GetFieldHandlePtr
getHandleGeometryShader (void) const;
361 EditFieldHandlePtr
editHandleGeometryShader (void);
362 GetFieldHandlePtr
getHandleFragmentShader (void) const;
363 EditFieldHandlePtr
editHandleFragmentShader (void);
364 GetFieldHandlePtr
getHandleVariables (void) const;
365 EditFieldHandlePtr
editHandleVariables (void);
366 GetFieldHandlePtr
getHandleVariableLocations (void) const;
367 EditFieldHandlePtr
editHandleVariableLocations(void);
368 GetFieldHandlePtr
getHandleProceduralVariableLocations (void) const;
369 EditFieldHandlePtr
editHandleProceduralVariableLocations(void);
370 GetFieldHandlePtr
getHandleGeometryVerticesOut (void) const;
371 EditFieldHandlePtr
editHandleGeometryVerticesOut(void);
372 GetFieldHandlePtr
getHandleGeometryInputType (void) const;
373 EditFieldHandlePtr
editHandleGeometryInputType(void);
374 GetFieldHandlePtr
getHandleGeometryOutputType (void) const;
375 EditFieldHandlePtr
editHandleGeometryOutputType(void);
376 GetFieldHandlePtr
getHandleAttributes (void) const;
377 EditFieldHandlePtr
editHandleAttributes (void);
378 GetFieldHandlePtr
getHandleGLId (void) const;
379 EditFieldHandlePtr
editHandleGLId (void);
380 GetFieldHandlePtr
getHandlePointSize (void) const;
381 EditFieldHandlePtr
editHandlePointSize (void);
384 /*---------------------------------------------------------------------*/
385 /*! \name Field Get */
389 MFInt32
*editMFVariableLocations(void);
390 const MFInt32
*getMFVariableLocations (void) const;
392 MFInt32
*editMFProceduralVariableLocations(void);
393 const MFInt32
*getMFProceduralVariableLocations (void) const;
396 MFInt32 ::reference
editVariableLocations(const UInt32 index
);
397 Int32
getVariableLocations (const UInt32 index
) const;
399 MFInt32 ::reference
editProceduralVariableLocations(const UInt32 index
);
400 Int32
getProceduralVariableLocations (const UInt32 index
) const;
403 /*---------------------------------------------------------------------*/
404 /*! \name Field Set */
409 /*---------------------------------------------------------------------*/
410 /*! \name Ptr MField Set */
414 /*---------------------------------------------------------------------*/
418 #ifdef OSG_MT_CPTR_ASPECT
419 virtual void execSyncV( FieldContainer
&oFrom
,
420 ConstFieldMaskArg whichField
,
421 AspectOffsetStore
&oOffsets
,
422 ConstFieldMaskArg syncMode
,
423 const UInt32 uiSyncInfo
);
425 void execSync ( ShaderExecutableChunkBase
*pFrom
,
426 ConstFieldMaskArg whichField
,
427 AspectOffsetStore
&oOffsets
,
428 ConstFieldMaskArg syncMode
,
429 const UInt32 uiSyncInfo
);
433 /*---------------------------------------------------------------------*/
438 /*---------------------------------------------------------------------*/
439 /*! \name Aspect Create */
442 #ifdef OSG_MT_CPTR_ASPECT
443 virtual FieldContainer
*createAspectCopy(
444 const FieldContainer
*pRefAspect
) const;
448 /*---------------------------------------------------------------------*/
452 /*---------------------------------------------------------------------*/
456 virtual void resolveLinks(void);
459 /*========================== PRIVATE ================================*/
462 /*---------------------------------------------------------------------*/
464 // prohibit default functions (move to 'public' if you need one)
465 void operator =(const ShaderExecutableChunkBase
&source
);
468 typedef ShaderExecutableChunkBase
*ShaderExecutableChunkBaseP
;
472 #endif /* _OSGSHADEREXECUTABLECHUNKBASE_H_ */