summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorperepelits.m <perepelits.m@samsung.com>2016-06-09 10:05:21 -0700
committerCedric BAIL <cedric@osg.samsung.com>2016-06-10 13:57:01 -0700
commit32f5bc113eb72c574963c07b1d5b71a03fb600b1 (patch)
tree2bed5e7076faf1f2ebf0e16a956921a84398a7f0
parent9b949508e3cc310f9a32852ba28b5c370296a81e (diff)
edje: creation of scene in edje-3d
Summary: Creation of scene and root node in edje-3d with all 3D-parts of edje object. Add some new methods to edje_util.c Reviewers: raster, Hermet, jpeg, cedric Reviewed By: cedric Subscribers: artem.popov Differential Revision: https://phab.enlightenment.org/D3963 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--src/lib/edje/Edje_Common.h12
-rw-r--r--src/lib/edje/edje_load.c54
2 files changed, 66 insertions, 0 deletions
diff --git a/src/lib/edje/Edje_Common.h b/src/lib/edje/Edje_Common.h
index b9f2b852f9..0db97f8a52 100644
--- a/src/lib/edje/Edje_Common.h
+++ b/src/lib/edje/Edje_Common.h
@@ -2338,6 +2338,18 @@ EAPI Eina_Bool edje_audio_channel_mute_get(Edje_Channel channel);
2338 * @since 1.10 2338 * @since 1.10
2339 */ 2339 */
2340EAPI const char *edje_object_part_object_name_get(const Evas_Object *obj); 2340EAPI const char *edje_object_part_object_name_get(const Evas_Object *obj);
2341
2342/**
2343 * Create scene and root node which contains all 3D parts of edje object
2344 * @param obj An edje part object
2345 * @param root node to collect all 3D parts
2346 * @param scene
2347 * @return scene and root node which contains all 3D parts of edje object
2348 * @note If this function returns @c EINA_FALSE, @p the scene or the root
2349 * node wasn't made
2350 * @since 1.18
2351 */
2352EAPI Eina_Bool edje_3d_object_add(Evas_Object *obj, Eo **root_node, Eo *scene);
2341/** 2353/**
2342 * @} 2354 * @}
2343 */ 2355 */
diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c
index e26eb5e0d4..78d4e21537 100644
--- a/src/lib/edje/edje_load.c
+++ b/src/lib/edje/edje_load.c
@@ -2475,3 +2475,57 @@ _edje_dupe_vector_data(Edje *ed, int svg_id, double width, double height,
2475 data->h = vector->h; 2475 data->h = vector->h;
2476} 2476}
2477 2477
2478EAPI Eina_Bool
2479edje_3d_object_add(Evas_Object *obj, Eo **root_node, Eo *scene)
2480{
2481 /* Use default value for state. */
2482 unsigned int i;
2483 Edje *ed;
2484 Edje_Real_Part *rp;
2485
2486 ed = _edje_fetch(obj);
2487
2488 if (!ed)
2489 {
2490 ERR("Cannot get edje from object");
2491 return EINA_FALSE;
2492 }
2493
2494 if (*root_node == NULL)
2495 *root_node = eo_add(EVAS_CANVAS3D_NODE_CLASS, ed->base->evas,
2496 evas_canvas3d_node_constructor(eo_self, EVAS_CANVAS3D_NODE_TYPE_NODE));
2497
2498 if (scene == NULL)
2499 scene = eo_add(EVAS_CANVAS3D_SCENE_CLASS, ed->base->evas);
2500
2501 if ((*root_node == NULL) || (scene == NULL))
2502 {
2503 ERR("Cannot create scene and root node");
2504 return EINA_FALSE;
2505 }
2506
2507 for (i = 0; i < ed->table_parts_size; i++)
2508 {
2509 rp = ed->table_parts[i];
2510
2511 if (rp->node)
2512 {
2513 evas_canvas3d_node_member_add(*root_node, rp->node);
2514 }
2515
2516 if ((rp->part->type == EDJE_PART_TYPE_CAMERA))
2517 {
2518 Evas_Object *viewport;
2519
2520 evas_canvas3d_scene_camera_node_set(scene, rp->node);
2521 evas_canvas3d_scene_root_node_set(scene, *root_node);
2522 evas_canvas3d_scene_size_set(scene, ed->collection->scene_size.width, ed->collection->scene_size.height);
2523 evas_canvas3d_scene_background_color_set(scene, 0, 0 ,0 ,0);
2524
2525 viewport = evas_object_image_source_get(rp->object);
2526 efl_canvas_scene3d_set(viewport, scene);
2527 }
2528 }
2529
2530 return EINA_TRUE;
2531}