diff options
author | Daria Volvenkova <d.volvenkova@corp.mail.ru> | 2016-11-23 13:41:12 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-23 13:41:12 +0300 |
commit | f36a01accc04908c2bbb6191f3e0c568f984f1f5 (patch) | |
tree | 45afa7c24566bec29780437c018fabcdf96958de /drape | |
parent | cb0cf73fc272ac9f94f152b7c7fca145ad7bd32f (diff) | |
parent | b1b87d7561e1870b38c91853cab7cbdc218548c7 (diff) |
Merge pull request #4778 from rokuz/traffic-improve-rendering
Improved traffic rendering
Diffstat (limited to 'drape')
-rw-r--r-- | drape/batcher.cpp | 4 | ||||
-rw-r--r-- | drape/batcher.hpp | 9 | ||||
-rw-r--r-- | drape/shaders/traffic_fragment_shader.fsh | 9 |
3 files changed, 19 insertions, 3 deletions
diff --git a/drape/batcher.cpp b/drape/batcher.cpp index c8bc1b548a..1f4cdc1ea9 100644 --- a/drape/batcher.cpp +++ b/drape/batcher.cpp @@ -283,9 +283,7 @@ IndicesRange Batcher::InsertPrimitives(GLState const & state, ref_ptr<AttributeP Batcher * BatcherFactory::GetNew() const { - uint32_t const kIndexBufferSize = 5000; - uint32_t const kVertexBufferSize = 5000; - return new Batcher(kIndexBufferSize, kVertexBufferSize); + return new Batcher(m_indexBufferSize, m_vertexBufferSize); } SessionGuard::SessionGuard(Batcher & batcher, Batcher::TFlushFn const & flusher) diff --git a/drape/batcher.hpp b/drape/batcher.hpp index ca5f30f6a0..18eeac31d6 100644 --- a/drape/batcher.hpp +++ b/drape/batcher.hpp @@ -87,7 +87,16 @@ private: class BatcherFactory { public: + BatcherFactory(uint32_t indexBufferSize, uint32_t vertexBufferSize) + : m_indexBufferSize(indexBufferSize) + , m_vertexBufferSize(vertexBufferSize) + {} + Batcher * GetNew() const; + +private: + uint32_t const m_indexBufferSize; + uint32_t const m_vertexBufferSize; }; class SessionGuard diff --git a/drape/shaders/traffic_fragment_shader.fsh b/drape/shaders/traffic_fragment_shader.fsh index e7d10f0e9d..f432f86b62 100644 --- a/drape/shaders/traffic_fragment_shader.fsh +++ b/drape/shaders/traffic_fragment_shader.fsh @@ -5,9 +5,13 @@ varying float v_halfLength; uniform sampler2D u_colorTex; uniform sampler2D u_maskTex; uniform float u_opacity; +uniform float u_outline; const float kAntialiasingThreshold = 0.92; +const float kOutlineThreshold1 = 0.8; +const float kOutlineThreshold2 = 0.5; + const vec3 kLightArrow = vec3(1.0, 1.0, 1.0); const vec3 kDarkArrow = vec3(107.0 / 255.0, 81.0 / 255.0, 20.0 / 255.0); @@ -20,6 +24,11 @@ void main(void) vec4 mask = texture2D(u_maskTex, v_maskTexCoord); color.a = u_opacity * (1.0 - smoothstep(kAntialiasingThreshold, 1.0, abs(v_halfLength))); color.rgb = mix(color.rgb, mask.rgb * mix(kLightArrow, kDarkArrow, step(alphaCode, 0.6)), mask.a); + if (u_outline > 0.0) + { + color.rgb = mix(color.rgb, vec3(1.0, 1.0, 1.0), step(kOutlineThreshold1, abs(v_halfLength))); + color.rgb = mix(color.rgb, vec3(1.0, 1.0, 1.0), smoothstep(kOutlineThreshold2, kOutlineThreshold1, abs(v_halfLength))); + } gl_FragColor = color; } else |