fixed InlineGeometryScene example.
This commit is contained in:
parent
95d8113e5c
commit
1e81a9f4c4
@ -53,6 +53,7 @@ private:
|
|||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
RenderTarget *rt=nullptr;
|
RenderTarget *rt=nullptr;
|
||||||
|
RenderPass *rp=nullptr;
|
||||||
RenderCmdBuffer *cmd=nullptr;
|
RenderCmdBuffer *cmd=nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -118,6 +119,8 @@ private:
|
|||||||
|
|
||||||
gbuffer.cmd=device->CreateRenderCommandBuffer();
|
gbuffer.cmd=device->CreateRenderCommandBuffer();
|
||||||
|
|
||||||
|
gbuffer.rp=gbuffer.rt->GetRenderPass();
|
||||||
|
|
||||||
return(gbuffer.rt);
|
return(gbuffer.rt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,18 +137,18 @@ private:
|
|||||||
|
|
||||||
bool InitGBufferPipeline(SubpassParam *sp)
|
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)
|
if(!sp->pipeline_triangles)
|
||||||
return(false);
|
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;
|
return sp->pipeline_fan;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InitCompositionPipeline(SubpassParam *sp)
|
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;
|
return sp->pipeline_fan;
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,8 @@ class TestApp:public CameraAppFramework
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
SceneNode render_root;
|
SceneNode render_root;
|
||||||
RenderList render_list;
|
RenderList * render_list =nullptr;
|
||||||
|
|
||||||
Material * material =nullptr;
|
Material * material =nullptr;
|
||||||
MaterialInstance * material_instance =nullptr;
|
MaterialInstance * material_instance =nullptr;
|
||||||
@ -208,18 +208,40 @@ private:
|
|||||||
ubo_light=db->CreateUBO(sizeof(PhongLight),&light);
|
ubo_light=db->CreateUBO(sizeof(PhongLight),&light);
|
||||||
ubo_phong=db->CreateUBO(sizeof(PhongMaterial),&phong);
|
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()))
|
mp_value->BindUBO("light",ubo_light);
|
||||||
return(false);
|
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()))
|
if(!mp_global->BindUBO("g_camera",GetCameraInfoBuffer()))return(false);
|
||||||
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);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,18 +270,25 @@ private:
|
|||||||
Add(ro_cone ,pipeline_solid,translate( 0,-16, 0));
|
Add(ro_cone ,pipeline_solid,translate( 0,-16, 0));
|
||||||
|
|
||||||
render_root.RefreshMatrix();
|
render_root.RefreshMatrix();
|
||||||
render_list.Expend(GetCameraInfo(),&render_root);
|
render_list->Expend(GetCameraInfo(),&render_root);
|
||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
~TestApp()
|
||||||
|
{
|
||||||
|
SAFE_CLEAR(render_list);
|
||||||
|
}
|
||||||
|
|
||||||
bool Init()
|
bool Init()
|
||||||
{
|
{
|
||||||
if(!CameraAppFramework::Init(SCREEN_WIDTH,SCREEN_HEIGHT))
|
if(!CameraAppFramework::Init(SCREEN_WIDTH,SCREEN_HEIGHT))
|
||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
|
render_list=new RenderList(device);
|
||||||
|
|
||||||
if(!InitMaterial())
|
if(!InitMaterial())
|
||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
@ -277,11 +306,9 @@ public:
|
|||||||
void BuildCommandBuffer(uint32_t index) override
|
void BuildCommandBuffer(uint32_t index) override
|
||||||
{
|
{
|
||||||
render_root.RefreshMatrix();
|
render_root.RefreshMatrix();
|
||||||
render_list.Begin();
|
render_list->Expend(GetCameraInfo(),&render_root);
|
||||||
render_root.ExpendToList(&render_list);
|
|
||||||
render_list.End();
|
|
||||||
|
|
||||||
VulkanApplicationFramework::BuildCommandBuffer(index,&render_list);
|
VulkanApplicationFramework::BuildCommandBuffer(index,render_list);
|
||||||
}
|
}
|
||||||
};//class TestApp:public CameraAppFramework
|
};//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