Change the params name of VKPhysicalDevice::GetPointSize
This commit is contained in:
parent
0cb5c45d2a
commit
3e0a170505
@ -104,11 +104,11 @@ public:
|
||||
|
||||
const uint32_t GetMaxColorAttachments ()const{return properties.limits.maxColorAttachments;}
|
||||
|
||||
const void GetPointSize(float &granularity,float &min_point,float &max_point)
|
||||
const void GetPointSize(float &granularity,float &min_size,float &max_size)
|
||||
{
|
||||
granularity =properties.limits.pointSizeGranularity;
|
||||
min_point =properties.limits.pointSizeRange[0];
|
||||
max_point =properties.limits.pointSizeRange[1];
|
||||
min_size =properties.limits.pointSizeRange[0];
|
||||
max_size =properties.limits.pointSizeRange[1];
|
||||
}
|
||||
|
||||
const void GetLineWidth(float &granularity,float &min_width,float &max_width)
|
||||
|
@ -1,12 +1,16 @@
|
||||
#include<hgl/graph/TileData.h>
|
||||
#include<hgl/log/LogInfo.h>
|
||||
#include<hgl/graph/vulkan/VKDevice.h>
|
||||
#include<hgl/graph/vulkan/VKBuffer.h>
|
||||
|
||||
namespace hgl
|
||||
{
|
||||
namespace graph
|
||||
{
|
||||
TileData::TileData(Texture2D *tt,const uint tw,const uint th)
|
||||
TileData::TileData(Device *dev,Texture2D *tt,const uint tw,const uint th)
|
||||
{
|
||||
device=dev;
|
||||
|
||||
tile_texture=tt;
|
||||
|
||||
tile_width=tw;
|
||||
@ -19,10 +23,15 @@ namespace hgl
|
||||
tile_count=0;
|
||||
|
||||
NEW_NULL_ARRAY(tile_object,TileData::Object *,tile_max_count);
|
||||
|
||||
tile_bytes=tile_width*tile_height*GetStrideByFormat(tile_texture->GetFormat());
|
||||
|
||||
tile_buffer=device->CreateBuffer(VK_BUFFER_USAGE_TRANSFER_SRC_BIT,tile_bytes,nullptr);
|
||||
}
|
||||
|
||||
TileData::~TileData()
|
||||
{
|
||||
SAFE_CLEAR(tile_buffer);
|
||||
SAFE_CLEAR(tile_texture);
|
||||
SAFE_CLEAR_OBJECT_ARRAY(tile_object,tile_max_count);
|
||||
}
|
||||
@ -42,7 +51,7 @@ namespace hgl
|
||||
return(-1);
|
||||
}
|
||||
|
||||
void TileData::WriteTile(int index,TileData::Object *obj,void *data,uint bytes,VkFormat format,int ctw,int cth)
|
||||
void TileData::WriteTile(const int index,TileData::Object *obj,const void *data,const uint bytes,const VkFormat format,int ctw,int cth)
|
||||
{
|
||||
int col,row;
|
||||
double left,top;
|
||||
@ -65,13 +74,15 @@ namespace hgl
|
||||
|
||||
tile_object[index]=obj;
|
||||
|
||||
//tile_texture->ChangeImage( left,
|
||||
// top,
|
||||
// tile_width,
|
||||
// tile_height,
|
||||
// data,
|
||||
// bytes,
|
||||
// format);
|
||||
tile_buffer->Write(data,0,bytes);
|
||||
|
||||
device->ChangeTexture2D(tile_texture,
|
||||
tile_buffer,
|
||||
left,
|
||||
top,
|
||||
tile_width,
|
||||
tile_height);
|
||||
|
||||
//请保留这段代码,以便未来使用时该数据时不会使用
|
||||
//{
|
||||
// vertex->Begin(index*6);
|
||||
@ -84,5 +95,121 @@ namespace hgl
|
||||
// vertex->End();
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 增加一个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)
|
||||
{
|
||||
if(!tile_object)return(nullptr);
|
||||
|
||||
int index;
|
||||
|
||||
index=FindSpace();
|
||||
if(index==-1)
|
||||
{
|
||||
LOG_PROBLEM(OS_TEXT("找不到空的Tile数据区!"));
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
TileData::Object *obj=new TileData::Object;
|
||||
|
||||
WriteTile(index,obj,data,bytes,format,ctw,cth);
|
||||
|
||||
tile_count++;
|
||||
return(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除一个Tile
|
||||
* @param obj 要删除的Tile的对象指针
|
||||
* @return 删除是否成功
|
||||
*/
|
||||
bool TileData::Delete(TileData::Object *obj)
|
||||
{
|
||||
if(!tile_object)return(false);
|
||||
|
||||
if(tile_object[obj->index])
|
||||
{
|
||||
if(tile_object[obj->index]!=obj)
|
||||
{
|
||||
LOG_PROBLEM(OS_TEXT("要删除的TileData::Object和TileData中的不对应!"));
|
||||
return(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
tile_object[obj->index]=nullptr;
|
||||
tile_count--;
|
||||
|
||||
delete obj;
|
||||
|
||||
return(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_PROBLEM(OS_TEXT("要删除的TileData::Object对象在TileData中不存在!"));
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改一个Tile的数据内容
|
||||
* @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)
|
||||
{
|
||||
if(!tile_object)return(false);
|
||||
|
||||
if(tile_object[obj->index])
|
||||
{
|
||||
if(tile_object[obj->index]!=obj)
|
||||
{
|
||||
LOG_PROBLEM(OS_TEXT("要更改的TileData::Object和TileData中的不对应!"));
|
||||
return(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTile(obj->index,obj,data,bytes,format,ctw,cth);
|
||||
|
||||
return(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_PROBLEM(OS_TEXT("要更改的TileData::Object对象在TileData中不存在!"));
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除所有Tile数据
|
||||
*/
|
||||
void TileData::Clear()
|
||||
{
|
||||
if(!tile_object)return;
|
||||
|
||||
int n=tile_max_count;
|
||||
|
||||
while(n--)
|
||||
if(tile_object[n])
|
||||
{
|
||||
delete tile_object[n];
|
||||
tile_object[n]=nullptr;
|
||||
}
|
||||
}
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
|
Loading…
x
Reference in New Issue
Block a user