fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / State / Shader / Chunks / OSGShaderProgramChunkBase.h
blob3eb65558961326563e5774213dc81fccba9daf22
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
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. *
18 * *
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. *
23 * *
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. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 /*****************************************************************************\
40 *****************************************************************************
41 ** **
42 ** This file is automatically generated. **
43 ** **
44 ** Any changes made to this file WILL be lost when it is **
45 ** regenerated, which can become necessary at any time. **
46 ** **
47 ** Do not change this file, changes should be done in the derived **
48 ** class ShaderProgramChunk
49 ** **
50 *****************************************************************************
51 \*****************************************************************************/
54 #ifndef _OSGSHADERPROGRAMCHUNKBASE_H_
55 #define _OSGSHADERPROGRAMCHUNKBASE_H_
56 #ifdef __sgi
57 #pragma once
58 #endif
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"
74 OSG_BEGIN_NAMESPACE
77 class ShaderProgramChunk;
79 //! \brief ShaderProgramChunk Base Class.
81 class OSG_SYSTEM_DLLMAPPING ShaderProgramChunkBase : public StateChunk
83 public:
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 =================================*/
95 public:
97 enum
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 */
140 /*! \{ */
142 static FieldContainerType &getClassType (void);
143 static UInt32 getClassTypeId (void);
144 static UInt16 getClassGroupId(void);
146 /*! \} */
147 /*---------------------------------------------------------------------*/
148 /*! \name FieldContainer Get */
149 /*! \{ */
151 virtual FieldContainerType &getType (void);
152 virtual const FieldContainerType &getType (void) const;
154 virtual UInt32 getContainerSize(void) const;
156 /*! \} */
157 /*---------------------------------------------------------------------*/
158 /*! \name Field Get */
159 /*! \{ */
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;
201 /*! \} */
202 /*---------------------------------------------------------------------*/
203 /*! \name Field Set */
204 /*! \{ */
206 void setGeometryVerticesOut(const UInt32 value);
207 void setGeometryInputType(const GLenum &value);
208 void setGeometryOutputType(const GLenum &value);
210 /*! \} */
211 /*---------------------------------------------------------------------*/
212 /*! \name Ptr Field Set */
213 /*! \{ */
215 /*! \} */
216 /*---------------------------------------------------------------------*/
217 /*! \name Ptr MField Set */
218 /*! \{ */
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 );
250 /*! \} */
251 /*---------------------------------------------------------------------*/
252 /*! \name Binary Access */
253 /*! \{ */
255 virtual SizeT getBinSize (ConstFieldMaskArg whichField);
256 virtual void copyToBin (BinaryDataHandler &pMem,
257 ConstFieldMaskArg whichField);
258 virtual void copyFromBin(BinaryDataHandler &pMem,
259 ConstFieldMaskArg whichField);
262 /*! \} */
263 /*---------------------------------------------------------------------*/
264 /*! \name Construction */
265 /*! \{ */
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);
278 /*! \} */
279 /*---------------------------------------------------------------------*/
280 /*! \name Copy */
281 /*! \{ */
283 virtual FieldContainerTransitPtr shallowCopy (void) const;
284 virtual FieldContainerTransitPtr shallowCopyLocal(
285 BitVector bFlags = FCLocal::All) const;
286 virtual FieldContainerTransitPtr shallowCopyDependent(
287 BitVector bFlags) const;
289 /*! \} */
290 /*========================= PROTECTED ===============================*/
292 protected:
294 static TypeObject _type;
296 static void classDescInserter(TypeObject &oType);
297 static const Char8 *getClassname (void );
299 /*---------------------------------------------------------------------*/
300 /*! \name Fields */
301 /*! \{ */
303 MFUnrecShaderProgramPtr _mfVertexShader;
304 MFUnrecShaderProgramPtr _mfTessControlShader;
305 MFUnrecShaderProgramPtr _mfTessEvaluationShader;
306 MFUnrecShaderProgramPtr _mfGeometryShader;
307 MFUnrecShaderProgramPtr _mfFragmentShader;
308 SFUInt32 _sfGeometryVerticesOut;
309 SFGLenum _sfGeometryInputType;
310 SFGLenum _sfGeometryOutputType;
312 /*! \} */
313 /*---------------------------------------------------------------------*/
314 /*! \name Constructors */
315 /*! \{ */
317 ShaderProgramChunkBase(void);
318 ShaderProgramChunkBase(const ShaderProgramChunkBase &source);
320 /*! \} */
321 /*---------------------------------------------------------------------*/
322 /*! \name Destructors */
323 /*! \{ */
325 virtual ~ShaderProgramChunkBase(void);
327 /*! \} */
328 /*---------------------------------------------------------------------*/
329 /*! \name onCreate */
330 /*! \{ */
332 void onCreate(const ShaderProgramChunk *source = NULL);
334 /*! \} */
335 /*---------------------------------------------------------------------*/
336 /*! \name Generic Field Access */
337 /*! \{ */
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);
356 /*! \} */
357 /*---------------------------------------------------------------------*/
358 /*! \name Sync */
359 /*! \{ */
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);
373 #endif
375 /*! \} */
376 /*---------------------------------------------------------------------*/
377 /*! \name Edit */
378 /*! \{ */
380 /*! \} */
381 /*---------------------------------------------------------------------*/
382 /*! \name Aspect Create */
383 /*! \{ */
385 #ifdef OSG_MT_CPTR_ASPECT
386 virtual FieldContainer *createAspectCopy(
387 const FieldContainer *pRefAspect) const;
388 #endif
390 /*! \} */
391 /*---------------------------------------------------------------------*/
392 /*! \name Edit */
393 /*! \{ */
394 /*! \} */
395 /*---------------------------------------------------------------------*/
396 /*! \name Sync */
397 /*! \{ */
399 virtual void resolveLinks(void);
401 /*! \} */
402 /*========================== PRIVATE ================================*/
404 private:
405 /*---------------------------------------------------------------------*/
407 // prohibit default functions (move to 'public' if you need one)
408 void operator =(const ShaderProgramChunkBase &source);
411 typedef ShaderProgramChunkBase *ShaderProgramChunkBaseP;
413 OSG_END_NAMESPACE
415 #endif /* _OSGSHADERPROGRAMCHUNKBASE_H_ */