fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / Contrib / ComputeBase / ComputeShader / OSGComputeShaderChunkBase.h
blob6581697090580e3b43560a9711665e18836f84ab
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 ComputeShaderChunk
49 ** **
50 *****************************************************************************
51 \*****************************************************************************/
54 #ifndef _OSGCOMPUTESHADERCHUNKBASE_H_
55 #define _OSGCOMPUTESHADERCHUNKBASE_H_
56 #ifdef __sgi
57 #pragma once
58 #endif
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"
75 OSG_BEGIN_NAMESPACE
78 class ComputeShaderChunk;
80 //! \brief ComputeShaderChunk Base Class.
82 class OSG_CONTRIBCOMPUTEBASE_DLLMAPPING ComputeShaderChunkBase : public StateChunk
84 public:
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 =================================*/
96 public:
98 enum
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 */
133 /*! \{ */
135 static FieldContainerType &getClassType (void);
136 static UInt32 getClassTypeId (void);
137 static UInt16 getClassGroupId(void);
139 /*! \} */
140 /*---------------------------------------------------------------------*/
141 /*! \name FieldContainer Get */
142 /*! \{ */
144 virtual FieldContainerType &getType (void);
145 virtual const FieldContainerType &getType (void) const;
147 virtual UInt32 getContainerSize(void) const;
149 /*! \} */
150 /*---------------------------------------------------------------------*/
151 /*! \name Field Get */
152 /*! \{ */
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;
176 /*! \} */
177 /*---------------------------------------------------------------------*/
178 /*! \name Field Set */
179 /*! \{ */
181 void setComputeProgram (const std::string &value);
182 void setVariables (ShaderProgramVariables * const value);
183 void setGLId (const UInt32 value);
185 /*! \} */
186 /*---------------------------------------------------------------------*/
187 /*! \name Ptr Field Set */
188 /*! \{ */
190 /*! \} */
191 /*---------------------------------------------------------------------*/
192 /*! \name Ptr MField Set */
193 /*! \{ */
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 );
201 /*! \} */
202 /*---------------------------------------------------------------------*/
203 /*! \name Binary Access */
204 /*! \{ */
206 virtual SizeT getBinSize (ConstFieldMaskArg whichField);
207 virtual void copyToBin (BinaryDataHandler &pMem,
208 ConstFieldMaskArg whichField);
209 virtual void copyFromBin(BinaryDataHandler &pMem,
210 ConstFieldMaskArg whichField);
213 /*! \} */
214 /*---------------------------------------------------------------------*/
215 /*! \name Construction */
216 /*! \{ */
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);
229 /*! \} */
230 /*---------------------------------------------------------------------*/
231 /*! \name Copy */
232 /*! \{ */
234 virtual FieldContainerTransitPtr shallowCopy (void) const;
235 virtual FieldContainerTransitPtr shallowCopyLocal(
236 BitVector bFlags = FCLocal::All) const;
237 virtual FieldContainerTransitPtr shallowCopyDependent(
238 BitVector bFlags) const;
240 /*! \} */
241 /*========================= PROTECTED ===============================*/
243 protected:
245 static TypeObject _type;
247 static void classDescInserter(TypeObject &oType);
248 static const Char8 *getClassname (void );
250 /*---------------------------------------------------------------------*/
251 /*! \name Fields */
252 /*! \{ */
254 MFUnrecShaderProgramPtr _mfComputeShader;
255 SFString _sfComputeProgram;
256 SFUnrecChildShaderProgramVariablesPtr _sfVariables;
257 MFInt32 _mfVariableLocations;
258 MFInt32 _mfProceduralVariableLocations;
259 SFUInt32 _sfGLId;
261 /*! \} */
262 /*---------------------------------------------------------------------*/
263 /*! \name Constructors */
264 /*! \{ */
266 ComputeShaderChunkBase(void);
267 ComputeShaderChunkBase(const ComputeShaderChunkBase &source);
269 /*! \} */
270 /*---------------------------------------------------------------------*/
271 /*! \name Destructors */
272 /*! \{ */
274 virtual ~ComputeShaderChunkBase(void);
276 /*! \} */
277 /*---------------------------------------------------------------------*/
278 /*! \name onCreate */
279 /*! \{ */
281 void onCreate(const ComputeShaderChunk *source = NULL);
283 /*! \} */
284 /*---------------------------------------------------------------------*/
285 /*! \name Child linking */
286 /*! \{ */
288 virtual bool unlinkChild(FieldContainer * const pChild,
289 UInt16 const childFieldId);
291 /*! \} */
292 /*---------------------------------------------------------------------*/
293 /*! \name Generic Field Access */
294 /*! \{ */
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);
309 /*! \} */
310 /*---------------------------------------------------------------------*/
311 /*! \name Field Get */
312 /*! \{ */
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;
328 /*! \} */
329 /*---------------------------------------------------------------------*/
330 /*! \name Field Set */
331 /*! \{ */
334 /*! \} */
335 /*---------------------------------------------------------------------*/
336 /*! \name Ptr MField Set */
337 /*! \{ */
339 /*! \} */
340 /*---------------------------------------------------------------------*/
341 /*! \name Sync */
342 /*! \{ */
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);
356 #endif
358 /*! \} */
359 /*---------------------------------------------------------------------*/
360 /*! \name Edit */
361 /*! \{ */
363 /*! \} */
364 /*---------------------------------------------------------------------*/
365 /*! \name Aspect Create */
366 /*! \{ */
368 #ifdef OSG_MT_CPTR_ASPECT
369 virtual FieldContainer *createAspectCopy(
370 const FieldContainer *pRefAspect) const;
371 #endif
373 /*! \} */
374 /*---------------------------------------------------------------------*/
375 /*! \name Edit */
376 /*! \{ */
377 /*! \} */
378 /*---------------------------------------------------------------------*/
379 /*! \name Sync */
380 /*! \{ */
382 virtual void resolveLinks(void);
384 /*! \} */
385 /*========================== PRIVATE ================================*/
387 private:
388 /*---------------------------------------------------------------------*/
390 // prohibit default functions (move to 'public' if you need one)
391 void operator =(const ComputeShaderChunkBase &source);
394 typedef ComputeShaderChunkBase *ComputeShaderChunkBaseP;
396 OSG_END_NAMESPACE
398 #endif /* _OSGCOMPUTESHADERCHUNKBASE_H_ */