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
path: root/drape
diff options
context:
space:
mode:
authorExMix <rahuba.youri@mapswithme.com>2014-11-18 13:38:50 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:32:55 +0300
commite3d23660d22652abef3395a0e6ee183d4b2fbe1c (patch)
tree3a9c011979fae3cf5a47cfb452e597322c15f270 /drape
parent8d76e8fee45818e2970b0c821d1c49b979800fc5 (diff)
[drape] line shader optimization
Diffstat (limited to 'drape')
-rw-r--r--drape/shaders/line_fragment_shader.fsh26
1 files changed, 10 insertions, 16 deletions
diff --git a/drape/shaders/line_fragment_shader.fsh b/drape/shaders/line_fragment_shader.fsh
index 49be8f77af..f92749062f 100644
--- a/drape/shaders/line_fragment_shader.fsh
+++ b/drape/shaders/line_fragment_shader.fsh
@@ -17,29 +17,23 @@ varying vec3 v_mask;
void main(void)
{
- float r = v_radius.y;
- float dist = abs(v_radius.x);
+ float squareDist = v_radius.x * v_radius.x;
+ float squareRadius = v_radius.y * v_radius.y;
+
+ float capY = (v_dx + 1.0 * sign(v_dx)) * v_radius.z / 2.0;
+ float joinY = (v_dx + 1.0) * v_radius.y / 2.0;
if (v_type.x < -0.5)
{
- float y = (v_dx + 1.0) * v_radius.y / 2.0;
+ float y = joinY;
if (v_type.y < 0.5)
- y = v_radius.y - (v_dx + 1.0) * v_radius.y / 2.0;
+ y = v_radius.y - joinY;
- float sq = dist * dist + y * y;
- if (sq >= v_radius.y * v_radius.y)
+ if (squareDist + y * y > squareRadius)
discard;
}
- else
- {
- if (v_type.y > 0.1 && abs(v_dx) >= 1.0)
- {
- float y = (v_dx + 1.0 * sign(v_dx)) * v_radius.z / 2.0;
- float gip2 = dist * dist + y * y;
- if(gip2 > v_radius.y * v_radius.y)
- discard;
- }
- }
+ else if (v_type.y > 0.1 && abs(v_dx) >= 1.0 && (squareDist + capY > squareRadius))
+ discard;
vec4 color = getTexel(int(v_color.z), v_color.xy);
color.a = getTexel(int(v_mask.z), v_mask.xy).a;