1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2006 by the 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 \*---------------------------------------------------------------------------*/
37 //---------------------------------------------------------------------------
39 //---------------------------------------------------------------------------
44 const StateChunkClass *SimpleSHLChunk::getStaticClass(void)
46 return ShaderExecutableChunk::getStaticClass();
50 UInt32 SimpleSHLChunk::getStaticClassId(void)
52 return getStaticClass()->getId();
56 template<class ValueT> inline
57 bool SimpleSHLChunk::setUniformParameter(const Char8 *name, const ValueT &value)
59 if(_sfVariables.getValue() == NULL)
61 ShaderProgramVariablesUnrecPtr pParam =
62 ShaderProgramVariables::createDependent(
63 this->getFieldFlags()->_bNamespaceMask);
68 return _sfVariables.getValue()->addUniformVariable(
71 editMFVariableLocations (),
72 editMFProceduralVariableLocations());
75 template<class ValueT> inline
76 bool SimpleSHLChunk::getUniformParameter(const Char8 *name, ValueT &value)
78 if(_sfVariables.getValue() != NULL)
80 return _sfVariables.getValue()->getUniformVariable(name, value);
88 template<class ValueT> inline
89 bool SimpleSHLChunk::addUniformVariable(const Char8 *name, const ValueT &value)
91 if(_sfVariables.getValue() == NULL)
93 ShaderProgramVariablesUnrecPtr pParam =
94 ShaderProgramVariables::createDependent(
95 this->getFieldFlags()->_bNamespaceMask);
100 return _sfVariables.getValue()->addUniformVariable(
103 editMFVariableLocations (),
104 editMFProceduralVariableLocations());
107 template<class ValueT> inline
108 bool SimpleSHLChunk::updateUniformVariable(const Char8 *name,
111 if(_sfVariables.getValue() == NULL)
113 ShaderProgramVariablesUnrecPtr pParam =
114 ShaderProgramVariables::createDependent(
115 this->getFieldFlags()->_bNamespaceMask);
117 setVariables(pParam);
120 return _sfVariables.getValue()->updateUniformVariable(name, value);
123 template<class ValueT>
124 bool SimpleSHLChunk::getUniformVariable(const Char8 *name, ValueT &value)
126 if(_sfVariables.getValue() != NULL)
128 return _sfVariables.getValue()->getUniformVariable(name, value);
137 UInt32 SimpleSHLChunk::getFuncUniform1i(void)
139 return ShaderProgram::getFuncIdUniform1i();
143 UInt32 SimpleSHLChunk::getFuncUniform1iv(void)
145 return ShaderProgram::getFuncIdUniform1iv();
149 UInt32 SimpleSHLChunk::getFuncUniform2iv(void)
151 return ShaderProgram::getFuncIdUniform2iv();
155 UInt32 SimpleSHLChunk::getFuncUniform3iv(void)
157 return ShaderProgram::getFuncIdUniform3iv();
161 UInt32 SimpleSHLChunk::getFuncUniform4iv(void)
163 return ShaderProgram::getFuncIdUniform4iv();
167 UInt32 SimpleSHLChunk::getFuncUniform1f(void)
169 return ShaderProgram::getFuncIdUniform1f();
173 UInt32 SimpleSHLChunk::getFuncUniform1fv(void)
175 return ShaderProgram::getFuncIdUniform1fv();
179 UInt32 SimpleSHLChunk::getFuncUniform2fv(void)
181 return ShaderProgram::getFuncIdUniform2fv();
185 UInt32 SimpleSHLChunk::getFuncUniform3fv(void)
187 return ShaderProgram::getFuncIdUniform3fv();
191 UInt32 SimpleSHLChunk::getFuncUniform4fv(void)
193 return ShaderProgram::getFuncIdUniform4fv();
197 UInt32 SimpleSHLChunk::getFuncUniformMatrix4fv(void)
199 return ShaderProgram::getFuncIdUniformMatrix4fv();
203 UInt32 SimpleSHLChunk::getFuncGetUniformiv(void)
205 return ShaderProgram::getFuncIdGetUniformiv();
209 UInt32 SimpleSHLChunk::getFuncGetUniformfv(void)
211 return ShaderProgram::getFuncIdGetUniformfv();