2022-10-13 17:39:57 +00:00
|
|
|
#version 440
|
|
|
|
|
|
|
|
layout( location = 0 ) in vec4 vertexCoord;
|
|
|
|
layout( location = 0 ) out float colorIndex;
|
|
|
|
|
|
|
|
layout( std140, binding = 0 ) uniform buf
|
|
|
|
{
|
|
|
|
mat4 matrix;
|
2022-10-18 15:37:31 +00:00
|
|
|
vec4 vector;
|
2022-10-13 17:39:57 +00:00
|
|
|
float opacity;
|
|
|
|
} ubuf;
|
|
|
|
|
|
|
|
out gl_PerVertex { vec4 gl_Position; };
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2022-10-18 15:37:31 +00:00
|
|
|
vec2 pos = vertexCoord.xy - ubuf.vector.xy;
|
|
|
|
vec2 span = ubuf.vector.zw;
|
2022-10-13 17:39:57 +00:00
|
|
|
|
2022-10-18 15:37:31 +00:00
|
|
|
colorIndex = dot( pos, span ) / dot( span, span );
|
2022-10-13 17:39:57 +00:00
|
|
|
gl_Position = ubuf.matrix * vertexCoord;
|
|
|
|
}
|