| VRS - The Virtual Rendering System |
| version 3.3 |
00001 /****************************************************************************** 00002 * VRS - The Virtual Rendering System 00003 * Copyright (C) 2003 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 // $Id: texturegl.h 6014 2007-08-09 07:51:16Z Konstantin_Baumann $ 00019 // $Date: 2007-08-09 09:51:16 +0200 (Thu, 09 Aug 2007) $ 00020 // $Revision: 6014 $ 00021 // $State$ 00022 // $Author: Konstantin_Baumann $ 00023 // 00024 // $Log$ 00025 // Revision 1.18 2005/10/13 09:52:35 baumann 00026 // mipmap handling improved 00027 // 00028 // Revision 1.17 2005/06/15 16:30:02 baumann 00029 // added methods SharedObj::isEqual() and SharedObj::IsEqual() (define operator==() in derived classes for a real implementaton) 00030 // 00031 // Revision 1.16 2005/01/03 01:43:10 klimetschek 00032 // - modified win32 project layout, splitted vrs.vcproj into vrs_container, vrs_core, vrs_sg, vrs_image, vrs_opengl and vrs_io 00033 // - removed vrs.vcproj 00034 // minor things: 00035 // - added all glutexamples to vrs4glut.sln 00036 // - fixed some problems in glutexamples 00037 // - removed all project references from all VS projects (using solution wide project dependencies instead) 00038 // 00039 // Revision 1.15 2004/11/03 14:45:07 saar 00040 // Class comment changed (Doxygen style) 00041 // 00042 // Revision 1.14 2004/03/12 16:28:41 baumann 00043 // macros VRS_NAMESPACE_BEGIN/_END expanded and removed 00044 // 00045 // Revision 1.13 2004/01/19 11:43:58 baumann 00046 // serialization mechanism improved 00047 // 00048 // Revision 1.12 2004/01/19 07:28:03 baumann 00049 // serialization mechanism improved 00050 // 00051 // Revision 1.11 2003/11/07 14:19:25 kirsch 00052 // removed leading underscore from include guards 00053 // 00054 // Revision 1.10 2003/09/13 12:21:39 baumann 00055 // MIRROR_CLAMP, MIRROR_CLAMP_TO_EDGE, and MIRROR_CLAMP_TO_BORDER added 00056 // 00057 // Revision 1.9 2003/07/29 13:21:28 kirsch 00058 // added support for ARB shadow functions 00059 // 00060 // Revision 1.8 2003/06/23 07:17:03 baumann 00061 // - new classes VRS::Texture and VRS::ImageTexture2D added to VRS core 00062 // - class VRS::TextureGL is now derived from VRS::Texture 00063 // 00064 // Revision 1.7 2002/12/11 16:05:31 kirsch 00065 // use Matrix() instead of Matrix::identity in constructor 00066 // 00067 // Revision 1.6 2002/11/13 07:20:50 baumann 00068 // changed TextureGL enum values to uppercase 00069 // added TextureGL::definesComponent() 00070 // 00071 // Revision 1.5 2002/09/02 16:21:10 baumann 00072 // method category() added (returns TextureGL::ClassNameVRS() for all texture classes) 00073 // 00074 // Revision 1.4 2002/04/07 17:14:11 baumann 00075 // Matrix::identity() changed to Matrix::identity 00076 // 00077 // Revision 1.3 2002/03/04 12:00:20 kersting 00078 // directory structure changes 00079 // 00080 // Revision 1.8 2002/03/03 21:44:26 kosta 00081 // VRS_TYPEINFO-macro rewritten 00082 // 00083 // Revision 1.7 2002/02/19 10:34:19 kosta 00084 // undone all changes since 2002-02-15 00085 // 00086 // Revision 1.4 2002/02/05 07:48:26 kosta 00087 // new persistency macros: 00088 // VRS_SERIALIZABLE(CLASS_NAME); 00089 // VRS_SERIALIZABLE_ABSTRACT_CLASS(CLASS_NAME); 00090 // VRS_SERIALIZABLE_NO_SO_CLASS(CLASS_NAME) 00091 // 00092 // Revision 1.3 2002/02/04 13:07:19 kosta 00093 // VRS_SERIALIZABLE macros completely rewritten 00094 // 00095 // Revision 1.2 2002/01/15 16:25:55 kosta 00096 // macros rewritten for a better namespace support 00097 // 00098 // Revision 1.1 2002/01/08 16:02:49 kosta 00099 // dir structure for textures changed 00100 // 00101 // Revision 1.5 2001/11/21 10:25:38 nienhaus 00102 // combine mode moved to opengl texture environment attribute 00103 // 00104 // Revision 1.4 2001/11/13 16:36:31 kirsch 00105 // changed line feed to unix style (removed control-M) 00106 // 00107 // Revision 1.3 2001/08/26 10:46:11 kosta 00108 // texture painters refined and simplified 00109 // 00110 // Revision 1.2 2001/08/20 15:07:58 kersting 00111 // added classname to enumeration 00112 // 00113 // Revision 1.1 2001/07/25 21:27:46 kosta 00114 // new texture mechanism implemented 00115 // 00116 00117 #ifndef VRS_OPENGL_TEXTUREGL_H_ 00118 #define VRS_OPENGL_TEXTUREGL_H_ 00119 00120 #include <vrs/color.h> 00121 #include <vrs/texture.h> 00122 #include <vrs/opengl/openglconfig.h> 00123 00124 namespace VRS { 00125 00127 class VRS_CORE_API TextureGL : public Texture { 00128 00129 public: 00130 enum FilterMode { 00131 NEAREST, 00132 LINEAR, 00133 TRILINEAR, 00134 LINEAR_MIPMAP_LINEAR = TRILINEAR, // linear per level, linear between levels 00135 NEAREST_MIPMAP_NEAREST, // nearest per level, nearest level 00136 LINEAR_MIPMAP_NEAREST, // linear per level, nearest level 00137 NEAREST_MIPMAP_LINEAR // nearest per level, linear between levels 00138 }; 00139 VRS_SERIALIZABLE_CLASS_ENUM(FilterMode); 00140 00141 enum WrapMode { 00142 REPEAT, 00143 CLAMP, 00144 CLAMP_TO_EDGE, 00145 CLAMP_TO_BORDER, 00146 MIRRORED_REPEAT, 00147 MIRROR_CLAMP, 00148 MIRROR_CLAMP_TO_EDGE, 00149 MIRROR_CLAMP_TO_BORDER 00150 }; 00151 VRS_SERIALIZABLE_CLASS_ENUM(WrapMode); 00152 00153 enum ShadowCompareMode { 00154 DISABLED, 00155 LEQUAL, 00156 GEQUAL, 00157 LESS, 00158 GREATER, 00159 EQUAL, 00160 NOT_EQUAL, 00161 ALWAYS, 00162 NEVER 00163 }; 00164 VRS_SERIALIZABLE_CLASS_ENUM(ShadowCompareMode); 00165 00166 enum ShadowResultMode { 00167 SHADOW_LUMINANCE, 00168 SHADOW_INTENSITY, 00169 SHADOW_ALPHA 00170 }; 00171 VRS_SERIALIZABLE_CLASS_ENUM(ShadowResultMode); 00172 00173 enum Component { 00174 COLOR, 00175 ALPHA, 00176 DEPTH 00177 }; 00178 VRS_SERIALIZABLE_CLASS_ENUM(Component); 00179 00180 protected: 00181 TextureGL( 00182 FilterMode minFilter = TextureGL::TRILINEAR, 00183 FilterMode magFilter = TextureGL::LINEAR, 00184 GLfloat anisotropic = 1.0, 00185 const Matrix& matrix = Matrix(), 00186 const Color& borderColor = Color(0.0f, 0.0f, 0.0f, 0.0f), // transparent black 00187 GLenum internalFormat = GL_ZERO, 00188 unsigned int minMipmapLevel = 0, 00189 unsigned int maxMipmapLevel = 1000 00190 ); 00201 bool operator==(const TextureGL& other) const; 00202 00203 public: 00204 virtual void setFilter(FilterMode filter); 00205 virtual void setMinFilter(FilterMode filter); 00206 virtual void setMagFilter(FilterMode filter); 00207 virtual FilterMode getMinFilter() const; 00208 virtual FilterMode getMagFilter() const; 00210 00211 virtual void setAnisotropic(GLfloat factor); 00212 virtual GLfloat getAnisotropic() const; 00216 virtual void setBorderColor(const Color& color); 00217 virtual const Color& getBorderColor() const; 00220 virtual void setMinMipmapLevel(unsigned int newMinMipmapLevel); 00221 virtual unsigned int getMinMipmapLevel() const; 00222 virtual void setMaxMipmapLevel(unsigned int newMaxMipmapLevel); 00223 virtual unsigned int getMaxMipmapLevel() const; 00227 virtual bool isMipmap() const; 00230 virtual void setShadowCompare(ShadowCompareMode); 00231 virtual ShadowCompareMode getShadowCompare() const; 00236 virtual void setShadowResult(ShadowResultMode); 00237 virtual ShadowResultMode getShadowResult() const; 00242 virtual void setInternalFormat(GLenum format = GL_ZERO); 00243 virtual GLenum getInternalFormat() const; 00250 virtual bool definesComponent(Component component) const; 00254 virtual ID category() const; 00256 00257 VRS_TYPEINFO(TextureGL, Texture); 00258 VRS_SERIALIZABLE(TextureGL); 00259 00260 private: 00261 FilterMode minFilter_; 00262 FilterMode magFilter_; 00263 GLfloat anisotropic_; 00264 Color borderColor_; 00265 GLint minMipmapLevel_; 00266 GLint maxMipmapLevel_; 00267 ShadowCompareMode shadowCompareMode_; 00268 ShadowResultMode shadowResultMode_; 00269 GLenum internalFormat_; 00270 }; 00271 00272 } // namespace VRS 00273 00274 #endif // VRS_OPENGL_TEXTUREGL_H_