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

uniforms_holder.cpp « graphics - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f3758494b8f97730bb0d32e2a2a3090aa75754f6 (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
#include "graphics/uniforms_holder.hpp"

#include "std/utility.hpp"

namespace graphics
{

bool UniformsHolder::insertValue(ESemantic sem, float value)
{
  return insertValue(m_floatHolder, sem, value);
}

bool UniformsHolder::insertValue(ESemantic sem, float x, float y)
{
  return insertValue(m_vec2Holder, sem, m2::PointF(x, y));
}

bool UniformsHolder::insertValue(ESemantic sem, float x, float y, float z, float w)
{
  return insertValue(m_vec4Holder, sem, array<float, 4>({{ x, y, z, w }}));
}

bool UniformsHolder::insertValue(ESemantic sem, math::Matrix<float, 4, 4> const & matrix)
{
  return insertValue(m_mat4Holder, sem, matrix);
}

bool UniformsHolder::getValue(ESemantic sem, float & value) const
{
  return getValue(m_floatHolder, sem, value);
}

bool UniformsHolder::getValue(ESemantic sem, float & x, float & y) const
{
  m2::PointF pt;
  if (!getValue(m_vec2Holder, sem, pt))
    return false;

  x = pt.x;
  y = pt.y;
  return true;
}

bool UniformsHolder::getValue(ESemantic sem, float & x, float & y, float & z, float & w) const
{
  array<float, 4> v;
  if (!getValue(m_vec4Holder, sem, v))
    return false;

  x = v[0];
  y = v[1];
  z = v[2];
  w = v[3];
  return true;
}

bool UniformsHolder::getValue(ESemantic sem, math::Matrix<float, 4, 4> & value) const
{
  return getValue(m_mat4Holder, sem, value);
}

} // namespace graphics