Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OSGShaderParameterChunk.cpp

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *               Copyright (C) 2000-2002 by the OpenSG Forum                 *
00006  *                                                                           *
00007  *                            www.opensg.org                                 *
00008  *                                                                           *
00009  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00010  *                                                                           *
00011 \*---------------------------------------------------------------------------*/
00012 /*---------------------------------------------------------------------------*\
00013  *                                License                                    *
00014  *                                                                           *
00015  * This library is free software; you can redistribute it and/or modify it   *
00016  * under the terms of the GNU Library General Public License as published    *
00017  * by the Free Software Foundation, version 2.                               *
00018  *                                                                           *
00019  * This library is distributed in the hope that it will be useful, but       *
00020  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00022  * Library General Public License for more details.                          *
00023  *                                                                           *
00024  * You should have received a copy of the GNU Library General Public         *
00025  * License along with this library; if not, write to the Free Software       *
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00027  *                                                                           *
00028 \*---------------------------------------------------------------------------*/
00029 /*---------------------------------------------------------------------------*\
00030  *                                Changes                                    *
00031  *                                                                           *
00032  *                                                                           *
00033  *                                                                           *
00034  *                                                                           *
00035  *                                                                           *
00036  *                                                                           *
00037 \*---------------------------------------------------------------------------*/
00038 
00039 //---------------------------------------------------------------------------
00040 //  Includes
00041 //---------------------------------------------------------------------------
00042 
00043 #include <stdlib.h>
00044 #include <stdio.h>
00045 
00046 #include <OSGConfig.h>
00047 
00048 #include "OSGShaderParameterChunk.h"
00049 
00050 #include <OSGShaderParameter.h>
00051 #include <OSGShaderParameterBool.h>
00052 #include <OSGShaderParameterInt.h>
00053 #include <OSGShaderParameterReal.h>
00054 #include <OSGShaderParameterVec2f.h>
00055 #include <OSGShaderParameterVec3f.h>
00056 #include <OSGShaderParameterVec4f.h>
00057 #include <OSGShaderParameterMatrix.h>
00058 
00059 OSG_USING_NAMESPACE
00060 
00061 /***************************************************************************\
00062  *                            Description                                  *
00063 \***************************************************************************/
00064 
00069 /***************************************************************************\
00070  *                           Class variables                               *
00071 \***************************************************************************/
00072 
00073 /***************************************************************************\
00074  *                           Class methods                                 *
00075 \***************************************************************************/
00076 
00077 void ShaderParameterChunk::initMethod (void)
00078 {
00079 }
00080 
00081 
00082 /***************************************************************************\
00083  *                           Instance methods                              *
00084 \***************************************************************************/
00085 
00086 /*-------------------------------------------------------------------------*\
00087  -  private                                                                 -
00088 \*-------------------------------------------------------------------------*/
00089 
00090 /*----------------------- constructors & destructors ----------------------*/
00091 
00092 ShaderParameterChunk::ShaderParameterChunk(void) :
00093     Inherited(),
00094     _parameter_access(NULL)
00095 {
00096 }
00097 
00098 ShaderParameterChunk::ShaderParameterChunk(const ShaderParameterChunk &source) :
00099     Inherited(source),
00100     _parameter_access(source._parameter_access)
00101 {
00102 }
00103 
00104 ShaderParameterChunk::~ShaderParameterChunk(void)
00105 {
00106 }
00107 
00108 void ShaderParameterChunk::onCreate(const ShaderParameterChunk *source)
00109 {
00110     Inherited::onCreate(source);
00111 
00112     // ignore prototypes.
00113     if(GlobalSystemState == Startup)
00114         return;
00115 
00116     _parameter_access = new ShaderParameterAccess(getParameters());
00117 }
00118 
00119 void ShaderParameterChunk::onDestroy(void)
00120 {
00121     Inherited::onDestroy();
00122 
00123     if(_parameter_access != NULL)
00124         delete _parameter_access;
00125 }
00126 
00127 /*----------------------------- class specific ----------------------------*/
00128 
00129 void ShaderParameterChunk::changed(BitVector whichField, UInt32 origin)
00130 {
00131     Inherited::changed(whichField, origin);
00132 }
00133 
00134 void ShaderParameterChunk::dump(      UInt32    , 
00135                          const BitVector ) const
00136 {
00137     SLOG << "Dump ShaderParameterChunk NI" << std::endl;
00138 }
00139 
00140 /*---------------------------------- Access -------------------------------*/
00141 
00142 
00143 /*------------------------------------ Set --------------------------------*/
00144 
00145 bool ShaderParameterChunk::setUniformParameter(const char *name, bool value)
00146 {
00147     return _parameter_access->setParameter<ShaderParameterBool>(name, value);
00148 }
00149 
00150 bool ShaderParameterChunk::setUniformParameter(const char *name, Int32 value)
00151 {
00152     return _parameter_access->setParameter<ShaderParameterInt>(name, value);
00153 }
00154 
00155 bool ShaderParameterChunk::setUniformParameter(const char *name, Real32 value)
00156 {
00157     return _parameter_access->setParameter<ShaderParameterReal>(name, value);
00158 }
00159 
00160 bool ShaderParameterChunk::setUniformParameter(const char *name, const Vec2f &value)
00161 {
00162     return _parameter_access->setParameter<ShaderParameterVec2f>(name, value);
00163 }
00164 
00165 bool ShaderParameterChunk::setUniformParameter(const char *name, const Vec3f &value)
00166 {
00167     return _parameter_access->setParameter<ShaderParameterVec3f>(name, value);
00168 }
00169 
00170 bool ShaderParameterChunk::setUniformParameter(const char *name, const Vec4f &value)
00171 {
00172     return _parameter_access->setParameter<ShaderParameterVec4f>(name, value);
00173 }
00174 
00175 bool ShaderParameterChunk::setUniformParameter(const char *name, const Matrix &value)
00176 {
00177     return _parameter_access->setParameter<ShaderParameterMatrix>(name, value);
00178 }
00179 
00180 /*------------------------------------ Get --------------------------------*/
00181 
00182 bool ShaderParameterChunk::getUniformParameter(const char *name, bool &value)
00183 {
00184     return _parameter_access->getParameter<ShaderParameterBool>(name, value);
00185 }
00186 
00187 bool ShaderParameterChunk::getUniformParameter(const char *name, Int32 &value)
00188 {
00189     return _parameter_access->getParameter<ShaderParameterInt>(name, value);
00190 }
00191 
00192 bool ShaderParameterChunk::getUniformParameter(const char *name, Real32 &value)
00193 {
00194     return _parameter_access->getParameter<ShaderParameterReal>(name, value);
00195 }
00196 
00197 bool ShaderParameterChunk::getUniformParameter(const char *name, Vec2f &value)
00198 {
00199     return _parameter_access->getParameter<ShaderParameterVec2f>(name, value);
00200 }
00201 
00202 bool ShaderParameterChunk::getUniformParameter(const char *name, Vec3f &value)
00203 {
00204     return _parameter_access->getParameter<ShaderParameterVec3f>(name, value);
00205 }
00206 
00207 bool ShaderParameterChunk::getUniformParameter(const char *name, Vec4f &value)
00208 {
00209     return _parameter_access->getParameter<ShaderParameterVec4f>(name, value);
00210 }
00211 
00212 bool ShaderParameterChunk::getUniformParameter(const char *name, Matrix &value)
00213 {
00214     return _parameter_access->getParameter<ShaderParameterMatrix>(name, value);
00215 }
00216 
00217 bool ShaderParameterChunk::subUniformParameter(const char *name)
00218 {
00219     return _parameter_access->subParameter(name);
00220 }
00221 
00222 /*------------------------------------------------------------------------*/
00223 /*                              cvs id's                                  */
00224 
00225 #ifdef OSG_SGI_CC
00226 #pragma set woff 1174
00227 #endif
00228 
00229 #ifdef OSG_LINUX_ICC
00230 #pragma warning( disable : 177 )
00231 #endif
00232 
00233 namespace
00234 {
00235     static Char8 cvsid_cpp       [] = "@(#)$Id: OSGShaderParameterChunk.cpp,v 1.1 2004/08/27 12:50:51 a-m-z Exp $";
00236     static Char8 cvsid_hpp       [] = OSGSHADERPARAMETERCHUNKBASE_HEADER_CVSID;
00237     static Char8 cvsid_inl       [] = OSGSHADERPARAMETERCHUNKBASE_INLINE_CVSID;
00238 
00239     static Char8 cvsid_fields_hpp[] = OSGSHADERPARAMETERCHUNKFIELDS_HEADER_CVSID;
00240 }
00241 
00242 #ifdef __sgi
00243 #pragma reset woff 1174
00244 #endif

Generated on Thu Aug 25 04:09:21 2005 for OpenSG by  doxygen 1.4.3