diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-07-21 01:44:42 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-08-10 18:08:41 +0100 |
commit | a39e5a0bc8df00d79773a0cc3318125c736028e4 (patch) | |
tree | 86fca75e943aabef49ff7eeddc91d9a79beeca7b | |
parent | Pull material lookup functions into a common file (diff) | |
download | ilt-a39e5a0bc8df00d79773a0cc3318125c736028e4.tar.bz2 ilt-a39e5a0bc8df00d79773a0cc3318125c736028e4.tar.xz ilt-a39e5a0bc8df00d79773a0cc3318125c736028e4.zip |
Pull material detail function into a common file
-rw-r--r-- | gfx/gl/shaders/commonPoint.glsl | 15 | ||||
-rw-r--r-- | gfx/gl/shaders/materialDetail.glsl | 14 |
2 files changed, 15 insertions, 14 deletions
diff --git a/gfx/gl/shaders/commonPoint.glsl b/gfx/gl/shaders/commonPoint.glsl index 2d9e388..6272d0b 100644 --- a/gfx/gl/shaders/commonPoint.glsl +++ b/gfx/gl/shaders/commonPoint.glsl @@ -1,17 +1,4 @@ -layout(binding = 1) uniform usampler2DRect materialData; - -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)); -} +include(`materialDetail.glsl') void main() diff --git a/gfx/gl/shaders/materialDetail.glsl b/gfx/gl/shaders/materialDetail.glsl new file mode 100644 index 0000000..05cf2c7 --- /dev/null +++ b/gfx/gl/shaders/materialDetail.glsl @@ -0,0 +1,14 @@ +layout(binding = 1) uniform usampler2DRect materialData; + +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)); +} |