feature/imgui-sdl
Last change
on this file since 27e580e was 67527a5, checked in by Dmitry Portnoy <dportnoy@…>, 4 years ago |
Switch all per-object buffers to be dynamic uniform buffers instead of shader storage buffers
|
-
Property mode
set to
100644
|
File size:
626 bytes
|
Rev | Line | |
---|
[237cbec] | 1 | #version 450
|
---|
| 2 | #extension GL_ARB_separate_shader_objects : enable
|
---|
| 3 |
|
---|
| 4 | struct Object {
|
---|
| 5 | mat4 model;
|
---|
| 6 | vec3 color;
|
---|
| 7 | bool deleted;
|
---|
| 8 | };
|
---|
| 9 |
|
---|
[67527a5] | 10 | layout(binding = 1) uniform ubo_block {
|
---|
| 11 | Object objects[1024];
|
---|
| 12 | } ubo;
|
---|
[237cbec] | 13 |
|
---|
| 14 | layout(binding = 2) uniform sampler2D laser_texture;
|
---|
| 15 |
|
---|
| 16 | layout(location = 0) in vec2 texcoords_fs;
|
---|
| 17 | layout(location = 1) flat in uint obj_index_fs;
|
---|
| 18 |
|
---|
| 19 | layout(location = 0) out vec4 frag_color;
|
---|
| 20 |
|
---|
| 21 | void main() {
|
---|
| 22 | vec4 texel = texture(laser_texture, texcoords_fs);
|
---|
[67527a5] | 23 | vec3 laser_color = ubo.objects[obj_index_fs].color;
|
---|
[237cbec] | 24 |
|
---|
| 25 | frag_color = vec4(texel.r * laser_color.r, texel.g * laser_color.g, texel.b * laser_color.b, texel.a);
|
---|
| 26 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.