added SceneAppFramework, global_descriptor.Bind used auto-mode.

This commit is contained in:
2023-10-11 18:49:29 +08:00
parent cfed14d746
commit 6f58475abd
7 changed files with 62 additions and 50 deletions

View File

@@ -12,16 +12,10 @@
using namespace hgl;
using namespace hgl::graph;
constexpr uint32_t SCREEN_WIDTH=1280;
constexpr uint32_t SCREEN_HEIGHT=720;
class TestApp:public CameraAppFramework
class TestApp:public SceneAppFramework
{
private:
SceneNode render_root;
RenderList * render_list =nullptr;
Material * material =nullptr;
Pipeline * pipeline =nullptr;
@@ -42,8 +36,6 @@ private:
material=db->CreateMaterial(mci);
if(!material)return(false);
db->global_descriptor.Bind(material);
Color4f GridColor;
COLOR ce=COLOR::BlenderAxisRed;
@@ -113,17 +105,10 @@ private:
public:
~TestApp()
bool Init(uint width,uint height) override
{
SAFE_CLEAR(render_list);
}
bool Init()
{
if(!CameraAppFramework::Init(SCREEN_WIDTH,SCREEN_HEIGHT))
if(!SceneAppFramework::Init(width,height))
return(false);
render_list=new RenderList(device);
if(!InitMDP())
return(false);
@@ -136,28 +121,9 @@ public:
return(true);
}
void BuildCommandBuffer(uint32 index)
{
VulkanApplicationFramework::BuildCommandBuffer(index,render_list);
}
void Resize(int w,int h)override
{
CameraAppFramework::Resize(w,h);
VulkanApplicationFramework::BuildCommandBuffer(render_list);
}
};//class TestApp:public CameraAppFramework
int main(int,char **)
{
TestApp app;
if(!app.Init())
return(-1);
while(app.Run());
return 0;
return RunApp<TestApp>(1280,720);
}

View File

@@ -27,7 +27,7 @@ static float lumiance_data[2]={1,1};
static Color4f white_color(1,1,1,1);
static Color4f yellow_color(1,1,0,1);
class TestApp:public CameraAppFramework
class TestApp:public SceneAppFramework
{
Color4f color;
@@ -35,9 +35,6 @@ class TestApp:public CameraAppFramework
private:
SceneNode render_root;
RenderList * render_list =nullptr;
Material * material =nullptr;
MaterialInstance * mi_plane_grid =nullptr;
MaterialInstance * mi_line =nullptr;
@@ -66,8 +63,6 @@ private:
material=db->CreateMaterial(mci);
if(!material)return(false);
db->global_descriptor.Bind(material);
mi_plane_grid=db->CreateMaterialInstance(material);
if(!mi_plane_grid)return(false);
mi_plane_grid->WriteMIData(white_color);