diff --git a/CMSceneGraph b/CMSceneGraph index 06a42e93..bf7152ae 160000 --- a/CMSceneGraph +++ b/CMSceneGraph @@ -1 +1 @@ -Subproject commit 06a42e93940fd2a377d5c4cbf5c4c8662d31ce3a +Subproject commit bf7152aee5cffa219c6675c03d1e075b9c98c3bf diff --git a/example/Vulkan/InlineGeometryScene.cpp b/example/Vulkan/InlineGeometryScene.cpp index c09e412d..eca256d5 100644 --- a/example/Vulkan/InlineGeometryScene.cpp +++ b/example/Vulkan/InlineGeometryScene.cpp @@ -11,8 +11,8 @@ using namespace hgl; using namespace hgl::graph; -constexpr uint32_t SCREEN_WIDTH=128; -constexpr uint32_t SCREEN_HEIGHT=128; +constexpr uint32_t SCREEN_WIDTH=1280; +constexpr uint32_t SCREEN_HEIGHT=720; class TestApp:public CameraAppFramework { @@ -42,8 +42,8 @@ private: bool InitMaterial() { - material=shader_manage->CreateMaterial(OS_TEXT("res/shader/OnlyPosition3D.vert.spv"), - OS_TEXT("res/shader/FlatColor.frag.spv")); + material=shader_manage->CreateMaterial(OS_TEXT("res/shader/OnlyPosition3D.vert"), + OS_TEXT("res/shader/FlatColor.frag")); if(!material) return(false); @@ -138,7 +138,7 @@ private: material_instance->BindUBO("color_material",ubo_color); - if(!InitCameraUBO(material_instance,"world")) + if(!material_instance->BindUBO("world",GetCameraMatrixBuffer())) return(false); material_instance->Update(); diff --git a/example/Vulkan/SceneTree.cpp b/example/Vulkan/SceneTree.cpp index 123a0b13..32afa385 100644 --- a/example/Vulkan/SceneTree.cpp +++ b/example/Vulkan/SceneTree.cpp @@ -17,7 +17,13 @@ constexpr uint32_t SCREEN_HEIGHT=720; class TestApp:public CameraAppFramework { - Color4f color; + struct + { + Vector4f color; + Vector4f abiment; + }color_material; + + Vector3f sun_direction; private: @@ -30,6 +36,7 @@ private: vulkan::MaterialInstance * material_instance =nullptr; vulkan::Buffer * ubo_color =nullptr; + vulkan::Buffer * ubo_sun =nullptr; vulkan::Renderable * renderable_object =nullptr; @@ -48,8 +55,8 @@ private: bool InitMaterial() { - material=shader_manage->CreateMaterial(OS_TEXT("res/shader/OnlyPosition3D.vert"), - OS_TEXT("res/shader/FlatColor.frag")); + material=shader_manage->CreateMaterial(OS_TEXT("res/shader/LightPosition3D.vert"), + OS_TEXT("res/shader/VertexColor.frag")); if(!material) return(false); @@ -62,22 +69,30 @@ private: void CreateRenderObject() { - struct CubeCreateInfo cci; + renderable_object=CreateRenderableSphere(db,material,40); - renderable_object=CreateRenderableCube(db,material,&cci); + db->Add(renderable_object); } bool InitUBO() { - if(!InitCameraUBO(material_instance,"world")) - return(false); - - color.Set(1,1,0,1); - ubo_color=device->CreateUBO(sizeof(Color4f),&color); + LCG lcg; + color_material.color=Vector4f(1,1,1,1.0); + color_material.abiment.Set(0.25,0.25,0.25,1.0); + ubo_color=device->CreateUBO(sizeof(color_material),&color_material); + + sun_direction=Vector3f::RandomDir(lcg); + ubo_sun=device->CreateUBO(sizeof(sun_direction),&sun_direction); + + material_instance->BindUBO("world",GetCameraMatrixBuffer()); material_instance->BindUBO("color_material",ubo_color); + material_instance->BindUBO("sun",ubo_sun); material_instance->Update(); + + db->Add(ubo_color); + db->Add(ubo_sun); return(true); } @@ -88,7 +103,7 @@ private: pipeline_creater->SetDepthTest(true); pipeline_creater->SetDepthWrite(true); pipeline_creater->CloseCullFace(); - pipeline_creater->SetPolygonMode(VK_POLYGON_MODE_LINE); + pipeline_creater->SetPolygonMode(VK_POLYGON_MODE_FILL); pipeline_creater->Set(PRIM_TRIANGLES); pipeline_line=pipeline_creater->Create(); diff --git a/example/Vulkan/SimplePBRForward.cpp b/example/Vulkan/SimplePBRForward.cpp index 330f3ecb..d1b39db6 100644 --- a/example/Vulkan/SimplePBRForward.cpp +++ b/example/Vulkan/SimplePBRForward.cpp @@ -82,6 +82,9 @@ private: vulkan::Material * material =nullptr; vulkan::MaterialInstance * material_instance =nullptr; + vulkan::Material * pbr_material =nullptr; + vulkan::MaterialInstance * pbr_material_instance =nullptr; + vulkan::Pipeline * pipeline_wireframe =nullptr; vulkan::Pipeline * pipeline_lines =nullptr; @@ -100,10 +103,15 @@ private: private: + bool InitPBRMaterial() + { + + } + bool InitMaterial() { - material=shader_manage->CreateMaterial(OS_TEXT("res/shader/OnlyPosition3D.vert.spv"), - OS_TEXT("res/shader/FlatColor.frag.spv")); + material=shader_manage->CreateMaterial(OS_TEXT("res/shader/OnlyPosition3D.vert"), + OS_TEXT("res/shader/FlatColor.frag")); if(!material) return(false); diff --git a/res b/res index 23685cd8..69343b3b 160000 --- a/res +++ b/res @@ -1 +1 @@ -Subproject commit 23685cd868ff941da4f0974035c8f4aa23594e03 +Subproject commit 69343b3bc6fb464f89ec22eca52c379dec58ac68