2015-12-15 01:33:16 +00:00
|
|
|
#version 330 core
|
|
|
|
|
|
|
|
// Input
|
2016-12-24 10:05:51 +00:00
|
|
|
layout(location = 0) in vec3 RawPosition;
|
|
|
|
layout(location = 1) in vec3 RawNormal;
|
2015-12-15 01:33:16 +00:00
|
|
|
|
|
|
|
// Output
|
2016-12-24 10:05:51 +00:00
|
|
|
out vec4 LightColor;
|
2015-12-15 01:33:16 +00:00
|
|
|
|
|
|
|
// Uniforms
|
|
|
|
layout(std140) uniform MVPBlock
|
|
|
|
{
|
|
|
|
mat4 ModelMtx;
|
|
|
|
mat4 ViewMtx;
|
|
|
|
mat4 ProjMtx;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Main
|
|
|
|
void main()
|
|
|
|
{
|
2016-12-24 10:05:51 +00:00
|
|
|
mat4 MVP = ModelMtx * ViewMtx * ProjMtx;
|
|
|
|
gl_Position = vec4(RawPosition, 1) * MVP;
|
2015-12-15 01:33:16 +00:00
|
|
|
|
2016-12-24 10:05:51 +00:00
|
|
|
// Fake lighting; render one white skylight pointing straight down with an ambient 0.5
|
|
|
|
float LightDot = dot(RawNormal, vec3(0, 0, -1));
|
|
|
|
float Alpha = (-LightDot + 1.0) / 2;
|
|
|
|
float LightAlpha = mix(0.5, 0.9, Alpha);
|
|
|
|
LightColor = vec4(LightAlpha, LightAlpha, LightAlpha, 1.0);
|
2015-12-15 01:33:16 +00:00
|
|
|
}
|