00001
00002 #ifndef RC_TEXTURE_H
00003 #define RC_TEXTURE_H
00004
00005
00006
00010 class Texture : public Resource {
00011
00012 friend class SceneGraph;
00013
00014 friend class Renderer;
00015 #ifdef RC_OPENGL
00016 friend class RendererGL;
00017 #endif
00018
00019 friend class Uniform;
00020
00021
00022
00023 private:
00024 Texture(
00025 const char *nidentifier,
00026
00027 TextureFormat_t nformat,
00028
00029 u32 nwidth,
00030 u32 nheight,
00031
00032 TextureFilter_t filter,
00033 TextureWrap_t wrap
00034 );
00035
00036 Texture(
00037 const char *nidentifier,
00038 const char *filename,
00039
00040 bool generate_mipmaps,
00041 TextureFilter_t filter,
00042 TextureWrap_t wrap
00043 );
00044
00050 Texture(
00051 const char *nidentifier,
00052 u8 *pixels,
00053
00054 TextureFormat_t nformat,
00055
00056 u32 nwidth,
00057 u32 nheight,
00058
00059 bool generate_mipmaps,
00060
00061 TextureFilter_t filter,
00062 TextureWrap_t wrap
00063 );
00064
00065 ~Texture();
00066
00067 public:
00068 bool hasMipMaps() { return hasMipmaps; }
00069
00070 u32 getWidth() { return width; }
00071
00072 u32 getHeight() { return height; }
00073
00074 TextureFormat_t getFormat() { return format; }
00075
00076
00077
00078
00079
00080 static void setTexture(
00081 Texture **target_tex,
00082 Texture *new_tex,
00083 bool instantiate_resource = true
00084 );
00085
00086 static void setTexture(
00087 Texture **target_tex,
00088 const char *nidentifier,
00089 const char *filename
00090 );
00091
00092 public:
00093
00094 void *getHandle();
00095
00096 void setHandle(
00097 void *nhandle
00098 );
00099
00100 #ifdef DEBUG
00101 protected:
00102 void print(
00103 FILE *f
00104 );
00105 #endif
00106
00107
00108
00109 private:
00110 TextureFormat_t format;
00111 u32 width;
00112 u32 height;
00113
00114 bool hasMipmaps;
00115
00116 void *handle;
00117
00118
00119 };
00120
00121 #endif
00122