00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __RE_Texture2DMap_h__
00020 #define __RE_Texture2DMap_h__
00021
00022 #include "RE_API.h"
00023 #include "RE_OGLTexture.h"
00024 #include <iostream.h>
00025
00026 class TIL_Raster;
00027 class TIL_TextureMap;
00028
00029
00030 class RE_API RE_Texture2DMap
00031 {
00032 public:
00033
00034 RE_Texture2DMap(const char *mapname = 0, const char *relativeTo = 0,
00035 TIL_Raster *rp = 0);
00036 RE_Texture2DMap(TIL_TextureMap *map);
00037 virtual ~RE_Texture2DMap();
00038
00039 void setMap(TIL_TextureMap *map);
00040 void setMap(const char *mapname, const char *relativeTo,
00041 TIL_Raster *rp = 0);
00042
00043 int getIndex(bool check_for_volatile=true);
00044 void clear();
00045 void clearRenderIndex();
00046
00047 void setBorders(int f) { hasBorders = f; }
00048 void setClamped(int f)
00049 { if (f != isClamped) clearRenderIndex();
00050 isClamped = f;
00051 }
00052 void setMipMapped(int f)
00053 { if (f != useMipMaps) clearRenderIndex();
00054 useMipMaps = f;
00055 }
00056
00057 int getBorders() const { return hasBorders; }
00058 int getClamped() const { return isClamped; }
00059 int getMipMapped() const { return useMipMaps; }
00060
00061 void setBorderColor(float r, float g, float b, float a)
00062 {
00063 if (myBorderColor[0] != r || myBorderColor[1] != g ||
00064 myBorderColor[2] != b || myBorderColor[3] != a)
00065 {
00066 clearRenderIndex();
00067 myBorderColor[0] = r;
00068 myBorderColor[1] = g;
00069 myBorderColor[2] = b;
00070 myBorderColor[3] = a;
00071 }
00072 }
00073
00074
00075
00076
00077
00078
00079 int setMinFilter( RE_TexFiltType t );
00080 RE_TexFiltType getMinFilter() const { return myMinFilter; }
00081
00082 int setMagFilter( RE_TexFiltType t );
00083 RE_TexFiltType getMagFilter() const { return myMagFilter; }
00084
00085
00086 static int getFreeTextureIndex();
00087 static void defineTexture(int idx, TIL_Raster *rp);
00088 static void undefineTexture(int idx);
00089
00090
00091 private:
00092 void setMap(const TIL_Raster *raster = 0);
00093
00094 TIL_TextureMap *myMap;
00095 float myBorderColor[4];
00096 int myIndex;
00097
00098 RE_TexFiltType myMinFilter;
00099 RE_TexFiltType myMagFilter;
00100
00101 unsigned int iOwnMap :1,
00102 isClamped :1,
00103 useMipMaps:1,
00104 hasBorders:1;
00105 };
00106
00107 #endif