Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / effects / inc / FUiEffects_RuntimeEffectModelScript.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_RuntimeEffectModelScript.h
19  * @brief       This is the header file for the EffectModelScript class.
20  */
21
22 #ifndef _FUI_EFFECTS_INTERNAL_RUNTIME_EFFECT_MODEL_SCRIPT_H_
23 #define _FUI_EFFECTS_INTERNAL_RUNTIME_EFFECT_MODEL_SCRIPT_H_
24
25 #include "utils/FUiEffects_UtilsLuaMat4.h"
26 #include "FUiEffects_RuntimeModel.h"
27 #include "FUiEffects_RuntimeEffectModel.h"
28 #include "FUiEffects_RuntimePropertyCast.h"
29
30 namespace Tizen { namespace Ui { namespace Effects { namespace _Runtime
31 {
32
33 class EffectModel;
34 class IEffectModelScript;
35 class UnitLight;
36
37 /**
38  * @class       EffectModelScript
39  * @brief       This class is used by toLua subsystem for binding Lua with EffectModel
40  *
41  * @since 2.0
42  *
43  */
44
45 //tolua_begin           <--(!do not edit!)the beginning of export part to lua
46 class EffectModelScript
47 {
48 //tolua_end                     <--(!do not edit!)the ending of export part to lua
49
50 public:
51         /**
52          * EffectModelScript class constructor
53          *
54          * @since 2.0
55          *
56          */
57         EffectModelScript(IEffectModelScript* pEModel);
58
59         /**
60          * EffectModelScript class destructor
61          *
62          * @since 2.0
63          *
64          */
65         ~EffectModelScript(void);
66
67 //tolua_begin           <--(!do not edit!)the beginning of export part to lua
68         /**
69          * Returns EffectModel's element's property
70          *
71          * @since 2.0
72          *
73          * @remarks             Transmits event GetProperty from script functions to up level
74          *                              via interface IEffectModelScript
75          */
76         PropertyCast GetProperty(long objID, ElementProperty property) const;
77
78         /**
79          * Sets EffectModel's element's property of boolean type.
80          *
81          * @since 2.0
82          *
83          * @remarks             Transmits event SetProperty from script functions to up level
84          *                              via interface IEffectModelScript
85          */
86         bool SetProperty(long objID, ElementProperty property, bool value);
87
88         /**
89          * Sets EffectModel's element's property of lua_Number type (floating point or integer).
90          *
91          * @since 2.0
92          *
93          * @remarks             Transmits event SetProperty from script functions to up level
94          *                              via interface IEffectModelScript
95          */
96         bool SetProperty(long objID, ElementProperty property, LUA_NUMBER value);
97
98         /**
99          * Sets EffectModel's element's property of Vec3f type.
100          *
101          * @since 2.0
102          *
103          * @remarks             Transmits event SetProperty from script functions to up level
104          *                              via interface IEffectModelScript
105          */
106         //tolua_end                     <--(!do not edit!)the ending of export part to lua
107         bool SetProperty(long objID, ElementProperty property, const Tizen::Ui::Effects::_Utils::Vec3f &value);
108         //tolua_begin           <--(!do not edit!)the beginning of export part to lua
109 #if 0
110         bool SetProperty(long objID, ElementProperty property, const Vector3 &value);           //for export to lua, should be ignored by c++ compiler
111 #endif
112
113         /**
114          * Sets property's value for elements group
115          *
116          * @since 2.0
117          *
118          */
119         bool SetPropertyGroup(long modelSurfaceID, GroupElements group, ElementProperty property, LUA_NUMBER value);
120
121         /**
122          * Calculates distance from specified model surface to its ground level
123          *
124          * @since 2.0
125          *
126          */
127         PropertyCast GetDistanceFromGround(long modelSurfaceID) const;
128
129         /**
130          * Generates request for bitmap updating.
131          *
132          * @since 2.0
133          *
134          * @remarks             Transmits event UpdateBitmap from script functions to up level
135          *                              via interface IEffectModelScript
136          */
137         bool UpdateBitmap(long graphicalSurfaceID, long bitmapID);
138
139         /**
140          * Returns a vector of vectors of nearest points ID to specified point of graphical surface
141          *
142          * @since 2.0
143          *
144          * @remarks             Transmits event GetNearestGPoint from script functions to up level
145          *                              via interface IEffectModelScript
146          */
147         //tolua_end                     <--(!do not edit!)the ending of export part to lua
148         PropertyCast GetNearestPointsIds(long graphicalSurfaceID, Tizen::Ui::Effects::_Utils::Vec3f &position) const;
149         //tolua_begin           <--(!do not edit!)the beginning of export part to lua
150 #if 0
151         PropertyCast GetNearestPointsIds(long graphicalSurfaceID, Vector3 &position) const;     //for export to lua, should be ignored by c++ compiler
152 #endif
153
154         /**
155          * Returns a vector of vectors of nearest points ID to specified point of graphical surface
156          *
157          * @since 2.0
158          *
159          * @remarks             Transmits event GetNearestGPoint from script functions to up level
160          *                              via interface IEffectModelScript
161          */
162         PropertyCast GetNearestPointsIds(long graphicalSurfaceID, float posX, float posY, float posZ) const;
163
164         /**
165          * Rotates model matrix by the Angle around Axis drawn from the Point
166          *
167          * @since 2.0
168          *
169          * @return              Returns true if model matrix was changed successfully and false otherwise
170          * @param [in]  GraphicalSurfaceID: ID of graphical surface which matrix has to be rotated
171          * @param [in]  Angle: The angle of rotation (radians)
172          * @param [in]  Axis: One of the axes (X, Y, Z, ARBITRARY) around which rotation will be performed
173          * @param [in]  Point: Base point on graphical surface which coordinates are not change
174          * @param [in]  ax, ay, az: The coordinates of axis around which rotation will be performed (in case Axis=AXIS_ARBITRARY)
175          * @param [in]  x0, y0, z0: Base point which coordinates are not change (in case Point=POINT_ARBITRARY)
176          *
177          */
178         bool RotateSurfaceN(long graphicalSurfaceID, float angle, _Axis axis, _Point point,
179                                                 float ax = 0.f, float ay = 0.f, float az = 1.f, float x0 = 0.f, float y0 = 0.f, float z0 = 0.f);
180
181         /**
182          * Rotates model matrix by the Angle around Axis drawn from the Point
183          *
184          * @since 2.0
185          *
186          * @return              Returns true if model matrix was changed successfully and false otherwise
187          * @param [in]  GraphicalSurfaceID: ID of graphical surface which matrix has to be rotated
188          * @param [in]  Angle: The angle of rotation (radians)
189          * @param [in]  Axis: One of the axes (X, Y, Z, ARBITRARY) around which rotation will be performed
190          * @param [in]  Point: Base point on graphical surface which coordinates are not change
191          * @param [in]  vAxis: The axis as vector around which rotation will be performed (in case Axis=AXIS_ARBITRARY)
192          * @param [in]  vBasePoint0: Base point which coordinates are not change (in case Point=POINT_ARBITRARY)
193          *
194          */
195         //tolua_end                     <--(!do not edit!)the ending of export part to lua
196         bool RotateSurfaceV(long graphicalSurfaceID, float angle, _Axis axis, _Point point,
197                                                 const Tizen::Ui::Effects::_Utils::Vec3f &axisArbit = Tizen::Ui::Effects::_Utils::Vec3f(0.f, 0.f, 1.f), const Tizen::Ui::Effects::_Utils::Vec3f &basePointArbit = Tizen::Ui::Effects::_Utils::Vec3f(0.f, 0.f, 0.f));
198         //tolua_begin           <--(!do not edit!)the beginning of export part to lua
199 #if 0
200         bool RotateSurfaceV(long graphicalSurfaceID, float angle, _Axis axis, _Point point,
201                                                 const Vector3 &axisArbit = Vector3(0.f, 0.f, 1.f), const Vector3 &basePointArbit = Vector3(0.f, 0.f, 0.f));     //for export to lua, should be ignored by c++ compiler
202 #endif
203
204         /**
205          * Scales model matrix by the factors ax, ay, az relative to the axes
206          *
207          * @since 2.0
208          *
209          * @return              Returns true if model matrix was changed successfully and false otherwise
210          * @param [in]  GraphicalSurfaceID: ID of graphical surface which matrix has to be scaled
211          * @param [in]  ax, ay, az: Multipliers for scaling along the axes
212          * @param [in]  Point: Base point on graphical surface which coordinates are not change
213          * @param [in]  x0, y0, z0: Base point which coordinates are not change (in case point=POINT_ARBITRARY)
214          *
215          */
216         bool ScaleSurface(long graphicalSurfaceID, float ax, float ay, float az, _Point point,
217                                                 float x0 = 0.f, float y0 = 0.f, float z0 = 0.f);
218
219         /**
220          * Scales model matrix by the factors encapsulated in vector vMultiplier
221          *
222          * @since 2.0
223          *
224          * @return              Returns true if model matrix was changed successfully and false otherwise
225          * @param [in]  GraphicalSurfaceID: ID of graphical surface which matrix has to be scaled
226          * @param [in]  vMultiplier: Vector of multipliers for scaling along the axes
227          * @param [in]  Point: Base point on graphical surface which coordinates are not change (the coordinates of this point do not change)
228          * @param [in]  vBasePopint0: Base point which coordinates are not change (if case point=POINT_ARBITRARY)
229          *
230          */
231         //tolua_end                             <--(!do not edit!)the ending of export part to lua
232         bool ScaleSurface(long graphicalSurfaceID, const Tizen::Ui::Effects::_Utils::Vec3f &multipliers, _Point point,
233                                                 const ::Tizen::Ui::Effects::_Utils::Vec3f &basePoint = Tizen::Ui::Effects::_Utils::Vec3f(0.f, 0.f, 0.f));
234         //tolua_begin                   <--(!do not edit!)the beginning of export part to lua
235 #if 0
236         bool ScaleSurface(long graphicalSurfaceID, const Vector3 &multipliers, _Point point,
237                                                 const Vector3 &basePoint = Vector3(0.f, 0.f, 0.f));             //for export to lua, should be ignored by c++ compiler
238 #endif
239
240         /**
241          * Translates model matrix by values x0, y0 and z0 relative to the axes
242          *
243          * @since 2.0
244          *
245          * @return              Returns true if model matrix was changed successfully and false otherwise
246          * @param [in]  GraphicalSurfaceID: ID of graphical surface which matrix has to be translated
247          * @param [in]  x0, y0, z0: the coordinates of destination point
248          *
249          */
250         bool MoveSurface(long graphicalSurfaceID, float x0, float y0, float z0);
251
252         /**
253          * Translates model matrix by vector vPointTarget
254          *
255          * @since 2.0
256          *
257          * @return              Returns true if model matrix was changed successfully and false otherwise
258          * @param [in]  GraphicalSurfaceID: ID of graphical surface which matrix has to be translated
259          * @param [in]  vPointTarget: destination point
260          *
261          */
262         //tolua_end                             <--(!do not edit!)the ending of export part to lua
263         bool MoveSurface(long graphicalSurfaceID, const Tizen::Ui::Effects::_Utils::Vec3f &pointTarget);
264         //tolua_begin                   <--(!do not edit!)the beginning of export part to lua
265 #if 0
266         bool MoveSurface(long graphicalSurfaceID, const Vector3 &pointTarget);          //for export to lua, should be ignored by c++ compiler
267 #endif
268
269         /**
270          * Sets identity model matrix
271          *
272          * @since 2.0
273          *
274          * @return              Returns true if model matrix was changed successfully and false otherwise
275          */
276         bool ResetSurfaceTransformation(long graphicalSurfaceID);
277
278         /**
279          * Function for redirection of lua print information
280          *
281          * @since 2.0
282          *
283          * @remarks             Is called from lua function print(...)
284          */
285         static void PrintLuaInfo(const char* pStr);
286
287         /**
288          * Sets the model matrix for specified graphical surface
289          *
290          * @since 2.0
291          */
292         // tolua_end            <--(!do not edit!)the ending of export part to lua
293         bool SetTransformationMatrix(long graphicalSurfaceID, const Tizen::Ui::Effects::_Utils::LuaMatrix4& luaMatrix4);
294         // tolua_begin          <--(!do not edit!)the beginning of export part to lua
295 #if 0
296         bool SetTransformationMatrix(long graphicalSurfaceID, const LuaMatrix4& luaMatrix4);
297 #endif
298
299 // tolua_end            <--(!do not edit!)the ending of export part to lua
300
301         /**
302          * Adds new unit light to scene
303          *
304          * @since 2.0
305          *
306          * @remarks             Returns true if addition was succeeded and false otherwise
307          */
308         bool AddUnitLight(UnitLight& unitLight);                                                //tolua_export
309
310         /**
311          * Excludes specified unit light from scene with using unique name of it
312          *
313          * @since 2.0
314          *
315          * @remarks             Returns true if addition was succeeded and false otherwise
316          */
317         bool RemoveUnitLight(const std::string& name);
318 #if 0
319         bool RemoveUnitLight(const string& name);                                               //tolua_export
320 #endif
321
322         /**
323          * Excludes all units light of specified type from scene
324          *
325          * @since 2.0
326          *
327          * @remarks             Returns true if addition was succeeded and false otherwise
328          */
329         bool RemoveAllUnitsLightType(TypeUnitLight typeUnitLight);              //tolua_export
330
331         /**
332          * Returns specified unit light with using unique name of it
333          *
334          * @since 2.0
335          *
336          */
337         PropertyCast GetUnitLight(const std::string& name) const;
338 #if 0
339         PropertyCast GetUnitLight(const string& name) const;                    //tolua_export
340 #endif
341
342         /**
343          * Sets ambient colour for scene
344          *
345          * @since 2.0
346          *
347          */
348         void SetLightAmbientColour(const Tizen::Ui::Effects::_Utils::Vec3f& ambientColour);
349 #if 0
350         void SetLightAmbientColour(const Vector3& ambientColour);               //tolua_export
351 #endif
352
353         /**
354          * Sets ambient colour for scene
355          *
356          * @since 2.0
357          *
358          */
359         void SetLightAmbientColour(float red, float green, float blue); //tolua_export
360
361         /**
362          * Sets light intensity for scene
363          *
364          * @since 2.0
365          *
366          */
367         void SetLightIntensity(float intensity);                                                //tolua_export
368
369         /**
370          * Sets attenuation for units light on scene
371          *
372          * @since 2.0
373          *
374          */
375         void SetLightAttenuation(float attenuation);                                    //tolua_export
376
377         /**
378          * Returns ambient colour of scene
379          *
380          * @since 2.0
381          *
382          */
383         const Tizen::Ui::Effects::_Utils::Vec3f& GetLightAmbientColour(void) const;
384 #if 0
385         const Vector3& GetLightAmbientColour(void) const;                               //tolua_export
386 #endif
387
388         /**
389          * Returns intensity of units light in a scene (as property of entire scene)
390          *
391          * @since 2.0
392          *
393          */
394         float GetLightIntensity(void) const;                                                    //tolua_export
395
396         /**
397          * Returns attenuation for units light on scene
398          *
399          * @since 2.0
400          *
401          */
402         float GetLightAttenuation(void) const;                                                  //tolua_export
403
404 private:
405         /**
406          * Hidden copy constructor
407          *
408          * @since 2.0
409          *
410          */
411         EffectModelScript(const EffectModelScript &rhs);
412
413         /**
414          * Hidden assignment operator
415          *
416          * @since 2.0
417          *
418          */
419         EffectModelScript &operator=(const EffectModelScript &rhs);
420
421 private:
422
423         IEffectModelScript* __pEModel;                          /**< pointer to interface IEffectModelScript (for transmitting events from script to up level)*/
424
425 }; // EffectModelScript   //tolua_export                <--(!do not edit!)exporting one line to lua
426
427 } } } } // Tizen::Ui::Effects::_Runtime
428
429 #endif //_FUI_EFFECTS_INTERNAL_RUNTIME_EFFECT_MODEL_SCRIPT_H_