82 lines
1.6 KiB
C++
82 lines
1.6 KiB
C++
|
#include<hgl/graph/RenderNode2D.h>
|
|||
|
#include<hgl/graph/VKRenderable.h>
|
|||
|
#include<hgl/util/sort/Sort.h>
|
|||
|
|
|||
|
/**
|
|||
|
*
|
|||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*
|
|||
|
* for(material)
|
|||
|
* for(pipeline)
|
|||
|
* for(material_instance)
|
|||
|
* for(vbo)
|
|||
|
*/
|
|||
|
|
|||
|
template<>
|
|||
|
int Comparator<hgl::graph::RenderNode2D>::compare(const hgl::graph::RenderNode2D &obj_one,const hgl::graph::RenderNode2D &obj_two) const
|
|||
|
{
|
|||
|
int off;
|
|||
|
|
|||
|
hgl::graph::Renderable *ri_one=obj_one.ri;
|
|||
|
hgl::graph::Renderable *ri_two=obj_two.ri;
|
|||
|
|
|||
|
//<2F>ȽϹ<C8BD><CFB9><EFBFBD>
|
|||
|
{
|
|||
|
off=ri_one->GetPipeline()
|
|||
|
-ri_two->GetPipeline();
|
|||
|
|
|||
|
if(off)
|
|||
|
return off;
|
|||
|
}
|
|||
|
|
|||
|
//<2F>Ƚϲ<C8BD><CFB2><EFBFBD>ʵ<EFBFBD><CAB5>
|
|||
|
//{
|
|||
|
// for(int i =(int)hgl::graph::DescriptorSetType::BEGIN_RANGE;
|
|||
|
// i<=(int)hgl::graph::DescriptorSetType::END_RANGE;
|
|||
|
// i++)
|
|||
|
// {
|
|||
|
// off=ri_one->GetMP((hgl::graph::DescriptorSetType)i)
|
|||
|
// -ri_two->GetMP((hgl::graph::DescriptorSetType)i);
|
|||
|
|
|||
|
// if(off)
|
|||
|
// return off;
|
|||
|
// }
|
|||
|
//}
|
|||
|
|
|||
|
//<2F>Ƚ<EFBFBD>vbo+ebo
|
|||
|
{
|
|||
|
off=ri_one->GetBufferHash()
|
|||
|
-ri_two->GetBufferHash();
|
|||
|
|
|||
|
if(off)
|
|||
|
return off;
|
|||
|
}
|
|||
|
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
namespace hgl
|
|||
|
{
|
|||
|
namespace graph
|
|||
|
{
|
|||
|
void MaterialRenderList2D::Add(Renderable *ri,const Matrix3x4f &mat)
|
|||
|
{
|
|||
|
RenderNode2D rn;
|
|||
|
|
|||
|
rn.local_to_world=mat;
|
|||
|
rn.ri=ri;
|
|||
|
|
|||
|
rn_list.Add(rn);
|
|||
|
}
|
|||
|
|
|||
|
void MaterialRenderList2D::End()
|
|||
|
{
|
|||
|
Comparator<hgl::graph::RenderNode2D> rnc;
|
|||
|
|
|||
|
Sort(rn_list,&rnc);
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
}//namespace graph
|
|||
|
}//namespace hgl
|