summaryrefslogtreecommitdiff
path: root/src/examples/evas/evas-3d-shadows.c
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2016-03-01 18:06:28 +0000
committerTom Hacohen <tom@stosb.com>2016-03-03 09:58:08 +0000
commitf21ade6123b9053fca8d1632644c48525a99d6e0 (patch)
treec5eb0445f471d21365a7a5a7b0ec7d279c11b398 /src/examples/evas/evas-3d-shadows.c
parent3faf3f3fc68a839f06b311c35ba020cb25e7c9c4 (diff)
Automatic migration to Eo4.
I just ran my script (email to follow) to migrate all of the EFL automatically. This commit is *only* the automatic conversion, so it can be easily reverted and re-run.
Diffstat (limited to 'src/examples/evas/evas-3d-shadows.c')
-rw-r--r--src/examples/evas/evas-3d-shadows.c470
1 files changed, 201 insertions, 269 deletions
diff --git a/src/examples/evas/evas-3d-shadows.c b/src/examples/evas/evas-3d-shadows.c
index 8fe1495..f70d7e4 100644
--- a/src/examples/evas/evas-3d-shadows.c
+++ b/src/examples/evas/evas-3d-shadows.c
@@ -84,20 +84,20 @@ _cb_clicked(void *data EINA_UNUSED, const Eo_Event *event)
84 Eina_List *meshes = NULL, *l; 84 Eina_List *meshes = NULL, *l;
85 Evas_Canvas3D_Mesh *m; 85 Evas_Canvas3D_Mesh *m;
86 Evas_Canvas3D_Node *billboard = NULL; 86 Evas_Canvas3D_Node *billboard = NULL;
87 eo_do((Evas_Canvas3D_Node *)event->event_info, meshes = (Eina_List *)evas_canvas3d_node_mesh_list_get()); 87 meshes = (Eina_List *)evas_canvas3d_node_mesh_list_get((Evas_Canvas3D_Node *)event->event_info);
88 EINA_LIST_FOREACH(meshes, l, m) 88 EINA_LIST_FOREACH(meshes, l, m)
89 { 89 {
90 eo_do(m, evas_canvas3d_mesh_shade_mode_set(EVAS_CANVAS3D_SHADE_MODE_DIFFUSE)); 90 evas_canvas3d_mesh_shade_mode_set(m, EVAS_CANVAS3D_SHADE_MODE_DIFFUSE);
91 } 91 }
92 if (choosed_node != (Evas_Canvas3D_Node *)event->event_info) 92 if (choosed_node != (Evas_Canvas3D_Node *)event->event_info)
93 { 93 {
94 eo_do(choosed_node, billboard = evas_canvas3d_node_billboard_target_get()); 94 billboard = evas_canvas3d_node_billboard_target_get(choosed_node);
95 if (!billboard) 95 if (!billboard)
96 { 96 {
97 eo_do(choosed_node, meshes = (Eina_List *)evas_canvas3d_node_mesh_list_get()); 97 meshes = (Eina_List *)evas_canvas3d_node_mesh_list_get(choosed_node);
98 EINA_LIST_FOREACH(meshes, l, m) 98 EINA_LIST_FOREACH(meshes, l, m)
99 { 99 {
100 eo_do(m, evas_canvas3d_mesh_shade_mode_set(EVAS_CANVAS3D_SHADE_MODE_PHONG)); 100 evas_canvas3d_mesh_shade_mode_set(m, EVAS_CANVAS3D_SHADE_MODE_PHONG);
101 } 101 }
102 } 102 }
103 choosed_node = (Evas_Canvas3D_Node *)event->event_info; 103 choosed_node = (Evas_Canvas3D_Node *)event->event_info;
@@ -111,10 +111,10 @@ _cb_collision(void *data EINA_UNUSED, const Eo_Event *event)
111{ 111{
112 Eina_List *meshes = NULL, *l; 112 Eina_List *meshes = NULL, *l;
113 Evas_Canvas3D_Mesh *m; 113 Evas_Canvas3D_Mesh *m;
114 eo_do((Evas_Canvas3D_Node *)event->event_info, meshes = (Eina_List *)evas_canvas3d_node_mesh_list_get()); 114 meshes = (Eina_List *)evas_canvas3d_node_mesh_list_get((Evas_Canvas3D_Node *)event->event_info);
115 EINA_LIST_FOREACH(meshes, l, m) 115 EINA_LIST_FOREACH(meshes, l, m)
116 { 116 {
117 eo_do(m, evas_canvas3d_mesh_shade_mode_set(EVAS_CANVAS3D_SHADE_MODE_DIFFUSE)); 117 evas_canvas3d_mesh_shade_mode_set(m, EVAS_CANVAS3D_SHADE_MODE_DIFFUSE);
118 } 118 }
119 119
120 return EINA_TRUE; 120 return EINA_TRUE;
@@ -142,20 +142,15 @@ _animate_scene(void *data)
142 Scene_Data *scene = (Scene_Data *)data; 142 Scene_Data *scene = (Scene_Data *)data;
143 if (scene->init) 143 if (scene->init)
144 { 144 {
145 eo_do(scene->mediator, 145 evas_canvas3d_node_position_get(scene->mediator, EVAS_CANVAS3D_SPACE_PARENT, &x, &y, &z);
146 evas_canvas3d_node_position_get(EVAS_CANVAS3D_SPACE_PARENT, &x, &y, &z)); 146 evas_canvas3d_node_position_set(scene->mediator, sin(angle) * 20, y, cos(angle) * 20);
147 eo_do(scene->mediator, 147 evas_canvas3d_node_look_at_set(scene->mediator, EVAS_CANVAS3D_SPACE_PARENT, 0.0, 3.0, 0.0, EVAS_CANVAS3D_SPACE_PARENT, 0.0, 5.0, 0.0);
148 evas_canvas3d_node_position_set(sin(angle) * 20 , y , cos(angle) * 20),
149 evas_canvas3d_node_look_at_set(EVAS_CANVAS3D_SPACE_PARENT, 0.0, 3.0, 0.0,
150 EVAS_CANVAS3D_SPACE_PARENT, 0.0, 5.0, 0.0));
151 angle += 0.005; 148 angle += 0.005;
152 if (angle > 360) angle = 0.0; 149 if (angle > 360) angle = 0.0;
153 } 150 }
154 else 151 else
155 eo_do(scene->mediator, 152 evas_canvas3d_node_position_set(scene->mediator, 0.0, 6.0, 12.0);
156 evas_canvas3d_node_position_set(0.0, 6.0, 12.0), 153 evas_canvas3d_node_look_at_set(scene->mediator, EVAS_CANVAS3D_SPACE_PARENT, 0.0, 3.0, 0.0, EVAS_CANVAS3D_SPACE_PARENT, 0.0, 5.0, 0.0);
157 evas_canvas3d_node_look_at_set(EVAS_CANVAS3D_SPACE_PARENT, 0.0, 3.0, 0.0,
158 EVAS_CANVAS3D_SPACE_PARENT, 0.0, 5.0, 0.0));
159 154
160 return EINA_TRUE; 155 return EINA_TRUE;
161} 156}
@@ -172,8 +167,8 @@ _on_canvas_resize(Ecore_Evas *ee)
172 int w, h; 167 int w, h;
173 168
174 ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); 169 ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
175 eo_do(background, efl_gfx_size_set(w, h)); 170 efl_gfx_size_set(background, w, h);
176 eo_do(image, efl_gfx_size_set(w, h)); 171 efl_gfx_size_set(image, w, h);
177} 172}
178 173
179static void 174static void
@@ -181,83 +176,70 @@ _body_material_set(Body_3D *body, float r, float g, float b)
181{ 176{
182 body->material = eo_add(EVAS_CANVAS3D_MATERIAL_CLASS, evas); 177 body->material = eo_add(EVAS_CANVAS3D_MATERIAL_CLASS, evas);
183 178
184 eo_do(body->material, 179 evas_canvas3d_material_enable_set(body->material, EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, EINA_TRUE);
185 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, EINA_TRUE), 180 evas_canvas3d_material_enable_set(body->material, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, EINA_TRUE);
186 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, EINA_TRUE), 181 evas_canvas3d_material_enable_set(body->material, EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, EINA_TRUE);
187 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, EINA_TRUE), 182 evas_canvas3d_material_color_set(body->material, EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, r, g, b, 1.0);
183 evas_canvas3d_material_color_set(body->material, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, r, g, b, 1.0);
184 evas_canvas3d_material_color_set(body->material, EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, 1.0, 1.0, 1.0, 1.0);
185 evas_canvas3d_material_shininess_set(body->material, 100.0);
188 186
189 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, r, g, b, 1.0), 187 evas_canvas3d_mesh_shade_mode_set(body->mesh, EVAS_CANVAS3D_SHADE_MODE_PHONG);
190 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, r, g, b, 1.0), 188 evas_canvas3d_mesh_frame_material_set(body->mesh, 0, body->material);
191 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, 1.0, 1.0, 1.0, 1.0),
192 evas_canvas3d_material_shininess_set(100.0));
193
194 eo_do(body->mesh,
195 evas_canvas3d_mesh_shade_mode_set(EVAS_CANVAS3D_SHADE_MODE_PHONG),
196 evas_canvas3d_mesh_frame_material_set(0, body->material));
197} 189}
198 190
199static void 191static void
200_sphere_setup(Body_3D *sphere) 192_sphere_setup(Body_3D *sphere)
201{ 193{
202 sphere->primitive = eo_add(EVAS_CANVAS3D_PRIMITIVE_CLASS, evas); 194 sphere->primitive = eo_add(EVAS_CANVAS3D_PRIMITIVE_CLASS, evas);
203 eo_do(sphere->primitive, 195 evas_canvas3d_primitive_form_set(sphere->primitive, EVAS_CANVAS3D_MESH_PRIMITIVE_SPHERE);
204 evas_canvas3d_primitive_form_set(EVAS_CANVAS3D_MESH_PRIMITIVE_SPHERE), 196 evas_canvas3d_primitive_precision_set(sphere->primitive, 50);
205 evas_canvas3d_primitive_precision_set(50));
206 197
207 sphere->mesh = eo_add(EVAS_CANVAS3D_MESH_CLASS, evas); 198 sphere->mesh = eo_add(EVAS_CANVAS3D_MESH_CLASS, evas);
208 eo_do(sphere->mesh, 199 evas_canvas3d_mesh_from_primitive_set(sphere->mesh, 0, sphere->primitive);
209 evas_canvas3d_mesh_from_primitive_set(0, sphere->primitive));
210 200
211 _body_material_set(sphere, 1, 0.0, 0.0); 201 _body_material_set(sphere, 1, 0.0, 0.0);
212 202
213 sphere->node = eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, 203 sphere->node = eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(eoid, EVAS_CANVAS3D_NODE_TYPE_MESH), evas_canvas3d_node_position_set(eoid, 3.0, 3.0, 0.0));
214 evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_MESH), 204 evas_canvas3d_node_mesh_add(sphere->node, sphere->mesh);
215 evas_canvas3d_node_position_set(3.0, 3.0, 0.0));
216 eo_do(sphere->node, evas_canvas3d_node_mesh_add(sphere->mesh));
217} 205}
218 206
219static void 207static void
220_cone_setup(Body_3D *cone) 208_cone_setup(Body_3D *cone)
221{ 209{
222 cone->primitive = eo_add(EVAS_CANVAS3D_PRIMITIVE_CLASS, evas); 210 cone->primitive = eo_add(EVAS_CANVAS3D_PRIMITIVE_CLASS, evas);
223 eo_do(cone->primitive, 211 evas_canvas3d_primitive_form_set(cone->primitive, EVAS_CANVAS3D_MESH_PRIMITIVE_CONE);
224 evas_canvas3d_primitive_form_set(EVAS_CANVAS3D_MESH_PRIMITIVE_CONE), 212 evas_canvas3d_primitive_precision_set(cone->primitive, 50);
225 evas_canvas3d_primitive_precision_set(50));
226 213
227 cone->mesh = eo_add(EVAS_CANVAS3D_MESH_CLASS, evas); 214 cone->mesh = eo_add(EVAS_CANVAS3D_MESH_CLASS, evas);
228 eo_do(cone->mesh, 215 evas_canvas3d_mesh_from_primitive_set(cone->mesh, 0, cone->primitive);
229 evas_canvas3d_mesh_from_primitive_set(0, cone->primitive));
230 216
231 _body_material_set(cone, 0.8, 0.5, 0.5); 217 _body_material_set(cone, 0.8, 0.5, 0.5);
232 218
233 cone->node = 219 cone->node =
234 eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, 220 eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(eoid, EVAS_CANVAS3D_NODE_TYPE_MESH));
235 evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_MESH)); 221 evas_canvas3d_node_mesh_add(cone->node, cone->mesh);
236 eo_do(cone->node, evas_canvas3d_node_mesh_add(cone->mesh), 222 evas_canvas3d_node_orientation_angle_axis_set(cone->node, -90.0, 1.0, 0.0, 0.0);
237 evas_canvas3d_node_orientation_angle_axis_set(-90.0, 1.0, 0.0, 0.0), 223 evas_canvas3d_node_position_set(cone->node, -4.0, 0.0, -3.0);
238 evas_canvas3d_node_position_set(-4.0, 0.0, -3.0));
239} 224}
240 225
241static void 226static void
242_cylinder_setup(Body_3D *cylinder) 227_cylinder_setup(Body_3D *cylinder)
243{ 228{
244 cylinder->primitive = eo_add(EVAS_CANVAS3D_PRIMITIVE_CLASS, evas); 229 cylinder->primitive = eo_add(EVAS_CANVAS3D_PRIMITIVE_CLASS, evas);
245 eo_do(cylinder->primitive, 230 evas_canvas3d_primitive_form_set(cylinder->primitive, EVAS_CANVAS3D_MESH_PRIMITIVE_CYLINDER);
246 evas_canvas3d_primitive_form_set(EVAS_CANVAS3D_MESH_PRIMITIVE_CYLINDER), 231 evas_canvas3d_primitive_precision_set(cylinder->primitive, 50);
247 evas_canvas3d_primitive_precision_set(50));
248 232
249 cylinder->mesh = eo_add(EVAS_CANVAS3D_MESH_CLASS, evas); 233 cylinder->mesh = eo_add(EVAS_CANVAS3D_MESH_CLASS, evas);
250 eo_do(cylinder->mesh, 234 evas_canvas3d_mesh_from_primitive_set(cylinder->mesh, 0, cylinder->primitive);
251 evas_canvas3d_mesh_from_primitive_set(0, cylinder->primitive));
252 235
253 _body_material_set(cylinder, 0.0, 0.0, 1.0); 236 _body_material_set(cylinder, 0.0, 0.0, 1.0);
254 237
255 cylinder->node = 238 cylinder->node =
256 eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, 239 eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(eoid, EVAS_CANVAS3D_NODE_TYPE_MESH));
257 evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_MESH)); 240 evas_canvas3d_node_mesh_add(cylinder->node, cylinder->mesh);
258 eo_do(cylinder->node, evas_canvas3d_node_mesh_add(cylinder->mesh), 241 evas_canvas3d_node_orientation_angle_axis_set(cylinder->node, -90.0, 1.0, 0.0, 0.0);
259 evas_canvas3d_node_orientation_angle_axis_set(-90.0, 1.0, 0.0, 0.0), 242 evas_canvas3d_node_position_set(cylinder->node, -2.0, 3.0, 1.0);
260 evas_canvas3d_node_position_set(-2.0, 3.0, 1.0));
261} 243}
262 244
263static void 245static void
@@ -265,228 +247,184 @@ _fence_setup(Body_3D *fence)
265{ 247{
266 248
267 Eo *texture = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas); 249 Eo *texture = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas);
268 eo_do(texture, evas_canvas3d_texture_atlas_enable_set(EINA_FALSE)); 250 evas_canvas3d_texture_atlas_enable_set(texture, EINA_FALSE);
269 eo_do(texture, 251 evas_canvas3d_texture_file_set(texture, PACKAGE_EXAMPLES_DIR EVAS_IMAGE_FOLDER "/grid.png", NULL);
270 evas_canvas3d_texture_file_set(PACKAGE_EXAMPLES_DIR EVAS_IMAGE_FOLDER "/grid.png", NULL), 252 evas_canvas3d_texture_filter_set(texture, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST);
271 evas_canvas3d_texture_filter_set(EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, 253 evas_canvas3d_texture_wrap_set(texture, EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT);
272 EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST),
273 evas_canvas3d_texture_wrap_set(EVAS_CANVAS3D_WRAP_MODE_REPEAT,
274 EVAS_CANVAS3D_WRAP_MODE_REPEAT));
275 Eo *texture1 = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas); 254 Eo *texture1 = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas);
276 eo_do(texture1, evas_canvas3d_texture_atlas_enable_set(EINA_FALSE)); 255 evas_canvas3d_texture_atlas_enable_set(texture1, EINA_FALSE);
277 eo_do(texture1, 256 evas_canvas3d_texture_file_set(texture1, PACKAGE_EXAMPLES_DIR EVAS_IMAGE_FOLDER "/grid_n.png", NULL);
278 evas_canvas3d_texture_file_set(PACKAGE_EXAMPLES_DIR EVAS_IMAGE_FOLDER "/grid_n.png", NULL), 257 evas_canvas3d_texture_filter_set(texture1, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST);
279 evas_canvas3d_texture_filter_set(EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, 258 evas_canvas3d_texture_wrap_set(texture1, EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT);
280 EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST),
281 evas_canvas3d_texture_wrap_set(EVAS_CANVAS3D_WRAP_MODE_REPEAT,
282 EVAS_CANVAS3D_WRAP_MODE_REPEAT));
283 fence->material = eo_add(EVAS_CANVAS3D_MATERIAL_CLASS, evas); 259 fence->material = eo_add(EVAS_CANVAS3D_MATERIAL_CLASS, evas);
284 260
285 eo_do(fence->material, 261 evas_canvas3d_material_texture_set(fence->material, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, texture);
286 evas_canvas3d_material_texture_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, texture), 262 evas_canvas3d_material_texture_set(fence->material, EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, texture);
287 evas_canvas3d_material_texture_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, texture), 263 evas_canvas3d_material_enable_set(fence->material, EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, EINA_TRUE);
288 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, EINA_TRUE), 264 evas_canvas3d_material_enable_set(fence->material, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, EINA_TRUE);
289 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, EINA_TRUE), 265 evas_canvas3d_material_enable_set(fence->material, EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, EINA_TRUE);
290 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, EINA_TRUE), 266 evas_canvas3d_material_enable_set(fence->material, EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL, EINA_TRUE);
291 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL, EINA_TRUE), 267 evas_canvas3d_material_texture_set(fence->material, EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL, texture1);
292 evas_canvas3d_material_texture_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL, texture1), 268 evas_canvas3d_material_color_set(fence->material, EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, 1.0, 1.0, 1.0, 1.0);
293 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, 1.0, 1.0, 1.0, 1.0), 269 evas_canvas3d_material_color_set(fence->material, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, 1.0, 1.0, 1.0, 1.0);
294 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, 1.0, 1.0, 1.0, 1.0), 270 evas_canvas3d_material_color_set(fence->material, EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, 1.0, 1.0, 1.0, 1.0);
295 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, 1.0, 1.0, 1.0, 1.0), 271 evas_canvas3d_material_shininess_set(fence->material, 100.0);
296 evas_canvas3d_material_shininess_set(100.0));
297 272
298 fence->primitive = eo_add(EVAS_CANVAS3D_PRIMITIVE_CLASS, evas); 273 fence->primitive = eo_add(EVAS_CANVAS3D_PRIMITIVE_CLASS, evas);
299 eo_do(fence->primitive, 274 evas_canvas3d_primitive_form_set(fence->primitive, EVAS_CANVAS3D_MESH_PRIMITIVE_CYLINDER);
300 evas_canvas3d_primitive_form_set(EVAS_CANVAS3D_MESH_PRIMITIVE_CYLINDER), 275 evas_canvas3d_primitive_mode_set(fence->primitive, EVAS_CANVAS3D_PRIMITIVE_MODE_WITHOUT_BASE);
301 evas_canvas3d_primitive_mode_set(EVAS_CANVAS3D_PRIMITIVE_MODE_WITHOUT_BASE), 276 evas_canvas3d_primitive_tex_scale_set(fence->primitive, 160.0, 12.0);
302 evas_canvas3d_primitive_tex_scale_set(160.0, 12.0), 277 evas_canvas3d_primitive_precision_set(fence->primitive, 50);
303 evas_canvas3d_primitive_precision_set(50));
304 278
305 fence->mesh = eo_add(EVAS_CANVAS3D_MESH_CLASS, evas); 279 fence->mesh = eo_add(EVAS_CANVAS3D_MESH_CLASS, evas);
306 eo_do(fence->mesh, 280 evas_canvas3d_mesh_from_primitive_set(fence->mesh, 0, fence->primitive);
307 evas_canvas3d_mesh_from_primitive_set(0, fence->primitive)); 281
308 282 evas_canvas3d_mesh_frame_material_set(fence->mesh, 0, fence->material);
309 eo_do(fence->mesh, 283 evas_canvas3d_mesh_alpha_func_set(fence->mesh, EVAS_CANVAS3D_COMPARISON_GREATER, 0);
310 evas_canvas3d_mesh_frame_material_set(0, fence->material), 284 evas_canvas3d_mesh_alpha_test_enable_set(fence->mesh, EINA_TRUE);
311 evas_canvas3d_mesh_alpha_func_set(EVAS_CANVAS3D_COMPARISON_GREATER, 0), 285 evas_canvas3d_mesh_shade_mode_set(fence->mesh, EVAS_CANVAS3D_SHADE_MODE_NORMAL_MAP);
312 evas_canvas3d_mesh_alpha_test_enable_set(EINA_TRUE),
313 evas_canvas3d_mesh_shade_mode_set(EVAS_CANVAS3D_SHADE_MODE_NORMAL_MAP));
314 fence->node = 286 fence->node =
315 eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, 287 eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(eoid, EVAS_CANVAS3D_NODE_TYPE_MESH));
316 evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_MESH)); 288 evas_canvas3d_node_mesh_add(fence->node, fence->mesh);
317 eo_do(fence->node, evas_canvas3d_node_mesh_add(fence->mesh), 289 evas_canvas3d_node_orientation_angle_axis_set(fence->node, -90.0, 1.0, 0.0, 0.0);
318 evas_canvas3d_node_orientation_angle_axis_set(-90.0, 1.0, 0.0, 0.0), 290 evas_canvas3d_node_scale_set(fence->node, 10.0, 10.0, 5.0);
319 evas_canvas3d_node_scale_set(10.0, 10.0, 5.0), 291 evas_canvas3d_node_position_set(fence->node, 0.0, -1.0, -2.0);
320 evas_canvas3d_node_position_set(0.0, -1.0, -2.0));
321} 292}
322 293
323static void 294static void
324_square_setup(Body_3D *square) 295_square_setup(Body_3D *square)
325{ 296{
326 square->primitive = eo_add(EVAS_CANVAS3D_PRIMITIVE_CLASS, evas); 297 square->primitive = eo_add(EVAS_CANVAS3D_PRIMITIVE_CLASS, evas);
327 eo_do(square->primitive, 298 evas_canvas3d_primitive_form_set(square->primitive, EVAS_CANVAS3D_MESH_PRIMITIVE_SQUARE);
328 evas_canvas3d_primitive_form_set(EVAS_CANVAS3D_MESH_PRIMITIVE_SQUARE));
329 299
330 square->mesh = eo_add(EVAS_CANVAS3D_MESH_CLASS, evas); 300 square->mesh = eo_add(EVAS_CANVAS3D_MESH_CLASS, evas);
331 eo_do(square->mesh, 301 evas_canvas3d_mesh_from_primitive_set(square->mesh, 0, square->primitive);
332 evas_canvas3d_mesh_from_primitive_set(0, square->primitive));
333 302
334 _body_material_set(square, 0.4, 0.4, 0.4); 303 _body_material_set(square, 0.4, 0.4, 0.4);
335 304
336 square->node = 305 square->node =
337 eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, 306 eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(eoid, EVAS_CANVAS3D_NODE_TYPE_MESH));
338 evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_MESH)); 307 evas_canvas3d_node_mesh_add(square->node, square->mesh);
339 eo_do(square->node, evas_canvas3d_node_mesh_add(square->mesh), 308 evas_canvas3d_node_position_set(square->node, 0.0, -1.0, 0.0);
340 evas_canvas3d_node_position_set(0.0, -1.0, 0.0), 309 evas_canvas3d_node_scale_set(square->node, 30.0, 30.0, 30.0);
341 evas_canvas3d_node_scale_set(30.0, 30.0, 30.0), 310 evas_canvas3d_node_orientation_angle_axis_set(square->node, 90.0, 1.0, 0.0, 0.0);
342 evas_canvas3d_node_orientation_angle_axis_set(90.0, 1.0, 0.0, 0.0));
343} 311}
344 312
345static void 313static void
346_box_setup(Body_3D *box) 314_box_setup(Body_3D *box)
347{ 315{
348 box->primitive = eo_add(EVAS_CANVAS3D_PRIMITIVE_CLASS, evas); 316 box->primitive = eo_add(EVAS_CANVAS3D_PRIMITIVE_CLASS, evas);
349 eo_do(box->primitive, 317 evas_canvas3d_primitive_form_set(box->primitive, EVAS_CANVAS3D_MESH_PRIMITIVE_CUBE);
350 evas_canvas3d_primitive_form_set(EVAS_CANVAS3D_MESH_PRIMITIVE_CUBE));
351 318
352 box->mesh = eo_add(EVAS_CANVAS3D_MESH_CLASS, evas); 319 box->mesh = eo_add(EVAS_CANVAS3D_MESH_CLASS, evas);
353 eo_do(box->mesh, 320 evas_canvas3d_mesh_from_primitive_set(box->mesh, 0, box->primitive);
354 evas_canvas3d_mesh_from_primitive_set(0, box->primitive));
355 321
356 _body_material_set(box, 0, 1, 0); 322 _body_material_set(box, 0, 1, 0);
357 323
358 box->node = eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, 324 box->node = eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(eoid, EVAS_CANVAS3D_NODE_TYPE_MESH));
359 evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_MESH)); 325 evas_canvas3d_node_mesh_add(box->node, box->mesh);
360 eo_do(box->node, evas_canvas3d_node_mesh_add(box->mesh), 326 evas_canvas3d_node_position_set(box->node, 3.0, 0.0, -3.0);
361 evas_canvas3d_node_position_set(3.0, 0.0, -3.0));
362} 327}
363 328
364static void 329static void
365_model_setup(Body_3D *model) 330_model_setup(Body_3D *model)
366{ 331{
367 model->texture = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas); 332 model->texture = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas);
368 eo_do(model->texture, 333 evas_canvas3d_texture_file_set(model->texture, image_path, NULL);
369 evas_canvas3d_texture_file_set(image_path, NULL), 334 evas_canvas3d_texture_filter_set(model->texture, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST);
370 evas_canvas3d_texture_filter_set(EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, 335 evas_canvas3d_texture_wrap_set(model->texture, EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT);
371 EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST),
372 evas_canvas3d_texture_wrap_set(EVAS_CANVAS3D_WRAP_MODE_REPEAT,
373 EVAS_CANVAS3D_WRAP_MODE_REPEAT));
374 model->material = eo_add(EVAS_CANVAS3D_MATERIAL_CLASS, evas); 336 model->material = eo_add(EVAS_CANVAS3D_MATERIAL_CLASS, evas);
375 337
376 eo_do(model->material, 338 evas_canvas3d_material_texture_set(model->material, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, model->texture);
377 evas_canvas3d_material_texture_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, model->texture), 339 evas_canvas3d_material_texture_set(model->material, EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, model->texture);
378 evas_canvas3d_material_texture_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, model->texture), 340 evas_canvas3d_material_enable_set(model->material, EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, EINA_TRUE);
379 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, EINA_TRUE), 341 evas_canvas3d_material_enable_set(model->material, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, EINA_TRUE);
380 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, EINA_TRUE), 342 evas_canvas3d_material_enable_set(model->material, EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, EINA_TRUE);
381 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR, EINA_TRUE), 343 evas_canvas3d_material_shininess_set(model->material, 100.0);
382 evas_canvas3d_material_shininess_set(100.0));
383 344
384 345
385 model->mesh = eo_add(EVAS_CANVAS3D_MESH_CLASS, evas); 346 model->mesh = eo_add(EVAS_CANVAS3D_MESH_CLASS, evas);
386 eo_do(model->mesh, 347 efl_file_set(model->mesh, model_path, NULL);
387 efl_file_set(model_path, NULL), 348 evas_canvas3d_mesh_frame_material_set(model->mesh, 0, model->material);
388 evas_canvas3d_mesh_frame_material_set(0, model->material), 349 evas_canvas3d_mesh_shade_mode_set(model->mesh, EVAS_CANVAS3D_SHADE_MODE_PHONG);
389 evas_canvas3d_mesh_shade_mode_set(EVAS_CANVAS3D_SHADE_MODE_PHONG));
390 350
391 model->node = 351 model->node =
392 eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, 352 eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(eoid, EVAS_CANVAS3D_NODE_TYPE_MESH));
393 evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_MESH)); 353 evas_canvas3d_node_mesh_add(model->node, model->mesh);
394 eo_do(model->node, evas_canvas3d_node_mesh_add(model->mesh), 354 evas_canvas3d_node_scale_set(model->node, 0.1, 0.1, 0.1);
395 evas_canvas3d_node_scale_set(0.1, 0.1, 0.1), 355 evas_canvas3d_node_orientation_angle_axis_set(model->node, 120.0, -0.577, -0.577, -0.577);
396 evas_canvas3d_node_orientation_angle_axis_set(120.0, -0.577, -0.577, -0.577));
397} 356}
398 357
399static void 358static void
400_billboard_setup(Scene_Data *data) 359_billboard_setup(Scene_Data *data)
401{ 360{
402 data->billboard.texture = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas); 361 data->billboard.texture = eo_add(EVAS_CANVAS3D_TEXTURE_CLASS, evas);
403 eo_do(data->billboard.texture, 362 evas_canvas3d_texture_file_set(data->billboard.texture, b_image_path, NULL);
404 evas_canvas3d_texture_file_set(b_image_path, NULL), 363 evas_canvas3d_texture_filter_set(data->billboard.texture, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST);
405 evas_canvas3d_texture_filter_set(EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST, 364 evas_canvas3d_texture_wrap_set(data->billboard.texture, EVAS_CANVAS3D_WRAP_MODE_REPEAT, EVAS_CANVAS3D_WRAP_MODE_REPEAT);
406 EVAS_CANVAS3D_TEXTURE_FILTER_NEAREST),
407 evas_canvas3d_texture_wrap_set(EVAS_CANVAS3D_WRAP_MODE_REPEAT,
408 EVAS_CANVAS3D_WRAP_MODE_REPEAT));
409 365
410 data->billboard.primitive = eo_add(EVAS_CANVAS3D_PRIMITIVE_CLASS, evas); 366 data->billboard.primitive = eo_add(EVAS_CANVAS3D_PRIMITIVE_CLASS, evas);
411 eo_do(data->billboard.primitive, 367 evas_canvas3d_primitive_form_set(data->billboard.primitive, EVAS_CANVAS3D_MESH_PRIMITIVE_SQUARE);
412 evas_canvas3d_primitive_form_set(EVAS_CANVAS3D_MESH_PRIMITIVE_SQUARE));
413 368
414 data->billboard.mesh = eo_add(EVAS_CANVAS3D_MESH_CLASS, evas); 369 data->billboard.mesh = eo_add(EVAS_CANVAS3D_MESH_CLASS, evas);
415 eo_do(data->billboard.mesh, 370 evas_canvas3d_mesh_from_primitive_set(data->billboard.mesh, 0, data->billboard.primitive);
416 evas_canvas3d_mesh_from_primitive_set(0, data->billboard.primitive));
417 371
418 _body_material_set(&(data->billboard), 1.0, 1.0, 1.0); 372 _body_material_set(&(data->billboard), 1.0, 1.0, 1.0);
419 373
420 eo_do(data->billboard.material, 374 evas_canvas3d_material_texture_set(data->billboard.material, EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, data->billboard.texture);
421 evas_canvas3d_material_texture_set(EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE, data->billboard.texture)); 375
422 376 evas_canvas3d_mesh_frame_material_set(data->billboard.mesh, 0, data->billboard.material);
423 eo_do(data->billboard.mesh, 377 evas_canvas3d_mesh_alpha_func_set(data->billboard.mesh, EVAS_CANVAS3D_COMPARISON_GREATER, 0);
424 evas_canvas3d_mesh_frame_material_set(0, data->billboard.material), 378 evas_canvas3d_mesh_alpha_test_enable_set(data->billboard.mesh, EINA_TRUE);
425 evas_canvas3d_mesh_alpha_func_set(EVAS_CANVAS3D_COMPARISON_GREATER, 0), 379 evas_canvas3d_mesh_shade_mode_set(data->billboard.mesh, EVAS_CANVAS3D_SHADE_MODE_DIFFUSE);
426 evas_canvas3d_mesh_alpha_test_enable_set(EINA_TRUE), 380 evas_canvas3d_mesh_blending_enable_set(data->billboard.mesh, EINA_TRUE);
427 evas_canvas3d_mesh_shade_mode_set(EVAS_CANVAS3D_SHADE_MODE_DIFFUSE), 381 evas_canvas3d_mesh_blending_func_set(data->billboard.mesh, EVAS_CANVAS3D_BLEND_FUNC_SRC_ALPHA, EVAS_CANVAS3D_BLEND_FUNC_ONE_MINUS_SRC_ALPHA);
428 evas_canvas3d_mesh_blending_enable_set(EINA_TRUE), 382
429 evas_canvas3d_mesh_blending_func_set(EVAS_CANVAS3D_BLEND_FUNC_SRC_ALPHA, 383 data->billboard.node = eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(eoid, EVAS_CANVAS3D_NODE_TYPE_MESH));
430 EVAS_CANVAS3D_BLEND_FUNC_ONE_MINUS_SRC_ALPHA)); 384 evas_canvas3d_node_mesh_add(data->billboard.node, data->billboard.mesh);
431 385 evas_canvas3d_node_position_set(data->billboard.node, 0.0, 2.0, 0.0);
432 data->billboard.node = eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, 386 evas_canvas3d_node_scale_set(data->billboard.node, 2.2, 4.6, 4.0);
433 evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_MESH)); 387
434 eo_do(data->billboard.node, 388 evas_canvas3d_node_billboard_target_set(data->billboard.node, data->mediator);
435 evas_canvas3d_node_mesh_add(data->billboard.mesh),
436 evas_canvas3d_node_position_set(0.0, 2.0, 0.0),
437 evas_canvas3d_node_scale_set(2.2, 4.6, 4.0));
438
439 eo_do(data->billboard.node,
440 evas_canvas3d_node_billboard_target_set(data->mediator));
441} 389}
442 390
443static void 391static void
444_camera_setup(Scene_Data *data) 392_camera_setup(Scene_Data *data)
445{ 393{
446 data->camera = eo_add(EVAS_CANVAS3D_CAMERA_CLASS, evas); 394 data->camera = eo_add(EVAS_CANVAS3D_CAMERA_CLASS, evas);
447 data->mediator = eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, 395 data->mediator = eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(eoid, EVAS_CANVAS3D_NODE_TYPE_NODE));
448 evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_NODE));
449 396
450 eo_do(data->camera, 397 evas_canvas3d_camera_projection_perspective_set(data->camera, 50.0, 1.0, 2.0, 100.0);
451 evas_canvas3d_camera_projection_perspective_set(50.0, 1.0, 2.0, 100.0));
452 398
453 data->camera_node = 399 data->camera_node =
454 eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, 400 eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(eoid, EVAS_CANVAS3D_NODE_TYPE_CAMERA));
455 evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_CAMERA));
456 401
457 eo_do(data->camera_node, 402 evas_canvas3d_node_camera_set(data->camera_node, data->camera);
458 evas_canvas3d_node_camera_set(data->camera));
459 403
460 404
461 eo_do(data->mediator, 405 evas_canvas3d_node_position_set(data->mediator, 0.0, 6.0, 12.0);
462 evas_canvas3d_node_position_set(0.0, 6.0, 12.0), 406 evas_canvas3d_node_look_at_set(data->mediator, EVAS_CANVAS3D_SPACE_PARENT, 0.0, 3.0, 0.0, EVAS_CANVAS3D_SPACE_PARENT, 0.0, 5.0, 0.0);
463 evas_canvas3d_node_look_at_set(EVAS_CANVAS3D_SPACE_PARENT, 0.0, 3.0, 0.0,
464 EVAS_CANVAS3D_SPACE_PARENT, 0.0, 5.0, 0.0));
465 407
466 eo_do(data->mediator, evas_canvas3d_node_member_add(data->camera_node)); 408 evas_canvas3d_node_member_add(data->mediator, data->camera_node);
467 eo_do(data->root_node, evas_canvas3d_node_member_add(data->mediator)); 409 evas_canvas3d_node_member_add(data->root_node, data->mediator);
468} 410}
469 411
470static void 412static void
471_light_setup(Scene_Data *data) 413_light_setup(Scene_Data *data)
472{ 414{
473 data->light = eo_add(EVAS_CANVAS3D_LIGHT_CLASS, evas); 415 data->light = eo_add(EVAS_CANVAS3D_LIGHT_CLASS, evas);
474 eo_do(data->light, 416 evas_canvas3d_light_ambient_set(data->light, AMBIENT_LIGHT, 1.0);
475 evas_canvas3d_light_ambient_set(AMBIENT_LIGHT, 1.0), 417 evas_canvas3d_light_diffuse_set(data->light, DIFFUSE_LIGHT, 1.0);
476 evas_canvas3d_light_diffuse_set(DIFFUSE_LIGHT, 1.0), 418 evas_canvas3d_light_specular_set(data->light, SPECULAR_LIGHT, 1.0);
477 evas_canvas3d_light_specular_set(SPECULAR_LIGHT, 1.0), 419 evas_canvas3d_light_spot_cutoff_set(data->light, 20);
478 evas_canvas3d_light_spot_cutoff_set(20), 420 evas_canvas3d_light_projection_perspective_set(data->light, 40.0, 1.0, 2.0, 1000.0);
479 evas_canvas3d_light_projection_perspective_set(40.0, 1.0, 2.0, 1000.0));
480 421
481 data->light_node = 422 data->light_node =
482 eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, 423 eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(eoid, EVAS_CANVAS3D_NODE_TYPE_LIGHT));
483 evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_LIGHT)); 424 evas_canvas3d_node_light_set(data->light_node, data->light);
484 eo_do(data->light_node, 425 evas_canvas3d_node_position_set(data->light_node, 50.0, 50.0, 70.0);
485 evas_canvas3d_node_light_set(data->light), 426 evas_canvas3d_node_look_at_set(data->light_node, EVAS_CANVAS3D_SPACE_PARENT, 15.0, 0.0, -5.0, EVAS_CANVAS3D_SPACE_PARENT, 0.0, 0.0, 1.0);
486 evas_canvas3d_node_position_set(50.0, 50.0, 70.0), 427 evas_canvas3d_node_member_add(data->root_node, data->light_node);
487 evas_canvas3d_node_look_at_set(EVAS_CANVAS3D_SPACE_PARENT, 15.0, 0.0, -5.0,
488 EVAS_CANVAS3D_SPACE_PARENT, 0.0, 0.0, 1.0));
489 eo_do(data->root_node, evas_canvas3d_node_member_add(data->light_node));
490} 428}
491 429
492static void 430static void
@@ -496,13 +434,11 @@ _scene_setup(Scene_Data *data)
496 434
497 data->scene = eo_add(EVAS_CANVAS3D_SCENE_CLASS, evas); 435 data->scene = eo_add(EVAS_CANVAS3D_SCENE_CLASS, evas);
498 436
499 eo_do(data->scene, 437 evas_canvas3d_scene_size_set(data->scene, WIDTH, HEIGHT);
500 evas_canvas3d_scene_size_set(WIDTH, HEIGHT); 438 evas_canvas3d_scene_background_color_set(data->scene, BG_COLOR, 1);
501 evas_canvas3d_scene_background_color_set(BG_COLOR, 1));
502 439
503 data->root_node = 440 data->root_node =
504 eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, 441 eo_add(EVAS_CANVAS3D_NODE_CLASS, evas, evas_canvas3d_node_constructor(eoid, EVAS_CANVAS3D_NODE_TYPE_NODE));
505 evas_canvas3d_node_constructor(EVAS_CANVAS3D_NODE_TYPE_NODE));
506 442
507 443
508 _camera_setup(data); 444 _camera_setup(data);
@@ -517,19 +453,17 @@ _scene_setup(Scene_Data *data)
517 _fence_setup(&data->fence); 453 _fence_setup(&data->fence);
518 _billboard_setup(data); 454 _billboard_setup(data);
519 455
520 eo_do(data->root_node, 456 evas_canvas3d_node_member_add(data->root_node, data->sphere.node);
521 evas_canvas3d_node_member_add(data->sphere.node), 457 evas_canvas3d_node_member_add(data->root_node, data->cube.node);
522 evas_canvas3d_node_member_add(data->cube.node), 458 evas_canvas3d_node_member_add(data->root_node, data->cylinder.node);
523 evas_canvas3d_node_member_add(data->cylinder.node), 459 evas_canvas3d_node_member_add(data->root_node, data->square.node);
524 evas_canvas3d_node_member_add(data->square.node), 460 evas_canvas3d_node_member_add(data->root_node, data->model.node);
525 evas_canvas3d_node_member_add(data->model.node), 461 evas_canvas3d_node_member_add(data->root_node, data->cone.node);
526 evas_canvas3d_node_member_add(data->cone.node), 462 evas_canvas3d_node_member_add(data->root_node, data->fence.node);
527 evas_canvas3d_node_member_add(data->fence.node)); 463
528 464 evas_canvas3d_scene_root_node_set(data->scene, data->root_node);
529 eo_do(data->scene, 465 evas_canvas3d_scene_camera_node_set(data->scene, data->camera_node);
530 evas_canvas3d_scene_root_node_set(data->root_node), 466 evas_canvas3d_scene_shadows_enable_set(data->scene, EINA_TRUE);
531 evas_canvas3d_scene_camera_node_set(data->camera_node),
532 evas_canvas3d_scene_shadows_enable_set(EINA_TRUE));
533} 467}
534 468
535static void 469static void
@@ -540,66 +474,66 @@ _on_key_down(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *eo EINA_U
540 if (!strcmp("w", ev->key)) 474 if (!strcmp("w", ev->key))
541 { 475 {
542 Evas_Real x, y, z; 476 Evas_Real x, y, z;
543 eo_do(choosed_node, evas_canvas3d_node_position_get(EVAS_CANVAS3D_SPACE_PARENT, &x, &y, &z)); 477 evas_canvas3d_node_position_get(choosed_node, EVAS_CANVAS3D_SPACE_PARENT, &x, &y, &z);
544 eo_do(choosed_node, evas_canvas3d_node_position_set(x, y + STEP, z)); 478 evas_canvas3d_node_position_set(choosed_node, x, y + STEP, z);
545 } 479 }
546 else if(!strcmp("s", ev->key)) 480 else if(!strcmp("s", ev->key))
547 { 481 {
548 Evas_Real x, y, z; 482 Evas_Real x, y, z;
549 eo_do(choosed_node, evas_canvas3d_node_position_get(EVAS_CANVAS3D_SPACE_PARENT, &x, &y, &z)); 483 evas_canvas3d_node_position_get(choosed_node, EVAS_CANVAS3D_SPACE_PARENT, &x, &y, &z);
550 eo_do(choosed_node, evas_canvas3d_node_position_set(x, y - STEP, z)); 484 evas_canvas3d_node_position_set(choosed_node, x, y - STEP, z);
551 } 485 }
552 else if(!strcmp("a", ev->key)) 486 else if(!strcmp("a", ev->key))
553 { 487 {
554 Evas_Real x, y, z; 488 Evas_Real x, y, z;
555 eo_do(choosed_node, evas_canvas3d_node_position_get(EVAS_CANVAS3D_SPACE_PARENT, &x, &y, &z)); 489 evas_canvas3d_node_position_get(choosed_node, EVAS_CANVAS3D_SPACE_PARENT, &x, &y, &z);
556 eo_do(choosed_node, evas_canvas3d_node_position_set(x - STEP, y, z)); 490 evas_canvas3d_node_position_set(choosed_node, x - STEP, y, z);
557 } 491 }
558 else if(!strcmp("d", ev->key)) 492 else if(!strcmp("d", ev->key))
559 { 493 {
560 Evas_Real x, y, z; 494 Evas_Real x, y, z;
561 eo_do(choosed_node, evas_canvas3d_node_position_get(EVAS_CANVAS3D_SPACE_PARENT, &x, &y, &z)); 495 evas_canvas3d_node_position_get(choosed_node, EVAS_CANVAS3D_SPACE_PARENT, &x, &y, &z);
562 eo_do(choosed_node, evas_canvas3d_node_position_set(x + STEP, y, z)); 496 evas_canvas3d_node_position_set(choosed_node, x + STEP, y, z);
563 } 497 }
564 else if(!strcmp("q", ev->key)) 498 else if(!strcmp("q", ev->key))
565 { 499 {
566 Evas_Real x, y, z; 500 Evas_Real x, y, z;
567 eo_do(choosed_node, evas_canvas3d_node_position_get(EVAS_CANVAS3D_SPACE_PARENT, &x, &y, &z)); 501 evas_canvas3d_node_position_get(choosed_node, EVAS_CANVAS3D_SPACE_PARENT, &x, &y, &z);
568 eo_do(choosed_node, evas_canvas3d_node_position_set(x, y, z - STEP)); 502 evas_canvas3d_node_position_set(choosed_node, x, y, z - STEP);
569 } 503 }
570 else if(!strcmp("e", ev->key)) 504 else if(!strcmp("e", ev->key))
571 { 505 {
572 Evas_Real x, y, z; 506 Evas_Real x, y, z;
573 eo_do(choosed_node, evas_canvas3d_node_position_get(EVAS_CANVAS3D_SPACE_PARENT, &x, &y, &z)); 507 evas_canvas3d_node_position_get(choosed_node, EVAS_CANVAS3D_SPACE_PARENT, &x, &y, &z);
574 eo_do(choosed_node, evas_canvas3d_node_position_set(x, y, z + STEP)); 508 evas_canvas3d_node_position_set(choosed_node, x, y, z + STEP);
575 } 509 }
576 else if(!strcmp("1", ev->key)) 510 else if(!strcmp("1", ev->key))
577 { 511 {
578 eo_do(scene->root_node, evas_canvas3d_node_member_del(scene->model.node)); 512 evas_canvas3d_node_member_del(scene->root_node, scene->model.node);
579 eo_do(scene->root_node, evas_canvas3d_node_member_add(scene->billboard.node)); 513 evas_canvas3d_node_member_add(scene->root_node, scene->billboard.node);
580 } 514 }
581 else if(!strcmp("2", ev->key)) 515 else if(!strcmp("2", ev->key))
582 { 516 {
583 eo_do(scene->root_node, evas_canvas3d_node_member_add(scene->model.node)); 517 evas_canvas3d_node_member_add(scene->root_node, scene->model.node);
584 eo_do(scene->root_node, evas_canvas3d_node_member_del(scene->billboard.node)); 518 evas_canvas3d_node_member_del(scene->root_node, scene->billboard.node);
585 } 519 }
586 else if(!strcmp("Up", ev->key)) 520 else if(!strcmp("Up", ev->key))
587 { 521 {
588 Evas_Real x, y, z; 522 Evas_Real x, y, z;
589 eo_do(scene->camera_node, evas_canvas3d_node_position_get(EVAS_CANVAS3D_SPACE_PARENT, &x, &y, &z)); 523 evas_canvas3d_node_position_get(scene->camera_node, EVAS_CANVAS3D_SPACE_PARENT, &x, &y, &z);
590 eo_do(scene->camera_node, evas_canvas3d_node_position_set(x, y, z + STEP)); 524 evas_canvas3d_node_position_set(scene->camera_node, x, y, z + STEP);
591 } 525 }
592 else if(!strcmp("Down", ev->key)) 526 else if(!strcmp("Down", ev->key))
593 { 527 {
594 Evas_Real x, y, z; 528 Evas_Real x, y, z;
595 eo_do(scene->camera_node, evas_canvas3d_node_position_get(EVAS_CANVAS3D_SPACE_PARENT, &x, &y, &z)); 529 evas_canvas3d_node_position_get(scene->camera_node, EVAS_CANVAS3D_SPACE_PARENT, &x, &y, &z);
596 eo_do(scene->camera_node, evas_canvas3d_node_position_set(x, y, z - STEP)); 530 evas_canvas3d_node_position_set(scene->camera_node, x, y, z - STEP);
597 } 531 }
598 else if (!strcmp("i", ev->key)) 532 else if (!strcmp("i", ev->key))
599 { 533 {
600 scene->init = !scene->init; 534 scene->init = !scene->init;
601 eo_do(scene->model.node, evas_canvas3d_node_position_set(0.0, 0.0, 0.0)); 535 evas_canvas3d_node_position_set(scene->model.node, 0.0, 0.0, 0.0);
602 eo_do(scene->billboard.node, evas_canvas3d_node_position_set(0.0, 2.0, 0.0)); 536 evas_canvas3d_node_position_set(scene->billboard.node, 0.0, 2.0, 0.0);
603 } 537 }
604 else 538 else
605 { 539 {
@@ -611,30 +545,30 @@ static void _init(Scene_Data *data)
611{ 545{
612 Eina_List *meshes = NULL, *l; 546 Eina_List *meshes = NULL, *l;
613 Evas_Canvas3D_Mesh *m; 547 Evas_Canvas3D_Mesh *m;
614 eo_do(data->sphere.node, meshes = (Eina_List *)evas_canvas3d_node_mesh_list_get()); 548 meshes = (Eina_List *)evas_canvas3d_node_mesh_list_get(data->sphere.node);
615 EINA_LIST_FOREACH(meshes, l, m) 549 EINA_LIST_FOREACH(meshes, l, m)
616 { 550 {
617 eo_do(m, evas_canvas3d_mesh_shade_mode_set(EVAS_CANVAS3D_SHADE_MODE_PHONG)); 551 evas_canvas3d_mesh_shade_mode_set(m, EVAS_CANVAS3D_SHADE_MODE_PHONG);
618 } 552 }
619 eo_do(data->cube.node, meshes = (Eina_List *)evas_canvas3d_node_mesh_list_get()); 553 meshes = (Eina_List *)evas_canvas3d_node_mesh_list_get(data->cube.node);
620 EINA_LIST_FOREACH(meshes, l, m) 554 EINA_LIST_FOREACH(meshes, l, m)
621 { 555 {
622 eo_do(m, evas_canvas3d_mesh_shade_mode_set(EVAS_CANVAS3D_SHADE_MODE_PHONG)); 556 evas_canvas3d_mesh_shade_mode_set(m, EVAS_CANVAS3D_SHADE_MODE_PHONG);
623 } 557 }
624 eo_do(data->cylinder.node, meshes = (Eina_List *)evas_canvas3d_node_mesh_list_get()); 558 meshes = (Eina_List *)evas_canvas3d_node_mesh_list_get(data->cylinder.node);
625 EINA_LIST_FOREACH(meshes, l, m) 559 EINA_LIST_FOREACH(meshes, l, m)
626 { 560 {
627 eo_do(m, evas_canvas3d_mesh_shade_mode_set(EVAS_CANVAS3D_SHADE_MODE_PHONG)); 561 evas_canvas3d_mesh_shade_mode_set(m, EVAS_CANVAS3D_SHADE_MODE_PHONG);
628 } 562 }
629 eo_do(data->model.node, meshes = (Eina_List *)evas_canvas3d_node_mesh_list_get()); 563 meshes = (Eina_List *)evas_canvas3d_node_mesh_list_get(data->model.node);
630 EINA_LIST_FOREACH(meshes, l, m) 564 EINA_LIST_FOREACH(meshes, l, m)
631 { 565 {
632 eo_do(m, evas_canvas3d_mesh_shade_mode_set(EVAS_CANVAS3D_SHADE_MODE_PHONG)); 566 evas_canvas3d_mesh_shade_mode_set(m, EVAS_CANVAS3D_SHADE_MODE_PHONG);
633 } 567 }
634 eo_do(data->cone.node, meshes = (Eina_List *)evas_canvas3d_node_mesh_list_get()); 568 meshes = (Eina_List *)evas_canvas3d_node_mesh_list_get(data->cone.node);
635 EINA_LIST_FOREACH(meshes, l, m) 569 EINA_LIST_FOREACH(meshes, l, m)
636 { 570 {
637 eo_do(m, evas_canvas3d_mesh_shade_mode_set(EVAS_CANVAS3D_SHADE_MODE_PHONG)); 571 evas_canvas3d_mesh_shade_mode_set(m, EVAS_CANVAS3D_SHADE_MODE_PHONG);
638 } 572 }
639} 573}
640 574
@@ -651,7 +585,7 @@ _on_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *eo EINA_UNUSED, voi
651 _init(d); 585 _init(d);
652 return; 586 return;
653 } 587 }
654 eo_do(d->scene, evas_canvas3d_scene_pick(ev->canvas.x, ev->canvas.y, &n, &m, &s, &t)); 588 evas_canvas3d_scene_pick(d->scene, ev->canvas.x, ev->canvas.y, &n, &m, &s, &t);
655 589
656} 590}
657int 591int
@@ -677,20 +611,18 @@ main(void)
677 611
678 /* Add a background rectangle objects. */ 612 /* Add a background rectangle objects. */
679 background = eo_add(EVAS_RECTANGLE_CLASS, evas); 613 background = eo_add(EVAS_RECTANGLE_CLASS, evas);
680 eo_do(background, 614 efl_gfx_color_set(background, 0, 0, 0, 255);
681 efl_gfx_color_set(0, 0, 0, 255), 615 efl_gfx_size_set(background, WIDTH, HEIGHT);
682 efl_gfx_size_set(WIDTH, HEIGHT), 616 efl_gfx_visible_set(background, EINA_TRUE);
683 efl_gfx_visible_set(EINA_TRUE));
684 617
685 /* Add an image object for 3D scene rendering. */ 618 /* Add an image object for 3D scene rendering. */
686 image = evas_object_image_filled_add(evas); 619 image = evas_object_image_filled_add(evas);
687 eo_do(image, 620 efl_gfx_size_set(image, WIDTH, HEIGHT);
688 efl_gfx_size_set(WIDTH, HEIGHT), 621 efl_gfx_visible_set(image, EINA_TRUE);
689 efl_gfx_visible_set(EINA_TRUE));
690 622
691 evas_object_focus_set(image, EINA_TRUE); 623 evas_object_focus_set(image, EINA_TRUE);
692 /* Set the image object as render target for 3D scene. */ 624 /* Set the image object as render target for 3D scene. */
693 eo_do(image, evas_obj_image_scene_set(data.scene)); 625 evas_obj_image_scene_set(image, data.scene);
694 626
695 nodes1 = eina_list_append(nodes1, data.sphere.node); 627 nodes1 = eina_list_append(nodes1, data.sphere.node);
696 nodes2 = eina_list_append(nodes2, data.sphere.node); 628 nodes2 = eina_list_append(nodes2, data.sphere.node);
@@ -698,14 +630,14 @@ main(void)
698 nodes2 = eina_list_append(nodes2, data.cone.node); 630 nodes2 = eina_list_append(nodes2, data.cone.node);
699 631
700 /*Set callbacks*/ 632 /*Set callbacks*/
701 eo_do(data.cube.node, eo_event_callback_add(EVAS_CANVAS3D_OBJECT_EVENT_CLICKED, _cb_clicked, NULL)); 633 eo_event_callback_add(data.cube.node, EVAS_CANVAS3D_OBJECT_EVENT_CLICKED, _cb_clicked, NULL);
702 eo_do(data.cube.node, eo_event_callback_add(EVAS_CANVAS3D_OBJECT_EVENT_COLLISION, _cb_collision, nodes2)); 634 eo_event_callback_add(data.cube.node, EVAS_CANVAS3D_OBJECT_EVENT_COLLISION, _cb_collision, nodes2);
703 635
704 eo_do(data.model.node, eo_event_callback_add(EVAS_CANVAS3D_OBJECT_EVENT_CLICKED, _cb_clicked, NULL)); 636 eo_event_callback_add(data.model.node, EVAS_CANVAS3D_OBJECT_EVENT_CLICKED, _cb_clicked, NULL);
705 eo_do(data.model.node, eo_event_callback_add(EVAS_CANVAS3D_OBJECT_EVENT_COLLISION, _cb_collision, nodes1)); 637 eo_event_callback_add(data.model.node, EVAS_CANVAS3D_OBJECT_EVENT_COLLISION, _cb_collision, nodes1);
706 638
707 eo_do(data.billboard.node, eo_event_callback_add(EVAS_CANVAS3D_OBJECT_EVENT_CLICKED, _cb_clicked, NULL)); 639 eo_event_callback_add(data.billboard.node, EVAS_CANVAS3D_OBJECT_EVENT_CLICKED, _cb_clicked, NULL);
708 eo_do(data.billboard.node, eo_event_callback_add(EVAS_CANVAS3D_OBJECT_EVENT_COLLISION, _cb_collision, nodes1)); 640 eo_event_callback_add(data.billboard.node, EVAS_CANVAS3D_OBJECT_EVENT_COLLISION, _cb_collision, nodes1);
709 641
710 evas_object_event_callback_add(image, EVAS_CALLBACK_MOUSE_DOWN, _on_mouse_down, &data); 642 evas_object_event_callback_add(image, EVAS_CALLBACK_MOUSE_DOWN, _on_mouse_down, &data);
711 evas_object_event_callback_add(image, EVAS_CALLBACK_KEY_DOWN, _on_key_down, &data); 643 evas_object_event_callback_add(image, EVAS_CALLBACK_KEY_DOWN, _on_key_down, &data);