Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / effects / inc / FUiEffects_RuntimeModel.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 /**
18  * @file        FUiEffects_RuntimeModel.h
19  * @brief       This file contains the basic enumerations and structures for working with model
20  *
21  */
22
23 #ifndef _FUI_EFFECTS_INTERNAL_RUNTIME_MODEL_H_
24 #define _FUI_EFFECTS_INTERNAL_RUNTIME_MODEL_H_
25
26 #include <list>
27 #include <vector>
28 #include <utils/FUiEffects_Utils.h>
29 #include <FUiEffectsTypes.h>
30
31 namespace Tizen { namespace Ui { namespace Effects { namespace _Runtime
32 {
33
34 const float EFFECT_EPSILONF = std::numeric_limits<float>::epsilon();
35
36 //tolua_begin                                   <--(!do not edit!)the beginning of export part to lua
37
38 enum TypeUnitLight
39 {
40         TYPE_UNIT_LIGHT_POINT,
41         TYPE_UNIT_LIGHT_SPOT,
42         TYPE_UNIT_LIGHT_DIRECTIONAL
43 };
44
45 /**
46 * @enum                 _EffectResult
47 *
48 * Defines possible options of Effect finishing
49 * @since 2.0
50 */
51 enum _EffectResult
52 {
53         EFFECT_CONTINUED = 1,                                   // Effect continued
54         EFFECT_FINISHED                                                 // Effect finished
55 }; //_EffectResult
56
57 /**
58 * @enum         ElementProperty
59 *
60 * For access to Effect's objects property (read, write) from scripts
61 * @since 2.0
62 *
63 */
64 enum ElementProperty
65 {
66         //PointSurface property:
67         B_IS_FIXED,                                     /**< Boolean property is involved into physics calculation*/
68         N_POS_X,                                        /**< Numeric property: the X coordinate of point*/
69         N_POS_Y,                                        /**< Numeric property: the Y coordinate of point*/
70         N_POS_Z,                                        /**< Numeric property: the Z coordinate of point*/
71         N_POS_X_INIT,                           /**< Numeric property: the initial X coordinate of point*/
72         N_POS_Y_INIT,                           /**< Numeric property: the initial Y coordinate of point*/
73         N_POS_Z_INIT,                           /**< Numeric property: the initial Z coordinate of point*/
74         N_MASS,                                         /**< Numeric property: the mass of point*/
75         N_FUSER_X,                                      /**< Numeric property: the X coordinate of user force*/
76         N_FUSER_Y,                                      /**< Numeric property: the Y coordinate of user force*/
77         N_FUSER_Z,                                      /**< Numeric property: the Z coordinate of user force*/
78         N_POINT_RESISTANCE,                     /**< Numeric property: the resistance of point movement*/
79         V_POS,                                          /**< Userdata property (Vector3): the position of point*/
80         V_POS_INIT,                                     /**< Userdata property (Vector3): the initial position of point*/
81         V_FUSER,                                        /**< Userdata property (Vector3): the user force vector*/
82
83         //PointSurfaceNURBS property:
84         N_NURBS_WEIGHT,                         /**< Numeric property: the weight of point (for rendering)*/
85
86         //RodSurface and SpringSurface property:
87         N_STIFFNESS,                            /**< Numeric property: the stiffness of spring or rod*/
88
89         //ModelSurface property:
90         N_ENV_RESISTANCE,                       /**< Numeric property: the environment resistance to movement*/
91         N_NUMBER_ITERATIONS,            /**< Numeric property: number of iterations per one calculation event (not change speed, but more stability)*/
92         N_MODEL_SPEED,                          /**< Numeric property: model speed as animation multiplier*/
93         N_GRAVITY_ACCEL_VALUE,          /**< Numeric property: the length of gravity acceleration vector*/
94         V_GRAVITY_ACCELERATION,         /**< Numeric property: gravity acceleration*/
95
96         //GraphicalSurface property:
97         N_TRANSPARENCY,                         /**< Numeric property: the surface transparency (from 0 (no transparency) to 1)*/
98
99         //EffectModel property
100         N_EFFECT_TIME_PASSED,           /**< Numeric property: time passed from effect beginning*/
101         N_EFFECT_DURATION                       /**< Numeric property: effect duration time*/
102
103 }; // ElementProperty
104
105
106 /**
107 * @enum         GroupElements
108 *
109 * Enumeration for choosing specified group of elements. @n
110 * For example, is used in function SetPropertyGroup for denoting of group
111 * @since 2.0
112 */
113 enum GroupElements
114 {
115         ALL_POINTS,             /**< means that property will be applied for all points in the model*/
116         ALL_SPRINGS,    /**< means that property will be applied for all springs in the model*/
117         ALL_RODS                /**< means that property will be applied for all rods in the model*/
118 }; // GroupElements
119
120 /**
121 * @enum         _Axis
122 *
123 * enumeration for choosing specified axis for rotation around it
124 * @since 2.0
125 */
126 enum _Axis
127 {
128         AXIS_X,                                 /**< denote the X axis */
129         AXIS_Y,                                 /**< denote the Y axis */
130         AXIS_Z,                                 /**< denote the Z axis */
131         AXIS_ARBITRARY                  /**< for denoting arbitrary axis (in case then user may set own arbitrary axis) */
132 }; // _Axis
133
134 /**
135 * @enum         _Point
136 *
137 * Enumeration for base point on graphical surface specification @n
138 * for using in various transformations such as rotation and scaling
139 * @since 2.0
140 *
141 */
142 enum _Point
143 {
144         POINT_LEFT_TOP,                         /**< left of horizontal and top of vertical point on a rectangular graphical surface */
145         POINT_CENTER_TOP,                       /**< center of horizontal and top of vertical point on a rectangular graphical surface */
146         POINT_RIGHT_TOP,                        /**< right of horizontal and top of vertical point on a rectangular graphical surface  */
147         POINT_LEFT_CENTER,                      /**< left of horizontal and center of vertical point on a rectangular graphical surface */
148         POINT_CENTER_CENTER,            /**< center of horizontal and center of vertical point on a rectangular graphical surface */
149         POINT_RIGHT_CENTER,                     /**< right of horizontal and center of vertical point on a rectangular graphical surface */
150         POINT_LEFT_BOTTOM,                      /**< left of horizontal and bottom of vertical point on a rectangular graphical surface */
151         POINT_CENTER_BOTTOM,            /**< center of horizontal and bottom of vertical point on a rectangular graphical surface */
152         POINT_RIGHT_BOTTOM,                     /**< right of horizontal and bottom of vertical point on a rectangular graphical surface */
153         POINT_ARBITRARY                         /**< means that user may specify arbitrary point by it's coordinates */
154 }; // _Point
155
156
157 /**
158 * @class        TouchEventScript
159 *
160 * Structure for working in scripts-handlers of user's touch events
161 *
162 * @since 2.0
163 *
164 */
165 struct TouchEventScript
166 {
167         //tolua_end
168         Tizen::Ui::Effects::_Utils::Vec3f currentPosition;              /**< current position in touch event info */
169         Tizen::Ui::Effects::_Utils::Vec3f startPosition;                /**< first position in touch event info */
170         unsigned long touchId;
171         //tolua_begin
172 #if 0
173         Vector3 currentPosition;                                // for export to lua, must be ignored by c++ compiler
174         Vector3 startPosition;                                  // for export to lua, must be ignored by c++ compiler
175         unsigned long touchId;                                  // for export to lua, must be ignored by c++ compiler
176 #endif
177 }; // TouchEventScript
178 //tolua_end                                             <--(!do not edit!)the ending of export part to lua
179
180 /**
181 * @enum                 _EffectState
182 *
183 *  Defines all possible states of an effect
184 *  @since 2.0
185 *
186 */
187 enum _EffectState
188 {
189         _EFFECT_STATE_RUNNABLE,                                         /**< Ready to start */
190         _EFFECT_STATE_RUNNING,                                          /**< Running */
191         _EFFECT_STATE_RUNTIME_ERROR,                            /**< Runtime error occurred */
192         _EFFECT_STATE_INITIALIZING,                                     /**< Being initialized */
193         _EFFECT_STATE_STARTING,                                         /**< Starting */
194         _EFFECT_STATE_FINISHING                                         /**< Finishing */
195 }; // _EffectState
196
197 /**
198 * @enum         ESurface
199 *
200 * Enumeration for denoting element surface (returning value by function ElementSurface::GetType). @n
201 * The value sequence is important (see ModelSurface::Construct)
202 * @since 2.0
203 *
204 */
205 enum ESurface
206 {
207         ESURFACE_MODEL_SURFACE = 0,
208         ESURFACE_GRAPHICAL_SURFACE,
209         ESURFACE_GRAPHICAL_SURFACE_NURBS,
210         ESURFACE_SPRING_SURFACE,
211         ESURFACE_ROD_SURFACE,
212         ESURFACE_POINT_SURFACE,
213         ESURFACE_POINT_SURFACE_NURBS
214 }; // ESurface
215
216
217 typedef std::list<long> LastShownBitmapIdCollection;
218
219 /**
220 * @class        EffectResultS
221 *
222 * Structure is used in EffectModel instances for runtime result storage
223 *
224 * @since 2.0
225 *
226 */
227 struct EffectResultS
228 {
229         EffectResultS(Tizen::Ui::Effects::EffectResult effectResult_ = static_cast<Tizen::Ui::Effects::EffectResult>(0),
230                                   LastShownBitmapIdCollection lastShownBitmapsId_ = LastShownBitmapIdCollection(1, -1))
231                                         : effectResult(effectResult_)
232                                         , lastShownBitmapsId(lastShownBitmapsId_)
233         {
234         }
235
236         Tizen::Ui::Effects::EffectResult effectResult;
237         LastShownBitmapIdCollection lastShownBitmapsId;
238 };
239
240 template<class T> class EffectsVector
241         : public std::vector<T>
242 {
243 public:
244         explicit EffectsVector(void) : std::vector<T>()
245         {
246         }
247
248         explicit EffectsVector(long n, const T& value = T()) : std::vector<T>(n, value)
249         {
250         }
251
252         EffectsVector(const EffectsVector<T>& rhs) :std::vector<T>(rhs)
253         {
254         }
255
256         template <class InputIterator>
257         EffectsVector(InputIterator first, InputIterator last) : std::vector<T>(first, last)
258         {
259         }
260
261         virtual ~EffectsVector(void)
262         {
263         }
264
265         long GetSize(void) const
266         {
267                 return this->size();
268         }
269 };
270
271 } } } } // Tizen::Ui::Effects::_Runtime
272
273 #endif //_FUI_EFFECTS_INTERNAL_RUNTIME_MODEL_H_