renamed many values and function's name.
This commit is contained in:
@@ -89,24 +89,6 @@ namespace hgl
|
||||
return(true);
|
||||
}
|
||||
|
||||
//template<typename T,IndexType IT>
|
||||
//T * CreateIBO(const uint count,const T *data=nullptr) ///<创建索引缓冲区
|
||||
//{
|
||||
// if(ibo)
|
||||
// return(nullptr);
|
||||
//
|
||||
// ibo=db->CreateIBO(IT,count,data);
|
||||
|
||||
// if(!ibo)
|
||||
// return(nullptr);
|
||||
|
||||
// return (T *)ibo->Map();
|
||||
//}
|
||||
|
||||
//uint8 * CreateIBO8 (uint count,const uint8 *data=nullptr){return CreateIBO<uint8 ,IndexType::U8 >(count,data);} ///<创建8位的索引缓冲区
|
||||
//uint16 * CreateIBO16(uint count,const uint16 *data=nullptr){return CreateIBO<uint16,IndexType::U16>(count,data);} ///<创建16位的索引缓冲区
|
||||
//uint32 * CreateIBO32(uint count,const uint32 *data=nullptr){return CreateIBO<uint32,IndexType::U32>(count,data);} ///<创建32位的索引缓冲区
|
||||
|
||||
virtual Primitive * Finish(const AnsiString &); ///<结束并创建可渲染对象
|
||||
};//class PrimitiveCreater
|
||||
}//namespace graph
|
||||
|
@@ -64,7 +64,8 @@ class IndexBuffer;
|
||||
struct IndexBufferAccess
|
||||
{
|
||||
IndexBuffer *buffer=nullptr;
|
||||
VkDeviceSize offset=0;
|
||||
VkDeviceSize start=0;
|
||||
VkDeviceSize count=0;
|
||||
};
|
||||
|
||||
using IBAccess=IndexBufferAccess;
|
||||
|
@@ -170,7 +170,7 @@ public:
|
||||
return(true);
|
||||
}
|
||||
|
||||
void BindIBO(const IBAccess *);
|
||||
// void BindIBO(const IBAccess *);
|
||||
|
||||
bool BindVBO(Renderable *);
|
||||
|
||||
@@ -192,8 +192,8 @@ public: //draw
|
||||
void Draw (const uint32_t vertex_count,const uint32_t instance_count) {vkCmdDraw(cmd_buf,vertex_count,instance_count,0,0);}
|
||||
void DrawIndexed (const uint32_t index_count ,const uint32_t instance_count) {vkCmdDrawIndexed(cmd_buf,index_count,instance_count,0,0,0);}
|
||||
|
||||
template<typename ...ARGS> void Draw (ARGS...args) {vkCmdDraw(cmd_buf,args...);}
|
||||
template<typename ...ARGS> void DrawIndexed (ARGS...args) {vkCmdDrawIndexed(cmd_buf,args...);}
|
||||
// template<typename ...ARGS> void Draw (ARGS...args) {vkCmdDraw(cmd_buf,args...);}
|
||||
// template<typename ...ARGS> void DrawIndexed (ARGS...args) {vkCmdDrawIndexed(cmd_buf,args...);}
|
||||
|
||||
void DrawIndirect (VkBuffer,VkDeviceSize, uint32_t drawCount,uint32_t stride=sizeof(VkDrawIndirectCommand ));
|
||||
void DrawIndexedIndirect(VkBuffer,VkDeviceSize, uint32_t drawCount,uint32_t stride=sizeof(VkDrawIndexedIndirectCommand ));
|
||||
@@ -201,6 +201,7 @@ public: //draw
|
||||
void DrawIndexedIndirect(VkBuffer buf, uint32_t drawCount,uint32_t stride=sizeof(VkDrawIndexedIndirectCommand )){return DrawIndexedIndirect( buf,0,drawCount,stride);}
|
||||
|
||||
void Draw (const VertexInputData *vid);
|
||||
void DrawIndexed (const IBAccess *iba,const uint32_t instance_count);
|
||||
|
||||
public: //dynamic state
|
||||
};//class RenderCmdBuffer:public GPUCmdBuffer
|
||||
|
@@ -16,7 +16,7 @@ class Primitive
|
||||
|
||||
protected:
|
||||
|
||||
uint32_t vertex_count;
|
||||
VkDeviceSize vertex_count;
|
||||
|
||||
VABAccessMap buffer_list;
|
||||
|
||||
@@ -30,7 +30,7 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
Primitive(GPUDevice *dev,const AnsiString &n,const uint32_t vc=0)
|
||||
Primitive(GPUDevice *dev,const AnsiString &n,const VkDeviceSize vc=0)
|
||||
{
|
||||
device=dev;
|
||||
prim_name=n;
|
||||
@@ -42,13 +42,13 @@ public:
|
||||
void SetBoundingBox(const AABB &aabb){BoundingBox=aabb;}
|
||||
const AABB & GetBoundingBox()const {return BoundingBox;}
|
||||
|
||||
bool Set(const AnsiString &name,VAB *vb,VkDeviceSize offset=0);
|
||||
bool SetVAB(const AnsiString &name,VAB *vb,VkDeviceSize start=0);
|
||||
|
||||
bool Set(IndexBuffer *ib,VkDeviceSize offset=0);
|
||||
bool SetIndex(IndexBuffer *ib,VkDeviceSize start,const VkDeviceSize index_count);
|
||||
|
||||
public:
|
||||
|
||||
const uint32_t GetVertexCount ()const {return vertex_count;}
|
||||
const VkDeviceSize GetVertexCount ()const {return vertex_count;}
|
||||
|
||||
bool GetVABAccess (const AnsiString &,VABAccess *);
|
||||
const int GetBufferCount ()const {return buffer_list.GetCount();}
|
||||
|
@@ -8,7 +8,7 @@ VK_NAMESPACE_BEGIN
|
||||
|
||||
struct PrimitiveData
|
||||
{
|
||||
uint32_t vertex_count;
|
||||
VkDeviceSize vertex_count;
|
||||
|
||||
uint32_t va_count;
|
||||
|
||||
|
@@ -11,13 +11,13 @@ class RenderablePrimitiveCreater
|
||||
{
|
||||
RenderResource *rr;
|
||||
|
||||
uint32_t vertex_count;
|
||||
VkDeviceSize vertex_count;
|
||||
|
||||
Primitive *prim;
|
||||
|
||||
public:
|
||||
|
||||
RenderablePrimitiveCreater(RenderResource *_rr,const AnsiString &name,uint32_t vc)
|
||||
RenderablePrimitiveCreater(RenderResource *_rr,const AnsiString &name,VkDeviceSize vc)
|
||||
{
|
||||
rr=_rr;
|
||||
vertex_count=vc;
|
||||
@@ -32,18 +32,18 @@ public:
|
||||
if(!vab)
|
||||
return(nullptr);
|
||||
|
||||
prim->Set(name,vab);
|
||||
prim->SetVAB(name,vab);
|
||||
return(vab);
|
||||
}
|
||||
|
||||
IndexBuffer *SetIBO(const IndexType &it,const void *buf,const uint32_t index_count)
|
||||
IndexBuffer *SetIndex(const IndexType &it,const void *buf,const VkDeviceSize index_count)
|
||||
{
|
||||
IndexBuffer *ibo=rr->CreateIBO(it,index_count,buf);
|
||||
|
||||
if(!ibo)
|
||||
return(nullptr);
|
||||
|
||||
prim->Set(ibo);
|
||||
prim->SetIndex(ibo,0,index_count);
|
||||
return(ibo);
|
||||
}
|
||||
|
||||
|
@@ -40,8 +40,7 @@ namespace hgl
|
||||
struct VABAccess
|
||||
{
|
||||
VAB *vab;
|
||||
VkDeviceSize offset;
|
||||
VkDeviceSize size;
|
||||
VkDeviceSize start;
|
||||
|
||||
void *map_ptr;
|
||||
|
||||
|
@@ -51,14 +51,14 @@ namespace hgl
|
||||
|
||||
/**
|
||||
* 取得数据区地址
|
||||
* @param offset 从第几个数据开始访问
|
||||
* @param start 从第几个数据开始访问
|
||||
* @return 访问地址
|
||||
*/
|
||||
T *Get(uint32_t offset=0)
|
||||
{
|
||||
if(!data||offset>=count)
|
||||
{
|
||||
LOG_HINT(OS_TEXT("VertexAttribDataAccess::Get() out,offset:")+OSString::numberOf(offset));
|
||||
LOG_HINT(OS_TEXT("VertexAttribDataAccess::Get() out,start:")+OSString::numberOf(offset));
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
@@ -67,14 +67,14 @@ namespace hgl
|
||||
|
||||
/**
|
||||
* 开始访问数据区
|
||||
* @param offset 从第几个数据开始访问
|
||||
* @param start 从第几个数据开始访问
|
||||
* @return 访问地址
|
||||
*/
|
||||
T *Begin(uint32_t offset=0)
|
||||
{
|
||||
if(access)
|
||||
{
|
||||
LOG_HINT(OS_TEXT("VertexAttribDataAccess::Begin() access!=0,offset:")+OSString::numberOf(offset));
|
||||
LOG_HINT(OS_TEXT("VertexAttribDataAccess::Begin() access!=0,start:")+OSString::numberOf(offset));
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user