From 26c60d5ace9b2a0667a930c4c92a3990a1d7d1dc Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 10 Aug 2024 18:01:13 +0100 Subject: Fix texture usage via materials in shadows This is a mess of a commit much like the shader folder, need a better way of dealing with them. --- gfx/gl/shaders/getMaterialDetail.glsl | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 gfx/gl/shaders/getMaterialDetail.glsl (limited to 'gfx/gl/shaders/getMaterialDetail.glsl') diff --git a/gfx/gl/shaders/getMaterialDetail.glsl b/gfx/gl/shaders/getMaterialDetail.glsl new file mode 100644 index 0000000..f819fb2 --- /dev/null +++ b/gfx/gl/shaders/getMaterialDetail.glsl @@ -0,0 +1,12 @@ +MaterialDetail +getMaterialDetail(uint midx) +{ + if (midx > 0u) { + const vec4 sPosSize = texture(materialData, uvec2(0, midx - 1u)); + const uvec4 sMode = texture(materialData, uvec2(1, midx - 1u)); + const uint mapmodeU = sMode.x & 0xFu; + const uint mapmodeV = (sMode.x & 0xF0u) >> 1; + return MaterialDetail(sPosSize.xy, sPosSize.zw, uvec2(mapmodeU, mapmodeV)); + } + return MaterialDetail(vec2(0, 0), vec2(0, 0), uvec2(0, 0)); +} -- cgit v1.2.3