| 1 |
#version 300 es |
| 2 |
|
| 3 |
in vec3 vertexPosition; |
| 4 |
in vec3 vertexNormal; |
| 5 |
|
| 6 |
out vec4 positionInLightSpace; |
| 7 |
out vec3 position; |
| 8 |
out vec3 normal; |
| 9 |
|
| 10 |
uniform mat4 lightViewProjection; |
| 11 |
uniform mat4 modelMatrix; |
| 12 |
uniform mat4 modelView; |
| 13 |
uniform mat3 modelViewNormal; |
| 14 |
uniform mat4 mvp; |
| 15 |
|
| 16 |
void main() |
| 17 |
{ |
| 18 |
// positionInLightSpace = lightViewProjection * modelMatrix * vec4(vertexPosition, 1.0); |
| 19 |
const mat4 shadowMatrix = mat4(0.5, 0.0, 0.0, 0.0, |
| 20 |
0.0, 0.5, 0.0, 0.0, |
| 21 |
0.0, 0.0, 0.5, 0.0, |
| 22 |
0.5, 0.5, 0.5, 1.0); |
| 23 |
|
| 24 |
positionInLightSpace = shadowMatrix * lightViewProjection * modelMatrix * vec4(vertexPosition, 1.0); |
| 25 |
|
| 26 |
normal = normalize(modelViewNormal * vertexNormal); |
| 27 |
position = vec3(modelView * vec4(vertexPosition, 1.0)); |
| 28 |
|
| 29 |
gl_Position = mvp * vec4(vertexPosition, 1.0); |
| 30 |
} |