forked from organicmaps/organicmaps
Review fixes
This commit is contained in:
parent
ec907e0022
commit
3932f732ee
14 changed files with 100 additions and 174 deletions
|
@ -40,6 +40,7 @@ SOURCES += \
|
|||
font_texture_tests.cpp \
|
||||
bingind_info_tests.cpp \
|
||||
stipple_pen_tests.cpp \
|
||||
texture_of_colors_tests.cpp \
|
||||
|
||||
HEADERS += \
|
||||
glmock_functions.hpp \
|
||||
|
|
|
@ -55,7 +55,7 @@ UNIT_TEST(ColorPalleteMappingTests)
|
|||
{
|
||||
ColorPalette cp(m2::PointU(32, 16));
|
||||
|
||||
dp::ColorKey key;
|
||||
dp::ColorKey key(0);
|
||||
key.SetColor(0);
|
||||
ColorResourceInfo const * info1 = cp.MapResource(key);
|
||||
key.SetColor(1);
|
||||
|
@ -89,7 +89,7 @@ UNIT_TEST(ColorPalleteUploadingTests1)
|
|||
ColorPalette cp(m2::PointU(width, height));
|
||||
cp.UploadResources(MakeStackRefPointer<Texture>(&texture));
|
||||
|
||||
dp::ColorKey key;
|
||||
dp::ColorKey key(0);
|
||||
key.SetColor(0);
|
||||
cp.MapResource(key);
|
||||
key.SetColor(1);
|
||||
|
@ -158,7 +158,7 @@ UNIT_TEST(ColorPalleteUploadingTests2)
|
|||
InitOpenGLTextures(width, height);
|
||||
|
||||
SimpleTexture texture;
|
||||
dp::ColorKey key;
|
||||
dp::ColorKey key(0);
|
||||
texture.Create(width, height, dp::RGBA8);
|
||||
ColorPalette cp(m2::PointU(width, height));
|
||||
|
||||
|
|
|
@ -26,11 +26,11 @@ public:
|
|||
|
||||
virtual void UpdateState()
|
||||
{
|
||||
this->Bind();
|
||||
Bind();
|
||||
m_indexer.UploadResources(MakeStackRefPointer<Texture>(this));
|
||||
}
|
||||
|
||||
public:
|
||||
private:
|
||||
mutable TIndexer m_indexer;
|
||||
};
|
||||
|
||||
|
|
|
@ -11,13 +11,8 @@ const lowp float OUTLINE_MAX_VALUE1 = 0.95;
|
|||
const lowp float GLYPH_MIN_VALUE = 0.45;
|
||||
const lowp float GLYPH_MAX_VALUE = 0.6;
|
||||
|
||||
lowp vec4 colorize(lowp vec4 baseColor)
|
||||
lowp vec4 colorize(lowp vec4 base, lowp vec4 outline, lowp float alpha)
|
||||
{
|
||||
int textureIndex = int(v_index);
|
||||
lowp vec4 outline = getTexel(textureIndex, v_colors.zw);
|
||||
lowp vec4 base = getTexel(textureIndex, v_colors.xy);
|
||||
lowp float alpha = 1.0 - baseColor.a;
|
||||
|
||||
if (alpha > OUTLINE_MAX_VALUE1)
|
||||
return vec4(outline.rgb, 0);
|
||||
if (alpha > OUTLINE_MAX_VALUE0)
|
||||
|
@ -37,12 +32,8 @@ lowp vec4 colorize(lowp vec4 baseColor)
|
|||
return base;
|
||||
}
|
||||
|
||||
lowp vec4 without_outline(lowp vec4 baseColor)
|
||||
lowp vec4 without_outline(lowp vec4 base, lowp float alpha)
|
||||
{
|
||||
int textureIndex = int(v_index);
|
||||
lowp vec4 base = getTexel(textureIndex, v_colors.xy);
|
||||
lowp float alpha = 1.0 - baseColor.a;
|
||||
|
||||
if (alpha > GLYPH_MIN_VALUE)
|
||||
{
|
||||
lowp float oFactor = smoothstep(GLYPH_MIN_VALUE, GLYPH_MAX_VALUE, alpha );
|
||||
|
@ -53,14 +44,15 @@ lowp vec4 without_outline(lowp vec4 baseColor)
|
|||
|
||||
void main (void)
|
||||
{
|
||||
int textureIndex = int(v_texcoord.z / 2.0);
|
||||
int textureIndex2 = int(v_index);
|
||||
lowp vec4 base = getTexel(textureIndex2, v_colors.xy);
|
||||
mediump float alpha = getTexel(textureIndex, v_texcoord.xy).a;
|
||||
int shapeIndex = int(v_texcoord.z / 2.0);
|
||||
int colorIndex = int(v_index);
|
||||
lowp vec4 base = getTexel(colorIndex, v_colors.xy);
|
||||
lowp vec4 outline = getTexel(colorIndex, v_colors.zw);
|
||||
mediump float alpha = getTexel(shapeIndex, v_texcoord.xy).a;
|
||||
|
||||
lowp float needOutline = (fract(v_texcoord.z / 2.0)) * 2.0;
|
||||
if (needOutline > 0.5)
|
||||
gl_FragColor = colorize(vec4(base.rgb, base.a*alpha));
|
||||
gl_FragColor = colorize(base, outline, 1.0 - base.a*alpha);
|
||||
else
|
||||
gl_FragColor = without_outline(vec4(base.rgb, base.a*alpha));
|
||||
gl_FragColor = without_outline(base, 1.0 - base.a*alpha);
|
||||
}
|
||||
|
|
|
@ -13,12 +13,9 @@ varying lowp float v_index;
|
|||
|
||||
~getTexel~
|
||||
|
||||
void sphere_join(MAXPREC float gip2)
|
||||
void sphere_join(MAXPREC float gip2, lowp vec4 baseColor, lowp vec4 outlineColor)
|
||||
{
|
||||
MAXPREC float r = v_radius.y;
|
||||
int textureIndex = int(v_index);
|
||||
lowp vec4 baseColor = getTexel(textureIndex, v_colors.xy);
|
||||
lowp vec4 outlineColor = getTexel(textureIndex, v_colors.zw);
|
||||
gl_FragColor = baseColor;
|
||||
if (gip2 > v_radius.w * v_radius.w)
|
||||
{
|
||||
|
@ -101,7 +98,7 @@ void main(void)
|
|||
if(gip2 > v_radius.y * v_radius.y)
|
||||
discard;
|
||||
else
|
||||
sphere_join(gip2);
|
||||
sphere_join(gip2, baseColor, outlineColor);
|
||||
}
|
||||
else if (v_dx <= -1.0)
|
||||
{
|
||||
|
@ -110,7 +107,7 @@ void main(void)
|
|||
if(gip2 > v_radius.y * v_radius.y)
|
||||
discard;
|
||||
else
|
||||
sphere_join(gip2);
|
||||
sphere_join(gip2, baseColor, outlineColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,5 @@ varying mediump vec3 v_color_index;
|
|||
|
||||
void main(void)
|
||||
{
|
||||
int textureIndex = int(v_color_index.z);
|
||||
gl_FragColor = getTexel(textureIndex, v_color_index.xy);
|
||||
gl_FragColor = getTexel(int(v_color_index.z), v_color_index.xy);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,5 @@ varying MAXPREC float v_textureIndex;
|
|||
|
||||
void main(void)
|
||||
{
|
||||
int textureIndex = int(v_textureIndex);
|
||||
gl_FragColor = getTexel(textureIndex, v_texCoords);
|
||||
gl_FragColor = getTexel(int(v_textureIndex), v_texCoords);
|
||||
}
|
||||
|
|
|
@ -7,26 +7,31 @@ ColorPalette::ColorPalette(m2::PointU const & canvasSize)
|
|||
: m_textureSize(canvasSize),
|
||||
m_curY(0),
|
||||
m_curX(0)
|
||||
{}
|
||||
|
||||
ColorPalette::~ColorPalette()
|
||||
{
|
||||
m_info = new ColorResourceInfo(m2::RectF(0, 0, 1, 1));
|
||||
TPalette::iterator it = m_palette.begin();
|
||||
for (; it != m_palette.end(); ++it)
|
||||
it->second.Destroy();
|
||||
}
|
||||
|
||||
ColorResourceInfo const * ColorPalette::MapResource(const ColorKey &key)
|
||||
{
|
||||
TPalette::iterator itm = m_palette.find(key.GetColor());
|
||||
uint32_t color = key.GetColor();
|
||||
TPalette::iterator itm = m_palette.find(color);
|
||||
if (itm == m_palette.end())
|
||||
{
|
||||
m_pendingNodes.push_back(key.GetColor());
|
||||
TInserted example = m_palette.insert(make_pair(key.GetColor(), m_palette.size()));
|
||||
itm = example.first;
|
||||
m_pendingNodes.push_back(color);
|
||||
int const size = m_palette.size();
|
||||
float const sizeX = static_cast<float>(m_textureSize.x);
|
||||
float const sizeY = static_cast<float>(m_textureSize.y);
|
||||
float const x = (size % m_textureSize.x + 0.5f) / sizeX;
|
||||
float const y = (size / m_textureSize.x + 0.5f) / sizeY;
|
||||
TResourcePtr m_ptr(new ColorResourceInfo(m2::RectF(x, y, x, y)));
|
||||
itm = m_palette.insert(make_pair(color, m_ptr)).first;
|
||||
}
|
||||
float const sizeX = static_cast<float>(m_textureSize.x);
|
||||
float x = (itm->second % m_textureSize.x) / sizeX;
|
||||
float y = (itm->second / m_textureSize.x) / sizeX;
|
||||
float deltaX = 1.0f / sizeX;
|
||||
float deltaY = 1.0f / sizeX;
|
||||
*m_info = ColorResourceInfo(m2::RectF(x, y, x + deltaX, y + deltaY));
|
||||
return m_info;
|
||||
return itm->second.GetRaw();
|
||||
}
|
||||
|
||||
void ColorPalette::UploadResources(RefPointer<Texture> texture)
|
||||
|
@ -34,58 +39,36 @@ void ColorPalette::UploadResources(RefPointer<Texture> texture)
|
|||
ASSERT(texture->GetFormat() == dp::RGBA8, ());
|
||||
if (m_pendingNodes.empty())
|
||||
return;
|
||||
uint32_t nodeCnt = m_pendingNodes.size();
|
||||
uint32_t offset1 = m_textureSize.x - m_curX;
|
||||
if (offset1 >= nodeCnt)
|
||||
uint32_t const nodeCnt = m_pendingNodes.size();
|
||||
uint32_t const offset = m_textureSize.x - m_curX;
|
||||
if (offset >= nodeCnt)
|
||||
{
|
||||
texture->UploadData(m_curX, m_curY, nodeCnt, 1, dp::RGBA8, MakeStackRefPointer<void>(&m_pendingNodes[0]));
|
||||
Move(nodeCnt);
|
||||
m_curX += nodeCnt;
|
||||
if (offset == nodeCnt)
|
||||
{
|
||||
m_curX = 0;
|
||||
m_curY++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
texture->UploadData(m_curX, m_curY, offset1, 1, dp::RGBA8, MakeStackRefPointer<void>(&m_pendingNodes[0]));
|
||||
m_curY += 1;
|
||||
texture->UploadData(m_curX, m_curY, offset, 1, dp::RGBA8, MakeStackRefPointer<void>(&m_pendingNodes[0]));
|
||||
m_curY++;
|
||||
m_curX = 0;
|
||||
uint32_t ySteps = (nodeCnt - offset1) / m_textureSize.x;
|
||||
uint32_t xSteps = (nodeCnt - offset1) % m_textureSize.x;
|
||||
texture->UploadData(0, m_curY, m_textureSize.x, ySteps, dp::RGBA8, MakeStackRefPointer<void>(&m_pendingNodes[offset1]));
|
||||
uint32_t const remnant = nodeCnt - offset;
|
||||
uint32_t const ySteps = remnant / m_textureSize.x;
|
||||
uint32_t const xSteps = remnant % m_textureSize.x;
|
||||
if (ySteps)
|
||||
texture->UploadData(0, m_curY, m_textureSize.x, ySteps, dp::RGBA8, MakeStackRefPointer<void>(&m_pendingNodes[offset]));
|
||||
m_curY += ySteps;
|
||||
if (!xSteps)
|
||||
return;
|
||||
texture->UploadData(m_curX, m_curY, xSteps, 1, dp::RGBA8, MakeStackRefPointer<void>(&m_pendingNodes[offset1 + ySteps * m_textureSize.x]));
|
||||
texture->UploadData(m_curX, m_curY, xSteps, 1, dp::RGBA8, MakeStackRefPointer<void>(&m_pendingNodes[offset + ySteps * m_textureSize.x]));
|
||||
m_curX += xSteps;
|
||||
}
|
||||
|
||||
m_pendingNodes.clear();
|
||||
}
|
||||
|
||||
void ColorPalette::AddData(void const * data, uint32_t size)
|
||||
{
|
||||
ASSERT(size % 4 == 0, ());
|
||||
uint32_t const cnt = size / 4;
|
||||
uint32_t const * idata = (uint32_t *)data;
|
||||
for (int i = 0; i < cnt; i++)
|
||||
{
|
||||
TInserted example = m_palette.insert(make_pair(idata[i], m_palette.size()));
|
||||
if (example.second)
|
||||
m_pendingNodes.push_back(idata[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void ColorPalette::Move(uint32_t step)
|
||||
{
|
||||
uint32_t initial = min(step, m_textureSize.x - m_curX);
|
||||
m_curX += initial;
|
||||
if (m_curX == m_textureSize.x)
|
||||
{
|
||||
m_curX = 0;
|
||||
m_curY += 1;
|
||||
}
|
||||
step -= initial;
|
||||
if (step <= 0)
|
||||
return;
|
||||
m_curY += step / m_textureSize.x;
|
||||
m_curX += step % m_textureSize.x;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,8 +10,11 @@ namespace dp
|
|||
class ColorKey : public Texture::Key
|
||||
{
|
||||
public:
|
||||
ColorKey(uint32_t color) : Texture::Key(), m_color(color) {}
|
||||
virtual Texture::ResourceType GetType() const { return Texture::Color; }
|
||||
uint32_t GetColor() const { return m_color; }
|
||||
void SetColor(uint32_t color) { m_color = color; }
|
||||
private:
|
||||
uint32_t m_color;
|
||||
};
|
||||
|
||||
|
@ -22,30 +25,24 @@ public:
|
|||
virtual Texture::ResourceType GetType() const { return Texture::Color; }
|
||||
};
|
||||
|
||||
class TextureOfColors
|
||||
{
|
||||
public:
|
||||
TextureOfColors();
|
||||
};
|
||||
|
||||
class ColorPalette
|
||||
{
|
||||
public:
|
||||
ColorPalette(m2::PointU const & canvasSize);
|
||||
~ColorPalette() { delete m_info; }
|
||||
~ColorPalette();
|
||||
ColorResourceInfo const * MapResource(ColorKey const & key);
|
||||
void UploadResources(RefPointer<Texture> texture);
|
||||
void AddData(void const * data, uint32_t size);
|
||||
public:
|
||||
void Move(uint32_t step);
|
||||
typedef map<uint32_t, uint32_t> TPalette;
|
||||
private:
|
||||
typedef MasterPointer<ColorResourceInfo> TResourcePtr;
|
||||
typedef map<uint32_t, TResourcePtr> TPalette;
|
||||
typedef pair<TPalette::iterator, bool> TInserted;
|
||||
|
||||
void Move(uint32_t step);
|
||||
TPalette m_palette;
|
||||
vector<uint32_t> m_pendingNodes;
|
||||
m2::PointU m_textureSize;
|
||||
uint32_t m_curY;
|
||||
uint32_t m_curX;
|
||||
ColorResourceInfo * m_info;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -35,15 +35,13 @@ void AreaShape::Draw(dp::RefPointer<dp::Batcher> batcher, dp::RefPointer<dp::Tex
|
|||
{
|
||||
dp::GLState state(gpu::SOLID_AREA_PROGRAM, dp::GLState::GeometryLayer);
|
||||
|
||||
dp::ColorKey key;
|
||||
key.m_color = m_params.m_color.GetColorInInt();
|
||||
dp::ColorKey key(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;
|
||||
m2::RectF const & rect = region.GetTexRect();
|
||||
float texIndex = static_cast<float>(region.GetTextureNode().m_textureOffset);
|
||||
|
||||
vector<vec3> colors(m_vertexes.size(), vec3(coord1, texIndex));
|
||||
vector<vec3> colors(m_vertexes.size(), vec3(rect.RightTop(), texIndex));
|
||||
|
||||
state.SetTextureSet(region.GetTextureNode().m_textureSet);
|
||||
|
||||
|
|
|
@ -53,15 +53,13 @@ void CircleShape::Draw(dp::RefPointer<dp::Batcher> batcher, dp::RefPointer<dp::T
|
|||
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::ColorKey key(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;
|
||||
m2::RectF const & rect = region.GetTexRect();
|
||||
float texIndex = static_cast<float>(region.GetTextureNode().m_textureOffset);
|
||||
|
||||
vec3 color(coord1, texIndex);
|
||||
vec3 color(rect.RightTop(), texIndex);
|
||||
|
||||
/// x, y, z floats on geompoint
|
||||
/// normal x, y on triangle forming normals
|
||||
|
|
|
@ -175,20 +175,16 @@ void LineShape::Draw(dp::RefPointer<dp::Batcher> batcher, dp::RefPointer<dp::Tex
|
|||
vertex[baseIdx + 3].y = vertex[baseIdx + 1].y;
|
||||
}
|
||||
|
||||
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::ColorKey key(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;
|
||||
key.m_color = (255 << 24) | (127 << 16) | (127 << 8) | 127;
|
||||
m2::RectF const & rect = region.GetTexRect();
|
||||
key.SetColor(dp::Color(127, 127, 127, 255).GetColorInInt());
|
||||
textures->GetColorRegion(key, region);
|
||||
m2::RectF const & rect2 = region.GetTexRect();
|
||||
m2::PointF coord2 = (rect2.RightTop() + rect2.LeftBottom()) * 0.5f;
|
||||
m2::RectF const & outlineRect = region.GetTexRect();
|
||||
float texIndex = static_cast<float>(region.GetTextureNode().m_textureOffset);
|
||||
|
||||
vector<vec4> colors(numVert, vec4(coord1, coord2));
|
||||
vector<vec4> colors(numVert, vec4(rect.RightTop(), outlineRect.RightTop()));
|
||||
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
|
||||
|
||||
|
|
|
@ -17,17 +17,14 @@ void FillColor(vector<Quad4> & colors,
|
|||
dp::Color const & base, dp::Color const & outline,
|
||||
dp::RefPointer<dp::TextureSetHolder> textures)
|
||||
{
|
||||
dp::ColorKey key;
|
||||
key.m_color = (base.m_alfa << 24) | (base.m_blue << 16) | (base.m_green << 8) | base.m_red;
|
||||
dp::ColorKey key(base.GetColorInInt());
|
||||
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;
|
||||
m2::RectF const & rect = region.GetTexRect();
|
||||
key.SetColor(outline.GetColorInInt());
|
||||
textures->GetColorRegion(key, region);
|
||||
m2::RectF const & rect2 = region.GetTexRect();
|
||||
m2::PointF coord2 = (rect2.RightTop() + rect2.LeftBottom()) * 0.5f;
|
||||
m2::RectF const & outlineRect = region.GetTexRect();
|
||||
|
||||
vec4 clrs(coord1, coord2);
|
||||
vec4 clrs(rect.RightTop(), outlineRect.RightTop());
|
||||
Quad4 f(clrs, clrs, clrs, clrs);
|
||||
fill(colors.begin(), colors.end(), f);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "../drape/shader_def.hpp"
|
||||
#include "../drape/overlay_tree.hpp"
|
||||
#include "../drape/stipple_pen_resource.hpp"
|
||||
#include "../drape/dynamic_texture.hpp"
|
||||
|
||||
#include "../drape_frontend/visual_params.hpp"
|
||||
#include "../drape_frontend/line_shape.hpp"
|
||||
|
@ -131,39 +130,12 @@ public:
|
|||
void Draw(dp::RefPointer<dp::Batcher> batcher, dp::RefPointer<dp::TextureSetHolder> textures) const
|
||||
{
|
||||
const int cnt = 6000;
|
||||
uint32_t colors[50000];
|
||||
colors[0] = (255<<24) | (0<<16) | (0<<8) | 255;
|
||||
colors[1] = (255<<24) | (0<<16) | (255<<8) | 0;
|
||||
colors[2] = (255<<24) | (0<<16) | (0<<8) | 255;
|
||||
|
||||
colors[3] = (255<<24) | (0<<16) | (255<<8) | 255;
|
||||
colors[4] = (255<<24) | (255<<16) | (0<<8) | 255;
|
||||
colors[5] = (255<<24) | (255<<16) | (255<<8) | 0;
|
||||
|
||||
colors[6] = (255<<24) | (255<<16) | (255<<8) | 255;
|
||||
|
||||
colors[7] = (255<<24) | (0<<16) | (0<<8) | 0;
|
||||
|
||||
dp::ColorKey key;
|
||||
key.m_color = (255<<24) | (1<<16) | (255<<8) | 0;
|
||||
dp::ColorKey key(0);
|
||||
dp::TextureSetHolder::ColorRegion region;
|
||||
textures->GetColorRegion(key, region);
|
||||
key.m_color = (255<<24) | (0<<16) | (255<<8) | 255;
|
||||
textures->GetColorRegion(key, region);
|
||||
key.m_color = colors[0];
|
||||
textures->GetColorRegion(key, region);
|
||||
key.m_color = colors[1];
|
||||
textures->GetColorRegion(key, region);
|
||||
key.m_color = colors[2];
|
||||
textures->GetColorRegion(key, region);
|
||||
key.m_color = colors[3];
|
||||
textures->GetColorRegion(key, region);
|
||||
key.m_color = colors[4];
|
||||
textures->GetColorRegion(key, region);
|
||||
for (int i = 8; i < cnt; ++i)
|
||||
for (int i = 0; i < cnt; ++i)
|
||||
{
|
||||
colors[i] = (255<<24) | (rand()%256 << 16) | (rand()%256 << 8) | (rand()%256);
|
||||
key.m_color = colors[i];
|
||||
key.SetColor(dp::Color(rand()%256, rand()%256, rand()%256, 255).GetColorInInt());
|
||||
textures->GetColorRegion(key, region);
|
||||
}
|
||||
|
||||
|
@ -184,23 +156,22 @@ public:
|
|||
m2::PointF(halfSize, halfSize), m2::PointF(halfSize, -halfSize)
|
||||
};
|
||||
|
||||
m2::PointF coord = (rect.RightTop() + rect.LeftBottom()) * 0.5f;
|
||||
|
||||
// glsl_types::vec4 texCoord[4] =
|
||||
// {
|
||||
// glsl_types::vec4(m2::PointF(0.0f, 1.0f), texIndex, 0),
|
||||
// glsl_types::vec4(m2::PointF(0.0f, 0.0f), texIndex, 0),
|
||||
// glsl_types::vec4(m2::PointF(1.0f, 1.0f), texIndex, 0),
|
||||
// glsl_types::vec4(m2::PointF(1.0f, 0.0f), texIndex, 0)
|
||||
// };
|
||||
|
||||
glsl_types::vec4 texCoord[4] =
|
||||
bool drawEntireTexture = true;
|
||||
glsl_types::vec4 texCoord[4];
|
||||
if (drawEntireTexture)
|
||||
{
|
||||
glsl_types::vec4(coord, texIndex, 0),
|
||||
glsl_types::vec4(coord, texIndex, 0),
|
||||
glsl_types::vec4(coord, texIndex, 0),
|
||||
glsl_types::vec4(coord, texIndex, 0)
|
||||
};
|
||||
texCoord[0] = glsl_types::vec4(m2::PointF(0.0f, 1.0f), texIndex, 0);
|
||||
texCoord[1] = glsl_types::vec4(m2::PointF(0.0f, 0.0f), texIndex, 0);
|
||||
texCoord[2] = glsl_types::vec4(m2::PointF(1.0f, 1.0f), texIndex, 0);
|
||||
texCoord[3] = glsl_types::vec4(m2::PointF(1.0f, 0.0f), texIndex, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
texCoord[0] = glsl_types::vec4(rect.RightTop(), texIndex, 0);
|
||||
texCoord[1] = glsl_types::vec4(rect.RightTop(), texIndex, 0);
|
||||
texCoord[2] = glsl_types::vec4(rect.RightTop(), texIndex, 0);
|
||||
texCoord[3] = glsl_types::vec4(rect.RightTop(), texIndex, 0);
|
||||
}
|
||||
|
||||
dp::AttributeProvider provider(3, 4);
|
||||
{
|
||||
|
@ -303,15 +274,13 @@ public:
|
|||
formingVectors[2] = m2::PointF( m_radius, m_radius);
|
||||
formingVectors[3] = m2::PointF( m_radius, -m_radius);
|
||||
|
||||
dp::ColorKey key;
|
||||
key.m_color = dp::Color(150, 130, 120, 255).GetColorInInt();
|
||||
dp::ColorKey key(dp::Color(150, 130, 120, 255).GetColorInInt());
|
||||
dp::TextureSetHolder::ColorRegion region;
|
||||
textures->GetColorRegion(key, region);
|
||||
m2::RectF const & rect1 = region.GetTexRect();
|
||||
m2::PointF coord1 = (rect1.RightTop() + rect1.LeftBottom()) * 0.5f;
|
||||
m2::RectF const & rect = region.GetTexRect();
|
||||
float texIndex = static_cast<float>(region.GetTextureNode().m_textureOffset);
|
||||
|
||||
vector<vec3> colors(4, vec3(coord1, texIndex));
|
||||
vector<vec3> colors(4, vec3(rect.RightTop(), texIndex));
|
||||
|
||||
dp::AttributeProvider provider(3, 4);
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue