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

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorr.kuznetsov <r.kuznetsov@corp.mail.ru>2018-08-03 13:16:59 +0300
committerDaria Volvenkova <d.volvenkova@corp.mail.ru>2018-08-06 14:09:53 +0300
commit704fd74d8d709f643d38266e1b484c16a441fb8b (patch)
tree09b594294973956482178ec173f27d899112ecd8 /drape/render_state.cpp
parentc43305029839d5c7c9ab2eeed370e56bd777cc41 (diff)
Removed glConst from render state and texture
Diffstat (limited to 'drape/render_state.cpp')
-rw-r--r--drape/render_state.cpp42
1 files changed, 28 insertions, 14 deletions
diff --git a/drape/render_state.cpp b/drape/render_state.cpp
index 90e4cd987b..2a1063e148 100644
--- a/drape/render_state.cpp
+++ b/drape/render_state.cpp
@@ -5,16 +5,30 @@
namespace dp
{
-BlendingParams::BlendingParams()
- : m_blendFunction(gl_const::GLAddBlend)
- , m_blendSrcFactor(gl_const::GLSrcAlfa)
- , m_blendDstFactor(gl_const::GLOneMinusSrcAlfa)
-{}
+namespace
+{
+glConst DecodeDepthFunction(DepthFunction depthFunction)
+{
+ switch (depthFunction)
+ {
+ case DepthFunction::Never: return gl_const::GLNever;
+ case DepthFunction::Less: return gl_const::GLLess;
+ case DepthFunction::Equal: return gl_const::GLEqual;
+ case DepthFunction::LessOrEqual: return gl_const::GLLessOrEqual;
+ case DepthFunction::Great: return gl_const::GLGreat;
+ case DepthFunction::NotEqual: return gl_const::GLNotEqual;
+ case DepthFunction::GreatOrEqual: return gl_const::GLGreatOrEqual;
+ case DepthFunction::Always: return gl_const::GLAlways;
+ }
+ ASSERT(false, ());
+}
+} // namespace
-void BlendingParams::Apply() const
+// static
+void AlphaBlendingState::Apply()
{
- GLFunctions::glBlendEquation(m_blendFunction);
- GLFunctions::glBlendFunc(m_blendSrcFactor, m_blendDstFactor);
+ GLFunctions::glBlendEquation(gl_const::GLAddBlend);
+ GLFunctions::glBlendFunc(gl_const::GLSrcAlpha, gl_const::GLOneMinusSrcAlpha);
}
Blending::Blending(bool isEnabled)
@@ -33,14 +47,14 @@ bool Blending::operator<(Blending const & other) const { return m_isEnabled < ot
bool Blending::operator==(Blending const & other) const { return m_isEnabled == other.m_isEnabled; }
-glConst RenderState::GetDepthFunction() const
+DepthFunction RenderState::GetDepthFunction() const
{
return m_depthFunction;
}
-void RenderState::SetDepthFunction(glConst functionName)
+void RenderState::SetDepthFunction(DepthFunction depthFunction)
{
- m_depthFunction = functionName;
+ m_depthFunction = depthFunction;
}
bool RenderState::GetDepthTestEnabled() const
@@ -53,12 +67,12 @@ void RenderState::SetDepthTestEnabled(bool enabled)
m_depthTestEnabled = enabled;
}
-glConst RenderState::GetTextureFilter() const
+TextureFilter RenderState::GetTextureFilter() const
{
return m_textureFilter;
}
-void RenderState::SetTextureFilter(glConst filter)
+void RenderState::SetTextureFilter(TextureFilter filter)
{
m_textureFilter = filter;
}
@@ -172,7 +186,7 @@ void ApplyState(RenderState const & state, ref_ptr<GpuProgram> program)
if (state.GetDepthTestEnabled())
{
GLFunctions::glEnable(gl_const::GLDepthTest);
- GLFunctions::glDepthFunc(state.GetDepthFunction());
+ GLFunctions::glDepthFunc(DecodeDepthFunction(state.GetDepthFunction()));
}
else
{