fixed: compile issue
[opensg.git] / Source / Contrib / CgFXMaterial / OSGCgFXMaterial.inl
blobc6f43858c6bb12978b34d7048c809de3708144ff
1 /*---------------------------------------------------------------------------*\
2  *                                OpenSG                                     *
3  *                                                                           *
4  *                                                                           *
5  *                     Copyright 2000-2002 by 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 \*---------------------------------------------------------------------------*/
38 #include <stdlib.h>
39 #include <stdio.h>
41 #include "OSGConfig.h"
43 OSG_BEGIN_NAMESPACE
45 template<class ValueT> inline
46 bool CgFXMaterial::addUniformVariable(const Char8 *name, const ValueT &value)
48     if(_sfVariables.getValue() == NULL)
49     {
50         ShaderProgramVariablesUnrecPtr pParam = 
51             ShaderProgramVariables::create();
53         setVariables(pParam);
54     }
56     return _sfVariables.getValue()->addUniformVariable(
57         name, 
58         value,
59         NULL,
60         NULL);
63 inline
64 void CgFXMaterial::addVariable(ShaderVariable *pVar)
66     if(_sfVariables.getValue() == NULL)
67     {
68         ShaderProgramVariablesUnrecPtr pParam = 
69             ShaderProgramVariables::create();
71         setVariables(pParam);
72     }
74     _sfVariables.getValue()->addVariable(pVar);
77 inline
78 const ShaderVariable *CgFXMaterial::getVariable(const Char8 *name) const
80     if(_sfVariables.getValue() != NULL)
81     {
82         return _sfVariables.getValue()->getVariable(name);
83     }
85     return NULL;
88 template<class ValueT> inline
89 bool CgFXMaterial::updateUniformVariable(const Char8  *name, 
90                                          const ValueT &value)
92     if(_sfVariables.getValue() == NULL)
93     {
94         ShaderProgramVariablesUnrecPtr pParam = 
95             ShaderProgramVariables::create();
97         setVariables(pParam);
98     }
100     return _sfVariables.getValue()->updateUniformVariable(name, value);
103 template<class ValueT>
104 bool CgFXMaterial::getUniformVariable(const Char8  *name,
105                                             ValueT &value)
107     if(_sfVariables.getValue() != NULL)
108     {
109         return _sfVariables.getValue()->getUniformVariable(name, value);
110     }
112     return false;
115 inline
116 CGeffect CgFXMaterial::getEffect(void) const
118     return _pCGeffect;
121 inline
122 const std::string *CgFXMaterial::getStateVarNames(void) const
124     return _vStateVarNames;
127 OSG_END_NAMESPACE