DALi Version 1.0.38
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / shader-effects / mirror-effect.cpp
index 4b72f0f..8a11c06 100644 (file)
@@ -1,18 +1,19 @@
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 
 #include <dali-toolkit/public-api/shader-effects/mirror-effect.h>
 
@@ -47,20 +48,19 @@ MirrorEffect::~MirrorEffect()
 MirrorEffect MirrorEffect::New()
 {
 
-  std::string vertextShader(
-      "precision mediump float;                     \n"
+  std::string vertexShader(
       "void main()                                  \n"
       "{                                            \n"
-      "  vec3 pos = aPosition;                      \n"
+      "  mediump vec3 pos = aPosition;              \n"
       "  pos.y = pos.y * 3.0;                       \n"
-      "  vec4 world = uModelView * vec4(pos,1.0);   \n"
+      "  mediump vec4 world = uModelView * vec4(pos,1.0); \n"
       "  gl_Position = uProjection * world;         \n"
       "  vTexCoord = aTexCoord;                     \n"
       "}                                            \n" );
 
   std::string fragmentShader(
-      "uniform  float  uDepth;                      \n"
-      "uniform  float  uAlpha;                      \n"
+      "uniform  mediump float  uDepth;              \n"
+      "uniform  mediump float  uAlpha;              \n"
       "void main()                                  \n"
       "{                                            \n"
       " if(vTexCoord.y < 1.0 / 3.0)                 \n"
@@ -74,9 +74,9 @@ MirrorEffect MirrorEffect::New()
       " }                                           \n"
       " else                                        \n"
       " {                                           \n"
-      "   float darkness = 3.0 - vTexCoord.y * 3.0;                                                   \n"
+      "   highp float darkness = 3.0 - vTexCoord.y * 3.0;                                                   \n"
       "   darkness = (1.0 - 1.0 / uDepth + darkness * 1.0/ uDepth) * 0.65;                            \n"
-      "   vec4 color = texture2D(sTexture, vec2(vTexCoord.x, -vTexCoord.y *3.0 + 3.0)) * uColor;      \n"
+      "   highp vec4 color = texture2D(sTexture, vec2(vTexCoord.x, -vTexCoord.y *3.0 + 3.0)) * uColor;      \n"
       "   color.a *= uAlpha;                                                                          \n"
       "   gl_FragColor = color * vec4(darkness, darkness, darkness, darkness);                        \n"
       " }                                           \n"
@@ -84,7 +84,7 @@ MirrorEffect MirrorEffect::New()
 
   // Create the implementation, temporarily owned on stack,
   Dali::ShaderEffect shaderEffectCustom =  Dali::ShaderEffect::New(
-      vertextShader,
+      vertexShader,
       fragmentShader,
       GeometryType( GEOMETRY_TYPE_IMAGE ),
       ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING ));