Welcome to mirror list, hosted at ThFree Co, Russian Federation.

glstate.hpp « drape - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 32da30401e7898dc61a114eb46e06a2d171ca0e9 (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
#pragma once

#include "drape/pointers.hpp"
#include "drape/texture.hpp"
#include "drape/gpu_program.hpp"
#include "drape/uniform_values_storage.hpp"

namespace dp
{

struct Blending
{
  Blending(bool isEnabled = false);

  void Apply() const;

  bool operator < (Blending const & other) const;
  bool operator == (Blending const & other) const;

  bool m_isEnabled;
  glConst m_blendFunction;
  glConst m_blendSrcFactor;
  glConst m_blendDstFactor;
};

class GLState
{
public:
  enum DepthLayer
  {
    /// Do not change order
    GeometryLayer,
    DynamicGeometry,
    OverlayLayer
  };

  GLState(uint32_t gpuProgramIndex, DepthLayer depthLayer);

  DepthLayer const & GetDepthLayer() const { return m_depthLayer; }

  void SetColorTexture(RefPointer<Texture> tex) { m_colorTexture = tex; }
  RefPointer<Texture> GetColorTexture() const { return m_colorTexture; }

  void SetMaskTexture(RefPointer<Texture> tex) { m_maskTexture = tex; }
  RefPointer<Texture> GetMaskTexture() const { return m_maskTexture; }

  void SetBlending(Blending const & blending) { m_blending = blending; }
  Blending const & GetBlending() const { return m_blending; }

  int GetProgramIndex() const { return m_gpuProgramIndex; }

  bool operator<(GLState const & other) const;
  bool operator==(GLState const & other) const;

private:
  uint32_t m_gpuProgramIndex;
  DepthLayer m_depthLayer;
  Blending m_blending;

  RefPointer<Texture> m_colorTexture;
  RefPointer<Texture> m_maskTexture;
};

void ApplyUniforms(UniformValuesStorage const & uniforms, RefPointer<GpuProgram> program);
void ApplyState(GLState state, RefPointer<GpuProgram> program);

} // namespace dp