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:
authorRoman Sorokin <sorok-roma@yandex.ru>2014-09-15 14:00:53 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:27:21 +0300
commit159c7b4b203ed0edc73aa7ce90adc97c016d8da2 (patch)
tree781af9145555ac87fdbbf38fa2b2bb337424792f /drape_frontend
parent72391142132d2316edbe34fef8f0065134ca0530 (diff)
Correct attribute loading for new shaders
Diffstat (limited to 'drape_frontend')
-rw-r--r--drape_frontend/area_shape.cpp35
-rw-r--r--drape_frontend/circle_shape.cpp53
-rw-r--r--drape_frontend/line_shape.cpp38
-rw-r--r--drape_frontend/line_shape.hpp2
-rw-r--r--drape_frontend/path_text_shape.cpp15
-rw-r--r--drape_frontend/text_layout.cpp41
-rw-r--r--drape_frontend/text_layout.hpp7
-rw-r--r--drape_frontend/text_shape.cpp24
8 files changed, 158 insertions, 57 deletions
diff --git a/drape_frontend/area_shape.cpp b/drape_frontend/area_shape.cpp
index 1c44bace34..35a750659c 100644
--- a/drape_frontend/area_shape.cpp
+++ b/drape_frontend/area_shape.cpp
@@ -1,13 +1,20 @@
#include "area_shape.hpp"
+#include "common_structures.hpp"
#include "../drape/shader_def.hpp"
#include "../drape/attribute_provider.hpp"
+#include "../drape/texture_of_colors.hpp"
+#include "../drape/texture_set_holder.hpp"
#include "../std/bind.hpp"
namespace df
{
+using glsl_types::vec2;
+using glsl_types::vec3;
+using glsl_types::vec4;
+
AreaShape::AreaShape(vector<m2::PointF> const & triangleList, AreaViewParams const & params)
: m_params(params)
{
@@ -24,12 +31,23 @@ AreaShape::AreaShape(vector<m2::PointF> const & triangleList, AreaViewParams con
bind(fn, &m_vertexes, bind(&Point3D::From2D, _1, params.m_depth)));
}
-void AreaShape::Draw(dp::RefPointer<dp::Batcher> batcher, dp::RefPointer<dp::TextureSetHolder> /*textures*/) const
+void AreaShape::Draw(dp::RefPointer<dp::Batcher> batcher, dp::RefPointer<dp::TextureSetHolder> textures) const
{
dp::GLState state(gpu::SOLID_AREA_PROGRAM, dp::GLState::GeometryLayer);
- state.SetColor(m_params.m_color);
- dp::AttributeProvider provider(1, m_vertexes.size());
+ dp::ColorKey key;
+ key.m_color = m_params.m_color.GetColorInInt();
+ dp::TextureSetHolder::ColorRegion region;
+ textures->GetColorRegion(key, region);
+ m2::RectF const & rect1 = region.GetTexRect();
+ m2::PointF coord1 = (rect1.RightTop() + rect1.LeftBottom()) * 0.5f;
+ float texIndex = static_cast<float>(region.GetTextureNode().m_textureOffset);
+
+ vector<vec3> colors(m_vertexes.size(), vec3(coord1, texIndex));
+
+ state.SetTextureSet(region.GetTextureNode().m_textureSet);
+
+ dp::AttributeProvider provider(2, m_vertexes.size());
{
dp::BindingInfo info(1);
dp::BindingDecl & decl = info.GetBindingDecl(0);
@@ -41,6 +59,17 @@ void AreaShape::Draw(dp::RefPointer<dp::Batcher> batcher, dp::RefPointer<dp::Tex
provider.InitStream(0, info, dp::MakeStackRefPointer((void *)&m_vertexes[0]));
}
+ {
+ dp::BindingInfo info(1);
+ dp::BindingDecl & decl = info.GetBindingDecl(0);
+ decl.m_attributeName = "a_color_index";
+ decl.m_componentCount = 3;
+ decl.m_componentType = gl_const::GLFloatType;
+ decl.m_offset = 0;
+ decl.m_stride = 0;
+ provider.InitStream(1, info, dp::MakeStackRefPointer((void *)&colors[0]));
+ }
+
batcher->InsertTriangleList(state, dp::MakeStackRefPointer(&provider));
}
diff --git a/drape_frontend/circle_shape.cpp b/drape_frontend/circle_shape.cpp
index af3136bec2..128be770b9 100644
--- a/drape_frontend/circle_shape.cpp
+++ b/drape_frontend/circle_shape.cpp
@@ -1,30 +1,43 @@
#include "circle_shape.hpp"
+#include "common_structures.hpp"
#include "../drape/batcher.hpp"
#include "../drape/attribute_provider.hpp"
#include "../drape/glstate.hpp"
#include "../drape/shader_def.hpp"
+#include "../drape/texture_of_colors.hpp"
+#include "../drape/texture_set_holder.hpp"
#define BLOCK_X_OFFSET 0
#define BLOCK_Y_OFFSET 1
#define BLOCK_Z_OFFSET 2
#define BLOCK_NX_OFFSET 3
#define BLOCK_NY_OFFSET 4
+#define BLOCK_CX_OFFSET 5
+#define BLOCK_CY_OFFSET 6
+#define BLOCK_IND_OFFSET 7
+#define VERTEX_STRIDE 8
namespace df
{
+ using glsl_types::vec2;
+ using glsl_types::vec3;
+ using glsl_types::vec4;
namespace
{
-void AddPoint(vector<float> & stream, size_t pointIndex, float x, float y, float z, float nX, float nY)
+void AddPoint(vector<float> & stream, size_t pointIndex, float x, float y, float z, float nX, float nY, vec3 const & color)
{
- size_t startIndex = pointIndex * 5;
+ size_t startIndex = pointIndex * VERTEX_STRIDE;
stream[startIndex + BLOCK_X_OFFSET] = x;
stream[startIndex + BLOCK_Y_OFFSET] = y;
stream[startIndex + BLOCK_Z_OFFSET] = z;
stream[startIndex + BLOCK_NX_OFFSET] = nX;
stream[startIndex + BLOCK_NY_OFFSET] = nY;
+ stream[startIndex + BLOCK_CX_OFFSET] = color.x;
+ stream[startIndex + BLOCK_CY_OFFSET] = color.y;
+ stream[startIndex + BLOCK_IND_OFFSET] = color.z;
}
} // namespace
@@ -35,44 +48,62 @@ CircleShape::CircleShape(m2::PointF const & mercatorPt, CircleViewParams const &
{
}
-void CircleShape::Draw(dp::RefPointer<dp::Batcher> batcher, dp::RefPointer<dp::TextureSetHolder>) const
+void CircleShape::Draw(dp::RefPointer<dp::Batcher> batcher, dp::RefPointer<dp::TextureSetHolder> textures) const
{
double const TriangleCount = 20.0;
double const etalonSector = (2.0 * math::pi) / TriangleCount;
+ dp::ColorKey key;
+ key.m_color = m_params.m_color.GetColorInInt();
+ dp::TextureSetHolder::ColorRegion region;
+ textures->GetColorRegion(key, region);
+ m2::RectF const & rect1 = region.GetTexRect();
+ m2::PointF coord1 = (rect1.RightTop() + rect1.LeftBottom()) * 0.5f;
+ float texIndex = static_cast<float>(region.GetTextureNode().m_textureOffset);
+
+ vec3 color(coord1, texIndex);
+
/// x, y, z floats on geompoint
/// normal x, y on triangle forming normals
/// 20 triangles on full circle
/// 22 points as triangle fan need n + 2 points on n triangles
- vector<float> stream((3 + 2) * (TriangleCount + 2));
- AddPoint(stream, 0, m_pt.x, m_pt.y, m_params.m_depth, 0.0f, 0.0f);
+
+ vector<float> stream((3 + 2 + 3) * (TriangleCount + 2));
+ AddPoint(stream, 0, m_pt.x, m_pt.y, m_params.m_depth, 0.0f, 0.0f, color);
m2::PointD startNormal(0.0f, m_params.m_radius);
for (size_t i = 0; i < TriangleCount + 1; ++i)
{
m2::PointD rotatedNormal = m2::Rotate(startNormal, (i) * etalonSector);
- AddPoint(stream, i + 1, m_pt.x, m_pt.y, m_params.m_depth, rotatedNormal.x, rotatedNormal.y);
+ AddPoint(stream, i + 1, m_pt.x, m_pt.y, m_params.m_depth, rotatedNormal.x, rotatedNormal.y, color);
}
dp::GLState state(gpu::SOLID_SHAPE_PROGRAM, dp::GLState::OverlayLayer);
- state.SetColor(m_params.m_color);
+ state.SetTextureSet(region.GetTextureNode().m_textureSet);
dp::AttributeProvider provider(1, TriangleCount + 2);
- dp::BindingInfo info(2);
+ dp::BindingInfo info(3);
dp::BindingDecl & posDecl = info.GetBindingDecl(0);
posDecl.m_attributeName = "a_position";
posDecl.m_componentCount = 3;
posDecl.m_componentType = gl_const::GLFloatType;
posDecl.m_offset = 0;
- posDecl.m_stride = 5 * sizeof(float);
+ posDecl.m_stride = VERTEX_STRIDE * sizeof(float);
dp::BindingDecl & normalDecl = info.GetBindingDecl(1);
normalDecl.m_attributeName = "a_normal";
normalDecl.m_componentCount = 2;
normalDecl.m_componentType = gl_const::GLFloatType;
- normalDecl.m_offset = 3 * sizeof(float);
- normalDecl.m_stride = 5 * sizeof(float);
+ normalDecl.m_offset = BLOCK_NX_OFFSET * sizeof(float);
+ normalDecl.m_stride = VERTEX_STRIDE * sizeof(float);
+
+ dp::BindingDecl & colorDecl = info.GetBindingDecl(2);
+ colorDecl.m_attributeName = "a_color_index";
+ colorDecl.m_componentCount = 3;
+ colorDecl.m_componentType = gl_const::GLFloatType;
+ colorDecl.m_offset = BLOCK_CX_OFFSET * sizeof(float);
+ colorDecl.m_stride = VERTEX_STRIDE * sizeof(float);
dp::OverlayHandle * overlay = new dp::SquareHandle(m_params.m_id,
dp::Center, m_pt,
diff --git a/drape_frontend/line_shape.cpp b/drape_frontend/line_shape.cpp
index 00dfecbffe..b20f841b7c 100644
--- a/drape_frontend/line_shape.cpp
+++ b/drape_frontend/line_shape.cpp
@@ -5,6 +5,8 @@
#include "../drape/attribute_provider.hpp"
#include "../drape/glstate.hpp"
#include "../drape/batcher.hpp"
+#include "../drape/texture_of_colors.hpp"
+#include "../drape/texture_set_holder.hpp"
#include "../base/math.hpp"
#include "../base/logging.hpp"
@@ -76,7 +78,7 @@ LineShape::LineShape(vector<m2::PointF> const & points,
m_points = points;
}
-void LineShape::Draw(dp::RefPointer<dp::Batcher> batcher, dp::RefPointer<dp::TextureSetHolder> /*textures*/) const
+void LineShape::Draw(dp::RefPointer<dp::Batcher> batcher, dp::RefPointer<dp::TextureSetHolder> textures) const
{
int size = m_points.size();
float const r = 1.0f;
@@ -173,11 +175,27 @@ void LineShape::Draw(dp::RefPointer<dp::Batcher> batcher, dp::RefPointer<dp::Tex
vertex[baseIdx + 3].y = vertex[baseIdx + 1].y;
}
- vector<vec4> baseColor(numVert, vec4(m_params.m_color));
- vector<vec4> outlineColor(numVert, vec4(0.5f, 0.5f, 0.5f, 1.0f)); /// TODO this color now not using.
+ dp::ColorKey key;
+ dp::Color clr = m_params.m_color;
+ key.m_color = (clr.m_alfa << 24) | (clr.m_blue << 16) | (clr.m_green << 8) | clr.m_red;
+ dp::TextureSetHolder::ColorRegion region;
+ textures->GetColorRegion(key, region);
+ m2::RectF const & rect1 = region.GetTexRect();
+ m2::PointF coord1 = (rect1.RightTop() + rect1.LeftBottom()) * 0.5f;
+ key.m_color = (255 << 24) | (127 << 16) | (127 << 8) | 127;
+ textures->GetColorRegion(key, region);
+ m2::RectF const & rect2 = region.GetTexRect();
+ m2::PointF coord2 = (rect2.RightTop() + rect2.LeftBottom()) * 0.5f;
+ float texIndex = static_cast<float>(region.GetTextureNode().m_textureOffset);
+
+ vector<vec4> colors(numVert, vec4(coord1, coord2));
+ vector<float> index(numVert, texIndex); /// TODO this color now not using.
///We need merge line styles to draw line outline and line by ont pass
dp::GLState state(gpu::SOLID_LINE_PROGRAM, dp::GLState::GeometryLayer);
+ state.SetTextureSet(region.GetTextureNode().m_textureSet);
+ state.SetBlending(dp::Blending(true));
+
dp::AttributeProvider provider(6, 4 * (size - 1));
{
@@ -227,25 +245,25 @@ void LineShape::Draw(dp::RefPointer<dp::Batcher> batcher, dp::RefPointer<dp::Tex
{
dp::BindingInfo clr1(1);
dp::BindingDecl & decl = clr1.GetBindingDecl(0);
- decl.m_attributeName = "color1";
+ decl.m_attributeName = "colors";
decl.m_componentCount = 4;
decl.m_componentType = gl_const::GLFloatType;
decl.m_offset = 0;
decl.m_stride = 0;
- provider.InitStream(4, clr1, dp::MakeStackRefPointer((void*)&baseColor[0]));
+ provider.InitStream(4, clr1, dp::MakeStackRefPointer((void*)&colors[0]));
}
{
- dp::BindingInfo clr2(1);
- dp::BindingDecl & decl = clr2.GetBindingDecl(0);
- decl.m_attributeName = "color2";
- decl.m_componentCount = 4;
+ dp::BindingInfo ind(1);
+ dp::BindingDecl & decl = ind.GetBindingDecl(0);
+ decl.m_attributeName = "index";
+ decl.m_componentCount = 1;
decl.m_componentType = gl_const::GLFloatType;
decl.m_offset = 0;
decl.m_stride = 0;
- provider.InitStream(5, clr2, dp::MakeStackRefPointer((void*)&outlineColor[0]));
+ provider.InitStream(5, ind, dp::MakeStackRefPointer((void*)&index[0]));
}
batcher->InsertListOfStrip(state, dp::MakeStackRefPointer(&provider), 4);
diff --git a/drape_frontend/line_shape.hpp b/drape_frontend/line_shape.hpp
index efc90eb6ed..0923f9e904 100644
--- a/drape_frontend/line_shape.hpp
+++ b/drape_frontend/line_shape.hpp
@@ -16,7 +16,7 @@ public:
LineShape(vector<m2::PointF> const & points,
LineViewParams const & params);
- virtual void Draw(dp::RefPointer<dp::Batcher> batcher, dp::RefPointer<dp::TextureSetHolder> /*textures*/) const;
+ virtual void Draw(dp::RefPointer<dp::Batcher> batcher, dp::RefPointer<dp::TextureSetHolder> textures) const;
float GetWidth() const { return m_params.m_width; }
dp::Color const & GetColor() const { return m_params.m_color; }
diff --git a/drape_frontend/path_text_shape.cpp b/drape_frontend/path_text_shape.cpp
index f9832f0df3..c0c7a495e8 100644
--- a/drape_frontend/path_text_shape.cpp
+++ b/drape_frontend/path_text_shape.cpp
@@ -141,10 +141,11 @@ namespace
vector<glsl_types::vec2> & positions,
vector<glsl_types::Quad4> & texCoord,
vector<glsl_types::Quad4> & fontColor,
- vector<glsl_types::Quad4> & outlineColor)
+ vector<glsl_types::Quad1> & index,
+ dp::RefPointer<dp::TextureSetHolder> textures)
{
ASSERT(!offsets.empty(), ());
- layout->InitPathText(depth, texCoord, fontColor, outlineColor);
+ layout->InitPathText(depth, texCoord, fontColor, index, textures);
dp::GLState state(gpu::PATH_FONT_PROGRAM, dp::GLState::OverlayLayer);
state.SetTextureSet(layout->GetTextureSet());
@@ -186,12 +187,12 @@ namespace
{
dp::BindingInfo outlineColorBind(1);
dp::BindingDecl & decl = outlineColorBind.GetBindingDecl(0);
- decl.m_attributeName = "a_outline_color";
- decl.m_componentCount = 4;
+ decl.m_attributeName = "a_index";
+ decl.m_componentCount = 1;
decl.m_componentType = gl_const::GLFloatType;
decl.m_offset = 0;
decl.m_stride = 0;
- provider.InitStream(3, outlineColorBind, dp::MakeStackRefPointer(&outlineColor[0]));
+ provider.InitStream(3, outlineColorBind, dp::MakeStackRefPointer(&index[0]));
}
dp::OverlayHandle * handle = new PathTextHandle(spline, layout, offsets[i], depth);
@@ -244,7 +245,7 @@ void PathTextShape::Draw(dp::RefPointer<dp::Batcher> batcher, dp::RefPointer<dp:
vector<glsl_types::vec2> positions(glyphCount, vec2(0.0, 0.0));
vector<glsl_types::Quad4> texCoords(glyphCount);
vector<glsl_types::Quad4> fontColor(glyphCount);
- vector<glsl_types::Quad4> outlineColor(glyphCount);
+ vector<glsl_types::Quad1> index(glyphCount);
buffer_vector<float, 32> offsets;
float const scalePtoG = 1.0f / m_scaleGtoP;
@@ -281,7 +282,7 @@ void PathTextShape::Draw(dp::RefPointer<dp::Batcher> batcher, dp::RefPointer<dp:
}
BatchPathText(m_spline, offsets, m_params.m_depth, batcher, layout,
- positions, texCoords, fontColor, outlineColor);
+ positions, texCoords, fontColor, index, textures);
}
}
diff --git a/drape_frontend/text_layout.cpp b/drape_frontend/text_layout.cpp
index b7fe836c21..3d283d9e44 100644
--- a/drape_frontend/text_layout.cpp
+++ b/drape_frontend/text_layout.cpp
@@ -7,15 +7,29 @@
#include "../std/limits.hpp"
using glsl_types::vec4;
+using glsl_types::Quad1;
using glsl_types::Quad4;
namespace
{
- void FillColor(vector<Quad4> & data, dp::Color const & color)
+void FillColor(vector<Quad4> & colors,
+ dp::TextureSetHolder::ColorRegion & region,
+ dp::Color const & base, dp::Color const & outline,
+ dp::RefPointer<dp::TextureSetHolder> textures)
{
- Quad4 c;
- c.v[0] = c.v[1] = c.v[2] = c.v[3] = vec4(dp::ColorF(color));
- fill(data.begin(), data.end(), c);
+ dp::ColorKey key;
+ key.m_color = (base.m_alfa << 24) | (base.m_blue << 16) | (base.m_green << 8) | base.m_red;
+ textures->GetColorRegion(key, region);
+ m2::RectF const & rect1 = region.GetTexRect();
+ m2::PointF coord1 = (rect1.RightTop() + rect1.LeftBottom()) * 0.5f;
+ key.m_color = (outline.m_alfa << 24) | (outline.m_blue << 16) | (outline.m_green << 8) | outline.m_red;
+ textures->GetColorRegion(key, region);
+ m2::RectF const & rect2 = region.GetTexRect();
+ m2::PointF coord2 = (rect2.RightTop() + rect2.LeftBottom()) * 0.5f;
+
+ vec4 clrs(coord1, coord2);
+ Quad4 f(clrs, clrs, clrs, clrs);
+ fill(colors.begin(), colors.end(), f);
}
}
@@ -96,15 +110,18 @@ dp::OverlayHandle * LayoutText(const FeatureID & featureID,
vector<glsl_types::Quad4> & positions,
vector<glsl_types::Quad4> & texCoord,
vector<glsl_types::Quad4> & color,
- vector<glsl_types::Quad4> & index,
+ vector<glsl_types::Quad1> & index,
dp::RefPointer<dp::TextureSetHolder> textures,
int count)
{
STATIC_ASSERT(sizeof(vec4) == 4 * sizeof(float));
STATIC_ASSERT(sizeof(Quad4) == 4 * sizeof(vec4));
- FillColor(color, layoutIter->m_font.m_color);
- FillColor(index,layoutIter->m_font.m_outlineColor);
+ dp::TextureSetHolder::ColorRegion region;
+ FillColor(color, region, layoutIter->m_font.m_color, layoutIter->m_font.m_outlineColor, textures);
+ float texIndex = static_cast<float>(region.GetTextureNode().m_textureOffset);
+ Quad1 f(texIndex, texIndex, texIndex, texIndex);
+ fill(index.begin(), index.end(), f);
int counter = 0;
m2::PointD size(0.0, 0.0);
@@ -161,7 +178,8 @@ dp::OverlayHandle * LayoutText(const FeatureID & featureID,
void TextLayout::InitPathText(float depth,
vector<glsl_types::Quad4> & texCoord,
vector<glsl_types::Quad4> & fontColor,
- vector<glsl_types::Quad4> & index) const
+ vector<glsl_types::Quad1> & index,
+ dp::RefPointer<dp::TextureSetHolder> textures) const
{
STATIC_ASSERT(sizeof(vec4) == 4 * sizeof(float));
STATIC_ASSERT(sizeof(Quad4) == 4 * sizeof(vec4));
@@ -171,8 +189,11 @@ void TextLayout::InitPathText(float depth,
ASSERT(glyphCount <= fontColor.size(), ());
ASSERT(glyphCount <= index.size(), ());
- FillColor(fontColor, m_font.m_color);
- FillColor(index, m_font.m_outlineColor);
+ dp::TextureSetHolder::ColorRegion region;
+ FillColor(fontColor, region, m_font.m_color, m_font.m_outlineColor, textures);
+ float texIndex = static_cast<float>(region.GetTextureNode().m_textureOffset);
+ Quad1 f(texIndex, texIndex, texIndex, texIndex);
+ fill(index.begin(), index.end(), f);
for (size_t i = 0; i < glyphCount; ++i)
GetTextureQuad(m_metrics[i], depth, texCoord[i]);
diff --git a/drape_frontend/text_layout.hpp b/drape_frontend/text_layout.hpp
index 5e4f33c1f2..5079e899a0 100644
--- a/drape_frontend/text_layout.hpp
+++ b/drape_frontend/text_layout.hpp
@@ -30,13 +30,14 @@ public:
void InitPathText(float depth,
vector<glsl_types::Quad4> & texCoord,
vector<glsl_types::Quad4> & fontColor,
- vector<glsl_types::Quad4> & outlineColor) const;
+ vector<glsl_types::Quad1> & index,
+ dp::RefPointer<dp::TextureSetHolder> textures) const;
void LayoutPathText(m2::Spline::iterator const & iterator,
float const scalePtoG,
IntrusiveVector<glsl_types::vec2> & positions,
bool isForwardDirection,
vector<m2::RectF> & rects,
- const ScreenBase & screen) const;
+ ScreenBase const & screen) const;
uint32_t GetGlyphCount() const;
uint32_t GetTextureSet() const;
@@ -63,7 +64,7 @@ private:
vector<glsl_types::Quad4> & positions,
vector<glsl_types::Quad4> & texCoord,
vector<glsl_types::Quad4> & color,
- vector<glsl_types::Quad4> & index,
+ vector<glsl_types::Quad1> & index,
dp::RefPointer<dp::TextureSetHolder> textures,
int count);
};
diff --git a/drape_frontend/text_shape.cpp b/drape_frontend/text_shape.cpp
index 53b4a6e221..1313468f4f 100644
--- a/drape_frontend/text_shape.cpp
+++ b/drape_frontend/text_shape.cpp
@@ -48,15 +48,15 @@ PointF GetShift(dp::Anchor anchor, float width, float height)
void BatchText(dp::RefPointer<dp::Batcher> batcher, int32_t textureSet,
vector<glsl_types::Quad4> const & positions,
vector<glsl_types::Quad4> const & texCoord,
- vector<glsl_types::Quad4> const & fontColors,
- vector<glsl_types::Quad4> const & outlineColor,
+ vector<glsl_types::Quad4> const & color,
+ vector<glsl_types::Quad1> const & index,
size_t glyphCount,
dp::OverlayHandle * handle)
{
ASSERT(glyphCount <= positions.size(), ());
ASSERT(positions.size() == texCoord.size(), ());
- ASSERT(positions.size() == fontColors.size(), ());
- ASSERT(positions.size() == outlineColor.size(), ());
+ ASSERT(positions.size() == color.size(), ());
+ ASSERT(positions.size() == index.size(), ());
dp::GLState state(gpu::FONT_PROGRAM, dp::GLState::OverlayLayer);
state.SetTextureSet(textureSet);
@@ -91,17 +91,17 @@ void BatchText(dp::RefPointer<dp::Batcher> batcher, int32_t textureSet,
decl.m_componentType = gl_const::GLFloatType;
decl.m_offset = 0;
decl.m_stride = 0;
- provider.InitStream(2, base_color, dp::MakeStackRefPointer((void*)&fontColors[0]));
+ provider.InitStream(2, base_color, dp::MakeStackRefPointer((void*)&color[0]));
}
{
dp::BindingInfo outline_color(1);
dp::BindingDecl & decl = outline_color.GetBindingDecl(0);
- decl.m_attributeName = "a_outline_color";
- decl.m_componentCount = 4;
+ decl.m_attributeName = "a_index";
+ decl.m_componentCount = 1;
decl.m_componentType = gl_const::GLFloatType;
decl.m_offset = 0;
decl.m_stride = 0;
- provider.InitStream(3, outline_color, dp::MakeStackRefPointer((void*)&outlineColor[0]));
+ provider.InitStream(3, outline_color, dp::MakeStackRefPointer((void*)&index[0]));
}
batcher->InsertListOfStrip(state, dp::MakeStackRefPointer(&provider), MovePointer(handle), 4);
@@ -260,7 +260,7 @@ void TextShape::DrawMultipleLines(dp::RefPointer<dp::Batcher> batcher, vector<Te
vector<glsl_types::Quad4> positions(symCount);
vector<glsl_types::Quad4> texCoord(symCount);
vector<glsl_types::Quad4> fontColor(symCount);
- vector<glsl_types::Quad4> indexes(symCount);
+ vector<glsl_types::Quad1> indexes(symCount);
float dy = (1.0f - TEXT_EXPAND_FACTOR) * heights[0];
vector<PointF> pixelOffset(count);
@@ -284,9 +284,9 @@ void TextShape::DrawMultipleLines(dp::RefPointer<dp::Batcher> batcher, vector<Te
indexes, textures, i + 1);
BatchText(batcher, layouts[0].GetTextureSet(),
- positions, texCoord,
- fontColor, indexes,
- delSymCount, handle);
+ positions, texCoord,
+ fontColor, indexes,
+ delSymCount, handle);
delSymCount = 0;
lastIndex = i + 1;