fixed InlineGeometryScene example.

This commit is contained in:
hyzboy 2021-09-22 18:36:54 +08:00
parent 95d8113e5c
commit 1e81a9f4c4
3 changed files with 49 additions and 19 deletions

View File

@ -53,6 +53,7 @@ private:
struct
{
RenderTarget *rt=nullptr;
RenderPass *rp=nullptr;
RenderCmdBuffer *cmd=nullptr;
public:
@ -118,6 +119,8 @@ private:
gbuffer.cmd=device->CreateRenderCommandBuffer();
gbuffer.rp=gbuffer.rt->GetRenderPass();
return(gbuffer.rt);
}
@ -134,18 +137,18 @@ private:
bool InitGBufferPipeline(SubpassParam *sp)
{
sp->pipeline_triangles =gbuffer.rt->CreatePipeline(sp->material,InlinePipeline::Solid3D,Prim::Triangles);
sp->pipeline_triangles =gbuffer.rp->CreatePipeline(sp->material,InlinePipeline::Solid3D,Prim::Triangles);
if(!sp->pipeline_triangles)
return(false);
sp->pipeline_fan =gbuffer.rt->CreatePipeline(sp->material,InlinePipeline::Solid3D,Prim::Fan);
sp->pipeline_fan =gbuffer.rp->CreatePipeline(sp->material,InlinePipeline::Solid3D,Prim::Fan);
return sp->pipeline_fan;
}
bool InitCompositionPipeline(SubpassParam *sp)
{
sp->pipeline_fan=sc_render_target->CreatePipeline(sp->material,InlinePipeline::Solid2D,Prim::Fan);
sp->pipeline_fan=device_render_pass->CreatePipeline(sp->material,InlinePipeline::Solid2D,Prim::Fan);
return sp->pipeline_fan;
}

View File

@ -37,8 +37,8 @@ class TestApp:public CameraAppFramework
private:
SceneNode render_root;
RenderList render_list;
SceneNode render_root;
RenderList * render_list =nullptr;
Material * material =nullptr;
MaterialInstance * material_instance =nullptr;
@ -208,18 +208,40 @@ private:
ubo_light=db->CreateUBO(sizeof(PhongLight),&light);
ubo_phong=db->CreateUBO(sizeof(PhongMaterial),&phong);
material_instance->BindUBO("light",ubo_light);
material_instance->BindUBO("phong",ubo_phong);
{
MaterialParameters *mp_value=material_instance->GetMP(DescriptorSetType::Value);
if(!mp_value)
return(false);
if(!material_instance->BindUBO("camera",GetCameraInfoBuffer()))
return(false);
mp_value->BindUBO("light",ubo_light);
mp_value->BindUBO("phong",ubo_phong);
material_instance->Update();
mp_value->Update();
}
{
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global);
if(!mp_global)
return(false);
if(!axis_mi->BindUBO("camera",GetCameraInfoBuffer()))
return(false);
if(!mp_global->BindUBO("g_camera",GetCameraInfoBuffer()))return(false);
mp_global->Update();
}
{
MaterialParameters *mp_global=axis_mi->GetMP(DescriptorSetType::Global);
if(!mp_global)
return(false);
if(!mp_global->BindUBO("g_camera",GetCameraInfoBuffer()))return(false);
mp_global->Update();
}
axis_mi->Update();
return(true);
}
@ -248,18 +270,25 @@ private:
Add(ro_cone ,pipeline_solid,translate( 0,-16, 0));
render_root.RefreshMatrix();
render_list.Expend(GetCameraInfo(),&render_root);
render_list->Expend(GetCameraInfo(),&render_root);
return(true);
}
public:
~TestApp()
{
SAFE_CLEAR(render_list);
}
bool Init()
{
if(!CameraAppFramework::Init(SCREEN_WIDTH,SCREEN_HEIGHT))
return(false);
render_list=new RenderList(device);
if(!InitMaterial())
return(false);
@ -277,11 +306,9 @@ public:
void BuildCommandBuffer(uint32_t index) override
{
render_root.RefreshMatrix();
render_list.Begin();
render_root.ExpendToList(&render_list);
render_list.End();
render_list->Expend(GetCameraInfo(),&render_root);
VulkanApplicationFramework::BuildCommandBuffer(index,&render_list);
VulkanApplicationFramework::BuildCommandBuffer(index,render_list);
}
};//class TestApp:public CameraAppFramework

2
res

@ -1 +1 @@
Subproject commit 64d5e5910df49d3e913e28dd4781699d8eff0a51
Subproject commit 9385c782cc857a87f579d2a022d18918e3526147