[1908591] | 1 | #version 450
|
---|
| 2 | #extension GL_ARB_separate_shader_objects : enable
|
---|
| 3 |
|
---|
[8e02b6b] | 4 | // TODO: Figure out if the UniformBufferObject label is necessary and, if not, remove it
|
---|
[1908591] | 5 | layout (binding = 0) uniform UniformBufferObject {
|
---|
| 6 | mat4 model;
|
---|
| 7 | mat4 view;
|
---|
| 8 | mat4 proj;
|
---|
| 9 | } ubo;
|
---|
| 10 |
|
---|
| 11 | layout(location = 0) in vec3 vertex_position;
|
---|
| 12 | layout(location = 1) in vec3 vertex_color;
|
---|
[8e02b6b] | 13 | //layout(location = 2) in vec3 vertex_normal;
|
---|
| 14 | //layout(location = 3) in uint ubo_index;
|
---|
[1908591] | 15 |
|
---|
| 16 | //out vec3 position_eye, normal_eye, color, light_position_eye, light2_position_eye;
|
---|
| 17 | layout(location = 0) out vec3 position_eye;
|
---|
| 18 | layout(location = 1) out vec3 color;
|
---|
[aa00bf2] | 19 | layout(location = 2) out vec3 light_position_eye;
|
---|
| 20 | layout(location = 3) out vec3 light2_position_eye;
|
---|
[1908591] | 21 |
|
---|
| 22 | // fixed point light position
|
---|
[aa00bf2] | 23 | vec3 light_position_world = vec3(0.0, 0.0, 2.0);
|
---|
| 24 | vec3 light2_position_world = vec3(0.0, 1.5, -0.1);
|
---|
[1908591] | 25 |
|
---|
| 26 | void main() {
|
---|
[8e02b6b] | 27 | //position_eye = vec3(view * model_mats[ubo_index] * vec4(vertex_position, 1.0));
|
---|
| 28 | position_eye = vec3(ubo.view * ubo.model * vec4(vertex_position, 1.0));
|
---|
| 29 | //normal_eye = normalize(vec3(view * model_mats[ubo_index] * vec4(vertex_normal, 0.0)));
|
---|
| 30 | color = vertex_color;
|
---|
[aa00bf2] | 31 | light_position_eye = vec3(ubo.view * vec4(light_position_world, 1.0));
|
---|
| 32 | light2_position_eye = vec3(ubo.view * vec4(light2_position_world, 1.0));
|
---|
[1908591] | 33 |
|
---|
[8e02b6b] | 34 | gl_Position = ubo.proj * vec4(position_eye, 1.0);
|
---|
[1908591] | 35 | }
|
---|