2018-09-14 22:09:43 +00:00
|
|
|
#version 430
|
2018-09-15 07:46:42 +00:00
|
|
|
|
|
|
|
struct Fragment
|
|
|
|
{
|
|
|
|
vec3 position;
|
|
|
|
vec3 normal;
|
|
|
|
vec4 material;
|
|
|
|
};
|
|
|
|
|
2018-09-18 20:26:51 +00:00
|
|
|
layout(location = 0) in vec3 vertex_position;
|
|
|
|
layout(location = 1) in vec3 vertex_normal;
|
|
|
|
layout(location = 2) in vec4 vertex_material;
|
|
|
|
|
2018-09-15 03:30:14 +00:00
|
|
|
layout(location = 3) in mat4 model_to_world;
|
2018-09-14 22:09:43 +00:00
|
|
|
|
|
|
|
layout(location = 0) uniform mat4 world_to_projection;
|
|
|
|
|
2018-09-15 07:46:42 +00:00
|
|
|
out Fragment fragment;
|
2018-09-15 01:29:05 +00:00
|
|
|
|
2018-09-14 22:09:43 +00:00
|
|
|
void main()
|
|
|
|
{
|
2018-09-18 20:26:51 +00:00
|
|
|
vec4 model_position = model_to_world * vec4(vertex_position, 1.0);
|
|
|
|
vec4 model_normal = model_to_world * vec4(vertex_normal, 0.0);
|
2018-09-15 01:29:05 +00:00
|
|
|
gl_Position = world_to_projection * model_position;
|
2018-09-15 07:46:42 +00:00
|
|
|
fragment.position = model_position.xyz;
|
|
|
|
fragment.normal = model_normal.xyz;
|
2018-09-18 20:26:51 +00:00
|
|
|
fragment.material = vertex_material;
|
2018-09-14 22:09:43 +00:00
|
|
|
}
|