Updated all header files to new format
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / transition-effects / cube-transition-wave-effect-impl.h
1 #ifndef DALI_TOOLKIT_INTERNAL_CUBE_TRANSITION_WAVE_EFFECT_H
2 #define DALI_TOOLKIT_INTERNAL_CUBE_TRANSITION_WAVE_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 // EXTERNAL INCLUDES
22
23 // INTERNAL INCLUDES
24 #include <dali-toolkit/devel-api/transition-effects/cube-transition-wave-effect.h>
25 #include <dali-toolkit/internal/transition-effects/cube-transition-effect-impl.h>
26
27 namespace Dali
28 {
29 namespace Toolkit
30 {
31 class CubeTransitionWaveEffect;
32
33 namespace Internal
34 {
35 class CubeTransitionEffect;
36
37 class CubeTransitionWaveEffect : public CubeTransitionEffect
38 {
39 public:
40   /**
41    * @copydoc Toolkit::CubeTransitionWaveEffect::New
42    */
43   static Toolkit::CubeTransitionWaveEffect New(unsigned int numRows, unsigned int numColumns);
44
45 protected:
46   /**
47    * @copydoc Toolkit::Internal::CubeTransitionEffect::OnInitialize
48    */
49   void OnInitialize() override;
50
51   /**
52    * @copydoc Toolkit::Internal::CubeTransitionEffect::OnStartTransition
53    */
54   void OnStartTransition(Vector2 panPosition, Vector2 panDisplacement) override;
55
56 private:
57   /**
58    * Construct a new CubeTransitionWaveEffect object
59    * @param[in] numRows How many rows of cubes
60    * @param[in] numColumns How many columns of cubes
61    */
62   CubeTransitionWaveEffect(unsigned int numRows, unsigned int numColumns);
63
64   /**
65    * The Saddle surface (Hyperbolic paraboloid)function is used to calculate the delay of rotating animation for each cube
66    * This function calculates the Hyperbolic paraboloid parameters,
67    * and the translation and rotation params for mapping the current stage coordinate to the function defining coordinate system
68    * @param[in] position The press down position of panGesture
69    * @param[in] displacement The displacement vector of panGesture
70    */
71   void CalculateSaddleSurfaceParameters(Vector2 position, Vector2 displacement);
72
73   /**
74    * Calculate the delay of the animation for each cube
75    * @param[in] x The X coordinate of the cube
76    * @param[in] y The Y coordinate of the cube
77    * @return The delay time of the animation
78    */
79   float CalculateDelay(float x, float y, bool forward);
80
81 private:
82   //saddle surface(Hyperbolic paraboloid)function, used to calculate the delay time of each cube
83   //z = 1.0 + y*y/a/a - x*x/b/b
84   //with our selection of parameters(a and b), this value for any cube is between 0.0 and 2.0
85   float   mSaddleAA; //a*a
86   float   mSaddleBB; //b*b
87   float   mSaddleB;  //b
88   Vector2 mTranslation;
89   Vector2 mRotation;
90
91 }; // class CubeTransitionWaveEffect
92
93 } // namespace Internal
94
95 // Helpers for public-api forwarding methods
96
97 inline Internal::CubeTransitionWaveEffect& GetImpl(Dali::Toolkit::CubeTransitionWaveEffect& obj)
98 {
99   DALI_ASSERT_ALWAYS(obj);
100
101   Dali::RefObject& handle = obj.GetImplementation();
102
103   return static_cast<Internal::CubeTransitionWaveEffect&>(handle);
104 }
105
106 inline const Internal::CubeTransitionWaveEffect& GetImpl(const Dali::Toolkit::CubeTransitionWaveEffect& obj)
107 {
108   DALI_ASSERT_ALWAYS(obj);
109
110   const Dali::RefObject& handle = obj.GetImplementation();
111
112   return static_cast<const Internal::CubeTransitionWaveEffect&>(handle);
113 }
114
115 } // namespace Toolkit
116
117 } // namespace Dali
118
119 #endif // DALI_TOOLKIT_INTERNAL_CUBE_TRANSITION_WAVE_EFFECT_H