summaryrefslogtreecommitdiff
path: root/src/mbgl/programs/hillshade_prepare_program.hpp
diff options
context:
space:
mode:
authorMolly Lloyd <mollymerp@users.noreply.github.com>2018-01-23 10:49:23 -0800
committerGitHub <noreply@github.com>2018-01-23 10:49:23 -0800
commitf3294200c6c866e5ab031ad8346c59a76aa37249 (patch)
tree6d9aedb552552607641a15c415a60be99a0877d5 /src/mbgl/programs/hillshade_prepare_program.hpp
parent2d15aed43c9faa875a8f625c3afc286f1175e0ce (diff)
downloadqtlocation-mapboxgl-f3294200c6c866e5ab031ad8346c59a76aa37249.tar.gz
[core] add raster-dem source type and hillshade layer type (#10642)
Diffstat (limited to 'src/mbgl/programs/hillshade_prepare_program.hpp')
-rw-r--r--src/mbgl/programs/hillshade_prepare_program.hpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/mbgl/programs/hillshade_prepare_program.hpp b/src/mbgl/programs/hillshade_prepare_program.hpp
new file mode 100644
index 0000000000..0f31a22df5
--- /dev/null
+++ b/src/mbgl/programs/hillshade_prepare_program.hpp
@@ -0,0 +1,47 @@
+#pragma once
+
+#include <mbgl/programs/program.hpp>
+#include <mbgl/programs/attributes.hpp>
+#include <mbgl/programs/uniforms.hpp>
+#include <mbgl/shaders/hillshade_prepare.hpp>
+#include <mbgl/util/geometry.hpp>
+
+namespace mbgl {
+
+namespace uniforms {
+MBGL_DEFINE_UNIFORM_VECTOR(uint16_t, 2, u_dimension);
+} // namespace uniforms
+
+class HillshadePrepareProgram : public Program<
+ shaders::hillshade_prepare,
+ gl::Triangle,
+ gl::Attributes<
+ attributes::a_pos,
+ attributes::a_texture_pos>,
+ gl::Uniforms<
+ uniforms::u_matrix,
+ uniforms::u_dimension,
+ uniforms::u_zoom,
+ uniforms::u_image>,
+ style::Properties<>> {
+public:
+ using Program::Program;
+
+ static LayoutVertex layoutVertex(Point<int16_t> p, Point<uint16_t> t) {
+ return LayoutVertex {
+ {{
+ p.x,
+ p.y
+ }},
+ {{
+ t.x,
+ t.y
+ }}
+ };
+ }
+};
+
+using HillshadePrepareLayoutVertex = HillshadePrepareProgram::LayoutVertex;
+using HillshadePrepareAttributes = HillshadePrepareProgram::Attributes;
+
+} // namespace mbgl