00001
00009 #ifndef _TEXTURE_H_
00010 #define _TEXTURE_H_
00011 #include "mat.h"
00012
00014 enum TGAtypes{COMPRESSED,UNCOMPRESSED};
00015
00019 class Texture
00020 {
00021 private:
00022 int textype;
00023 string texname;
00024
00025 GLubyte *imageData;
00026 GLuint width, height, bpp;
00027 GLuint texID;
00028 int texmode;
00029 GLfloat tileX,tileY;
00030
00031 GLint texLoc, tileXLoc, tileYLoc, texMatrixloc, intensityLoc;
00032
00033 TMatrix texMatrix;
00034
00035 public:
00037 GLfloat intensity;
00038
00039 Texture();
00040 ~Texture();
00041
00043 void SetName(string name)
00044 { texname = name; }
00046 string GetName()
00047 { return texname; }
00048
00049
00050 GLint Load(const char *_texname, int _textype, const char *filename, int _texmode,
00051 GLfloat _intensity, GLfloat _tileX, GLfloat _tileY, bool mipmap, bool aniso, GLint cache);
00052
00053
00054 GLint Load(const char *_texname, int _textype, const char **cube_files,
00055 int _texmode, GLfloat _intensity, GLfloat _tileX, GLfloat _tileY, bool aniso, GLint cache);
00056
00057
00058 bool LoadTGA(const char *filename);
00059
00061 bool Empty()
00062 { return (texID == 0); }
00063
00064
00065 void ActivateTexture(GLint tex_unit, bool set_uniforms = false);
00066
00067 void GetUniforms(GLuint shader);
00068
00070 void SetShadowMatrix(TMatrix t)
00071 { texMatrix = t; }
00073 void SetIntensity(GLfloat _intensity)
00074 { intensity = _intensity; }
00076 void SetID(GLuint id)
00077 { texID = id; }
00079 void SetType(int type)
00080 { textype = type; }
00081
00083 GLuint GetID()
00084 { return texID; }
00086 int GetType()
00087 { return textype; }
00089 int GetMode()
00090 { return texmode; }
00092 bool HasTiles()
00093 { return (tileX > 1 || tileY > 1); }
00094 };
00095
00096 #endif