Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / effects / runtime / FUiEffects_RuntimeEffectModelScript.cpp
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.cpp
19  * @brief       This file contains an implementation of EffectModelScript class methods
20  *
21  */
22
23 #include <FBaseSys.h>
24 #include <FUiEffects_EffectManagerImpl.h>
25 #include "FUiEffects_RuntimeEffectModelScript.h"
26 #include <FUiEffects_EffectImpl.h>
27
28 using namespace std;
29 using namespace Tizen::Ui::Effects;
30 using namespace Tizen::Ui::Effects::_Utils;
31
32 namespace Tizen { namespace Ui { namespace Effects { namespace _Runtime
33 {
34
35 EffectModelScript::EffectModelScript(IEffectModelScript* pEModel)
36 {
37         __pEModel = pEModel;
38         return;
39 }
40
41 EffectModelScript::~EffectModelScript(void)
42 {
43         return;
44 }
45
46 PropertyCast
47 EffectModelScript::GetProperty(long objID, ElementProperty property) const
48 {
49         return __pEModel->ScriptGetProperty(objID, property);
50 }
51
52 bool
53 EffectModelScript::SetProperty(long objID, ElementProperty property, bool value)
54 {
55         return __pEModel->ScriptSetProperty(objID, property, value);
56 }
57
58 bool
59 EffectModelScript::SetProperty(long objID, ElementProperty property, LUA_NUMBER value)
60 {
61         return __pEModel->ScriptSetProperty(objID, property, value);
62 }
63
64 bool
65 EffectModelScript::SetProperty(long objID, ElementProperty property, const Vec3f &value)
66 {
67         return __pEModel->ScriptSetProperty(objID, property, value);
68 }
69
70 bool
71 EffectModelScript::SetPropertyGroup(long objID, GroupElements group, ElementProperty property, LUA_NUMBER value)
72 {
73         return __pEModel->ScriptSetPropertyGroup(objID, group, property, value);
74 }
75
76 PropertyCast
77 EffectModelScript::GetDistanceFromGround(long modelSurfaceID) const
78 {
79         return __pEModel->ScriptGetDistanceFromGround(modelSurfaceID);
80 }
81
82 bool
83 EffectModelScript::UpdateBitmap(long graphicalSurfaceID, long bitmapID)
84 {
85         return __pEModel->ScriptUpdateBitmap(graphicalSurfaceID, bitmapID);
86 }
87
88 PropertyCast
89 EffectModelScript::GetNearestPointsIds(long graphicalSurfaceID, Vec3f &position) const
90 {
91         return __pEModel->ScriptGetNearestPointsIds(graphicalSurfaceID, position);
92 }
93
94 PropertyCast
95 EffectModelScript::GetNearestPointsIds(long graphicalSurfaceID, float posX, float posY, float posZ) const
96 {
97         Vec3f tempVec3(posX, posY, posZ);
98         return __pEModel->ScriptGetNearestPointsIds(graphicalSurfaceID, tempVec3);
99 }
100
101 bool
102 EffectModelScript::RotateSurfaceN(long graphicalSurfaceID, float angle, _Axis axis, _Point point,
103                                                    float ax, float ay, float az, float x0, float y0, float z0)
104 {
105         return __pEModel->ScriptRotateSurface(graphicalSurfaceID, angle, axis, point,
106                                                                                   ax, ay, az, x0, y0, z0);
107 }
108
109 bool
110 EffectModelScript::RotateSurfaceV(long graphicalSurfaceID, float angle, _Axis axis, _Point point,
111                                                    const Vec3f &axisArbit, const Vec3f &basePointArbit)
112 {
113         return __pEModel->ScriptRotateSurface(graphicalSurfaceID, angle, axis, point,
114                                                                                   axisArbit.x, axisArbit.y, axisArbit.z, basePointArbit.x, basePointArbit.y, basePointArbit.z);
115 }
116
117 bool
118 EffectModelScript::ScaleSurface(long graphicalSurfaceID, float ax, float ay, float az, _Point point,
119                                                                 float x0, float y0, float z0)
120 {
121         return __pEModel->ScriptScaleSurface(graphicalSurfaceID, ax, ay, az, point,
122                                                                                  x0, y0, z0);
123 }
124
125 bool
126 EffectModelScript::ScaleSurface(long graphicalSurfaceID, const Vec3f &multipliers, _Point point,
127                                                                 const Vec3f &basePopintArbit)
128 {
129         return __pEModel->ScriptScaleSurface(graphicalSurfaceID, multipliers.x, multipliers.y, multipliers.z, point,
130                                                                                  basePopintArbit.x, basePopintArbit.y, basePopintArbit.z);
131 }
132
133 bool
134 EffectModelScript::MoveSurface(long graphicalSurfaceId, float x0, float y0, float z0)
135 {
136         return __pEModel->ScriptMoveSurface(graphicalSurfaceId, x0, y0, z0);
137 }
138
139 bool
140 EffectModelScript::MoveSurface(long graphicalSurfaceId, const Vec3f &pointTarget)
141 {
142         return __pEModel->ScriptMoveSurface(graphicalSurfaceId, pointTarget.x, pointTarget.y, pointTarget.z);
143 }
144
145 bool
146 EffectModelScript::ResetSurfaceTransformation(long graphicalSurfaceID)
147 {
148         return __pEModel->ScriptResetSurfaceTransformation(graphicalSurfaceID);
149 }
150
151 void
152 EffectModelScript::PrintLuaInfo(const char* pStr)
153 {
154         SysLog(NID_UI_EFFECT, "%s", pStr);
155         return;
156 }
157
158 bool
159 EffectModelScript::SetTransformationMatrix(long graphicalSurfaceID, const LuaMatrix4& luaMatrix4)
160 {
161         return __pEModel->ScriptSetTransformationMatrix(graphicalSurfaceID, luaMatrix4);
162 }
163
164 //lighting
165 bool
166 EffectModelScript::AddUnitLight(UnitLight& unitLight)
167 {
168         return __pEModel->ScriptAddUnitLight(unitLight);
169 }
170
171 bool
172 EffectModelScript::RemoveUnitLight(const std::string& name)
173 {
174         return __pEModel->ScriptRemoveUnitLight(name);
175 }
176
177 bool
178 EffectModelScript::RemoveAllUnitsLightType(TypeUnitLight typeUnitLight)
179 {
180         return __pEModel->ScriptRemoveAllUnitsLightType(typeUnitLight);
181 }
182
183 PropertyCast
184 EffectModelScript::GetUnitLight(const string& name) const
185 {
186         return __pEModel->ScriptGetUnitLight(name);
187 }
188
189 void
190 EffectModelScript::SetLightAmbientColour(const Vec3f& ambientColour)
191 {
192         __pEModel->ScriptSetLightAmbientColour(ambientColour);
193         return;
194 }
195
196 void
197 EffectModelScript::SetLightAmbientColour(float red, float green, float blue)
198 {
199         __pEModel->ScriptSetLightAmbientColour(red, green, blue);
200         return;
201 }
202
203 void
204 EffectModelScript::SetLightIntensity(float intensity)
205 {
206         __pEModel->ScriptSetLightIntensity(intensity);
207         return;
208 }
209
210 void
211 EffectModelScript::SetLightAttenuation(float attenuation)
212 {
213         __pEModel->ScriptSetLightAttenuation(attenuation);
214         return;
215 }
216
217 const Vec3f&
218 EffectModelScript::GetLightAmbientColour(void) const
219 {
220         return __pEModel->ScriptGetLightAmbientColour();
221 }
222
223 float
224 EffectModelScript::GetLightIntensity(void) const
225 {
226         return __pEModel->ScriptGetLightIntensity();
227 }
228
229 float
230 EffectModelScript::GetLightAttenuation(void) const
231 {
232         return __pEModel->ScriptGetLightAttenuation();
233 }
234
235 } } } } // Tizen::Ui::Effects::_Runtime