summaryrefslogtreecommitdiffstats
path: root/src/opengl/util/linear_brush.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'src/opengl/util/linear_brush.glsl')
-rw-r--r--src/opengl/util/linear_brush.glsl22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/opengl/util/linear_brush.glsl b/src/opengl/util/linear_brush.glsl
new file mode 100644
index 0000000000..90a4440a99
--- /dev/null
+++ b/src/opengl/util/linear_brush.glsl
@@ -0,0 +1,22 @@
+uniform sampler1D palette;
+uniform vec3 linear;
+uniform vec3 inv_matrix_m0;
+uniform vec3 inv_matrix_m1;
+uniform vec3 inv_matrix_m2;
+
+vec4 brush()
+{
+ mat3 mat;
+
+ mat[0] = inv_matrix_m0;
+ mat[1] = inv_matrix_m1;
+ mat[2] = inv_matrix_m2;
+
+ vec3 hcoords = mat * vec3(gl_FragCoord.xy, 1);
+ vec2 A = hcoords.xy / hcoords.z;
+
+ float val = dot(linear.xy, A) * linear.z;
+
+ return texture1D(palette, val);
+}
+