1 /*---------------------------------------------------------------------------*\
5 * Copyright 2000-2002 by OpenSG Forum *
7 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
9 \*---------------------------------------------------------------------------*/
10 /*---------------------------------------------------------------------------*\
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. *
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. *
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. *
26 \*---------------------------------------------------------------------------*/
27 /*---------------------------------------------------------------------------*\
35 \*---------------------------------------------------------------------------*/
41 #include "OSGConfig.h"
45 template<class ValueT> inline
46 bool CgFXMaterial::addUniformVariable(const Char8 *name, const ValueT &value)
48 if(_sfVariables.getValue() == NULL)
50 ShaderProgramVariablesUnrecPtr pParam =
51 ShaderProgramVariables::create();
56 return _sfVariables.getValue()->addUniformVariable(
64 void CgFXMaterial::addVariable(ShaderVariable *pVar)
66 if(_sfVariables.getValue() == NULL)
68 ShaderProgramVariablesUnrecPtr pParam =
69 ShaderProgramVariables::create();
74 _sfVariables.getValue()->addVariable(pVar);
78 const ShaderVariable *CgFXMaterial::getVariable(const Char8 *name) const
80 if(_sfVariables.getValue() != NULL)
82 return _sfVariables.getValue()->getVariable(name);
88 template<class ValueT> inline
89 bool CgFXMaterial::updateUniformVariable(const Char8 *name,
92 if(_sfVariables.getValue() == NULL)
94 ShaderProgramVariablesUnrecPtr pParam =
95 ShaderProgramVariables::create();
100 return _sfVariables.getValue()->updateUniformVariable(name, value);
103 template<class ValueT>
104 bool CgFXMaterial::getUniformVariable(const Char8 *name,
107 if(_sfVariables.getValue() != NULL)
109 return _sfVariables.getValue()->getUniformVariable(name, value);
116 CGeffect CgFXMaterial::getEffect(void) const
122 const std::string *CgFXMaterial::getStateVarNames(void) const
124 return _vStateVarNames;