aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/shapes/shaders/lineargradient.vert
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2017-07-28 11:54:44 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2017-07-29 15:40:27 +0000
commit5e8347fdbab98d721f031634a9f6c8b217072d34 (patch)
treeca507e39d1ffb058e6c622d17e19e1b236531f05 /src/imports/shapes/shaders/lineargradient.vert
parent182983943b76bc0e40ff7693853ef2262323fa80 (diff)
Move shapes-related shaders to under the shapes plugin
Do not leave them in quick/items' qrc. Change-Id: I12360a54caa368219a7a80645f92af66aa9de9ba Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/imports/shapes/shaders/lineargradient.vert')
-rw-r--r--src/imports/shapes/shaders/lineargradient.vert15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/imports/shapes/shaders/lineargradient.vert b/src/imports/shapes/shaders/lineargradient.vert
new file mode 100644
index 0000000000..eb21b8886b
--- /dev/null
+++ b/src/imports/shapes/shaders/lineargradient.vert
@@ -0,0 +1,15 @@
+attribute vec4 vertexCoord;
+attribute vec4 vertexColor;
+
+uniform mat4 matrix;
+uniform vec2 gradStart;
+uniform vec2 gradEnd;
+
+varying float gradTabIndex;
+
+void main()
+{
+ vec2 gradVec = gradEnd - gradStart;
+ gradTabIndex = dot(gradVec, vertexCoord.xy - gradStart) / (gradVec.x * gradVec.x + gradVec.y * gradVec.y);
+ gl_Position = matrix * vertexCoord;
+}