| 1 |
#version 150 core |
| 2 |
|
| 3 |
in vec3 vertexPosition; |
| 4 |
in vec3 vertexNormal; |
| 5 |
in vec2 vertexTexCoord; |
| 6 |
in vec4 vertexTangent; |
| 7 |
|
| 8 |
out vec3 worldPosition; |
| 9 |
out vec3 worldNormal; |
| 10 |
out vec4 worldTangent; |
| 11 |
out vec2 texCoord; |
| 12 |
|
| 13 |
uniform mat4 modelMatrix; |
| 14 |
uniform mat3 modelNormalMatrix; |
| 15 |
uniform mat4 mvp; |
| 16 |
|
| 17 |
void main() |
| 18 |
{ |
| 19 |
// Scale texture coordinates for for fragment shader |
| 20 |
texCoord = vertexTexCoord; |
| 21 |
|
| 22 |
// Transform position, normal, and tangent to world coords |
| 23 |
worldPosition = vec3(modelMatrix * vec4(vertexPosition, 1.0)); |
| 24 |
worldNormal = normalize(modelNormalMatrix * vertexNormal); |
| 25 |
worldTangent.xyz = normalize(vec3(modelMatrix * vec4(vertexTangent.xyz, 0.0))); |
| 26 |
worldTangent.w = vertexTangent.w; |
| 27 |
|
| 28 |
// Calculate animated vertex positions |
| 29 |
|
| 30 |
float sinPos = (vertexPosition.z)+(vertexPosition.x); |
| 31 |
float sinPos2 = (vertexPosition.y/2)+(vertexPosition.z); |
| 32 |
vec3 vertMod = vec3(vertexPosition.x,vertexPosition.y,vertexPosition.z); |
| 33 |
|
| 34 |
// Calculate vertex position in clip coordinates |
| 35 |
gl_Position = mvp * vec4(vertexPosition, 1.0); |
| 36 |
} |