Geometry3D范例改进(未完成,不可用)
This commit is contained in:
parent
3c554c9e99
commit
3155234629
@ -16,11 +16,6 @@ bool LoadFromFile(const OSString &filename,VK_NAMESPACE::PipelineCreater *pc);
|
|||||||
constexpr uint32_t SCREEN_WIDTH=128;
|
constexpr uint32_t SCREEN_WIDTH=128;
|
||||||
constexpr uint32_t SCREEN_HEIGHT=128;
|
constexpr uint32_t SCREEN_HEIGHT=128;
|
||||||
|
|
||||||
struct WorldConfig
|
|
||||||
{
|
|
||||||
Matrix4f mvp;
|
|
||||||
}world;
|
|
||||||
|
|
||||||
class TestApp:public VulkanApplicationFramework
|
class TestApp:public VulkanApplicationFramework
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@ -70,8 +65,6 @@ private:
|
|||||||
camera.height=SCREEN_HEIGHT;
|
camera.height=SCREEN_HEIGHT;
|
||||||
|
|
||||||
camera.Refresh(); //更新矩阵计算
|
camera.Refresh(); //更新矩阵计算
|
||||||
|
|
||||||
world.mvp=camera.projection*camera.modelview*scale(50,50,50);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InitMaterial()
|
bool InitMaterial()
|
||||||
@ -114,21 +107,21 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InitUBO()
|
//bool InitUBO()
|
||||||
{
|
//{
|
||||||
const VkExtent2D extent=device->GetExtent();
|
// const VkExtent2D extent=device->GetExtent();
|
||||||
|
|
||||||
ubo_mvp=db->CreateUBO(sizeof(WorldConfig),&world);
|
// ubo_mvp=db->CreateUBO(sizeof(WorldConfig),&world);
|
||||||
|
|
||||||
if(!ubo_mvp)
|
// if(!ubo_mvp)
|
||||||
return(false);
|
// return(false);
|
||||||
|
|
||||||
if(!descriptor_sets->BindUBO(material->GetUBO("world"),*ubo_mvp))
|
// if(!descriptor_sets->BindUBO(material->GetUBO("world"),*ubo_mvp))
|
||||||
return(false);
|
// return(false);
|
||||||
|
|
||||||
descriptor_sets->Update();
|
// descriptor_sets->Update();
|
||||||
return(true);
|
// return(true);
|
||||||
}
|
//}
|
||||||
|
|
||||||
bool InitPipeline()
|
bool InitPipeline()
|
||||||
{
|
{
|
||||||
@ -163,13 +156,12 @@ private:
|
|||||||
|
|
||||||
bool InitScene()
|
bool InitScene()
|
||||||
{
|
{
|
||||||
//render_root.Add(db->CreateRenderableInstance(pipeline_line,descriptor_sets,ro_plane_grid));
|
render_root.Add(db->CreateRenderableInstance(pipeline_line,descriptor_sets,ro_plane_grid));
|
||||||
render_root.Add(db->CreateRenderableInstance(pipeline_triangles,descriptor_sets,ro_cube));
|
|
||||||
|
render_root.Add(db->CreateRenderableInstance(pipeline_triangles,descriptor_sets,ro_cube),scale(50,50,50));
|
||||||
//render_root.Add(db->CreateRenderableInstance(pipeline,descriptor_sets,ro_circle));
|
//render_root.Add(db->CreateRenderableInstance(pipeline,descriptor_sets,ro_circle));
|
||||||
|
|
||||||
Matrix4f s10=scale(10,10,10);
|
render_root.RefreshMatrix(&(camera.mvp));
|
||||||
|
|
||||||
render_root.RefreshMatrix();
|
|
||||||
render_root.ExpendToList(&render_list);
|
render_root.ExpendToList(&render_list);
|
||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
@ -214,8 +206,8 @@ public:
|
|||||||
|
|
||||||
CreateRenderObject();
|
CreateRenderObject();
|
||||||
|
|
||||||
if(!InitUBO())
|
// if(!InitUBO())
|
||||||
return(false);
|
// return(false);
|
||||||
|
|
||||||
if(!InitPipeline())
|
if(!InitPipeline())
|
||||||
return(false);
|
return(false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user