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 *); void Set(Renderable *);
}; };
MaterialInstanceSets mi_set; SortedSets<int> mi_id_set;
DataArray<RenderItem> ri_array; DataArray<RenderItem> ri_array;
uint ri_count; uint ri_count;
void StatMI();
void Stat(); void Stat();
protected: protected:

View File

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

View File

@ -91,6 +91,7 @@ void MaterialRenderList::End()
if(node_count<=0)return; if(node_count<=0)return;
StatMI();
Stat(); Stat();
//写入LocalToWorld数据 //写入LocalToWorld数据
@ -104,6 +105,19 @@ void MaterialRenderList::RenderItem::Set(Renderable *ri)
vid =ri->GetVertexInputData(); 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() void MaterialRenderList::Stat()
{ {
const uint count=rn_list.GetCount(); const uint count=rn_list.GetCount();
@ -112,8 +126,6 @@ void MaterialRenderList::Stat()
ri_array.Clear(); ri_array.Clear();
ri_array.Alloc(count); ri_array.Alloc(count);
mi_set.Clear();
RenderItem *ri=ri_array.GetData(); RenderItem *ri=ri_array.GetData();
ri_count=1; ri_count=1;