/*
- * 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.
* 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 <dali-toolkit/devel-api/shader-effects/alpha-discard-effect.h>
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/graphics/builtin-shader-extern-gen.h>
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
+
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