X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2Fanimated-shapes%2Fanimated-shapes-example.cpp;h=204fcef3248d30e86955fb9d99dec866a3412e16;hb=38b87ec05860401c3dcbf20d047aa0b55ea5841a;hp=dd79982a9abef5f2b2dc238b450eb5a08b391f61;hpb=40844807e7258f1e5d9ef1a3650f438c8777409c;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/examples/animated-shapes/animated-shapes-example.cpp b/examples/animated-shapes/animated-shapes-example.cpp index dd79982..204fcef 100644 --- a/examples/animated-shapes/animated-shapes-example.cpp +++ b/examples/animated-shapes/animated-shapes-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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. @@ -15,8 +15,10 @@ * */ -#include #include +#include +#include "generated/animated-shapes-frag.h" +#include "generated/animated-shapes-vert.h" #include "shared/view.h" #include @@ -26,55 +28,25 @@ using namespace Dali::Toolkit; namespace { - const char* APPLICATION_TITLE("Animated Shapes"); -const char* VERTEX_SHADER = DALI_COMPOSE_SHADER -( - attribute mediump vec3 aCoefficient; - uniform mediump mat4 uMvpMatrix; - uniform mediump vec3 uPosition[MAX_POINT_COUNT]; - varying lowp vec2 vCoefficient; - void main() - { - int vertexId = int(aCoefficient.z); - gl_Position = uMvpMatrix * vec4(uPosition[vertexId], 1.0); - - vCoefficient = aCoefficient.xy; - } -); - -// Fragment shader. -const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER -( - uniform lowp vec4 uColor; - varying lowp vec2 vCoefficient; - void main() - { - lowp float C = (vCoefficient.x*vCoefficient.x-vCoefficient.y); - lowp float Cdx = dFdx(C); - lowp float Cdy = dFdy(C); - - lowp float distance = float(C / sqrt(Cdx*Cdx + Cdy*Cdy)); - lowp float alpha = 0.5 - distance; - gl_FragColor = vec4( uColor.rgb, uColor.a * alpha ); - } -); - -Shader CreateShader( unsigned int pointCount ) +Shader CreateShader(unsigned int pointCount) { std::ostringstream vertexShader; - vertexShader << "#define MAX_POINT_COUNT "<< pointCount << "\n"<