newly RenderNode2D/List
This commit is contained in:
parent
cd03ee8211
commit
b26e25df61
2
CMCore
2
CMCore
@ -1 +1 @@
|
||||
Subproject commit a377fe8d05d9486379c1da6007a940a90898e956
|
||||
Subproject commit d4d8af1bdcba53acc70fb6b2edf3b21a3a7245d9
|
@ -23,6 +23,8 @@ namespace hgl
|
||||
|
||||
private:
|
||||
|
||||
uint renderable_count; ///<可渲染对象数量
|
||||
|
||||
MaterialRenderMap2D mrl_map; ///<按材质分类的渲染列表
|
||||
|
||||
RenderNode2DComparator render_node_comparator;
|
||||
@ -38,12 +40,8 @@ namespace hgl
|
||||
virtual bool ExpendNode(SceneNode *);
|
||||
virtual void End();
|
||||
|
||||
bool BindPerFrameDescriptor();
|
||||
bool BindPerMaterialDescriptor();
|
||||
|
||||
private:
|
||||
|
||||
Material * last_mtl;
|
||||
Pipeline * last_pipeline;
|
||||
MaterialParameters *last_mp[DESCRIPTOR_SET_TYPE_COUNT];
|
||||
uint32_t last_vbo;
|
||||
|
@ -17,16 +17,32 @@ namespace hgl
|
||||
Renderable *ri;
|
||||
};
|
||||
|
||||
using RenderNode2DList=List<RenderNode2D *>;
|
||||
using RenderNode2DList=List<RenderNode2D>;
|
||||
|
||||
/**
|
||||
* 同一材质的对象渲染列表
|
||||
*/
|
||||
struct MaterialRenderList2D
|
||||
class MaterialRenderList2D
|
||||
{
|
||||
Material *mtl;
|
||||
|
||||
RenderNode2DList rn_list;
|
||||
|
||||
public:
|
||||
|
||||
MaterialRenderList2D(Material *m)
|
||||
{
|
||||
mtl=m;
|
||||
}
|
||||
|
||||
void Add(Renderable *ri,const Matrix3x4f &mat);
|
||||
|
||||
void ClearData()
|
||||
{
|
||||
rn_list.ClearData();
|
||||
}
|
||||
|
||||
void End();
|
||||
};
|
||||
|
||||
class MaterialRenderMap2D:public ObjectMap<Material *,MaterialRenderList2D>
|
||||
@ -36,15 +52,18 @@ namespace hgl
|
||||
MaterialRenderMap2D()=default;
|
||||
virtual ~MaterialRenderMap2D()=default;
|
||||
|
||||
void ClearData()
|
||||
void Begin()
|
||||
{
|
||||
for(auto *it:data_list)
|
||||
it->value->rn_list.ClearData();
|
||||
it->value->ClearData();
|
||||
}
|
||||
|
||||
void End()
|
||||
{
|
||||
for(auto *it:data_list)
|
||||
it->value->End();
|
||||
}
|
||||
};
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
|
||||
using RenderNode2DPointer=hgl::graph::RenderNode2D *;
|
||||
using RenderNode2DComparator=Comparator<RenderNode2DPointer>;
|
||||
#endif//HGL_GRAPH_RENDER_NODE_2D_INCLUDE
|
||||
|
@ -23,11 +23,6 @@ class DescriptorSet
|
||||
|
||||
bool is_dirty;
|
||||
|
||||
protected: //动态UBO/SSBO记录
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
friend class GPUDevice;
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include<hgl/graph/RenderNode2D.h>
|
||||
#include<hgl/graph/RenderNode2D.h>
|
||||
#include<hgl/graph/VKRenderable.h>
|
||||
#include<hgl/util/sort/Sort.h>
|
||||
|
||||
/**
|
||||
*
|
||||
* 理论上讲,我们需要按以下顺序排序
|
||||
* 理论上讲,我们需要按以下顺序排序
|
||||
*
|
||||
* for(material)
|
||||
* for(pipeline)
|
||||
@ -20,7 +20,7 @@ int Comparator<hgl::graph::RenderNode2D>::compare(const hgl::graph::RenderNode2D
|
||||
hgl::graph::Renderable *ri_one=obj_one.ri;
|
||||
hgl::graph::Renderable *ri_two=obj_two.ri;
|
||||
|
||||
//比较管线
|
||||
//比较管线
|
||||
{
|
||||
off=ri_one->GetPipeline()
|
||||
-ri_two->GetPipeline();
|
||||
@ -29,7 +29,7 @@ int Comparator<hgl::graph::RenderNode2D>::compare(const hgl::graph::RenderNode2D
|
||||
return off;
|
||||
}
|
||||
|
||||
//比较材质实例
|
||||
//比较材质实例
|
||||
//{
|
||||
// for(int i =(int)hgl::graph::DescriptorSetType::BEGIN_RANGE;
|
||||
// i<=(int)hgl::graph::DescriptorSetType::END_RANGE;
|
||||
@ -43,7 +43,7 @@ int Comparator<hgl::graph::RenderNode2D>::compare(const hgl::graph::RenderNode2D
|
||||
// }
|
||||
//}
|
||||
|
||||
//比较vbo+ebo
|
||||
//比较vbo+ebo
|
||||
{
|
||||
off=ri_one->GetBufferHash()
|
||||
-ri_two->GetBufferHash();
|
||||
@ -70,12 +70,18 @@ namespace hgl
|
||||
}
|
||||
|
||||
void MaterialRenderList2D::End()
|
||||
{
|
||||
//排序
|
||||
{
|
||||
Comparator<hgl::graph::RenderNode2D> rnc;
|
||||
|
||||
Sort(rn_list,&rnc);
|
||||
}
|
||||
|
||||
|
||||
//创建UBO/SSBO绑定数据
|
||||
{
|
||||
mtl->
|
||||
}
|
||||
}
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
|
Loading…
x
Reference in New Issue
Block a user