fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / State / Shader / SHL / OSGSimpleSHLChunk.inl
blobd1fad2d171b54f02f8f5405a86b2323d2f1d3ed2
1 /*---------------------------------------------------------------------------*\
2  *                                OpenSG                                     *
3  *                                                                           *
4  *                                                                           *
5  *               Copyright (C) 2000-2006 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 const StateChunkClass *SimpleSHLChunk::getStaticClass(void)
46     return ShaderExecutableChunk::getStaticClass();
49 inline
50 UInt32 SimpleSHLChunk::getStaticClassId(void)
52     return getStaticClass()->getId();
55 #ifdef OSG_1_COMPAT
56 template<class ValueT> inline
57 bool SimpleSHLChunk::setUniformParameter(const Char8 *name, const ValueT &value)
59     if(_sfVariables.getValue() == NULL)
60     {
61         ShaderProgramVariablesUnrecPtr pParam = 
62             ShaderProgramVariables::createDependent(
63                 this->getFieldFlags()->_bNamespaceMask);
65         setVariables(pParam);
66     }
68     return _sfVariables.getValue()->addUniformVariable(
69         name, 
70         value,
71         editMFVariableLocations          (),
72         editMFProceduralVariableLocations());
75 template<class ValueT> inline
76 bool SimpleSHLChunk::getUniformParameter(const Char8 *name, ValueT &value)
78     if(_sfVariables.getValue() != NULL)
79     {
80         return _sfVariables.getValue()->getUniformVariable(name, value);
81     }
83     return false;
86 #endif
88 template<class ValueT> inline
89 bool SimpleSHLChunk::addUniformVariable(const Char8 *name, const ValueT &value)
91     if(_sfVariables.getValue() == NULL)
92     {
93         ShaderProgramVariablesUnrecPtr pParam = 
94             ShaderProgramVariables::createDependent(
95                 this->getFieldFlags()->_bNamespaceMask);
97         setVariables(pParam);
98     }
100     return _sfVariables.getValue()->addUniformVariable(
101         name, 
102         value,
103         editMFVariableLocations          (),
104         editMFProceduralVariableLocations());
107 template<class ValueT> inline
108 bool SimpleSHLChunk::updateUniformVariable(const Char8 *name, 
109                                            const ValueT &value)
111     if(_sfVariables.getValue() == NULL)
112     {
113         ShaderProgramVariablesUnrecPtr pParam = 
114             ShaderProgramVariables::createDependent(
115                 this->getFieldFlags()->_bNamespaceMask);
117         setVariables(pParam);
118     }
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)
127     {
128         return _sfVariables.getValue()->getUniformVariable(name, value);
129     }
131     return false;
135 #ifdef OSG_1_COMPAT
136 inline
137 UInt32 SimpleSHLChunk::getFuncUniform1i(void)
139     return ShaderProgram::getFuncIdUniform1i();
142 inline
143 UInt32 SimpleSHLChunk::getFuncUniform1iv(void)
145     return ShaderProgram::getFuncIdUniform1iv();
148 inline
149 UInt32 SimpleSHLChunk::getFuncUniform2iv(void)
151     return ShaderProgram::getFuncIdUniform2iv();
154 inline
155 UInt32 SimpleSHLChunk::getFuncUniform3iv(void)
157     return ShaderProgram::getFuncIdUniform3iv();
160 inline
161 UInt32 SimpleSHLChunk::getFuncUniform4iv(void)
163     return ShaderProgram::getFuncIdUniform4iv();
166 inline
167 UInt32 SimpleSHLChunk::getFuncUniform1f(void)
169     return ShaderProgram::getFuncIdUniform1f();
172 inline
173 UInt32 SimpleSHLChunk::getFuncUniform1fv(void)
175     return ShaderProgram::getFuncIdUniform1fv();
178 inline
179 UInt32 SimpleSHLChunk::getFuncUniform2fv(void)
181     return ShaderProgram::getFuncIdUniform2fv();
184 inline
185 UInt32 SimpleSHLChunk::getFuncUniform3fv(void)
187     return ShaderProgram::getFuncIdUniform3fv();
190 inline
191 UInt32 SimpleSHLChunk::getFuncUniform4fv(void)
193     return ShaderProgram::getFuncIdUniform4fv();
196 inline
197 UInt32 SimpleSHLChunk::getFuncUniformMatrix4fv(void)
199     return ShaderProgram::getFuncIdUniformMatrix4fv();
202 inline
203 UInt32 SimpleSHLChunk::getFuncGetUniformiv(void)
205     return ShaderProgram::getFuncIdGetUniformiv();
208 inline
209 UInt32 SimpleSHLChunk::getFuncGetUniformfv(void)
211     return ShaderProgram::getFuncIdGetUniformfv();
213 #endif
215 OSG_END_NAMESPACE