diff options
Diffstat (limited to 'gfx/gl/shaders/materialDetail.glsl')
-rw-r--r-- | gfx/gl/shaders/materialDetail.glsl | 14 |
1 files changed, 14 insertions, 0 deletions
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)); +} |