units
This commit is contained in:
+17
-15
@@ -5,14 +5,14 @@ uniform mat4 projectionMatrix;
|
||||
|
||||
uniform mat4 normalMatrix;
|
||||
uniform mat4 modelMatrix;
|
||||
uniform mat4 worldMatrix;
|
||||
|
||||
layout(location = 0) in vec3 position;
|
||||
layout(location = 1) in vec2 inCoord;
|
||||
|
||||
layout (location = 2) in float zPos;
|
||||
layout (location =3) in vec3 inNormal;
|
||||
layout (location = 3) in vec3 inNormal;
|
||||
|
||||
//in float height;
|
||||
out vec2 fragTexCoord;
|
||||
out vec2 tilePos;
|
||||
out vec3 fragVert;
|
||||
@@ -20,22 +20,24 @@ smooth out vec3 vWorldPos;
|
||||
uniform mat4 MVP;
|
||||
smooth out vec3 vNormal;
|
||||
out float z_pos;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = MVP * vec4(position.x, position.y, zPos, 1.0);
|
||||
|
||||
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;
|
||||
// World position: anchored to terrain ground
|
||||
vec4 wPos = worldMatrix * vec4(position.x, position.y, zPos, 1.0);
|
||||
vWorldPos = wPos.xyz;
|
||||
|
||||
// Texture coordinates based on world coordinates (stays fixed when camera moves)
|
||||
fragTexCoord = vec2(wPos.x * 0.5, wPos.y * 0.5);
|
||||
|
||||
// Tile-local position for the hexagon border outline
|
||||
vec4 tpos = modelMatrix * vec4(position.x, position.y, 0.0, 1.0);
|
||||
tilePos = vec2(tpos.x, tpos.y);
|
||||
|
||||
vNormal = inNormal.xyz;
|
||||
fragVert = position;
|
||||
|
||||
vec4 vWorldPosLocal =modelMatrix*inPositionScaled;
|
||||
vWorldPos = vWorldPosLocal.xyz;
|
||||
z_pos=zPos;
|
||||
z_pos = zPos;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user