00001 #pragma once
00002
00003 #ifndef __GV_H__
00004 #include "gv.h"
00005 #endif
00006
00007 #include "loadbmp.h"
00008 #include "gm_grp_driver.h"
00009
00010 extern gm_grp_driver* g_pgrpdriver;
00011
00012
00013 class gm_texture_list
00014 {
00015
00016 };
00017 typedef struct _compressed_info
00018 {
00019 unsigned char* src;
00020 unsigned long srcLen;
00021 } compressed_info;
00022
00023 typedef struct _gm_texture_info
00024 {
00025 int w;
00026 int h;
00027 int bpp;
00028 void* tex_handle;
00029 compressed_info compressedinfo;
00030 int nref;
00031 } gm_texture_info;
00032
00033
00034 extern unsigned long g_textureMemoryAllocSize;
00035 extern unsigned long g_textureMemoryAllocCompressedSize;
00036
00037
00038
00039 class gm_texture_avi
00040 {
00041 public:
00042
00043 bool m_bAlpha;
00044 float m_fFps;
00045 int m_nLoopCount;
00046
00047 gm_texture_avi(void)
00048 {
00049 m_bAlpha=false;
00050 m_fFps=12.0f;
00051 m_nLoopCount=0;
00052 }
00053 ~gm_texture_avi(void)
00054 {
00055 }
00056 void stop(void)
00057 {
00058 }
00059 void play(int nloop)
00060 {
00061
00062 }
00063 bool IsPlaying(void)
00064 {
00065 return true;
00066 }
00067 };
00068
00069 class gv_texture_atm
00070 {
00071 public:
00072 bool bCompressed;
00073 int nf;
00074 int nw;
00075 int nh;
00076 int ba;
00077 int skipFirst;
00078 typedef struct _pair_frameinfo
00079 {
00080 unsigned long i_start;
00081 unsigned long i_end;
00082 } pair_frameinfo;
00083
00084 geArray<pair_frameinfo> m_frameinfo;
00085 FILE* m_fp;
00086 gv_texture_atm(void);
00087 ~gv_texture_atm(void);
00088 void Set(int w, int h, int nframe, int balpha, bool bCompress);
00089 void AddFrame(unsigned long lstart, unsigned long lend);
00090
00091 void GetFrameData(int iFrame, unsigned long& s, unsigned long& e);
00092 };
00093
00094 class gm_texture
00095 {
00096 private:
00097 gm_texture_info* m_tex_handle_info;
00098
00099 static std::map<gvStringc, gm_texture_info* > texturehandleMap;
00100
00101 geArray<gm_texture_info*> m_pTexList;
00102
00103
00104
00105 public:
00106
00107
00108 bool mLocalCacheCompressed;
00109 bool mbAbleBind;
00110
00111 bool m_bAlpha;
00112 bool m_bIsAnimationTexture;
00113 bool m_bAvi;
00114 int m_nLoop;
00115 bool m_bLoopEndFirst;
00116 int m_iCurFrame;
00117 float m_fDelayTime;
00118 float m_fFPS;
00119
00120 float m_fOldTime;
00121 int m_iOldCurFrame;
00122 int m_iStartFrame;
00123 int m_iEndFrame;
00124 int m_iTotalFrame;
00125
00126
00127 int bpp;
00128 char m_szTexID[128];
00129 bool m_bIsLoaded;
00130 gm_texture_avi* m_pAviTexture;
00131
00132 int m_w;
00133 int m_h;
00134
00135 simple_vector4 tex_mul;
00136 gm_texture(void);
00137 ~gm_texture(void);
00138 void EnableCache(bool bflag=true);
00139 bool Charge(void);
00140 bool UnCharge(void);
00141
00142 void unload(void);
00143
00144 static gm_texture_info* texturehandleMapFind(char* szFileName);
00145 static void texturehandleMapSet(char* szFileName,gm_texture_info* pHandle);
00146 static void texturehandleMapClear(void);
00147 static bool textureandleMapRemove(char* szFileName);
00148 static bool textureandleMapRemove(gm_texture_info* p);
00149
00150 bool LoadTexture(char* szFileName, bool bCompressCache=false);
00151
00152 bool LoadAniTexture(char* szFileName);
00153 bool create(int wsize,int hsize,char* szFileName);
00154 gm_texture_info* create_internal(int& wsize, int& hsize,char* szFileName);
00155
00156 void* GetTexDX9(void);
00157 void* GetTexFirstFrame(void);
00158 bool bindtexFirstFrame(void);
00159 bool bindtex(void);
00160 void resetStop(void);
00161
00162 bool bind(void);
00163 void SetAniFrameRange(int na, int nb);
00164
00165 gv_texture_atm* m_pATM;
00166 long MovieFirstSeek;
00167 bool m_bMovieGenerated;
00168
00169 int MakeMovie(void);
00170 };
00171
00172