[STRONG] merge VDM render OK!!! TEST OK! next step is to support VDM Render and non-VDM Render, recommend is two MaterialRenderList class.
This commit is contained in:
parent
0dcf004f4c
commit
bf5e401566
@ -64,7 +64,7 @@ private:
|
||||
|
||||
bool InitVertexLumMP()
|
||||
{
|
||||
mtl::Material3DCreateConfig cfg(device->GetDeviceAttribute(),"VertexLuminance3D",false,Prim::Lines);
|
||||
mtl::Material3DCreateConfig cfg(device->GetDeviceAttribute(),"VertexLuminance3D",Prim::Lines);
|
||||
|
||||
cfg.local_to_world=true;
|
||||
|
||||
@ -92,9 +92,10 @@ private:
|
||||
|
||||
bool InitBlinnPhongSunLightMP()
|
||||
{
|
||||
mtl::Material3DCreateConfig cfg(device->GetDeviceAttribute(),"BlinnPhong3D",true,Prim::Triangles);
|
||||
mtl::Material3DCreateConfig cfg(device->GetDeviceAttribute(),"BlinnPhong3D",Prim::Triangles);
|
||||
|
||||
cfg.local_to_world=true;
|
||||
cfg.material_instance=true;
|
||||
|
||||
mtl_blinnphong=db->LoadMaterial("Std3D/BlinnPhong/SunLightPureColor",&cfg);
|
||||
if(!mtl_blinnphong)return(false);
|
||||
|
@ -191,6 +191,15 @@ public: //draw
|
||||
void DrawIndexed (const uint32_t index_count ) {vkCmdDrawIndexed(cmd_buf,index_count,1,0,0,0);}
|
||||
void Draw (const uint32_t vertex_count,const uint32_t instance_count) {vkCmdDraw(cmd_buf,vertex_count,instance_count,0,0);}
|
||||
void DrawIndexed (const uint32_t index_count ,const uint32_t instance_count) {vkCmdDrawIndexed(cmd_buf,index_count,instance_count,0,0,0);}
|
||||
void DrawIndexed (const uint32_t index_count ,const uint32_t instance_count,const uint32_t firstIndex,const int32_t vertexOffset,const uint32_t firstInstance)
|
||||
{
|
||||
vkCmdDrawIndexed(cmd_buf,
|
||||
index_count,
|
||||
instance_count,
|
||||
firstIndex,
|
||||
vertexOffset,
|
||||
firstInstance);
|
||||
}
|
||||
|
||||
// template<typename ...ARGS> void Draw (ARGS...args) {vkCmdDraw(cmd_buf,args...);}
|
||||
// template<typename ...ARGS> void DrawIndexed (ARGS...args) {vkCmdDrawIndexed(cmd_buf,args...);}
|
||||
|
@ -164,7 +164,7 @@ bool MaterialRenderList::BindVAB(const VertexInputData *vid,const DrawData *dd,c
|
||||
}
|
||||
|
||||
if(assign_buffer) //L2W/MI分发组
|
||||
vbo_list->Add(assign_buffer->GetVAB(),ASSIGN_VAB_STRIDE_BYTES*ri_index);
|
||||
vbo_list->Add(assign_buffer->GetVAB(),0);//ASSIGN_VAB_STRIDE_BYTES*ri_index);
|
||||
|
||||
//if(!vbo_list.IsFull()) //Joint组,暂未支持
|
||||
//{
|
||||
@ -222,19 +222,18 @@ void MaterialRenderList::Render(RenderItem *ri)
|
||||
{
|
||||
last_vid=ri->vid;
|
||||
last_dd=nullptr;
|
||||
}
|
||||
|
||||
if(!ri->dd->Comp(last_dd))
|
||||
{
|
||||
BindVAB(ri->vid,ri->dd,ri->first);
|
||||
last_dd=ri->dd;
|
||||
cmd_buf->BindIBO(ri->vid->ibo,0);
|
||||
}
|
||||
|
||||
if(last_vid->ibo)
|
||||
{
|
||||
cmd_buf->BindIBO(ri->vid->ibo,ri->dd->index_start);
|
||||
cmd_buf->DrawIndexed(ri->dd->index_count,
|
||||
ri->count);
|
||||
ri->count,
|
||||
ri->dd->index_start,
|
||||
ri->dd->vab_offset[0],
|
||||
ri->first);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -145,7 +145,7 @@ Renderable *CreateRenderable(Primitive *prim,MaterialInstance *mi,Pipeline *p)
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
dd->vab_offset[i]=vab_access->start*vif->stride;
|
||||
dd->vab_offset[i]=vab_access->start;
|
||||
vid->vab_list[i]=vab_access->vab->GetBuffer();
|
||||
++vif;
|
||||
}
|
||||
|
@ -113,6 +113,9 @@ MaterialCreateInfo *LoadMaterialFromFile(const AnsiString &name,Material2DCreate
|
||||
if(!mfd)
|
||||
return nullptr;
|
||||
|
||||
if(mfd->mi.mi_bytes>0)
|
||||
cfg->material_instance=true;
|
||||
|
||||
cfg->shader_stage_flag_bit=mfd->shader_stage_flag_bit;
|
||||
|
||||
Std2DMaterialLoader mtl(mfd,cfg);
|
||||
|
@ -114,6 +114,9 @@ MaterialCreateInfo *LoadMaterialFromFile(const AnsiString &name,Material3DCreate
|
||||
if(!mfd)
|
||||
return nullptr;
|
||||
|
||||
if(mfd->mi.mi_bytes>0)
|
||||
cfg->material_instance=true;
|
||||
|
||||
cfg->shader_stage_flag_bit=mfd->shader_stage_flag_bit;
|
||||
|
||||
Std3DMaterialLoader mtl(mfd,cfg);
|
||||
|
Loading…
x
Reference in New Issue
Block a user