23 lines
702 B
GLSL
23 lines
702 B
GLSL
#version 450 core
|
|
struct PosTex { vec4 pospos; vec4 texang; };
|
|
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
|
layout (std430, binding = 2) readonly buffer Pos { PosTex data[]; };
|
|
out float vAng;
|
|
out vec4 vPos;
|
|
out vec3 vTexCoords;
|
|
int indices[6] = {0,1,3,0,3,2};
|
|
void main()
|
|
{
|
|
vec4 texang = data[gl_VertexID / 6].texang;
|
|
vec4 pp = data[gl_VertexID / 6].pospos;
|
|
int j = indices[gl_VertexID % 6];
|
|
float z = (j > 1.5 ? 100 : 0);
|
|
vec2 xy = (j % 2 > 0 ? pp.xy : pp.zw);
|
|
vPos = vec4( xy, z, 1);
|
|
gl_Position = theMat * vPos;
|
|
vAng = texang.y;
|
|
float d = distance(pp.xy,pp.zw) / 50;
|
|
int jj = j / 2;
|
|
vTexCoords = vec3(d * (j % 2), 2 * jj , texang.x);
|
|
}
|