mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-08-03 11:17:05 -04:00
26 lines
515 B
GLSL
26 lines
515 B
GLSL
#version 460
|
|
|
|
//in pixel
|
|
uniform vec2 start;
|
|
uniform vec2 dimension;
|
|
uniform vec2 screen;
|
|
uniform int points;
|
|
uniform int offset;
|
|
|
|
layout(std430, binding = 5) buffer _data
|
|
{
|
|
float data[];
|
|
};
|
|
|
|
|
|
void main() {
|
|
float x = gl_VertexID;
|
|
float y = -data[(gl_VertexID+offset)%points];
|
|
// Convert to opengl coordinates:
|
|
vec2 position_percentage = (start + dimension*vec2(x/points, y))/screen;
|
|
|
|
vec2 position = vec2(position_percentage.x, -position_percentage.y)*2 + vec2(-1, 1);
|
|
|
|
gl_Position = vec4(position, 0, 1);
|
|
}
|