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:
authorr.kuznetsov <r.kuznetsov@corp.mail.ru>2016-07-14 15:13:22 +0300
committerr.kuznetsov <r.kuznetsov@corp.mail.ru>2016-07-14 15:13:22 +0300
commitcde591ff82328d0e980aaf86dfb4bc36c73d5082 (patch)
treee1ee40356fbf2ee8bcd56e22cebcdadc04804ec6 /drape
parentbb94ea2bef74f72047cfd6b0f752d9362904f9aa (diff)
Improved 3d arrow rendering
Diffstat (limited to 'drape')
-rw-r--r--drape/shaders/arrow3d_fragment_shader.fsh5
-rw-r--r--drape/shaders/arrow3d_vertex_shader.vsh12
2 files changed, 8 insertions, 9 deletions
diff --git a/drape/shaders/arrow3d_fragment_shader.fsh b/drape/shaders/arrow3d_fragment_shader.fsh
index 523906d492..e6dcb2dc06 100644
--- a/drape/shaders/arrow3d_fragment_shader.fsh
+++ b/drape/shaders/arrow3d_fragment_shader.fsh
@@ -1,4 +1,4 @@
-varying float v_intensity;
+varying vec2 v_intensity;
#ifdef SAMSUNG_GOOGLE_NEXUS
uniform sampler2D u_colorTex;
@@ -14,7 +14,8 @@ void main()
lowp vec4 fakeColor = texture2D(u_colorTex, vec2(0.0, 0.0)) * kFakeColorScalar;
#endif
- vec4 resColor = vec4((v_intensity * 0.3 + 0.7) * u_color.rgb, u_color.a);
+ float alpha = smoothstep(0.8, 1.0, v_intensity.y);
+ vec4 resColor = vec4((v_intensity.x * 0.5 + 0.5) * u_color.rgb, u_color.a * alpha);
#ifdef SAMSUNG_GOOGLE_NEXUS
gl_FragColor = resColor + fakeColor;
diff --git a/drape/shaders/arrow3d_vertex_shader.vsh b/drape/shaders/arrow3d_vertex_shader.vsh
index 1fd6741a9c..ddd1063394 100644
--- a/drape/shaders/arrow3d_vertex_shader.vsh
+++ b/drape/shaders/arrow3d_vertex_shader.vsh
@@ -1,17 +1,15 @@
-attribute vec3 a_pos;
+attribute vec4 a_pos;
attribute vec3 a_normal;
uniform mat4 m_transform;
-varying float v_intensity;
+varying vec2 v_intensity;
-const vec4 lightDir = vec4(1.0, 0.0, 3.0, 0.0);
+const vec3 lightDir = vec3(0.316, 0.0, 0.948);
void main()
{
- vec4 position = m_transform * vec4(a_pos, 1.0);
- vec4 normal = m_transform * vec4(a_normal + a_pos, 1.0);
- v_intensity = max(0.0, -dot(normalize(lightDir), normalize(normal - position)));
+ vec4 position = m_transform * vec4(a_pos.xyz, 1.0);
+ v_intensity = vec2(max(0.0, -dot(lightDir, a_normal)), a_pos.w);
gl_Position = position;
}
-