diff --git a/drape/shaders/doc/line_fragment_shader_fsh.txt b/drape/shaders/doc/line_fragment_shader_fsh.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/drape/shaders/texturing_fragment_shader.fsh b/drape/shaders/texturing_fragment_shader.fsh index ee76888deb..d6a6b26ebd 100644 --- a/drape/shaders/texturing_fragment_shader.fsh +++ b/drape/shaders/texturing_fragment_shader.fsh @@ -1,5 +1,6 @@ uniform sampler2D u_textures[8]; -varying highp vec4 v_texCoords; +varying highp vec2 v_texCoords; +varying highp float v_textureIndex; const int Index0 = 0; const int Index1 = 1; @@ -12,24 +13,24 @@ const int Index7 = 7; void main(void) { - int index = int(floor(v_texCoords.z)); highp vec4 color; - if (index == Index0) - color = texture2D(u_textures[Index0], v_texCoords.st); - else if (index == Index1) - color = texture2D(u_textures[Index1], v_texCoords.st); - else if (index == Index2) - color = texture2D(u_textures[Index2], v_texCoords.st); - else if (index == Index3) - color = texture2D(u_textures[Index3], v_texCoords.st); - else if (index == Index4) - color = texture2D(u_textures[Index4], v_texCoords.st); - else if (index == Index5) - color = texture2D(u_textures[Index5], v_texCoords.st); - else if (index == Index6) - color = texture2D(u_textures[Index6], v_texCoords.st); - else if (index == Index7) - color = texture2D(u_textures[Index7], v_texCoords.st); + int textureIndex = int(v_textureIndex); + if (textureIndex == Index0) + color = texture2D(u_textures[Index0], v_texCoords); + else if (textureIndex == Index1) + color = texture2D(u_textures[Index1], v_texCoords); + else if (textureIndex == Index2) + color = texture2D(u_textures[Index2], v_texCoords); + else if (textureIndex == Index3) + color = texture2D(u_textures[Index3], v_texCoords); + else if (textureIndex == Index4) + color = texture2D(u_textures[Index4], v_texCoords); + else if (textureIndex == Index5) + color = texture2D(u_textures[Index5], v_texCoords); + else if (textureIndex == Index6) + color = texture2D(u_textures[Index6], v_texCoords); + else if (textureIndex == Index7) + color = texture2D(u_textures[Index7], v_texCoords); gl_FragColor = color; } diff --git a/drape/shaders/texturing_vertex_shader.vsh b/drape/shaders/texturing_vertex_shader.vsh index ceb6ac5ad1..3c2b39f02c 100644 --- a/drape/shaders/texturing_vertex_shader.vsh +++ b/drape/shaders/texturing_vertex_shader.vsh @@ -1,14 +1,16 @@ attribute highp vec4 a_position; -attribute highp vec4 a_normal; -attribute highp vec4 a_texCoords; +attribute highp vec2 a_normal; +attribute highp vec3 a_texCoords; uniform highp mat4 modelView; uniform highp mat4 projection; -varying highp vec4 v_texCoords; +varying highp vec2 v_texCoords; +varying float v_textureIndex; void main(void) { - gl_Position = ((a_position * modelView) + a_normal) * projection; - v_texCoords = a_texCoords; + gl_Position = (vec4(a_normal.xy, 0, 0) + (a_position * modelView)) * projection; + v_texCoords = a_texCoords.st; + v_textureIndex = a_texCoords.z; }