Merge "Change BuildRequires of dali2-toolkit to Requires" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / page-turn-view / page-turn-book-spine-effect.h
1 #ifndef DALI_PAGE_TURN_BOOK_SPINE_EFFECT_H
2 #define DALI_PAGE_TURN_BOOK_SPINE_EFFECT_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 // INTERNAL INCLUDES
22 #include <dali-toolkit/internal/graphics/builtin-shader-extern-gen.h>
23 #include <dali-toolkit/public-api/visuals/visual-properties.h>
24
25 namespace Dali
26 {
27 namespace Toolkit
28 {
29 namespace Internal
30 {
31 /**
32  * @brief Creates a new PageTurnBookSpineEffect
33  * This is an assisting effect of PageTurnEffect to display a book spine on _static_ pages, and also to flip the image horizontally when needed.
34  *
35  * When the page is turned over in landscape, call
36  * SetIsBackImageVisible(true), this effect can display the back image
37  * correctly after the page been rotated 180 degrees.  To
38  * display the pages visually consistent with its turning state,
39  * please set the uniforms with the same values as the PageTurnEffect.
40  *
41  * Animatable/Constrainable uniforms:
42  *  "uSpineShadowParameter" - The two parameters are the major&minor radius (in pixels) to form an ellipse shape. The top-left
43  *                            quarter of this ellipse is used to calculate spine normal for simulating shadow *
44  *  "uTextureWidth" - 1.0 for single sided page,
45  *                    2.0 for double sided image which has left half part as page front side and right half part as page back side.
46  *
47  * @return The newly created Property::Map with the page turn book spine effect
48  **/
49 inline Property::Map CreatePageTurnBookSpineEffect()
50 {
51   Property::Map map;
52
53   Property::Map customShader;
54
55   customShader[Toolkit::Visual::Shader::Property::VERTEX_SHADER]   = SHADER_PAGE_TURN_BOOK_SPINE_EFFECT_VERT.data();
56   customShader[Toolkit::Visual::Shader::Property::FRAGMENT_SHADER] = SHADER_PAGE_TURN_BOOK_SPINE_EFFECT_FRAG.data();
57
58   map[Toolkit::Visual::Property::SHADER] = customShader;
59   return map;
60 }
61
62 } //namespace Internal
63
64 } // namespace Toolkit
65
66 } // namespace Dali
67
68 #endif // DALI_PAGE_TURN_BOOK_SPINE_EFFECT_H