diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-12-17 12:14:35 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-12-17 12:14:35 +0000 |
commit | cbc94ed8572cd4ea4e22ad5437b54eea055235d9 (patch) | |
tree | 8fe8d0016124f7e4fa19a72a6fe6c9ea48b6ab2c /gfx/gl/shaders/directionalLight.fs | |
parent | Use a separate framebuffer for illumination phase (diff) | |
download | ilt-cbc94ed8572cd4ea4e22ad5437b54eea055235d9.tar.bz2 ilt-cbc94ed8572cd4ea4e22ad5437b54eea055235d9.tar.xz ilt-cbc94ed8572cd4ea4e22ad5437b54eea055235d9.zip |
Use 32bit integer texture for position render data
Diffstat (limited to 'gfx/gl/shaders/directionalLight.fs')
-rw-r--r-- | gfx/gl/shaders/directionalLight.fs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gfx/gl/shaders/directionalLight.fs b/gfx/gl/shaders/directionalLight.fs index ca10ef5..3756db7 100644 --- a/gfx/gl/shaders/directionalLight.fs +++ b/gfx/gl/shaders/directionalLight.fs @@ -7,7 +7,7 @@ out vec3 FragColor; in vec2 TexCoords; -layout(binding = 0) uniform sampler2D gPosition; +layout(binding = 0) uniform isampler2D gPosition; layout(binding = 1) uniform sampler2D gNormal; layout(binding = 2) uniform sampler2D shadowMap; @@ -27,7 +27,7 @@ insideShadowCube(vec3 v) } float -isShaded(vec3 Position) +isShaded(ivec3 Position) { for (uint m = 0u; m < lightViewProjectionCount; m++) { vec3 PositionInLightSpace = (lightViewProjection[m] * vec4(Position, 1.0f)).xyz; @@ -44,7 +44,7 @@ isShaded(vec3 Position) void main() { - const vec3 Position = texture(gPosition, TexCoords).xyz; + const ivec3 Position = texture(gPosition, TexCoords).xyz; const vec3 Normal = texture(gNormal, TexCoords).rgb; const float shaded = isShaded(Position); FragColor = (1 - shaded) * max(dot(-lightDirection, Normal) * lightColour, 0); |