42 lines
1017 B
GLSL
42 lines
1017 B
GLSL
#version 400
|
|
uniform mat4 camera;
|
|
uniform mat4 modelViewMatrix;
|
|
uniform mat4 projectionMatrix;
|
|
|
|
uniform mat4 normalMatrix;
|
|
uniform mat4 modelMatrix;
|
|
|
|
layout(location = 0) in vec3 position;
|
|
layout(location = 1) in vec2 inCoord;
|
|
|
|
layout (location = 2) in float zPos;
|
|
layout (location =3) in vec3 inNormal;
|
|
|
|
//in float height;
|
|
out vec2 fragTexCoord;
|
|
out vec2 tilePos;
|
|
out vec3 fragVert;
|
|
smooth out vec3 vWorldPos;
|
|
uniform mat4 MVP;
|
|
smooth out vec3 vNormal;
|
|
out float z_pos;
|
|
void main()
|
|
{
|
|
|
|
vec4 inPositionScaled = vec4(position, 1.0);
|
|
gl_Position = MVP *vec4(position.x,position.y,zPos, 1.0);
|
|
vec4 texp= modelViewMatrix *vec4(position.x,position.y,0, 1.0);
|
|
fragTexCoord = vec2(texp.x/2,texp.y/2);
|
|
vec4 tpos = modelMatrix*vec4(position.x,position.y,0, 1.0);
|
|
tilePos = vec2(tpos.x,tpos.y);
|
|
//vColor = vec4(color, 1.0);
|
|
vec4 vRes = vec4(inNormal, 0.0);
|
|
vNormal = inNormal.xyz;
|
|
fragVert = position;
|
|
|
|
vec4 vWorldPosLocal =modelMatrix*inPositionScaled;
|
|
vWorldPos = vWorldPosLocal.xyz;
|
|
z_pos=zPos;
|
|
}
|
|
|