fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / State / Shader / Variables / OSGShaderVariableFunctor.inl
blobdbd0351d3d1904c53c2e7b56243b925404333353
1 /*---------------------------------------------------------------------------*\
2  *                                OpenSG                                     *
3  *                                                                           *
4  *                                                                           *
5  *               Copyright (C) 2000-2002 by the OpenSG Forum                 *
6  *                                                                           *
7  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
8  *                                                                           *
9 \*---------------------------------------------------------------------------*/
10 /*---------------------------------------------------------------------------*\
11  *                                License                                    *
12  *                                                                           *
13  * This library is free software; you can redistribute it and/or modify it   *
14  * under the terms of the GNU Library General Public License as published    *
15  * by the Free Software Foundation, version 2.                               *
16  *                                                                           *
17  * This library is distributed in the hope that it will be useful, but       *
18  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
20  * Library General Public License for more details.                          *
21  *                                                                           *
22  * You should have received a copy of the GNU Library General Public         *
23  * License along with this library; if not, write to the Free Software       *
24  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
25  *                                                                           *
26 \*---------------------------------------------------------------------------*/
27 /*---------------------------------------------------------------------------*\
28  *                                Changes                                    *
29  *                                                                           *
30  *                                                                           *
31  *                                                                           *
32  *                                                                           *
33  *                                                                           *
34  *                                                                           *
35 \*---------------------------------------------------------------------------*/
37 //---------------------------------------------------------------------------
38 //  Includes
39 //---------------------------------------------------------------------------
41 OSG_BEGIN_NAMESPACE
43 inline
44 void ShaderVariableFunctor::setFunctor(ProcVarFunctor pFunc)
46     _pFunc = pFunc;
48 #ifdef OSG_1_COMPAT
49     _uiFuncMode = 0;
50 #endif
53 inline
54 void ShaderVariableFunctor::setFunctor(ProcVarNodeFunctor pFunc)
56     _pNodeFunc = pFunc;
58 #ifdef OSG_1_COMPAT
59     _uiFuncMode = 0;
60 #endif
64 #ifdef OSG_1_COMPAT
65 inline
66 void ShaderVariableFunctor::setFunctor(ParamFunctor pPFunc)
68     _pPFunc = pPFunc;
69     
70     _uiFuncMode = 1;
73 inline
74 void ShaderVariableFunctor::setFunctor (OSGParamFunctor pOSGPFunc)
76     _pOSGPFunc = pOSGPFunc;
78     _uiFuncMode = 2;
81 inline
82 UInt32 ShaderVariableFunctor::getFuncMode(void)
84     return _uiFuncMode;
86 #endif
88 inline
89 void ShaderVariableFunctor::evaluate(DrawEnv *pEnv,
90                                      Int32   &iLocation)
92     if(_pFunc)
93     {
94         _pFunc(pEnv, iLocation);
95     }
97     if(_pNodeFunc)
98     {
99         _pNodeFunc(pEnv, iLocation, pEnv->getSGNode());
100     }
103 #ifdef OSG_1_COMPAT
104 inline
105 void ShaderVariableFunctor::evaluate(GetUniformLocProc  getULoc,
106                                      DrawEnv           *pEnv,
107                                      UInt32             uiProg )
109     if(_pPFunc)
110     {
111         _pPFunc(getULoc, pEnv, uiProg);
112     }
115 inline
116 void ShaderVariableFunctor::evaluate(ShaderVariable    *pVar,
117                                      DrawEnv           *pEnv,
118                                      UInt32             uiProg)
120     if(_pOSGPFunc)
121     {
122         _pOSGPFunc(pVar, pEnv, uiProg);
123     }
125 #endif
127 OSG_END_NAMESPACE