diff --git a/example/common/VulkanAppFramework.h b/example/common/VulkanAppFramework.h index 2ec0ac8e..6111d34c 100644 --- a/example/common/VulkanAppFramework.h +++ b/example/common/VulkanAppFramework.h @@ -226,8 +226,8 @@ public: cb->BindDescriptorSets(ri->GetMaterial()); cb->BindVBO(ri); - if (vid->index_buffer->buffer) - cb->DrawIndexed(vid->index_buffer->buffer->GetCount()); + if (vid->ib_access->buffer) + cb->DrawIndexed(vid->ib_access->buffer->GetCount()); else cb->Draw(vid->vertex_count); diff --git a/inc/hgl/graph/RenderNode.h b/inc/hgl/graph/RenderNode.h index f9241757..02297eb4 100644 --- a/inc/hgl/graph/RenderNode.h +++ b/inc/hgl/graph/RenderNode.h @@ -12,7 +12,7 @@ namespace hgl class MaterialInstance; class GPUDevice; struct VertexInputData; - struct IndexBufferData; + struct IndexBufferAccess; struct RenderNode { diff --git a/inc/hgl/graph/VK.h b/inc/hgl/graph/VK.h index c77673da..e628a6de 100644 --- a/inc/hgl/graph/VK.h +++ b/inc/hgl/graph/VK.h @@ -59,7 +59,7 @@ using VAB=VertexAttribBuffer; class IndexBuffer; -struct IndexBufferData +struct IndexBufferAccess { IndexBuffer *buffer=nullptr; VkDeviceSize offset=0; diff --git a/inc/hgl/graph/VKCommandBuffer.h b/inc/hgl/graph/VKCommandBuffer.h index 4cd346e8..10e20071 100644 --- a/inc/hgl/graph/VKCommandBuffer.h +++ b/inc/hgl/graph/VKCommandBuffer.h @@ -170,7 +170,7 @@ public: return(true); } - void BindIBO(const IndexBufferData *); + void BindIBO(const IndexBufferAccess *); bool BindVBO(Renderable *); diff --git a/inc/hgl/graph/VKPrimitive.h b/inc/hgl/graph/VKPrimitive.h index 40297b36..3c5041e1 100644 --- a/inc/hgl/graph/VKPrimitive.h +++ b/inc/hgl/graph/VKPrimitive.h @@ -14,12 +14,10 @@ struct PrimitiveData uint32_t vertex_count; uint32_t va_count; - - VABAccess *vab_list; - IndexBufferData index_buffer_data; + IndexBufferAccess ib_access; AABB BoundingBox; }; @@ -38,7 +36,7 @@ protected: VABAccessMap buffer_list; - IndexBufferData index_buffer_data; + IndexBufferAccess ib_access; AABB BoundingBox; @@ -78,7 +76,7 @@ public: bool GetVABAccess (const AnsiString &,VABAccess *); const int GetBufferCount ()const {return buffer_list.GetCount();} - const IndexBufferData * GetIndexBufferData ()const {return &index_buffer_data;} + const IndexBufferAccess * GetIndexBufferAccess()const {return &ib_access;} };//class Primitive VK_NAMESPACE_END #endif//HGL_GRAPH_VULKAN_PRIMITIVE_INCLUDE diff --git a/inc/hgl/graph/VKRenderable.h b/inc/hgl/graph/VKRenderable.h index d7bdd6eb..461e2fa4 100644 --- a/inc/hgl/graph/VKRenderable.h +++ b/inc/hgl/graph/VKRenderable.h @@ -17,11 +17,11 @@ struct VertexInputData uint32_t vertex_count; - const IndexBufferData *index_buffer; + const IndexBufferAccess *ib_access; public: - VertexInputData(const uint32_t,const uint32_t,const IndexBufferData *); + VertexInputData(const uint32_t,const uint32_t,const IndexBufferAccess *); ~VertexInputData(); const bool Comp(const VertexInputData *vid)const @@ -38,7 +38,7 @@ public: if(vertex_count!=vid->vertex_count)return(false); - if(index_buffer!=vid->index_buffer)return(false); + if(ib_access!=vid->ib_access)return(false); return(true); } diff --git a/inc/hgl/graph/VKRenderablePrimitiveCreater.h b/inc/hgl/graph/VKRenderablePrimitiveCreater.h index d3d41e05..bf584117 100644 --- a/inc/hgl/graph/VKRenderablePrimitiveCreater.h +++ b/inc/hgl/graph/VKRenderablePrimitiveCreater.h @@ -1,9 +1,12 @@ -#ifndef HGL_VK_RENDERABLE_PRIMITIVE_CREATER_INCLUDE +#ifndef HGL_VK_RENDERABLE_PRIMITIVE_CREATER_INCLUDE #define HGL_VK_RENDERABLE_PRIMITIVE_CREATER_INCLUDE #include VK_NAMESPACE_BEGIN +/** +* 可绘制图元创建器 +*/ class RenderablePrimitiveCreater { RenderResource *rr; @@ -50,4 +53,4 @@ public: } };//class RenderablePrimitiveCreater VK_NAMESPACE_END -#endif // HGL_VK_RENDERABLE_PRIMITIVE_CREATER_INCLUDE \ No newline at end of file +#endif // HGL_VK_RENDERABLE_PRIMITIVE_CREATER_INCLUDE diff --git a/src/SceneGraph/MaterialRenderList.cpp b/src/SceneGraph/MaterialRenderList.cpp index d86293f5..c6a79d3a 100644 --- a/src/SceneGraph/MaterialRenderList.cpp +++ b/src/SceneGraph/MaterialRenderList.cpp @@ -256,7 +256,7 @@ void MaterialRenderList::Render(RenderItem *ri) last_vid=ri->vid; } - const IndexBufferData *ibd=last_vid->index_buffer; + const IndexBufferAccess *ibd=last_vid->ib_access; if(ibd->buffer) { diff --git a/src/SceneGraph/Vulkan/VKCommandBufferRender.cpp b/src/SceneGraph/Vulkan/VKCommandBufferRender.cpp index ee823705..2a712a3b 100644 --- a/src/SceneGraph/Vulkan/VKCommandBufferRender.cpp +++ b/src/SceneGraph/Vulkan/VKCommandBufferRender.cpp @@ -129,7 +129,7 @@ bool RenderCmdBuffer::BindDescriptorSets(Material *mtl) return(true); } -void RenderCmdBuffer::BindIBO(const IndexBufferData *ibd) +void RenderCmdBuffer::BindIBO(const IndexBufferAccess *ibd) { vkCmdBindIndexBuffer( cmd_buf, ibd->buffer->GetBuffer(), @@ -149,10 +149,13 @@ bool RenderCmdBuffer::BindVBO(Renderable *ri) vkCmdBindVertexBuffers(cmd_buf,0,vid->binding_count,vid->buffer_list,vid->buffer_offset); - IndexBuffer *indices_buffer=vid->index_buffer->buffer; + IndexBuffer *indices_buffer=vid->ib_access->buffer; if(indices_buffer) - vkCmdBindIndexBuffer(cmd_buf,indices_buffer->GetBuffer(),vid->index_buffer->offset,VkIndexType(indices_buffer->GetType())); + vkCmdBindIndexBuffer(cmd_buf, + indices_buffer->GetBuffer(), + vid->ib_access->offset, + VkIndexType(indices_buffer->GetType())); return(true); } diff --git a/src/SceneGraph/Vulkan/VKPrimitive.cpp b/src/SceneGraph/Vulkan/VKPrimitive.cpp index fa465b4a..c9a5516e 100644 --- a/src/SceneGraph/Vulkan/VKPrimitive.cpp +++ b/src/SceneGraph/Vulkan/VKPrimitive.cpp @@ -65,8 +65,8 @@ bool Primitive::Set(IndexBuffer *ib,VkDeviceSize offset) { if(!ib)return(false); - index_buffer_data.buffer=ib; - index_buffer_data.offset=offset; + ib_access.buffer=ib; + ib_access.offset=offset; #ifdef _DEBUG DebugUtils *du=device->GetDebugUtils(); diff --git a/src/SceneGraph/Vulkan/VKRenderable.cpp b/src/SceneGraph/Vulkan/VKRenderable.cpp index 65740df3..6dfa6f76 100644 --- a/src/SceneGraph/Vulkan/VKRenderable.cpp +++ b/src/SceneGraph/Vulkan/VKRenderable.cpp @@ -6,7 +6,7 @@ #include VK_NAMESPACE_BEGIN -VertexInputData::VertexInputData(const uint32_t c,const uint32_t vc,const IndexBufferData *ibd) +VertexInputData::VertexInputData(const uint32_t c,const uint32_t vc,const IndexBufferAccess *iba) { binding_count=c; @@ -15,7 +15,7 @@ VertexInputData::VertexInputData(const uint32_t c,const uint32_t vc,const IndexB vertex_count=vc; - index_buffer=ibd; + ib_access=iba; } VertexInputData::~VertexInputData() @@ -57,7 +57,7 @@ Renderable *CreateRenderable(Primitive *prim,MaterialInstance *mi,Pipeline *p) VAB *vab; - VertexInputData *vid=new VertexInputData(input_count,prim->GetVertexCount(),prim->GetIndexBufferData()); + VertexInputData *vid=new VertexInputData(input_count,prim->GetVertexCount(),prim->GetIndexBufferAccess()); const VertexInputFormat *vif=vil->GetVIFList(VertexInputGroup::Basic); VABAccess vad;