src/gl/gridprogram.cpp

changeset 72
7c27cda03747
parent 70
f21b800b02a4
child 90
e234edb5e613
--- a/src/gl/gridprogram.cpp	Fri Mar 06 21:53:30 2020 +0200
+++ b/src/gl/gridprogram.cpp	Fri Mar 06 23:45:44 2020 +0200
@@ -27,7 +27,7 @@
 uniform mat4 projection;
 uniform mat4 model;
 smooth out vec2 ex_uv;
-const mat4 stretch = mat4(vec4(10000, 0, 0, 0), vec4(0, 10000, 0, 0), vec4(0, 0, 10000, 0), vec4(0, 0, 0, 1));
+const mat4 stretch = mat4(vec4(1000, 0, 0, 0), vec4(0, 1000, 0, 0), vec4(0, 0, 1000, 0), vec4(0, 0, 0, 1));
 uniform mat4 grid;
 
 void main()
@@ -47,8 +47,8 @@
 
 void main(void)
 {
-	float dx = fract(ex_uv.y / 0.0001f);
-	float dy = fract(ex_uv.x / 0.0001f);
+	float dx = fract(ex_uv.y / 0.001f);
+	float dy = fract(ex_uv.x / 0.001f);
 	/* compute distance to nearest unit line */
 	float d = min(min(min(dy, dx), 1 - dy), 1 - dx);
 	/* use an extreme sigmoid to bring out the grid shape */
@@ -56,8 +56,8 @@
 	/* fade the grid towards extreme co-ordinates */
 	d = (1.0f - 20 * max(abs(ex_uv.x), abs(ex_uv.y))) * d;
 	/* add dashes */
-	d *= (1 + cos(ex_uv.y / 0.00001f * pi)) * 0.5f;
-	d *= (1 + cos(ex_uv.x / 0.00001f * pi)) * 0.5f;
+	d *= (1 + cos(ex_uv.y / 0.0001f * pi)) * 0.5f;
+	d *= (1 + cos(ex_uv.x / 0.0001f * pi)) * 0.5f;
 	color = vec4(gridColor.xyz, gridColor.w * d);
 }
 )";

mercurial