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 ShaderProgramChunk
50 *****************************************************************************
51 \*****************************************************************************/
54 #ifndef _OSGSHADERPROGRAMCHUNKBASE_H_
55 #define _OSGSHADERPROGRAMCHUNKBASE_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 "OSGSysFields.h" // GeometryVerticesOut type
70 #include "OSGBaseFields.h" // GeometryInputType type
72 #include "OSGShaderProgramChunkFields.h"
77 class ShaderProgramChunk
;
79 //! \brief ShaderProgramChunk Base Class.
81 class OSG_SYSTEM_DLLMAPPING ShaderProgramChunkBase
: public StateChunk
85 typedef StateChunk Inherited
;
86 typedef StateChunk ParentContainer
;
88 typedef Inherited::TypeObject TypeObject
;
89 typedef TypeObject::InitPhase InitPhase
;
91 OSG_GEN_INTERNALPTR(ShaderProgramChunk
);
93 /*========================== PUBLIC =================================*/
99 VertexShaderFieldId
= Inherited::NextFieldId
,
100 TessControlShaderFieldId
= VertexShaderFieldId
+ 1,
101 TessEvaluationShaderFieldId
= TessControlShaderFieldId
+ 1,
102 GeometryShaderFieldId
= TessEvaluationShaderFieldId
+ 1,
103 FragmentShaderFieldId
= GeometryShaderFieldId
+ 1,
104 GeometryVerticesOutFieldId
= FragmentShaderFieldId
+ 1,
105 GeometryInputTypeFieldId
= GeometryVerticesOutFieldId
+ 1,
106 GeometryOutputTypeFieldId
= GeometryInputTypeFieldId
+ 1,
107 NextFieldId
= GeometryOutputTypeFieldId
+ 1
110 static const OSG::BitVector VertexShaderFieldMask
=
111 (TypeTraits
<BitVector
>::One
<< VertexShaderFieldId
);
112 static const OSG::BitVector TessControlShaderFieldMask
=
113 (TypeTraits
<BitVector
>::One
<< TessControlShaderFieldId
);
114 static const OSG::BitVector TessEvaluationShaderFieldMask
=
115 (TypeTraits
<BitVector
>::One
<< TessEvaluationShaderFieldId
);
116 static const OSG::BitVector GeometryShaderFieldMask
=
117 (TypeTraits
<BitVector
>::One
<< GeometryShaderFieldId
);
118 static const OSG::BitVector FragmentShaderFieldMask
=
119 (TypeTraits
<BitVector
>::One
<< FragmentShaderFieldId
);
120 static const OSG::BitVector GeometryVerticesOutFieldMask
=
121 (TypeTraits
<BitVector
>::One
<< GeometryVerticesOutFieldId
);
122 static const OSG::BitVector GeometryInputTypeFieldMask
=
123 (TypeTraits
<BitVector
>::One
<< GeometryInputTypeFieldId
);
124 static const OSG::BitVector GeometryOutputTypeFieldMask
=
125 (TypeTraits
<BitVector
>::One
<< GeometryOutputTypeFieldId
);
126 static const OSG::BitVector NextFieldMask
=
127 (TypeTraits
<BitVector
>::One
<< NextFieldId
);
129 typedef MFUnrecShaderProgramPtr MFVertexShaderType
;
130 typedef MFUnrecShaderProgramPtr MFTessControlShaderType
;
131 typedef MFUnrecShaderProgramPtr MFTessEvaluationShaderType
;
132 typedef MFUnrecShaderProgramPtr MFGeometryShaderType
;
133 typedef MFUnrecShaderProgramPtr MFFragmentShaderType
;
134 typedef SFUInt32 SFGeometryVerticesOutType
;
135 typedef SFGLenum SFGeometryInputTypeType
;
136 typedef SFGLenum SFGeometryOutputTypeType
;
138 /*---------------------------------------------------------------------*/
139 /*! \name Class Get */
142 static FieldContainerType
&getClassType (void);
143 static UInt32
getClassTypeId (void);
144 static UInt16
getClassGroupId(void);
147 /*---------------------------------------------------------------------*/
148 /*! \name FieldContainer Get */
151 virtual FieldContainerType
&getType (void);
152 virtual const FieldContainerType
&getType (void) const;
154 virtual UInt32
getContainerSize(void) const;
157 /*---------------------------------------------------------------------*/
158 /*! \name Field Get */
161 const MFUnrecShaderProgramPtr
*getMFVertexShader (void) const;
162 MFUnrecShaderProgramPtr
*editMFVertexShader (void);
163 const MFUnrecShaderProgramPtr
*getMFTessControlShader(void) const;
164 MFUnrecShaderProgramPtr
*editMFTessControlShader(void);
165 const MFUnrecShaderProgramPtr
*getMFTessEvaluationShader(void) const;
166 MFUnrecShaderProgramPtr
*editMFTessEvaluationShader(void);
167 const MFUnrecShaderProgramPtr
*getMFGeometryShader (void) const;
168 MFUnrecShaderProgramPtr
*editMFGeometryShader (void);
169 const MFUnrecShaderProgramPtr
*getMFFragmentShader (void) const;
170 MFUnrecShaderProgramPtr
*editMFFragmentShader (void);
172 SFUInt32
*editSFGeometryVerticesOut(void);
173 const SFUInt32
*getSFGeometryVerticesOut (void) const;
175 SFGLenum
*editSFGeometryInputType(void);
176 const SFGLenum
*getSFGeometryInputType (void) const;
178 SFGLenum
*editSFGeometryOutputType(void);
179 const SFGLenum
*getSFGeometryOutputType (void) const;
182 ShaderProgram
* getVertexShader (const UInt32 index
) const;
184 ShaderProgram
* getTessControlShader(const UInt32 index
) const;
186 ShaderProgram
* getTessEvaluationShader(const UInt32 index
) const;
188 ShaderProgram
* getGeometryShader (const UInt32 index
) const;
190 ShaderProgram
* getFragmentShader (const UInt32 index
) const;
192 UInt32
&editGeometryVerticesOut(void);
193 UInt32
getGeometryVerticesOut (void) const;
195 GLenum
&editGeometryInputType(void);
196 const GLenum
&getGeometryInputType (void) const;
198 GLenum
&editGeometryOutputType(void);
199 const GLenum
&getGeometryOutputType (void) const;
202 /*---------------------------------------------------------------------*/
203 /*! \name Field Set */
206 void setGeometryVerticesOut(const UInt32 value
);
207 void setGeometryInputType(const GLenum
&value
);
208 void setGeometryOutputType(const GLenum
&value
);
211 /*---------------------------------------------------------------------*/
212 /*! \name Ptr Field Set */
216 /*---------------------------------------------------------------------*/
217 /*! \name Ptr MField Set */
220 void addVertexShader (ShaderProgram
* const value
);
221 void assignVertexShader (const MFUnrecShaderProgramPtr
&value
);
222 void subVertexShader (UInt32 uiIndex
);
223 void removeObjFromVertexShader(ShaderProgram
* const value
);
224 void clearVertexShaders (void );
226 void addTessControlShader (ShaderProgram
* const value
);
227 void assignTessControlShader (const MFUnrecShaderProgramPtr
&value
);
228 void subTessControlShader (UInt32 uiIndex
);
229 void removeObjFromTessControlShader(ShaderProgram
* const value
);
230 void clearTessControlShaders (void );
232 void addTessEvaluationShader (ShaderProgram
* const value
);
233 void assignTessEvaluationShader (const MFUnrecShaderProgramPtr
&value
);
234 void subTessEvaluationShader (UInt32 uiIndex
);
235 void removeObjFromTessEvaluationShader(ShaderProgram
* const value
);
236 void clearTessEvaluationShaders (void );
238 void addGeometryShader (ShaderProgram
* const value
);
239 void assignGeometryShader (const MFUnrecShaderProgramPtr
&value
);
240 void subGeometryShader (UInt32 uiIndex
);
241 void removeObjFromGeometryShader(ShaderProgram
* const value
);
242 void clearGeometryShaders (void );
244 void addFragmentShader (ShaderProgram
* const value
);
245 void assignFragmentShader (const MFUnrecShaderProgramPtr
&value
);
246 void subFragmentShader (UInt32 uiIndex
);
247 void removeObjFromFragmentShader(ShaderProgram
* const value
);
248 void clearFragmentShaders (void );
251 /*---------------------------------------------------------------------*/
252 /*! \name Binary Access */
255 virtual SizeT
getBinSize (ConstFieldMaskArg whichField
);
256 virtual void copyToBin (BinaryDataHandler
&pMem
,
257 ConstFieldMaskArg whichField
);
258 virtual void copyFromBin(BinaryDataHandler
&pMem
,
259 ConstFieldMaskArg whichField
);
263 /*---------------------------------------------------------------------*/
264 /*! \name Construction */
267 static ShaderProgramChunkTransitPtr
create (void);
268 static ShaderProgramChunk
*createEmpty (void);
270 static ShaderProgramChunkTransitPtr
createLocal (
271 BitVector bFlags
= FCLocal::All
);
273 static ShaderProgramChunk
*createEmptyLocal(
274 BitVector bFlags
= FCLocal::All
);
276 static ShaderProgramChunkTransitPtr
createDependent (BitVector bFlags
);
279 /*---------------------------------------------------------------------*/
283 virtual FieldContainerTransitPtr
shallowCopy (void) const;
284 virtual FieldContainerTransitPtr
shallowCopyLocal(
285 BitVector bFlags
= FCLocal::All
) const;
286 virtual FieldContainerTransitPtr
shallowCopyDependent(
287 BitVector bFlags
) const;
290 /*========================= PROTECTED ===============================*/
294 static TypeObject _type
;
296 static void classDescInserter(TypeObject
&oType
);
297 static const Char8
*getClassname (void );
299 /*---------------------------------------------------------------------*/
303 MFUnrecShaderProgramPtr _mfVertexShader
;
304 MFUnrecShaderProgramPtr _mfTessControlShader
;
305 MFUnrecShaderProgramPtr _mfTessEvaluationShader
;
306 MFUnrecShaderProgramPtr _mfGeometryShader
;
307 MFUnrecShaderProgramPtr _mfFragmentShader
;
308 SFUInt32 _sfGeometryVerticesOut
;
309 SFGLenum _sfGeometryInputType
;
310 SFGLenum _sfGeometryOutputType
;
313 /*---------------------------------------------------------------------*/
314 /*! \name Constructors */
317 ShaderProgramChunkBase(void);
318 ShaderProgramChunkBase(const ShaderProgramChunkBase
&source
);
321 /*---------------------------------------------------------------------*/
322 /*! \name Destructors */
325 virtual ~ShaderProgramChunkBase(void);
328 /*---------------------------------------------------------------------*/
329 /*! \name onCreate */
332 void onCreate(const ShaderProgramChunk
*source
= NULL
);
335 /*---------------------------------------------------------------------*/
336 /*! \name Generic Field Access */
339 GetFieldHandlePtr
getHandleVertexShader (void) const;
340 EditFieldHandlePtr
editHandleVertexShader (void);
341 GetFieldHandlePtr
getHandleTessControlShader (void) const;
342 EditFieldHandlePtr
editHandleTessControlShader(void);
343 GetFieldHandlePtr
getHandleTessEvaluationShader (void) const;
344 EditFieldHandlePtr
editHandleTessEvaluationShader(void);
345 GetFieldHandlePtr
getHandleGeometryShader (void) const;
346 EditFieldHandlePtr
editHandleGeometryShader (void);
347 GetFieldHandlePtr
getHandleFragmentShader (void) const;
348 EditFieldHandlePtr
editHandleFragmentShader (void);
349 GetFieldHandlePtr
getHandleGeometryVerticesOut (void) const;
350 EditFieldHandlePtr
editHandleGeometryVerticesOut(void);
351 GetFieldHandlePtr
getHandleGeometryInputType (void) const;
352 EditFieldHandlePtr
editHandleGeometryInputType(void);
353 GetFieldHandlePtr
getHandleGeometryOutputType (void) const;
354 EditFieldHandlePtr
editHandleGeometryOutputType(void);
357 /*---------------------------------------------------------------------*/
361 #ifdef OSG_MT_CPTR_ASPECT
362 virtual void execSyncV( FieldContainer
&oFrom
,
363 ConstFieldMaskArg whichField
,
364 AspectOffsetStore
&oOffsets
,
365 ConstFieldMaskArg syncMode
,
366 const UInt32 uiSyncInfo
);
368 void execSync ( ShaderProgramChunkBase
*pFrom
,
369 ConstFieldMaskArg whichField
,
370 AspectOffsetStore
&oOffsets
,
371 ConstFieldMaskArg syncMode
,
372 const UInt32 uiSyncInfo
);
376 /*---------------------------------------------------------------------*/
381 /*---------------------------------------------------------------------*/
382 /*! \name Aspect Create */
385 #ifdef OSG_MT_CPTR_ASPECT
386 virtual FieldContainer
*createAspectCopy(
387 const FieldContainer
*pRefAspect
) const;
391 /*---------------------------------------------------------------------*/
395 /*---------------------------------------------------------------------*/
399 virtual void resolveLinks(void);
402 /*========================== PRIVATE ================================*/
405 /*---------------------------------------------------------------------*/
407 // prohibit default functions (move to 'public' if you need one)
408 void operator =(const ShaderProgramChunkBase
&source
);
411 typedef ShaderProgramChunkBase
*ShaderProgramChunkBaseP
;
415 #endif /* _OSGSHADERPROGRAMCHUNKBASE_H_ */