diff --git a/base/VulkanTexture.hpp b/base/VulkanTexture.hpp index fdff7517..0052097f 100644 --- a/base/VulkanTexture.hpp +++ b/base/VulkanTexture.hpp @@ -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(); diff --git a/data/shaders/shadowmapping/scene.frag b/data/shaders/shadowmapping/scene.frag index 367984c8..476c53ed 100644 --- a/data/shaders/shadowmapping/scene.frag +++ b/data/shaders/shadowmapping/scene.frag @@ -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; @@ -65,4 +64,4 @@ void main() outFragColor = vec4(diffuse * shadow, 1.0); -} \ No newline at end of file +} diff --git a/data/shaders/shadowmappingcascade/scene.frag b/data/shaders/shadowmappingcascade/scene.frag index 470b5da6..73c3721c 100644 --- a/data/shaders/shadowmappingcascade/scene.frag +++ b/data/shaders/shadowmappingcascade/scene.frag @@ -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) { @@ -121,4 +120,4 @@ void main() break; } } -} \ No newline at end of file +}