tests/manual/rhi/tex3d/texture3d.frag
raw| 1 | #version 440 |
| 2 | |
| 3 | layout(location = 0) in vec2 v_texcoord; |
| 4 | |
| 5 | layout(location = 0) out vec4 fragColor; |
| 6 | |
| 7 | layout(std140, binding = 0) uniform buf { |
| 8 | mat4 mvp; |
| 9 | int flip; |
| 10 | int idx; |
| 11 | } ubuf; |
| 12 | |
| 13 | layout(binding = 1) uniform sampler3D tex; |
| 14 | |
| 15 | void main() |
| 16 | { |
| 17 | float w = 0.0; |
| 18 | if (ubuf.idx == 1) |
| 19 | w = 0.5; |
| 20 | else if (ubuf.idx == 2) |
| 21 | w = 1.0; |
| 22 | vec4 c = texture(tex, vec3(v_texcoord, w)); |
| 23 | fragColor = vec4(c.rgb * c.a, c.a); |
| 24 | } |