1 #ifndef DALI_TOOLKIT_SHADER_EFFECT_MOTION_STRETCH_H
2 #define DALI_TOOLKIT_SHADER_EFFECT_MOTION_STRETCH_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/actors/actor.h>
23 #include <dali/public-api/object/property-map.h>
26 #include <dali-toolkit/public-api/dali-toolkit-common.h>
33 * @brief Set the properties for the motion stretch
35 DALI_TOOLKIT_API void SetMotionStretchProperties(Actor& actor);
38 * @brief Creates a new MotionStretchEffect
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.
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.
61 * @return The newly created Property::Map with the motion stretch effect
63 DALI_TOOLKIT_API Property::Map CreateMotionStretchEffect();
65 } // namespace Toolkit
69 #endif // DALI_TOOLKIT_SHADER_EFFECT_MOTION_STRETCH_H