added vdm sort
This commit is contained in:
parent
8cdf88e2fd
commit
55001843ea
@ -28,6 +28,7 @@ private:
|
|||||||
|
|
||||||
Pipeline * pipeline;
|
Pipeline * pipeline;
|
||||||
MaterialInstance * mi;
|
MaterialInstance * mi;
|
||||||
|
|
||||||
const PrimitiveDataBuffer * pdb;
|
const PrimitiveDataBuffer * pdb;
|
||||||
const PrimitiveRenderData * prd;
|
const PrimitiveRenderData * prd;
|
||||||
|
|
||||||
@ -47,6 +48,7 @@ protected:
|
|||||||
|
|
||||||
Pipeline * last_pipeline;
|
Pipeline * last_pipeline;
|
||||||
const PrimitiveDataBuffer * last_data_buffer;
|
const PrimitiveDataBuffer * last_data_buffer;
|
||||||
|
const VertexDataManager * last_vdm;
|
||||||
const PrimitiveRenderData * last_render_data;
|
const PrimitiveRenderData * last_render_data;
|
||||||
|
|
||||||
bool BindVAB(const PrimitiveDataBuffer *,const uint);
|
bool BindVAB(const PrimitiveDataBuffer *,const uint);
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include<hgl/graph/VKRenderAssign.h>
|
#include<hgl/graph/VKRenderAssign.h>
|
||||||
#include<hgl/util/sort/Sort.h>
|
#include<hgl/util/sort/Sort.h>
|
||||||
#include"RenderAssignBuffer.h"
|
#include"RenderAssignBuffer.h"
|
||||||
|
#include<hgl/graph/VertexDataManager.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -20,7 +21,7 @@
|
|||||||
template<>
|
template<>
|
||||||
int Comparator<hgl::graph::RenderNode>::compare(const hgl::graph::RenderNode &obj_one,const hgl::graph::RenderNode &obj_two) const
|
int Comparator<hgl::graph::RenderNode>::compare(const hgl::graph::RenderNode &obj_one,const hgl::graph::RenderNode &obj_two) const
|
||||||
{
|
{
|
||||||
int off;
|
hgl::int64 off;
|
||||||
|
|
||||||
hgl::graph::Renderable *ri_one=obj_one.ri;
|
hgl::graph::Renderable *ri_one=obj_one.ri;
|
||||||
hgl::graph::Renderable *ri_two=obj_two.ri;
|
hgl::graph::Renderable *ri_two=obj_two.ri;
|
||||||
@ -34,15 +35,31 @@ int Comparator<hgl::graph::RenderNode>::compare(const hgl::graph::RenderNode &ob
|
|||||||
return off;
|
return off;
|
||||||
}
|
}
|
||||||
|
|
||||||
//比较模型
|
auto *prim_one=ri_one->GetPrimitive();
|
||||||
|
auto *prim_two=ri_two->GetPrimitive();
|
||||||
|
|
||||||
|
//比如VDM
|
||||||
{
|
{
|
||||||
off=ri_one->GetPrimitive()
|
off=prim_one->GetVDM()
|
||||||
-ri_two->GetPrimitive();
|
-prim_two->GetVDM();
|
||||||
|
|
||||||
if(off)
|
if(off)
|
||||||
return off;
|
return off;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//比较模型
|
||||||
|
{
|
||||||
|
off=prim_one
|
||||||
|
-prim_two;
|
||||||
|
|
||||||
|
if(off)
|
||||||
|
{
|
||||||
|
off=prim_one->GetVertexOffset()-prim_two->GetVertexOffset(); //保存vertex offset小的在前面
|
||||||
|
|
||||||
|
return off;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +131,8 @@ void MaterialRenderList::Stat()
|
|||||||
ri->Set(rn->ri);
|
ri->Set(rn->ri);
|
||||||
|
|
||||||
last_pipeline =ri->pipeline;
|
last_pipeline =ri->pipeline;
|
||||||
last_data_buffer =ri->pdb;
|
last_data_buffer=ri->pdb;
|
||||||
|
last_vdm =ri->pdb->vdm;
|
||||||
last_render_data=ri->prd;
|
last_render_data=ri->prd;
|
||||||
|
|
||||||
++rn;
|
++rn;
|
||||||
@ -246,7 +264,9 @@ void MaterialRenderList::Render(RenderCmdBuffer *rcb)
|
|||||||
RenderItem *ri=ri_array.GetData();
|
RenderItem *ri=ri_array.GetData();
|
||||||
|
|
||||||
last_pipeline =nullptr;
|
last_pipeline =nullptr;
|
||||||
last_data_buffer =nullptr;
|
last_data_buffer=nullptr;
|
||||||
|
last_vdm =nullptr;
|
||||||
|
last_render_data=nullptr;
|
||||||
|
|
||||||
if(assign_buffer)
|
if(assign_buffer)
|
||||||
assign_buffer->Bind(material);
|
assign_buffer->Bind(material);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user