From 9dafdb1e88bb898ced9369b63b81756a9f7df8ee Mon Sep 17 00:00:00 2001
From: Marlon Schumacher <schumacher@hfm-karlsruhe.de>
Date: Sat, 06 Jul 2024 23:58:38 +0200
Subject: [PATCH] feat: add all initial files to repository

---
 shadyLines.jxs |  122 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 122 insertions(+), 0 deletions(-)

diff --git a/shadyLines.jxs b/shadyLines.jxs
new file mode 100644
index 0000000..40d6825
--- /dev/null
+++ b/shadyLines.jxs
@@ -0,0 +1,122 @@
+<jittershader name="Connect_Close_Vertices">
+	<description>Default Connect Close Vertices </description>
+
+	<param name="position" type="vec3" state="POSITION" />
+	<param name="modelViewProjectionMatrix" type="mat4" state="MODELVIEW_PROJECTION_MATRIX" />
+	<param name="color" type="vec4" state="COLOR" />
+
+	<param name="posBuffer" type="int" default="0" />
+	<param name="distThreshold" type="float" default="0.1" />
+
+	<language name="glsl" version="1.5">
+
+		<bind param="position" program="vp" />
+		<bind param="modelViewProjectionMatrix" program="vp" />
+		<bind param="color" program="vp" />
+
+		<bind param="posBuffer" program="vp" />
+		<bind param="distThreshold" program="vp" />
+
+		<program name="vp" type="vertex">
+<![CDATA[
+#version 330 core
+uniform mat4 modelViewProjectionMatrix;
+in vec3 position;
+in vec4 color;
+
+uniform samplerBuffer posBuffer;
+uniform float distThreshold;
+
+const int arrayLength = 6;
+
+out jit_PerVertex {
+	flat vec4 color;	
+	flat vec4 closeParticlePosition[arrayLength];
+} jit_out;
+
+void main() {	
+	int iterations = 1000;
+
+	gl_Position = modelViewProjectionMatrix * vec4(position, 1.);	
+	jit_out.color = color;
+
+	// initialize close particles position to this particle position
+	for (int i=0; i<arrayLength; i++)
+	{
+		jit_out.closeParticlePosition[i] = modelViewProjectionMatrix * vec4(position, 1.);
+	}
+
+	int counter = 0; 
+	for (int i=gl_VertexID+1; i<iterations; i++)
+	{
+		vec3 otherPosition = texelFetch(posBuffer, i).xyz;
+
+		float dist = length(position - otherPosition);
+
+		if (dist < distThreshold && dist > 0.0)
+		{
+			jit_out.closeParticlePosition[counter] = modelViewProjectionMatrix * vec4(otherPosition, 1.);
+			counter++; 
+			if (counter >= arrayLength)
+			{
+				break;
+			}
+		}
+	}
+}
+]]>
+		</program>
+		<program name="gp" type="geometry">
+<![CDATA[
+#version 330 core
+
+layout (points) in;
+layout (line_strip, max_vertices=12) out;
+
+const int arrayLength = 6;
+
+in jit_PerVertex {
+	flat vec4 color;	
+	flat vec4 closeParticlePosition[arrayLength];
+} jit_in[];
+
+out jit_PerVertex {
+	flat vec4 color;	
+};
+
+void main() {
+	for (int i = 0; i<arrayLength; i++)
+	{
+		gl_Position = gl_in[0].gl_Position;
+		color = jit_in[0].color;
+		EmitVertex();
+
+		gl_Position = jit_in[0].closeParticlePosition[i];
+		color = jit_in[0].color;
+		EmitVertex();
+		
+		EndPrimitive();
+	}
+}
+]]>
+		</program>
+		<program name="fp" type="fragment">
+<![CDATA[
+#version 330 core
+
+in jit_PerVertex {
+	flat vec4 color;
+} jit_in;
+
+out vec4 color;
+
+void main() {
+	color = jit_in.color;
+
+	// if (length(gl_PointCoord-0.5)>0.5)
+	// discard;
+}	
+]]>
+		</program>
+	</language>
+</jittershader>

--
Gitblit v1.9.1