更改测试
This commit is contained in:
parent
5d61707b4d
commit
ee30e6acce
@ -1,4 +1,4 @@
|
|||||||
// 9.延迟渲染
|
// 9.延迟渲染
|
||||||
// 简单的延迟渲染测试,仅一个太阳光
|
// 简单的延迟渲染测试,仅一个太阳光
|
||||||
|
|
||||||
#include"VulkanAppFramework.h"
|
#include"VulkanAppFramework.h"
|
||||||
@ -224,6 +224,7 @@ private:
|
|||||||
AutoDelete<vulkan::PipelineCreater> pipeline_creater=new vulkan::PipelineCreater(device,sp->material,gbuffer.renderpass,gbuffer.extent);
|
AutoDelete<vulkan::PipelineCreater> pipeline_creater=new vulkan::PipelineCreater(device,sp->material,gbuffer.renderpass,gbuffer.extent);
|
||||||
pipeline_creater->SetDepthTest(true);
|
pipeline_creater->SetDepthTest(true);
|
||||||
pipeline_creater->SetDepthWrite(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_BACK_BIT);
|
||||||
pipeline_creater->SetCullMode(VK_CULL_MODE_NONE);
|
pipeline_creater->SetCullMode(VK_CULL_MODE_NONE);
|
||||||
pipeline_creater->Set(PRIM_TRIANGLES);
|
pipeline_creater->Set(PRIM_TRIANGLES);
|
||||||
|
@ -14,7 +14,7 @@ layout (location = 2) out vec4 outColor;
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
outPosition=vec4(FragmentPosition,1.0);
|
outPosition=vec4(normalize(FragmentPosition*2.0-vec3(1.0)),1.0);
|
||||||
|
|
||||||
/* vec3 N = normalize(FragmentNormal);
|
/* vec3 N = normalize(FragmentNormal);
|
||||||
N.y=-N.y;
|
N.y=-N.y;
|
||||||
@ -25,6 +25,6 @@ void main()
|
|||||||
|
|
||||||
//outNormal=vec4(tnorm,1.0);
|
//outNormal=vec4(tnorm,1.0);
|
||||||
|
|
||||||
outNormal=vec4(FragmentNormal,1.0);
|
outNormal=vec4(normalize(FragmentNormal*2.0-vec3(1.0)),1.0);
|
||||||
outColor=texture(TextureColor,FragmentTexCoord);
|
outColor=texture(TextureColor,FragmentTexCoord);
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ void main()
|
|||||||
|
|
||||||
gl_Position=pos*world.mvp;
|
gl_Position=pos*world.mvp;
|
||||||
|
|
||||||
FragmentPosition=pos.xyz;
|
FragmentPosition=(pos*world.modelview).xyz;
|
||||||
FragmentTexCoord=TexCoord;
|
FragmentTexCoord=TexCoord;
|
||||||
|
|
||||||
// mat3 n=inverse(mat3(pc.local_to_world));
|
// mat3 n=inverse(mat3(pc.local_to_world));
|
||||||
@ -38,6 +38,6 @@ void main()
|
|||||||
// FragmentNormal=normalize(Normal)*n;
|
// FragmentNormal=normalize(Normal)*n;
|
||||||
// FragmentTangent=normalize(Tangent)*n;
|
// FragmentTangent=normalize(Tangent)*n;
|
||||||
|
|
||||||
FragmentNormal=normalize((Normal+vec3(1.0))/2.0);
|
FragmentNormal=Normal;
|
||||||
FragmentTangent=Tangent;
|
FragmentTangent=Tangent;
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ namespace
|
|||||||
|
|
||||||
bool CreateDepthBuffer(DeviceAttribute *rsa)
|
bool CreateDepthBuffer(DeviceAttribute *rsa)
|
||||||
{
|
{
|
||||||
const VkFormat depth_format=rsa->physical_device->GetDepthFormat();
|
const VkFormat depth_format=rsa->physical_device->GetDepthFormat(false);
|
||||||
|
|
||||||
const VkFormatProperties props=rsa->physical_device->GetFormatProperties(depth_format);
|
const VkFormatProperties props=rsa->physical_device->GetFormatProperties(depth_format);
|
||||||
|
|
||||||
|
@ -24,6 +24,9 @@ ImageView *CreateImageView(VkDevice device,VkImageViewType type,VkFormat format,
|
|||||||
|
|
||||||
if(aspectMask&VK_IMAGE_ASPECT_DEPTH_BIT)
|
if(aspectMask&VK_IMAGE_ASPECT_DEPTH_BIT)
|
||||||
{
|
{
|
||||||
|
if(format>=VK_FORMAT_D16_UNORM_S8_UINT)
|
||||||
|
iv_createinfo.subresourceRange.aspectMask|=VK_IMAGE_ASPECT_STENCIL_BIT;
|
||||||
|
|
||||||
iv_createinfo.components.r=VK_COMPONENT_SWIZZLE_IDENTITY;
|
iv_createinfo.components.r=VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||||
iv_createinfo.components.g=VK_COMPONENT_SWIZZLE_IDENTITY;
|
iv_createinfo.components.g=VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||||
iv_createinfo.components.b=VK_COMPONENT_SWIZZLE_IDENTITY;
|
iv_createinfo.components.b=VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user