5f4976d87ff6aebebde8a971df68a2bc98352494
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / shader-effects / motion-stretch-effect.h
1 #ifndef DALI_TOOLKIT_SHADER_EFFECT_MOTION_STRETCH_H
2 #define DALI_TOOLKIT_SHADER_EFFECT_MOTION_STRETCH_H
3
4 /*
5  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/actors/actor.h>
23 #include <dali/public-api/object/property-map.h>
24
25 // INTERNAL INCLUDES
26 #include <dali-toolkit/public-api/dali-toolkit-common.h>
27
28 namespace Dali
29 {
30 namespace Toolkit
31 {
32 /**
33  * @brief Set the properties for the motion stretch
34  */
35 DALI_TOOLKIT_API void SetMotionStretchProperties( Actor& actor );
36
37 /**
38  * @brief Creates a new MotionStretchEffect
39  *
40  * Motion stretch shader works on a per object basis. Objects will stretch in the direction of motion when they move, or if the camera moves.
41  *
42  * Animatable/Constrainable uniforms:
43  *  "uGeometryStretchFactor"  - This scales the amount the geometry stretches along the motion velocity vector.
44  *                              A smaller value means the geometry stretches less, larger it stretches more. Default 0.5.
45  *  "uSpeedScalingFactor"     - This value is used to control how much to fade the actor near the edges, based on the
46  *                              speed the actor is moving. When the actor is at rest this is not applied. Default 0.5.
47  *  "uObjectFadeStart"        - The displacement from the centre of the actor that the actor will start to fade towards
48  *                              its edges. This is used to prevent an unsightly hard edge between the stretched actor and
49  *                              the scene. Depends on the values of the vertices in the vertex stream. When the actor is at
50  *                              rest this is not applied. Default Vector2(0.25, 0.25), which is half way towards the edge for
51  *                              an ImageVisual::QUAD.
52  *  "uObjectFadeEnd"          - The displacement from the centre of the actor that the actor will finish fading towards its edges.
53  *                              This is used to prevent an unsightly hard edge between the stretched actor and the scene. Depends
54  *                              on the values of the vertices in the vertex stream. When the actor is at rest this is not applied.
55  *                              Default 0.5, which is all the way towards the edge for an ImageVisual::QUAD.
56  *  "uAlphaScale"             - Global scaler applied to the alpha of the actor. Used to make the stretched actor a bit more subtle
57  *                              and reveal a bit of the background behind it as it moves. When the actor is at rest this is not
58  *                              applied. Default 0.75.
59  *  "uModelLastFrame"         - The model to world space transformation matrix of the actor in the previous frame.
60  *
61  * @return The newly created Property::Map with the motion stretch effect
62  */
63 DALI_TOOLKIT_API Property::Map CreateMotionStretchEffect();
64
65 } // namespace Toolkit
66
67 } // namespace Dali
68
69 #endif // DALI_TOOLKIT_SHADER_EFFECT_MOTION_STRETCH_H