optimized_texture.h
资源名称:hge181.rar [点击查看]
上传用户:jnfxsk
上传日期:2022-06-16
资源大小:3675k
文件大小:1k
源码类别:
游戏引擎
开发平台:
Visual C++
- #ifndef OPTIMIZED_TEXTURE_H
- #define OPTIMIZED_TEXTURE_H
- #include "texasm.h"
- #include "gfx_object.h"
- #include "RectPlacement.h"
- bool Write32BitPNGWithPitch(FILE* fp, void* pBits, bool bNeedAlpha, int nWidth, int nHeight, int nPitch);
- struct CColor
- {
- unsigned char r;
- unsigned char g;
- unsigned char b;
- unsigned char a;
- };
- class COptimizedTexture
- {
- public:
- COptimizedTexture();
- ~COptimizedTexture() { Reset(); }
- void Reset();
- void SetMaxSize(int w, int h) { maxw = w; maxh = h; }
- void SetMargin(int margin) { placer.SetMargin(margin); }
- bool PlaceObject(CGfxObject *obj);
- void AddNoTextureObject(CGfxObject *obj);
- int GetNumPlaced() { return obj_list.size(); }
- bool Create();
- bool CopyData();
- bool OptimizeAlpha();
- bool Save(char *filename);
- bool SaveDescriptions(char *resfile, char *texfile, char *texname);
- private:
- int maxw;
- int maxh;
- GfxObjList obj_list;
- CRectPlacement placer;
- int texw;
- int texh;
- HTEXTURE tex;
- CColor *tex_data;
- int pitch;
- };
- #endif