fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / State / Shader / Variables / OSGShaderVariableFunctor.h
blob8ace6f7675f343a72688d955b72b29cb27842b93
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2002 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 _OSGSHADERVARIABLEFUNCTOR_H_
40 #define _OSGSHADERVARIABLEFUNCTOR_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGShaderVariableFunctorBase.h"
46 #include "OSGDrawEnv.h"
48 #include "boost/function.hpp"
50 OSG_BEGIN_NAMESPACE
52 /*! \brief ShaderVariableFunctor class. See \ref
53 PageSystemShaderVariableFunctor for a description.
54 \ingroup GrpSystemShaderVariables
55 \ingroup GrpLibOSGSystem
56 \includebasedoc
59 class OSG_SYSTEM_DLLMAPPING ShaderVariableFunctor :
60 public ShaderVariableFunctorBase
62 private:
64 /*========================== PUBLIC =================================*/
66 public:
68 typedef ShaderVariableFunctorBase Inherited;
70 typedef GLint (OSG_APIENTRY *GetUniformLocProc)( GLuint programObj,
71 const Char8 *name );
73 typedef boost::function<void (DrawEnv *, Int32 )> ProcVarFunctor;
74 typedef boost::function<void (DrawEnv *, Int32, Node *)> ProcVarNodeFunctor;
76 #ifdef OSG_1_COMPAT
77 typedef boost::function<void (GetUniformLocProc ,
78 DrawEnv *,
79 GLuint )> ParamFunctor;
81 typedef boost::function<void (ShaderVariable * const,
82 DrawEnv * ,
83 GLuint )> OSGParamFunctor;
84 #endif
86 /*---------------------------------------------------------------------*/
87 /*! \name Sync */
88 /*! \{ */
90 virtual void changed(ConstFieldMaskArg whichField,
91 UInt32 origin,
92 BitVector details);
94 /*! \} */
95 /*---------------------------------------------------------------------*/
96 /*! \name Output */
97 /*! \{ */
99 virtual void dump( UInt32 uiIndent = 0,
100 const BitVector bvFlags = 0) const;
102 /*! \} */
103 /*---------------------------------------------------------------------*/
104 /*! \name Output */
105 /*! \{ */
107 void setFunctor (ProcVarFunctor pFunc );
108 void setFunctor (ProcVarNodeFunctor pFunc );
109 #ifdef OSG_1_COMPAT
110 void setFunctor (ParamFunctor pPFunc );
111 void setFunctor (OSGParamFunctor pOSGPFunc);
113 UInt32 getFuncMode(void );
114 #endif
116 /*! \} */
117 /*---------------------------------------------------------------------*/
118 /*! \name Output */
119 /*! \{ */
121 virtual bool isProcedural(void) const;
123 /*! \} */
124 /*---------------------------------------------------------------------*/
125 /*! \name Output */
126 /*! \{ */
128 void evaluate(DrawEnv *pEnv,
129 Int32 &iLocation);
131 #ifdef OSG_1_COMPAT
132 void evaluate(GetUniformLocProc getULoc,
133 DrawEnv *pEnv,
134 UInt32 uiProg );
136 void evaluate(ShaderVariable *pVar,
137 DrawEnv *pEnv,
138 UInt32 uiProg );
139 #endif
141 /*! \} */
142 /*========================= PROTECTED ===============================*/
144 protected:
146 #ifdef OSG_1_COMPAT
147 UInt32 _uiFuncMode;
149 ParamFunctor _pPFunc;
150 OSGParamFunctor _pOSGPFunc;
151 #endif
153 ProcVarFunctor _pFunc;
154 ProcVarNodeFunctor _pNodeFunc;
156 /*---------------------------------------------------------------------*/
157 /*! \name Constructors */
158 /*! \{ */
160 ShaderVariableFunctor(void);
161 ShaderVariableFunctor(const ShaderVariableFunctor &source);
163 /*! \} */
164 /*---------------------------------------------------------------------*/
165 /*! \name Destructors */
166 /*! \{ */
168 virtual ~ShaderVariableFunctor(void);
170 /*! \} */
171 /*---------------------------------------------------------------------*/
172 /*! \name Init */
173 /*! \{ */
175 static void initMethod(InitPhase ePhase);
177 /*! \} */
178 /*---------------------------------------------------------------------*/
179 /*! \name Destructors */
180 /*! \{ */
182 /*! \} */
183 /*========================== PRIVATE ================================*/
185 private:
187 friend class FieldContainer;
188 friend class ShaderVariableFunctorBase;
190 // prohibit default functions (move to 'public' if you need one)
191 void operator =(const ShaderVariableFunctor &source);
194 typedef ShaderVariableFunctor *ShaderVariableFunctorP;
196 OSG_END_NAMESPACE
198 #include "OSGShaderVariableFunctorBase.inl"
199 #include "OSGShaderVariableFunctor.inl"
201 #endif /* _OSGSHADERVARIABLEFUNCTOR_H_ */