1 #ifndef DALI_PAGE_TURN_BOOK_SPINE_EFFECT_H
2 #define DALI_PAGE_TURN_BOOK_SPINE_EFFECT_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-toolkit/internal/graphics/builtin-shader-extern-gen.h>
23 #include <dali-toolkit/public-api/visuals/visual-properties.h>
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.
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.
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.
47 * @return The newly created Property::Map with the page turn book spine effect
49 inline Property::Map CreatePageTurnBookSpineEffect()
53 Property::Map customShader;
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();
58 map[Toolkit::Visual::Property::SHADER] = customShader;
62 } //namespace Internal
64 } // namespace Toolkit
68 #endif // DALI_PAGE_TURN_BOOK_SPINE_EFFECT_H