1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2002 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 _OSGSHADERVARIABLEFUNCTOR_H_
40 #define _OSGSHADERVARIABLEFUNCTOR_H_
45 #include "OSGShaderVariableFunctorBase.h"
46 #include "OSGDrawEnv.h"
48 #include "boost/function.hpp"
52 /*! \brief ShaderVariableFunctor class. See \ref
53 PageSystemShaderVariableFunctor for a description.
54 \ingroup GrpSystemShaderVariables
55 \ingroup GrpLibOSGSystem
59 class OSG_SYSTEM_DLLMAPPING ShaderVariableFunctor
:
60 public ShaderVariableFunctorBase
64 /*========================== PUBLIC =================================*/
68 typedef ShaderVariableFunctorBase Inherited
;
70 typedef GLint (OSG_APIENTRY
*GetUniformLocProc
)( GLuint programObj
,
73 typedef boost::function
<void (DrawEnv
*, Int32
)> ProcVarFunctor
;
74 typedef boost::function
<void (DrawEnv
*, Int32
, Node
*)> ProcVarNodeFunctor
;
77 typedef boost::function
<void (GetUniformLocProc
,
79 GLuint
)> ParamFunctor
;
81 typedef boost::function
<void (ShaderVariable
* const,
83 GLuint
)> OSGParamFunctor
;
86 /*---------------------------------------------------------------------*/
90 virtual void changed(ConstFieldMaskArg whichField
,
95 /*---------------------------------------------------------------------*/
99 virtual void dump( UInt32 uiIndent
= 0,
100 const BitVector bvFlags
= 0) const;
103 /*---------------------------------------------------------------------*/
107 void setFunctor (ProcVarFunctor pFunc
);
108 void setFunctor (ProcVarNodeFunctor pFunc
);
110 void setFunctor (ParamFunctor pPFunc
);
111 void setFunctor (OSGParamFunctor pOSGPFunc
);
113 UInt32
getFuncMode(void );
117 /*---------------------------------------------------------------------*/
121 virtual bool isProcedural(void) const;
124 /*---------------------------------------------------------------------*/
128 void evaluate(DrawEnv
*pEnv
,
132 void evaluate(GetUniformLocProc getULoc
,
136 void evaluate(ShaderVariable
*pVar
,
142 /*========================= PROTECTED ===============================*/
149 ParamFunctor _pPFunc
;
150 OSGParamFunctor _pOSGPFunc
;
153 ProcVarFunctor _pFunc
;
154 ProcVarNodeFunctor _pNodeFunc
;
156 /*---------------------------------------------------------------------*/
157 /*! \name Constructors */
160 ShaderVariableFunctor(void);
161 ShaderVariableFunctor(const ShaderVariableFunctor
&source
);
164 /*---------------------------------------------------------------------*/
165 /*! \name Destructors */
168 virtual ~ShaderVariableFunctor(void);
171 /*---------------------------------------------------------------------*/
175 static void initMethod(InitPhase ePhase
);
178 /*---------------------------------------------------------------------*/
179 /*! \name Destructors */
183 /*========================== 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
;
198 #include "OSGShaderVariableFunctorBase.inl"
199 #include "OSGShaderVariableFunctor.inl"
201 #endif /* _OSGSHADERVARIABLEFUNCTOR_H_ */