fixed InlineGeometryScene example.
This commit is contained in:
parent
95d8113e5c
commit
1e81a9f4c4
@ -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;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ class TestApp:public CameraAppFramework
|
||||
private:
|
||||
|
||||
SceneNode render_root;
|
||||
RenderList render_list;
|
||||
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(!material_instance->BindUBO("camera",GetCameraInfoBuffer()))
|
||||
if(!mp_value)
|
||||
return(false);
|
||||
|
||||
material_instance->Update();
|
||||
mp_value->BindUBO("light",ubo_light);
|
||||
mp_value->BindUBO("phong",ubo_phong);
|
||||
|
||||
if(!axis_mi->BindUBO("camera",GetCameraInfoBuffer()))
|
||||
mp_value->Update();
|
||||
}
|
||||
|
||||
{
|
||||
MaterialParameters *mp_global=material_instance->GetMP(DescriptorSetType::Global);
|
||||
|
||||
if(!mp_global)
|
||||
return(false);
|
||||
|
||||
axis_mi->Update();
|
||||
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();
|
||||
}
|
||||
|
||||
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
2
res
@ -1 +1 @@
|
||||
Subproject commit 64d5e5910df49d3e913e28dd4781699d8eff0a51
|
||||
Subproject commit 9385c782cc857a87f579d2a022d18918e3526147
|
Loading…
x
Reference in New Issue
Block a user