updated codes of RenderNode2D/RenderList2D

This commit is contained in:
2023-05-04 22:01:00 +08:00
parent 30c736b7c8
commit 1e03e28f0b
7 changed files with 184 additions and 16 deletions

View File

@@ -3,12 +3,14 @@
#include<hgl/math/Math.h>
#include<hgl/type/Map.h>
#include<hgl/graph/VK.h>
namespace hgl
{
namespace graph
{
class Renderable;
class Material;
class GPUDevice;
struct RenderNode2D
{
@@ -19,21 +21,39 @@ namespace hgl
using RenderNode2DList=List<RenderNode2D>;
struct RenderNode2DExtraBuffer;
/**
* 同一材质的对象渲染列表
*/
class MaterialRenderList2D
{
GPUDevice *device;
RenderCmdBuffer *cmd_buf;
Material *mtl;
RenderNode2DList rn_list;
RenderNode2DExtraBuffer *extra_buffer;
protected:
uint32_t binding_count;
VkBuffer *buffer_list;
VkDeviceSize *buffer_offset;
MaterialInstance *last_mi;
Pipeline *last_pipeline;
Primitive *last_primitive;
uint first_index;
void Render(const uint index,Renderable *);
public:
MaterialRenderList2D(Material *m)
{
mtl=m;
}
MaterialRenderList2D(GPUDevice *d,RenderCmdBuffer *,Material *m);
~MaterialRenderList2D();
void Add(Renderable *ri,const Matrix3x4f &mat);
@@ -43,6 +63,8 @@ namespace hgl
}
void End();
void Render();
};
class MaterialRenderMap2D:public ObjectMap<Material *,MaterialRenderList2D>

View File

@@ -55,7 +55,7 @@ public:
const UTF8String & GetName ()const{return data->name;}
// const VertexInput * GetVertexInput ()const{return data->vertex_input;}
const VertexInput * GetVertexInput ()const{return data->vertex_input;}
const ShaderStageCreateInfoList & GetStageList ()const{return data->shader_stage_list;}

View File

@@ -38,9 +38,7 @@ namespace hgl
}
const VkFormat GetFormat ()const{return format;} ///<取得数据类型
// const uint32_t GetVecSize ()const{return vec_size;} ///<取数缓冲区元数据成份数量
const uint32_t GetCount ()const{return count;} ///<取得数据数量
// const uint32_t GetStride ()const{return stride;} ///<取得每一组数据字节数
void * GetData ()const{return mem_data;} ///<取得数据指针
const uint32_t GetTotalBytes ()const{return total_bytes;} ///<取得数据字节数
};//class VertexAttribData