summaryrefslogtreecommitdiff
path: root/src/mbgl/shader/symbol_uniforms.hpp
blob: dc1b25004f90e12e17d5b0036fc993c5126843da (plain)
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
75
76
#pragma once

#include <mbgl/shader/uniforms.hpp>

#include <array>

namespace mbgl {

namespace style {
class SymbolPropertyValues;
} // namespace style

class RenderTile;
class TransformState;

namespace uniforms {
MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_texsize);
MBGL_DEFINE_UNIFORM_SCALAR(bool, u_rotate_with_map);
MBGL_DEFINE_UNIFORM_SCALAR(bool, u_pitch_with_map);
MBGL_DEFINE_UNIFORM_SCALAR(gl::TextureUnit, u_texture);
MBGL_DEFINE_UNIFORM_SCALAR(gl::TextureUnit, u_fadetexture);
MBGL_DEFINE_UNIFORM_SCALAR(float, u_buffer);
MBGL_DEFINE_UNIFORM_SCALAR(float, u_gamma);
MBGL_DEFINE_UNIFORM_SCALAR(float, u_aspect_ratio);
} // namespace uniforms

struct SymbolIconUniforms : gl::Uniforms<
    uniforms::u_matrix,
    uniforms::u_opacity,
    uniforms::u_extrude_scale,
    uniforms::u_texsize,
    uniforms::u_zoom,
    uniforms::u_rotate_with_map,
    uniforms::u_texture,
    uniforms::u_fadetexture>
{
    static Values values(const style::SymbolPropertyValues&,
                         const std::array<uint16_t, 2>& texsize,
                         const std::array<float, 2>& pixelsToGLUnits,
                         const RenderTile&,
                         const TransformState&);
};

struct SymbolSDFUniforms : gl::Uniforms<
    uniforms::u_matrix,
    uniforms::u_opacity,
    uniforms::u_extrude_scale,
    uniforms::u_texsize,
    uniforms::u_zoom,
    uniforms::u_rotate_with_map,
    uniforms::u_texture,
    uniforms::u_fadetexture,
    uniforms::u_color,
    uniforms::u_buffer,
    uniforms::u_gamma,
    uniforms::u_pitch,
    uniforms::u_bearing,
    uniforms::u_aspect_ratio,
    uniforms::u_pitch_with_map>
{
    static Values haloValues(const style::SymbolPropertyValues&,
                              const std::array<uint16_t, 2>& texsize,
                              const std::array<float, 2>& pixelsToGLUnits,
                              const RenderTile&,
                              const TransformState&,
                              float pixelRatio);

    static Values foregroundValues(const style::SymbolPropertyValues&,
                              const std::array<uint16_t, 2>& texsize,
                              const std::array<float, 2>& pixelsToGLUnits,
                              const RenderTile&,
                              const TransformState&,
                              float pixelRatio);
};

} // namespace mbgl