X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Fdevel-api%2Fshader-effects%2Falpha-discard-effect.cpp;h=3b3933b4be9089d9fd2413db93164eab2448bdf9;hp=1c6be016f284e0a3ca7a72d9296a89ef00a2ff3c;hb=HEAD;hpb=f58b8383147de70affa1e3949cf1c6757d705d3c diff --git a/dali-toolkit/devel-api/shader-effects/alpha-discard-effect.cpp b/dali-toolkit/devel-api/shader-effects/alpha-discard-effect.cpp index 1c6be01..3b3933b 100644 --- a/dali-toolkit/devel-api/shader-effects/alpha-discard-effect.cpp +++ b/dali-toolkit/devel-api/shader-effects/alpha-discard-effect.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 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. @@ -12,50 +12,29 @@ * 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. - * */ // CLASS HEADER #include +// INTERNAL INCLUDES +#include +#include + namespace Dali { - namespace Toolkit { - -AlphaDiscardEffect::AlphaDiscardEffect() +Property::Map CreateAlphaDiscardEffect() { -} + Property::Map map; -AlphaDiscardEffect::~AlphaDiscardEffect() -{ -} + Property::Map customShader; + customShader[Visual::Shader::Property::FRAGMENT_SHADER] = SHADER_ALPHA_DISCARD_EFFECT_FRAG.data(); -AlphaDiscardEffect AlphaDiscardEffect::New() -{ - const char* ALPHA_DISCARD_FRAGMENT_SHADER_SOURCE = - "void main() \n" - "{ \n" - " mediump vec4 color = texture2D( sTexture, vTexCoord ); \n" - " if(color.a <= 0.0001) \n" - " { \n" - " discard; \n" - " } \n" - " gl_FragColor = color * uColor; \n" - "} \n"; - - ShaderEffect shader = ShaderEffect::New( "", // Use default - ALPHA_DISCARD_FRAGMENT_SHADER_SOURCE ); - return AlphaDiscardEffect( shader ); -} - -//Call the Parent copy constructor to add reference to the implementation for this object -AlphaDiscardEffect::AlphaDiscardEffect( ShaderEffect handle ) -: ShaderEffect( handle ) -{ + map[Toolkit::Visual::Property::SHADER] = customShader; + return map; } } // namespace Toolkit - } // namespace Dali