using IBAccess=IndexBufferAccess

This commit is contained in:
hyzboy 2024-04-27 00:05:25 +08:00
parent 6dba761a80
commit bbf94767fe
9 changed files with 19 additions and 21 deletions

View File

@ -8,11 +8,7 @@ namespace hgl
namespace graph
{
class Renderable;
class Material;
class MaterialInstance;
class GPUDevice;
struct VertexInputData;
struct IndexBufferAccess;
struct RenderNode
{

View File

@ -67,6 +67,8 @@ struct IndexBufferAccess
VkDeviceSize offset=0;
};
using IBAccess=IndexBufferAccess;
class GPUCmdBuffer;
class RenderCmdBuffer;
class TextureCmdBuffer;

View File

@ -170,7 +170,7 @@ public:
return(true);
}
void BindIBO(const IndexBufferAccess *);
void BindIBO(const IBAccess *);
bool BindVBO(Renderable *);

View File

@ -20,7 +20,7 @@ protected:
VABAccessMap buffer_list;
IndexBufferAccess ib_access;
IBAccess ib_access;
AABB BoundingBox;
@ -53,7 +53,7 @@ public:
bool GetVABAccess (const AnsiString &,VABAccess *);
const int GetBufferCount ()const {return buffer_list.GetCount();}
const IndexBufferAccess * GetIndexBufferAccess()const {return &ib_access;}
const IBAccess * GetIBAccess ()const {return &ib_access;}
};//class Primitive
VK_NAMESPACE_END
#endif//HGL_GRAPH_VULKAN_PRIMITIVE_INCLUDE

View File

@ -14,9 +14,9 @@ struct PrimitiveData
VABAccess *vab_list;
IndexBufferAccess ib_access;
IBAccess ib_access;
AABB BoundingBox;
};
};//struct PrimitiveData
VK_NAMESPACE_END

View File

@ -17,11 +17,11 @@ struct VertexInputData
uint32_t vertex_count;
const IndexBufferAccess *ib_access;
const IBAccess *ib_access;
public:
VertexInputData(const uint32_t,const uint32_t,const IndexBufferAccess *);
VertexInputData(const uint32_t,const uint32_t,const IBAccess *);
~VertexInputData();
const bool Comp(const VertexInputData *vid)const

View File

@ -256,13 +256,13 @@ void MaterialRenderList::Render(RenderItem *ri)
last_vid=ri->vid;
}
const IndexBufferAccess *ibd=last_vid->ib_access;
const IBAccess *iba=last_vid->ib_access;
if(ibd->buffer)
if(iba->buffer)
{
cmd_buf->BindIBO(ibd);
cmd_buf->BindIBO(iba);
cmd_buf->DrawIndexed(ibd->buffer->GetCount(),ri->count);
cmd_buf->DrawIndexed(iba->buffer->GetCount(),ri->count);
}
else
{

View File

@ -129,12 +129,12 @@ bool RenderCmdBuffer::BindDescriptorSets(Material *mtl)
return(true);
}
void RenderCmdBuffer::BindIBO(const IndexBufferAccess *ibd)
void RenderCmdBuffer::BindIBO(const IBAccess *iba)
{
vkCmdBindIndexBuffer( cmd_buf,
ibd->buffer->GetBuffer(),
ibd->offset,
VkIndexType(ibd->buffer->GetType()));
iba->buffer->GetBuffer(),
iba->offset,
VkIndexType(iba->buffer->GetType()));
}
bool RenderCmdBuffer::BindVBO(Renderable *ri)

View File

@ -6,7 +6,7 @@
#include<hgl/log/LogInfo.h>
VK_NAMESPACE_BEGIN
VertexInputData::VertexInputData(const uint32_t c,const uint32_t vc,const IndexBufferAccess *iba)
VertexInputData::VertexInputData(const uint32_t c,const uint32_t vc,const IBAccess *iba)
{
binding_count=c;
@ -57,7 +57,7 @@ Renderable *CreateRenderable(Primitive *prim,MaterialInstance *mi,Pipeline *p)
VAB *vab;
VertexInputData *vid=new VertexInputData(input_count,prim->GetVertexCount(),prim->GetIndexBufferAccess());
VertexInputData *vid=new VertexInputData(input_count,prim->GetVertexCount(),prim->GetIBAccess());
const VertexInputFormat *vif=vil->GetVIFList(VertexInputGroup::Basic);
VABAccess vad;