fix RenderableCreater and VertexAttribData, VertexAttribDataAccess..... and then test CreateRenderableRectangle passed.

This commit is contained in:
2020-07-20 18:12:02 +08:00
parent 4898592c32
commit 79b012d5b9
6 changed files with 1181 additions and 1177 deletions

View File

@@ -34,11 +34,11 @@ private:
vulkan::Material * material =nullptr;
vulkan::MaterialInstance * material_instance =nullptr;
vulkan::Renderable *ro_rectangle =nullptr,
vulkan::Renderable *ro_rectangle =nullptr;/*,
*ro_circle =nullptr,
*ro_round_rectangle =nullptr;
*ro_round_rectangle =nullptr;*/
vulkan::Buffer * ubo_world_matrix =nullptr;
vulkan::Buffer * ubo_world_matrix =nullptr;
vulkan::Buffer * ubo_color_material =nullptr;
vulkan::Pipeline * pipeline =nullptr;
@@ -69,32 +69,32 @@ private:
ro_rectangle=CreateRenderableRectangle(db,material,&rci);
}
{
struct RoundRectangleCreateInfo rrci;
//{
// struct RoundRectangleCreateInfo rrci;
rrci.scope.Set(SCREEN_WIDTH-30,10,20,20);
rrci.radius=5;
rrci.round_per=5;
// rrci.scope.Set(SCREEN_WIDTH-30,10,20,20);
// rrci.radius=5;
// rrci.round_per=5;
ro_round_rectangle=CreateRenderableRoundRectangle(db,material,&rrci);
}
// ro_round_rectangle=CreateRenderableRoundRectangle(db,material,&rrci);
//}
{
struct CircleCreateInfo cci;
//{
// struct CircleCreateInfo cci;
cci.center.x=SCREEN_WIDTH/2;
cci.center.y=SCREEN_HEIGHT/2;
// cci.center.x=SCREEN_WIDTH/2;
// cci.center.y=SCREEN_HEIGHT/2;
cci.radius.x=SCREEN_WIDTH*0.35;
cci.radius.y=SCREEN_HEIGHT*0.35;
// cci.radius.x=SCREEN_WIDTH*0.35;
// cci.radius.y=SCREEN_HEIGHT*0.35;
cci.field_count=8;
// cci.field_count=8;
ro_circle=CreateRenderableCircle(db,material,&cci);
}
// ro_circle=CreateRenderableCircle(db,material,&cci);
//}
}
vulkan::Buffer *CreateUBO(const UTF8String &name,const VkDeviceSize size,void *data)
vulkan::Buffer *CreateUBO(const AnsiString &name,const VkDeviceSize size,void *data)
{
vulkan::Buffer *ubo=device->CreateUBO(size,data);
@@ -107,6 +107,8 @@ private:
return(nullptr);
}
db->Add(ubo);
return ubo;
}
@@ -119,7 +121,7 @@ private:
cam.Refresh();
ubo_world_matrix =CreateUBO("world", sizeof(WorldMatrix),&cam.matrix);
ubo_world_matrix =CreateUBO("world", sizeof(WorldMatrix),&cam.matrix);
ubo_color_material =CreateUBO("color_material",sizeof(Vector4f),&color);
material_instance->Update();
@@ -143,8 +145,8 @@ private:
bool InitScene()
{
render_root.Add(db->CreateRenderableInstance(pipeline,material_instance,ro_rectangle));
render_root.Add(db->CreateRenderableInstance(pipeline,material_instance,ro_round_rectangle));
render_root.Add(db->CreateRenderableInstance(pipeline,material_instance,ro_circle));
// render_root.Add(db->CreateRenderableInstance(pipeline,material_instance,ro_round_rectangle));
// render_root.Add(db->CreateRenderableInstance(pipeline,material_instance,ro_circle));
render_root.ExpendToList(&render_list);
BuildCommandBuffer(&render_list);