1 #pragma once
2 
3 #include <mbgl/programs/program.hpp>
4 #include <mbgl/programs/attributes.hpp>
5 #include <mbgl/programs/uniforms.hpp>
6 #include <mbgl/shaders/hillshade.hpp>
7 #include <mbgl/util/geometry.hpp>
8 #include <mbgl/style/layers/hillshade_layer_properties.hpp>
9 
10 namespace mbgl {
11 
12 namespace uniforms {
13 MBGL_DEFINE_UNIFORM_SCALAR(Color, u_shadow);
14 MBGL_DEFINE_UNIFORM_SCALAR(Color, u_highlight);
15 MBGL_DEFINE_UNIFORM_SCALAR(Color, u_accent);
16 MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_light);
17 MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_latrange);
18 } // namespace uniforms
19 
20 class HillshadeProgram : public Program<
21     shaders::hillshade,
22     gl::Triangle,
23     gl::Attributes<
24         attributes::a_pos,
25         attributes::a_texture_pos>,
26     gl::Uniforms<
27         uniforms::u_matrix,
28         uniforms::u_image,
29         uniforms::u_highlight,
30         uniforms::u_shadow,
31         uniforms::u_accent,
32         uniforms::u_light,
33         uniforms::u_latrange>,
34     style::HillshadePaintProperties>{
35 public:
36     using Program::Program;
37 
layoutVertex(Point<int16_t> p,Point<uint16_t> t)38     static LayoutVertex layoutVertex(Point<int16_t> p, Point<uint16_t> t) {
39         return LayoutVertex {
40             {{
41                 p.x,
42                 p.y
43             }},
44             {{
45                 t.x,
46                 t.y
47             }}
48         };
49     }
50 };
51 
52 using HillshadeLayoutVertex = HillshadeProgram::LayoutVertex;
53 using HillshadeAttributes = HillshadeProgram::Attributes;
54 
55 } // namespace mbgl
56