00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 class pgRend;
00033 class pgPrim;
00034 class pgSprt;
00035 class pgScr;
00036 class pgDrawMgr;
00037
00038
00043 class PG_API pgTex
00044 {
00045 friend class pgRend;
00046 friend class pgPrim;
00047 friend class pgSprt;
00048 friend class pgScr;
00049 friend class pgDrawMgr;
00050
00051 public:
00052 pgDefineException(ExceptionInvalidArgument);
00053 pgDefineException(ExceptionInvalidCall);
00054 pgDefineException(ExceptionVolatileTextureUploaded);
00055
00056 enum TexFormat
00057 {
00058 FORMAT_RGB,
00059 FORMAT_RGBA,
00060 FORMAT_ALPHA,
00061
00062 FORMAT_PNG_RGB,
00063 FORMAT_PNG_RGBA,
00064 FORMAT_PNG_ALPHA
00065 };
00066
00067 enum TexMode
00068 {
00069 MODE_READ_ONLY,
00070 MODE_READ_WRITE,
00071 MODE_FRAMEBUFFER,
00072 MODE_VOLATILE
00073 };
00074
00075 pgTex* getPrevN() const;
00076 pgTex* getNextN() const;
00077
00078 pgID getID() const;
00079 u16 getWidth() const;
00080 u16 getHeight() const;
00081 TexFormat getFormat() const;
00082 TexMode getMode() const;
00083 const void* getImage() const;
00084 u32 getImageSize() const;
00085
00086 void* editImage();
00087 void clearImage(pgCol col);
00088 void resizeImage(u16 width, u16 height);
00089
00090 void setVolatile();
00091
00092 pgID getProxyTextureID() const;
00093 void setProxyTextureID(pgID tex_id);
00094
00095 private:
00096 enum TexFlag
00097 {
00098 FLAG_UPLOAD,
00099 FLAG_UV_ADJUST
00100 };
00101
00102 pgTex(pgID tex_id, u16 width, u16 height, TexFormat format, TexMode mode, const void* image, u32 image_size);
00103 ~pgTex();
00104 void operator=(const pgTex&);
00105
00106 u32 getTexObj();
00107 void expandAndRegisterTexture_ptx();
00108 void expandAndRegisterTexture_png();
00109
00110 pgID m_id;
00111 u16 m_width;
00112 u16 m_height;
00113 pgType<u8, TexFormat> m_format;
00114 pgType<u8, TexMode> m_mode;
00115 pgFlag<u8, TexFlag> m_flag;
00116 const void* m_image;
00117 u32 m_image_size;
00118 u32 m_tex_obj;
00119 r32 m_u_param_a;
00120 r32 m_u_param_b;
00121 r32 m_v_param_a;
00122 r32 m_v_param_b;
00123 pgTex* m_proxy_tex;
00124 };