![]() |
Public API Reference |
00001 /* 00002 Copyright (C) 2003 by Mat Sutcliffe <oktal@gmx.co.uk> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public 00015 License along with this library; if not, write to the Free 00016 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 */ 00018 00019 #ifndef __CS_GFX_SHADERVAR_H__ 00020 #define __CS_GFX_SHADERVAR_H__ 00021 00022 #include "csutil/refcount.h" 00023 #include "csutil/strhash.h" 00024 #include "iutil/string.h" 00025 #include "csgeom/vector2.h" 00026 #include "csgeom/vector3.h" 00027 #include "csgeom/vector4.h" 00028 #include "csgfx/rgbpixel.h" 00029 00030 struct iTextureHandle; 00031 struct iTextureWrapper; 00032 00036 class csShaderVariable : public csRefCount 00037 { 00038 public: 00040 enum VariableType 00041 { 00042 INT = 1, 00043 FLOAT, 00044 STRING, 00045 COLOR, 00046 TEXTURE, 00047 VECTOR2, 00048 VECTOR3, 00049 VECTOR4 00050 }; 00051 00052 private: 00053 csStringID Name; 00054 00055 VariableType Type; 00056 00057 int Int; 00058 csRef<iString> String; 00059 csRef<iTextureHandle> TextureHandValue; 00060 csRef<iTextureWrapper> TextureWrapValue; 00061 csVector4 VectorValue; 00062 00063 public: 00065 csShaderVariable (csStringID name); 00066 00068 VariableType GetType() const { return Type; } 00070 void SetType (VariableType t) { Type = t; } 00071 00073 csStringID GetName() const { return Name; } 00074 00076 bool GetValue (int& value) const; 00078 bool GetValue (float& value) const; 00080 bool GetValue (iString*& value) const; 00082 bool GetValue (csRGBpixel& value) const; 00084 bool GetValue (iTextureHandle*& value) const; 00086 bool GetValue (iTextureWrapper*& value) const; 00088 bool GetValue (csVector2& value) const; 00090 bool GetValue (csVector3& value) const; 00092 bool GetValue (csVector4& value) const; 00093 00095 bool SetValue (int value); 00097 bool SetValue (float value); 00099 bool SetValue (iString* value); 00101 bool SetValue (const csRGBpixel &value); 00103 bool SetValue (iTextureHandle* value); 00105 bool SetValue (iTextureWrapper* value); 00107 bool SetValue (const csVector2 &value); 00109 bool SetValue (const csVector3 &value); 00111 bool SetValue (const csVector4 &value); 00112 }; 00113 00114 #endif