newly material instance stat,but can't run.

This commit is contained in:
HuYingzhuo(hugo/hyzboy) 2023-09-19 21:45:54 +08:00
parent 2dedeaad90
commit 4208e47534
3 changed files with 17 additions and 6 deletions

View File

@ -35,10 +35,11 @@ private:
void Set(Renderable *);
};
MaterialInstanceSets mi_set;
SortedSets<int> mi_id_set;
DataArray<RenderItem> ri_array;
uint ri_count;
void StatMI();
void Stat();
protected:

View File

@ -22,8 +22,6 @@ namespace hgl
};
using RenderNodeList=List<RenderNode>;
using MaterialInstanceSets=SortedSets<MaterialInstance *>;
}//namespace graph
}//namespace hgl
#endif//HGL_GRAPH_RENDER_NODE_INCLUDE

View File

@ -91,6 +91,7 @@ void MaterialRenderList::End()
if(node_count<=0)return;
StatMI();
Stat();
//写入LocalToWorld数据
@ -104,6 +105,19 @@ void MaterialRenderList::RenderItem::Set(Renderable *ri)
vid =ri->GetVertexInputData();
}
void MaterialRenderList::StatMI()
{
mi_id_set.Clear();
for(RenderNode &rn:rn_list)
mi_id_set.Add(rn.ri->GetMaterialInstance()->GetMIID());
if(mi_id_set.GetCount()>mtl->GetMIMaxCount())
{
//超出最大数量了怎么办???
}
}
void MaterialRenderList::Stat()
{
const uint count=rn_list.GetCount();
@ -112,8 +126,6 @@ void MaterialRenderList::Stat()
ri_array.Clear();
ri_array.Alloc(count);
mi_set.Clear();
RenderItem *ri=ri_array.GetData();
ri_count=1;