delete useless param in TileData. because the Vulkan don't support pixel format convert.
This commit is contained in:
parent
2b218861e5
commit
9d9dd30416
@ -13,7 +13,7 @@ namespace hgl
|
||||
* TileData是一种处理大量等同尺寸及格式贴图的管理机制,程序会自动根据显卡最大贴图处理能力来创建尽可能符合需求的贴图。(注:Tile的大小不必符合2次幂)
|
||||
* Tile的增加或删除,程序会自动排序,尽可能小的减少I/O消耗。
|
||||
*/
|
||||
class TileData ///Tile纹理管理
|
||||
class TileData ///Tile纹理管理
|
||||
{
|
||||
Device *device;
|
||||
|
||||
@ -30,43 +30,42 @@ namespace hgl
|
||||
|
||||
protected:
|
||||
|
||||
vulkan::Buffer *tile_buffer; ///<Tile暂存缓冲区
|
||||
vulkan::Buffer *tile_buffer; ///<Tile暂存缓冲区
|
||||
|
||||
Texture2D *tile_texture; ///<TileData所用的纹理对象
|
||||
Texture2D *tile_texture; ///<TileData所用的纹理对象
|
||||
|
||||
TileData::Object **tile_object; ///<所有的Tile对象
|
||||
TileData::Object **tile_object; ///<所有的Tile对象
|
||||
|
||||
uint tile_width,tile_height; ///<Tile的宽和高
|
||||
uint32_t tile_bytes; ///<一个tile字节数
|
||||
uint tile_count,tile_max_count; ///<当前Tile数量与最大数量
|
||||
uint tile_rows,tile_cols; ///<贴图中可用的Tile行数和列数
|
||||
uint tile_width,tile_height; ///<Tile的宽和高
|
||||
uint32_t tile_bytes; ///<一个tile字节数
|
||||
uint tile_count,tile_max_count; ///<当前Tile数量与最大数量
|
||||
uint tile_rows,tile_cols; ///<贴图中可用的Tile行数和列数
|
||||
|
||||
protected:
|
||||
|
||||
int FindSpace(); ///<寻找一个空位
|
||||
void WriteTile( const int,TileData::Object *,
|
||||
const void *,const uint,const VkFormat,const int,const int); ///<写入一个Tile数据
|
||||
int FindSpace(); ///<寻找一个空位
|
||||
void WriteTile(const int,TileData::Object *,const void *,const uint,const int,const int); ///<写入一个Tile数据
|
||||
|
||||
public:
|
||||
|
||||
int GetWidth ()const{return tile_width;} ///<取得Tile宽
|
||||
int GetHeight ()const{return tile_height;} ///<取得Tile高
|
||||
int GetCount ()const{return tile_count;} ///<取得Tile数量
|
||||
int GetMaxCount ()const{return tile_max_count;} ///<取得Tile最大数量
|
||||
int GetFreeCount()const{return tile_max_count-tile_count;} ///<取得空余Tile数量
|
||||
int GetWidth ()const{return tile_width;} ///<取得Tile宽
|
||||
int GetHeight ()const{return tile_height;} ///<取得Tile高
|
||||
int GetCount ()const{return tile_count;} ///<取得Tile数量
|
||||
int GetMaxCount ()const{return tile_max_count;} ///<取得Tile最大数量
|
||||
int GetFreeCount()const{return tile_max_count-tile_count;} ///<取得空余Tile数量
|
||||
|
||||
Texture2D * GetTexture ()const{return tile_texture;} ///<取得贴图
|
||||
Texture2D * GetTexture ()const{return tile_texture;} ///<取得贴图
|
||||
|
||||
public:
|
||||
|
||||
TileData(Device *,Texture2D *,const uint tw,const uint th);
|
||||
virtual ~TileData();
|
||||
|
||||
TileData::Object *Add(const void *,const uint,const VkFormat,const int=-1,const int=-1); ///<增加一个Tile
|
||||
// TileData::Object *Add(Bitmap2D *,int=-1,int=-1); ///<增加一个Tile
|
||||
TileData::Object *Add(const void *,const uint,const int=-1,const int=-1); ///<增加一个Tile
|
||||
// TileData::Object *Add(Bitmap2D *,int=-1,int=-1); ///<增加一个Tile
|
||||
|
||||
bool Delete(TileData::Object *); ///<删除一个Tile
|
||||
bool Change(TileData::Object *,const void *,const uint,const VkFormat,const int=-1,const int=-1); ///<更改一个Tile的数据内容
|
||||
bool Change(TileData::Object *,const void *,const uint,const int=-1,const int=-1); ///<更改一个Tile的数据内容
|
||||
void Clear(); ///<清除Tile数据
|
||||
};//class TileData
|
||||
}//namespace graph
|
||||
|
@ -51,7 +51,7 @@ namespace hgl
|
||||
return(-1);
|
||||
}
|
||||
|
||||
void TileData::WriteTile(const int index,TileData::Object *obj,const void *data,const uint bytes,const VkFormat format,int ctw,int cth)
|
||||
void TileData::WriteTile(const int index,TileData::Object *obj,const void *data,const uint bytes,int ctw,int cth)
|
||||
{
|
||||
int col,row;
|
||||
double left,top;
|
||||
@ -101,12 +101,11 @@ namespace hgl
|
||||
* 增加一个Tile
|
||||
* @param data 图形原始数据
|
||||
* @param bytes 图形原始数据字节数
|
||||
* @param format 图形的色彩格式
|
||||
* @param ctw 当前tile宽度,-1表示等同全局设置
|
||||
* @param cth 当前tile高度,-1表示等同全局设置
|
||||
* @return 为增加的Tile创建的对象
|
||||
*/
|
||||
TileData::Object *TileData::Add(const void *data,const uint bytes,const VkFormat format,const int ctw,const int cth)
|
||||
TileData::Object *TileData::Add(const void *data,const uint bytes,const int ctw,const int cth)
|
||||
{
|
||||
if(!tile_object)return(nullptr);
|
||||
|
||||
@ -121,7 +120,7 @@ namespace hgl
|
||||
|
||||
TileData::Object *obj=new TileData::Object;
|
||||
|
||||
WriteTile(index,obj,data,bytes,format,ctw,cth);
|
||||
WriteTile(index,obj,data,bytes,ctw,cth);
|
||||
|
||||
tile_count++;
|
||||
return(obj);
|
||||
@ -165,12 +164,11 @@ namespace hgl
|
||||
* @param obj 要更改的Tile的对象指针
|
||||
* @param data 图形原始数据
|
||||
* @param bytes 图形原始数据字节数
|
||||
* @param format 图形的色彩格式
|
||||
* @param ctw 当前tile宽度,-1表示等同全局设置
|
||||
* @param cth 当前tile高度,-1表示等同全局设置
|
||||
* @return 更改是否成功
|
||||
*/
|
||||
bool TileData::Change(TileData::Object *obj,const void *data,const uint bytes,const VkFormat format,const int ctw,const int cth)
|
||||
bool TileData::Change(TileData::Object *obj,const void *data,const uint bytes,const int ctw,const int cth)
|
||||
{
|
||||
if(!tile_object)return(false);
|
||||
|
||||
@ -183,7 +181,7 @@ namespace hgl
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTile(obj->index,obj,data,bytes,format,ctw,cth);
|
||||
WriteTile(obj->index,obj,data,bytes,ctw,cth);
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user