diff --git a/example/Vulkan/Deferred.cpp b/example/Vulkan/Deferred.cpp index d68701d9..741aa4ac 100644 --- a/example/Vulkan/Deferred.cpp +++ b/example/Vulkan/Deferred.cpp @@ -28,8 +28,16 @@ constexpr uint32_t SCREEN_HEIGHT=128; using Texture2DPointer=vulkan::Texture2D *; constexpr VkFormat position_candidate_format[]={FMT_RGBA32F,FMT_RGBA16F}; -constexpr VkFormat color_candidate_format []={FMT_RGBA32F,FMT_RGBA16F,FMT_RGB16UN,FMT_RGB16SN,FMT_RGBA8UN,FMT_RGBA8SN,FMT_RGBA8U,FMT_RGB565,FMT_BGR565}; -constexpr VkFormat normal_candidate_format []={FMT_RGBA32F,FMT_RGBA16F}; +constexpr VkFormat color_candidate_format []={FMT_RGBA32F, + FMT_RGBA16F,FMT_RGB16UN,FMT_RGB16SN, + FMT_RGBA8UN,FMT_RGBA8SN,FMT_RGBA8U, + FMT_BGRA8UN,FMT_BGRA8SN,FMT_BGRA8U, + FMT_ABGR8UN,FMT_ABGR8SN,FMT_ABGR8U, + FMT_RGB565,FMT_BGR565}; +constexpr VkFormat normal_candidate_format []={FMT_RGBA32F, + FMT_RGBA16F, + FMT_A2RGB10UN,FMT_A2RGB10SN,FMT_A2BGR10UN, + FMT_A2BGR10SN}; constexpr VkFormat depth_candidate_format []={FMT_D32F,FMT_D32F_S8U,FMT_X8_D24,FMT_D24UN_S8U,FMT_D16UN,FMT_D16UN_S8U}; class TestApp:public CameraAppFramework @@ -222,11 +230,8 @@ private: bool InitGBufferPipeline(SubpassParam *sp) { AutoDelete pipeline_creater=new vulkan::PipelineCreater(device,sp->material,gbuffer.renderpass,gbuffer.extent); - pipeline_creater->SetDepthTest(true); - pipeline_creater->SetDepthWrite(true); - pipeline_creater->SetDepthCompareOp(VK_COMPARE_OP_ALWAYS); //pipeline_creater->SetCullMode(VK_CULL_MODE_BACK_BIT); - pipeline_creater->SetCullMode(VK_CULL_MODE_NONE); + pipeline_creater->CloseCullFace(); pipeline_creater->Set(PRIM_TRIANGLES); sp->pipeline=pipeline_creater->Create(); @@ -327,7 +332,7 @@ private: } { - ro_sphere=CreateRenderableSphere(db,mtl,16); + ro_sphere=CreateRenderableSphere(db,mtl,64); } { @@ -368,12 +373,12 @@ private: { CreateRenderObject(sp->material); render_root.Add(db->CreateRenderableInstance(sp->pipeline,sp->desc_sets,ro_cube),scale(50,50,50)); - //render_root.Add(db->CreateRenderableInstance(sp->pipeline,sp->desc_sets,ro_plane_grid)); - //render_root.Add(db->CreateRenderableInstance(sp->pipeline,sp->desc_sets,ro_torus)); - //render_root.Add(db->CreateRenderableInstance(sp->pipeline,sp->desc_sets,ro_cube ),translate(-10, 0, 5)*scale(10,10,10)); - //render_root.Add(db->CreateRenderableInstance(sp->pipeline,sp->desc_sets,ro_sphere ),translate( 10, 0, 5)*scale(10,10,10)); - //render_root.Add(db->CreateRenderableInstance(sp->pipeline,sp->desc_sets,ro_cylinder ),translate( 0, 16, 0)); - //render_root.Add(db->CreateRenderableInstance(sp->pipeline,sp->desc_sets,ro_cone ),translate( 0,-16, 0)); + render_root.Add(db->CreateRenderableInstance(sp->pipeline,sp->desc_sets,ro_plane_grid)); + render_root.Add(db->CreateRenderableInstance(sp->pipeline,sp->desc_sets,ro_torus)); + render_root.Add(db->CreateRenderableInstance(sp->pipeline,sp->desc_sets,ro_cube ),translate(-10, 0, 5)*scale(10,10,10)); + render_root.Add(db->CreateRenderableInstance(sp->pipeline,sp->desc_sets,ro_sphere ),translate( 10, 0, 5)*scale(40,40,40)); + render_root.Add(db->CreateRenderableInstance(sp->pipeline,sp->desc_sets,ro_cylinder ),translate( 0, 16, 0)); + render_root.Add(db->CreateRenderableInstance(sp->pipeline,sp->desc_sets,ro_cone ),translate( 0,-16, 0)); render_root.RefreshMatrix(); render_root.ExpendToList(&render_list); diff --git a/example/Vulkan/VulkanAppFramework.h b/example/Vulkan/VulkanAppFramework.h index 9b1ff438..e30bc386 100644 --- a/example/Vulkan/VulkanAppFramework.h +++ b/example/Vulkan/VulkanAppFramework.h @@ -276,7 +276,7 @@ public: camera.width=w; camera.height=h; camera.center.Set(0,0,0,1); - camera.eye.Set(100,100,100,1); + camera.eye.Set(100,100,0,1); //xyz三个值不要一样,以方便调试 camera.znear=-1; camera.zfar=1; diff --git a/inc/hgl/graph/Camera.h b/inc/hgl/graph/Camera.h index 937f706f..d83e78e2 100644 --- a/inc/hgl/graph/Camera.h +++ b/inc/hgl/graph/Camera.h @@ -39,7 +39,7 @@ namespace hgl float height; ///<视图高 float fov=60; ///<水平FOV - float znear=0,zfar=1000; /// &ref_list,Listflags = 0; desc->samples = VK_SAMPLE_COUNT_1_BIT; desc->loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR; //LOAD_OP_CLEAR代表LOAD时清空内容 - desc->storeOp = VK_ATTACHMENT_STORE_OP_STORE; //STORE_OP_STROE代表SOTRE时储存内容 - desc->stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; //DONT CARE表示不在意 + desc->storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; //DONT CARE表示不在意 + desc->stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; desc->stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; desc->initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; //代表不关心初始布局 desc->finalLayout = depth_final_layout;