fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / State / Shader / SHL / OSGSimpleSHLVariableChunk.h
blob43764809388e323c18aa479e30ee1895d12a3f45
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2006 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
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 #ifndef _OSGSIMPLESHLVARIABLECHUNK_H_
40 #define _OSGSIMPLESHLVARIABLECHUNK_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGSimpleSHLVariableChunkBase.h"
46 #include "OSGShaderExecutableVarChunk.h"
48 OSG_BEGIN_NAMESPACE
50 /*! \brief SimpleSHLVariableChunk class. See \ref
51 PageStateSimpleSHLVariableChunk for a description.
52 \ingroup GrpSystemShaderSHLChunk
53 \ingroup GrpLibOSGSystem
54 \includebasedoc
57 class OSG_SYSTEM_DLLMAPPING SimpleSHLVariableChunk :
58 public SimpleSHLVariableChunkBase
60 protected:
62 /*========================== PUBLIC =================================*/
64 public:
66 typedef SimpleSHLVariableChunkBase Inherited;
67 typedef SimpleSHLVariableChunk Self;
69 /*---------------------------------------------------------------------*/
70 /*! \name Chunk Class Access */
71 /*! \{ */
73 virtual const StateChunkClass *getClass(void) const;
75 /*! \} */
76 /*---------------------------------------------------------------------*/
77 /*! \name Static Chunk Class Access */
78 /*! \{ */
80 static UInt32 getStaticClassId(void);
81 static const StateChunkClass *getStaticClass (void);
83 /*! \} */
84 /*---------------------------------------------------------------------*/
85 /*! \name Chunk Id */
86 /*! \{ */
88 virtual UInt16 getChunkId(void);
90 /*! \} */
91 /*---------------------------------------------------------------------*/
92 /*! \name Sync */
93 /*! \{ */
95 virtual void changed(ConstFieldMaskArg whichField,
96 UInt32 origin,
97 BitVector details );
99 /*! \} */
100 /*---------------------------------------------------------------------*/
101 /*! \name Output */
102 /*! \{ */
104 #ifdef OSG_1_COMPAT
105 void setSHLChunk(SimpleSHLChunk *) {}
106 #endif
108 /*! \} */
109 /*---------------------------------------------------------------------*/
110 /*! \name Output */
111 /*! \{ */
113 #ifdef OSG_1_COMPAT
114 template<class ValueT>
115 bool setUniformParameter (const Char8 *name, const ValueT &value);
116 #endif
118 template<class ValueT>
119 bool addUniformVariable (const Char8 *name, const ValueT &value);
121 template<class ValueT>
122 bool updateUniformVariable (const Char8 *name, const ValueT &value);
124 template<class ValueT>
125 bool getUniformVariable (const Char8 *name, ValueT &value);
127 bool subUniformVariable (const Char8 *name );
128 void clearUniformVariables ( void );
130 /*! \} */
131 /*---------------------------------------------------------------------*/
132 /*! \name Init */
133 /*! \{ */
135 virtual void activate (DrawEnv*, UInt32 index = 0);
136 virtual void changeFrom(DrawEnv*, StateChunk*, UInt32 index = 0);
137 virtual void deactivate(DrawEnv*, UInt32 index = 0);
139 /*! \} */
140 /*---------------------------------------------------------------------*/
141 /*! \name Output */
142 /*! \{ */
144 virtual void dump( UInt32 uiIndent = 0,
145 const BitVector bvFlags = 0) const;
147 /*! \} */
148 /*========================= PROTECTED ===============================*/
150 protected:
152 /*---------------------------------------------------------------------*/
154 #if 0
155 static volatile UInt16 _uiChunkCounter;
156 #endif
158 UInt16 _uiChunkId;
160 // Variables should all be in SimpleSHLVariableChunkBase.
162 /*---------------------------------------------------------------------*/
163 /*! \name Init */
164 /*! \{ */
166 void onCreate (const SimpleSHLVariableChunk *source = NULL);
167 void onCreateAspect(const SimpleSHLVariableChunk *createAspect,
168 const SimpleSHLVariableChunk *source = NULL);
170 /*! \} */
171 /*---------------------------------------------------------------------*/
172 /*! \name Constructors */
173 /*! \{ */
175 SimpleSHLVariableChunk(void);
176 SimpleSHLVariableChunk(const SimpleSHLVariableChunk &source);
178 /*! \} */
179 /*---------------------------------------------------------------------*/
180 /*! \name Destructors */
181 /*! \{ */
183 virtual ~SimpleSHLVariableChunk(void);
185 /*! \} */
186 /*---------------------------------------------------------------------*/
187 /*! \name Init */
188 /*! \{ */
190 static void initMethod(InitPhase ePhase);
192 /*! \} */
193 /*---------------------------------------------------------------------*/
194 /*! \name Init */
195 /*! \{ */
197 void updateVariables(DrawEnv *pEnv);
199 /*! \} */
200 /*========================== PRIVATE ================================*/
202 private:
204 friend class FieldContainer;
205 friend class SimpleSHLVariableChunkBase;
207 // prohibit default functions (move to 'public' if you need one)
208 void operator =(const SimpleSHLVariableChunk &source);
211 typedef SimpleSHLVariableChunk *SimpleSHLVariableChunkP;
213 OSG_END_NAMESPACE
215 #include "OSGSimpleSHLVariableChunkBase.inl"
216 #include "OSGSimpleSHLVariableChunk.inl"
218 #endif /* _OSGSIMPLESHLVARIABLECHUNK_H_ */