28 lines
661 B
Plaintext
28 lines
661 B
Plaintext
|
#version 430
|
||
|
|
||
|
struct Fragment
|
||
|
{
|
||
|
vec3 position;
|
||
|
vec3 normal;
|
||
|
vec4 material;
|
||
|
};
|
||
|
|
||
|
layout(location = 0) in vec3 vertex_position;
|
||
|
layout(location = 1) in vec3 vertex_normal;
|
||
|
layout(location = 2) in vec4 vertex_material;
|
||
|
|
||
|
layout(location = 3) in mat4 model_to_world;
|
||
|
|
||
|
layout(location = 0) uniform mat4 world_to_projection;
|
||
|
|
||
|
out Fragment fragment;
|
||
|
|
||
|
void main()
|
||
|
{
|
||
|
vec4 model_position = model_to_world * vec4(vertex_position, 1.0);
|
||
|
vec4 model_normal = model_to_world * vec4(vertex_normal, 0.0);
|
||
|
gl_Position = world_to_projection * model_position;
|
||
|
fragment.position = model_position.xyz;
|
||
|
fragment.normal = model_normal.xyz;
|
||
|
fragment.material = vertex_material;
|
||
|
}
|