blob: dda8626411f533536cdb1194dbe677952bd98ad6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#version 330 core
layout(location = 0) in vec3 vertexPosition_modelspace;
layout(location = 1) in vec3 vertexNormal;
out vec2 UV;
out vec3 normIn;
out vec3 camDirIn;
out vec3 lightDirIn;
//out vec3 vertPos;
uniform mat4 MVP;
uniform mat4 worldMat;
const vec3 Tuning_LightPos = vec3(1, 1, 1.0);
void main()
{
gl_Position = MVP * vec4(vertexPosition_modelspace,1);
UV = (vertexPosition_modelspace.xy+vec2(1,1))/2.0;
normIn = vertexNormal;
mat3 invWorldRot = transpose(mat3(worldMat[0].xyz, worldMat[1].xyz, worldMat[2].xyz));
//mat3 invWorldRot = mat3(1.0f);
vec3 worldPos = (worldMat * vec4(vertexPosition_modelspace,1)).xyz;
camDirIn = invWorldRot * (vec3(0,0,1) - worldPos);
//camDir = worldPos;
lightDirIn = invWorldRot * (Tuning_LightPos - worldPos);
//vec4 vertPos4 = vec4(vertexPosition_modelspace,1);
//vertPos = vec3(vertPos4) / vertPos4.w;
}
|