2020-08-26 18:01:32 +00:00
|
|
|
layout (location = 0) in vec2 inVertex;
|
2020-08-29 10:10:38 +00:00
|
|
|
#ifdef TW_TILE_TEXTURED
|
|
|
|
layout (location = 1) in vec3 inVertexTexCoord;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
uniform mat4x2 gPos;
|
|
|
|
|
|
|
|
#if defined(TW_TILE_BORDER) || defined(TW_TILE_BORDER_LINE)
|
|
|
|
uniform vec2 gDir;
|
|
|
|
uniform vec2 gOffset;
|
|
|
|
#endif
|
2020-08-19 05:05:51 +00:00
|
|
|
|
2020-08-29 10:10:38 +00:00
|
|
|
#if defined(TW_TILE_BORDER)
|
|
|
|
uniform int gJumpIndex;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TW_TILE_TEXTURED
|
|
|
|
noperspective out vec3 TexCoord;
|
|
|
|
#endif
|
2017-09-12 18:05:05 +00:00
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2020-08-29 10:10:38 +00:00
|
|
|
#if defined(TW_TILE_BORDER)
|
|
|
|
vec4 VertPos = vec4(inVertex, 0.0, 1.0);
|
|
|
|
int XCount = gl_InstanceID - (int(gl_InstanceID/gJumpIndex) * gJumpIndex);
|
|
|
|
int YCount = (int(gl_InstanceID/gJumpIndex));
|
2021-04-30 22:42:37 +00:00
|
|
|
VertPos.x += gOffset.x + gDir.x * float(XCount);
|
|
|
|
VertPos.y += gOffset.y + gDir.y * float(YCount);
|
2020-08-29 10:10:38 +00:00
|
|
|
|
|
|
|
gl_Position = vec4(gPos * VertPos, 0.0, 1.0);
|
|
|
|
#elif defined(TW_TILE_BORDER_LINE)
|
|
|
|
vec4 VertPos = vec4(inVertex.x + gOffset.x, inVertex.y + gOffset.y, 0.0, 1.0);
|
2021-04-30 22:42:37 +00:00
|
|
|
VertPos.x += gDir.x * float(gl_InstanceID);
|
|
|
|
VertPos.y += gDir.y * float(gl_InstanceID);
|
2020-08-29 10:10:38 +00:00
|
|
|
|
|
|
|
gl_Position = vec4(gPos * VertPos, 0.0, 1.0);
|
|
|
|
#else
|
|
|
|
gl_Position = vec4(gPos * vec4(inVertex, 0.0, 1.0), 0.0, 1.0);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TW_TILE_TEXTURED
|
|
|
|
TexCoord = inVertexTexCoord;
|
|
|
|
#endif
|
2017-11-09 10:31:13 +00:00
|
|
|
}
|