diff options
author | ExMix <rahuba.youri@mapswithme.com> | 2014-03-27 18:55:45 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:13:59 +0300 |
commit | 760e3679c35f407d8481503b4898744b850cae50 (patch) | |
tree | 65dd6f87eff3c429df5c0148f1489edc4d46f43a /drape_frontend/area_shape.cpp | |
parent | 9eaf13fa8efdf6a071dbdd22c981c5adcc404db6 (diff) |
[drape] texture wrapper and texture manager
Diffstat (limited to 'drape_frontend/area_shape.cpp')
-rw-r--r-- | drape_frontend/area_shape.cpp | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/drape_frontend/area_shape.cpp b/drape_frontend/area_shape.cpp index 4ea16fff74..048c26d68e 100644 --- a/drape_frontend/area_shape.cpp +++ b/drape_frontend/area_shape.cpp @@ -3,34 +3,29 @@ #include "../drape/shader_def.hpp" #include "../drape/attribute_provider.hpp" +#include "../std/bind.hpp" + namespace df { - AreaShape::AreaShape(const Color & c, float depth) - : m_color(c) - , m_depth(depth) - {} - - void AreaShape::AddTriangle(const m2::PointF & v1, - const m2::PointF & v2, - const m2::PointF & v3) + AreaShape::AreaShape(vector<m2::PointF> const & triangleList, AreaViewParams const & params) + : m_params(params) { - m_vertexes.push_back(Point3D(v1.x, v1.y, m_depth)); - m_vertexes.push_back(Point3D(v2.x, v2.y, m_depth)); - m_vertexes.push_back(Point3D(v3.x, v3.y, m_depth)); + m_vertexes.reserve(triangleList.size()); + for_each(triangleList.begin(), triangleList.end(), + bind(&vector<Point3D>::push_back, &m_vertexes, + bind(&Point3D::From2D, _1, params.m_depth))); } - void AreaShape::Draw(RefPointer<Batcher> batcher, RefPointer<TextureManager> /*textures*/) const + void AreaShape::Draw(RefPointer<Batcher> batcher, RefPointer<TextureSetHolder> /*textures*/) const { GLState state(gpu::SOLID_AREA_PROGRAM, 0); - float r, g, b, a; - ::Convert(m_color, r, g, b, a); - state.GetUniformValues().SetFloatValue("color", r, g, b, a); + state.SetColor(m_params.m_color); AttributeProvider provider(1, m_vertexes.size()); { BindingInfo info(1); BindingDecl & decl = info.GetBindingDecl(0); - decl.m_attributeName = "position"; + decl.m_attributeName = "a_position"; decl.m_componentCount = 3; decl.m_componentType = GLConst::GLFloatType; decl.m_offset = 0; |