summaryrefslogtreecommitdiff
path: root/src/mbgl/shaders/heatmap_texture.cpp
diff options
context:
space:
mode:
authorVladimir Agafonkin <agafonkin@gmail.com>2018-02-15 17:38:23 +0200
committerGitHub <noreply@github.com>2018-02-15 17:38:23 +0200
commit82de856c94bbc090ba30186011610da5e233e277 (patch)
treebb8d4eb20901b4ac852520465d2487f6d5729852 /src/mbgl/shaders/heatmap_texture.cpp
parent1fdec7a5c1babc0cd36a110ce372175a5252d45e (diff)
downloadqtlocation-mapboxgl-82de856c94bbc090ba30186011610da5e233e277.tar.gz
[core, ios, macos, android, node] Heatmap layer (#11046)
Co-Authored-By: Konstantin Käfer <mail@kkaefer.com> Co-Authored-By: Anand Thakker <anandthakker@users.noreply.github.com> Co-Authored-By: Minh Nguyễn <1ec5@users.noreply.github.com>
Diffstat (limited to 'src/mbgl/shaders/heatmap_texture.cpp')
-rw-r--r--src/mbgl/shaders/heatmap_texture.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/mbgl/shaders/heatmap_texture.cpp b/src/mbgl/shaders/heatmap_texture.cpp
new file mode 100644
index 0000000000..c5d35c48ae
--- /dev/null
+++ b/src/mbgl/shaders/heatmap_texture.cpp
@@ -0,0 +1,42 @@
+// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.
+
+#include <mbgl/shaders/heatmap_texture.hpp>
+
+namespace mbgl {
+namespace shaders {
+
+const char* heatmap_texture::name = "heatmap_texture";
+const char* heatmap_texture::vertexSource = R"MBGL_SHADER(
+uniform mat4 u_matrix;
+uniform vec2 u_world;
+attribute vec2 a_pos;
+varying vec2 v_pos;
+
+void main() {
+ gl_Position = u_matrix * vec4(a_pos * u_world, 0, 1);
+
+ v_pos.x = a_pos.x;
+ v_pos.y = 1.0 - a_pos.y;
+}
+
+)MBGL_SHADER";
+const char* heatmap_texture::fragmentSource = R"MBGL_SHADER(
+uniform sampler2D u_image;
+uniform sampler2D u_color_ramp;
+uniform float u_opacity;
+varying vec2 v_pos;
+
+void main() {
+ float t = texture2D(u_image, v_pos).r;
+ vec4 color = texture2D(u_color_ramp, vec2(t, 0.5));
+ gl_FragColor = color * u_opacity;
+
+#ifdef OVERDRAW_INSPECTOR
+ gl_FragColor = vec4(0.0);
+#endif
+}
+
+)MBGL_SHADER";
+
+} // namespace shaders
+} // namespace mbgl