Merge branch 'master' of github.com:SaschaWillems/Vulkan
This commit is contained in:
commit
49ee3469b6
3 changed files with 8 additions and 10 deletions
|
|
@ -386,8 +386,8 @@ namespace vks
|
||||||
void* buffer,
|
void* buffer,
|
||||||
VkDeviceSize bufferSize,
|
VkDeviceSize bufferSize,
|
||||||
VkFormat format,
|
VkFormat format,
|
||||||
uint32_t width,
|
uint32_t texWidth,
|
||||||
uint32_t height,
|
uint32_t texHeight,
|
||||||
vks::VulkanDevice *device,
|
vks::VulkanDevice *device,
|
||||||
VkQueue copyQueue,
|
VkQueue copyQueue,
|
||||||
VkFilter filter = VK_FILTER_LINEAR,
|
VkFilter filter = VK_FILTER_LINEAR,
|
||||||
|
|
@ -397,8 +397,8 @@ namespace vks
|
||||||
assert(buffer);
|
assert(buffer);
|
||||||
|
|
||||||
this->device = device;
|
this->device = device;
|
||||||
width = width;
|
width = texWidth;
|
||||||
height = height;
|
height = texHeight;
|
||||||
mipLevels = 1;
|
mipLevels = 1;
|
||||||
|
|
||||||
VkMemoryAllocateInfo memAllocInfo = vks::initializers::memoryAllocateInfo();
|
VkMemoryAllocateInfo memAllocInfo = vks::initializers::memoryAllocateInfo();
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,9 @@ layout (location = 0) out vec4 outFragColor;
|
||||||
|
|
||||||
#define ambient 0.1
|
#define ambient 0.1
|
||||||
|
|
||||||
float textureProj(vec4 P, vec2 off)
|
float textureProj(vec4 shadowCoord, vec2 off)
|
||||||
{
|
{
|
||||||
float shadow = 1.0;
|
float shadow = 1.0;
|
||||||
vec4 shadowCoord = P / P.w;
|
|
||||||
if ( shadowCoord.z > -1.0 && shadowCoord.z < 1.0 )
|
if ( shadowCoord.z > -1.0 && shadowCoord.z < 1.0 )
|
||||||
{
|
{
|
||||||
float dist = texture( shadowMap, shadowCoord.st + off ).r;
|
float dist = texture( shadowMap, shadowCoord.st + off ).r;
|
||||||
|
|
@ -65,4 +64,4 @@ void main()
|
||||||
|
|
||||||
outFragColor = vec4(diffuse * shadow, 1.0);
|
outFragColor = vec4(diffuse * shadow, 1.0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,12 +33,11 @@ const mat4 biasMat = mat4(
|
||||||
0.5, 0.5, 0.0, 1.0
|
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 shadow = 1.0;
|
||||||
float bias = 0.005;
|
float bias = 0.005;
|
||||||
|
|
||||||
vec4 shadowCoord = P / P.w;
|
|
||||||
if ( shadowCoord.z > -1.0 && shadowCoord.z < 1.0 ) {
|
if ( shadowCoord.z > -1.0 && shadowCoord.z < 1.0 ) {
|
||||||
float dist = texture(shadowMap, vec3(shadowCoord.st + offset, cascadeIndex)).r;
|
float dist = texture(shadowMap, vec3(shadowCoord.st + offset, cascadeIndex)).r;
|
||||||
if (shadowCoord.w > 0 && dist < shadowCoord.z - bias) {
|
if (shadowCoord.w > 0 && dist < shadowCoord.z - bias) {
|
||||||
|
|
@ -121,4 +120,4 @@ void main()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue