Merge branch 'master' of github.com:SaschaWillems/Vulkan

This commit is contained in:
Sascha Willems 2019-01-31 20:10:04 +01:00
commit 49ee3469b6
3 changed files with 8 additions and 10 deletions

View file

@ -386,8 +386,8 @@ namespace vks
void* buffer,
VkDeviceSize bufferSize,
VkFormat format,
uint32_t width,
uint32_t height,
uint32_t texWidth,
uint32_t texHeight,
vks::VulkanDevice *device,
VkQueue copyQueue,
VkFilter filter = VK_FILTER_LINEAR,
@ -397,8 +397,8 @@ namespace vks
assert(buffer);
this->device = device;
width = width;
height = height;
width = texWidth;
height = texHeight;
mipLevels = 1;
VkMemoryAllocateInfo memAllocInfo = vks::initializers::memoryAllocateInfo();

View file

@ -14,10 +14,9 @@ layout (location = 0) out vec4 outFragColor;
#define ambient 0.1
float textureProj(vec4 P, vec2 off)
float textureProj(vec4 shadowCoord, vec2 off)
{
float shadow = 1.0;
vec4 shadowCoord = P / P.w;
if ( shadowCoord.z > -1.0 && shadowCoord.z < 1.0 )
{
float dist = texture( shadowMap, shadowCoord.st + off ).r;

View file

@ -33,12 +33,11 @@ const mat4 biasMat = mat4(
0.5, 0.5, 0.0, 1.0
);
float textureProj(vec4 P, vec2 offset, uint cascadeIndex)
float textureProj(vec4 shadowCoord, vec2 offset, uint cascadeIndex)
{
float shadow = 1.0;
float bias = 0.005;
vec4 shadowCoord = P / P.w;
if ( shadowCoord.z > -1.0 && shadowCoord.z < 1.0 ) {
float dist = texture(shadowMap, vec3(shadowCoord.st + offset, cascadeIndex)).r;
if (shadowCoord.w > 0 && dist < shadowCoord.z - bias) {