charcoal/OpenGLEngine/LitVS.glsl
elipzer 1eea92a3af LitScene Phong Lighting Complete
Now, LitScene allows for simple lighting. (Shadows still to come).
Ambient, specular, and diffuse lighting available and each mesh's
vertex can define a material that defines its reflectivity. An
example scene was added to the MyApplication as the scene for the
6 button.
2018-09-15 03:46:42 -04:00

32 lines
629 B
GLSL

#version 430
struct Vertex
{
vec3 position;
vec3 normal;
vec4 material;
};
struct Fragment
{
vec3 position;
vec3 normal;
vec4 material;
};
layout(location = 0) in Vertex vertex;
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;
}