aboutsummaryrefslogtreecommitdiff
path: root/resources/shaders/anchorPoint.geom
diff options
context:
space:
mode:
authorgithub-classroom[bot] <66690702+github-classroom[bot]@users.noreply.github.com>2024-03-19 02:01:17 +0000
committerGitHub <noreply@github.com>2024-03-19 02:01:17 +0000
commit0f8d0e3cfdbd9b11b2357ed3e1a11375e7af8e80 (patch)
tree48b88b3b3b3a522a90c38b2178363a163a32f2ee /resources/shaders/anchorPoint.geom
Initial commit
Diffstat (limited to 'resources/shaders/anchorPoint.geom')
-rw-r--r--resources/shaders/anchorPoint.geom41
1 files changed, 41 insertions, 0 deletions
diff --git a/resources/shaders/anchorPoint.geom b/resources/shaders/anchorPoint.geom
new file mode 100644
index 0000000..ccb6b84
--- /dev/null
+++ b/resources/shaders/anchorPoint.geom
@@ -0,0 +1,41 @@
+#version 330 core
+
+layout(points) in;
+layout (triangle_strip, max_vertices = 4) out;
+
+in vec4 vColor[];
+out vec4 fColor;
+out vec2 fPoint;
+out float fRadius;
+
+uniform int width;
+uniform int height;
+uniform float vSize;
+
+void main() {
+ vec4 offset = vec4(vSize, -vSize, 0.0, 0.0);
+
+ int i;
+ for (i = 0; i < gl_in.length(); i ++) {
+ vec4 p = gl_in[i].gl_Position;
+
+ fColor = vColor[i];
+ fPoint = vec2((p.x * 0.5 + 0.5) * width,
+ (p.y * 0.5 + 0.5) * height);
+ fRadius = vSize;
+
+ gl_Position = p + offset.yxzw;
+ EmitVertex();
+
+ gl_Position = p + offset.yyzw;
+ EmitVertex();
+
+ gl_Position = p + offset.xxzw;
+ EmitVertex();
+
+ gl_Position = p + offset.xyzw;
+ EmitVertex();
+
+ EndPrimitive();
+ }
+}