feature/imgui-sdl
points-test
Last change
on this file since 237cbec was 237cbec, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 4 years ago |
Create a pipeline and shaders to render multicolored lasers
|
-
Property mode
set to
100644
|
File size:
875 bytes
|
Line | |
---|
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 = 0) uniform UniformBufferObject {
|
---|
11 | mat4 view;
|
---|
12 | mat4 proj;
|
---|
13 | } ubo;
|
---|
14 |
|
---|
15 | layout(binding = 1) readonly buffer StorageBufferObject {
|
---|
16 | Object objects[];
|
---|
17 | } sbo;
|
---|
18 |
|
---|
19 | layout(location = 0) in vec3 vertex_position;
|
---|
20 | layout(location = 1) in vec2 texcoords_vs;
|
---|
21 | layout(location = 2) in uint obj_index_vs;
|
---|
22 |
|
---|
23 | layout(location = 0) out vec2 texcoords_fs;
|
---|
24 | layout(location = 1) out uint obj_index_fs;
|
---|
25 |
|
---|
26 | void main() {
|
---|
27 | vec3 position_eye = vec3(ubo.view * sbo.objects[obj_index_vs].model * vec4(vertex_position, 1.0));
|
---|
28 |
|
---|
29 | texcoords_fs = texcoords_vs;
|
---|
30 | obj_index_fs = obj_index_vs;
|
---|
31 |
|
---|
32 | if (sbo.objects[obj_index_vs].deleted) {
|
---|
33 | gl_Position = vec4(0.0, 0.0, 2.0, 1.0);
|
---|
34 | } else {
|
---|
35 | gl_Position = ubo.proj * vec4(position_eye, 1.0);
|
---|
36 | }
|
---|
37 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.