fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / State / Shader / Chunks / OSGShaderExecutableChunkBase.h
blobf56b2fa8efb35f7ce47a544dd43f13f8058d3e24
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 ShaderExecutableChunk
49 ** **
50 *****************************************************************************
51 \*****************************************************************************/
54 #ifndef _OSGSHADEREXECUTABLECHUNKBASE_H_
55 #define _OSGSHADEREXECUTABLECHUNKBASE_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 "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"
76 OSG_BEGIN_NAMESPACE
79 class ShaderExecutableChunk;
81 //! \brief ShaderExecutableChunk Base Class.
83 class OSG_SYSTEM_DLLMAPPING ShaderExecutableChunkBase : public StateChunk
85 public:
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 =================================*/
97 public:
99 enum
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 */
166 /*! \{ */
168 static FieldContainerType &getClassType (void);
169 static UInt32 getClassTypeId (void);
170 static UInt16 getClassGroupId(void);
172 /*! \} */
173 /*---------------------------------------------------------------------*/
174 /*! \name FieldContainer Get */
175 /*! \{ */
177 virtual FieldContainerType &getType (void);
178 virtual const FieldContainerType &getType (void) const;
180 virtual UInt32 getContainerSize(void) const;
182 /*! \} */
183 /*---------------------------------------------------------------------*/
184 /*! \name Field Get */
185 /*! \{ */
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;
229 /*! \} */
230 /*---------------------------------------------------------------------*/
231 /*! \name Field Set */
232 /*! \{ */
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);
241 /*! \} */
242 /*---------------------------------------------------------------------*/
243 /*! \name Ptr Field Set */
244 /*! \{ */
246 /*! \} */
247 /*---------------------------------------------------------------------*/
248 /*! \name Ptr MField Set */
249 /*! \{ */
251 /*! \} */
252 /*---------------------------------------------------------------------*/
253 /*! \name Binary Access */
254 /*! \{ */
256 virtual SizeT getBinSize (ConstFieldMaskArg whichField);
257 virtual void copyToBin (BinaryDataHandler &pMem,
258 ConstFieldMaskArg whichField);
259 virtual void copyFromBin(BinaryDataHandler &pMem,
260 ConstFieldMaskArg whichField);
263 /*! \} */
264 /*---------------------------------------------------------------------*/
265 /*! \name Construction */
266 /*! \{ */
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);
279 /*! \} */
280 /*---------------------------------------------------------------------*/
281 /*! \name Copy */
282 /*! \{ */
284 virtual FieldContainerTransitPtr shallowCopy (void) const;
285 virtual FieldContainerTransitPtr shallowCopyLocal(
286 BitVector bFlags = FCLocal::All) const;
287 virtual FieldContainerTransitPtr shallowCopyDependent(
288 BitVector bFlags) const;
290 /*! \} */
291 /*========================= PROTECTED ===============================*/
293 protected:
295 static TypeObject _type;
297 static void classDescInserter(TypeObject &oType);
298 static const Char8 *getClassname (void );
300 /*---------------------------------------------------------------------*/
301 /*! \name Fields */
302 /*! \{ */
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;
316 SFUInt32 _sfGLId;
317 SFBool _sfPointSize;
319 /*! \} */
320 /*---------------------------------------------------------------------*/
321 /*! \name Constructors */
322 /*! \{ */
324 ShaderExecutableChunkBase(void);
325 ShaderExecutableChunkBase(const ShaderExecutableChunkBase &source);
327 /*! \} */
328 /*---------------------------------------------------------------------*/
329 /*! \name Destructors */
330 /*! \{ */
332 virtual ~ShaderExecutableChunkBase(void);
334 /*! \} */
335 /*---------------------------------------------------------------------*/
336 /*! \name onCreate */
337 /*! \{ */
339 void onCreate(const ShaderExecutableChunk *source = NULL);
341 /*! \} */
342 /*---------------------------------------------------------------------*/
343 /*! \name Child linking */
344 /*! \{ */
346 virtual bool unlinkChild(FieldContainer * const pChild,
347 UInt16 const childFieldId);
349 /*! \} */
350 /*---------------------------------------------------------------------*/
351 /*! \name Generic Field Access */
352 /*! \{ */
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);
383 /*! \} */
384 /*---------------------------------------------------------------------*/
385 /*! \name Field Get */
386 /*! \{ */
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;
402 /*! \} */
403 /*---------------------------------------------------------------------*/
404 /*! \name Field Set */
405 /*! \{ */
408 /*! \} */
409 /*---------------------------------------------------------------------*/
410 /*! \name Ptr MField Set */
411 /*! \{ */
413 /*! \} */
414 /*---------------------------------------------------------------------*/
415 /*! \name Sync */
416 /*! \{ */
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);
430 #endif
432 /*! \} */
433 /*---------------------------------------------------------------------*/
434 /*! \name Edit */
435 /*! \{ */
437 /*! \} */
438 /*---------------------------------------------------------------------*/
439 /*! \name Aspect Create */
440 /*! \{ */
442 #ifdef OSG_MT_CPTR_ASPECT
443 virtual FieldContainer *createAspectCopy(
444 const FieldContainer *pRefAspect) const;
445 #endif
447 /*! \} */
448 /*---------------------------------------------------------------------*/
449 /*! \name Edit */
450 /*! \{ */
451 /*! \} */
452 /*---------------------------------------------------------------------*/
453 /*! \name Sync */
454 /*! \{ */
456 virtual void resolveLinks(void);
458 /*! \} */
459 /*========================== PRIVATE ================================*/
461 private:
462 /*---------------------------------------------------------------------*/
464 // prohibit default functions (move to 'public' if you need one)
465 void operator =(const ShaderExecutableChunkBase &source);
468 typedef ShaderExecutableChunkBase *ShaderExecutableChunkBaseP;
470 OSG_END_NAMESPACE
472 #endif /* _OSGSHADEREXECUTABLECHUNKBASE_H_ */