/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include <sstream>
#include <iomanip>
#include <dali/public-api/animation/constraint.h>
-#include <dali/public-api/common/stage.h>
+#include <dali/devel-api/common/stage.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/render-tasks/render-task-list.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/internal/graphics/builtin-shader-extern-gen.h>
#include <dali-toolkit/internal/controls/control/control-renderers.h>
#include <dali-toolkit/internal/controls/shadow-view/shadow-view-impl.h>
#include <dali-toolkit/internal/filters/blur-two-pass-filter.h>
+#include <dali-toolkit/internal/controls/control/control-data-impl.h>
// TODO:
// pixel format / size - set from JSON
const char* const BLUR_STRENGTH_PROPERTY_NAME = "BlurStrengthProperty";
const char* const SHADOW_COLOR_PROPERTY_NAME = "ShadowColorProperty";
-const char* const RENDER_SHADOW_VERTEX_SOURCE =
-
- " attribute mediump vec2 aPosition;\n"
- " uniform mediump mat4 uMvpMatrix;\n"
- " uniform mediump mat4 uModelMatrix;\n"
- " uniform vec3 uSize;\n"
- " varying vec2 vTexCoord;\n"
-
- " uniform mediump mat4 uLightCameraProjectionMatrix;\n"
- " uniform mediump mat4 uLightCameraViewMatrix;\n"
- "\n"
- "void main()\n"
- "{\n"
- " mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);\n"
- " vertexPosition.xyz *= uSize;\n"
- " gl_Position = uMvpMatrix * vertexPosition;\n"
- " vec4 textureCoords = uLightCameraProjectionMatrix * uLightCameraViewMatrix * uModelMatrix * vertexPosition;\n"
- " vTexCoord = 0.5 + 0.5 * (textureCoords.xy/textureCoords.w);\n"
- "}\n";
-
-const char* const RENDER_SHADOW_FRAGMENT_SOURCE =
- "varying mediump vec2 vTexCoord;\n"
- "uniform lowp vec4 uShadowColor;\n"
- "uniform sampler2D sTexture;\n"
-
- "void main()\n"
- "{\n"
- " lowp float alpha;\n"
- " alpha = texture2D(sTexture, vec2(vTexCoord.x, vTexCoord.y)).a;\n"
- " gl_FragColor = vec4(uShadowColor.rgb, uShadowColor.a * alpha);\n"
- "}\n";
-
} // namespace
ShadowView::ShadowView( float downsampleWidthScale, float downsampleHeightScale )
mShadowPlane.SetProperty( Actor::Property::NAME, "SHADOW_PLANE" );
mShadowPlane.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
mShadowPlane.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- Renderer shadowRenderer = CreateRenderer( RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE, Shader::Hint::OUTPUT_IS_TRANSPARENT, Uint16Pair(20,20) );
+ Renderer shadowRenderer = CreateRenderer( SHADER_SHADOW_VIEW_RENDER_SHADER_VERT, SHADER_SHADOW_VIEW_RENDER_SHADER_FRAG,
+ Shader::Hint::OUTPUT_IS_TRANSPARENT,
+ Uint16Pair(20,20) );
TextureSet textureSet = shadowRenderer.GetTextures();
textureSet.SetTexture( 0u, mOutputFrameBuffer.GetColorTexture() );
mShadowPlane.AddRenderer( shadowRenderer );
Constraint blurStrengthConstraint = Constraint::New<float>( mBlurFilter.GetHandleForAnimateBlurStrength(), mBlurFilter.GetBlurStrengthPropertyIndex(), EqualToConstraint() );
blurStrengthConstraint.AddSource( Source( self, mBlurStrengthPropertyIndex) );
blurStrengthConstraint.Apply();
+
+ DevelControl::SetAccessibilityConstructor( Self(), []( Dali::Actor actor ) {
+ return std::unique_ptr< Dali::Accessibility::Accessible >(
+ new Control::Impl::AccessibleImpl( actor, Dali::Accessibility::Role::FILLER ) );
+ } );
}
void ShadowView::OnChildAdd( Actor& child )