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