1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2006 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
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 #ifndef _OSGSIMPLESHLVARIABLECHUNK_H_
40 #define _OSGSIMPLESHLVARIABLECHUNK_H_
45 #include "OSGSimpleSHLVariableChunkBase.h"
46 #include "OSGShaderExecutableVarChunk.h"
50 /*! \brief SimpleSHLVariableChunk class. See \ref
51 PageStateSimpleSHLVariableChunk for a description.
52 \ingroup GrpSystemShaderSHLChunk
53 \ingroup GrpLibOSGSystem
57 class OSG_SYSTEM_DLLMAPPING SimpleSHLVariableChunk
:
58 public SimpleSHLVariableChunkBase
62 /*========================== PUBLIC =================================*/
66 typedef SimpleSHLVariableChunkBase Inherited
;
67 typedef SimpleSHLVariableChunk Self
;
69 /*---------------------------------------------------------------------*/
70 /*! \name Chunk Class Access */
73 virtual const StateChunkClass
*getClass(void) const;
76 /*---------------------------------------------------------------------*/
77 /*! \name Static Chunk Class Access */
80 static UInt32
getStaticClassId(void);
81 static const StateChunkClass
*getStaticClass (void);
84 /*---------------------------------------------------------------------*/
88 virtual UInt16
getChunkId(void);
91 /*---------------------------------------------------------------------*/
95 virtual void changed(ConstFieldMaskArg whichField
,
100 /*---------------------------------------------------------------------*/
105 void setSHLChunk(SimpleSHLChunk
*) {}
109 /*---------------------------------------------------------------------*/
114 template<class ValueT
>
115 bool setUniformParameter (const Char8
*name
, const ValueT
&value
);
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 );
131 /*---------------------------------------------------------------------*/
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);
140 /*---------------------------------------------------------------------*/
144 virtual void dump( UInt32 uiIndent
= 0,
145 const BitVector bvFlags
= 0) const;
148 /*========================= PROTECTED ===============================*/
152 /*---------------------------------------------------------------------*/
155 static volatile UInt16 _uiChunkCounter
;
160 // Variables should all be in SimpleSHLVariableChunkBase.
162 /*---------------------------------------------------------------------*/
166 void onCreate (const SimpleSHLVariableChunk
*source
= NULL
);
167 void onCreateAspect(const SimpleSHLVariableChunk
*createAspect
,
168 const SimpleSHLVariableChunk
*source
= NULL
);
171 /*---------------------------------------------------------------------*/
172 /*! \name Constructors */
175 SimpleSHLVariableChunk(void);
176 SimpleSHLVariableChunk(const SimpleSHLVariableChunk
&source
);
179 /*---------------------------------------------------------------------*/
180 /*! \name Destructors */
183 virtual ~SimpleSHLVariableChunk(void);
186 /*---------------------------------------------------------------------*/
190 static void initMethod(InitPhase ePhase
);
193 /*---------------------------------------------------------------------*/
197 void updateVariables(DrawEnv
*pEnv
);
200 /*========================== 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
;
215 #include "OSGSimpleSHLVariableChunkBase.inl"
216 #include "OSGSimpleSHLVariableChunk.inl"
218 #endif /* _OSGSIMPLESHLVARIABLECHUNK_H_ */