OK! Can RUN! full OK!...next step is to create VDMRender in MaterialRenderList
This commit is contained in:
@@ -24,11 +24,11 @@ private:
|
||||
struct RenderItem
|
||||
{
|
||||
uint32_t first;
|
||||
uint32_t count;
|
||||
uint32_t instance_count;
|
||||
|
||||
Pipeline * pipeline;
|
||||
MaterialInstance * mi;
|
||||
const PrimitiveDataBuffer * prb;
|
||||
const PrimitiveDataBuffer * pdb;
|
||||
const PrimitiveRenderData * prd;
|
||||
|
||||
public:
|
||||
@@ -43,10 +43,10 @@ private:
|
||||
|
||||
protected:
|
||||
|
||||
VABList * vbo_list;
|
||||
VABList * vab_list;
|
||||
|
||||
Pipeline * last_pipeline;
|
||||
const PrimitiveDataBuffer * last_render_buf;
|
||||
const PrimitiveDataBuffer * last_data_buffer;
|
||||
const PrimitiveRenderData * last_render_data;
|
||||
|
||||
bool BindVAB(const PrimitiveDataBuffer *,const uint);
|
||||
|
@@ -22,9 +22,11 @@ protected:
|
||||
|
||||
AnsiString prim_name;
|
||||
PrimitiveData * prim_data;
|
||||
|
||||
|
||||
uint32_t vertices_number; ///<顶点数量
|
||||
|
||||
void_pointer *map_ptr_list; ///<映射指针列表
|
||||
|
||||
uint32_t index_number; ///<索引数量
|
||||
IndexType index_type; ///<索引类型
|
||||
IndexBuffer * ibo; ///<索引缓冲区
|
||||
@@ -127,10 +129,10 @@ template<typename T> class VABMap
|
||||
|
||||
public:
|
||||
|
||||
VABMap(PrimitiveCreater *pc,const AnsiString &name)
|
||||
VABMap(PrimitiveCreater *c,const AnsiString &name)
|
||||
{
|
||||
pc=c;
|
||||
vab_index=pc->GetVABIndex(name,T::GetVulkanFormat(),nullptr);
|
||||
vab_index=pc->GetVABIndex(name,T::GetVulkanFormat());
|
||||
|
||||
void *map_ptr=(T *)(pc->MapVAB(vab_index));
|
||||
|
||||
@@ -148,7 +150,7 @@ public:
|
||||
|
||||
~VABMap()
|
||||
{
|
||||
if(vab)
|
||||
if(pc&&vab_index>=0)
|
||||
pc->UnmapVAB(vab_index);
|
||||
}
|
||||
|
||||
|
@@ -174,9 +174,9 @@ public:
|
||||
return(true);
|
||||
}
|
||||
|
||||
void BindIBO(IBAccess *);
|
||||
void BindIBO(IndexBuffer *,const VkDeviceSize byte_offset=0);
|
||||
|
||||
bool BindVAB(Renderable *);
|
||||
bool BindRenderBuffer(const PrimitiveDataBuffer *);
|
||||
|
||||
void SetViewport (uint32_t first,uint32_t count,const VkViewport *vp) {vkCmdSetViewport(cmd_buf,first,count,vp);}
|
||||
void SetScissor (uint32_t first,uint32_t count,const VkRect2D *sci) {vkCmdSetScissor(cmd_buf,first,count,sci);}
|
||||
@@ -213,8 +213,7 @@ public: //draw
|
||||
void DrawIndirect (VkBuffer buf, uint32_t drawCount,uint32_t stride=sizeof(VkDrawIndirectCommand )){return DrawIndirect( buf,0,drawCount,stride);}
|
||||
void DrawIndexedIndirect(VkBuffer buf, uint32_t drawCount,uint32_t stride=sizeof(VkDrawIndexedIndirectCommand )){return DrawIndexedIndirect( buf,0,drawCount,stride);}
|
||||
|
||||
void Draw (const PrimitiveDataBuffer *prb,const PrimitiveRenderData *prd);
|
||||
// void DrawIndexed (const IBAccess *iba,const uint32_t instance_count);
|
||||
void Draw (const PrimitiveDataBuffer *prb,const PrimitiveRenderData *prd,const uint32_t instance_count=1,const uint32_t first_instance=0);
|
||||
|
||||
public: //dynamic state
|
||||
};//class RenderCmdBuffer:public GPUCmdBuffer
|
||||
|
@@ -33,10 +33,14 @@ public:
|
||||
|
||||
const VkDeviceSize GetVertexCount ()const;
|
||||
const int GetVABCount ()const;
|
||||
const int GetVABIndex (const AnsiString &name)const;
|
||||
VAB * GetVAB (const int);
|
||||
VAB * GetVAB (const AnsiString &name){return GetVAB(GetVABIndex(name));}
|
||||
const int32_t GetVertexOffset ()const; ///<取得顶点偏移(注意是顶点不是字节)
|
||||
|
||||
VABAccess * GetVABAccess (const AnsiString &);
|
||||
|
||||
const uint32_t GetIndexCount ()const;
|
||||
IndexBuffer * GetIBO ();
|
||||
const uint32_t GetFirstIndex ()const; ///<取得第一个索引
|
||||
|
||||
const AABB & GetBoundingBox ()const{return BoundingBox;}
|
||||
};//class Primitive
|
||||
|
@@ -31,10 +31,10 @@ struct PrimitiveDataBuffer
|
||||
|
||||
public:
|
||||
|
||||
PrimitiveDataBuffer(const uint32_t,const uint32_t, IndexBuffer *);
|
||||
PrimitiveDataBuffer(const uint32_t,IndexBuffer *);
|
||||
~PrimitiveDataBuffer();
|
||||
|
||||
const bool Comp(const PrimitiveDataBuffer *prb)const;
|
||||
const bool Comp(const PrimitiveDataBuffer *pdb)const;
|
||||
};//struct PrimitiveDataBuffer
|
||||
|
||||
/**
|
||||
@@ -43,19 +43,27 @@ public:
|
||||
*/
|
||||
struct PrimitiveRenderData
|
||||
{
|
||||
uint vab_count;
|
||||
uint32_t vertex_count;
|
||||
uint32_t index_count;
|
||||
//因为要VAB是流式访问,所以我们这个结构会被用做排序依据
|
||||
//也因此,把vertex_offset放在最前面
|
||||
|
||||
int32_t vertex_offset; //注意:这里的offset是相对于vertex的,代表第几个顶点,不是字节偏移
|
||||
uint32_t first_index;
|
||||
|
||||
uint32_t vertex_count;
|
||||
uint32_t index_count;
|
||||
|
||||
public:
|
||||
|
||||
PrimitiveRenderData(const uint32_t bc,const uint32_t vc);
|
||||
~PrimitiveRenderData();
|
||||
PrimitiveRenderData(const uint32_t vc,const uint32_t ic,const int32_t vo=0,const uint32_t fi=0)
|
||||
{
|
||||
vertex_count =vc;
|
||||
index_count =ic;
|
||||
vertex_offset =vo;
|
||||
first_index =fi;
|
||||
}
|
||||
|
||||
const bool Comp(const PrimitiveRenderData *)const;
|
||||
CompOperatorMemcmp(const PrimitiveRenderData &);
|
||||
CompOperatorMemcmpPointer(PrimitiveRenderData);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -95,8 +103,8 @@ public:
|
||||
Primitive * GetPrimitive (){return primitive;}
|
||||
const AABB & GetBoundingBox ()const{return primitive->GetBoundingBox();}
|
||||
|
||||
const PrimitiveDataBuffer * GetRenderBuffer ()const{return primitive_data_buffer;}
|
||||
const PrimitiveRenderData * GetRenderData ()const{return primitive_render_data;}
|
||||
const PrimitiveDataBuffer *GetRenderBuffer ()const{return primitive_data_buffer;}
|
||||
const PrimitiveRenderData *GetRenderData ()const{return primitive_render_data;}
|
||||
};//class Renderable
|
||||
|
||||
Renderable *CreateRenderable(Primitive *,MaterialInstance *,Pipeline *);
|
||||
|
Reference in New Issue
Block a user