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:
-rw-r--r--android/jni/com/mapswithme/core/render_context.hpp2
-rw-r--r--android/jni/com/mapswithme/maps/Framework.cpp4
-rw-r--r--android/jni/com/mapswithme/maps/Lifecycle.cpp2
-rw-r--r--graphics/agg_traits.hpp2
-rw-r--r--graphics/area_renderer.cpp3
-rw-r--r--graphics/area_renderer.hpp4
-rw-r--r--graphics/blitter.cpp529
-rw-r--r--graphics/blitter.hpp209
-rw-r--r--graphics/circle_element.cpp2
-rw-r--r--graphics/circle_element.hpp2
-rw-r--r--graphics/circle_style.cpp4
-rw-r--r--graphics/composite_overlay_element.cpp2
-rw-r--r--graphics/composite_overlay_element.hpp2
-rw-r--r--graphics/defines.hpp13
-rw-r--r--graphics/display_list.cpp228
-rw-r--r--graphics/display_list.hpp88
-rw-r--r--graphics/display_list_renderer.cpp160
-rw-r--r--graphics/display_list_renderer.hpp65
-rw-r--r--graphics/geometry_batcher.cpp1583
-rw-r--r--graphics/geometry_batcher.hpp298
-rw-r--r--graphics/glyph_cache.cpp5
-rw-r--r--graphics/glyph_style.cpp4
-rw-r--r--graphics/graphics.pro82
-rw-r--r--graphics/graphics_tests/screengl_test.cpp79
-rw-r--r--graphics/graphics_tests/screenglglobal_test.cpp2
-rw-r--r--graphics/graphics_tests/texture_test.cpp2
-rw-r--r--graphics/graphics_tests/thread_render.cpp16
-rw-r--r--graphics/image_info.cpp3
-rw-r--r--graphics/image_renderer.cpp4
-rw-r--r--graphics/line_style.cpp4
-rw-r--r--graphics/opengl/base_texture.cpp (renamed from graphics/base_texture.cpp)18
-rw-r--r--graphics/opengl/base_texture.hpp (renamed from graphics/base_texture.hpp)13
-rw-r--r--graphics/opengl/buffer_object.cpp (renamed from graphics/buffer_object.cpp)12
-rw-r--r--graphics/opengl/buffer_object.hpp (renamed from graphics/buffer_object.hpp)4
-rw-r--r--graphics/opengl/clipper.cpp (renamed from graphics/clipper.cpp)8
-rw-r--r--graphics/opengl/clipper.hpp (renamed from graphics/clipper.hpp)2
-rw-r--r--graphics/opengl/data_traits.hpp (renamed from graphics/data_traits.hpp)4
-rw-r--r--graphics/opengl/framebuffer.cpp (renamed from graphics/framebuffer.cpp)6
-rw-r--r--graphics/opengl/framebuffer.hpp (renamed from graphics/framebuffer.hpp)5
-rw-r--r--graphics/opengl/geometry_renderer.cpp (renamed from graphics/geometry_renderer.cpp)235
-rw-r--r--graphics/opengl/geometry_renderer.hpp (renamed from graphics/geometry_renderer.hpp)69
-rw-r--r--graphics/opengl/gl_procedures.inl (renamed from graphics/internal/gl_procedures.inl)0
-rw-r--r--graphics/opengl/managed_texture.cpp (renamed from graphics/managed_texture.cpp)5
-rw-r--r--graphics/opengl/managed_texture.hpp (renamed from graphics/managed_texture.hpp)10
-rw-r--r--graphics/opengl/opengl.cpp (renamed from graphics/internal/opengl.cpp)0
-rw-r--r--graphics/opengl/opengl.hpp (renamed from graphics/internal/opengl.hpp)1
-rw-r--r--graphics/opengl/opengl_es.cpp (renamed from graphics/internal/opengl_es.cpp)0
-rw-r--r--graphics/opengl/opengl_ext.cpp (renamed from graphics/internal/opengl_ext.cpp)0
-rw-r--r--graphics/opengl/opengl_glsl_es2.cpp (renamed from graphics/internal/opengl_glsl_es2.cpp)0
-rw-r--r--graphics/opengl/opengl_glsl_ext.cpp (renamed from graphics/internal/opengl_glsl_ext.cpp)0
-rw-r--r--graphics/opengl/opengl_glsl_impl.cpp (renamed from graphics/internal/opengl_glsl_impl.cpp)0
-rw-r--r--graphics/opengl/opengl_glsl_impl.hpp (renamed from graphics/internal/opengl_glsl_impl.hpp)0
-rw-r--r--graphics/opengl/opengl_win32.cpp (renamed from graphics/internal/opengl_win32.cpp)0
-rw-r--r--graphics/opengl/renderbuffer.cpp (renamed from graphics/renderbuffer.cpp)2
-rw-r--r--graphics/opengl/renderbuffer.hpp (renamed from graphics/renderbuffer.hpp)4
-rw-r--r--graphics/opengl/rendercontext.cpp (renamed from graphics/rendercontext.cpp)2
-rw-r--r--graphics/opengl/rendercontext.hpp (renamed from graphics/rendercontext.hpp)2
-rw-r--r--graphics/opengl/renderer.cpp (renamed from graphics/renderer.cpp)8
-rw-r--r--graphics/opengl/renderer.hpp (renamed from graphics/renderer.hpp)18
-rw-r--r--graphics/opengl/storage.cpp (renamed from graphics/storage.cpp)4
-rw-r--r--graphics/opengl/storage.hpp (renamed from graphics/storage.hpp)2
-rw-r--r--graphics/opengl/texture.hpp (renamed from graphics/texture.hpp)7
-rw-r--r--graphics/opengl/utils.cpp (renamed from graphics/utils.cpp)2
-rw-r--r--graphics/opengl/utils.hpp (renamed from graphics/utils.hpp)2
-rw-r--r--graphics/opengl/vertex.cpp (renamed from graphics/vertex.cpp)2
-rw-r--r--graphics/opengl/vertex.hpp (renamed from graphics/vertex.hpp)4
-rw-r--r--graphics/overlay.cpp4
-rw-r--r--graphics/overlay.hpp2
-rw-r--r--graphics/overlay_element.hpp7
-rw-r--r--graphics/overlay_renderer.cpp343
-rw-r--r--graphics/overlay_renderer.hpp101
-rw-r--r--graphics/packets_queue.cpp191
-rw-r--r--graphics/packets_queue.hpp169
-rw-r--r--graphics/path_renderer.cpp3
-rw-r--r--graphics/path_text_element.cpp2
-rw-r--r--graphics/path_text_element.hpp2
-rw-r--r--graphics/render_target.hpp23
-rw-r--r--graphics/resource_manager.cpp15
-rw-r--r--graphics/resource_manager.hpp2
-rw-r--r--graphics/resource_style.cpp2
-rw-r--r--graphics/screen.hpp17
-rw-r--r--graphics/shape_renderer.cpp3
-rw-r--r--graphics/skin.cpp3
-rw-r--r--graphics/skin_page.cpp6
-rw-r--r--graphics/straight_text_element.cpp2
-rw-r--r--graphics/straight_text_element.hpp2
-rw-r--r--graphics/symbol_element.cpp2
-rw-r--r--graphics/symbol_element.hpp2
-rw-r--r--graphics/text_element.cpp2
-rw-r--r--graphics/text_element.hpp8
-rw-r--r--graphics/text_renderer.cpp108
-rw-r--r--graphics/text_renderer.hpp53
-rw-r--r--gui/button.cpp2
-rw-r--r--gui/button.hpp2
-rw-r--r--gui/controller.cpp6
-rw-r--r--gui/controller.hpp18
-rw-r--r--gui/element.cpp2
-rw-r--r--gui/element.hpp2
-rw-r--r--gui/text_view.cpp2
-rw-r--r--gui/text_view.hpp2
-rw-r--r--iphone/Maps/Classes/EAGLView.mm6
-rw-r--r--iphone/Maps/Classes/RenderBuffer.hpp2
-rw-r--r--iphone/Maps/Classes/RenderBuffer.mm4
-rw-r--r--iphone/Maps/Classes/RenderContext.hpp2
-rw-r--r--map/compass_arrow.cpp4
-rw-r--r--map/compass_arrow.hpp4
-rw-r--r--map/country_status_display.cpp2
-rw-r--r--map/country_status_display.hpp2
-rw-r--r--map/coverage_generator.cpp8
-rw-r--r--map/coverage_generator.hpp4
-rw-r--r--map/drawer.cpp4
-rw-r--r--map/drawer.hpp7
-rw-r--r--map/framework.cpp4
-rw-r--r--map/location_state.cpp16
-rw-r--r--map/location_state.hpp16
-rw-r--r--map/qgl_render_context.hpp3
-rw-r--r--map/queued_renderer.cpp39
-rw-r--r--map/queued_renderer.hpp16
-rw-r--r--map/render_policy.cpp8
-rw-r--r--map/render_policy.hpp4
-rw-r--r--map/ruler.cpp2
-rw-r--r--map/ruler.hpp2
-rw-r--r--map/screen_coverage.cpp10
-rw-r--r--map/screen_coverage.hpp10
-rw-r--r--map/simple_render_policy.cpp3
-rw-r--r--map/test_render_policy.cpp14
-rw-r--r--map/test_render_policy.hpp4
-rw-r--r--map/tile.cpp4
-rw-r--r--map/tile_renderer.cpp15
-rw-r--r--map/tile_renderer.hpp7
-rw-r--r--map/tiling_render_policy_mt.cpp1
-rw-r--r--map/tiling_render_policy_st.cpp4
-rw-r--r--qt/draw_widget.cpp2
-rw-r--r--qt_tstfrm/macros.hpp2
-rw-r--r--qt_tstfrm/tstwidgets.cpp15
-rw-r--r--qt_tstfrm/tstwidgets.hpp12
136 files changed, 2688 insertions, 2538 deletions
diff --git a/android/jni/com/mapswithme/core/render_context.hpp b/android/jni/com/mapswithme/core/render_context.hpp
index 56374cc531..f878cd7be1 100644
--- a/android/jni/com/mapswithme/core/render_context.hpp
+++ b/android/jni/com/mapswithme/core/render_context.hpp
@@ -7,7 +7,7 @@
#pragma once
-#include "../../../../../graphics/rendercontext.hpp"
+#include "../../../../../graphics/opengl/rendercontext.hpp"
#include "../../../../../std/shared_ptr.hpp"
diff --git a/android/jni/com/mapswithme/maps/Framework.cpp b/android/jni/com/mapswithme/maps/Framework.cpp
index ce04bd6114..8b8c5a579e 100644
--- a/android/jni/com/mapswithme/maps/Framework.cpp
+++ b/android/jni/com/mapswithme/maps/Framework.cpp
@@ -12,8 +12,8 @@
#include "../../../../../coding/file_container.hpp"
-#include "../../../../../graphics/framebuffer.hpp"
-#include "../../../../../graphics/internal/opengl.hpp"
+#include "../../../../../graphics/opengl/framebuffer.hpp"
+#include "../../../../../graphics/opengl/opengl.hpp"
#include "../../../../../platform/platform.hpp"
#include "../../../../../platform/location.hpp"
diff --git a/android/jni/com/mapswithme/maps/Lifecycle.cpp b/android/jni/com/mapswithme/maps/Lifecycle.cpp
index 8c51782bd7..8ae89f0b30 100644
--- a/android/jni/com/mapswithme/maps/Lifecycle.cpp
+++ b/android/jni/com/mapswithme/maps/Lifecycle.cpp
@@ -18,7 +18,7 @@
#include "../../../nv_event/nv_event.hpp"
#include "../../../nv_thread/nv_thread.hpp"
#include "../../../../../base/logging.hpp"
-#include "../../../../../graphics/internal/opengl.hpp"
+#include "../../../../../graphics/opengl/opengl.hpp"
#include "Framework.hpp"
#include "../platform/Platform.hpp"
diff --git a/graphics/agg_traits.hpp b/graphics/agg_traits.hpp
index da61009316..4233d28e41 100644
--- a/graphics/agg_traits.hpp
+++ b/graphics/agg_traits.hpp
@@ -7,7 +7,7 @@
#include <agg_scanline_u.h>
#include <agg_ellipse.h>
-#include "data_traits.hpp"
+#include "opengl/data_traits.hpp"
template <typename Traits>
struct AggTraits
diff --git a/graphics/area_renderer.cpp b/graphics/area_renderer.cpp
index d9b3af5e48..f7aba20de8 100644
--- a/graphics/area_renderer.cpp
+++ b/graphics/area_renderer.cpp
@@ -2,7 +2,8 @@
#include "resource_style.hpp"
#include "skin.hpp"
#include "skin_page.hpp"
-#include "base_texture.hpp"
+
+#include "opengl/base_texture.hpp"
#include "../base/logging.hpp"
diff --git a/graphics/area_renderer.hpp b/graphics/area_renderer.hpp
index 31aec8eec8..615cd65dc1 100644
--- a/graphics/area_renderer.hpp
+++ b/graphics/area_renderer.hpp
@@ -4,7 +4,7 @@
namespace graphics
{
- class AreaRenderer : public gl::GeometryBatcher
+ class AreaRenderer : public GeometryBatcher
{
private:
@@ -14,7 +14,7 @@ namespace graphics
public:
- typedef gl::GeometryBatcher base_t;
+ typedef GeometryBatcher base_t;
struct Params : base_t::Params
{
diff --git a/graphics/blitter.cpp b/graphics/blitter.cpp
index c1878e9df3..25524db925 100644
--- a/graphics/blitter.cpp
+++ b/graphics/blitter.cpp
@@ -1,356 +1,255 @@
-#include "../base/SRC_FIRST.hpp"
+#include "opengl/base_texture.hpp"
+#include "opengl/buffer_object.hpp"
+#include "opengl/utils.hpp"
+#include "opengl/storage.hpp"
+#include "opengl/vertex.hpp"
+#include "opengl/texture.hpp"
#include "blitter.hpp"
-#include "framebuffer.hpp"
-#include "base_texture.hpp"
#include "resource_manager.hpp"
-#include "buffer_object.hpp"
-#include "utils.hpp"
-#include "storage.hpp"
-#include "vertex.hpp"
#include "defines.hpp"
-#include "texture.hpp"
#include "../geometry/screenbase.hpp"
#include "../base/logging.hpp"
namespace graphics
{
- namespace gl
+ Blitter::Blitter(base_t::Params const & params) : base_t(params)
{
- Blitter::IMMDrawTexturedRect::IMMDrawTexturedRect(
- m2::RectF const & rect,
- m2::RectF const & texRect,
- shared_ptr<BaseTexture> const & texture,
- shared_ptr<ResourceManager> const & rm)
- {
- m2::PointF rectPoints[4] =
- {
- m2::PointF(rect.minX(), rect.minY()),
- m2::PointF(rect.maxX(), rect.minY()),
- m2::PointF(rect.maxX(), rect.maxY()),
- m2::PointF(rect.minX(), rect.maxY())
- };
-
- m2::PointF texRectPoints[4] =
- {
- m2::PointF(texRect.minX(), texRect.minY()),
- m2::PointF(texRect.maxX(), texRect.minY()),
- m2::PointF(texRect.maxX(), texRect.maxY()),
- m2::PointF(texRect.minX(), texRect.maxY()),
- };
-
- m_pts.resize(4);
- m_texPts.resize(4);
-
- copy(rectPoints, rectPoints + 4, &m_pts[0]);
- copy(texRectPoints, texRectPoints + 4, &m_texPts[0]);
- m_ptsCount = 4;
- m_texture = texture;
- m_hasTexture = true;
- m_hasColor = false;
- m_color = graphics::Color(255, 255, 255, 255);
- m_resourceManager = rm;
- }
+ }
- Blitter::Blitter(base_t::Params const & params) : base_t(params)
- {
- }
+ Blitter::~Blitter()
+ {
+ }
- Blitter::~Blitter()
- {
- }
+ void Blitter::beginFrame()
+ {
+ base_t::beginFrame();
+ }
- void Blitter::beginFrame()
- {
- base_t::beginFrame();
- }
+ void Blitter::endFrame()
+ {
+ base_t::endFrame();
+ }
- void Blitter::endFrame()
- {
- base_t::endFrame();
- }
+ void Blitter::blit(shared_ptr<gl::BaseTexture> const & srcSurface,
+ ScreenBase const & from,
+ ScreenBase const & to,
+ bool isSubPixel,
+ graphics::Color const & color,
+ m2::RectI const & srcRect,
+ m2::RectU const & texRect)
+ {
+ blit(srcSurface,
+ from.PtoGMatrix() * to.GtoPMatrix(),
+ isSubPixel,
+ color,
+ srcRect,
+ texRect);
+ }
- void Blitter::blit(shared_ptr<BaseTexture> const & srcSurface,
- ScreenBase const & from,
- ScreenBase const & to,
- bool isSubPixel,
- graphics::Color const & color,
- m2::RectI const & srcRect,
- m2::RectU const & texRect)
- {
- blit(srcSurface,
- from.PtoGMatrix() * to.GtoPMatrix(),
- isSubPixel,
- color,
- srcRect,
- texRect);
- }
+ void Blitter::blit(BlitInfo const * blitInfo,
+ size_t s,
+ bool isSubPixel)
+ {
+ vector<m2::PointF> geomPts(4 * s);
+ vector<m2::PointF> texPts(4 * s);
+ vector<unsigned short> idxData(4 * s);
- void Blitter::blit(BlitInfo const * blitInfo,
- size_t s,
- bool isSubPixel)
+ for (size_t i = 0; i < s; ++i)
{
- vector<m2::PointF> geomPts(4 * s);
- vector<m2::PointF> texPts(4 * s);
- vector<unsigned short> idxData(4 * s);
-
- for (size_t i = 0; i < s; ++i)
- {
- calcPoints(blitInfo[i].m_srcRect,
- blitInfo[i].m_texRect,
- blitInfo[i].m_srcSurface,
- blitInfo[i].m_matrix,
- isSubPixel,
- &geomPts[i * 4],
- &texPts[i * 4]);
-
- idxData[i * 4 ] = i * 4;
- idxData[i * 4 + 1] = i * 4 + 1;
- idxData[i * 4 + 2] = i * 4 + 2;
- idxData[i * 4 + 3] = i * 4 + 3;
- }
-
- graphics::gl::Storage storage = resourceManager()->multiBlitStorages()->Reserve();
-
- if (resourceManager()->multiBlitStorages()->IsCancelled())
- {
- LOG(LINFO, ("skipping multiBlit on cancelled multiBlitStorages pool"));
- return;
- }
-
- /// TODO : Bad lock/unlock checking pattern. Should refactor
- if (!storage.m_vertices->isLocked())
- storage.m_vertices->lock();
- if (!storage.m_indices->isLocked())
- storage.m_indices->lock();
-
- Vertex * pointsData = (Vertex*)storage.m_vertices->data();
-
- for (size_t i = 0; i < s * 4; ++i)
- {
- pointsData[i].pt.x = geomPts[i].x;
- pointsData[i].pt.y = geomPts[i].y;
- pointsData[i].depth = graphics::maxDepth;
- pointsData[i].tex.x = texPts[i].x;
- pointsData[i].tex.y = texPts[i].y;
- pointsData[i].normal.x = 0;
- pointsData[i].normal.y = 0;
-// pointsData[i].color = graphics::Color(255, 255, 255, 255);
- }
-
- memcpy(storage.m_indices->data(), &idxData[0], idxData.size() * sizeof(unsigned short));
-
- base_t::unlockStorage(storage);
- base_t::applyBlitStates();
-
- for (unsigned i = 0; i < s; ++i)
- base_t::drawGeometry(blitInfo[i].m_srcSurface,
- storage,
- 4,
- sizeof(unsigned short) * i * 4,
- GL_TRIANGLE_FAN);
-
- base_t::applyStates();
- base_t::discardStorage(storage);
-
- base_t::freeStorage(storage, resourceManager()->multiBlitStorages());
+ calcPoints(blitInfo[i].m_srcRect,
+ blitInfo[i].m_texRect,
+ blitInfo[i].m_srcSurface,
+ blitInfo[i].m_matrix,
+ isSubPixel,
+ &geomPts[i * 4],
+ &texPts[i * 4]);
+
+ idxData[i * 4 ] = i * 4;
+ idxData[i * 4 + 1] = i * 4 + 1;
+ idxData[i * 4 + 2] = i * 4 + 2;
+ idxData[i * 4 + 3] = i * 4 + 3;
}
- void Blitter::blit(shared_ptr<graphics::gl::BaseTexture> const & srcSurface,
- math::Matrix<double, 3, 3> const & m,
- bool isSubPixel)
+ graphics::gl::Storage storage = resourceManager()->multiBlitStorages()->Reserve();
+
+ if (resourceManager()->multiBlitStorages()->IsCancelled())
{
- blit(srcSurface,
- m,
- isSubPixel,
- graphics::Color(),
- m2::RectI(0, 0, srcSurface->width(), srcSurface->height()),
- m2::RectU(0, 0, srcSurface->width(), srcSurface->height()));
+ LOG(LINFO, ("skipping multiBlit on cancelled multiBlitStorages pool"));
+ return;
}
- void Blitter::calcPoints(m2::RectI const & srcRect,
- m2::RectU const & texRect,
- shared_ptr<BaseTexture> const & srcSurface,
- math::Matrix<double, 3, 3> const & m,
- bool isSubPixel,
- m2::PointF * geomPts,
- m2::PointF * texPts)
+ /// TODO : Bad lock/unlock checking pattern. Should refactor
+ if (!storage.m_vertices->isLocked())
+ storage.m_vertices->lock();
+ if (!storage.m_indices->isLocked())
+ storage.m_indices->lock();
+
+ gl::Vertex * pointsData = (gl::Vertex*)storage.m_vertices->data();
+
+ for (size_t i = 0; i < s * 4; ++i)
{
- m2::PointF pt = m2::PointF(m2::PointD(srcRect.minX(), srcRect.minY()) * m);
-
- if (!isSubPixel)
- {
- pt.x = pt.x - my::rounds(pt.x);
- pt.y = pt.y - my::rounds(pt.y);
- }
- else
- pt = m2::PointF(0, 0);
-
- geomPts[0] = m2::PointF(m2::PointD(srcRect.minX(), srcRect.minY()) * m) + pt;
- geomPts[1] = m2::PointF(m2::PointD(srcRect.maxX(), srcRect.minY()) * m) + pt;
- geomPts[2] = m2::PointF(m2::PointD(srcRect.maxX(), srcRect.maxY()) * m) + pt;
- geomPts[3] = m2::PointF(m2::PointD(srcRect.minX(), srcRect.maxY()) * m) + pt;
-
- texPts[0] = srcSurface->mapPixel(m2::PointF(texRect.minX(), texRect.minY()));
- texPts[1] = srcSurface->mapPixel(m2::PointF(texRect.maxX(), texRect.minY()));
- texPts[2] = srcSurface->mapPixel(m2::PointF(texRect.maxX(), texRect.maxY()));
- texPts[3] = srcSurface->mapPixel(m2::PointF(texRect.minX(), texRect.maxY()));
+ pointsData[i].pt.x = geomPts[i].x;
+ pointsData[i].pt.y = geomPts[i].y;
+ pointsData[i].depth = graphics::maxDepth;
+ pointsData[i].tex.x = texPts[i].x;
+ pointsData[i].tex.y = texPts[i].y;
+ pointsData[i].normal.x = 0;
+ pointsData[i].normal.y = 0;
+ // pointsData[i].color = graphics::Color(255, 255, 255, 255);
}
- void Blitter::blit(shared_ptr<graphics::gl::BaseTexture> const & srcSurface,
- math::Matrix<double, 3, 3> const & m,
- bool isSubPixel,
- graphics::Color const & color,
- m2::RectI const & srcRect,
- m2::RectU const & texRect)
- {
- m2::PointF pts[4];
- m2::PointF texPts[4];
+ memcpy(storage.m_indices->data(), &idxData[0], idxData.size() * sizeof(unsigned short));
- calcPoints(srcRect, texRect, srcSurface, m, isSubPixel, pts, texPts);
+ base_t::unlockStorage(storage);
+ base_t::applyBlitStates();
- immDrawTexturedPrimitives(pts, texPts, 4, srcSurface, true, color, false);
- }
+ for (unsigned i = 0; i < s; ++i)
+ base_t::drawGeometry(blitInfo[i].m_srcSurface,
+ storage,
+ 4,
+ sizeof(unsigned short) * i * 4,
+ ETrianglesFan);
- void Blitter::blit(shared_ptr<BaseTexture> const & srcSurface,
- ScreenBase const & from,
- ScreenBase const & to,
- bool isSubPixel)
- {
- blit(srcSurface,
- from,
- to,
- isSubPixel,
- graphics::Color(),
- m2::RectI(0, 0, srcSurface->width(), srcSurface->height()),
- m2::RectU(0, 0, srcSurface->width(), srcSurface->height()));
- }
+ base_t::applyStates();
+ base_t::discardStorage(storage);
- void Blitter::immDrawSolidRect(m2::RectF const & rect,
- graphics::Color const & color)
- {
- immDrawRect(rect, m2::RectF(), shared_ptr<RGBA8Texture>(), false, color, true);
- }
+ base_t::freeStorage(storage, resourceManager()->multiBlitStorages());
+ }
- void Blitter::immDrawRect(m2::RectF const & rect,
- m2::RectF const & texRect,
- shared_ptr<BaseTexture> texture,
- bool hasTexture,
- graphics::Color const & color,
- bool hasColor)
- {
- m2::PointF rectPoints[4] =
- {
- m2::PointF(rect.minX(), rect.minY()),
- m2::PointF(rect.maxX(), rect.minY()),
- m2::PointF(rect.maxX(), rect.maxY()),
- m2::PointF(rect.minX(), rect.maxY())
- };
-
- m2::PointF texRectPoints[4] =
- {
- m2::PointF(texRect.minX(), texRect.minY()),
- m2::PointF(texRect.maxX(), texRect.minY()),
- m2::PointF(texRect.maxX(), texRect.maxY()),
- m2::PointF(texRect.minX(), texRect.maxY()),
- };
-
- immDrawTexturedPrimitives(rectPoints, texRectPoints, 4, texture, hasTexture, color, hasColor);
- }
+ void Blitter::blit(shared_ptr<graphics::gl::BaseTexture> const & srcSurface,
+ math::Matrix<double, 3, 3> const & m,
+ bool isSubPixel)
+ {
+ blit(srcSurface,
+ m,
+ isSubPixel,
+ graphics::Color(),
+ m2::RectI(0, 0, srcSurface->width(), srcSurface->height()),
+ m2::RectU(0, 0, srcSurface->width(), srcSurface->height()));
+ }
+
+ void Blitter::calcPoints(m2::RectI const & srcRect,
+ m2::RectU const & texRect,
+ shared_ptr<gl::BaseTexture> const & srcSurface,
+ math::Matrix<double, 3, 3> const & m,
+ bool isSubPixel,
+ m2::PointF * geomPts,
+ m2::PointF * texPts)
+ {
+ m2::PointF pt = m2::PointF(m2::PointD(srcRect.minX(), srcRect.minY()) * m);
- void Blitter::immDrawTexturedRect(m2::RectF const & rect,
- m2::RectF const & texRect,
- shared_ptr<BaseTexture> const & texture)
+ if (!isSubPixel)
{
- shared_ptr<IMMDrawTexturedRect> command(new IMMDrawTexturedRect(rect, texRect, texture, resourceManager()));
- processCommand(command);
+ pt.x = pt.x - my::rounds(pt.x);
+ pt.y = pt.y - my::rounds(pt.y);
}
+ else
+ pt = m2::PointF(0, 0);
+
+ geomPts[0] = m2::PointF(m2::PointD(srcRect.minX(), srcRect.minY()) * m) + pt;
+ geomPts[1] = m2::PointF(m2::PointD(srcRect.maxX(), srcRect.minY()) * m) + pt;
+ geomPts[2] = m2::PointF(m2::PointD(srcRect.maxX(), srcRect.maxY()) * m) + pt;
+ geomPts[3] = m2::PointF(m2::PointD(srcRect.minX(), srcRect.maxY()) * m) + pt;
- void Blitter::immDrawTexturedPrimitives(m2::PointF const * pts,
- m2::PointF const * texPts,
- size_t size,
- shared_ptr<BaseTexture> const & texture,
- bool hasTexture,
- graphics::Color const & color,
- bool hasColor)
+ texPts[0] = srcSurface->mapPixel(m2::PointF(texRect.minX(), texRect.minY()));
+ texPts[1] = srcSurface->mapPixel(m2::PointF(texRect.maxX(), texRect.minY()));
+ texPts[2] = srcSurface->mapPixel(m2::PointF(texRect.maxX(), texRect.maxY()));
+ texPts[3] = srcSurface->mapPixel(m2::PointF(texRect.minX(), texRect.maxY()));
+ }
+
+ void Blitter::blit(shared_ptr<graphics::gl::BaseTexture> const & srcSurface,
+ math::Matrix<double, 3, 3> const & m,
+ bool isSubPixel,
+ graphics::Color const & color,
+ m2::RectI const & srcRect,
+ m2::RectU const & texRect)
+ {
+ m2::PointF pts[4];
+ m2::PointF texPts[4];
+
+ calcPoints(srcRect, texRect, srcSurface, m, isSubPixel, pts, texPts);
+
+ immDrawTexturedPrimitives(pts, texPts, 4, srcSurface, true, color, false);
+ }
+
+ void Blitter::blit(shared_ptr<gl::BaseTexture> const & srcSurface,
+ ScreenBase const & from,
+ ScreenBase const & to,
+ bool isSubPixel)
+ {
+ blit(srcSurface,
+ from,
+ to,
+ isSubPixel,
+ graphics::Color(),
+ m2::RectI(0, 0, srcSurface->width(), srcSurface->height()),
+ m2::RectU(0, 0, srcSurface->width(), srcSurface->height()));
+ }
+
+ void Blitter::immDrawSolidRect(m2::RectF const & rect,
+ graphics::Color const & color)
+ {
+ immDrawRect(rect, m2::RectF(), shared_ptr<gl::RGBA8Texture>(), false, color, true);
+ }
+
+ void Blitter::immDrawRect(m2::RectF const & rect,
+ m2::RectF const & texRect,
+ shared_ptr<gl::BaseTexture> texture,
+ bool hasTexture,
+ graphics::Color const & color,
+ bool hasColor)
+ {
+ m2::PointF rectPoints[4] =
{
- shared_ptr<IMMDrawTexturedPrimitives> command(new IMMDrawTexturedPrimitives());
-
- command->m_ptsCount = size;
- command->m_pts.resize(size);
- command->m_texPts.resize(size);
- copy(pts, pts + size, command->m_pts.begin());
- copy(texPts, texPts + size, command->m_texPts.begin());
- command->m_texture = texture;
- command->m_hasTexture = hasTexture;
- command->m_color = color;
- command->m_hasColor = hasColor;
- command->m_resourceManager = resourceManager();
-
- processCommand(command);
- }
+ m2::PointF(rect.minX(), rect.minY()),
+ m2::PointF(rect.maxX(), rect.minY()),
+ m2::PointF(rect.maxX(), rect.maxY()),
+ m2::PointF(rect.minX(), rect.maxY())
+ };
- void Blitter::IMMDrawTexturedPrimitives::perform()
+ m2::PointF texRectPoints[4] =
{
- if (isDebugging())
- LOG(LINFO, ("performing IMMDrawTexturedPrimitives command"));
-
- graphics::gl::Storage blitStorage = m_resourceManager->blitStorages()->Reserve();
-
- if (m_resourceManager->blitStorages()->IsCancelled())
- {
- LOG(LDEBUG, ("skipping IMMDrawTexturedPrimitives on cancelled multiBlitStorages pool"));
- return;
- }
-
- if (!blitStorage.m_vertices->isLocked())
- blitStorage.m_vertices->lock();
-
- if (!blitStorage.m_indices->isLocked())
- blitStorage.m_indices->lock();
-
- Vertex * pointsData = (Vertex*)blitStorage.m_vertices->data();
-
- for (size_t i = 0; i < m_ptsCount; ++i)
- {
- pointsData[i].pt.x = m_pts[i].x;
- pointsData[i].pt.y = m_pts[i].y;
- pointsData[i].depth = graphics::maxDepth;
- pointsData[i].tex.x = m_texPts[i].x;
- pointsData[i].tex.y = m_texPts[i].y;
- pointsData[i].normal.x = 0;
- pointsData[i].normal.y = 0;
- }
-
- blitStorage.m_vertices->unlock();
- blitStorage.m_vertices->makeCurrent();
-
- Vertex::setupLayout(blitStorage.m_vertices->glPtr());
-
- if (m_texture)
- m_texture->makeCurrent();
-
- unsigned short idxData[4] = {0, 1, 2, 3};
- memcpy(blitStorage.m_indices->data(), idxData, sizeof(idxData));
- blitStorage.m_indices->unlock();
- blitStorage.m_indices->makeCurrent();
-
- OGLCHECK(glDisableFn(GL_ALPHA_TEST_MWM));
- OGLCHECK(glDisableFn(GL_BLEND));
- OGLCHECK(glDisableFn(GL_DEPTH_TEST));
- OGLCHECK(glDepthMask(GL_FALSE));
- OGLCHECK(glDrawElementsFn(GL_TRIANGLE_FAN, 4, GL_UNSIGNED_SHORT, blitStorage.m_indices->glPtr()));
- OGLCHECK(glDepthMask(GL_TRUE));
- OGLCHECK(glEnableFn(GL_DEPTH_TEST));
- OGLCHECK(glEnableFn(GL_BLEND));
- OGLCHECK(glEnableFn(GL_ALPHA_TEST_MWM));
-
- blitStorage.m_vertices->discard();
- blitStorage.m_indices->discard();
-
- m_resourceManager->blitStorages()->Free(blitStorage);
- }
+ m2::PointF(texRect.minX(), texRect.minY()),
+ m2::PointF(texRect.maxX(), texRect.minY()),
+ m2::PointF(texRect.maxX(), texRect.maxY()),
+ m2::PointF(texRect.minX(), texRect.maxY()),
+ };
+
+ immDrawTexturedPrimitives(rectPoints, texRectPoints, 4, texture, hasTexture, color, hasColor);
+ }
+
+ void Blitter::immDrawTexturedRect(m2::RectF const & rect,
+ m2::RectF const & texRect,
+ shared_ptr<gl::BaseTexture> const & texture)
+ {
+ shared_ptr<IMMDrawTexturedRect> command(new IMMDrawTexturedRect(rect, texRect, texture, resourceManager()));
+ processCommand(command);
+ }
+
+ void Blitter::immDrawTexturedPrimitives(m2::PointF const * pts,
+ m2::PointF const * texPts,
+ size_t size,
+ shared_ptr<gl::BaseTexture> const & texture,
+ bool hasTexture,
+ graphics::Color const & color,
+ bool hasColor)
+ {
+ shared_ptr<IMMDrawTexturedPrimitives> command(new IMMDrawTexturedPrimitives());
+
+ command->m_ptsCount = size;
+ command->m_pts.resize(size);
+ command->m_texPts.resize(size);
+ copy(pts, pts + size, command->m_pts.begin());
+ copy(texPts, texPts + size, command->m_texPts.begin());
+ command->m_texture = texture;
+ command->m_hasTexture = hasTexture;
+ command->m_color = color;
+ command->m_hasColor = hasColor;
+ command->m_resourceManager = resourceManager();
+
+ processCommand(command);
}
}
diff --git a/graphics/blitter.hpp b/graphics/blitter.hpp
index 115acceb9e..0a967e9ab6 100644
--- a/graphics/blitter.hpp
+++ b/graphics/blitter.hpp
@@ -1,7 +1,8 @@
#pragma once
-#include "geometry_renderer.hpp"
-#include "storage.hpp"
+#include "opengl/storage.hpp"
+
+#include "display_list_renderer.hpp"
#include "../geometry/point2d.hpp"
#include "../geometry/rect2d.hpp"
@@ -19,119 +20,95 @@ namespace graphics
namespace gl
{
class BaseTexture;
-
- struct BlitInfo
- {
- shared_ptr<BaseTexture> m_srcSurface;
- math::Matrix<double, 3, 3> m_matrix;
- m2::RectI m_srcRect;
- m2::RectU m_texRect;
- };
-
- class Blitter : public GeometryRenderer
- {
- private:
-
- graphics::gl::Storage m_blitStorage;
-
- protected:
-
- typedef GeometryRenderer base_t;
-
- void calcPoints(m2::RectI const & srcRect,
- m2::RectU const & texRect,
- shared_ptr<BaseTexture> const & texture,
- math::Matrix<double, 3, 3> const & m,
- bool isSubPixel,
- m2::PointF * geomPts,
- m2::PointF * texPts);
-
- public:
-
- struct IMMDrawTexturedPrimitives : Command
- {
- buffer_vector<m2::PointF, 8> m_pts;
- buffer_vector<m2::PointF, 8> m_texPts;
- unsigned m_ptsCount;
- shared_ptr<BaseTexture> m_texture;
- bool m_hasTexture;
- graphics::Color m_color;
- bool m_hasColor;
-
- shared_ptr<ResourceManager> m_resourceManager;
-
- void perform();
- };
-
- struct IMMDrawTexturedRect : IMMDrawTexturedPrimitives
- {
- IMMDrawTexturedRect(m2::RectF const & rect,
- m2::RectF const & texRect,
- shared_ptr<BaseTexture> const & texture,
- shared_ptr<ResourceManager> const & rm);
- };
-
- Blitter(base_t::Params const & params);
- ~Blitter();
-
- void beginFrame();
- void endFrame();
-
- /// Immediate mode rendering functions.
- /// they doesn't buffer any data as other functions do, but immediately renders it
- /// @{
-
- void blit(shared_ptr<BaseTexture> const & srcSurface,
- ScreenBase const & from,
- ScreenBase const & to,
- bool isSubPixel,
- graphics::Color const & color,
- m2::RectI const & srcRect,
- m2::RectU const & texRect);
-
- void blit(shared_ptr<BaseTexture> const & srcSurface,
- ScreenBase const & from,
- ScreenBase const & to,
- bool isSubPixel = false);
-
- void blit(shared_ptr<BaseTexture> const & srcSurface,
- math::Matrix<double, 3, 3> const & m,
- bool isSubPixel = false);
-
- void blit(shared_ptr<BaseTexture> const & srcSurface,
- math::Matrix<double, 3, 3> const & m,
- bool isSubPixel,
- graphics::Color const & color,
- m2::RectI const & srcRect,
- m2::RectU const & texRect);
-
- void blit(BlitInfo const * blitInfo,
- size_t s,
- bool isSubPixel);
-
- void immDrawSolidRect(m2::RectF const & rect,
- graphics::Color const & color);
-
- void immDrawRect(m2::RectF const & rect,
- m2::RectF const & texRect,
- shared_ptr<BaseTexture> texture,
- bool hasTexture,
- graphics::Color const & color,
- bool hasColor);
-
- void immDrawTexturedPrimitives(m2::PointF const * pts,
- m2::PointF const * texPts,
- size_t size,
- shared_ptr<BaseTexture> const & texture,
- bool hasTexture,
- graphics::Color const & color,
- bool hasColor);
-
- void immDrawTexturedRect(m2::RectF const & rect,
- m2::RectF const & texRect,
- shared_ptr<BaseTexture> const & texture);
-
- /// @}
- };
}
+
+ struct BlitInfo
+ {
+ shared_ptr<gl::BaseTexture> m_srcSurface;
+ math::Matrix<double, 3, 3> m_matrix;
+ m2::RectI m_srcRect;
+ m2::RectU m_texRect;
+ };
+
+ class Blitter : public DisplayListRenderer
+ {
+ private:
+
+ gl::Storage m_blitStorage;
+
+ protected:
+
+ typedef DisplayListRenderer base_t;
+
+ void calcPoints(m2::RectI const & srcRect,
+ m2::RectU const & texRect,
+ shared_ptr<gl::BaseTexture> const & texture,
+ math::Matrix<double, 3, 3> const & m,
+ bool isSubPixel,
+ m2::PointF * geomPts,
+ m2::PointF * texPts);
+ public:
+
+ Blitter(base_t::Params const & params);
+ ~Blitter();
+
+ void beginFrame();
+ void endFrame();
+
+ /// Immediate mode rendering functions.
+ /// they doesn't buffer any data as other functions do, but immediately renders it
+ /// @{
+
+ void blit(shared_ptr<gl::BaseTexture> const & srcSurface,
+ ScreenBase const & from,
+ ScreenBase const & to,
+ bool isSubPixel,
+ graphics::Color const & color,
+ m2::RectI const & srcRect,
+ m2::RectU const & texRect);
+
+ void blit(shared_ptr<gl::BaseTexture> const & srcSurface,
+ ScreenBase const & from,
+ ScreenBase const & to,
+ bool isSubPixel = false);
+
+ void blit(shared_ptr<gl::BaseTexture> const & srcSurface,
+ math::Matrix<double, 3, 3> const & m,
+ bool isSubPixel = false);
+
+ void blit(shared_ptr<gl::BaseTexture> const & srcSurface,
+ math::Matrix<double, 3, 3> const & m,
+ bool isSubPixel,
+ graphics::Color const & color,
+ m2::RectI const & srcRect,
+ m2::RectU const & texRect);
+
+ void blit(BlitInfo const * blitInfo,
+ size_t s,
+ bool isSubPixel);
+
+ void immDrawSolidRect(m2::RectF const & rect,
+ Color const & color);
+
+ void immDrawRect(m2::RectF const & rect,
+ m2::RectF const & texRect,
+ shared_ptr<gl::BaseTexture> texture,
+ bool hasTexture,
+ Color const & color,
+ bool hasColor);
+
+ void immDrawTexturedPrimitives(m2::PointF const * pts,
+ m2::PointF const * texPts,
+ size_t size,
+ shared_ptr<gl::BaseTexture> const & texture,
+ bool hasTexture,
+ Color const & color,
+ bool hasColor);
+
+ void immDrawTexturedRect(m2::RectF const & rect,
+ m2::RectF const & texRect,
+ shared_ptr<gl::BaseTexture> const & texture);
+
+ /// @}
+ };
}
diff --git a/graphics/circle_element.cpp b/graphics/circle_element.cpp
index 6a7723d610..a0fd5a0b58 100644
--- a/graphics/circle_element.cpp
+++ b/graphics/circle_element.cpp
@@ -41,7 +41,7 @@ namespace graphics
return m2::AnyRectD(m2::RectD(posPt, posPt + m2::PointD(texRect.SizeX(), texRect.SizeY())));
}
- void CircleElement::draw(gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const
+ void CircleElement::draw(OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const
{
if (!isNeedRedraw())
return;
diff --git a/graphics/circle_element.hpp b/graphics/circle_element.hpp
index 6f99c87a05..49fbde0e0e 100644
--- a/graphics/circle_element.hpp
+++ b/graphics/circle_element.hpp
@@ -29,7 +29,7 @@ namespace graphics
vector<m2::AnyRectD> const & boundRects() const;
- void draw(gl::OverlayRenderer * s, math::Matrix<double, 3, 3> const & m) const;
+ void draw(OverlayRenderer * s, math::Matrix<double, 3, 3> const & m) const;
int visualRank() const;
diff --git a/graphics/circle_style.cpp b/graphics/circle_style.cpp
index 6a379da0fe..f9d059a855 100644
--- a/graphics/circle_style.cpp
+++ b/graphics/circle_style.cpp
@@ -1,7 +1,7 @@
#include "resource_style.hpp"
-
#include "agg_traits.hpp"
-#include "data_traits.hpp"
+
+#include "opengl/data_traits.hpp"
namespace graphics
{
diff --git a/graphics/composite_overlay_element.cpp b/graphics/composite_overlay_element.cpp
index e0dbbf3293..c49f946995 100644
--- a/graphics/composite_overlay_element.cpp
+++ b/graphics/composite_overlay_element.cpp
@@ -41,7 +41,7 @@ namespace graphics
return m_boundRects;
}
- void CompositeOverlayElement::draw(gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const
+ void CompositeOverlayElement::draw(OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const
{
r->drawRectangle(roughBoundRect(), graphics::Color(255, 255, 0, 64), depth() - 3);
for (unsigned i = 0; i < m_elements.size(); ++i)
diff --git a/graphics/composite_overlay_element.hpp b/graphics/composite_overlay_element.hpp
index 97ba118547..96604f1489 100644
--- a/graphics/composite_overlay_element.hpp
+++ b/graphics/composite_overlay_element.hpp
@@ -24,7 +24,7 @@ namespace graphics
vector<m2::AnyRectD> const & boundRects() const;
- void draw(gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
+ void draw(OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
int visualRank() const;
diff --git a/graphics/defines.hpp b/graphics/defines.hpp
index 046759874f..2935f7676b 100644
--- a/graphics/defines.hpp
+++ b/graphics/defines.hpp
@@ -4,6 +4,19 @@ namespace graphics
{
static const int maxDepth = 20000;
+ enum EPrimitives
+ {
+ ETriangles,
+ ETrianglesFan,
+ ETrianglesStrip
+ };
+
+ enum EMatrix
+ {
+ EModelView,
+ EProjection
+ };
+
enum EPosition
{
EPosCenter = 0x00,
diff --git a/graphics/display_list.cpp b/graphics/display_list.cpp
index 2af5151843..bcced2c0b6 100644
--- a/graphics/display_list.cpp
+++ b/graphics/display_list.cpp
@@ -1,124 +1,118 @@
#include "display_list.hpp"
-#include "internal/opengl.hpp"
namespace graphics
{
- namespace gl
+ DisplayList::DisplayList(DisplayListRenderer * parent)
+ : m_parent(parent),
+ m_isDebugging(false)
+ {}
+
+ DisplayList::~DisplayList()
+ {
+ for (list<shared_ptr<DiscardStorageCmd> >::const_iterator it = m_discardStorageCmd.begin();
+ it != m_discardStorageCmd.end();
+ ++it)
+ m_parent->processCommand(*it);
+
+ m_discardStorageCmd.clear();
+
+ for (list<shared_ptr<FreeStorageCmd> >::const_iterator it = m_freeStorageCmd.begin();
+ it != m_freeStorageCmd.end();
+ ++it)
+ m_parent->processCommand(*it);
+
+ m_freeStorageCmd.clear();
+
+ for (list<shared_ptr<FreeTextureCmd> >::const_iterator it = m_freeTextureCmd.begin();
+ it != m_freeTextureCmd.end();
+ ++it)
+ m_parent->processCommand(*it);
+
+ m_freeTextureCmd.clear();
+
+ m_commands.clear();
+ }
+
+ void DisplayList::applyBlitStates(shared_ptr<ApplyBlitStatesCmd> const & cmd)
{
- DisplayList::DisplayList(GeometryRenderer * parent)
- : m_parent(parent),
- m_isDebugging(false)
- {}
-
- DisplayList::~DisplayList()
- {
- for (list<shared_ptr<DiscardStorageCmd> >::const_iterator it = m_discardStorageCmd.begin();
- it != m_discardStorageCmd.end();
- ++it)
- m_parent->processCommand(*it);
-
- m_discardStorageCmd.clear();
-
- for (list<shared_ptr<FreeStorageCmd> >::const_iterator it = m_freeStorageCmd.begin();
- it != m_freeStorageCmd.end();
- ++it)
- m_parent->processCommand(*it);
-
- m_freeStorageCmd.clear();
-
- for (list<shared_ptr<FreeTextureCmd> >::const_iterator it = m_freeTextureCmd.begin();
- it != m_freeTextureCmd.end();
- ++it)
- m_parent->processCommand(*it);
-
- m_freeTextureCmd.clear();
-
- m_commands.clear();
- }
-
- void DisplayList::applyBlitStates(shared_ptr<ApplyBlitStatesCmd> const & cmd)
- {
- cmd->setIsDebugging(m_isDebugging);
- m_commands.push_back(cmd);
- }
-
- void DisplayList::applyStates(shared_ptr<ApplyStatesCmd> const & cmd)
- {
- cmd->setIsDebugging(m_isDebugging);
- m_commands.push_back(cmd);
- }
-
- void DisplayList::drawGeometry(shared_ptr<DrawGeometryCmd> const & cmd)
- {
- cmd->setIsDebugging(m_isDebugging);
- m_commands.push_back(cmd);
- }
-
- void DisplayList::unlockStorage(shared_ptr<UnlockStorageCmd> const & cmd)
- {
- cmd->setIsDebugging(m_isDebugging);
- m_parent->processCommand(cmd);
- }
-
- void DisplayList::freeStorage(shared_ptr<FreeStorageCmd> const & cmd)
- {
- cmd->setIsDebugging(m_isDebugging);
- m_freeStorageCmd.push_back(cmd);
- }
-
- void DisplayList::freeTexture(shared_ptr<FreeTextureCmd> const & cmd)
- {
- cmd->setIsDebugging(m_isDebugging);
- m_freeTextureCmd.push_back(cmd);
- }
-
- void DisplayList::discardStorage(shared_ptr<DiscardStorageCmd> const & cmd)
- {
- cmd->setIsDebugging(m_isDebugging);
- m_discardStorageCmd.push_back(cmd);
- }
-
- void DisplayList::uploadData(shared_ptr<UploadDataCmd> const & cmd)
- {
- cmd->setIsDebugging(m_isDebugging);
- m_parent->processCommand(cmd);
- }
-
- void DisplayList::addCheckPoint()
- {
- m_parent->addCheckPoint();
- }
-
- void DisplayList::draw(math::Matrix<double, 3, 3> const & m)
- {
- math::Matrix<float, 4, 4> mv;
-
- /// preparing ModelView matrix
-
- mv(0, 0) = m(0, 0); mv(0, 1) = m(1, 0); mv(0, 2) = 0; mv(0, 3) = m(2, 0);
- mv(1, 0) = m(0, 1); mv(1, 1) = m(1, 1); mv(1, 2) = 0; mv(1, 3) = m(2, 1);
- mv(2, 0) = 0; mv(2, 1) = 0; mv(2, 2) = 1; mv(2, 3) = 0;
- mv(3, 0) = m(0, 2); mv(3, 1) = m(1, 2); mv(3, 2) = 0; mv(3, 3) = m(2, 2);
-
- OGLCHECK(glMatrixModeFn(GL_MODELVIEW_MWM));
- OGLCHECK(glLoadIdentityFn());
- OGLCHECK(glLoadMatrixfFn(&mv(0, 0)));
-
- /// drawing collected geometry
-
- if (m_isDebugging)
- LOG(LINFO, ("started DisplayList::draw"));
-
- for (list<shared_ptr<Command> >::const_iterator it = m_commands.begin();
- it != m_commands.end();
- ++it)
- (*it)->perform();
-
- if (m_isDebugging)
- LOG(LINFO, ("finished DisplayList::draw"));
-
- OGLCHECK(glMatrixModeFn(GL_MODELVIEW_MWM));
- OGLCHECK(glLoadIdentityFn());
- }
+ cmd->setIsDebugging(m_isDebugging);
+ m_commands.push_back(cmd);
+ }
+
+ void DisplayList::applyStates(shared_ptr<ApplyStatesCmd> const & cmd)
+ {
+ cmd->setIsDebugging(m_isDebugging);
+ m_commands.push_back(cmd);
+ }
+
+ void DisplayList::drawGeometry(shared_ptr<DrawGeometryCmd> const & cmd)
+ {
+ cmd->setIsDebugging(m_isDebugging);
+ m_commands.push_back(cmd);
+ }
+
+ void DisplayList::unlockStorage(shared_ptr<UnlockStorageCmd> const & cmd)
+ {
+ cmd->setIsDebugging(m_isDebugging);
+ m_parent->processCommand(cmd);
+ }
+
+ void DisplayList::freeStorage(shared_ptr<FreeStorageCmd> const & cmd)
+ {
+ cmd->setIsDebugging(m_isDebugging);
+ m_freeStorageCmd.push_back(cmd);
+ }
+
+ void DisplayList::freeTexture(shared_ptr<FreeTextureCmd> const & cmd)
+ {
+ cmd->setIsDebugging(m_isDebugging);
+ m_freeTextureCmd.push_back(cmd);
+ }
+
+ void DisplayList::discardStorage(shared_ptr<DiscardStorageCmd> const & cmd)
+ {
+ cmd->setIsDebugging(m_isDebugging);
+ m_discardStorageCmd.push_back(cmd);
+ }
+
+ void DisplayList::uploadStyles(shared_ptr<UploadDataCmd> const & cmd)
+ {
+ cmd->setIsDebugging(m_isDebugging);
+ m_parent->processCommand(cmd);
+ }
+
+ void DisplayList::addCheckPoint()
+ {
+ static_cast<gl::Renderer*>(m_parent)->addCheckPoint();
+ }
+
+ void DisplayList::draw(DisplayListRenderer * r,
+ math::Matrix<double, 3, 3> const & m)
+ {
+ math::Matrix<float, 4, 4> mv;
+
+ /// preparing ModelView matrix
+
+ mv(0, 0) = m(0, 0); mv(0, 1) = m(1, 0); mv(0, 2) = 0; mv(0, 3) = m(2, 0);
+ mv(1, 0) = m(0, 1); mv(1, 1) = m(1, 1); mv(1, 2) = 0; mv(1, 3) = m(2, 1);
+ mv(2, 0) = 0; mv(2, 1) = 0; mv(2, 2) = 1; mv(2, 3) = 0;
+ mv(3, 0) = m(0, 2); mv(3, 1) = m(1, 2); mv(3, 2) = 0; mv(3, 3) = m(2, 2);
+
+ r->loadMatrix(EModelView, mv);
+
+ /// drawing collected geometry
+
+ if (m_isDebugging)
+ LOG(LINFO, ("started DisplayList::draw"));
+
+ for (list<shared_ptr<Command> >::const_iterator it = m_commands.begin();
+ it != m_commands.end();
+ ++it)
+ (*it)->perform();
+
+ if (m_isDebugging)
+ LOG(LINFO, ("finished DisplayList::draw"));
+
+ r->loadMatrix(EModelView, math::Identity<double, 4>());
}
}
diff --git a/graphics/display_list.hpp b/graphics/display_list.hpp
index cfaa5c6b44..68d24af86f 100644
--- a/graphics/display_list.hpp
+++ b/graphics/display_list.hpp
@@ -1,51 +1,51 @@
#pragma once
-#include "geometry_renderer.hpp"
+#include "defines.hpp"
+#include "display_list_renderer.hpp"
namespace graphics
{
- namespace gl
+ class DisplayList
{
- class DisplayList
- {
- private:
-
- typedef GeometryRenderer::DrawGeometry DrawGeometryCmd;
- typedef GeometryRenderer::DiscardStorage DiscardStorageCmd;
- typedef GeometryRenderer::FreeTexture FreeTextureCmd;
- typedef GeometryRenderer::UnlockStorage UnlockStorageCmd;
- typedef GeometryRenderer::FreeStorage FreeStorageCmd;
- typedef GeometryRenderer::ApplyBlitStates ApplyBlitStatesCmd;
- typedef GeometryRenderer::ApplyStates ApplyStatesCmd;
- typedef GeometryRenderer::UploadData UploadDataCmd;
-
- list<shared_ptr<Command> > m_commands;
-
- list<shared_ptr<DiscardStorageCmd> > m_discardStorageCmd;
- list<shared_ptr<FreeTextureCmd> > m_freeTextureCmd;
- list<shared_ptr<FreeStorageCmd> > m_freeStorageCmd;
-
- GeometryRenderer * m_parent;
- bool m_isDebugging;
-
- friend class GeometryRenderer;
- DisplayList(GeometryRenderer * parent);
-
- public:
-
- ~DisplayList();
-
- void applyStates(shared_ptr<ApplyStatesCmd> const & cmd);
- void applyBlitStates(shared_ptr<ApplyBlitStatesCmd> const & cmd);
- void drawGeometry(shared_ptr<DrawGeometryCmd> const & cmd);
- void unlockStorage(shared_ptr<UnlockStorageCmd> const & cmd);
- void discardStorage(shared_ptr<DiscardStorageCmd> const & cmd);
- void freeTexture(shared_ptr<FreeTextureCmd> const & cmd);
- void freeStorage(shared_ptr<FreeStorageCmd> const & cmd);
- void uploadData(shared_ptr<UploadDataCmd> const & cmd);
- void addCheckPoint();
-
- void draw(math::Matrix<double, 3, 3> const & m);
- };
- }
+ private:
+
+ typedef gl::GeometryRenderer::DrawGeometry DrawGeometryCmd;
+ typedef gl::GeometryRenderer::DiscardStorage DiscardStorageCmd;
+ typedef gl::GeometryRenderer::FreeTexture FreeTextureCmd;
+ typedef gl::GeometryRenderer::UnlockStorage UnlockStorageCmd;
+ typedef gl::GeometryRenderer::FreeStorage FreeStorageCmd;
+ typedef gl::GeometryRenderer::ApplyBlitStates ApplyBlitStatesCmd;
+ typedef gl::GeometryRenderer::ApplyStates ApplyStatesCmd;
+ typedef gl::GeometryRenderer::UploadData UploadDataCmd;
+
+ list<shared_ptr<Command> > m_commands;
+
+ list<shared_ptr<DiscardStorageCmd> > m_discardStorageCmd;
+ list<shared_ptr<FreeTextureCmd> > m_freeTextureCmd;
+ list<shared_ptr<FreeStorageCmd> > m_freeStorageCmd;
+
+ DisplayListRenderer * m_parent;
+ bool m_isDebugging;
+
+ DisplayList(DisplayListRenderer * parent);
+
+ friend class DisplayListRenderer;
+
+ public:
+
+ ~DisplayList();
+
+ void applyStates(shared_ptr<ApplyStatesCmd> const & cmd);
+ void applyBlitStates(shared_ptr<ApplyBlitStatesCmd> const & cmd);
+ void drawGeometry(shared_ptr<DrawGeometryCmd> const & cmd);
+ void unlockStorage(shared_ptr<UnlockStorageCmd> const & cmd);
+ void discardStorage(shared_ptr<DiscardStorageCmd> const & cmd);
+ void freeTexture(shared_ptr<FreeTextureCmd> const & cmd);
+ void freeStorage(shared_ptr<FreeStorageCmd> const & cmd);
+ void uploadStyles(shared_ptr<UploadDataCmd> const & cmd);
+ void addCheckPoint();
+
+ void draw(DisplayListRenderer * r,
+ math::Matrix<double, 3, 3> const & m);
+ };
}
diff --git a/graphics/display_list_renderer.cpp b/graphics/display_list_renderer.cpp
new file mode 100644
index 0000000000..3c00bc84bc
--- /dev/null
+++ b/graphics/display_list_renderer.cpp
@@ -0,0 +1,160 @@
+#include "display_list_renderer.hpp"
+#include "display_list.hpp"
+
+namespace graphics
+{
+ DisplayListRenderer::DisplayListRenderer(Params const & p)
+ : base_t(p),
+ m_displayList(0)
+ {
+ }
+
+ DisplayList * DisplayListRenderer::createDisplayList()
+ {
+ return new DisplayList(this);
+ }
+
+ void DisplayListRenderer::setDisplayList(DisplayList * dl)
+ {
+ m_displayList = dl;
+ }
+
+ DisplayList * DisplayListRenderer::displayList() const
+ {
+ return m_displayList;
+ }
+
+ void DisplayListRenderer::drawDisplayList(DisplayList * dl,
+ math::Matrix<double, 3, 3> const & m)
+ {
+ dl->draw(this, m);
+ }
+
+ void DisplayListRenderer::drawGeometry(shared_ptr<gl::BaseTexture> const & texture,
+ gl::Storage const & storage,
+ size_t indicesCount,
+ size_t indicesOffs,
+ EPrimitives primType)
+ {
+ if (isCancelled())
+ return;
+
+ if (m_displayList)
+ {
+ shared_ptr<DrawGeometry> command(new DrawGeometry());
+
+ command->m_texture = texture;
+ command->m_storage = storage;
+ command->m_indicesCount = indicesCount;
+ command->m_indicesOffs = indicesOffs;
+ command->m_primitiveType = primType;
+
+ m_displayList->drawGeometry(command);
+ }
+ else
+ base_t::drawGeometry(texture,
+ storage,
+ indicesCount,
+ indicesOffs,
+ primType);
+
+ }
+
+ void DisplayListRenderer::uploadStyles(shared_ptr<ResourceStyle> const * styles,
+ size_t count,
+ shared_ptr<gl::BaseTexture> const & texture)
+ {
+ if (isCancelled())
+ return;
+
+ if (m_displayList)
+ m_displayList->uploadStyles(make_shared_ptr(new UploadData(styles, count, texture)));
+ else
+ base_t::uploadStyles(styles, count, texture);
+ }
+
+ void DisplayListRenderer::freeTexture(shared_ptr<gl::BaseTexture> const & texture,
+ TTexturePool * texturePool)
+ {
+ if (m_displayList)
+ {
+ shared_ptr<FreeTexture> command(new FreeTexture());
+
+ command->m_texture = texture;
+ command->m_texturePool = texturePool;
+
+ m_displayList->freeTexture(command);
+ }
+ else
+ base_t::freeTexture(texture, texturePool);
+ }
+
+ void DisplayListRenderer::freeStorage(gl::Storage const & storage,
+ TStoragePool * storagePool)
+ {
+ if (m_displayList)
+ {
+ shared_ptr<FreeStorage> command(new FreeStorage());
+
+ command->m_storage = storage;
+ command->m_storagePool = storagePool;
+
+ m_displayList->freeStorage(command);
+ }
+ else
+ base_t::freeStorage(storage, storagePool);
+ }
+
+ void DisplayListRenderer::unlockStorage(gl::Storage const & storage)
+ {
+ if (m_displayList)
+ {
+ shared_ptr<UnlockStorage> cmd(new UnlockStorage());
+
+ cmd->m_storage = storage;
+
+ m_displayList->unlockStorage(cmd);
+ }
+ else
+ base_t::unlockStorage(storage);
+ }
+
+ void DisplayListRenderer::discardStorage(gl::Storage const & storage)
+ {
+ if (m_displayList)
+ {
+ shared_ptr<DiscardStorage> cmd(new DiscardStorage());
+
+ cmd->m_storage = storage;
+
+ m_displayList->discardStorage(cmd);
+ }
+ else
+ base_t::discardStorage(storage);
+ }
+
+ void DisplayListRenderer::applyBlitStates()
+ {
+ if (m_displayList)
+ m_displayList->applyBlitStates(make_shared_ptr(new ApplyBlitStates()));
+ else
+ base_t::applyBlitStates();
+ }
+
+ void DisplayListRenderer::applyStates()
+ {
+ if (m_displayList)
+ m_displayList->applyStates(make_shared_ptr(new ApplyStates()));
+ else
+ base_t::applyStates();
+ }
+
+ void DisplayListRenderer::addCheckPoint()
+ {
+ if (m_displayList)
+ m_displayList->addCheckPoint();
+ else
+ base_t::addCheckPoint();
+ }
+
+}
diff --git a/graphics/display_list_renderer.hpp b/graphics/display_list_renderer.hpp
new file mode 100644
index 0000000000..f065442616
--- /dev/null
+++ b/graphics/display_list_renderer.hpp
@@ -0,0 +1,65 @@
+#pragma once
+
+#include "opengl/storage.hpp"
+#include "opengl/base_texture.hpp"
+#include "opengl/geometry_renderer.hpp"
+
+namespace graphics
+{
+ class DisplayList;
+
+ class DisplayListRenderer : public gl::GeometryRenderer
+ {
+ private:
+
+ DisplayList * m_displayList;
+
+ public:
+
+ typedef gl::GeometryRenderer base_t;
+ typedef base_t::Params Params;
+
+ DisplayListRenderer(Params const & p);
+
+ /// create display list
+ DisplayList * createDisplayList();
+ /// set current display list
+ void setDisplayList(DisplayList * displayList);
+ /// get current display list
+ DisplayList * displayList() const;
+ /// draw display list
+ void drawDisplayList(DisplayList * dl, math::Matrix<double, 3, 3> const & m);
+
+ /// Interceptable commands
+ /// @{
+
+ /// draw geometry
+ void drawGeometry(shared_ptr<gl::BaseTexture> const & texture,
+ gl::Storage const & storage,
+ size_t indicesCount,
+ size_t indicesOffs,
+ EPrimitives primType);
+ /// upload ResourceStyle's on texture
+ void uploadStyles(shared_ptr<ResourceStyle> const * styles,
+ size_t count,
+ shared_ptr<gl::BaseTexture> const & texture);
+ /// free texture
+ void freeTexture(shared_ptr<gl::BaseTexture> const & texture,
+ TTexturePool * texturePool);
+ /// free storage
+ void freeStorage(gl::Storage const & storage,
+ TStoragePool * storagePool);
+ /// unlock storage
+ void unlockStorage(gl::Storage const & storage);
+ /// discard storage
+ void discardStorage(gl::Storage const & storage);
+ /// add checkpoint
+ void addCheckPoint();
+ /// apply blit states
+ void applyBlitStates();
+ /// apply geometry rendering states
+ void applyStates();
+
+ /// @}
+ };
+}
diff --git a/graphics/geometry_batcher.cpp b/graphics/geometry_batcher.cpp
index fed5b06fdb..0fbaae07be 100644
--- a/graphics/geometry_batcher.cpp
+++ b/graphics/geometry_batcher.cpp
@@ -1,12 +1,13 @@
#include "geometry_batcher.hpp"
#include "skin.hpp"
#include "color.hpp"
-#include "utils.hpp"
#include "resource_manager.hpp"
#include "skin_page.hpp"
-#include "base_texture.hpp"
+#include "resource_style.hpp"
-#include "internal/opengl.hpp"
+#include "opengl/base_texture.hpp"
+#include "opengl/utils.hpp"
+#include "opengl/opengl.hpp"
#include "../geometry/rect2d.hpp"
@@ -20,792 +21,824 @@
namespace graphics
{
- namespace gl
+ GeometryBatcher::Params::Params()
+ : m_useGuiResources(false)
+ {}
+
+ GeometryBatcher::GeometryBatcher(Params const & params)
+ : base_t(params),
+ m_isAntiAliased(true),
+ m_useGuiResources(params.m_useGuiResources)
{
- GeometryBatcher::Params::Params()
- : m_useGuiResources(false)
- {}
+ reset(-1);
+ base_t::applyStates();
- GeometryBatcher::GeometryBatcher(Params const & params)
- : base_t(params),
- m_isAntiAliased(true),
- m_useGuiResources(params.m_useGuiResources)
+ /// 1 to turn antialiasing on
+ /// 2 to switch it off
+ m_aaShift = m_isAntiAliased ? 1 : 2;
+ }
+
+ GeometryBatcher::~GeometryBatcher()
+ {
+ for (size_t i = 0; i < m_pipelines.size(); ++i)
+ {
+ discardPipeline(i);
+ freePipeline(i);
+ if (m_skin->page(i)->type() != SkinPage::EStatic)
+ freeTexture(i);
+ }
+ }
+
+ void GeometryBatcher::reset(int pipelineID)
+ {
+ for (size_t i = 0; i < m_pipelines.size(); ++i)
+ {
+ if ((pipelineID == -1) || ((size_t)pipelineID == i))
+ {
+ m_pipelines[i].m_currentVertex = 0;
+ m_pipelines[i].m_currentIndex = 0;
+ }
+ }
+ }
+
+ void GeometryBatcher::GeometryPipeline::checkStorage(shared_ptr<ResourceManager> const & resourceManager) const
+ {
+ if (!m_hasStorage)
+ {
+ if (m_useGuiResources)
+ m_storage = resourceManager->guiThreadStorages()->Reserve();
+ else
+ {
+ switch (m_type)
+ {
+ case SkinPage::EPrimary:
+ m_storage = resourceManager->primaryStorages()->Reserve();
+ break;
+ case SkinPage::EFonts:
+ m_storage = resourceManager->smallStorages()->Reserve();
+ break;
+ case SkinPage::EStatic:
+ m_storage = resourceManager->smallStorages()->Reserve();
+ break;
+ default:
+ LOG(LERROR, ("invalid storage type in checkStorage"));
+ }
+ }
+
+ if (m_storage.m_vertices && m_storage.m_indices)
+ {
+ m_maxVertices = m_storage.m_vertices->size() / sizeof(gl::Vertex);
+ m_maxIndices = m_storage.m_indices->size() / sizeof(unsigned short);
+
+ if (!m_storage.m_vertices->isLocked())
+ m_storage.m_vertices->lock();
+ if (!m_storage.m_indices->isLocked())
+ m_storage.m_indices->lock();
+
+ m_vertices = (gl::Vertex*)m_storage.m_vertices->data();
+ m_indices = (unsigned short *)m_storage.m_indices->data();
+
+ m_hasStorage = true;
+ }
+ else
+ {
+ m_maxVertices = 0;
+ m_maxIndices = 0;
+
+ m_vertices = 0;
+ m_indices = 0;
+
+ m_hasStorage = false;
+ }
+ }
+ }
+
+ void GeometryBatcher::freePipeline(int pipelineID)
+ {
+ GeometryPipeline & pipeline = m_pipelines[pipelineID];
+
+ if (pipeline.m_hasStorage)
{
- reset(-1);
- base_t::applyStates();
+ TStoragePool * storagePool = 0;
+ if (pipeline.m_useGuiResources)
+ storagePool = resourceManager()->guiThreadStorages();
+ else
+ switch (pipeline.m_type)
+ {
+ case SkinPage::EPrimary:
+ storagePool = resourceManager()->primaryStorages();
+ break;
+ case SkinPage::EFonts:
+ storagePool = resourceManager()->smallStorages();
+ break;
+ case SkinPage::EStatic:
+ storagePool = resourceManager()->smallStorages();
+ break;
+ default:
+ LOG(LERROR, ("invalid pipeline type in freePipeline"));
+ break;
+ }
+
+ base_t::freeStorage(pipeline.m_storage, storagePool);
+
+ pipeline.m_hasStorage = false;
+ pipeline.m_storage = gl::Storage();
+ }
+ }
+
+ void GeometryBatcher::setSkin(shared_ptr<Skin> skin)
+ {
+ m_skin = skin;
+ if (m_skin != 0)
+ {
+ /// settings proper skin page type according to useGuiResources flag
+ if (m_useGuiResources)
+ for (size_t i = 0; i < m_skin->pagesCount(); ++i)
+ if (m_skin->page(i)->type() != SkinPage::EStatic)
+ m_skin->page(i)->setType(SkinPage::ELightWeight);
+
+ m_pipelines.resize(m_skin->pagesCount());
- /// 1 to turn antialiasing on
- /// 2 to switch it off
- m_aaShift = m_isAntiAliased ? 1 : 2;
+ m_skin->addClearPageFn(bind(&GeometryBatcher::flush, this, _1), 100);
+ m_skin->addClearPageFn(bind(&GeometryBatcher::freeTexture, this, _1), 99);
+
+ for (size_t i = 0; i < m_pipelines.size(); ++i)
+ {
+ m_pipelines[i].m_useGuiResources = m_useGuiResources;
+ m_pipelines[i].m_currentVertex = 0;
+ m_pipelines[i].m_currentIndex = 0;
+
+ m_pipelines[i].m_hasStorage = false;
+ m_pipelines[i].m_type = skin->page(i)->type();
+
+ m_pipelines[i].m_maxVertices = 0;
+ m_pipelines[i].m_maxIndices = 0;
+
+ m_pipelines[i].m_vertices = 0;
+ m_pipelines[i].m_indices = 0;
+ }
}
+ }
+
+ shared_ptr<Skin> const & GeometryBatcher::skin() const
+ {
+ return m_skin;
+ }
+
+ void GeometryBatcher::beginFrame()
+ {
+ base_t::beginFrame();
+ reset(-1);
+ for (size_t i = 0; i < m_pipelines.size(); ++i)
+ {
+ m_pipelines[i].m_verticesDrawn = 0;
+ m_pipelines[i].m_indicesDrawn = 0;
+ }
+ }
+
+ void GeometryBatcher::clear(graphics::Color const & c, bool clearRT, float depth, bool clearDepth)
+ {
+ flush(-1);
+ base_t::clear(c, clearRT, depth, clearDepth);
+ }
+
+ void GeometryBatcher::setRenderTarget(shared_ptr<RenderTarget> const & rt)
+ {
+ flush(-1);
+ base_t::setRenderTarget(rt);
+ }
+
+ void GeometryBatcher::endFrame()
+ {
+ flush(-1);
+ /// Syncronization point.
+ enableClipRect(false);
+
+ if (isDebugging())
+ {
+ for (size_t i = 0; i < m_pipelines.size(); ++i)
+ if ((m_pipelines[i].m_verticesDrawn != 0) || (m_pipelines[i].m_indicesDrawn != 0))
+ {
+ LOG(LINFO, ("pipeline #", i, " vertices=", m_pipelines[i].m_verticesDrawn, ", triangles=", m_pipelines[i].m_indicesDrawn / 3));
+ }
+ }
+
+ /// is the rendering was cancelled, there possibly could
+ /// be "ghost" render styles which are present in internal
+ /// skin structures, but aren't rendered onto skin texture.
+ /// so we are clearing the whole skin, to ensure that they
+ /// are gone(slightly heavy, but very simple solution).
+ if (isCancelled())
+ m_skin->clearHandles();
+
+ base_t::endFrame();
+ }
+
+ bool GeometryBatcher::hasRoom(size_t verticesCount, size_t indicesCount, int pipelineID) const
+ {
+ GeometryPipeline const & pipeline = m_pipelines[pipelineID];
+
+ pipeline.checkStorage(resourceManager());
+ if (!pipeline.m_hasStorage)
+ return false;
+
+ return ((pipeline.m_currentVertex + verticesCount <= pipeline.m_maxVertices)
+ && (pipeline.m_currentIndex + indicesCount <= pipeline.m_maxIndices));
+ }
+
+ int GeometryBatcher::verticesLeft(int pipelineID) const
+ {
+ GeometryPipeline const & pipeline = m_pipelines[pipelineID];
+
+ pipeline.checkStorage(resourceManager());
+ if (!pipeline.m_hasStorage)
+ return -1;
+
+ return pipeline.m_maxVertices - pipeline.m_currentVertex;
+ }
+
+ int GeometryBatcher::indicesLeft(int pipelineID) const
+ {
+ GeometryPipeline const & pipeline = m_pipelines[pipelineID];
+
+ pipeline.checkStorage(resourceManager());
+ if (!pipeline.m_hasStorage)
+ return -1;
+
+ return pipeline.m_maxIndices - pipeline.m_currentIndex;
+ }
+
+ void GeometryBatcher::flush(int pipelineID)
+ {
+ if (m_skin)
+ {
+ for (size_t i = m_pipelines.size(); i > 0; --i)
+ {
+ size_t id = i - 1;
+
+ if ((pipelineID == -1) || (id == (size_t)pipelineID))
+ {
+ if (flushPipeline(m_skin->page(id), id))
+ {
+ int nextPage = m_skin->nextPage(id);
+
+ if (nextPage != id)
+ {
+ // reserving texture in advance, before we'll
+ // potentially return current texture into the pool.
+ m_skin->page(nextPage)->checkTexture();
+ }
+
+ m_skin->changePage(id);
+ }
+
+ /// resetting geometry storage associated
+ /// with the specified pipeline.
+ reset(id);
+ }
+ }
+ }
+ }
+
+ void GeometryBatcher::freeTexture(int pipelineID)
+ {
+ if (!m_skin->page(pipelineID)->hasTexture())
+ return;
+
+ shared_ptr<gl::BaseTexture> texture = m_skin->page(pipelineID)->texture();
+ TTexturePool * texturePool = 0;
+
+ switch (m_skin->page(pipelineID)->type())
+ {
+ case SkinPage::EPrimary:
+ texturePool = resourceManager()->primaryTextures();
+ break;
+ case SkinPage::EFonts:
+ texturePool = resourceManager()->fontTextures();
+ break;
+ case SkinPage::ELightWeight:
+ texturePool = resourceManager()->guiThreadTextures();
+ break;
+ case SkinPage::EStatic:
+ LOG(LWARNING, ("texture with EStatic can't be freed."));
+ return;
+ }
+
+ base_t::freeTexture(texture, texturePool);
+
+ m_skin->page(pipelineID)->resetTexture();
+ }
+
+ void GeometryBatcher::unlockPipeline(int pipelineID)
+ {
+ GeometryPipeline & pipeline = m_pipelines[pipelineID];
+ base_t::unlockStorage(pipeline.m_storage);
+ }
+
+ void GeometryBatcher::discardPipeline(int pipelineID)
+ {
+ GeometryPipeline & pipeline = m_pipelines[pipelineID];
+
+ if (pipeline.m_hasStorage)
+ base_t::discardStorage(pipeline.m_storage);
+ }
+
+ bool GeometryBatcher::flushPipeline(shared_ptr<SkinPage> const & skinPage,
+ int pipelineID)
+ {
+ GeometryPipeline & pipeline = m_pipelines[pipelineID];
+ if (pipeline.m_currentIndex)
+ {
+ if (skinPage->hasData())
+ {
+ uploadStyles(&skinPage->uploadQueue()[0], skinPage->uploadQueue().size(), skinPage->texture());
+ skinPage->clearUploadQueue();
+ }
+
+ unlockPipeline(pipelineID);
+
+ drawGeometry(skinPage->texture(),
+ pipeline.m_storage,
+ pipeline.m_currentIndex,
+ 0,
+ ETriangles);
+
+ discardPipeline(pipelineID);
+
+
+ if (isDebugging())
+ {
+ pipeline.m_verticesDrawn += pipeline.m_currentVertex;
+ pipeline.m_indicesDrawn += pipeline.m_currentIndex;
+ // LOG(LINFO, ("Pipeline #", i - 1, "draws ", pipeline.m_currentIndex / 3, "/", pipeline.m_maxIndices / 3," triangles"));
+ }
+
+ freePipeline(pipelineID);
+
+ pipeline.m_maxIndices = 0;
+ pipeline.m_maxVertices = 0;
+ pipeline.m_vertices = 0;
+ pipeline.m_indices = 0;
+ pipeline.m_currentIndex = 0;
+ pipeline.m_currentVertex = 0;
+
+ return true;
+ }
+
+ return false;
+ }
+
+ void GeometryBatcher::drawTexturedPolygon(
+ m2::PointD const & ptShift,
+ ang::AngleD const & angle,
+ float tx0, float ty0, float tx1, float ty1,
+ float x0, float y0, float x1, float y1,
+ double depth,
+ int pipelineID)
+ {
+ if (!hasRoom(4, 6, pipelineID))
+ flush(pipelineID);
+
+ m_pipelines[pipelineID].checkStorage(resourceManager());
+ if (!m_pipelines[pipelineID].m_hasStorage)
+ return;
+
+ float texMinX = tx0;
+ float texMaxX = tx1;
+ float texMinY = ty0;
+ float texMaxY = ty1;
+
+ shared_ptr<gl::BaseTexture> const & texture = m_skin->page(pipelineID)->texture();
+
+ if (!texture)
+ {
+ LOG(LDEBUG, ("returning as no texture is reserved"));
+ return;
+ }
+
+ texture->mapPixel(texMinX, texMinY);
+ texture->mapPixel(texMaxX, texMaxY);
+
+ /// rotated and translated four points (x0, y0), (x0, y1), (x1, y1), (x1, y0)
+
+ m2::PointF coords[4] =
+ {
+ m2::PointF(x0 * angle.cos() - y0 * angle.sin() + ptShift.x, x0 * angle.sin() + y0 * angle.cos() + ptShift.y),
+ m2::PointF(x0 * angle.cos() - y1 * angle.sin() + ptShift.x, x0 * angle.sin() + y1 * angle.cos() + ptShift.y),
+ m2::PointF(x1 * angle.cos() - y1 * angle.sin() + ptShift.x, x1 * angle.sin() + y1 * angle.cos() + ptShift.y),
+ m2::PointF(x1 * angle.cos() - y0 * angle.sin() + ptShift.x, x1 * angle.sin() + y0 * angle.cos() + ptShift.y)
+ };
+
+ /// Special case. Making straight fonts sharp.
+ if (angle.val() == 0)
+ {
+ float deltaX = coords[0].x - ceil(coords[0].x);
+ float deltaY = coords[0].y - ceil(coords[0].y);
+
+ for (size_t i = 0; i < 4; ++i)
+ {
+ coords[i].x -= deltaX;
+ coords[i].y -= deltaY;
+ }
+ }
+
+ m2::PointF texCoords[4] =
+ {
+ m2::PointF(texMinX, texMinY),
+ m2::PointF(texMinX, texMaxY),
+ m2::PointF(texMaxX, texMaxY),
+ m2::PointF(texMaxX, texMinY)
+ };
+
+ m2::PointF normal(0, 0);
+
+ addTexturedFanStrided(coords, sizeof(m2::PointF),
+ &normal, 0,
+ texCoords, sizeof(m2::PointF),
+ 4,
+ depth,
+ pipelineID);
+ }
+
+ void GeometryBatcher::drawStraightTexturedPolygon(
+ m2::PointD const & ptPivot,
+ float tx0, float ty0, float tx1, float ty1,
+ float x0, float y0, float x1, float y1,
+ double depth,
+ int pipelineID)
+ {
+ if (!hasRoom(4, 6, pipelineID))
+ flush(pipelineID);
+
+ m_pipelines[pipelineID].checkStorage(resourceManager());
+ if (!m_pipelines[pipelineID].m_hasStorage)
+ return;
- GeometryBatcher::~GeometryBatcher()
- {
- for (size_t i = 0; i < m_pipelines.size(); ++i)
- {
- discardPipeline(i);
- freePipeline(i);
- if (m_skin->page(i)->type() != SkinPage::EStatic)
- freeTexture(i);
- }
- }
-
- void GeometryBatcher::reset(int pipelineID)
- {
- for (size_t i = 0; i < m_pipelines.size(); ++i)
- {
- if ((pipelineID == -1) || ((size_t)pipelineID == i))
- {
- m_pipelines[i].m_currentVertex = 0;
- m_pipelines[i].m_currentIndex = 0;
- }
- }
- }
-
- void GeometryBatcher::GeometryPipeline::checkStorage(shared_ptr<ResourceManager> const & resourceManager) const
- {
- if (!m_hasStorage)
- {
- if (m_useGuiResources)
- m_storage = resourceManager->guiThreadStorages()->Reserve();
- else
- {
- switch (m_type)
- {
- case SkinPage::EPrimary:
- m_storage = resourceManager->primaryStorages()->Reserve();
- break;
- case SkinPage::EFonts:
- m_storage = resourceManager->smallStorages()->Reserve();
- break;
- case SkinPage::EStatic:
- m_storage = resourceManager->smallStorages()->Reserve();
- break;
- default:
- LOG(LERROR, ("invalid storage type in checkStorage"));
- }
- }
-
- if (m_storage.m_vertices && m_storage.m_indices)
- {
- m_maxVertices = m_storage.m_vertices->size() / sizeof(Vertex);
- m_maxIndices = m_storage.m_indices->size() / sizeof(unsigned short);
-
- if (!m_storage.m_vertices->isLocked())
- m_storage.m_vertices->lock();
- if (!m_storage.m_indices->isLocked())
- m_storage.m_indices->lock();
-
- m_vertices = (Vertex*)m_storage.m_vertices->data();
- m_indices = (unsigned short *)m_storage.m_indices->data();
-
- m_hasStorage = true;
- }
- else
- {
- m_maxVertices = 0;
- m_maxIndices = 0;
-
- m_vertices = 0;
- m_indices = 0;
-
- m_hasStorage = false;
- }
- }
- }
-
- void GeometryBatcher::freePipeline(int pipelineID)
- {
- GeometryPipeline & pipeline = m_pipelines[pipelineID];
-
- if (pipeline.m_hasStorage)
- {
- TStoragePool * storagePool = 0;
- if (pipeline.m_useGuiResources)
- storagePool = resourceManager()->guiThreadStorages();
- else
- switch (pipeline.m_type)
- {
- case SkinPage::EPrimary:
- storagePool = resourceManager()->primaryStorages();
- break;
- case SkinPage::EFonts:
- storagePool = resourceManager()->smallStorages();
- break;
- case SkinPage::EStatic:
- storagePool = resourceManager()->smallStorages();
- break;
- default:
- LOG(LERROR, ("invalid pipeline type in freePipeline"));
- break;
- }
-
- base_t::freeStorage(pipeline.m_storage, storagePool);
-
- pipeline.m_hasStorage = false;
- pipeline.m_storage = Storage();
- }
- }
-
- void GeometryBatcher::setSkin(shared_ptr<Skin> skin)
- {
- m_skin = skin;
- if (m_skin != 0)
- {
- /// settings proper skin page type according to useGuiResources flag
- if (m_useGuiResources)
- for (size_t i = 0; i < m_skin->pagesCount(); ++i)
- if (m_skin->page(i)->type() != SkinPage::EStatic)
- m_skin->page(i)->setType(SkinPage::ELightWeight);
-
- m_pipelines.resize(m_skin->pagesCount());
-
- m_skin->addClearPageFn(bind(&GeometryBatcher::flush, this, _1), 100);
- m_skin->addClearPageFn(bind(&GeometryBatcher::freeTexture, this, _1), 99);
-
- for (size_t i = 0; i < m_pipelines.size(); ++i)
- {
- m_pipelines[i].m_useGuiResources = m_useGuiResources;
- m_pipelines[i].m_currentVertex = 0;
- m_pipelines[i].m_currentIndex = 0;
-
- m_pipelines[i].m_hasStorage = false;
- m_pipelines[i].m_type = skin->page(i)->type();
-
- m_pipelines[i].m_maxVertices = 0;
- m_pipelines[i].m_maxIndices = 0;
-
- m_pipelines[i].m_vertices = 0;
- m_pipelines[i].m_indices = 0;
- }
- }
- }
-
- shared_ptr<Skin> const & GeometryBatcher::skin() const
- {
- return m_skin;
- }
-
- void GeometryBatcher::beginFrame()
- {
- base_t::beginFrame();
- reset(-1);
- for (size_t i = 0; i < m_pipelines.size(); ++i)
- {
- m_pipelines[i].m_verticesDrawn = 0;
- m_pipelines[i].m_indicesDrawn = 0;
- }
- }
-
- void GeometryBatcher::clear(graphics::Color const & c, bool clearRT, float depth, bool clearDepth)
- {
- flush(-1);
- base_t::clear(c, clearRT, depth, clearDepth);
- }
-
- void GeometryBatcher::setRenderTarget(shared_ptr<RenderTarget> const & rt)
- {
- flush(-1);
- base_t::setRenderTarget(rt);
- }
-
- void GeometryBatcher::endFrame()
- {
- flush(-1);
- /// Syncronization point.
- enableClipRect(false);
-
- if (isDebugging())
- {
- for (size_t i = 0; i < m_pipelines.size(); ++i)
- if ((m_pipelines[i].m_verticesDrawn != 0) || (m_pipelines[i].m_indicesDrawn != 0))
- {
- LOG(LINFO, ("pipeline #", i, " vertices=", m_pipelines[i].m_verticesDrawn, ", triangles=", m_pipelines[i].m_indicesDrawn / 3));
- }
- }
-
- /// is the rendering was cancelled, there possibly could
- /// be "ghost" render styles which are present in internal
- /// skin structures, but aren't rendered onto skin texture.
- /// so we are clearing the whole skin, to ensure that they
- /// are gone(slightly heavy, but very simple solution).
- if (isCancelled())
- m_skin->clearHandles();
-
- base_t::endFrame();
- }
-
- bool GeometryBatcher::hasRoom(size_t verticesCount, size_t indicesCount, int pipelineID) const
- {
- GeometryPipeline const & pipeline = m_pipelines[pipelineID];
-
- pipeline.checkStorage(resourceManager());
- if (!pipeline.m_hasStorage)
- return false;
-
- return ((pipeline.m_currentVertex + verticesCount <= pipeline.m_maxVertices)
- && (pipeline.m_currentIndex + indicesCount <= pipeline.m_maxIndices));
- }
-
- int GeometryBatcher::verticesLeft(int pipelineID) const
- {
- GeometryPipeline const & pipeline = m_pipelines[pipelineID];
-
- pipeline.checkStorage(resourceManager());
- if (!pipeline.m_hasStorage)
- return -1;
-
- return pipeline.m_maxVertices - pipeline.m_currentVertex;
- }
-
- int GeometryBatcher::indicesLeft(int pipelineID) const
- {
- GeometryPipeline const & pipeline = m_pipelines[pipelineID];
-
- pipeline.checkStorage(resourceManager());
- if (!pipeline.m_hasStorage)
- return -1;
-
- return pipeline.m_maxIndices - pipeline.m_currentIndex;
- }
-
- void GeometryBatcher::flush(int pipelineID)
- {
- if (m_skin)
- {
- for (size_t i = m_pipelines.size(); i > 0; --i)
- {
- size_t id = i - 1;
-
- if ((pipelineID == -1) || (id == (size_t)pipelineID))
- {
- if (flushPipeline(m_skin->page(id), id))
- {
- int nextPage = m_skin->nextPage(id);
-
- if (nextPage != id)
- {
- // reserving texture in advance, before we'll
- // potentially return current texture into the pool.
- m_skin->page(nextPage)->checkTexture();
- }
-
- m_skin->changePage(id);
- }
-
- /// resetting geometry storage associated
- /// with the specified pipeline.
- reset(id);
- }
- }
- }
- }
-
- void GeometryBatcher::freeTexture(int pipelineID)
- {
- if (!m_skin->page(pipelineID)->hasTexture())
- return;
-
- shared_ptr<BaseTexture> texture = m_skin->page(pipelineID)->texture();
- TTexturePool * texturePool = 0;
-
- switch (m_skin->page(pipelineID)->type())
- {
- case SkinPage::EPrimary:
- texturePool = resourceManager()->primaryTextures();
- break;
- case SkinPage::EFonts:
- texturePool = resourceManager()->fontTextures();
- break;
- case SkinPage::ELightWeight:
- texturePool = resourceManager()->guiThreadTextures();
- break;
- case SkinPage::EStatic:
- LOG(LWARNING, ("texture with EStatic can't be freed."));
- return;
- }
-
- base_t::freeTexture(texture, texturePool);
-
- m_skin->page(pipelineID)->resetTexture();
- }
-
- void GeometryBatcher::unlockPipeline(int pipelineID)
- {
- GeometryPipeline & pipeline = m_pipelines[pipelineID];
- base_t::unlockStorage(pipeline.m_storage);
- }
-
- void GeometryBatcher::discardPipeline(int pipelineID)
- {
- GeometryPipeline & pipeline = m_pipelines[pipelineID];
-
- if (pipeline.m_hasStorage)
- base_t::discardStorage(pipeline.m_storage);
- }
-
- bool GeometryBatcher::flushPipeline(shared_ptr<SkinPage> const & skinPage,
+ float texMinX = tx0;
+ float texMaxX = tx1;
+ float texMinY = ty0;
+ float texMaxY = ty1;
+
+ shared_ptr<gl::BaseTexture> const & texture = m_skin->page(pipelineID)->texture();
+
+ if (!texture)
+ {
+ LOG(LDEBUG, ("returning as no texture is reserved"));
+ return;
+ }
+
+ texture->mapPixel(texMinX, texMinY);
+ texture->mapPixel(texMaxX, texMaxY);
+
+ /// rotated and translated four points (x0, y0), (x0, y1), (x1, y1), (x1, y0)
+
+ m2::PointF offsets[4] =
+ {
+ m2::PointF(x0, y0),
+ m2::PointF(x0, y1),
+ m2::PointF(x1, y1),
+ m2::PointF(x1, y0)
+ };
+
+ m2::PointF texCoords[4] =
+ {
+ m2::PointF(texMinX, texMinY),
+ m2::PointF(texMinX, texMaxY),
+ m2::PointF(texMaxX, texMaxY),
+ m2::PointF(texMaxX, texMinY)
+ };
+
+ m2::PointF pv(ptPivot.x, ptPivot.y);
+
+ addTexturedFanStrided(&pv, 0,
+ offsets, sizeof(m2::PointF),
+ texCoords, sizeof(m2::PointF),
+ 4,
+ depth,
+ pipelineID);
+ }
+
+
+ void GeometryBatcher::addTexturedFan(m2::PointF const * coords,
+ m2::PointF const * normals,
+ m2::PointF const * texCoords,
+ unsigned size,
+ double depth,
int pipelineID)
- {
- GeometryPipeline & pipeline = m_pipelines[pipelineID];
- if (pipeline.m_currentIndex)
- {
- if (skinPage->hasData())
- {
- uploadTexture(skinPage->uploadQueue(), skinPage->texture());
- skinPage->clearUploadQueue();
- }
-
- unlockPipeline(pipelineID);
-
- drawGeometry(skinPage->texture(),
- pipeline.m_storage,
- pipeline.m_currentIndex,
- 0,
- GL_TRIANGLES);
-
- discardPipeline(pipelineID);
-
-
- if (isDebugging())
- {
- pipeline.m_verticesDrawn += pipeline.m_currentVertex;
- pipeline.m_indicesDrawn += pipeline.m_currentIndex;
-// LOG(LINFO, ("Pipeline #", i - 1, "draws ", pipeline.m_currentIndex / 3, "/", pipeline.m_maxIndices / 3," triangles"));
- }
-
- freePipeline(pipelineID);
-
- pipeline.m_maxIndices = 0;
- pipeline.m_maxVertices = 0;
- pipeline.m_vertices = 0;
- pipeline.m_indices = 0;
- pipeline.m_currentIndex = 0;
- pipeline.m_currentVertex = 0;
-
- return true;
- }
-
- return false;
- }
-
- void GeometryBatcher::drawTexturedPolygon(
- m2::PointD const & ptShift,
- ang::AngleD const & angle,
- float tx0, float ty0, float tx1, float ty1,
- float x0, float y0, float x1, float y1,
- double depth,
- int pipelineID)
- {
- if (!hasRoom(4, 6, pipelineID))
- flush(pipelineID);
-
- m_pipelines[pipelineID].checkStorage(resourceManager());
- if (!m_pipelines[pipelineID].m_hasStorage)
- return;
-
- float texMinX = tx0;
- float texMaxX = tx1;
- float texMinY = ty0;
- float texMaxY = ty1;
-
- shared_ptr<BaseTexture> const & texture = m_skin->page(pipelineID)->texture();
-
- if (!texture)
- {
- LOG(LDEBUG, ("returning as no texture is reserved"));
- return;
- }
-
- texture->mapPixel(texMinX, texMinY);
- texture->mapPixel(texMaxX, texMaxY);
-
- /// rotated and translated four points (x0, y0), (x0, y1), (x1, y1), (x1, y0)
-
- m2::PointF coords[4] =
- {
- m2::PointF(x0 * angle.cos() - y0 * angle.sin() + ptShift.x, x0 * angle.sin() + y0 * angle.cos() + ptShift.y),
- m2::PointF(x0 * angle.cos() - y1 * angle.sin() + ptShift.x, x0 * angle.sin() + y1 * angle.cos() + ptShift.y),
- m2::PointF(x1 * angle.cos() - y1 * angle.sin() + ptShift.x, x1 * angle.sin() + y1 * angle.cos() + ptShift.y),
- m2::PointF(x1 * angle.cos() - y0 * angle.sin() + ptShift.x, x1 * angle.sin() + y0 * angle.cos() + ptShift.y)
- };
-
- /// Special case. Making straight fonts sharp.
- if (angle.val() == 0)
- {
- float deltaX = coords[0].x - ceil(coords[0].x);
- float deltaY = coords[0].y - ceil(coords[0].y);
-
- for (size_t i = 0; i < 4; ++i)
- {
- coords[i].x -= deltaX;
- coords[i].y -= deltaY;
- }
- }
-
- m2::PointF texCoords[4] =
- {
- m2::PointF(texMinX, texMinY),
- m2::PointF(texMinX, texMaxY),
- m2::PointF(texMaxX, texMaxY),
- m2::PointF(texMaxX, texMinY)
- };
-
- m2::PointF normal(0, 0);
-
- addTexturedFanStrided(coords, sizeof(m2::PointF),
- &normal, 0,
- texCoords, sizeof(m2::PointF),
- 4,
- depth,
- pipelineID);
- }
-
- void GeometryBatcher::drawStraightTexturedPolygon(
- m2::PointD const & ptPivot,
- float tx0, float ty0, float tx1, float ty1,
- float x0, float y0, float x1, float y1,
- double depth,
- int pipelineID)
- {
- if (!hasRoom(4, 6, pipelineID))
- flush(pipelineID);
-
- m_pipelines[pipelineID].checkStorage(resourceManager());
- if (!m_pipelines[pipelineID].m_hasStorage)
- return;
-
- float texMinX = tx0;
- float texMaxX = tx1;
- float texMinY = ty0;
- float texMaxY = ty1;
-
- shared_ptr<BaseTexture> const & texture = m_skin->page(pipelineID)->texture();
-
- if (!texture)
- {
- LOG(LDEBUG, ("returning as no texture is reserved"));
- return;
- }
-
- texture->mapPixel(texMinX, texMinY);
- texture->mapPixel(texMaxX, texMaxY);
-
- /// rotated and translated four points (x0, y0), (x0, y1), (x1, y1), (x1, y0)
-
- m2::PointF offsets[4] =
- {
- m2::PointF(x0, y0),
- m2::PointF(x0, y1),
- m2::PointF(x1, y1),
- m2::PointF(x1, y0)
- };
-
- m2::PointF texCoords[4] =
- {
- m2::PointF(texMinX, texMinY),
- m2::PointF(texMinX, texMaxY),
- m2::PointF(texMaxX, texMaxY),
- m2::PointF(texMaxX, texMinY)
- };
-
- m2::PointF pv(ptPivot.x, ptPivot.y);
-
- addTexturedFanStrided(&pv, 0,
- offsets, sizeof(m2::PointF),
- texCoords, sizeof(m2::PointF),
- 4,
- depth,
- pipelineID);
- }
+ {
+ addTexturedFanStrided(coords, sizeof(m2::PointF),
+ normals, sizeof(m2::PointF),
+ texCoords, sizeof(m2::PointF),
+ size,
+ depth,
+ pipelineID);
+ }
+
+ void GeometryBatcher::addTexturedFanStrided(m2::PointF const * coords,
+ size_t coordsStride,
+ m2::PointF const * normals,
+ size_t normalsStride,
+ m2::PointF const * texCoords,
+ size_t texCoordsStride,
+ unsigned size,
+ double depth,
+ int pipelineID)
+ {
+ if (!hasRoom(size, (size - 2) * 3, pipelineID))
+ flush(pipelineID);
+
+ GeometryPipeline & pipeline = m_pipelines[pipelineID];
+
+ pipeline.checkStorage(resourceManager());
+ if (!pipeline.m_hasStorage)
+ return;
+
+ ASSERT(size > 2, ());
+
+ size_t vOffset = pipeline.m_currentVertex;
+ size_t iOffset = pipeline.m_currentIndex;
+
+ for (unsigned i = 0; i < size; ++i)
+ {
+ pipeline.m_vertices[vOffset + i].pt = *coords;
+ pipeline.m_vertices[vOffset + i].normal = *normals;
+ pipeline.m_vertices[vOffset + i].tex = *texCoords;
+ pipeline.m_vertices[vOffset + i].depth = depth;
+ coords = reinterpret_cast<m2::PointF const*>(reinterpret_cast<unsigned char const*>(coords) + coordsStride);
+ normals = reinterpret_cast<m2::PointF const*>(reinterpret_cast<unsigned char const*>(normals) + normalsStride);
+ texCoords = reinterpret_cast<m2::PointF const*>(reinterpret_cast<unsigned char const*>(texCoords) + texCoordsStride);
+ }
+
+ pipeline.m_currentVertex += size;
+
+ for (size_t j = 0; j < size - 2; ++j)
+ {
+ pipeline.m_indices[iOffset + j * 3] = vOffset;
+ pipeline.m_indices[iOffset + j * 3 + 1] = vOffset + j + 1;
+ pipeline.m_indices[iOffset + j * 3 + 2] = vOffset + j + 2;
+ }
+
+ pipeline.m_currentIndex += (size - 2) * 3;
+ }
+
+ void GeometryBatcher::addTexturedStrip(
+ m2::PointF const * coords,
+ m2::PointF const * normals,
+ m2::PointF const * texCoords,
+ unsigned size,
+ double depth,
+ int pipelineID
+ )
+ {
+ addTexturedStripStrided(coords, sizeof(m2::PointF),
+ normals, sizeof(m2::PointF),
+ texCoords, sizeof(m2::PointF),
+ size,
+ depth,
+ pipelineID);
+ }
+
+ void GeometryBatcher::addTexturedStripStrided(
+ m2::PointF const * coords,
+ size_t coordsStride,
+ m2::PointF const * normals,
+ size_t normalsStride,
+ m2::PointF const * texCoords,
+ size_t texCoordsStride,
+ unsigned size,
+ double depth,
+ int pipelineID)
+ {
+ if (!hasRoom(size, (size - 2) * 3, pipelineID))
+ flush(pipelineID);
+
+ GeometryPipeline & pipeline = m_pipelines[pipelineID];
+
+ pipeline.checkStorage(resourceManager());
+ if (!pipeline.m_hasStorage)
+ return;
+
+ ASSERT(size > 2, ());
+
+ size_t vOffset = pipeline.m_currentVertex;
+ size_t iOffset = pipeline.m_currentIndex;
+
+ for (unsigned i = 0; i < size; ++i)
+ {
+ pipeline.m_vertices[vOffset + i].pt = *coords;
+ pipeline.m_vertices[vOffset + i].normal = *normals;
+ pipeline.m_vertices[vOffset + i].tex = *texCoords;
+ pipeline.m_vertices[vOffset + i].depth = depth;
+ coords = reinterpret_cast<m2::PointF const*>(reinterpret_cast<unsigned char const*>(coords) + coordsStride);
+ normals = reinterpret_cast<m2::PointF const*>(reinterpret_cast<unsigned char const*>(normals) + normalsStride);
+ texCoords = reinterpret_cast<m2::PointF const*>(reinterpret_cast<unsigned char const*>(texCoords) + texCoordsStride);
+ }
+
+ pipeline.m_currentVertex += size;
+
+ size_t oldIdx1 = vOffset;
+ size_t oldIdx2 = vOffset + 1;
+
+ for (size_t j = 0; j < size - 2; ++j)
+ {
+ pipeline.m_indices[iOffset + j * 3] = oldIdx1;
+ pipeline.m_indices[iOffset + j * 3 + 1] = oldIdx2;
+ pipeline.m_indices[iOffset + j * 3 + 2] = vOffset + j + 2;
+
+ oldIdx1 = oldIdx2;
+ oldIdx2 = vOffset + j + 2;
+ }
+
+ pipeline.m_currentIndex += (size - 2) * 3;
+ }
+
+ void GeometryBatcher::addTexturedListStrided(
+ m2::PointD const * coords,
+ size_t coordsStride,
+ m2::PointF const * normals,
+ size_t normalsStride,
+ m2::PointF const * texCoords,
+ size_t texCoordsStride,
+ unsigned size,
+ double depth,
+ int pipelineID)
+ {
+ if (!hasRoom(size, size, pipelineID))
+ flush(pipelineID);
+
+ GeometryPipeline & pipeline = m_pipelines[pipelineID];
+
+ pipeline.checkStorage(resourceManager());
+ if (!pipeline.m_hasStorage)
+ return;
+
+ ASSERT(size > 2, ());
+
+ size_t vOffset = pipeline.m_currentVertex;
+ size_t iOffset = pipeline.m_currentIndex;
+
+ for (size_t i = 0; i < size; ++i)
+ {
+ pipeline.m_vertices[vOffset + i].pt = m2::PointF(coords->x, coords->y);
+ pipeline.m_vertices[vOffset + i].normal = *normals;
+ pipeline.m_vertices[vOffset + i].tex = *texCoords;
+ pipeline.m_vertices[vOffset + i].depth = depth;
+ coords = reinterpret_cast<m2::PointD const*>(reinterpret_cast<unsigned char const*>(coords) + coordsStride);
+ normals = reinterpret_cast<m2::PointF const*>(reinterpret_cast<unsigned char const*>(normals) + normalsStride);
+ texCoords = reinterpret_cast<m2::PointF const*>(reinterpret_cast<unsigned char const*>(texCoords) + texCoordsStride);
+ }
+
+ pipeline.m_currentVertex += size;
+
+ for (size_t i = 0; i < size; ++i)
+ pipeline.m_indices[iOffset + i] = vOffset + i;
+ pipeline.m_currentIndex += size;
+ }
+
+
+ void GeometryBatcher::addTexturedListStrided(
+ m2::PointF const * coords,
+ size_t coordsStride,
+ m2::PointF const * normals,
+ size_t normalsStride,
+ m2::PointF const * texCoords,
+ size_t texCoordsStride,
+ unsigned size,
+ double depth,
+ int pipelineID)
+ {
+ if (!hasRoom(size, size, pipelineID))
+ flush(pipelineID);
- void GeometryBatcher::addTexturedFan(m2::PointF const * coords,
+ GeometryPipeline & pipeline = m_pipelines[pipelineID];
+
+ pipeline.checkStorage(resourceManager());
+ if (!pipeline.m_hasStorage)
+ return;
+
+ ASSERT(size > 2, ());
+
+ size_t vOffset = pipeline.m_currentVertex;
+ size_t iOffset = pipeline.m_currentIndex;
+
+ for (size_t i = 0; i < size; ++i)
+ {
+ pipeline.m_vertices[vOffset + i].pt = *coords;
+ pipeline.m_vertices[vOffset + i].normal = *normals;
+ pipeline.m_vertices[vOffset + i].tex = *texCoords;
+ pipeline.m_vertices[vOffset + i].depth = depth;
+ coords = reinterpret_cast<m2::PointF const*>(reinterpret_cast<unsigned char const*>(coords) + coordsStride);
+ normals = reinterpret_cast<m2::PointF const*>(reinterpret_cast<unsigned char const*>(normals) + normalsStride);
+ texCoords = reinterpret_cast<m2::PointF const*>(reinterpret_cast<unsigned char const*>(texCoords) + texCoordsStride);
+ }
+
+ pipeline.m_currentVertex += size;
+
+ for (size_t i = 0; i < size; ++i)
+ pipeline.m_indices[iOffset + i] = vOffset + i;
+
+ pipeline.m_currentIndex += size;
+ }
+
+ void GeometryBatcher::addTexturedList(m2::PointF const * coords,
m2::PointF const * normals,
m2::PointF const * texCoords,
unsigned size,
double depth,
int pipelineID)
- {
- addTexturedFanStrided(coords, sizeof(m2::PointF),
+ {
+ addTexturedListStrided(coords, sizeof(m2::PointF),
normals, sizeof(m2::PointF),
texCoords, sizeof(m2::PointF),
- size,
- depth,
- pipelineID);
- }
-
- void GeometryBatcher::addTexturedFanStrided(m2::PointF const * coords,
- size_t coordsStride,
- m2::PointF const * normals,
- size_t normalsStride,
- m2::PointF const * texCoords,
- size_t texCoordsStride,
- unsigned size,
- double depth,
- int pipelineID)
- {
- if (!hasRoom(size, (size - 2) * 3, pipelineID))
- flush(pipelineID);
-
- GeometryPipeline & pipeline = m_pipelines[pipelineID];
-
- pipeline.checkStorage(resourceManager());
- if (!pipeline.m_hasStorage)
- return;
-
- ASSERT(size > 2, ());
-
- size_t vOffset = pipeline.m_currentVertex;
- size_t iOffset = pipeline.m_currentIndex;
-
- for (unsigned i = 0; i < size; ++i)
- {
- pipeline.m_vertices[vOffset + i].pt = *coords;
- pipeline.m_vertices[vOffset + i].normal = *normals;
- pipeline.m_vertices[vOffset + i].tex = *texCoords;
- pipeline.m_vertices[vOffset + i].depth = depth;
- coords = reinterpret_cast<m2::PointF const*>(reinterpret_cast<unsigned char const*>(coords) + coordsStride);
- normals = reinterpret_cast<m2::PointF const*>(reinterpret_cast<unsigned char const*>(normals) + normalsStride);
- texCoords = reinterpret_cast<m2::PointF const*>(reinterpret_cast<unsigned char const*>(texCoords) + texCoordsStride);
- }
-
- pipeline.m_currentVertex += size;
-
- for (size_t j = 0; j < size - 2; ++j)
- {
- pipeline.m_indices[iOffset + j * 3] = vOffset;
- pipeline.m_indices[iOffset + j * 3 + 1] = vOffset + j + 1;
- pipeline.m_indices[iOffset + j * 3 + 2] = vOffset + j + 2;
- }
-
- pipeline.m_currentIndex += (size - 2) * 3;
- }
-
- void GeometryBatcher::addTexturedStrip(
- m2::PointF const * coords,
- m2::PointF const * normals,
- m2::PointF const * texCoords,
- unsigned size,
- double depth,
- int pipelineID
- )
- {
- addTexturedStripStrided(coords, sizeof(m2::PointF),
- normals, sizeof(m2::PointF),
- texCoords, sizeof(m2::PointF),
- size,
- depth,
- pipelineID);
- }
-
- void GeometryBatcher::addTexturedStripStrided(
- m2::PointF const * coords,
- size_t coordsStride,
- m2::PointF const * normals,
- size_t normalsStride,
- m2::PointF const * texCoords,
- size_t texCoordsStride,
- unsigned size,
- double depth,
- int pipelineID)
- {
- if (!hasRoom(size, (size - 2) * 3, pipelineID))
- flush(pipelineID);
-
- GeometryPipeline & pipeline = m_pipelines[pipelineID];
-
- pipeline.checkStorage(resourceManager());
- if (!pipeline.m_hasStorage)
- return;
-
- ASSERT(size > 2, ());
-
- size_t vOffset = pipeline.m_currentVertex;
- size_t iOffset = pipeline.m_currentIndex;
-
- for (unsigned i = 0; i < size; ++i)
- {
- pipeline.m_vertices[vOffset + i].pt = *coords;
- pipeline.m_vertices[vOffset + i].normal = *normals;
- pipeline.m_vertices[vOffset + i].tex = *texCoords;
- pipeline.m_vertices[vOffset + i].depth = depth;
- coords = reinterpret_cast<m2::PointF const*>(reinterpret_cast<unsigned char const*>(coords) + coordsStride);
- normals = reinterpret_cast<m2::PointF const*>(reinterpret_cast<unsigned char const*>(normals) + normalsStride);
- texCoords = reinterpret_cast<m2::PointF const*>(reinterpret_cast<unsigned char const*>(texCoords) + texCoordsStride);
- }
-
- pipeline.m_currentVertex += size;
-
- size_t oldIdx1 = vOffset;
- size_t oldIdx2 = vOffset + 1;
-
- for (size_t j = 0; j < size - 2; ++j)
- {
- pipeline.m_indices[iOffset + j * 3] = oldIdx1;
- pipeline.m_indices[iOffset + j * 3 + 1] = oldIdx2;
- pipeline.m_indices[iOffset + j * 3 + 2] = vOffset + j + 2;
-
- oldIdx1 = oldIdx2;
- oldIdx2 = vOffset + j + 2;
- }
-
- pipeline.m_currentIndex += (size - 2) * 3;
- }
-
- void GeometryBatcher::addTexturedListStrided(
- m2::PointD const * coords,
- size_t coordsStride,
- m2::PointF const * normals,
- size_t normalsStride,
- m2::PointF const * texCoords,
- size_t texCoordsStride,
- unsigned size,
- double depth,
- int pipelineID)
- {
- if (!hasRoom(size, size, pipelineID))
- flush(pipelineID);
-
- GeometryPipeline & pipeline = m_pipelines[pipelineID];
-
- pipeline.checkStorage(resourceManager());
- if (!pipeline.m_hasStorage)
- return;
-
- ASSERT(size > 2, ());
-
- size_t vOffset = pipeline.m_currentVertex;
- size_t iOffset = pipeline.m_currentIndex;
-
- for (size_t i = 0; i < size; ++i)
- {
- pipeline.m_vertices[vOffset + i].pt = m2::PointF(coords->x, coords->y);
- pipeline.m_vertices[vOffset + i].normal = *normals;
- pipeline.m_vertices[vOffset + i].tex = *texCoords;
- pipeline.m_vertices[vOffset + i].depth = depth;
- coords = reinterpret_cast<m2::PointD const*>(reinterpret_cast<unsigned char const*>(coords) + coordsStride);
- normals = reinterpret_cast<m2::PointF const*>(reinterpret_cast<unsigned char const*>(normals) + normalsStride);
- texCoords = reinterpret_cast<m2::PointF const*>(reinterpret_cast<unsigned char const*>(texCoords) + texCoordsStride);
- }
-
- pipeline.m_currentVertex += size;
-
- for (size_t i = 0; i < size; ++i)
- pipeline.m_indices[iOffset + i] = vOffset + i;
-
- pipeline.m_currentIndex += size;
- }
-
-
- void GeometryBatcher::addTexturedListStrided(
- m2::PointF const * coords,
- size_t coordsStride,
- m2::PointF const * normals,
- size_t normalsStride,
- m2::PointF const * texCoords,
- size_t texCoordsStride,
- unsigned size,
- double depth,
- int pipelineID)
- {
- if (!hasRoom(size, size, pipelineID))
- flush(pipelineID);
-
- GeometryPipeline & pipeline = m_pipelines[pipelineID];
-
- pipeline.checkStorage(resourceManager());
- if (!pipeline.m_hasStorage)
- return;
-
- ASSERT(size > 2, ());
-
- size_t vOffset = pipeline.m_currentVertex;
- size_t iOffset = pipeline.m_currentIndex;
-
- for (size_t i = 0; i < size; ++i)
- {
- pipeline.m_vertices[vOffset + i].pt = *coords;
- pipeline.m_vertices[vOffset + i].normal = *normals;
- pipeline.m_vertices[vOffset + i].tex = *texCoords;
- pipeline.m_vertices[vOffset + i].depth = depth;
- coords = reinterpret_cast<m2::PointF const*>(reinterpret_cast<unsigned char const*>(coords) + coordsStride);
- normals = reinterpret_cast<m2::PointF const*>(reinterpret_cast<unsigned char const*>(normals) + normalsStride);
- texCoords = reinterpret_cast<m2::PointF const*>(reinterpret_cast<unsigned char const*>(texCoords) + texCoordsStride);
- }
-
- pipeline.m_currentVertex += size;
-
- for (size_t i = 0; i < size; ++i)
- pipeline.m_indices[iOffset + i] = vOffset + i;
-
- pipeline.m_currentIndex += size;
- }
-
- void GeometryBatcher::addTexturedList(m2::PointF const * coords,
- m2::PointF const * normals,
- m2::PointF const * texCoords,
- unsigned size,
- double depth,
- int pipelineID)
- {
- addTexturedListStrided(coords, sizeof(m2::PointF),
- normals, sizeof(m2::PointF),
- texCoords, sizeof(m2::PointF),
- size, depth, pipelineID);
- }
-
- void GeometryBatcher::enableClipRect(bool flag)
- {
- flush(-1);
- base_t::enableClipRect(flag);
- }
-
- void GeometryBatcher::setClipRect(m2::RectI const & rect)
- {
- flush(-1);
- base_t::setClipRect(rect);
- }
-
- int GeometryBatcher::aaShift() const
- {
- return m_aaShift;
- }
-
- void GeometryBatcher::memoryWarning()
- {
- if (m_skin)
- m_skin->memoryWarning();
- }
-
- void GeometryBatcher::enterBackground()
- {
- if (m_skin)
- m_skin->enterBackground();
- }
-
- void GeometryBatcher::enterForeground()
- {
- if (m_skin)
- m_skin->enterForeground();
- }
-
- void GeometryBatcher::setDisplayList(DisplayList * dl)
- {
- flush(-1);
- base_t::setDisplayList(dl);
- }
-
- void GeometryBatcher::drawDisplayList(DisplayList * dl, math::Matrix<double, 3, 3> const & m)
- {
- flush(-1);
- base_t::drawDisplayList(dl, m);
- }
-
- void GeometryBatcher::setPixelPrecision(bool flag)
- {
- flush(-1);
- base_t::setPixelPrecision(flag);
- }
- } // namespace gl
+ size, depth, pipelineID);
+ }
+
+ void GeometryBatcher::enableClipRect(bool flag)
+ {
+ flush(-1);
+ base_t::enableClipRect(flag);
+ }
+
+ void GeometryBatcher::setClipRect(m2::RectI const & rect)
+ {
+ flush(-1);
+ base_t::setClipRect(rect);
+ }
+
+ int GeometryBatcher::aaShift() const
+ {
+ return m_aaShift;
+ }
+
+ void GeometryBatcher::memoryWarning()
+ {
+ if (m_skin)
+ m_skin->memoryWarning();
+ }
+
+ void GeometryBatcher::enterBackground()
+ {
+ if (m_skin)
+ m_skin->enterBackground();
+ }
+
+ void GeometryBatcher::enterForeground()
+ {
+ if (m_skin)
+ m_skin->enterForeground();
+ }
+
+ void GeometryBatcher::setDisplayList(DisplayList * dl)
+ {
+ flush(-1);
+ base_t::setDisplayList(dl);
+ }
+
+ void GeometryBatcher::drawDisplayList(DisplayList * dl, math::Matrix<double, 3, 3> const & m)
+ {
+ flush(-1);
+ base_t::drawDisplayList(dl, m);
+ }
+
+ void GeometryBatcher::setPixelPrecision(bool flag)
+ {
+ flush(-1);
+ base_t::setPixelPrecision(flag);
+ }
+
+ void GeometryBatcher::uploadStyles(shared_ptr<ResourceStyle> const * styles,
+ size_t count,
+ shared_ptr<gl::BaseTexture> const & texture)
+ {
+ /// splitting the whole queue of commands into the chunks no more
+ /// than 64KB of uploadable data each
+
+ size_t bytesUploaded = 0;
+ size_t bytesPerPixel = graphics::formatSize(resourceManager()->params().m_texFormat);
+ size_t prev = 0;
+
+ for (size_t i = 0; i < count; ++i)
+ {
+ shared_ptr<ResourceStyle> const & style = styles[i];
+
+ bytesUploaded += style->m_texRect.SizeX() * style->m_texRect.SizeY() * bytesPerPixel;
+
+ if (bytesUploaded > 64 * 1024)
+ {
+ base_t::uploadStyles(styles + prev, i + 1 - prev, texture);
+ if (i + 1 < count)
+ addCheckPoint();
+
+ prev = i + 1;
+ bytesUploaded = 0;
+ }
+ }
+
+ if (count != 0)
+ {
+ base_t::uploadStyles(styles, count, texture);
+ bytesUploaded = 0;
+ }
+ }
} // namespace graphics
diff --git a/graphics/geometry_batcher.hpp b/graphics/geometry_batcher.hpp
index 3dac1dea87..bc969340a5 100644
--- a/graphics/geometry_batcher.hpp
+++ b/graphics/geometry_batcher.hpp
@@ -1,11 +1,12 @@
#pragma once
-#include "vertex.hpp"
-#include "buffer_object.hpp"
-#include "renderbuffer.hpp"
-#include "framebuffer.hpp"
+#include "opengl/vertex.hpp"
+#include "opengl/buffer_object.hpp"
+#include "opengl/renderbuffer.hpp"
+#include "opengl/framebuffer.hpp"
+#include "opengl/storage.hpp"
+
#include "blitter.hpp"
-#include "storage.hpp"
#include "skin_page.hpp"
#include "resource_manager.hpp"
@@ -27,113 +28,128 @@ namespace graphics
{
class Skin;
- namespace gl
+ class GeometryBatcher : public Blitter
{
- class GeometryBatcher : public Blitter
- {
- public:
+ public:
- typedef function<void()> onFlushFinishedFn;
+ typedef function<void()> onFlushFinishedFn;
- private:
+ private:
- typedef Blitter base_t;
+ typedef Blitter base_t;
- shared_ptr<graphics::Skin> m_skin;
+ shared_ptr<Skin> m_skin;
- struct GeometryPipeline
- {
- size_t m_verticesDrawn;
- size_t m_indicesDrawn;
+ struct GeometryPipeline
+ {
+ size_t m_verticesDrawn;
+ size_t m_indicesDrawn;
- size_t m_currentVertex;
- size_t m_currentIndex;
+ size_t m_currentVertex;
+ size_t m_currentIndex;
- /// made mutable to implement lazy reservation of m_storage
- /// @{
- mutable size_t m_maxVertices;
- mutable size_t m_maxIndices;
+ /// made mutable to implement lazy reservation of m_storage
+ /// @{
+ mutable size_t m_maxVertices;
+ mutable size_t m_maxIndices;
- mutable bool m_hasStorage;
- mutable Storage m_storage;
+ mutable bool m_hasStorage;
+ mutable gl::Storage m_storage;
- mutable Vertex * m_vertices;
- mutable unsigned short * m_indices;
- /// @}
+ mutable gl::Vertex * m_vertices;
+ mutable unsigned short * m_indices;
+ /// @}
- bool m_useGuiResources;
- graphics::SkinPage::EType m_type;
+ bool m_useGuiResources;
+ SkinPage::EType m_type;
- int verticesLeft();
- int indicesLeft();
+ int verticesLeft();
+ int indicesLeft();
- void checkStorage(shared_ptr<ResourceManager> const & resourceManager) const;
- };
+ void checkStorage(shared_ptr<ResourceManager> const & resourceManager) const;
+ };
- vector<GeometryPipeline> m_pipelines;
+ vector<GeometryPipeline> m_pipelines;
- void reset(int pipelineID);
+ void reset(int pipelineID);
- void freePipeline(int pipelineID);
- void freeTexture(int pipelineID);
+ void freePipeline(int pipelineID);
+ void freeTexture(int pipelineID);
- bool m_isAntiAliased;
- bool m_isSynchronized;
- bool m_useGuiResources;
+ bool m_isAntiAliased;
+ bool m_isSynchronized;
+ bool m_useGuiResources;
- int m_aaShift;
+ int m_aaShift;
- public:
+ public:
- /// INTERNAL API! USE WITH CAUTION
- /// @{
- void flush(int pipelineID);
- /// @}
+ /// INTERNAL API! USE WITH CAUTION
+ /// @{
+ void flush(int pipelineID);
+ /// @}
- bool hasRoom(size_t verticesCount, size_t indicesCount, int pipelineID) const;
- int verticesLeft(int pipelineID) const;
- int indicesLeft(int pipelineID) const;
+ bool hasRoom(size_t verticesCount, size_t indicesCount, int pipelineID) const;
+ int verticesLeft(int pipelineID) const;
+ int indicesLeft(int pipelineID) const;
- struct Params : public base_t::Params
- {
- bool m_useGuiResources;
- Params();
- };
+ struct Params : public base_t::Params
+ {
+ bool m_useGuiResources;
+ Params();
+ };
- GeometryBatcher(Params const & params);
- ~GeometryBatcher();
+ GeometryBatcher(Params const & params);
+ ~GeometryBatcher();
- void setSkin(shared_ptr<Skin> skin);
- shared_ptr<Skin> const & skin() const;
+ void setSkin(shared_ptr<Skin> skin);
+ shared_ptr<Skin> const & skin() const;
- void beginFrame();
- void endFrame();
+ void beginFrame();
+ void endFrame();
- bool flushPipeline(shared_ptr<SkinPage> const & skinPage, int pipelineID);
- void unlockPipeline(int pipelineID);
- void discardPipeline(int pipelineID);
+ bool flushPipeline(shared_ptr<SkinPage> const & skinPage, int pipelineID);
+ void unlockPipeline(int pipelineID);
+ void discardPipeline(int pipelineID);
- public:
+ public:
- /// This functions hide the base_t functions with the same name and signature
- /// to flush(-1) upon calling them
- /// @{
- void enableClipRect(bool flag);
- void setClipRect(m2::RectI const & rect);
+ /// This functions hide the base_t functions with the same name and signature
+ /// to flush(-1) upon calling them
+ /// @{
+ void enableClipRect(bool flag);
+ void setClipRect(m2::RectI const & rect);
- void clear(graphics::Color const & c, bool clearRT = true, float depth = 1.0, bool clearDepth = true);
- /// @}
+ void clear(Color const & c, bool clearRT = true, float depth = 1.0, bool clearDepth = true);
+ /// @}
+
+ void setRenderTarget(shared_ptr<RenderTarget> const & rt);
- void setRenderTarget(shared_ptr<RenderTarget> const & rt);
+ void addTexturedFan(m2::PointF const * coords,
+ m2::PointF const * normals,
+ m2::PointF const * texCoords,
+ unsigned size,
+ double depth,
+ int pipelineID);
- void addTexturedFan(m2::PointF const * coords,
+ void addTexturedFanStrided(m2::PointF const * coords,
+ size_t coordsStride,
+ m2::PointF const * normals,
+ size_t normalsStride,
+ m2::PointF const * texCoords,
+ size_t texCoordsStride,
+ unsigned size,
+ double depth,
+ int pipelineID);
+
+ void addTexturedStrip(m2::PointF const * coords,
m2::PointF const * normals,
m2::PointF const * texCoords,
unsigned size,
double depth,
int pipelineID);
- void addTexturedFanStrided(m2::PointF const * coords,
+ void addTexturedStripStrided(m2::PointF const * coords,
size_t coordsStride,
m2::PointF const * normals,
size_t normalsStride,
@@ -143,77 +159,63 @@ namespace graphics
double depth,
int pipelineID);
- void addTexturedStrip(m2::PointF const * coords,
- m2::PointF const * normals,
- m2::PointF const * texCoords,
- unsigned size,
- double depth,
- int pipelineID);
-
- void addTexturedStripStrided(m2::PointF const * coords,
- size_t coordsStride,
- m2::PointF const * normals,
- size_t normalsStride,
- m2::PointF const * texCoords,
- size_t texCoordsStride,
- unsigned size,
- double depth,
- int pipelineID);
-
- void addTexturedList(m2::PointF const * coords,
- m2::PointF const * texCoords,
- m2::PointF const * normalCoords,
- unsigned size,
- double depth,
- int pipelineID);
-
- void addTexturedListStrided(m2::PointD const * coords,
- size_t coordsStride,
- m2::PointF const * normals,
- size_t normalsStride,
- m2::PointF const * texCoords,
- size_t texCoordsStride,
- unsigned size,
- double depth,
- int pipelineID);
-
- void addTexturedListStrided(m2::PointF const * coords,
- size_t coordsStride,
- m2::PointF const * normals,
- size_t normalsStride,
- m2::PointF const * texCoords,
- size_t texCoordsStride,
- unsigned size,
- double depth,
- int pipelineID);
-
- int aaShift() const;
-
- void drawStraightTexturedPolygon(
- m2::PointD const & ptPivot,
- float tx0, float ty0, float tx1, float ty1,
- float x0, float y0, float x1, float y1,
- double depth,
- int pipelineID);
-
- /// drawing textured polygon with antialiasing
- /// we assume that the (tx0, ty0, tx1, ty1) area on texture is surrounded by (0, 0, 0, 0) pixels,
- /// and the 1px interior area is also (0, 0, 0, 0).
- void drawTexturedPolygon(
- m2::PointD const & ptWhere,
- ang::AngleD const & angle,
- float tx0, float ty0, float tx1, float ty1,
- float x0, float y0, float x1, float y1,
- double depth,
- int pipelineID);
-
- void memoryWarning();
- void enterBackground();
- void enterForeground();
-
- void setDisplayList(DisplayList * dl);
- void drawDisplayList(DisplayList * dl, math::Matrix<double, 3, 3> const & m);
- void setPixelPrecision(bool flag);
- };
- }
+ void addTexturedList(m2::PointF const * coords,
+ m2::PointF const * texCoords,
+ m2::PointF const * normalCoords,
+ unsigned size,
+ double depth,
+ int pipelineID);
+
+ void addTexturedListStrided(m2::PointD const * coords,
+ size_t coordsStride,
+ m2::PointF const * normals,
+ size_t normalsStride,
+ m2::PointF const * texCoords,
+ size_t texCoordsStride,
+ unsigned size,
+ double depth,
+ int pipelineID);
+
+ void addTexturedListStrided(m2::PointF const * coords,
+ size_t coordsStride,
+ m2::PointF const * normals,
+ size_t normalsStride,
+ m2::PointF const * texCoords,
+ size_t texCoordsStride,
+ unsigned size,
+ double depth,
+ int pipelineID);
+
+ int aaShift() const;
+
+ void drawStraightTexturedPolygon(
+ m2::PointD const & ptPivot,
+ float tx0, float ty0, float tx1, float ty1,
+ float x0, float y0, float x1, float y1,
+ double depth,
+ int pipelineID);
+
+ /// drawing textured polygon with antialiasing
+ /// we assume that the (tx0, ty0, tx1, ty1) area on texture is surrounded by (0, 0, 0, 0) pixels,
+ /// and the 1px interior area is also (0, 0, 0, 0).
+ void drawTexturedPolygon(
+ m2::PointD const & ptWhere,
+ ang::AngleD const & angle,
+ float tx0, float ty0, float tx1, float ty1,
+ float x0, float y0, float x1, float y1,
+ double depth,
+ int pipelineID);
+
+ void memoryWarning();
+ void enterBackground();
+ void enterForeground();
+
+ void setDisplayList(DisplayList * dl);
+ void drawDisplayList(DisplayList * dl, math::Matrix<double, 3, 3> const & m);
+ void setPixelPrecision(bool flag);
+
+ void uploadStyles(shared_ptr<ResourceStyle> const * styles,
+ size_t count,
+ shared_ptr<gl::BaseTexture> const & texture);
+ };
}
diff --git a/graphics/glyph_cache.cpp b/graphics/glyph_cache.cpp
index 7ad84d8a8e..aa7df2aa4d 100644
--- a/graphics/glyph_cache.cpp
+++ b/graphics/glyph_cache.cpp
@@ -1,9 +1,10 @@
#include "glyph_cache.hpp"
#include "glyph_cache_impl.hpp"
-#include "data_traits.hpp"
-#include "internal/opengl.hpp"
#include "ft2_debug.hpp"
+#include "opengl/data_traits.hpp"
+#include "opengl/opengl.hpp"
+
#include "../3party/fribidi/lib/fribidi-deprecated.h"
#include "../3party/fribidi/lib/fribidi.h"
diff --git a/graphics/glyph_style.cpp b/graphics/glyph_style.cpp
index 3ef9d78baa..fa3d7b9001 100644
--- a/graphics/glyph_style.cpp
+++ b/graphics/glyph_style.cpp
@@ -1,8 +1,8 @@
#include "resource_style.hpp"
-
#include "glyph_cache.hpp"
#include "agg_traits.hpp"
-#include "data_traits.hpp"
+
+#include "opengl/data_traits.hpp"
namespace graphics
{
diff --git a/graphics/graphics.pro b/graphics/graphics.pro
index 21f32c20f4..9aa46d03a6 100644
--- a/graphics/graphics.pro
+++ b/graphics/graphics.pro
@@ -13,26 +13,27 @@ INCLUDEPATH += $$ROOT_DIR/3party/freetype/include $$ROOT_DIR/3party/agg
include($$ROOT_DIR/common.pri)
SOURCES += \
- internal/opengl.cpp \
- vertex.cpp \
+ opengl/framebuffer.cpp \
+ opengl/opengl.cpp \
+ opengl/buffer_object.cpp \
+ opengl/renderbuffer.cpp \
+ opengl/base_texture.cpp \
+ opengl/managed_texture.cpp \
+ opengl/renderer.cpp \
+ opengl/rendercontext.cpp \
+ opengl/vertex.cpp \
+ opengl/clipper.cpp \
+ opengl/geometry_renderer.cpp \
+ opengl/storage.cpp \
+ opengl/utils.cpp \
+ blitter.cpp \
resource_manager.cpp \
skin.cpp \
pen_info.cpp \
resource_style.cpp \
color.cpp \
skin_loader.cpp \
- framebuffer.cpp \
- buffer_object.cpp \
- utils.cpp \
- renderbuffer.cpp \
- base_texture.cpp \
- managed_texture.cpp \
- blitter.cpp \
- clipper.cpp \
- renderer.cpp \
- geometry_renderer.cpp \
skin_page.cpp \
- storage.cpp \
glyph_cache.cpp \
glyph_cache_impl.cpp \
ft2_debug.cpp \
@@ -53,7 +54,6 @@ SOURCES += \
composite_overlay_element.cpp \
path_text_element.cpp \
straight_text_element.cpp \
- rendercontext.cpp \
line_style.cpp \
circle_style.cpp \
glyph_style.cpp \
@@ -62,32 +62,34 @@ SOURCES += \
display_list.cpp \
data_formats.cpp \
image_info.cpp \
- image_renderer.cpp
+ image_renderer.cpp \
+ display_list_renderer.cpp
HEADERS += \
- internal/opengl.hpp \
- internal/gl_procedures.inl \
- vertex.hpp \
+ opengl/opengl.hpp \
+ opengl/gl_procedures.inl \
+ opengl/vertex.hpp \
+ opengl/texture.hpp \
+ opengl/framebuffer.hpp \
+ opengl/buffer_object.hpp \
+ opengl/renderbuffer.hpp \
+ opengl/base_texture.hpp \
+ opengl/managed_texture.hpp \
+ opengl/rendercontext.hpp \
+ opengl/clipper.hpp \
+ opengl/renderer.hpp \
+ opengl/geometry_renderer.hpp \
+ opengl/data_traits.hpp \
+ opengl/storage.hpp \
+ opengl/utils.hpp \
+ blitter.hpp \
resource_manager.hpp \
- texture.hpp \
skin.hpp \
skin_loader.hpp \
pen_info.hpp \
resource_style.hpp \
color.hpp \
- framebuffer.hpp \
- buffer_object.hpp \
- utils.hpp \
- renderbuffer.hpp \
- base_texture.hpp \
- managed_texture.hpp \
- rendercontext.hpp \
- blitter.hpp \
- clipper.hpp \
- renderer.hpp \
- geometry_renderer.hpp \
skin_page.hpp \
- storage.hpp \
render_target.hpp \
glyph_cache.hpp \
data_formats.hpp \
@@ -116,18 +118,18 @@ HEADERS += \
circle_element.hpp \
packets_queue.hpp \
display_list.hpp \
- data_traits.hpp \
image_renderer.hpp \
- image_info.hpp
+ image_info.hpp \
+ display_list_renderer.hpp
win32* {
- SOURCES += internal/opengl_win32.cpp
+ SOURCES += opengl/opengl_win32.cpp
} else: android*|iphone* {
- HEADERS += internal/opengl_glsl_impl.hpp
- SOURCES += internal/opengl_glsl_es2.cpp \
- internal/opengl_glsl_impl.cpp
+ HEADERS += opengl/opengl_glsl_impl.hpp
+ SOURCES += opengl/opengl_glsl_es2.cpp \
+ opengl/opengl_glsl_impl.cpp
} else {
- HEADERS += internal/opengl_glsl_impl.hpp
- SOURCES += internal/opengl_glsl_ext.cpp \
- internal/opengl_glsl_impl.cpp
+ HEADERS += opengl/opengl_glsl_impl.hpp
+ SOURCES += opengl/opengl_glsl_ext.cpp \
+ opengl/opengl_glsl_impl.cpp
}
diff --git a/graphics/graphics_tests/screengl_test.cpp b/graphics/graphics_tests/screengl_test.cpp
index 40a6e16de6..58943f73f7 100644
--- a/graphics/graphics_tests/screengl_test.cpp
+++ b/graphics/graphics_tests/screengl_test.cpp
@@ -4,8 +4,6 @@
#include "../../geometry/transformations.hpp"
#include "../../graphics/screen.hpp"
-#include "../../graphics/utils.hpp"
-#include "../../graphics/internal/opengl.hpp"
#include "../../graphics/skin.hpp"
#include "../../graphics/pen_info.hpp"
#include "../../graphics/circle_info.hpp"
@@ -13,6 +11,9 @@
#include "../../graphics/straight_text_element.hpp"
#include "../../graphics/path_text_element.hpp"
+#include "../../graphics/opengl/utils.hpp"
+#include "../../graphics/opengl/opengl.hpp"
+
#include "../../qt_tstfrm/macros.hpp"
#include "../../testing/testing.hpp"
@@ -26,7 +27,7 @@ namespace
{
struct TestDrawPoint
{
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
p->drawSymbol(m2::PointD(40, 40), 0, graphics::EPosCenter, 0);
p->drawSymbol(m2::PointD(40.5, 60), 0, graphics::EPosCenter, 0);
@@ -36,7 +37,7 @@ namespace
struct TestDrawSolidRect
{
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
p->immDrawSolidRect(m2::RectF(0, 0, 100, 100), graphics::Color(255, 0, 0, 255));
}
@@ -44,7 +45,7 @@ namespace
struct TestDrawLine
{
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
m2::PointD pts[3] =
{
@@ -100,7 +101,7 @@ namespace
return m_pathes[i];
}
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
for (size_t i = 0; i < m_pathes.size(); ++i)
{
@@ -375,7 +376,7 @@ namespace
AddTest(testPoints, testPattern, graphics::Color(255, 0, 0, 255), 40, 0.5);
}
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
p->enableClipRect(true);
p->setClipRect(m2::RectI(50, 70, 150, 150));
@@ -385,7 +386,7 @@ namespace
p->beginFrame();
p->setClipRect(r);
p->enableClipRect(true);
- p->clear(graphics::gl::Screen::s_bgColor);
+ p->clear(graphics::Screen::s_bgColor);
}
};
@@ -558,7 +559,7 @@ namespace
struct TestDrawPoly
{
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
// m2::PointD ptsStrip[5] = {m2::PointD(10, 10), m2::PointD(40, 10), m2::PointD(70, 10), m2::PointD(90, 60), m2::PointD(130, 30)};
// p->drawTriangles(ptsStrip, 5, graphics::TriangleStrip, p->skin()->mapColor(graphics::Color(255, 0, 0, 255)));
@@ -574,7 +575,7 @@ namespace
/// Trying to draw polygon with more vertices that fits into internal buffer.
struct TestDrawPolyOverflow
{
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
size_t verticesCount = 30000;
vector<m2::PointD> vertices;
@@ -609,7 +610,7 @@ namespace
struct TestDrawText
{
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
m2::PointD path[2] = {m2::PointD(100, 200), m2::PointD(1000, 200)};
double pat[2] = {2, 2};
@@ -628,7 +629,7 @@ namespace
struct TestDrawSingleSymbol
{
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
graphics::FontDesc fontDesc(20, graphics::Color(0, 0, 0, 0), true, graphics::Color(255, 255, 255, 255));
p->drawText(fontDesc, m2::PointD(40, 50), graphics::EPosAboveRight, "X", 1, true);
@@ -637,7 +638,7 @@ namespace
struct TestDrawEmptySymbol
{
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
graphics::FontDesc fontDesc(20, graphics::Color(0, 0, 0, 0), true, graphics::Color(255, 255, 255, 255));
p->drawText(fontDesc, m2::PointD(40, 50), graphics::EPosAboveRight, " ", 1, true);
@@ -646,7 +647,7 @@ namespace
struct TestDrawStringOnString
{
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
size_t const maxTimes = 10;
size_t const yStep = 30;
@@ -661,7 +662,7 @@ namespace
struct TestDrawSingleSymbolAndSolidPath
{
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
vector<m2::PointD> path;
path.push_back(m2::PointD(40, 50));
@@ -681,7 +682,7 @@ namespace
struct TestDrawMultiLineStringWithPosition
{
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
graphics::FontDesc fontDesc(14, graphics::Color(0, 0, 0, 0), true, graphics::Color(255, 255, 255, 255));
@@ -734,7 +735,7 @@ namespace
struct TestDrawString
{
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
graphics::FontDesc fontDesc(20, graphics::Color(0, 0, 0, 0), true, graphics::Color(255, 255, 255, 255));
p->drawText(fontDesc, m2::PointD(40, 150), graphics::EPosAboveRight, "Simplicity is the ultimate sophistication", 0, true);
@@ -743,7 +744,7 @@ namespace
struct TestDrawStringWithColor
{
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
graphics::FontDesc fontDesc(25, graphics::Color(0, 0, 255, 255), true, graphics::Color(255, 255, 255, 255));
p->drawText(fontDesc, m2::PointD(40, 50), graphics::EPosAboveRight, "Simplicity is the ultimate sophistication", 0, true);
@@ -753,7 +754,7 @@ namespace
struct TestDrawUnicodeSymbols
{
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
graphics::FontDesc fontDesc(12);
p->drawText(fontDesc, m2::PointD(40, 50), graphics::EPosAboveRight, "Latin Symbol : A", 0, true);
@@ -764,7 +765,7 @@ namespace
struct TestDrawTextRect : TestDrawString
{
typedef TestDrawString base_t;
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
m2::PointD startPt(40, 50);
@@ -812,7 +813,7 @@ namespace
m_penInfo = graphics::PenInfo(graphics::Color(0xFF, 0xFF, 0xFF, 0xFF), 2, &pat[0], ARRAY_SIZE(pat), 0);
}
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
p->drawPath(&m_path[0], m_path.size(), 0, p->skin()->mapPenInfo(m_penInfo), 1);
graphics::FontDesc fontDesc(30);
@@ -859,7 +860,7 @@ namespace
}
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
p->drawPath(&m_testPoints[0], m_testPoints.size(), 0, p->skin()->mapPenInfo(graphics::PenInfo(graphics::Color(255, 255, 255, 255), 2, 0, 0, 0)), 0);
graphics::FontDesc fontDesc(20, graphics::Color(0, 0, 0, 255), false);
@@ -888,7 +889,7 @@ namespace
m_penInfo = graphics::PenInfo(graphics::Color(0, 0, 0, 0xFF), 2, &pat[0], ARRAY_SIZE(pat), 0);
}
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
p->drawPath(&m_path[0], m_path.size(), 0, p->skin()->mapPenInfo(m_penInfo), 0);
graphics::FontDesc fontDesc(20);
@@ -908,7 +909,7 @@ namespace
m_penInfo = graphics::PenInfo(graphics::Color(0, 0, 0, 0xFF), 2, &pat[0], ARRAY_SIZE(pat), 0);
}
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
graphics::StraightTextElement::Params params;
params.m_fontDesc = graphics::FontDesc(20);
@@ -947,7 +948,7 @@ namespace
m_penInfo = graphics::PenInfo(graphics::Color(0, 0, 0, 0xFF), 2, &pat[0], ARRAY_SIZE(pat), 0);
}
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
graphics::PathTextElement::Params params;
params.m_pts = &m_path[0];
@@ -992,7 +993,7 @@ namespace
m_penInfo = graphics::PenInfo(graphics::Color(0, 0, 0, 0xFF), 2, &pat[0], ARRAY_SIZE(pat), 0);
}
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
p->drawPath(&m_path[0], m_path.size(), 0, p->skin()->mapPenInfo(m_penInfo), 0);
// graphics::FontDesc fontDesc(false, 10);
@@ -1017,7 +1018,7 @@ namespace
m_pathAbove[i].y += 50;
}
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
TestDrawTextOnPath::DoDraw(p);
@@ -1034,7 +1035,7 @@ namespace
struct TestDrawTextOverflow
{
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
int const startSize = 20;
size_t const sizesCount = 20;
@@ -1051,7 +1052,7 @@ namespace
struct TestDrawTextFiltering
{
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
int const startSize = 20;
size_t const sizesCount = 20;
@@ -1069,7 +1070,7 @@ namespace
struct TestDrawRandomTextFiltering
{
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
char const * texts [] = {"Simplicity is the ultimate sophistication", "Leonardo Da Vinci"};
@@ -1096,7 +1097,7 @@ namespace
struct TestDrawUtilsRect
{
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
shared_ptr<graphics::gl::RGBA8Texture> texture(new graphics::gl::RGBA8Texture(512, 512));
texture->randomize();
@@ -1113,7 +1114,7 @@ namespace
struct TestDrawUtilsRectFilledTexture
{
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
shared_ptr<graphics::gl::RGBA8Texture> texture(new graphics::gl::RGBA8Texture(512, 512));
texture->fill(graphics::Color(0, 255, 0, 255));
@@ -1131,7 +1132,7 @@ namespace
struct TestDrawOverlappedSymbolWithText
{
public:
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
p->setOverlay(make_shared_ptr(new graphics::Overlay()));
p->overlay()->setCouldOverlap(false);
@@ -1153,7 +1154,7 @@ namespace
struct TestDrawAnyRect
{
public:
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
m2::AnyRectD r[3] =
{
@@ -1173,7 +1174,7 @@ namespace
struct TestDrawSector
{
public:
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
p->drawArc(m2::PointD(100, 100), 0, math::pi * 2, 30, graphics::Color(0, 0, 255, 128), 12000);
p->fillSector(m2::PointD(100, 100), 0, math::pi * 2, 30, graphics::Color(0, 0, 255, 64), 12000);
@@ -1208,7 +1209,7 @@ namespace
t.endPolygon();
}
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
double inputDataPat[] = {10, 0};
graphics::PenInfo inputDataRule(graphics::Color::fromARGB(0xFF000000), 6, inputDataPat, 2, 0);
@@ -1316,7 +1317,7 @@ namespace
struct TestDrawSymbolFiltering
{
- void DoDraw(shared_ptr<graphics::gl::Screen> const & p)
+ void DoDraw(shared_ptr<graphics::Screen> const & p)
{
for (int i = 0; i < 40; ++i)
p->drawSymbol(m2::PointD(100 + i, 100), "hospital", graphics::EPosCenter, 0);
@@ -1325,7 +1326,7 @@ namespace
struct TestDrawCircle
{
- void DoDraw(shared_ptr<graphics::gl::Screen> const & p)
+ void DoDraw(shared_ptr<graphics::Screen> const & p)
{
graphics::CircleInfo ci0(10, graphics::Color(255, 0, 0, 255));
p->drawCircle(m2::PointD(200, 200), ci0, graphics::EPosCenter, 100);
@@ -1337,7 +1338,7 @@ namespace
struct TestDrawImage
{
- void DoDraw(shared_ptr<graphics::gl::Screen> const & p)
+ void DoDraw(shared_ptr<graphics::Screen> const & p)
{
graphics::ImageInfo ii("test.png");
diff --git a/graphics/graphics_tests/screenglglobal_test.cpp b/graphics/graphics_tests/screenglglobal_test.cpp
index 015d1fd4b1..1f0506f9d2 100644
--- a/graphics/graphics_tests/screenglglobal_test.cpp
+++ b/graphics/graphics_tests/screenglglobal_test.cpp
@@ -33,7 +33,7 @@ namespace
TestBase::Init();
}
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
std::vector<m2::PointD> pts;
diff --git a/graphics/graphics_tests/texture_test.cpp b/graphics/graphics_tests/texture_test.cpp
index f1f2ef4197..cd00777e16 100644
--- a/graphics/graphics_tests/texture_test.cpp
+++ b/graphics/graphics_tests/texture_test.cpp
@@ -2,7 +2,7 @@
#include "../../qt_tstfrm/macros.hpp"
#include "../../testing/testing.hpp"
-#include "../texture.hpp"
+#include "../opengl/texture.hpp"
UNIT_TEST(TextureTest_Main)
{
diff --git a/graphics/graphics_tests/thread_render.cpp b/graphics/graphics_tests/thread_render.cpp
index a8deac8860..8f698101f7 100644
--- a/graphics/graphics_tests/thread_render.cpp
+++ b/graphics/graphics_tests/thread_render.cpp
@@ -1,7 +1,9 @@
#include "../../base/SRC_FIRST.hpp"
+
+#include "../../graphics/opengl/utils.hpp"
+#include "../../graphics/opengl/texture.hpp"
+
#include "../../graphics/screen.hpp"
-#include "../../graphics/utils.hpp"
-#include "../../graphics/texture.hpp"
#include "../../std/shared_ptr.hpp"
#include "../../qt_tstfrm/macros.hpp"
#include "../../base/thread.hpp"
@@ -10,11 +12,11 @@ namespace
{
struct RenderRoutine : public threads::IRoutine
{
- shared_ptr<graphics::gl::Screen> m_pScreen;
+ shared_ptr<graphics::Screen> m_pScreen;
shared_ptr<qt::gl::RenderContext> m_renderContext;
int & m_globalCounter;
- RenderRoutine(shared_ptr<graphics::gl::Screen> pScreen,
+ RenderRoutine(shared_ptr<graphics::Screen> pScreen,
shared_ptr<qt::gl::RenderContext> renderContext,
int & globalCounter)
: m_pScreen(pScreen),
@@ -28,7 +30,7 @@ namespace
for (size_t i = 0; i < 30; ++i)
{
m_pScreen->beginFrame();
- m_pScreen->clear(graphics::gl::Screen::s_bgColor);
+ m_pScreen->clear(graphics::Screen::s_bgColor);
m_pScreen->immDrawRect(
m2::RectF(i * 15 + 20, 10, i * 15 + 30, 20),
m2::RectF(),
@@ -51,7 +53,7 @@ namespace
globalCounter = 0;
}
- void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ void DoDraw(shared_ptr<graphics::Screen> p)
{
globalCounter = 0;
threads::Thread thread;
@@ -59,7 +61,7 @@ namespace
for (size_t i = 0; i < 30; ++i)
{
p->beginFrame();
- p->clear(graphics::gl::Screen::s_bgColor);
+ p->clear(graphics::Screen::s_bgColor);
p->immDrawSolidRect(
m2::RectF(i * 15 + 20, 30, i * 15 + 30, 40),
graphics::Color(0, 0, 255, (globalCounter++) * (255 / 60) ));
diff --git a/graphics/image_info.cpp b/graphics/image_info.cpp
index 3449b40552..a972e54d50 100644
--- a/graphics/image_info.cpp
+++ b/graphics/image_info.cpp
@@ -1,5 +1,6 @@
#include "image_info.hpp"
-#include "data_traits.hpp"
+
+#include "opengl/data_traits.hpp"
#include "../platform/platform.hpp"
diff --git a/graphics/image_renderer.cpp b/graphics/image_renderer.cpp
index b928b4ba0e..c93aa6e20d 100644
--- a/graphics/image_renderer.cpp
+++ b/graphics/image_renderer.cpp
@@ -1,9 +1,9 @@
#include "image_renderer.hpp"
-
-#include "base_texture.hpp"
#include "resource_style.hpp"
#include "skin.hpp"
+#include "opengl/base_texture.hpp"
+
#include "../base/assert.hpp"
#include "../base/macros.hpp"
diff --git a/graphics/line_style.cpp b/graphics/line_style.cpp
index a0248b18c1..eb22bca483 100644
--- a/graphics/line_style.cpp
+++ b/graphics/line_style.cpp
@@ -1,7 +1,7 @@
#include "resource_style.hpp"
-
#include "agg_traits.hpp"
-#include "data_traits.hpp"
+
+#include "opengl/data_traits.hpp"
namespace graphics
{
diff --git a/graphics/base_texture.cpp b/graphics/opengl/base_texture.cpp
index 191cf3a358..c5a8229411 100644
--- a/graphics/base_texture.cpp
+++ b/graphics/opengl/base_texture.cpp
@@ -1,10 +1,11 @@
-#include "../base/SRC_FIRST.hpp"
+#include "../../base/SRC_FIRST.hpp"
-#include "internal/opengl.hpp"
+#include "../../base/logging.hpp"
+#include "../../std/bind.hpp"
+
+#include "opengl.hpp"
#include "base_texture.hpp"
#include "utils.hpp"
-#include "../base/logging.hpp"
-#include "../std/bind.hpp"
namespace graphics
{
@@ -76,18 +77,15 @@ namespace graphics
return id;
}
- void BaseTexture::makeCurrent(graphics::gl::PacketsQueue * queue) const
+ void BaseTexture::makeCurrent(graphics::PacketsQueue * queue) const
{
if (queue)
{
- queue->processFn(bind(&BaseTexture::makeCurrent, this, (graphics::gl::PacketsQueue*)0));
+ queue->processFn(bind(&BaseTexture::makeCurrent, this, (graphics::PacketsQueue*)0));
return;
}
-/*#ifndef OMIM_OS_ANDROID
- if (current() != m_id)
-#endif*/
- OGLCHECK(glBindTexture(GL_TEXTURE_2D, m_id));
+ OGLCHECK(glBindTexture(GL_TEXTURE_2D, m_id));
}
unsigned BaseTexture::id() const
diff --git a/graphics/base_texture.hpp b/graphics/opengl/base_texture.hpp
index 39c37ffba5..4be978a5b5 100644
--- a/graphics/base_texture.hpp
+++ b/graphics/opengl/base_texture.hpp
@@ -1,13 +1,16 @@
#pragma once
-#include "../geometry/rect2d.hpp"
-#include "../geometry/point2d.hpp"
-#include "render_target.hpp"
-#include "packets_queue.hpp"
+#include "../../geometry/rect2d.hpp"
+#include "../../geometry/point2d.hpp"
+
+#include "../render_target.hpp"
+#include "../packets_queue.hpp"
namespace graphics
{
struct Color;
+ class PacketsQueue;
+
namespace gl
{
class BaseTexture : public RenderTarget
@@ -34,7 +37,7 @@ namespace graphics
unsigned height() const;
unsigned id() const;
- void makeCurrent(graphics::gl::PacketsQueue * queue = 0) const;
+ void makeCurrent(graphics::PacketsQueue * queue = 0) const;
void attachToFrameBuffer();
void detachFromFrameBuffer();
diff --git a/graphics/buffer_object.cpp b/graphics/opengl/buffer_object.cpp
index 1c316d2429..937e2a639a 100644
--- a/graphics/buffer_object.cpp
+++ b/graphics/opengl/buffer_object.cpp
@@ -1,12 +1,12 @@
-#include "../base/SRC_FIRST.hpp"
-#include "../base/logging.hpp"
-#include "../base/assert.hpp"
-#include "../base/shared_buffer_manager.hpp"
+#include "../../base/SRC_FIRST.hpp"
+#include "../../base/logging.hpp"
+#include "../../base/assert.hpp"
+#include "../../base/shared_buffer_manager.hpp"
-#include "internal/opengl.hpp"
+#include "../../std/list.hpp"
+#include "opengl.hpp"
#include "buffer_object.hpp"
-#include "../std/list.hpp"
namespace graphics
{
diff --git a/graphics/buffer_object.hpp b/graphics/opengl/buffer_object.hpp
index bdd000db7e..f04190821a 100644
--- a/graphics/buffer_object.hpp
+++ b/graphics/opengl/buffer_object.hpp
@@ -1,7 +1,7 @@
#pragma once
-#include "../std/vector.hpp"
-#include "../std/shared_ptr.hpp"
+#include "../../std/vector.hpp"
+#include "../../std/shared_ptr.hpp"
namespace graphics
{
diff --git a/graphics/clipper.cpp b/graphics/opengl/clipper.cpp
index 9fb94e6d88..2c61e18dba 100644
--- a/graphics/clipper.cpp
+++ b/graphics/opengl/clipper.cpp
@@ -1,8 +1,8 @@
-#include "../base/SRC_FIRST.hpp"
+#include "../../std/bind.hpp"
+#include "../../base/logging.hpp"
+
#include "clipper.hpp"
-#include "internal/opengl.hpp"
-#include "../std/bind.hpp"
-#include "../base/logging.hpp"
+#include "opengl.hpp"
namespace graphics
{
diff --git a/graphics/clipper.hpp b/graphics/opengl/clipper.hpp
index 50f4b9ea42..c9b981d05f 100644
--- a/graphics/clipper.hpp
+++ b/graphics/opengl/clipper.hpp
@@ -1,6 +1,6 @@
#pragma once
-#include "../geometry/rect2d.hpp"
+#include "../../geometry/rect2d.hpp"
#include "renderer.hpp"
namespace graphics
diff --git a/graphics/data_traits.hpp b/graphics/opengl/data_traits.hpp
index bfe3a7d41e..92790406a5 100644
--- a/graphics/data_traits.hpp
+++ b/graphics/opengl/data_traits.hpp
@@ -1,7 +1,7 @@
#pragma once
-#include "internal/opengl.hpp"
-#include "color.hpp"
+#include "opengl.hpp"
+#include "../color.hpp"
#include <boost/gil/gil_all.hpp>
#include <boost/mpl/vector_c.hpp>
diff --git a/graphics/framebuffer.cpp b/graphics/opengl/framebuffer.cpp
index 31a9ec6120..8c34de7aea 100644
--- a/graphics/framebuffer.cpp
+++ b/graphics/opengl/framebuffer.cpp
@@ -3,11 +3,11 @@
#include "framebuffer.hpp"
#include "render_target.hpp"
#include "renderbuffer.hpp"
-#include "internal/opengl.hpp"
+#include "opengl.hpp"
#include "utils.hpp"
-#include "../base/logging.hpp"
-#include "../std/list.hpp"
+#include "../../base/logging.hpp"
+#include "../../std/list.hpp"
namespace graphics
{
diff --git a/graphics/framebuffer.hpp b/graphics/opengl/framebuffer.hpp
index cb0973c918..d03cae35c5 100644
--- a/graphics/framebuffer.hpp
+++ b/graphics/opengl/framebuffer.hpp
@@ -1,14 +1,15 @@
#pragma once
-#include "../std/shared_ptr.hpp"
+#include "../../std/shared_ptr.hpp"
namespace graphics
{
+ class RenderTarget;
+
namespace gl
{
class BaseTexture;
class RenderBuffer;
- class RenderTarget;
class FrameBuffer
{
diff --git a/graphics/geometry_renderer.cpp b/graphics/opengl/geometry_renderer.cpp
index 943e074ff8..bb59cd9675 100644
--- a/graphics/geometry_renderer.cpp
+++ b/graphics/opengl/geometry_renderer.cpp
@@ -5,9 +5,8 @@
#include "texture.hpp"
#include "buffer_object.hpp"
#include "managed_texture.hpp"
-#include "display_list.hpp"
#include "vertex.hpp"
-#include "internal/opengl.hpp"
+#include "opengl/opengl.hpp"
#include "../std/bind.hpp"
#include "../base/logging.hpp"
@@ -19,14 +18,17 @@ namespace graphics
typedef Texture<DATA_TRAITS, true> TDynamicTexture;
GeometryRenderer::GeometryRenderer(base_t::Params const & params)
- : base_t(params),
- m_displayList(0)
+ : base_t(params)
{}
- GeometryRenderer::UploadData::UploadData(SkinPage::TUploadQueue const & uploadQueue,
+ GeometryRenderer::UploadData::UploadData(shared_ptr<ResourceStyle> const * styles,
+ size_t count,
shared_ptr<BaseTexture> const & texture)
- : m_uploadQueue(uploadQueue), m_texture(texture)
- {}
+ : m_texture(texture)
+ {
+ m_uploadQueue.reserve(count);
+ copy(styles, styles + count, back_inserter(m_uploadQueue));
+ }
GeometryRenderer::UploadData::UploadData()
{}
@@ -84,65 +86,107 @@ namespace graphics
}
- void GeometryRenderer::uploadTextureImpl(SkinPage::TUploadQueue const & uploadQueue,
- size_t start, size_t end,
- shared_ptr<BaseTexture> const & texture,
- bool shouldAddCheckPoint)
+ void GeometryRenderer::uploadStyles(shared_ptr<ResourceStyle> const * styles,
+ size_t count,
+ shared_ptr<BaseTexture> const & texture)
{
- if (isCancelled())
- return;
-
- vector<shared_ptr<ResourceStyle> > v;
- v.reserve(end - start);
- copy(&uploadQueue[0] + start, &uploadQueue[0] + end, back_inserter(v));
-
- shared_ptr<UploadData> command(new UploadData(v, texture));
+ processCommand(make_shared_ptr(new UploadData(styles, count, texture)));
+ }
- if (m_displayList)
- m_displayList->uploadData(command);
- else
- processCommand(command);
+ GeometryRenderer::IMMDrawTexturedRect::IMMDrawTexturedRect(
+ m2::RectF const & rect,
+ m2::RectF const & texRect,
+ shared_ptr<BaseTexture> const & texture,
+ shared_ptr<ResourceManager> const & rm)
+ {
+ m2::PointF rectPoints[4] =
+ {
+ m2::PointF(rect.minX(), rect.minY()),
+ m2::PointF(rect.maxX(), rect.minY()),
+ m2::PointF(rect.maxX(), rect.maxY()),
+ m2::PointF(rect.minX(), rect.maxY())
+ };
- if (shouldAddCheckPoint)
+ m2::PointF texRectPoints[4] =
{
- if (m_displayList)
- m_displayList->addCheckPoint();
- else
- addCheckPoint();
- }
+ m2::PointF(texRect.minX(), texRect.minY()),
+ m2::PointF(texRect.maxX(), texRect.minY()),
+ m2::PointF(texRect.maxX(), texRect.maxY()),
+ m2::PointF(texRect.minX(), texRect.maxY()),
+ };
+
+ m_pts.resize(4);
+ m_texPts.resize(4);
+
+ copy(rectPoints, rectPoints + 4, &m_pts[0]);
+ copy(texRectPoints, texRectPoints + 4, &m_texPts[0]);
+ m_ptsCount = 4;
+ m_texture = texture;
+ m_hasTexture = true;
+ m_hasColor = false;
+ m_color = graphics::Color(255, 255, 255, 255);
+ m_resourceManager = rm;
}
- void GeometryRenderer::uploadTexture(SkinPage::TUploadQueue const & uploadQueue,
- shared_ptr<BaseTexture> const & texture)
+ void GeometryRenderer::IMMDrawTexturedPrimitives::perform()
{
- /// splitting the whole queue of commands into the chunks no more
- /// than 100kb of uploadable data each
+ if (isDebugging())
+ LOG(LINFO, ("performing IMMDrawTexturedPrimitives command"));
- /// tracking the number of bytes downloaded onto the texture
- /// in a single shot.
- size_t bytesUploaded = 0;
- size_t bytesPerPixel = graphics::formatSize(resourceManager()->params().m_texFormat);
- size_t prev = 0;
+ graphics::gl::Storage blitStorage = m_resourceManager->blitStorages()->Reserve();
- for (size_t i = 0; i < uploadQueue.size(); ++i)
+ if (m_resourceManager->blitStorages()->IsCancelled())
{
- shared_ptr<ResourceStyle> const & style = uploadQueue[i];
+ LOG(LDEBUG, ("skipping IMMDrawTexturedPrimitives on cancelled multiBlitStorages pool"));
+ return;
+ }
- bytesUploaded += style->m_texRect.SizeX() * style->m_texRect.SizeY() * bytesPerPixel;
+ if (!blitStorage.m_vertices->isLocked())
+ blitStorage.m_vertices->lock();
- if (bytesUploaded > 64 * 1024)
- {
- uploadTextureImpl(uploadQueue, prev, i + 1, texture, true);
- prev = i + 1;
- bytesUploaded = 0;
- }
- }
+ if (!blitStorage.m_indices->isLocked())
+ blitStorage.m_indices->lock();
+
+ Vertex * pointsData = (Vertex*)blitStorage.m_vertices->data();
- if (!uploadQueue.empty())
+ for (size_t i = 0; i < m_ptsCount; ++i)
{
- uploadTextureImpl(uploadQueue, prev, uploadQueue.size(), texture, false);
- bytesUploaded = 0;
+ pointsData[i].pt.x = m_pts[i].x;
+ pointsData[i].pt.y = m_pts[i].y;
+ pointsData[i].depth = graphics::maxDepth;
+ pointsData[i].tex.x = m_texPts[i].x;
+ pointsData[i].tex.y = m_texPts[i].y;
+ pointsData[i].normal.x = 0;
+ pointsData[i].normal.y = 0;
}
+
+ blitStorage.m_vertices->unlock();
+ blitStorage.m_vertices->makeCurrent();
+
+ Vertex::setupLayout(blitStorage.m_vertices->glPtr());
+
+ if (m_texture)
+ m_texture->makeCurrent();
+
+ unsigned short idxData[4] = {0, 1, 2, 3};
+ memcpy(blitStorage.m_indices->data(), idxData, sizeof(idxData));
+ blitStorage.m_indices->unlock();
+ blitStorage.m_indices->makeCurrent();
+
+ OGLCHECK(glDisableFn(GL_ALPHA_TEST_MWM));
+ OGLCHECK(glDisableFn(GL_BLEND));
+ OGLCHECK(glDisableFn(GL_DEPTH_TEST));
+ OGLCHECK(glDepthMask(GL_FALSE));
+ OGLCHECK(glDrawElementsFn(GL_TRIANGLE_FAN, 4, GL_UNSIGNED_SHORT, blitStorage.m_indices->glPtr()));
+ OGLCHECK(glDepthMask(GL_TRUE));
+ OGLCHECK(glEnableFn(GL_DEPTH_TEST));
+ OGLCHECK(glEnableFn(GL_BLEND));
+ OGLCHECK(glEnableFn(GL_ALPHA_TEST_MWM));
+
+ blitStorage.m_vertices->discard();
+ blitStorage.m_indices->discard();
+
+ m_resourceManager->blitStorages()->Free(blitStorage);
}
void GeometryRenderer::DrawGeometry::perform()
@@ -168,8 +212,23 @@ namespace graphics
// OGLCHECK(glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ));
+ unsigned glPrimType;
+
+ switch (m_primitiveType)
+ {
+ case ETrianglesFan:
+ glPrimType = GL_TRIANGLE_FAN;
+ break;
+ case ETriangles:
+ glPrimType = GL_TRIANGLES;
+ break;
+ case ETrianglesStrip:
+ glPrimType = GL_TRIANGLE_STRIP;
+ break;
+ };
+
OGLCHECK(glDrawElementsFn(
- m_primitiveType,
+ glPrimType,
m_indicesCount,
GL_UNSIGNED_SHORT,
((unsigned char*)m_storage.m_indices->glPtr()) + m_indicesOffs));
@@ -186,11 +245,8 @@ namespace graphics
Storage const & storage,
size_t indicesCount,
size_t indicesOffs,
- unsigned primType)
+ EPrimitives primType)
{
- if (isCancelled())
- return;
-
shared_ptr<DrawGeometry> command(new DrawGeometry());
command->m_texture = texture;
@@ -199,10 +255,7 @@ namespace graphics
command->m_indicesOffs = indicesOffs;
command->m_primitiveType = primType;
- if (m_displayList)
- m_displayList->drawGeometry(command);
- else
- processCommand(command);
+ processCommand(command);
}
void GeometryRenderer::FreeStorage::perform()
@@ -228,10 +281,7 @@ namespace graphics
command->m_storage = storage;
command->m_storagePool = storagePool;
- if (m_displayList)
- m_displayList->freeStorage(command);
- else
- processCommand(command);
+ processCommand(command);
}
void GeometryRenderer::FreeTexture::perform()
@@ -265,10 +315,7 @@ namespace graphics
command->m_texture = texture;
command->m_texturePool = texturePool;
- if (m_displayList)
- m_displayList->freeTexture(command);
- else
- processCommand(command);
+ processCommand(command);
}
void GeometryRenderer::UnlockStorage::perform()
@@ -302,10 +349,7 @@ namespace graphics
command->m_storage = storage;
- if (m_displayList)
- m_displayList->unlockStorage(command);
- else
- processCommand(command);
+ processCommand(command);
}
void GeometryRenderer::DiscardStorage::perform()
@@ -333,31 +377,7 @@ namespace graphics
command->m_storage = storage;
- if (m_displayList)
- m_displayList->discardStorage(command);
- else
- processCommand(command);
- }
-
- DisplayList * GeometryRenderer::createDisplayList()
- {
- return new DisplayList(this);
- }
-
- void GeometryRenderer::setDisplayList(DisplayList * dl)
- {
- m_displayList = dl;
- }
-
- void GeometryRenderer::drawDisplayList(DisplayList * dl,
- math::Matrix<double, 3, 3> const & m)
- {
- dl->draw(m);
- }
-
- DisplayList * GeometryRenderer::displayList() const
- {
- return m_displayList;
+ processCommand(command);
}
void GeometryRenderer::ApplyStates::perform()
@@ -400,13 +420,7 @@ namespace graphics
void GeometryRenderer::applyStates()
{
-
- shared_ptr<ApplyStates> command(new ApplyStates());
-
- if (m_displayList)
- m_displayList->applyStates(command);
- else
- processCommand(command);
+ processCommand(make_shared_ptr(new ApplyStates()));
}
void GeometryRenderer::ApplyBlitStates::perform()
@@ -427,12 +441,15 @@ namespace graphics
void GeometryRenderer::applyBlitStates()
{
- shared_ptr<ApplyBlitStates> command(new ApplyBlitStates());
+ processCommand(make_shared_ptr(new ApplyBlitStates()));
+ }
- if (m_displayList)
- m_displayList->applyBlitStates(command);
- else
- processCommand(command);
+ void GeometryRenderer::loadMatrix(EMatrix mt,
+ math::Matrix<float, 4, 4> const & m)
+ {
+ OGLCHECK(glMatrixModeFn(GL_MODELVIEW_MWM));
+ OGLCHECK(glLoadIdentityFn());
+ OGLCHECK(glLoadMatrixfFn(&m(0, 0)));
}
}
}
diff --git a/graphics/geometry_renderer.hpp b/graphics/opengl/geometry_renderer.hpp
index c90f469b19..bdb691e179 100644
--- a/graphics/geometry_renderer.hpp
+++ b/graphics/opengl/geometry_renderer.hpp
@@ -1,12 +1,14 @@
#pragma once
+#include "../defines.hpp"
+#include "../skin_page.hpp"
+
#include "clipper.hpp"
-#include "skin_page.hpp"
-#include "../base/threaded_list.hpp"
+#include "../../base/threaded_list.hpp"
-#include "../std/shared_ptr.hpp"
-#include "../std/function.hpp"
+#include "../../std/shared_ptr.hpp"
+#include "../../std/function.hpp"
namespace graphics
{
@@ -15,31 +17,21 @@ namespace graphics
namespace gl
{
class BaseTexture;
- class DisplayList;
class GeometryRenderer : public Clipper
{
- private:
-
- DisplayList * m_displayList;
-
- void uploadTextureImpl(SkinPage::TUploadQueue const & uploadQueue,
- size_t start,
- size_t end,
- shared_ptr<BaseTexture> const & texture,
- bool shouldAddCheckPoint);
-
public:
typedef Clipper base_t;
struct UploadData : public Command
{
- SkinPage::TUploadQueue m_uploadQueue;
+ vector<shared_ptr<ResourceStyle> > m_uploadQueue;
shared_ptr<BaseTexture> m_texture;
UploadData();
- UploadData(SkinPage::TUploadQueue const & uploadQueue,
+ UploadData(shared_ptr<ResourceStyle> const * styles,
+ size_t count,
shared_ptr<BaseTexture> const & texture);
void perform();
@@ -47,13 +39,36 @@ namespace graphics
void dump();
};
+ struct IMMDrawTexturedPrimitives : Command
+ {
+ buffer_vector<m2::PointF, 8> m_pts;
+ buffer_vector<m2::PointF, 8> m_texPts;
+ unsigned m_ptsCount;
+ shared_ptr<BaseTexture> m_texture;
+ bool m_hasTexture;
+ graphics::Color m_color;
+ bool m_hasColor;
+
+ shared_ptr<ResourceManager> m_resourceManager;
+
+ void perform();
+ };
+
+ struct IMMDrawTexturedRect : IMMDrawTexturedPrimitives
+ {
+ IMMDrawTexturedRect(m2::RectF const & rect,
+ m2::RectF const & texRect,
+ shared_ptr<BaseTexture> const & texture,
+ shared_ptr<ResourceManager> const & rm);
+ };
+
struct DrawGeometry : Command
{
shared_ptr<BaseTexture> m_texture;
Storage m_storage;
size_t m_indicesCount;
size_t m_indicesOffs;
- unsigned m_primitiveType;
+ EPrimitives m_primitiveType;
void perform();
void dump();
@@ -115,22 +130,20 @@ namespace graphics
Storage const & storage,
size_t indicesCount,
size_t indicesOffs,
- unsigned primType);
+ EPrimitives primType);
+
+ void uploadStyles(shared_ptr<ResourceStyle> const * styles,
+ size_t count,
+ shared_ptr<BaseTexture> const & texture);
- void uploadTexture(SkinPage::TUploadQueue const & uploadQueue, shared_ptr<BaseTexture> const & texture);
void freeTexture(shared_ptr<BaseTexture> const & texture, TTexturePool * texturePool);
void freeStorage(Storage const & storage, TStoragePool * storagePool);
void unlockStorage(Storage const & storage);
void discardStorage(Storage const & storage);
- /// create display list
- DisplayList * createDisplayList();
- /// set current display list
- void setDisplayList(DisplayList * displayList);
- /// get current display list
- DisplayList * displayList() const;
- /// draw display list
- void drawDisplayList(DisplayList * dl, math::Matrix<double, 3, 3> const & m);
+ /// setup rendering matrix
+ void loadMatrix(EMatrix mt,
+ math::Matrix<float, 4, 4> const & m);
};
}
}
diff --git a/graphics/internal/gl_procedures.inl b/graphics/opengl/gl_procedures.inl
index 28bc10f8f9..28bc10f8f9 100644
--- a/graphics/internal/gl_procedures.inl
+++ b/graphics/opengl/gl_procedures.inl
diff --git a/graphics/managed_texture.cpp b/graphics/opengl/managed_texture.cpp
index 5365cddff5..2ffcca0de3 100644
--- a/graphics/managed_texture.cpp
+++ b/graphics/opengl/managed_texture.cpp
@@ -1,8 +1,9 @@
#include "../base/SRC_FIRST.hpp"
-#include "internal/opengl.hpp"
+#include "../../base/shared_buffer_manager.hpp"
+
+#include "opengl.hpp"
#include "managed_texture.hpp"
-#include "../base/shared_buffer_manager.hpp"
namespace graphics
{
diff --git a/graphics/managed_texture.hpp b/graphics/opengl/managed_texture.hpp
index c4785c56da..e30b7b938e 100644
--- a/graphics/managed_texture.hpp
+++ b/graphics/opengl/managed_texture.hpp
@@ -1,10 +1,12 @@
#pragma once
-#include "../geometry/rect2d.hpp"
-#include "../geometry/point2d.hpp"
+#include "../../geometry/rect2d.hpp"
+#include "../../geometry/point2d.hpp"
+
+#include "../../std/vector.hpp"
+#include "../../std/shared_ptr.hpp"
+
#include "base_texture.hpp"
-#include "../std/vector.hpp"
-#include "../std/shared_ptr.hpp"
namespace graphics
{
diff --git a/graphics/internal/opengl.cpp b/graphics/opengl/opengl.cpp
index fc5730486d..fc5730486d 100644
--- a/graphics/internal/opengl.cpp
+++ b/graphics/opengl/opengl.cpp
diff --git a/graphics/internal/opengl.hpp b/graphics/opengl/opengl.hpp
index 8293066917..58c99aeda9 100644
--- a/graphics/internal/opengl.hpp
+++ b/graphics/opengl/opengl.hpp
@@ -1,4 +1,5 @@
#pragma once
+
#include "../../std/target_os.hpp"
#include "../../base/logging.hpp"
diff --git a/graphics/internal/opengl_es.cpp b/graphics/opengl/opengl_es.cpp
index 9e2641fb11..9e2641fb11 100644
--- a/graphics/internal/opengl_es.cpp
+++ b/graphics/opengl/opengl_es.cpp
diff --git a/graphics/internal/opengl_ext.cpp b/graphics/opengl/opengl_ext.cpp
index 0538edc487..0538edc487 100644
--- a/graphics/internal/opengl_ext.cpp
+++ b/graphics/opengl/opengl_ext.cpp
diff --git a/graphics/internal/opengl_glsl_es2.cpp b/graphics/opengl/opengl_glsl_es2.cpp
index 2c31e77f34..2c31e77f34 100644
--- a/graphics/internal/opengl_glsl_es2.cpp
+++ b/graphics/opengl/opengl_glsl_es2.cpp
diff --git a/graphics/internal/opengl_glsl_ext.cpp b/graphics/opengl/opengl_glsl_ext.cpp
index 51f2e9f3f9..51f2e9f3f9 100644
--- a/graphics/internal/opengl_glsl_ext.cpp
+++ b/graphics/opengl/opengl_glsl_ext.cpp
diff --git a/graphics/internal/opengl_glsl_impl.cpp b/graphics/opengl/opengl_glsl_impl.cpp
index 339ef4409c..339ef4409c 100644
--- a/graphics/internal/opengl_glsl_impl.cpp
+++ b/graphics/opengl/opengl_glsl_impl.cpp
diff --git a/graphics/internal/opengl_glsl_impl.hpp b/graphics/opengl/opengl_glsl_impl.hpp
index c3f9d50a9b..c3f9d50a9b 100644
--- a/graphics/internal/opengl_glsl_impl.hpp
+++ b/graphics/opengl/opengl_glsl_impl.hpp
diff --git a/graphics/internal/opengl_win32.cpp b/graphics/opengl/opengl_win32.cpp
index 9b6b525672..9b6b525672 100644
--- a/graphics/internal/opengl_win32.cpp
+++ b/graphics/opengl/opengl_win32.cpp
diff --git a/graphics/renderbuffer.cpp b/graphics/opengl/renderbuffer.cpp
index fa468f6be3..d4c3a712e3 100644
--- a/graphics/renderbuffer.cpp
+++ b/graphics/opengl/renderbuffer.cpp
@@ -1,6 +1,6 @@
#include "../base/SRC_FIRST.hpp"
-#include "internal/opengl.hpp"
+#include "opengl.hpp"
#include "renderbuffer.hpp"
#include "utils.hpp"
diff --git a/graphics/renderbuffer.hpp b/graphics/opengl/renderbuffer.hpp
index fcbf6a38a1..7bfd5383f5 100644
--- a/graphics/renderbuffer.hpp
+++ b/graphics/opengl/renderbuffer.hpp
@@ -1,7 +1,7 @@
#pragma once
-#include "../std/shared_ptr.hpp"
-#include "render_target.hpp"
+#include "../../std/shared_ptr.hpp"
+#include "../render_target.hpp"
namespace graphics
{
diff --git a/graphics/rendercontext.cpp b/graphics/opengl/rendercontext.cpp
index f1e072cc78..eca9c14636 100644
--- a/graphics/rendercontext.cpp
+++ b/graphics/opengl/rendercontext.cpp
@@ -1,6 +1,6 @@
#include "../base/SRC_FIRST.hpp"
#include "rendercontext.hpp"
-#include "internal/opengl.hpp"
+#include "opengl.hpp"
namespace graphics
{
diff --git a/graphics/rendercontext.hpp b/graphics/opengl/rendercontext.hpp
index f0cb992cce..6ce645f78d 100644
--- a/graphics/rendercontext.hpp
+++ b/graphics/opengl/rendercontext.hpp
@@ -1,6 +1,6 @@
#pragma once
-#include "../std/shared_ptr.hpp"
+#include "../../std/shared_ptr.hpp"
namespace graphics
{
diff --git a/graphics/renderer.cpp b/graphics/opengl/renderer.cpp
index 7df85142f1..c976164ba1 100644
--- a/graphics/renderer.cpp
+++ b/graphics/opengl/renderer.cpp
@@ -1,12 +1,12 @@
-#include "../base/SRC_FIRST.hpp"
+#include "../base/logging.hpp"
+
#include "renderer.hpp"
#include "data_traits.hpp"
#include "utils.hpp"
#include "framebuffer.hpp"
#include "renderbuffer.hpp"
#include "resource_manager.hpp"
-#include "internal/opengl.hpp"
-#include "../base/logging.hpp"
+#include "opengl.hpp"
namespace graphics
{
@@ -289,7 +289,7 @@ namespace graphics
void Renderer::processCommand(shared_ptr<Command> const & command, Packet::EType type, bool doForce)
{
if (command)
- command->m_isDebugging = renderQueue() && !doForce;
+ command->setIsDebugging(renderQueue() && !doForce);
if (renderQueue() && !doForce)
renderQueue()->processPacket(Packet(command, type));
diff --git a/graphics/renderer.hpp b/graphics/opengl/renderer.hpp
index ab7c631a55..5be49975c7 100644
--- a/graphics/renderer.hpp
+++ b/graphics/opengl/renderer.hpp
@@ -1,25 +1,25 @@
#pragma once
-#include "color.hpp"
-#include "packets_queue.hpp"
-#include "resource_manager.hpp"
+#include "../color.hpp"
+#include "../packets_queue.hpp"
+#include "../resource_manager.hpp"
-#include "../base/threaded_list.hpp"
-#include "../base/commands_queue.hpp"
-#include "../std/function.hpp"
-#include "../std/shared_ptr.hpp"
-#include "../geometry/rect2d.hpp"
+#include "../../base/threaded_list.hpp"
+#include "../../base/commands_queue.hpp"
+#include "../../std/function.hpp"
+#include "../../std/shared_ptr.hpp"
+#include "../../geometry/rect2d.hpp"
namespace graphics
{
class ResourceManager;
+ class RenderTarget;
namespace gl
{
class FrameBuffer;
class RenderBuffer;
class BaseTexture;
- class RenderTarget;
class Renderer
{
diff --git a/graphics/storage.cpp b/graphics/opengl/storage.cpp
index d565dc73d4..8412fd2a7b 100644
--- a/graphics/storage.cpp
+++ b/graphics/opengl/storage.cpp
@@ -1,7 +1,7 @@
-#include "../base/SRC_FIRST.hpp"
#include "storage.hpp"
#include "buffer_object.hpp"
-#include "internal/opengl.hpp"
+
+#include "opengl/opengl.hpp"
namespace graphics
{
diff --git a/graphics/storage.hpp b/graphics/opengl/storage.hpp
index f77459b1ac..82e49e1366 100644
--- a/graphics/storage.hpp
+++ b/graphics/opengl/storage.hpp
@@ -1,6 +1,6 @@
#pragma once
-#include "../std/shared_ptr.hpp"
+#include "../../std/shared_ptr.hpp"
namespace graphics
{
diff --git a/graphics/texture.hpp b/graphics/opengl/texture.hpp
index 49861e9f9d..5d04069cbc 100644
--- a/graphics/texture.hpp
+++ b/graphics/opengl/texture.hpp
@@ -2,11 +2,12 @@
#include "managed_texture.hpp"
#include "data_traits.hpp"
-#include "image_info.hpp"
-#include "../platform/platform.hpp"
+#include "../image_info.hpp"
-#include "../coding/lodepng_io.hpp"
+#include "../../platform/platform.hpp"
+
+#include "../../coding/lodepng_io.hpp"
namespace gil = boost::gil;
namespace mpl = boost::mpl;
diff --git a/graphics/utils.cpp b/graphics/opengl/utils.cpp
index 73139c6edf..187d5f8bce 100644
--- a/graphics/utils.cpp
+++ b/graphics/opengl/utils.cpp
@@ -1,7 +1,7 @@
#include "defines.hpp"
#include "utils.hpp"
-#include "internal/opengl.hpp"
+#include "opengl/opengl.hpp"
#include "../std/target_os.hpp"
diff --git a/graphics/utils.hpp b/graphics/opengl/utils.hpp
index 7441750c64..4cc8d41f04 100644
--- a/graphics/utils.hpp
+++ b/graphics/opengl/utils.hpp
@@ -1,6 +1,6 @@
#pragma once
-#include "../std/stdint.hpp"
+#include "../../std/stdint.hpp"
namespace graphics
{
diff --git a/graphics/vertex.cpp b/graphics/opengl/vertex.cpp
index 060f3ea1d9..f260265f4d 100644
--- a/graphics/vertex.cpp
+++ b/graphics/opengl/vertex.cpp
@@ -1,6 +1,6 @@
#include "vertex.hpp"
-#include "internal/opengl.hpp"
+#include "opengl.hpp"
namespace graphics
{
diff --git a/graphics/vertex.hpp b/graphics/opengl/vertex.hpp
index c58f877840..ec14b8d303 100644
--- a/graphics/vertex.hpp
+++ b/graphics/opengl/vertex.hpp
@@ -1,8 +1,8 @@
#pragma once
-#include "color.hpp"
+#include "../color.hpp"
-#include "../geometry/point2d.hpp"
+#include "../../geometry/point2d.hpp"
namespace graphics
{
diff --git a/graphics/overlay.cpp b/graphics/overlay.cpp
index 221a559267..58a0cb6c2f 100644
--- a/graphics/overlay.cpp
+++ b/graphics/overlay.cpp
@@ -29,7 +29,7 @@ namespace graphics
return elem->roughBoundRect();
}
- void DrawIfNotCancelled(gl::OverlayRenderer * r,
+ void DrawIfNotCancelled(OverlayRenderer * r,
shared_ptr<OverlayElement> const & e,
math::Matrix<double, 3, 3> const & m)
{
@@ -37,7 +37,7 @@ namespace graphics
e->draw(r, m);
}
- void Overlay::draw(gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m)
+ void Overlay::draw(OverlayRenderer * r, math::Matrix<double, 3, 3> const & m)
{
m_tree.ForEach(bind(&DrawIfNotCancelled, r, _1, cref(m)));
}
diff --git a/graphics/overlay.hpp b/graphics/overlay.hpp
index 2945f4f251..c096deebd5 100644
--- a/graphics/overlay.hpp
+++ b/graphics/overlay.hpp
@@ -35,7 +35,7 @@ namespace graphics
Overlay();
Overlay(Overlay const & src);
- void draw(gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m);
+ void draw(OverlayRenderer * r, math::Matrix<double, 3, 3> const & m);
void selectOverlayElements(m2::PointD const & pt, list<shared_ptr<OverlayElement> > & res);
void selectOverlayElements(m2::RectD const & rect, list<shared_ptr<OverlayElement> > & res);
diff --git a/graphics/overlay_element.hpp b/graphics/overlay_element.hpp
index 27e69b333e..dd565d7764 100644
--- a/graphics/overlay_element.hpp
+++ b/graphics/overlay_element.hpp
@@ -8,10 +8,7 @@
namespace graphics
{
- namespace gl
- {
- class OverlayRenderer;
- }
+ class OverlayRenderer;
class OverlayElement
{
@@ -63,7 +60,7 @@ namespace graphics
/// PLEASE, REMEMBER THE REFERENCE!!!
virtual vector<m2::AnyRectD> const & boundRects() const = 0;
- virtual void draw(gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const = 0;
+ virtual void draw(OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const = 0;
virtual int visualRank() const = 0;
m2::PointD const & pivot() const;
diff --git a/graphics/overlay_renderer.cpp b/graphics/overlay_renderer.cpp
index 55d89f4b6a..fa86e4406f 100644
--- a/graphics/overlay_renderer.cpp
+++ b/graphics/overlay_renderer.cpp
@@ -12,186 +12,183 @@
namespace graphics
{
- namespace gl
+ OverlayRenderer::Params::Params()
+ : m_drawTexts(true),
+ m_drawSymbols(true)
{
- OverlayRenderer::Params::Params()
- : m_drawTexts(true),
- m_drawSymbols(true)
- {
- }
-
- OverlayRenderer::OverlayRenderer(Params const & p)
- : TextRenderer(p),
- m_drawTexts(p.m_drawTexts),
- m_drawSymbols(p.m_drawSymbols),
- m_overlay(p.m_overlay)
- {
- }
-
- void OverlayRenderer::drawSymbol(SymbolElement::Params & params)
- {
- if (!m_drawSymbols)
- return;
-
- params.m_skin = skin().get();
-
- shared_ptr<OverlayElement> oe(new SymbolElement(params));
-
- math::Matrix<double, 3, 3> id = math::Identity<double, 3>();
-
- if (!m_overlay.get())
- oe->draw(this, id);
- else
- m_overlay->processOverlayElement(oe);
- }
-
- void OverlayRenderer::drawSymbol(m2::PointD const & pt, string const & symbolName, EPosition pos, int depth)
- {
- graphics::SymbolElement::Params params;
- params.m_depth = depth;
- params.m_position = pos;
- params.m_pivot = pt;
- params.m_symbolName = symbolName;
-
- drawSymbol(params);
- }
-
- void OverlayRenderer::drawCircle(m2::PointD const & pt,
- graphics::CircleInfo const & ci,
- EPosition pos,
- int depth)
- {
- CircleElement::Params params;
-
- params.m_depth = depth;
- params.m_position = pos;
- params.m_pivot = pt;
- params.m_ci = ci;
-
- shared_ptr<OverlayElement> oe(new CircleElement(params));
-
- math::Matrix<double, 3, 3> id = math::Identity<double, 3>();
-
- if (!m_overlay.get())
- oe->draw(this, id);
- else
- m_overlay->processOverlayElement(oe);
- }
-
- void OverlayRenderer::drawText(FontDesc const & fontDesc,
+ }
+
+ OverlayRenderer::OverlayRenderer(Params const & p)
+ : TextRenderer(p),
+ m_drawTexts(p.m_drawTexts),
+ m_drawSymbols(p.m_drawSymbols),
+ m_overlay(p.m_overlay)
+ {
+ }
+
+ void OverlayRenderer::drawSymbol(SymbolElement::Params & params)
+ {
+ if (!m_drawSymbols)
+ return;
+
+ params.m_skin = skin().get();
+
+ shared_ptr<OverlayElement> oe(new SymbolElement(params));
+
+ math::Matrix<double, 3, 3> id = math::Identity<double, 3>();
+
+ if (!m_overlay.get())
+ oe->draw(this, id);
+ else
+ m_overlay->processOverlayElement(oe);
+ }
+
+ void OverlayRenderer::drawSymbol(m2::PointD const & pt, string const & symbolName, EPosition pos, int depth)
+ {
+ graphics::SymbolElement::Params params;
+ params.m_depth = depth;
+ params.m_position = pos;
+ params.m_pivot = pt;
+ params.m_symbolName = symbolName;
+
+ drawSymbol(params);
+ }
+
+ void OverlayRenderer::drawCircle(m2::PointD const & pt,
+ graphics::CircleInfo const & ci,
+ EPosition pos,
+ int depth)
+ {
+ CircleElement::Params params;
+
+ params.m_depth = depth;
+ params.m_position = pos;
+ params.m_pivot = pt;
+ params.m_ci = ci;
+
+ shared_ptr<OverlayElement> oe(new CircleElement(params));
+
+ math::Matrix<double, 3, 3> id = math::Identity<double, 3>();
+
+ if (!m_overlay.get())
+ oe->draw(this, id);
+ else
+ m_overlay->processOverlayElement(oe);
+ }
+
+ void OverlayRenderer::drawText(FontDesc const & fontDesc,
+ m2::PointD const & pt,
+ graphics::EPosition pos,
+ string const & utf8Text,
+ double depth,
+ bool log2vis,
+ bool doSplit)
+ {
+ if (!m_drawTexts)
+ return;
+
+ StraightTextElement::Params params;
+ params.m_depth = depth;
+ params.m_fontDesc = fontDesc;
+ params.m_log2vis = log2vis;
+ params.m_pivot = pt;
+ params.m_position = pos;
+ params.m_glyphCache = glyphCache();
+ params.m_logText = strings::MakeUniString(utf8Text);
+ params.m_doSplit = doSplit;
+ params.m_useAllParts = false;
+
+ shared_ptr<OverlayElement> oe(new StraightTextElement(params));
+
+ math::Matrix<double, 3, 3> id = math::Identity<double, 3>();
+
+ if (!m_overlay.get())
+ oe->draw(this, id);
+ else
+ m_overlay->processOverlayElement(oe);
+ }
+
+ void OverlayRenderer::drawTextEx(FontDesc const & primaryFont,
+ FontDesc const & secondaryFont,
m2::PointD const & pt,
graphics::EPosition pos,
- string const & utf8Text,
+ string const & text,
+ string const & secondaryText,
double depth,
bool log2vis,
bool doSplit)
- {
- if (!m_drawTexts)
- return;
-
- StraightTextElement::Params params;
- params.m_depth = depth;
- params.m_fontDesc = fontDesc;
- params.m_log2vis = log2vis;
- params.m_pivot = pt;
- params.m_position = pos;
- params.m_glyphCache = glyphCache();
- params.m_logText = strings::MakeUniString(utf8Text);
- params.m_doSplit = doSplit;
- params.m_useAllParts = false;
-
- shared_ptr<OverlayElement> oe(new StraightTextElement(params));
-
- math::Matrix<double, 3, 3> id = math::Identity<double, 3>();
-
- if (!m_overlay.get())
- oe->draw(this, id);
- else
- m_overlay->processOverlayElement(oe);
- }
-
- void OverlayRenderer::drawTextEx(FontDesc const & primaryFont,
- FontDesc const & secondaryFont,
- m2::PointD const & pt,
- graphics::EPosition pos,
- string const & text,
- string const & secondaryText,
- double depth,
- bool log2vis,
- bool doSplit)
- {
- if (!m_drawTexts)
- return;
-
- StraightTextElement::Params params;
- params.m_depth = depth;
- params.m_fontDesc = primaryFont;
- params.m_auxFontDesc = secondaryFont;
- params.m_log2vis = log2vis;
- params.m_pivot = pt;
- params.m_position = pos;
- params.m_glyphCache = glyphCache();
- params.m_logText = strings::MakeUniString(text);
- params.m_auxLogText = strings::MakeUniString(secondaryText);
- params.m_doSplit = doSplit;
- params.m_useAllParts = false;
-
- shared_ptr<OverlayElement> oe(new StraightTextElement(params));
-
- math::Matrix<double, 3, 3> id = math::Identity<double, 3>();
-
- if (!m_overlay.get())
- oe->draw(this, id);
- else
- m_overlay->processOverlayElement(oe);
- }
-
- bool OverlayRenderer::drawPathText(
+ {
+ if (!m_drawTexts)
+ return;
+
+ StraightTextElement::Params params;
+ params.m_depth = depth;
+ params.m_fontDesc = primaryFont;
+ params.m_auxFontDesc = secondaryFont;
+ params.m_log2vis = log2vis;
+ params.m_pivot = pt;
+ params.m_position = pos;
+ params.m_glyphCache = glyphCache();
+ params.m_logText = strings::MakeUniString(text);
+ params.m_auxLogText = strings::MakeUniString(secondaryText);
+ params.m_doSplit = doSplit;
+ params.m_useAllParts = false;
+
+ shared_ptr<OverlayElement> oe(new StraightTextElement(params));
+
+ math::Matrix<double, 3, 3> id = math::Identity<double, 3>();
+
+ if (!m_overlay.get())
+ oe->draw(this, id);
+ else
+ m_overlay->processOverlayElement(oe);
+ }
+
+ bool OverlayRenderer::drawPathText(
FontDesc const & fontDesc, m2::PointD const * path, size_t s, string const & utf8Text,
double fullLength, double pathOffset, graphics::EPosition pos, double depth)
- {
- if (!m_drawTexts)
- return false;
-
- PathTextElement::Params params;
-
- params.m_pts = path;
- params.m_ptsCount = s;
- params.m_fullLength = fullLength;
- params.m_pathOffset = pathOffset;
- params.m_fontDesc = fontDesc;
- params.m_logText = strings::MakeUniString(utf8Text);
- params.m_depth = depth;
- params.m_log2vis = true;
- params.m_glyphCache = glyphCache();
- params.m_pivot = path[0];
- params.m_position = pos;
-
- shared_ptr<PathTextElement> pte(new PathTextElement(params));
-
- math::Matrix<double, 3, 3> id = math::Identity<double, 3>();
-
- if (!m_overlay.get())
- pte->draw(this, id);
- else
- m_overlay->processOverlayElement(pte);
-
- return true;
- }
-
- void OverlayRenderer::setOverlay(shared_ptr<Overlay> const & overlay)
- {
- m_overlay = overlay;
- }
-
- shared_ptr<Overlay> const & OverlayRenderer::overlay() const
- {
- return m_overlay;
- }
-
- void OverlayRenderer::resetOverlay()
- {
- m_overlay.reset();
- }
+ {
+ if (!m_drawTexts)
+ return false;
+
+ PathTextElement::Params params;
+
+ params.m_pts = path;
+ params.m_ptsCount = s;
+ params.m_fullLength = fullLength;
+ params.m_pathOffset = pathOffset;
+ params.m_fontDesc = fontDesc;
+ params.m_logText = strings::MakeUniString(utf8Text);
+ params.m_depth = depth;
+ params.m_log2vis = true;
+ params.m_glyphCache = glyphCache();
+ params.m_pivot = path[0];
+ params.m_position = pos;
+
+ shared_ptr<PathTextElement> pte(new PathTextElement(params));
+
+ math::Matrix<double, 3, 3> id = math::Identity<double, 3>();
+
+ if (!m_overlay.get())
+ pte->draw(this, id);
+ else
+ m_overlay->processOverlayElement(pte);
+
+ return true;
+ }
+
+ void OverlayRenderer::setOverlay(shared_ptr<Overlay> const & overlay)
+ {
+ m_overlay = overlay;
+ }
+
+ shared_ptr<Overlay> const & OverlayRenderer::overlay() const
+ {
+ return m_overlay;
+ }
+
+ void OverlayRenderer::resetOverlay()
+ {
+ m_overlay.reset();
}
}
diff --git a/graphics/overlay_renderer.hpp b/graphics/overlay_renderer.hpp
index bb1bacfa40..4c58834f88 100644
--- a/graphics/overlay_renderer.hpp
+++ b/graphics/overlay_renderer.hpp
@@ -6,73 +6,70 @@
namespace graphics
{
- namespace gl
+ class OverlayRenderer : public TextRenderer
{
- class OverlayRenderer : public TextRenderer
- {
- private:
+ private:
- bool m_drawTexts;
- bool m_drawSymbols;
- shared_ptr<graphics::Overlay> m_overlay;
+ bool m_drawTexts;
+ bool m_drawSymbols;
+ shared_ptr<graphics::Overlay> m_overlay;
- typedef map<m2::PointI, shared_ptr<OverlayElement> > TElements;
+ typedef map<m2::PointI, shared_ptr<OverlayElement> > TElements;
- TElements m_elements;
+ TElements m_elements;
- public:
+ public:
+
+ struct Params : public TextRenderer::Params
+ {
+ bool m_drawTexts;
+ bool m_drawSymbols;
+ shared_ptr<graphics::Overlay> m_overlay;
+ Params();
+ };
- struct Params : public TextRenderer::Params
- {
- bool m_drawTexts;
- bool m_drawSymbols;
- shared_ptr<graphics::Overlay> m_overlay;
- Params();
- };
+ OverlayRenderer(Params const & p);
- OverlayRenderer(Params const & p);
+ /// Drawing POI symbol
+ void drawSymbol(SymbolElement::Params & params);
+ void drawSymbol(m2::PointD const & pt, string const & symbolName, EPosition pos, int depth);
- /// Drawing POI symbol
- void drawSymbol(SymbolElement::Params & params);
- void drawSymbol(m2::PointD const & pt, string const & symbolName, EPosition pos, int depth);
+ /// Drawing circle
+ void drawCircle(m2::PointD const & pt, graphics::CircleInfo const & ci, EPosition pos, int depth);
- /// Drawing circle
- void drawCircle(m2::PointD const & pt, graphics::CircleInfo const & ci, EPosition pos, int depth);
+ /// drawing straight text
+ void drawText(FontDesc const & fontDesc,
+ m2::PointD const & pt,
+ graphics::EPosition pos,
+ string const & utf8Text,
+ double depth,
+ bool log2vis,
+ bool doSplit = false);
- /// drawing straight text
- void drawText(FontDesc const & fontDesc,
+ void drawTextEx(FontDesc const & primaryFont,
+ FontDesc const & secondaryFont,
m2::PointD const & pt,
graphics::EPosition pos,
- string const & utf8Text,
+ string const & text,
+ string const & secondaryText,
double depth,
bool log2vis,
bool doSplit = false);
- void drawTextEx(FontDesc const & primaryFont,
- FontDesc const & secondaryFont,
- m2::PointD const & pt,
+ /// drawing text on the path
+ bool drawPathText(FontDesc const & fontDesc,
+ m2::PointD const * path,
+ size_t s,
+ string const & utf8Text,
+ double fullLength,
+ double pathOffset,
graphics::EPosition pos,
- string const & text,
- string const & secondaryText,
- double depth,
- bool log2vis,
- bool doSplit = false);
-
- /// drawing text on the path
- bool drawPathText(FontDesc const & fontDesc,
- m2::PointD const * path,
- size_t s,
- string const & utf8Text,
- double fullLength,
- double pathOffset,
- graphics::EPosition pos,
- double depth);
-
- void setOverlay(shared_ptr<Overlay> const & overlay);
-
- shared_ptr<Overlay> const & overlay() const;
-
- void resetOverlay();
- };
- }
+ double depth);
+
+ void setOverlay(shared_ptr<Overlay> const & overlay);
+
+ shared_ptr<Overlay> const & overlay() const;
+
+ void resetOverlay();
+ };
}
diff --git a/graphics/packets_queue.cpp b/graphics/packets_queue.cpp
index 83e964e3b0..c2fa838632 100644
--- a/graphics/packets_queue.cpp
+++ b/graphics/packets_queue.cpp
@@ -3,132 +3,129 @@
namespace graphics
{
- namespace gl
+ bool Command::isDebugging() const
{
- bool Command::isDebugging() const
- {
- return m_isDebugging;
- }
+ return m_isDebugging;
+ }
- void Command::setIsDebugging(bool flag)
- {
- m_isDebugging = flag;
- }
+ void Command::setIsDebugging(bool flag)
+ {
+ m_isDebugging = flag;
+ }
- Command::Command()
- : m_isDebugging(false)
- {}
+ Command::Command()
+ : m_isDebugging(false)
+ {}
- Command::~Command()
- {}
+ Command::~Command()
+ {}
- void Command::cancel()
- {}
+ void Command::cancel()
+ {}
- void Command::perform()
- {}
+ void Command::perform()
+ {}
- void Command::dump()
- {}
+ void Command::dump()
+ {}
- DumpCommand::DumpCommand(shared_ptr<Command> const & cmd)
- : m_cmd(cmd)
- {}
+ DumpCommand::DumpCommand(shared_ptr<Command> const & cmd)
+ : m_cmd(cmd)
+ {}
- void DumpCommand::perform()
- {
- m_cmd->dump();
- }
-
- Packet::Packet()
- {}
-
- Packet::Packet(EType type)
- : m_type(type)
- {}
+ void DumpCommand::perform()
+ {
+ m_cmd->dump();
+ }
- Packet::Packet(shared_ptr<Command> const & command,
- EType type)
- : m_command(command),
- m_type(type)
- {}
+ Packet::Packet()
+ {}
- PacketsQueue::PacketsQueue()
- : m_fenceManager(5)
- {}
+ Packet::Packet(EType type)
+ : m_type(type)
+ {}
- struct SignalFence : public Command
- {
- int m_id;
- FenceManager * m_fenceManager;
+ Packet::Packet(shared_ptr<Command> const & command,
+ EType type)
+ : m_command(command),
+ m_type(type)
+ {}
- SignalFence(int id, FenceManager * fenceManager)
- : m_id(id), m_fenceManager(fenceManager)
- {}
+ PacketsQueue::PacketsQueue()
+ : m_fenceManager(5)
+ {}
- void perform()
- {
- m_fenceManager->signalFence(m_id);
- }
+ struct SignalFence : public Command
+ {
+ int m_id;
+ FenceManager * m_fenceManager;
- void cancel()
- {
- perform();
- }
- };
+ SignalFence(int id, FenceManager * fenceManager)
+ : m_id(id), m_fenceManager(fenceManager)
+ {}
- int PacketsQueue::insertFence(Packet::EType type)
+ void perform()
{
- int id = m_fenceManager.insertFence();
- processPacket(Packet(make_shared_ptr(new SignalFence(id, &m_fenceManager)), type));
- return id;
+ m_fenceManager->signalFence(m_id);
}
- void PacketsQueue::joinFence(int id)
+ void cancel()
{
- m_fenceManager.joinFence(id);
+ perform();
}
+ };
- void PacketsQueue::completeCommands()
- {
- joinFence(insertFence(Packet::EFramePoint));
- }
+ int PacketsQueue::insertFence(Packet::EType type)
+ {
+ int id = m_fenceManager.insertFence();
+ processPacket(Packet(make_shared_ptr(new SignalFence(id, &m_fenceManager)), type));
+ return id;
+ }
- void PacketsQueue::cancelCommands()
- {
- joinFence(insertFence(Packet::ECancelPoint));
- }
+ void PacketsQueue::joinFence(int id)
+ {
+ m_fenceManager.joinFence(id);
+ }
- void PacketsQueue::cancel()
- {
- m_packets.Cancel();
- m_fenceManager.cancel();
- }
+ void PacketsQueue::completeCommands()
+ {
+ joinFence(insertFence(Packet::EFramePoint));
+ }
- void PacketsQueue::cancelFences()
- {
- m_fenceManager.cancel();
- }
+ void PacketsQueue::cancelCommands()
+ {
+ joinFence(insertFence(Packet::ECancelPoint));
+ }
- void PacketsQueue::processPacket(Packet const & packet)
- {
- if (m_packets.IsCancelled())
- {
- if (packet.m_command)
- packet.m_command->cancel();
- }
- else
- m_packets.PushBack(packet);
- }
+ void PacketsQueue::cancel()
+ {
+ m_packets.Cancel();
+ m_fenceManager.cancel();
+ }
- bool PacketsQueue::empty() const
- {
- return m_packets.Empty();
- }
+ void PacketsQueue::cancelFences()
+ {
+ m_fenceManager.cancel();
+ }
- size_t PacketsQueue::size() const
+ void PacketsQueue::processPacket(Packet const & packet)
+ {
+ if (m_packets.IsCancelled())
{
- return m_packets.Size();
+ if (packet.m_command)
+ packet.m_command->cancel();
}
+ else
+ m_packets.PushBack(packet);
+ }
+
+ bool PacketsQueue::empty() const
+ {
+ return m_packets.Empty();
+ }
+
+ size_t PacketsQueue::size() const
+ {
+ return m_packets.Size();
}
}
diff --git a/graphics/packets_queue.hpp b/graphics/packets_queue.hpp
index bc9957eccb..0ccf910195 100644
--- a/graphics/packets_queue.hpp
+++ b/graphics/packets_queue.hpp
@@ -10,118 +10,113 @@
namespace graphics
{
- namespace gl
+ struct Command
{
- struct Command
- {
- private:
+ private:
- bool m_isDebugging;
- string m_name;
+ bool m_isDebugging;
+ string m_name;
- public:
+ public:
- bool isDebugging() const;
- void setIsDebugging(bool flag);
+ bool isDebugging() const;
+ void setIsDebugging(bool flag);
- Command();
+ Command();
- virtual ~Command();
- virtual void perform();
- virtual void cancel();
- virtual void dump();
+ virtual ~Command();
+ virtual void perform();
+ virtual void cancel();
+ virtual void dump();
+ };
- friend class Renderer;
- };
+ struct DumpCommand : Command
+ {
+ shared_ptr<Command> m_cmd;
- struct DumpCommand : Command
- {
- shared_ptr<Command> m_cmd;
+ DumpCommand(shared_ptr<Command> const & cmd);
- DumpCommand(shared_ptr<Command> const & cmd);
+ void perform();
+ };
- void perform();
- };
+ template <typename Fn>
+ struct FunctorCommand : Command
+ {
+ Fn m_fn;
+ bool m_performOnCancel;
- template <typename Fn>
- struct FunctorCommand : Command
- {
- Fn m_fn;
- bool m_performOnCancel;
+ FunctorCommand(Fn fn, bool performOnCancel = false)
+ : m_fn(fn), m_performOnCancel(performOnCancel)
+ {}
- FunctorCommand(Fn fn, bool performOnCancel = false)
- : m_fn(fn), m_performOnCancel(performOnCancel)
- {}
+ void perform()
+ {
+ m_fn();
+ }
- void perform()
- {
+ void cancel()
+ {
+ if (m_performOnCancel)
m_fn();
- }
-
- void cancel()
- {
- if (m_performOnCancel)
- m_fn();
- }
- };
+ }
+ };
- struct Packet
+ struct Packet
+ {
+ enum EType
{
- enum EType
- {
- ECommand,
- ECheckPoint,
- EFramePoint,
- ECancelPoint
- };
-
- shared_ptr<Command> m_command;
- EType m_type;
-
- Packet();
- /// empty packet act as a frame delimiter or a checkpoint.
- explicit Packet(EType type);
- /// simple command
- Packet(shared_ptr<Command> const & command,
- EType type);
+ ECommand,
+ ECheckPoint,
+ EFramePoint,
+ ECancelPoint
};
- class PacketsQueue
- {
- private:
+ shared_ptr<Command> m_command;
+ EType m_type;
- ThreadedList<Packet> m_packets;
- FenceManager m_fenceManager;
+ Packet();
+ /// empty packet act as a frame delimiter or a checkpoint.
+ explicit Packet(EType type);
+ /// simple command
+ Packet(shared_ptr<Command> const & command,
+ EType type);
+ };
- public:
+ class PacketsQueue
+ {
+ private:
- PacketsQueue();
+ ThreadedList<Packet> m_packets;
+ FenceManager m_fenceManager;
- void processPacket(Packet const & packet);
- void cancel();
- void cancelFences();
- bool empty() const;
- size_t size() const;
+ public:
- int insertFence(Packet::EType type);
- void joinFence(int id);
+ PacketsQueue();
- /// Convenience functions
+ void processPacket(Packet const & packet);
+ void cancel();
+ void cancelFences();
+ bool empty() const;
+ size_t size() const;
- void completeCommands();
- void cancelCommands();
+ int insertFence(Packet::EType type);
+ void joinFence(int id);
- template <typename Fn>
- void processFn(Fn fn, bool performOnCancel = false)
- {
- processPacket(Packet(make_shared_ptr(new FunctorCommand<Fn>(fn)), Packet::ECommand));
- }
+ /// convenience functions
- template <typename Fn>
- void processList(Fn fn)
- {
- m_packets.ProcessList(fn);
- }
- };
- }
+ void completeCommands();
+ void cancelCommands();
+
+ template <typename Fn>
+ void processFn(Fn fn, bool performOnCancel = false)
+ {
+ processPacket(Packet(make_shared_ptr(new FunctorCommand<Fn>(fn)), Packet::ECommand));
+ }
+
+ template <typename Fn>
+ void processList(Fn fn)
+ {
+ m_packets.ProcessList(fn);
+ }
+ };
}
diff --git a/graphics/path_renderer.cpp b/graphics/path_renderer.cpp
index 46b75f2434..ec365aa338 100644
--- a/graphics/path_renderer.cpp
+++ b/graphics/path_renderer.cpp
@@ -2,7 +2,8 @@
#include "resource_style.hpp"
#include "skin.hpp"
#include "skin_page.hpp"
-#include "base_texture.hpp"
+
+#include "opengl/base_texture.hpp"
#include "../base/logging.hpp"
diff --git a/graphics/path_text_element.cpp b/graphics/path_text_element.cpp
index 9f79389bfb..0f6ce30d40 100644
--- a/graphics/path_text_element.cpp
+++ b/graphics/path_text_element.cpp
@@ -46,7 +46,7 @@ namespace graphics
return m_boundRects;
}
- void PathTextElement::draw(gl::OverlayRenderer * screen, math::Matrix<double, 3, 3> const & m) const
+ void PathTextElement::draw(OverlayRenderer * screen, math::Matrix<double, 3, 3> const & m) const
{
if (screen->isDebugging())
{
diff --git a/graphics/path_text_element.hpp b/graphics/path_text_element.hpp
index 8f849dd861..76332b072f 100644
--- a/graphics/path_text_element.hpp
+++ b/graphics/path_text_element.hpp
@@ -25,7 +25,7 @@ namespace graphics
vector<m2::AnyRectD> const & boundRects() const;
- void draw(gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
+ void draw(OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
int visualRank() const;
diff --git a/graphics/render_target.hpp b/graphics/render_target.hpp
index 100ba7b78c..7ef18ce2a0 100644
--- a/graphics/render_target.hpp
+++ b/graphics/render_target.hpp
@@ -2,18 +2,15 @@
namespace graphics
{
- namespace gl
+ class RenderTarget
{
- class RenderTarget
- {
- public:
- virtual ~RenderTarget() {}
- /// attach render target to framebuffer and setup coordinate system
- virtual unsigned int id() const = 0;
- virtual void attachToFrameBuffer() = 0;
- virtual void detachFromFrameBuffer() = 0;
- virtual unsigned width() const = 0;
- virtual unsigned height() const = 0;
- };
- }
+ public:
+ virtual ~RenderTarget() {}
+ /// attach render target to framebuffer and setup coordinate system
+ virtual unsigned int id() const = 0;
+ virtual void attachToFrameBuffer() = 0;
+ virtual void detachFromFrameBuffer() = 0;
+ virtual unsigned width() const = 0;
+ virtual unsigned height() const = 0;
+ };
}
diff --git a/graphics/resource_manager.cpp b/graphics/resource_manager.cpp
index c997e29ce8..bc96953632 100644
--- a/graphics/resource_manager.cpp
+++ b/graphics/resource_manager.cpp
@@ -1,12 +1,13 @@
-
-#include "internal/opengl.hpp"
-#include "base_texture.hpp"
-#include "data_traits.hpp"
#include "resource_manager.hpp"
+
+#include "opengl/opengl.hpp"
+#include "opengl/base_texture.hpp"
+#include "opengl/data_traits.hpp"
+#include "opengl/storage.hpp"
+#include "opengl/texture.hpp"
+#include "opengl/buffer_object.hpp"
+
#include "skin_loader.hpp"
-#include "storage.hpp"
-#include "texture.hpp"
-#include "buffer_object.hpp"
#include "../coding/file_reader.hpp"
#include "../coding/parse_xml.hpp"
diff --git a/graphics/resource_manager.hpp b/graphics/resource_manager.hpp
index 07dc3a6e89..5ccd1a271e 100644
--- a/graphics/resource_manager.hpp
+++ b/graphics/resource_manager.hpp
@@ -9,7 +9,7 @@
#include "../base/mutex.hpp"
#include "../base/resource_pool.hpp"
-#include "storage.hpp"
+#include "opengl/storage.hpp"
#include "glyph_cache.hpp"
#include "data_formats.hpp"
diff --git a/graphics/resource_style.cpp b/graphics/resource_style.cpp
index 78ac1f883c..c6d9d62f90 100644
--- a/graphics/resource_style.cpp
+++ b/graphics/resource_style.cpp
@@ -1,6 +1,6 @@
#include "resource_style.hpp"
-#include "data_traits.hpp"
+#include "opengl/data_traits.hpp"
namespace graphics
{
diff --git a/graphics/screen.hpp b/graphics/screen.hpp
index 8d563f4798..4ce0fe727c 100644
--- a/graphics/screen.hpp
+++ b/graphics/screen.hpp
@@ -4,17 +4,14 @@
namespace graphics
{
- namespace gl
+ class Screen : public OverlayRenderer
{
- class Screen : public OverlayRenderer
- {
- private:
- public:
+ private:
+ public:
- typedef OverlayRenderer::Params Params;
+ typedef OverlayRenderer::Params Params;
- Screen(Params const & params) : OverlayRenderer(params)
- {}
- };
- }
+ Screen(Params const & params) : OverlayRenderer(params)
+ {}
+ };
}
diff --git a/graphics/shape_renderer.cpp b/graphics/shape_renderer.cpp
index 860dddaf89..816d646d7b 100644
--- a/graphics/shape_renderer.cpp
+++ b/graphics/shape_renderer.cpp
@@ -3,7 +3,8 @@
#include "pen_info.hpp"
#include "resource_style.hpp"
#include "skin_page.hpp"
-#include "base_texture.hpp"
+
+#include "opengl/base_texture.hpp"
#include "../geometry/point2d.hpp"
diff --git a/graphics/skin.cpp b/graphics/skin.cpp
index bc6ae971b5..bb9c4aab6f 100644
--- a/graphics/skin.cpp
+++ b/graphics/skin.cpp
@@ -11,9 +11,6 @@
#include "../std/bind.hpp"
#include "../std/numeric.hpp"
-#include "internal/opengl.hpp"
-
-
namespace graphics
{
Skin::Skin(shared_ptr<ResourceManager> const & resourceManager,
diff --git a/graphics/skin_page.cpp b/graphics/skin_page.cpp
index bb85d81a30..ca6ff54915 100644
--- a/graphics/skin_page.cpp
+++ b/graphics/skin_page.cpp
@@ -1,10 +1,10 @@
#include "skin_page.hpp"
-#include "texture.hpp"
-#include "data_traits.hpp"
+#include "opengl/texture.hpp"
+#include "opengl/data_traits.hpp"
+
#include "resource_style.hpp"
#include "resource_manager.hpp"
-#include "internal/opengl.hpp"
#include "../base/logging.hpp"
diff --git a/graphics/straight_text_element.cpp b/graphics/straight_text_element.cpp
index 1826258b2a..c03bd3d9dd 100644
--- a/graphics/straight_text_element.cpp
+++ b/graphics/straight_text_element.cpp
@@ -248,7 +248,7 @@ namespace graphics
return m_boundRects;
}
- void StraightTextElement::draw(gl::OverlayRenderer * screen, math::Matrix<double, 3, 3> const & m) const
+ void StraightTextElement::draw(OverlayRenderer * screen, math::Matrix<double, 3, 3> const & m) const
{
if (screen->isDebugging())
{
diff --git a/graphics/straight_text_element.hpp b/graphics/straight_text_element.hpp
index 55b2100f8e..a2b024de3c 100644
--- a/graphics/straight_text_element.hpp
+++ b/graphics/straight_text_element.hpp
@@ -31,7 +31,7 @@ namespace graphics
vector<m2::AnyRectD> const & boundRects() const;
- void draw(gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
+ void draw(OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
int visualRank() const;
diff --git a/graphics/symbol_element.cpp b/graphics/symbol_element.cpp
index 133de605a3..b9a382f20c 100644
--- a/graphics/symbol_element.cpp
+++ b/graphics/symbol_element.cpp
@@ -53,7 +53,7 @@ namespace graphics
return m2::AnyRectD(m2::RectD(posPt, posPt + m2::PointD(texRect.SizeX(), texRect.SizeY())));
}
- void SymbolElement::draw(gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const
+ void SymbolElement::draw(OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const
{
if (!isNeedRedraw())
return;
diff --git a/graphics/symbol_element.hpp b/graphics/symbol_element.hpp
index c7769ff2ac..11d260f1aa 100644
--- a/graphics/symbol_element.hpp
+++ b/graphics/symbol_element.hpp
@@ -33,7 +33,7 @@ namespace graphics
SymbolElement(SymbolElement const & se, math::Matrix<double, 3, 3> const & m);
vector<m2::AnyRectD> const & boundRects() const;
- void draw(gl::OverlayRenderer * s, math::Matrix<double, 3, 3> const & m) const;
+ void draw(OverlayRenderer * s, math::Matrix<double, 3, 3> const & m) const;
uint32_t styleID() const;
diff --git a/graphics/text_element.cpp b/graphics/text_element.cpp
index 32c0dda9ad..9795d5841f 100644
--- a/graphics/text_element.cpp
+++ b/graphics/text_element.cpp
@@ -72,7 +72,7 @@ namespace graphics
}
void TextElement::drawTextImpl(GlyphLayout const & layout,
- gl::OverlayRenderer * screen,
+ OverlayRenderer * screen,
math::Matrix<double, 3, 3> const & m,
bool doTransformPivotOnly,
bool doAlignPivot,
diff --git a/graphics/text_element.hpp b/graphics/text_element.hpp
index 97af332c64..5d68fee30b 100644
--- a/graphics/text_element.hpp
+++ b/graphics/text_element.hpp
@@ -17,11 +17,7 @@ namespace graphics
class ResourceManager;
class Skin;
class SkinPage;
-
- namespace gl
- {
- class OverlayRenderer;
- }
+ class OverlayRenderer;
class TextElement : public OverlayElement
{
@@ -61,7 +57,7 @@ namespace graphics
TextElement(Params const & p);
void drawTextImpl(GlyphLayout const & layout,
- gl::OverlayRenderer * r,
+ OverlayRenderer * r,
math::Matrix<double, 3, 3> const & m,
bool doTransformPivotOnly,
bool doAlignPivot,
diff --git a/graphics/text_renderer.cpp b/graphics/text_renderer.cpp
index 43c87a3e46..08b488ec74 100644
--- a/graphics/text_renderer.cpp
+++ b/graphics/text_renderer.cpp
@@ -12,67 +12,63 @@
namespace graphics
{
- namespace gl
- {
-
- TextRenderer::Params::Params()
- : m_drawTexts(true),
- m_glyphCacheID(-1)
- {}
+ TextRenderer::Params::Params()
+ : m_drawTexts(true),
+ m_glyphCacheID(-1)
+ {}
- TextRenderer::TextRenderer(Params const & params)
- : base_t(params),
- m_drawTexts(params.m_drawTexts),
- m_glyphCacheID(params.m_glyphCacheID)
- {}
+ TextRenderer::TextRenderer(Params const & params)
+ : base_t(params),
+ m_drawTexts(params.m_drawTexts),
+ m_glyphCacheID(params.m_glyphCacheID)
+ {}
- void TextRenderer::drawStraightGlyph(m2::PointD const & ptPivot,
- m2::PointD const & ptOffs,
- GlyphStyle const * p,
- float depth)
- {
- float x0 = ptOffs.x + (p->m_gi->m_metrics.m_xOffset - 1);
- float y1 = ptOffs.y - (p->m_gi->m_metrics.m_yOffset - 1);
- float y0 = y1 - (p->m_texRect.SizeY() - 2);
- float x1 = x0 + (p->m_texRect.SizeX() - 2);
+ void TextRenderer::drawStraightGlyph(m2::PointD const & ptPivot,
+ m2::PointD const & ptOffs,
+ GlyphStyle const * p,
+ float depth)
+ {
+ float x0 = ptOffs.x + (p->m_gi->m_metrics.m_xOffset - 1);
+ float y1 = ptOffs.y - (p->m_gi->m_metrics.m_yOffset - 1);
+ float y0 = y1 - (p->m_texRect.SizeY() - 2);
+ float x1 = x0 + (p->m_texRect.SizeX() - 2);
- drawStraightTexturedPolygon(
- ptPivot,
- p->m_texRect.minX() + 1,
- p->m_texRect.minY() + 1,
- p->m_texRect.maxX() - 1,
- p->m_texRect.maxY() - 1,
- x0, y0, x1, y1,
- depth,
- p->m_pipelineID
- );
- }
+ drawStraightTexturedPolygon(
+ ptPivot,
+ p->m_texRect.minX() + 1,
+ p->m_texRect.minY() + 1,
+ p->m_texRect.maxX() - 1,
+ p->m_texRect.maxY() - 1,
+ x0, y0, x1, y1,
+ depth,
+ p->m_pipelineID
+ );
+ }
- void TextRenderer::drawGlyph(m2::PointD const & ptOrg,
- m2::PointD const & ptGlyph,
- ang::AngleD const & angle,
- float /*blOffset*/,
- GlyphStyle const * p,
- double depth)
- {
- float x0 = ptGlyph.x + (p->m_gi->m_metrics.m_xOffset - 1);
- float y1 = ptGlyph.y - (p->m_gi->m_metrics.m_yOffset - 1);
- float y0 = y1 - (p->m_texRect.SizeY() - 2);
- float x1 = x0 + (p->m_texRect.SizeX() - 2);
+ void TextRenderer::drawGlyph(m2::PointD const & ptOrg,
+ m2::PointD const & ptGlyph,
+ ang::AngleD const & angle,
+ float /*blOffset*/,
+ GlyphStyle const * p,
+ double depth)
+ {
+ float x0 = ptGlyph.x + (p->m_gi->m_metrics.m_xOffset - 1);
+ float y1 = ptGlyph.y - (p->m_gi->m_metrics.m_yOffset - 1);
+ float y0 = y1 - (p->m_texRect.SizeY() - 2);
+ float x1 = x0 + (p->m_texRect.SizeX() - 2);
- drawTexturedPolygon(ptOrg, angle,
- p->m_texRect.minX() + 1,
- p->m_texRect.minY() + 1,
- p->m_texRect.maxX() - 1,
- p->m_texRect.maxY() - 1,
- x0, y0, x1, y1,
- depth,
- p->m_pipelineID);
- }
+ drawTexturedPolygon(ptOrg, angle,
+ p->m_texRect.minX() + 1,
+ p->m_texRect.minY() + 1,
+ p->m_texRect.maxX() - 1,
+ p->m_texRect.maxY() - 1,
+ x0, y0, x1, y1,
+ depth,
+ p->m_pipelineID);
+ }
- GlyphCache * TextRenderer::glyphCache() const
- {
- return resourceManager()->glyphCache(m_glyphCacheID);
- }
+ GlyphCache * TextRenderer::glyphCache() const
+ {
+ return resourceManager()->glyphCache(m_glyphCacheID);
}
}
diff --git a/graphics/text_renderer.hpp b/graphics/text_renderer.hpp
index 334353818d..bf65a4ec2e 100644
--- a/graphics/text_renderer.hpp
+++ b/graphics/text_renderer.hpp
@@ -12,42 +12,39 @@
namespace graphics
{
- namespace gl
+ class TextRenderer : public ImageRenderer
{
- class TextRenderer : public ImageRenderer
- {
- private:
+ private:
- bool m_drawTexts;
- int m_glyphCacheID;
+ bool m_drawTexts;
+ int m_glyphCacheID;
- public:
+ public:
- typedef ImageRenderer base_t;
+ typedef ImageRenderer base_t;
- struct Params : base_t::Params
- {
- bool m_drawTexts;
- int m_glyphCacheID;
- Params();
- };
+ struct Params : base_t::Params
+ {
+ bool m_drawTexts;
+ int m_glyphCacheID;
+ Params();
+ };
- TextRenderer(Params const & params);
+ TextRenderer(Params const & params);
- void drawStraightGlyph(m2::PointD const & ptOrg,
- m2::PointD const & ptGlyph,
- GlyphStyle const * p,
- float depth);
+ void drawStraightGlyph(m2::PointD const & ptOrg,
+ m2::PointD const & ptGlyph,
+ GlyphStyle const * p,
+ float depth);
- void drawGlyph(m2::PointD const & ptOrg,
- m2::PointD const & ptGlyph,
- ang::AngleD const & angle,
- float blOffset,
- GlyphStyle const * p,
- double depth);
+ void drawGlyph(m2::PointD const & ptOrg,
+ m2::PointD const & ptGlyph,
+ ang::AngleD const & angle,
+ float blOffset,
+ GlyphStyle const * p,
+ double depth);
- GlyphCache * glyphCache() const;
- };
- }
+ GlyphCache * glyphCache() const;
+ };
}
diff --git a/gui/button.cpp b/gui/button.cpp
index 785e3e2384..17549bbeb5 100644
--- a/gui/button.cpp
+++ b/gui/button.cpp
@@ -128,7 +128,7 @@ namespace gui
return m_boundRects;
}
- void Button::draw(graphics::gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const
+ void Button::draw(graphics::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const
{
if (!isVisible())
return;
diff --git a/gui/button.hpp b/gui/button.hpp
index fb5e5d5f68..049cf16df1 100644
--- a/gui/button.hpp
+++ b/gui/button.hpp
@@ -73,7 +73,7 @@ namespace gui
/// @{
vector<m2::AnyRectD> const & boundRects() const;
- void draw(graphics::gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
+ void draw(graphics::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
/// @}
};
diff --git a/gui/controller.cpp b/gui/controller.cpp
index 45155aa945..dfc90e4e43 100644
--- a/gui/controller.cpp
+++ b/gui/controller.cpp
@@ -20,7 +20,7 @@ namespace gui
Controller::RenderParams::RenderParams(double visualScale,
TInvalidateFn invalidateFn,
graphics::GlyphCache * glyphCache,
- graphics::gl::Screen * cacheScreen)
+ graphics::Screen * cacheScreen)
: m_VisualScale(visualScale),
m_InvalidateFn(invalidateFn),
m_GlyphCache(glyphCache),
@@ -158,7 +158,7 @@ namespace gui
PurgeElements();
}
- void Controller::DrawFrame(graphics::gl::Screen * screen)
+ void Controller::DrawFrame(graphics::Screen * screen)
{
screen->beginFrame();
@@ -201,7 +201,7 @@ namespace gui
return m_bundle;
}
- graphics::gl::Screen * Controller::GetCacheScreen() const
+ graphics::Screen * Controller::GetCacheScreen() const
{
return m_CacheScreen;
}
diff --git a/gui/controller.hpp b/gui/controller.hpp
index 37956b91ab..b6be4ca257 100644
--- a/gui/controller.hpp
+++ b/gui/controller.hpp
@@ -12,11 +12,7 @@ namespace graphics
{
class GlyphCache;
class OverlayElement;
-
- namespace gl
- {
- class Screen;
- }
+ class Screen;
}
namespace gui
@@ -58,7 +54,7 @@ namespace gui
StringsBundle const * m_bundle;
/// Screen, which is used to cache gui::Elements into display lists.
- graphics::gl::Screen * m_CacheScreen;
+ graphics::Screen * m_CacheScreen;
/// Should we call the onTapEnded when the tap finished(we should
/// not if the tap was cancelled while moving).
@@ -84,12 +80,12 @@ namespace gui
double m_VisualScale;
TInvalidateFn m_InvalidateFn;
graphics::GlyphCache * m_GlyphCache;
- graphics::gl::Screen * m_CacheScreen;
+ graphics::Screen * m_CacheScreen;
RenderParams();
RenderParams(double visualScale,
TInvalidateFn invalidateFn,
graphics::GlyphCache * glyphCache,
- graphics::gl::Screen * cacheScreen);
+ graphics::Screen * cacheScreen);
};
/// Attach GUI Controller to the renderer
@@ -110,11 +106,11 @@ namespace gui
StringsBundle const * GetStringsBundle() const;
/// Get GlyphCache
graphics::GlyphCache * GetGlyphCache() const;
- /// Get graphics::gl::Screen, which is used to cache gui::Element's
+ /// Get graphics::Screen, which is used to cache gui::Element's
/// into display lists.
- graphics::gl::Screen * GetCacheScreen() const;
+ graphics::Screen * GetCacheScreen() const;
/// Redraw GUI
- void DrawFrame(graphics::gl::Screen * screen);
+ void DrawFrame(graphics::Screen * screen);
/// Calling gui::Element::update for every element.
void UpdateElements();
/// Calling gui::Element::purge for every element.
diff --git a/gui/element.cpp b/gui/element.cpp
index c183e01602..48f2a18510 100644
--- a/gui/element.cpp
+++ b/gui/element.cpp
@@ -86,7 +86,7 @@ namespace gui
return 0;
}
- void Element::draw(graphics::gl::OverlayRenderer *r, math::Matrix<double, 3, 3> const & m) const
+ void Element::draw(graphics::OverlayRenderer *r, math::Matrix<double, 3, 3> const & m) const
{
for (unsigned i = 0; i < boundRects().size(); ++i)
r->drawRectangle(boundRects()[i], color(state()), depth());
diff --git a/gui/element.hpp b/gui/element.hpp
index 88ba5dc624..5179101735 100644
--- a/gui/element.hpp
+++ b/gui/element.hpp
@@ -68,7 +68,7 @@ namespace gui
double visualScale() const;
graphics::OverlayElement * clone(math::Matrix<double, 3, 3> const & m) const;
- void draw(graphics::gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
+ void draw(graphics::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
int visualRank() const;
virtual void cache();
diff --git a/gui/text_view.cpp b/gui/text_view.cpp
index 68ce7742d8..61be3de297 100644
--- a/gui/text_view.cpp
+++ b/gui/text_view.cpp
@@ -48,7 +48,7 @@ namespace gui
m_elem.reset(new graphics::StraightTextElement(params));
}
- void TextView::draw(graphics::gl::OverlayRenderer *r, math::Matrix<double, 3, 3> const & m) const
+ void TextView::draw(graphics::OverlayRenderer *r, math::Matrix<double, 3, 3> const & m) const
{
checkDirtyDrawing();
m_elem->draw(r, m);
diff --git a/gui/text_view.hpp b/gui/text_view.hpp
index 8ec2d6933d..5f949cafd7 100644
--- a/gui/text_view.hpp
+++ b/gui/text_view.hpp
@@ -36,7 +36,7 @@ namespace gui
string const & text() const;
vector<m2::AnyRectD> const & boundRects() const;
- void draw(graphics::gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
+ void draw(graphics::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
bool onTapStarted(m2::PointD const & pt);
bool onTapMoved(m2::PointD const & pt);
diff --git a/iphone/Maps/Classes/EAGLView.mm b/iphone/Maps/Classes/EAGLView.mm
index cacb544b5a..d4553778fa 100644
--- a/iphone/Maps/Classes/EAGLView.mm
+++ b/iphone/Maps/Classes/EAGLView.mm
@@ -9,7 +9,7 @@
#include "Framework.h"
#include "../../graphics/resource_manager.hpp"
-#include "../../graphics/internal/opengl.hpp"
+#include "../../graphics/opengl/opengl.hpp"
#include "../../graphics/data_formats.hpp"
#include "../../map/render_policy.hpp"
@@ -123,7 +123,7 @@
{
frameBuffer->onSize(width, height);
- shared_ptr<graphics::gl::Screen> screen = renderPolicy->GetDrawer()->screen();
+ shared_ptr<graphics::Screen> screen = renderPolicy->GetDrawer()->screen();
/// free old render buffer, as we would not create a new one.
screen->resetRenderTarget();
@@ -143,7 +143,7 @@
GetFramework().OnSize(width, height);
screen->beginFrame();
- screen->clear(graphics::gl::Screen::s_bgColor);
+ screen->clear(graphics::Screen::s_bgColor);
screen->endFrame();
}
diff --git a/iphone/Maps/Classes/RenderBuffer.hpp b/iphone/Maps/Classes/RenderBuffer.hpp
index 1505c7ac20..cce1082d53 100644
--- a/iphone/Maps/Classes/RenderBuffer.hpp
+++ b/iphone/Maps/Classes/RenderBuffer.hpp
@@ -8,7 +8,7 @@
namespace iphone
{
- class RenderBuffer : public graphics::gl::RenderTarget
+ class RenderBuffer : public graphics::RenderTarget
{
private:
diff --git a/iphone/Maps/Classes/RenderBuffer.mm b/iphone/Maps/Classes/RenderBuffer.mm
index 029aa3e19c..c3fd3b01e2 100644
--- a/iphone/Maps/Classes/RenderBuffer.mm
+++ b/iphone/Maps/Classes/RenderBuffer.mm
@@ -2,8 +2,8 @@
#include "RenderBuffer.hpp"
-#include "../../../graphics/internal/opengl.hpp"
-#include "../../../graphics/utils.hpp"
+#include "../../../graphics/opengl/opengl.hpp"
+#include "../../../graphics/opengl/utils.hpp"
namespace iphone
{
diff --git a/iphone/Maps/Classes/RenderContext.hpp b/iphone/Maps/Classes/RenderContext.hpp
index 2ca70a56d3..d83dddec2d 100644
--- a/iphone/Maps/Classes/RenderContext.hpp
+++ b/iphone/Maps/Classes/RenderContext.hpp
@@ -13,7 +13,7 @@
#include <OpenGLES/ES1/gl.h>
#include <OpenGLES/ES1/glext.h>
-#include "../../../graphics/rendercontext.hpp"
+#include "../../../graphics/opengl/rendercontext.hpp"
#include "../../../std/shared_ptr.hpp"
diff --git a/map/compass_arrow.cpp b/map/compass_arrow.cpp
index 573b55e64c..78aa1743fd 100644
--- a/map/compass_arrow.cpp
+++ b/map/compass_arrow.cpp
@@ -52,7 +52,7 @@ vector<m2::AnyRectD> const & CompassArrow::boundRects() const
return m_boundRects;
}
-void CompassArrow::draw(graphics::gl::OverlayRenderer * r,
+void CompassArrow::draw(graphics::OverlayRenderer * r,
math::Matrix<double, 3, 3> const & m) const
{
if (isVisible())
@@ -71,7 +71,7 @@ void CompassArrow::draw(graphics::gl::OverlayRenderer * r,
void CompassArrow::cache()
{
- graphics::gl::Screen * cacheScreen = m_controller->GetCacheScreen();
+ graphics::Screen * cacheScreen = m_controller->GetCacheScreen();
m_displayList.reset();
m_displayList.reset(cacheScreen->createDisplayList());
diff --git a/map/compass_arrow.hpp b/map/compass_arrow.hpp
index efdec9525b..035aac25c2 100644
--- a/map/compass_arrow.hpp
+++ b/map/compass_arrow.hpp
@@ -27,7 +27,7 @@ private:
graphics::Color const m_southRightColor;
double m_angle;
- scoped_ptr<graphics::gl::DisplayList> m_displayList;
+ scoped_ptr<graphics::DisplayList> m_displayList;
mutable vector<m2::AnyRectD> m_boundRects;
@@ -52,7 +52,7 @@ public:
unsigned GetArrowHeight() const;
vector<m2::AnyRectD> const & boundRects() const;
- void draw(graphics::gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
+ void draw(graphics::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
bool onTapEnded(m2::PointD const & pt);
diff --git a/map/country_status_display.cpp b/map/country_status_display.cpp
index 5086356a0a..4c9b2fe350 100644
--- a/map/country_status_display.cpp
+++ b/map/country_status_display.cpp
@@ -235,7 +235,7 @@ void CountryStatusDisplay::setCountryName(string const & name)
}
}
-void CountryStatusDisplay::draw(graphics::gl::OverlayRenderer *r,
+void CountryStatusDisplay::draw(graphics::OverlayRenderer *r,
math::Matrix<double, 3, 3> const & m) const
{
if (!isVisible())
diff --git a/map/country_status_display.hpp b/map/country_status_display.hpp
index 683bd958b6..6a6bc3b7f9 100644
--- a/map/country_status_display.hpp
+++ b/map/country_status_display.hpp
@@ -79,7 +79,7 @@ public:
/// attach element to controller.
void setController(gui::Controller *controller);
/// render element
- void draw(graphics::gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
+ void draw(graphics::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
/// get bounding rects
vector<m2::AnyRectD> const & boundRects() const;
diff --git a/map/coverage_generator.cpp b/map/coverage_generator.cpp
index 1d7710ec19..7779746527 100644
--- a/map/coverage_generator.cpp
+++ b/map/coverage_generator.cpp
@@ -6,7 +6,7 @@
#include "tile_set.hpp"
#include "../graphics/skin.hpp"
-#include "../graphics/rendercontext.hpp"
+#include "../graphics/opengl/rendercontext.hpp"
#include "../base/logging.hpp"
@@ -20,7 +20,7 @@ CoverageGenerator::CoverageGenerator(
shared_ptr<WindowHandle> const & windowHandle,
shared_ptr<graphics::gl::RenderContext> const & primaryRC,
shared_ptr<graphics::ResourceManager> const & rm,
- graphics::gl::PacketsQueue * glQueue,
+ graphics::PacketsQueue * glQueue,
RenderPolicy::TCountryNameFn countryNameFn)
: m_queue(1),
m_tileRenderer(tileRenderer),
@@ -52,7 +52,7 @@ CoverageGenerator::CoverageGenerator(
ScreenCoverage * CoverageGenerator::CreateCoverage()
{
- graphics::gl::Screen::Params params;
+ graphics::Screen::Params params;
params.m_resourceManager = m_resourceManager;
params.m_renderQueue = m_glQueue;
@@ -61,7 +61,7 @@ ScreenCoverage * CoverageGenerator::CreateCoverage()
params.m_isSynchronized = false;
params.m_glyphCacheID = m_resourceManager->cacheThreadGlyphCacheID();
- shared_ptr<graphics::gl::Screen> screen(new graphics::gl::Screen(params));
+ shared_ptr<graphics::Screen> screen(new graphics::Screen(params));
shared_ptr<graphics::Skin> skin(loadSkin(m_resourceManager, m_skinName));
screen->setSkin(skin);
diff --git a/map/coverage_generator.hpp b/map/coverage_generator.hpp
index 65d22dbc89..b3b68b8e9f 100644
--- a/map/coverage_generator.hpp
+++ b/map/coverage_generator.hpp
@@ -60,7 +60,7 @@ private:
RenderPolicy::TCountryNameFn m_countryNameFn;
- graphics::gl::PacketsQueue * m_glQueue;
+ graphics::PacketsQueue * m_glQueue;
string m_skinName;
FenceManager m_fenceManager;
@@ -78,7 +78,7 @@ public:
shared_ptr<WindowHandle> const & windowHandle,
shared_ptr<graphics::gl::RenderContext> const & primaryRC,
shared_ptr<graphics::ResourceManager> const & rm,
- graphics::gl::PacketsQueue * glQueue,
+ graphics::PacketsQueue * glQueue,
RenderPolicy::TCountryNameFn countryNameFn);
~CoverageGenerator();
diff --git a/map/drawer.cpp b/map/drawer.cpp
index 0a0ff77f97..41eaa30d37 100644
--- a/map/drawer.cpp
+++ b/map/drawer.cpp
@@ -54,7 +54,7 @@ void di::DrawRule::SetID(size_t threadID, uint32_t id) const
Drawer::Drawer(Params const & params)
: m_visualScale(params.m_visualScale), m_threadID(params.m_threadID)
{
- m_pScreen = shared_ptr<graphics::gl::Screen>(new graphics::gl::Screen(params));
+ m_pScreen = shared_ptr<graphics::Screen>(new graphics::Screen(params));
m_pSkin = params.m_skin;
m_pScreen->setSkin(m_pSkin);
@@ -276,7 +276,7 @@ void Drawer::drawPathNumber(di::PathInfo const & path, di::DrawInfo const * pInf
}
}
-shared_ptr<graphics::gl::Screen> Drawer::screen() const
+shared_ptr<graphics::Screen> Drawer::screen() const
{
return m_pScreen;
}
diff --git a/map/drawer.hpp b/map/drawer.hpp
index 729e26aa94..1eedf1a024 100644
--- a/map/drawer.hpp
+++ b/map/drawer.hpp
@@ -73,7 +73,7 @@ class Drawer
int m_level;
size_t m_threadID;
- shared_ptr<graphics::gl::Screen> m_pScreen;
+ shared_ptr<graphics::Screen> m_pScreen;
shared_ptr<graphics::Skin> m_pSkin;
static void ClearSkinPage(size_t threadID, uint8_t pipelineID);
@@ -97,7 +97,8 @@ protected:
typedef shared_ptr<graphics::gl::FrameBuffer> frame_buffer_t;
public:
- struct Params : graphics::gl::Screen::Params
+
+ struct Params : graphics::Screen::Params
{
size_t m_threadID;
double m_visualScale;
@@ -116,7 +117,7 @@ public:
void onSize(int w, int h);
- shared_ptr<graphics::gl::Screen> screen() const;
+ shared_ptr<graphics::Screen> screen() const;
double VisualScale() const;
void SetScale(int level);
diff --git a/map/framework.cpp b/map/framework.cpp
index 0e53258280..bd0dbce5fb 100644
--- a/map/framework.cpp
+++ b/map/framework.cpp
@@ -27,7 +27,7 @@
#include "../coding/internal/file_data.hpp"
-#include "../graphics/rendercontext.hpp"
+#include "../graphics/opengl/rendercontext.hpp"
#include "../geometry/angles.hpp"
#include "../geometry/distance_on_sphere.hpp"
@@ -706,7 +706,7 @@ void Framework::DrawAdditionalInfo(shared_ptr<PaintEvent> const & e)
ASSERT ( m_renderPolicy, () );
Drawer * pDrawer = e->drawer();
- graphics::gl::Screen * pScreen = pDrawer->screen().get();
+ graphics::Screen * pScreen = pDrawer->screen().get();
pScreen->beginFrame();
diff --git a/map/location_state.cpp b/map/location_state.cpp
index d5102d4572..4b976d2186 100644
--- a/map/location_state.cpp
+++ b/map/location_state.cpp
@@ -214,9 +214,9 @@ namespace location
void State::cacheArrowBorder(EState state)
{
- graphics::gl::Screen * cacheScreen = m_controller->GetCacheScreen();
+ graphics::Screen * cacheScreen = m_controller->GetCacheScreen();
- shared_ptr<graphics::gl::DisplayList> & dl = m_arrowBorderLists[state];
+ shared_ptr<graphics::DisplayList> & dl = m_arrowBorderLists[state];
dl.reset();
dl.reset(cacheScreen->createDisplayList());
@@ -250,9 +250,9 @@ namespace location
void State::cacheArrowBody(EState state)
{
- graphics::gl::Screen * cacheScreen = m_controller->GetCacheScreen();
+ graphics::Screen * cacheScreen = m_controller->GetCacheScreen();
- shared_ptr<graphics::gl::DisplayList> & dl = m_arrowBodyLists[state];
+ shared_ptr<graphics::DisplayList> & dl = m_arrowBodyLists[state];
dl.reset();
dl.reset(cacheScreen->createDisplayList());
@@ -290,7 +290,7 @@ namespace location
void State::cacheLocationMark()
{
- graphics::gl::Screen * cacheScreen = m_controller->GetCacheScreen();
+ graphics::Screen * cacheScreen = m_controller->GetCacheScreen();
m_locationMarkDL.reset();
m_locationMarkDL.reset(cacheScreen->createDisplayList());
@@ -366,7 +366,7 @@ namespace location
}
}
- void State::draw(graphics::gl::OverlayRenderer * r,
+ void State::draw(graphics::OverlayRenderer * r,
math::Matrix<double, 3, 3> const & m) const
{
if (isVisible())
@@ -395,7 +395,7 @@ namespace location
screenAngle + headingRad),
pivot());
- map<EState, shared_ptr<graphics::gl::DisplayList> >::const_iterator it;
+ map<EState, shared_ptr<graphics::DisplayList> >::const_iterator it;
it = m_arrowBodyLists.find(state());
if (it != m_arrowBodyLists.end())
@@ -429,7 +429,7 @@ namespace location
/// and then arrow border
if (m_hasCompass)
{
- map<EState, shared_ptr<graphics::gl::DisplayList> >::const_iterator it;
+ map<EState, shared_ptr<graphics::DisplayList> >::const_iterator it;
it = m_arrowBorderLists.find(state());
if (it != m_arrowBorderLists.end())
diff --git a/map/location_state.hpp b/map/location_state.hpp
index 538b25218d..c34df1177c 100644
--- a/map/location_state.hpp
+++ b/map/location_state.hpp
@@ -22,10 +22,7 @@ namespace anim
namespace graphics
{
- namespace gl
- {
- class DisplayList;
- }
+ class DisplayList;
}
namespace location
@@ -92,10 +89,10 @@ namespace location
double m_arrowBackHeight;
double m_arrowScale;
- map<EState, shared_ptr<graphics::gl::DisplayList> > m_arrowBodyLists;
- map<EState, shared_ptr<graphics::gl::DisplayList> > m_arrowBorderLists;
- scoped_ptr<graphics::gl::DisplayList> m_locationMarkDL;
- scoped_ptr<graphics::gl::DisplayList> m_positionMarkDL;
+ map<EState, shared_ptr<graphics::DisplayList> > m_arrowBodyLists;
+ map<EState, shared_ptr<graphics::DisplayList> > m_arrowBorderLists;
+ scoped_ptr<graphics::DisplayList> m_locationMarkDL;
+ scoped_ptr<graphics::DisplayList> m_positionMarkDL;
/// @}
@@ -177,8 +174,7 @@ namespace location
/// graphics::OverlayElement and gui::Element related methods
// @{
vector<m2::AnyRectD> const & boundRects() const;
- void draw(graphics::gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
- bool roughHitTest(m2::PointD const & pt) const;
+ void draw(graphics::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
bool hitTest(m2::PointD const & pt) const;
bool onTapEnded(m2::PointD const & p);
/// @}
diff --git a/map/qgl_render_context.hpp b/map/qgl_render_context.hpp
index bd8c788e6d..0e091443a5 100644
--- a/map/qgl_render_context.hpp
+++ b/map/qgl_render_context.hpp
@@ -1,10 +1,9 @@
#pragma once
-#include "../graphics/rendercontext.hpp"
+#include "../graphics/opengl/rendercontext.hpp"
#include "../std/shared_ptr.hpp"
-
class QWidget;
class QGLContext;
class QGLWidget;
diff --git a/map/queued_renderer.cpp b/map/queued_renderer.cpp
index 3931ec181e..9134347ba3 100644
--- a/map/queued_renderer.cpp
+++ b/map/queued_renderer.cpp
@@ -1,5 +1,6 @@
#include "queued_renderer.hpp"
-#include "../graphics/internal/opengl.hpp"
+
+#include "../graphics/opengl/opengl.hpp"
QueuedRenderer::QueuedRenderer(int pipelinesCount)
{
@@ -87,12 +88,12 @@ bool QueuedRenderer::RenderQueuedCommands(int pipelineNum)
cmdProcessed = m_Pipelines[pipelineNum].m_FrameCommands.size();
- list<graphics::gl::Packet>::iterator it;
+ list<graphics::Packet>::iterator it;
bool res = !m_Pipelines[pipelineNum].m_FrameCommands.empty();
bool partialExecution = m_Pipelines[pipelineNum].m_CouldExecutePartially;
- graphics::gl::Packet::EType bucketType = m_Pipelines[pipelineNum].m_Type;
+ graphics::Packet::EType bucketType = m_Pipelines[pipelineNum].m_Type;
while (!m_Pipelines[pipelineNum].m_FrameCommands.empty())
{
@@ -100,20 +101,20 @@ bool QueuedRenderer::RenderQueuedCommands(int pipelineNum)
if (it->m_command)
it->m_command->setIsDebugging(m_IsDebugging);
- if (bucketType == graphics::gl::Packet::ECancelPoint)
+ if (bucketType == graphics::Packet::ECancelPoint)
{
if (it->m_command)
it->m_command->cancel();
}
else
{
- ASSERT(bucketType == graphics::gl::Packet::EFramePoint, ());
+ ASSERT(bucketType == graphics::Packet::EFramePoint, ());
if (it->m_command)
it->m_command->perform();
}
- bool isCheckpoint = (it->m_type == graphics::gl::Packet::ECheckPoint);
+ bool isCheckpoint = (it->m_type == graphics::Packet::ECheckPoint);
m_Pipelines[pipelineNum].m_FrameCommands.pop_front();
@@ -136,24 +137,24 @@ bool QueuedRenderer::RenderQueuedCommands(int pipelineNum)
// graphics::gl::g_doLogOGLCalls = false;
}
-void QueuedRenderer::PacketsPipeline::FillFrameCommands(list<graphics::gl::Packet> & renderQueue, int maxFrames)
+void QueuedRenderer::PacketsPipeline::FillFrameCommands(list<graphics::Packet> & renderQueue, int maxFrames)
{
ASSERT(m_FrameCommands.empty(), ());
/// searching for "delimiter" markers
- list<graphics::gl::Packet>::iterator first = renderQueue.begin();
- list<graphics::gl::Packet>::iterator last = renderQueue.begin();
+ list<graphics::Packet>::iterator first = renderQueue.begin();
+ list<graphics::Packet>::iterator last = renderQueue.begin();
/// checking whether there are a CancelPoint packet in the queue.
/// In this case - fill m_FrameCommands till this packet
- for (list<graphics::gl::Packet>::iterator it = renderQueue.begin();
+ for (list<graphics::Packet>::iterator it = renderQueue.begin();
it != renderQueue.end();
++it)
{
- graphics::gl::Packet p = *it;
- if (p.m_type == graphics::gl::Packet::ECancelPoint)
+ graphics::Packet p = *it;
+ if (p.m_type == graphics::Packet::ECancelPoint)
{
copy(first, ++it, back_inserter(m_FrameCommands));
renderQueue.erase(first, it);
@@ -170,9 +171,9 @@ void QueuedRenderer::PacketsPipeline::FillFrameCommands(list<graphics::gl::Packe
while ((framesLeft != 0) && (packetsLeft != 0) && (last != renderQueue.end()))
{
- graphics::gl::Packet p = *last;
+ graphics::Packet p = *last;
- if (p.m_type == graphics::gl::Packet::EFramePoint)
+ if (p.m_type == graphics::Packet::EFramePoint)
{
/// found frame boundary, copying
copy(first, ++last, back_inserter(m_FrameCommands));
@@ -190,7 +191,7 @@ void QueuedRenderer::PacketsPipeline::FillFrameCommands(list<graphics::gl::Packe
}
}
-void QueuedRenderer::CopyQueuedCommands(list<graphics::gl::Packet> &l, list<graphics::gl::Packet> &r)
+void QueuedRenderer::CopyQueuedCommands(list<graphics::Packet> &l, list<graphics::Packet> &r)
{
swap(l, r);
}
@@ -202,20 +203,20 @@ void QueuedRenderer::CancelQueuedCommands(int pipelineNum)
m_Pipelines[pipelineNum].m_Queue.cancel();
- list<graphics::gl::Packet> l;
+ list<graphics::Packet> l;
m_Pipelines[pipelineNum].m_Queue.processList(bind(&QueuedRenderer::CopyQueuedCommands, this, _1, ref(l)));
- for (list<graphics::gl::Packet>::iterator it = l.begin(); it != l.end(); ++it)
+ for (list<graphics::Packet>::iterator it = l.begin(); it != l.end(); ++it)
{
- graphics::gl::Packet p = *it;
+ graphics::Packet p = *it;
if (p.m_command)
p.m_command->cancel();
}
}
-graphics::gl::PacketsQueue * QueuedRenderer::GetPacketsQueue(int pipelineNum)
+graphics::PacketsQueue * QueuedRenderer::GetPacketsQueue(int pipelineNum)
{
return &m_Pipelines[pipelineNum].m_Queue;
}
diff --git a/map/queued_renderer.hpp b/map/queued_renderer.hpp
index 63fcda5cc8..0e7306a950 100644
--- a/map/queued_renderer.hpp
+++ b/map/queued_renderer.hpp
@@ -1,7 +1,7 @@
#pragma once
#include "../base/threaded_list.hpp"
-#include "../graphics/renderer.hpp"
+#include "../graphics/opengl/renderer.hpp"
/// Mixture-class for rendering policies, used on the
/// devices that do not support OpenGL context sharing
@@ -15,9 +15,9 @@ private:
/// of "heavy" commands.
struct PacketsPipeline
{
- graphics::gl::PacketsQueue m_Queue; //< all enqueued commands
- list<graphics::gl::Packet> m_FrameCommands; //< list of commands to execute on current frame
- graphics::gl::Packet::EType m_Type; //< type of the actions to perform with FrameCommands
+ graphics::PacketsQueue m_Queue; //< all enqueued commands
+ list<graphics::Packet> m_FrameCommands; //< list of commands to execute on current frame
+ graphics::Packet::EType m_Type; //< type of the actions to perform with FrameCommands
bool m_CouldExecutePartially;
@@ -26,10 +26,10 @@ private:
/// skipping empty frames.
/// - if there are a CancelPoint in the QueueData than the packets are copied up to
/// CancelPoint packet ignoring maxCheckPoints param
- void FillFrameCommands(list<graphics::gl::Packet> & QueueData, int maxCheckPoints);
+ void FillFrameCommands(list<graphics::Packet> & QueueData, int maxCheckPoints);
};
- /// couldn't use vector here as PacketsPipeline holds non-copyable graphics::gl::PacketsQueue
+ /// couldn't use vector here as PacketsPipeline holds non-copyable graphics::PacketsQueue
PacketsPipeline * m_Pipelines;
int m_PipelinesCount;
@@ -50,7 +50,7 @@ public:
QueuedRenderer(int pipelinesCount);
~QueuedRenderer();
- void CopyQueuedCommands(list<graphics::gl::Packet> & l, list<graphics::gl::Packet> & r);
+ void CopyQueuedCommands(list<graphics::Packet> & l, list<graphics::Packet> & r);
bool RenderQueuedCommands(int pipelineNum);
void CancelQueuedCommands(int pipelineNum);
@@ -64,5 +64,5 @@ public:
bool NeedRedraw() const;
void SetSinglePipelineProcessing(bool flag);
- graphics::gl::PacketsQueue * GetPacketsQueue(int pipelineNum);
+ graphics::PacketsQueue * GetPacketsQueue(int pipelineNum);
};
diff --git a/map/render_policy.cpp b/map/render_policy.cpp
index 9105860d30..467662d556 100644
--- a/map/render_policy.cpp
+++ b/map/render_policy.cpp
@@ -10,7 +10,7 @@
#include "../anim/controller.hpp"
#include "../anim/task.hpp"
-#include "../graphics/internal/opengl.hpp"
+#include "../graphics/opengl/opengl.hpp"
#include "../graphics/skin.hpp"
#include "../indexer/scales.hpp"
@@ -46,7 +46,7 @@ RenderPolicy::RenderPolicy(Params const & p,
void RenderPolicy::InitCacheScreen()
{
- graphics::gl::Screen::Params cp;
+ graphics::Screen::Params cp;
cp.m_doUnbindRT = false;
cp.m_glyphCacheID = m_resourceManager->guiThreadGlyphCacheID();
@@ -54,7 +54,7 @@ void RenderPolicy::InitCacheScreen()
cp.m_isSynchronized = false;
cp.m_resourceManager = m_resourceManager;
- m_cacheScreen = make_shared_ptr(new graphics::gl::Screen(cp));
+ m_cacheScreen = make_shared_ptr(new graphics::Screen(cp));
m_cacheScreen->setSkin(m_skin);
}
@@ -257,7 +257,7 @@ graphics::Color const RenderPolicy::GetBgColor() const
return m_bgColor;
}
-shared_ptr<graphics::gl::Screen> const & RenderPolicy::GetCacheScreen() const
+shared_ptr<graphics::Screen> const & RenderPolicy::GetCacheScreen() const
{
return m_cacheScreen;
}
diff --git a/map/render_policy.hpp b/map/render_policy.hpp
index e5360e3096..34eed05765 100644
--- a/map/render_policy.hpp
+++ b/map/render_policy.hpp
@@ -57,7 +57,7 @@ protected:
graphics::Color m_bgColor;
shared_ptr<graphics::ResourceManager> m_resourceManager;
shared_ptr<graphics::Skin> m_skin;
- shared_ptr<graphics::gl::Screen> m_cacheScreen;
+ shared_ptr<graphics::Screen> m_cacheScreen;
shared_ptr<graphics::gl::RenderContext> m_primaryRC;
shared_ptr<WindowHandle> m_windowHandle;
shared_ptr<Drawer> m_drawer;
@@ -155,7 +155,7 @@ public:
virtual shared_ptr<graphics::Overlay> const GetOverlay() const;
graphics::Color const GetBgColor() const;
- shared_ptr<graphics::gl::Screen> const & GetCacheScreen() const;
+ shared_ptr<graphics::Screen> const & GetCacheScreen() const;
virtual void SetSkin(shared_ptr<graphics::Skin> const & skin);
shared_ptr<graphics::Skin> const & GetSkin() const;
diff --git a/map/ruler.cpp b/map/ruler.cpp
index e545cd607a..be0a1290f1 100644
--- a/map/ruler.cpp
+++ b/map/ruler.cpp
@@ -268,7 +268,7 @@ vector<m2::AnyRectD> const & Ruler::boundRects() const
return m_boundRects;
}
-void Ruler::draw(graphics::gl::OverlayRenderer * s, math::Matrix<double, 3, 3> const & m) const
+void Ruler::draw(graphics::OverlayRenderer * s, math::Matrix<double, 3, 3> const & m) const
{
if (m_isInitialized)
{
diff --git a/map/ruler.hpp b/map/ruler.hpp
index e9d696a572..5b7983a9a8 100644
--- a/map/ruler.hpp
+++ b/map/ruler.hpp
@@ -78,7 +78,7 @@ public:
vector<m2::AnyRectD> const & boundRects() const;
- void draw(graphics::gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
+ void draw(graphics::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
int visualRank() const;
graphics::OverlayElement * clone(math::Matrix<double, 3, 3> const & m) const;
diff --git a/map/screen_coverage.cpp b/map/screen_coverage.cpp
index 1049f5d881..f12ea2b379 100644
--- a/map/screen_coverage.cpp
+++ b/map/screen_coverage.cpp
@@ -11,7 +11,7 @@
#include "../graphics/screen.hpp"
#include "../graphics/display_list.hpp"
#include "../graphics/skin.hpp"
-#include "../graphics/base_texture.hpp"
+#include "../graphics/opengl/base_texture.hpp"
#include "screen_coverage.hpp"
#include "tile_renderer.hpp"
@@ -30,7 +30,7 @@ ScreenCoverage::ScreenCoverage()
ScreenCoverage::ScreenCoverage(TileRenderer * tileRenderer,
CoverageGenerator * coverageGenerator,
- shared_ptr<graphics::gl::Screen> const & cacheScreen)
+ shared_ptr<graphics::Screen> const & cacheScreen)
: m_tileRenderer(tileRenderer),
m_coverageGenerator(coverageGenerator),
m_overlay(new graphics::Overlay()),
@@ -178,7 +178,7 @@ bool ScreenCoverage::Cache(core::CommandsQueue::Environment const & env)
m_cacheScreen->beginFrame();
m_cacheScreen->setDisplayList(m_primaryDL.get());
- vector<graphics::gl::BlitInfo> infos;
+ vector<graphics::BlitInfo> infos;
for (TTileSet::const_iterator it = m_tiles.begin(); it != m_tiles.end(); ++it)
{
@@ -187,7 +187,7 @@ bool ScreenCoverage::Cache(core::CommandsQueue::Environment const & env)
size_t tileWidth = tile->m_renderTarget->width();
size_t tileHeight = tile->m_renderTarget->height();
- graphics::gl::BlitInfo bi;
+ graphics::BlitInfo bi;
bi.m_matrix = tile->m_tileScreen.PtoGMatrix() * m_screen.GtoPMatrix();
bi.m_srcRect = m2::RectI(0, 0, tileWidth - 2, tileHeight - 2);
@@ -412,7 +412,7 @@ ScreenCoverage::~ScreenCoverage()
Clear();
}
-void ScreenCoverage::Draw(graphics::gl::Screen * s, ScreenBase const & screen)
+void ScreenCoverage::Draw(graphics::Screen * s, ScreenBase const & screen)
{
math::Matrix<double, 3, 3> m = m_screen.PtoGMatrix() * screen.GtoPMatrix();
diff --git a/map/screen_coverage.hpp b/map/screen_coverage.hpp
index cf5ed32f15..8c058ce678 100644
--- a/map/screen_coverage.hpp
+++ b/map/screen_coverage.hpp
@@ -68,12 +68,12 @@ private:
/// quick check.
int m_leafTilesToRender;
/// Screen, which is used for caching of this ScreenCoverage into DisplayList
- shared_ptr<graphics::gl::Screen> m_cacheScreen;
+ shared_ptr<graphics::Screen> m_cacheScreen;
/// DisplayList which holds cached ScreenCoverage
- shared_ptr<graphics::gl::DisplayList> m_primaryDL;
+ shared_ptr<graphics::DisplayList> m_primaryDL;
/// DisplayList to cache all straight texts.
/// They are drawn with different shader.
- shared_ptr<graphics::gl::DisplayList> m_sharpTextDL;
+ shared_ptr<graphics::DisplayList> m_sharpTextDL;
/// Direct copying is prohibited.
ScreenCoverage(ScreenCoverage const & src);
@@ -89,7 +89,7 @@ public:
/// Constructor
ScreenCoverage(TileRenderer * tileRenderer,
CoverageGenerator * coverageGenerator,
- shared_ptr<graphics::gl::Screen> const & cacheScreen);
+ shared_ptr<graphics::Screen> const & cacheScreen);
/// Destructor
~ScreenCoverage();
/// Copy all needed information into specified ScreenCoverage
@@ -124,7 +124,7 @@ public:
/// recalculate screen coverage, using as much info from prev coverage as possible
void SetScreen(ScreenBase const & screen);
/// draw screen coverage
- void Draw(graphics::gl::Screen * s, ScreenBase const & currentScreen);
+ void Draw(graphics::Screen * s, ScreenBase const & currentScreen);
/// get draw scale for the tiles in the current coverage
/// Not all tiles in coverage could correspond to this value,
/// as there could be tiles from lower and higher level in the
diff --git a/map/simple_render_policy.cpp b/map/simple_render_policy.cpp
index 92c29e880b..29a0644909 100644
--- a/map/simple_render_policy.cpp
+++ b/map/simple_render_policy.cpp
@@ -2,8 +2,9 @@
#include "events.hpp"
#include "drawer.hpp"
#include "window_handle.hpp"
+
#include "../graphics/overlay.hpp"
-#include "../graphics/internal/opengl.hpp"
+#include "../graphics/opengl/opengl.hpp"
#include "../graphics/skin.hpp"
#include "../indexer/scales.hpp"
diff --git a/map/test_render_policy.cpp b/map/test_render_policy.cpp
index 2e5435db5d..1cdfd9d731 100644
--- a/map/test_render_policy.cpp
+++ b/map/test_render_policy.cpp
@@ -3,9 +3,9 @@
#include "drawer.hpp"
#include "window_handle.hpp"
-#include "../graphics/base_texture.hpp"
-#include "../graphics/internal/opengl.hpp"
-#include "../graphics/utils.hpp"
+#include "../graphics/opengl/base_texture.hpp"
+#include "../graphics/opengl/opengl.hpp"
+#include "../graphics/opengl/utils.hpp"
#include "../graphics/skin.hpp"
#include "../geometry/screenbase.hpp"
@@ -171,10 +171,10 @@ void TestRenderPolicy::DrawFrame(shared_ptr<PaintEvent> const & e,
OGLCHECK(glClear(GL_COLOR_BUFFER_BIT));*/
- shared_ptr<Blitter::IMMDrawTexturedRect> immDrawTexturedRect;
+ shared_ptr<GeometryRenderer::IMMDrawTexturedRect> immDrawTexturedRect;
immDrawTexturedRect.reset(
- new Blitter::IMMDrawTexturedRect(m2::RectF(0, 0, m_backBuffer->width(), m_backBuffer->height()),
+ new GeometryRenderer::IMMDrawTexturedRect(m2::RectF(0, 0, m_backBuffer->width(), m_backBuffer->height()),
m2::RectF(0, 0, 1, 1),
m_backBuffer,
m_resourceManager));
@@ -204,7 +204,7 @@ void TestRenderPolicy::DrawFrame(shared_ptr<PaintEvent> const & e,
OGLCHECK(glClear(GL_COLOR_BUFFER_BIT));*/
immDrawTexturedRect.reset(
- new Blitter::IMMDrawTexturedRect(m2::RectF(0, 0, m_backBuffer->width(), m_backBuffer->height()),
+ new GeometryRenderer::IMMDrawTexturedRect(m2::RectF(0, 0, m_backBuffer->width(), m_backBuffer->height()),
m2::RectF(0, 0, 1, 1),
m_backBuffer,
m_resourceManager));
@@ -222,7 +222,7 @@ void TestRenderPolicy::DrawFrame(shared_ptr<PaintEvent> const & e,
OGLCHECK(glFramebufferTexture2DFn(GL_FRAMEBUFFER_MWM, GL_COLOR_ATTACHMENT0_MWM, GL_TEXTURE_2D, m_actualTarget->id(), 0));
immDrawTexturedRect.reset(
- new Blitter::IMMDrawTexturedRect(m2::RectF(0, 0, m_backBuffer->width(), m_backBuffer->height()),
+ new GeometryRenderer::IMMDrawTexturedRect(m2::RectF(0, 0, m_backBuffer->width(), m_backBuffer->height()),
m2::RectF(0, 0, 1, 1),
m_backBuffer,
m_resourceManager));
diff --git a/map/test_render_policy.hpp b/map/test_render_policy.hpp
index 77e963bcbd..7fe445a2f5 100644
--- a/map/test_render_policy.hpp
+++ b/map/test_render_policy.hpp
@@ -13,8 +13,8 @@ private:
shared_ptr<graphics::gl::BaseTexture> m_actualTarget;
shared_ptr<graphics::gl::BaseTexture> m_backBuffer;
- shared_ptr<graphics::gl::Screen> m_auxScreen;
- shared_ptr<graphics::gl::Screen> m_drawerScreen;
+ shared_ptr<graphics::Screen> m_auxScreen;
+ shared_ptr<graphics::Screen> m_drawerScreen;
bool m_hasScreen;
ScreenBase m_screen;
diff --git a/map/tile.cpp b/map/tile.cpp
index 961d0a1d35..9a08bcd5d6 100644
--- a/map/tile.cpp
+++ b/map/tile.cpp
@@ -1,8 +1,6 @@
-#include "../base/SRC_FIRST.hpp"
-
#include "tile.hpp"
-#include "../graphics/base_texture.hpp"
+#include "../graphics/opengl/base_texture.hpp"
Tile::Tile()
{}
diff --git a/map/tile_renderer.cpp b/map/tile_renderer.cpp
index 798c24b9a0..8367e6c118 100644
--- a/map/tile_renderer.cpp
+++ b/map/tile_renderer.cpp
@@ -3,9 +3,10 @@
#include "tile_renderer.hpp"
#include "window_handle.hpp"
-#include "../graphics/internal/opengl.hpp"
-#include "../graphics/rendercontext.hpp"
-#include "../graphics/base_texture.hpp"
+#include "../graphics/opengl/opengl.hpp"
+#include "../graphics/opengl/rendercontext.hpp"
+#include "../graphics/opengl/base_texture.hpp"
+
#include "../graphics/packets_queue.hpp"
#include "../graphics/skin.hpp"
@@ -26,7 +27,7 @@ TileRenderer::TileRenderer(
shared_ptr<graphics::gl::RenderContext> const & primaryRC,
shared_ptr<graphics::ResourceManager> const & rm,
double visualScale,
- graphics::gl::PacketsQueue ** packetsQueues
+ graphics::PacketsQueue ** packetsQueues
) : m_queue(executorsCount),
m_tileSize(tileSize),
m_renderFn(renderFn),
@@ -115,7 +116,7 @@ void TileRenderer::FinalizeThreadGL(core::CommandsQueue::Environment const & env
threadData.m_renderContext->endThreadDrawing();
}
-void TileRenderer::ReadPixels(graphics::gl::PacketsQueue * glQueue, core::CommandsQueue::Environment const & env)
+void TileRenderer::ReadPixels(graphics::PacketsQueue * glQueue, core::CommandsQueue::Environment const & env)
{
ThreadData & threadData = m_threadData[env.threadNum()];
@@ -123,7 +124,7 @@ void TileRenderer::ReadPixels(graphics::gl::PacketsQueue * glQueue, core::Comman
if (glQueue)
{
- glQueue->processFn(bind(&TileRenderer::ReadPixels, this, (graphics::gl::PacketsQueue*)0, ref(env)), true);
+ glQueue->processFn(bind(&TileRenderer::ReadPixels, this, (graphics::PacketsQueue*)0, ref(env)), true);
return;
}
@@ -154,7 +155,7 @@ void TileRenderer::DrawTile(core::CommandsQueue::Environment const & env,
ThreadData & threadData = m_threadData[env.threadNum()];
- graphics::gl::PacketsQueue * glQueue = threadData.m_drawerParams.m_renderQueue;
+ graphics::PacketsQueue * glQueue = threadData.m_drawerParams.m_renderQueue;
Drawer * drawer = threadData.m_drawer;
diff --git a/map/tile_renderer.hpp b/map/tile_renderer.hpp
index 7664176efc..96e6d97b3f 100644
--- a/map/tile_renderer.hpp
+++ b/map/tile_renderer.hpp
@@ -18,10 +18,11 @@
namespace graphics
{
class ResourceManager;
+ class PacketsQueue;
+
namespace gl
{
class RenderContext;
- class PacketsQueue;
}
}
@@ -77,7 +78,7 @@ protected:
Tiler::RectInfo const & rectInfo,
int sequenceID);
- void ReadPixels(graphics::gl::PacketsQueue * glQueue, core::CommandsQueue::Environment const & env);
+ void ReadPixels(graphics::PacketsQueue * glQueue, core::CommandsQueue::Environment const & env);
public:
@@ -90,7 +91,7 @@ public:
shared_ptr<graphics::gl::RenderContext> const & primaryRC,
shared_ptr<graphics::ResourceManager> const & rm,
double visualScale,
- graphics::gl::PacketsQueue ** packetsQueue);
+ graphics::PacketsQueue ** packetsQueue);
/// destructor.
virtual ~TileRenderer();
/// add command to the commands queue.
diff --git a/map/tiling_render_policy_mt.cpp b/map/tiling_render_policy_mt.cpp
index a8273f1f5f..ae78ea5688 100644
--- a/map/tiling_render_policy_mt.cpp
+++ b/map/tiling_render_policy_mt.cpp
@@ -2,7 +2,6 @@
#include "../platform/platform.hpp"
-#include "../graphics/internal/opengl.hpp"
#include "../graphics/skin.hpp"
#include "window_handle.hpp"
diff --git a/map/tiling_render_policy_st.cpp b/map/tiling_render_policy_st.cpp
index db746b94e0..bf8a58babf 100644
--- a/map/tiling_render_policy_st.cpp
+++ b/map/tiling_render_policy_st.cpp
@@ -2,7 +2,7 @@
#include "../platform/platform.hpp"
-#include "../graphics/internal/opengl.hpp"
+#include "../graphics/opengl/opengl.hpp"
#include "../graphics/skin.hpp"
#include "window_handle.hpp"
@@ -216,7 +216,7 @@ void TilingRenderPolicyST::SetRenderFn(TRenderFn renderFn)
int cpuCores = GetPlatform().CpuCores();
string skinName = SkinName();
- graphics::gl::PacketsQueue ** queues = new graphics::gl::PacketsQueue*[cpuCores];
+ graphics::PacketsQueue ** queues = new graphics::PacketsQueue*[cpuCores];
for (unsigned i = 0; i < cpuCores; ++i)
queues[i] = m_QueuedRenderer->GetPacketsQueue(i);
diff --git a/qt/draw_widget.cpp b/qt/draw_widget.cpp
index 3da8b3b89a..e3bc358084 100644
--- a/qt/draw_widget.cpp
+++ b/qt/draw_widget.cpp
@@ -6,7 +6,7 @@
#include "../gui/controller.hpp"
-#include "../graphics/internal/opengl.hpp"
+#include "../graphics/opengl/opengl.hpp"
#include "../platform/settings.hpp"
#include "../platform/platform.hpp"
diff --git a/qt_tstfrm/macros.hpp b/qt_tstfrm/macros.hpp
index fc249faf64..5e8f4696ea 100644
--- a/qt_tstfrm/macros.hpp
+++ b/qt_tstfrm/macros.hpp
@@ -109,7 +109,7 @@ class GLTestWidget : public tst::GLDrawWidget
public:
- virtual void DoDraw(shared_ptr<graphics::gl::Screen> p)
+ virtual void DoDraw(shared_ptr<graphics::Screen> p)
{
test.DoDraw(p);
}
diff --git a/qt_tstfrm/tstwidgets.cpp b/qt_tstfrm/tstwidgets.cpp
index 7d6ab3a293..ea87ed7bb8 100644
--- a/qt_tstfrm/tstwidgets.cpp
+++ b/qt_tstfrm/tstwidgets.cpp
@@ -3,17 +3,18 @@
#include "screen_qt.hpp"
#include "../graphics/screen.hpp"
-#include "../graphics/utils.hpp"
#include "../graphics/skin.hpp"
-#include "../graphics/framebuffer.hpp"
-#include "../graphics/renderbuffer.hpp"
#include "../graphics/resource_manager.hpp"
-#include "../graphics/internal/opengl.hpp"
+
+#include "../graphics/opengl/utils.hpp"
+#include "../graphics/opengl/framebuffer.hpp"
+#include "../graphics/opengl/renderbuffer.hpp"
+#include "../graphics/opengl/opengl.hpp"
#include "../platform/platform.hpp"
-template class qt::GLDrawWidgetT<graphics::gl::Screen>;
+template class qt::GLDrawWidgetT<graphics::Screen>;
namespace tst {
@@ -141,7 +142,7 @@ void GLDrawWidget::initializeGL()
params.m_frameBuffer = m_frameBuffer;
params.m_glyphCacheID = m_resourceManager->guiThreadGlyphCacheID();
- m_p = make_shared_ptr(new graphics::gl::Screen(params));
+ m_p = make_shared_ptr(new graphics::Screen(params));
m_primaryFrameBuffer = make_shared_ptr(new graphics::gl::FrameBuffer(true));
@@ -149,7 +150,7 @@ void GLDrawWidget::initializeGL()
m_p->setSkin(m_skin);
params.m_frameBuffer = m_primaryFrameBuffer;
- m_primaryScreen = make_shared_ptr(new graphics::gl::Screen(params));
+ m_primaryScreen = make_shared_ptr(new graphics::Screen(params));
}
void GLDrawWidget::resizeGL(int w, int h)
diff --git a/qt_tstfrm/tstwidgets.hpp b/qt_tstfrm/tstwidgets.hpp
index 93a4f62b33..a55e0680e3 100644
--- a/qt_tstfrm/tstwidgets.hpp
+++ b/qt_tstfrm/tstwidgets.hpp
@@ -2,9 +2,11 @@
#include "widgets.hpp"
-#include "../graphics/texture.hpp"
+#include "../graphics/opengl/texture.hpp"
+#include "../graphics/opengl/renderbuffer.hpp"
+
#include "../graphics/resource_manager.hpp"
-#include "../graphics/renderbuffer.hpp"
+
#include "../map/drawer.hpp"
#include "../map/qgl_render_context.hpp"
@@ -24,10 +26,10 @@ namespace qt { class Screen; }
namespace tst
{
- class GLDrawWidget : public qt::GLDrawWidgetT<graphics::gl::Screen>
+ class GLDrawWidget : public qt::GLDrawWidgetT<graphics::Screen>
{
protected:
- typedef qt::GLDrawWidgetT<graphics::gl::Screen> base_type;
+ typedef qt::GLDrawWidgetT<graphics::Screen> base_type;
shared_ptr<graphics::ResourceManager> m_resourceManager;
@@ -37,7 +39,7 @@ namespace tst
shared_ptr<graphics::gl::RenderBuffer> m_depthBuffer;
shared_ptr<graphics::Skin> m_skin;
shared_ptr<qt::gl::RenderContext> m_primaryContext;
- shared_ptr<graphics::gl::Screen> m_primaryScreen;
+ shared_ptr<graphics::Screen> m_primaryScreen;
public: