似乎一切正常了

This commit is contained in:
hyzboy 2019-07-11 22:09:22 +08:00
parent 9d02859f46
commit f3a8028e7c
4 changed files with 22 additions and 17 deletions

View File

@ -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<vulkan::PipelineCreater> 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);

View File

@ -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;

View File

@ -39,7 +39,7 @@ namespace hgl
float height; ///<视图高
float fov=60; ///<水平FOV
float znear=0,zfar=1000; ///<Z轴上离眼睛的距离
float znear=-1,zfar=1; ///<Z轴上离眼睛的距离
Vector4f eye; ///<眼睛坐标
Vector4f center; ///<视点坐标

View File

@ -156,8 +156,8 @@ bool Device::CreateDepthAttachment( List<VkAttachmentReference> &ref_list,List<V
desc->flags = 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;