feature/imgui-sdl
Last change
on this file since b01b50c was 237cbec, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 5 years ago |
Create a pipeline and shaders to render multicolored lasers
|
-
Property mode
set to
100644
|
File size:
640 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 |
|
---|
| 10 | layout(binding = 1) readonly buffer StorageBufferObject {
|
---|
| 11 | Object objects[];
|
---|
| 12 | } sbo;
|
---|
| 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);
|
---|
| 23 | vec3 laser_color = sbo.objects[obj_index_fs].color;
|
---|
| 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.