fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / Contrib / ComputeBase / ComputeShader / OSGComputeShaderChunk.inl
blobbb37138fce8cdb6949d763a5f263d25ae1814197
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 *ComputeShaderChunk::getStaticClass(void)
46     return &ComputeShaderChunk::_class;
49 inline
50 UInt32 ComputeShaderChunk::getStaticClassId(void)
52     return getStaticClass()->getId();
55 template<class ValueT> inline
56 bool ComputeShaderChunk::addUniformVariable(const Char8  *name, 
57                                             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 ComputeShaderChunk::updateUniformVariable(const Char8  *name, 
77                                                const ValueT &value)
79     if(_sfVariables.getValue() == NULL)
80     {
81         ShaderProgramVariablesUnrecPtr pParam = 
82             ShaderProgramVariables::createDependent(
83                 this->getFieldFlags()->_bNamespaceMask);
85         setVariables(pParam);
86     }
88     return _sfVariables.getValue()->updateUniformVariable(name, value);
91 template<class ValueT>
92 bool ComputeShaderChunk::getUniformVariable(const Char8 *name, ValueT &value)
94     if(_sfVariables.getValue() != NULL)
95     {
96         return _sfVariables.getValue()->getUniformVariable(name, value);
97     }
99     return false;
102 OSG_END_NAMESPACE