| VRS - The Virtual Rendering System |
| version 3.3 |
00001 /****************************************************************************** 00002 * VRS - The Virtual Rendering System 00003 * Copyright (C) 2000-2004 Computer Graphics Systems Group at the 00004 * Hasso-Plattner-Institute (HPI), Potsdam, Germany. 00005 * 00006 * This library is free software; you can redistribute it and/or modify it 00007 * under the terms of the GNU Lesser General Public License as published by 00008 * the Free Software Foundation; either version 2.1 of the License, or (at 00009 * your option) any later version. This library is distributed in the hope 00010 * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied 00011 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU Lesser General Public License for more details. You should have received 00013 * a copy of the GNU Lesser+ General Public License along with this library; if 00014 * not, write to the FreeSoftware Foundation, Inc., 59 Temple Place, Suite 330, 00015 * Boston, MA, 02111-1307, USA. 00016 ******************************************************************************/ 00017 00018 #ifndef VRS_GL2_EXTSHADER_UBERSHADERUNIFORMVARIABLE_H 00019 #define VRS_GL2_EXTSHADER_UBERSHADERUNIFORMVARIABLE_H 00020 00021 // 00022 // VRS 00023 // 00024 #include <vrs/opengl/gl2/uniformvariable.h> 00025 00026 namespace VRS 00027 { 00028 namespace GL2 00029 { 00030 namespace EXTSHADER 00031 { 00035 template<typename T> 00036 class UberShaderUniformVariable : public UniformVariableBase 00037 { 00038 public: 00039 UberShaderUniformVariable(const std::string& name, const T& value) : 00040 UniformVariableBase(), 00041 name_(name), 00042 value_(value) 00043 { } 00049 virtual std::string name() const { return name_; } 00051 00052 virtual const T& getValue() const { return value_; } 00053 virtual void setValue(const T& newValue) { value_ = newValue; modified(); } 00055 00056 VRS_TYPEINFO(UberShaderUniformVariable, UniformVariableBase); 00057 VRS_SERIALIZABLE(UberShaderUniformVariable); 00058 00059 protected: 00060 00061 UberShaderUniformVariable(void) { return; } // only for serialization!!! 00062 00063 private: 00064 00065 std::string name_; 00066 T value_; 00067 00068 };//endclass UberShaderUniformVariable<T> 00069 00070 template<typename T> 00071 inline void UberShaderUniformVariable<T>::serialize(SerializationManager& manager) 00072 { 00073 UINT8 version = 0; 00074 manager.classVersion(version); 00075 00076 VRS_SERIALIZATION_PARENT_CLASS(manager, UniformVariableBase); 00077 serialization(manager, "name", name_); 00078 serialization(manager, "value", value_); 00079 00080 return; 00081 } 00082 00083 VRS_SERIALIZATION_REGISTRATION_TEMPLATE(UberShaderUniformVariable); 00084 00085 };//endnamespace EXTSHADER 00086 00087 };//endnamespace GL2 00088 00089 };//endnamespace VRS 00090 00091 #endif // VRS_GL2_EXTSHADER_UBERSHADERUNIFORMVARIABLE_H