Revert "Added sub pixel itensity calculation for text rendering." 98/28798/3
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Thu, 16 Oct 2014 08:47:43 +0000 (01:47 -0700)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Thu, 16 Oct 2014 08:48:34 +0000 (01:48 -0700)
This reverts commit aadff4921d036ebc24b90c99d98949a14399e654.

Reversion required due to poor text quality in the demos.

Change-Id: Icd69e4c96057cbc820383e01336358ee8def8133

dali/internal/render/shader-source/distance-field-font.txt

index f41a958..267852b 100644 (file)
@@ -3,7 +3,10 @@
   attribute mediump vec3  aPosition;
   attribute mediump vec2  aTexCoord;
 
+  uniform   mediump mat4  uModelView;
+  uniform   mediump mat4  uProjection;
   uniform   mediump mat4  uMvpMatrix;
+  uniform   mediump mat3  uNormalMatrix;
   uniform   lowp    vec4  uColor;
   uniform   lowp    vec4  uTextColor;
 
 </VertexShader>
 
 <FragmentShader>
-#extension GL_OES_standard_derivatives : enable
 
   uniform mediump sampler2D sTexture;
   uniform highp   vec4      sTextureRect;
   uniform lowp    vec4      uColor;
   uniform highp   vec2      uSmoothing;
 
-  varying highp   vec2      vTexCoord;
+  varying highp vec2      vTexCoord;
 
 #ifdef USE_GRADIENT
   varying lowp    vec4      vColor;
@@ -49,9 +51,7 @@
   void main()
   {
     // sample distance field
-    highp vec2 offset = dFdx(vTexCoord) * 0.33333;
-    highp float distanceL = texture2D(sTexture, vTexCoord - offset).a;
-    highp float distanceR = texture2D(sTexture, vTexCoord + offset).a;
+    highp float distance = texture2D(sTexture, vTexCoord).a;
 
 #ifdef USE_GRADIENT
     lowp vec4 color = clamp(vColor, 0., 1.); // gradiant calculation can overflow.
 #endif
 
     // adjust fragment alpha by sampled distance
-    mediump float distance = distanceL * .5 + distanceR *.5;
-    mediump vec3 attenuation = vec3( distanceL, distance, distanceR );
-    attenuation = smoothstep(uSmoothing[0], uSmoothing[1], attenuation );
-
     color.a *= smoothstep(uSmoothing[0], uSmoothing[1], distance );
 
-    // color multiplied by Actor color
-    color = uColor * color;
-
-    // apply attenuation
-    color.rgb = mix(vec3(1.)-color.rgb, color.rgb, attenuation);
-
-    gl_FragColor = color;
+    // final color multiplied by Actor color
+    gl_FragColor = uColor * color;
   }
 
 </FragmentShader>