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

texture.h

Go to the documentation of this file.
00001 /* ***********************************************************************************
00002         Writer:         Sebastien Bloc
00003         Copyright:      2003-2004
00004         eMail:          sebastien.bloc@free.fr
00005         URL:            http://mignonsoft.free.fr
00006 
00007         This program is free software; you can redistribute it and/or
00008         modify it under the terms of the GNU General Public License
00009         as published by the Free Software Foundation; either version 2
00010         of the License, or (at your option) any later version.
00011 
00012         This program is distributed in the hope that it will be useful,
00013         but WITHOUT ANY WARRANTY; without even the implied warranty of
00014         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015         GNU General Public License for more details.
00016         http://www.gnu.org/copyleft/gpl.html
00017 *********************************************************************************** */
00018 
00023 #ifndef INCLUDE_3D_TEXTURE_H
00024 #define INCLUDE_3D_TEXTURE_H
00025 
00026 #include "3d.h"
00027 #include "color.h"
00028 
00029 typedef enum
00030 {
00031         texture1D = GL_TEXTURE_1D , 
00032         texture2D = GL_TEXTURE_2D,
00033         texture3D = GL_TEXTURE_3D
00034 } TextureTarget; // a caster en GLint pour switch
00035 
00036 typedef enum
00037 {
00038         clamp = GL_CLAMP,
00039         repeat = GL_REPEAT
00040 } TextureWrap; // a caster en GLint pour switch
00041 
00042 typedef enum
00043 {
00044         nearest = GL_NEAREST,
00045         linear = GL_LINEAR
00046 } TextureFilter; // a caster en GLint pour switch
00047 
00048 typedef enum 
00049 {
00050         modulate = GL_MODULATE, 
00051         decal = GL_DECAL,
00052         blend = GL_BLEND, 
00053         replace = GL_REPLACE,
00054 } TextureEnvMode; // a caster en GLint pour switch
00055 
00063 class Texture
00064 {
00065 private:
00066         GLubyte *dataOut;       // utilisé dans CreateCurstomBegin / End
00067 
00068 public:
00069         static MyList<Texture *> list;
00070         GLint id;
00071         MyString name;
00072         MyString source;
00073         BOOL useResizing;
00074         GLdouble xScale,yScale;
00075         int xSize,ySize;
00076         TextureTarget target;                           
00077         TextureWrap wrapT,wrapS;                        
00078         TextureFilter magFilter,minFilter;
00079         TextureEnvMode envMode;                          
00080         Color envColor;
00081         Color border;
00082 
00083 public: // membre static
00084         static Texture * Find(char *name);
00085         static BOOL Delete(Texture *texture);
00086 
00087 public:
00088         void VerifyId();
00089         void Config(); 
00090         void ConfigPixelStore();
00091         GLubyte * ConfigSize (int _xSize,int _ySize,BOOL allocate,BOOL resizeIt);
00092         void SetCoord(double x,double y);
00093         double GetXCoord(double x);
00094         double GetYCoord(double y);
00095         BOOL Delete();
00096 
00097 public:
00098         Texture();
00099         ~Texture();
00100         void Zero();
00101         void operator =(Texture &src);
00102         operator GLuint () const { return id; }
00103 
00104         BOOL FromNull();
00105         BOOL FromFile(char *_name,char *fileName,BOOL resizeIt=FALSE);
00106         BOOL FromBitmap(char *_name,char *fileName,BOOL resizeIt=FALSE);
00107         BOOL FromText(char *_name,char *text,COLORREF color,COLORREF background,int xFormat=0,int yFormat=0);
00108 
00109         BOOL Begin(char *_name,int deltaX,int deltaY);
00110         BOOL SetPixel(int x,int y,byte r,byte g,byte b);
00111         BOOL GetPixel(int x,int y,byte &r,byte &g,byte &b);
00112         BOOL AddText(char *text,COLORREF color,COLORREF background,int xFormat=0,int yFormat=0);
00113         BOOL End();
00114 };
00115 
00116 #endif

Generated on Fri Aug 20 19:19:50 2004 for 3d Controls by doxygen 1.3.6