1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#pragma once
#include <mbgl/programs/program.hpp>
#include <mbgl/programs/attributes.hpp>
#include <mbgl/programs/uniforms.hpp>
#include <mbgl/programs/textures.hpp>
#include <mbgl/util/geometry.hpp>
#include <mbgl/style/layers/raster_layer_properties.hpp>
namespace mbgl {
namespace uniforms {
MBGL_DEFINE_UNIFORM_SCALAR(float, fade_t);
MBGL_DEFINE_UNIFORM_SCALAR(float, buffer_scale);
MBGL_DEFINE_UNIFORM_SCALAR(float, brightness_low);
MBGL_DEFINE_UNIFORM_SCALAR(float, brightness_high);
MBGL_DEFINE_UNIFORM_SCALAR(float, saturation_factor);
MBGL_DEFINE_UNIFORM_SCALAR(float, contrast_factor);
MBGL_DEFINE_UNIFORM_SCALAR(float, scale_parent);
MBGL_DEFINE_UNIFORM_VECTOR(float, 3, spin_weights);
MBGL_DEFINE_UNIFORM_VECTOR(float, 2, tl_parent);
} // namespace uniforms
class RasterProgram : public Program<
RasterProgram,
gfx::PrimitiveType::Triangle,
TypeList<
attributes::pos,
attributes::texture_pos>,
TypeList<
uniforms::matrix,
uniforms::opacity,
uniforms::fade_t,
uniforms::brightness_low,
uniforms::brightness_high,
uniforms::saturation_factor,
uniforms::contrast_factor,
uniforms::spin_weights,
uniforms::buffer_scale,
uniforms::scale_parent,
uniforms::tl_parent>,
TypeList<
textures::image0,
textures::image1>,
style::RasterPaintProperties>
{
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 RasterLayoutVertex = RasterProgram::LayoutVertex;
using RasterAttributes = RasterProgram::AttributeList;
class RasterLayerPrograms final : public LayerTypePrograms {
public:
RasterLayerPrograms(gfx::Context& context, const ProgramParameters& programParameters)
: raster(context, programParameters) {}
RasterProgram raster;
};
} // namespace mbgl
|