From e545e141835511edfab0a46b66bcea03ad0fc773 Mon Sep 17 00:00:00 2001 From: rachytski Date: Fri, 25 May 2012 17:48:54 +0400 Subject: [PATCH] added GeometryBatcher::addTexturedFanStrided. --- yg/geometry_batcher.cpp | 23 ++++++++++++++++++++--- yg/geometry_batcher.hpp | 8 ++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/yg/geometry_batcher.cpp b/yg/geometry_batcher.cpp index dd947c718c..e12de0bf23 100644 --- a/yg/geometry_batcher.cpp +++ b/yg/geometry_batcher.cpp @@ -475,7 +475,22 @@ namespace yg addTexturedFan(coords, texCoords, 4, depth, pipelineID); } - void GeometryBatcher::addTexturedFan(m2::PointF const * coords, m2::PointF const * texCoords, unsigned size, double depth, int pipelineID) + void GeometryBatcher::addTexturedFan(m2::PointF const * coords, + m2::PointF const * texCoords, + unsigned size, + double depth, + int pipelineID) + { + addTexturedFanStrided(coords, sizeof(m2::PointF), texCoords, sizeof(m2::PointF), size, depth, pipelineID); + } + + void GeometryBatcher::addTexturedFanStrided(m2::PointF const * coords, + size_t coordsStride, + m2::PointF const * texCoords, + size_t texCoordsStride, + unsigned size, + double depth, + int pipelineID) { if (!hasRoom(size, (size - 2) * 3, pipelineID)) flush(pipelineID); @@ -493,9 +508,11 @@ namespace yg for (unsigned i = 0; i < size; ++i) { - pipeline.m_vertices[vOffset + i].pt = coords[i]; - pipeline.m_vertices[vOffset + i].tex = texCoords[i]; + pipeline.m_vertices[vOffset + i].pt = *coords; + pipeline.m_vertices[vOffset + i].tex = *texCoords; pipeline.m_vertices[vOffset + i].depth = depth; + coords = reinterpret_cast(reinterpret_cast(coords) + coordsStride); + texCoords = reinterpret_cast(reinterpret_cast(texCoords) + texCoordsStride); } pipeline.m_currentVertex += size; diff --git a/yg/geometry_batcher.hpp b/yg/geometry_batcher.hpp index cb389e0f75..9c40b35371 100644 --- a/yg/geometry_batcher.hpp +++ b/yg/geometry_batcher.hpp @@ -132,6 +132,14 @@ namespace yg double depth, int pipelineID); + void addTexturedFanStrided(m2::PointF const * coords, + size_t coordsStride, + m2::PointF const * texCoords, + size_t texCoordsStride, + unsigned size, + double depth, + int pipelineID); + void addTexturedStripStrided(m2::PointF const * coords, size_t coordsStride, m2::PointF const * texCoords,