Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Texture.hpp

Go to the documentation of this file.
00001 /****************************************************************************\ 00002 * VRVis * 00003 * http://vrvis.sourceforge.net * 00004 * (C) 2004 by Alex Loeffler * 00005 * mailto:aloeffler@users.sourceforge.net * 00006 **************************************************************************** 00007 * License * 00008 * * 00009 * This library is free software; you can redistribute it and/or modify it * 00010 * under the terms of the GNU Library General Public License as published * 00011 * by the Free Software Foundation, version 2. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, but * 00014 * WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00016 * Library General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Library General Public * 00019 * License along with this library; if not, write to the Free Software * 00020 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00021 \****************************************************************************/ 00022 00023 #ifndef TEXTURE_HPP 00024 #define TEXTURE_HPP 00025 00026 #include <vrj/Draw/OGL/GlContextData.h> 00027 #include "ColorDataDefs.hpp" 00028 00029 #include "Common.hpp" 00030 00031 namespace vrvis 00032 { 00033 00036 class Texture 00037 { 00038 // ================================================================== PUBLIC 00039 00040 public: 00041 00042 // ----------------------------------------------- Constructor & Destructor. 00044 00046 Texture(const int cOriginX, 00047 const int cOriginY, 00048 const int cWidth, 00049 const int cHeight, 00050 const int cMaxValidX, 00051 const int cMaxValidY, 00052 const ColorDataMap& crColorDataMap); 00053 00055 ~Texture(void); 00056 00058 // -------------------------------------------------------------- Accessors. 00060 00062 int getOriginX(void) const; 00064 int getOriginY(void) const; 00065 00067 int getSizeX(void) const; 00069 int getSizeY(void) const; 00070 00072 int getMaxValidX(void) const; 00074 int getMaxValidY(void) const; 00075 00077 double getLowerLimit(void) const; 00079 double getUpperLimit(void) const; 00080 00082 ushort* getTexData(void) const; 00083 00085 void getTexCoords(float& rMinX, float& rMaxX, float& rMinY, float& rMaxY); 00086 00088 // --------------------------------------------------------------- Mutators. 00090 00092 void setTexCoords(const float cMinX, 00093 const float cMaxX, 00094 const float cMinY, 00095 const float cMaxY); 00096 00098 void setLimits(const double cLowerLimit, const double cUpperLimit); 00099 00101 // -------------------------------------------- Texture Data Initialization. 00103 00105 void fill(void); 00107 void createGLTexture(void); 00108 00110 // ---------------------------------------------- Texture Data Manipulation. 00112 00114 void calculateTextureData(void); 00116 void rebuildGLTexture(int offsetX = 0, 00117 int offsetY = 0, 00118 int width = -1, 00119 int height = -1); 00120 00122 // ---------------------------------------------------------------- Drawing. 00124 00126 void drawTexturedQuad(const float cDrawUnitX, const float cDrawUnitY); 00127 00129 // --------------------------------------------------- Maximum Texture Size. 00130 00132 static int getMaxTexSize(void); 00133 00134 // ================================================================= PRIVATE 00135 00136 private: 00137 00138 // ---------------------------------------------------------------- Friends. 00139 00141 friend class Input; 00142 00143 // ---------------------------------------------------- Member Construction. 00144 00146 static void setMaxTexSize(int maxTexSize); 00147 00148 // ---------------------------------------------------------------- Members. 00149 00151 const int mcOriginX; 00153 const int mcOriginY; 00154 00155 const int mcSizeX; 00156 const int mcSizeY; 00157 00158 const int mcMaxValidX; 00159 const int mcMaxValidY; 00160 00161 float mTexCoordMinX; 00162 float mTexCoordMaxX; 00163 float mTexCoordMinY; 00164 float mTexCoordMaxY; 00165 00166 double mLowerLimit; 00167 double mUpperLimit; 00168 00170 const ColorDataMap& mcrColorDataMap; 00171 00173 ushort* mpTexData; 00174 00176 vrj::GlContextData<uint> mTexID; 00177 00178 // --------------------------------------------------------- Static Members. 00179 00180 static double sInitialLowerLimit; 00181 static double sInitialUpperLimit; 00182 00184 static int sMaxTexSize; 00185 }; 00186 00187 } // End namespace. 00188 00189 #endif // TEXTURE_HPP

Generated on Tue Sep 21 07:31:08 2004 for VRVis by doxygen 1.3.8