From 7b09174f5f3e29471fb40afa1d04cf3f37ee54e7 Mon Sep 17 00:00:00 2001 From: raster Date: Tue, 16 Feb 2010 16:36:16 +0000 Subject: [PATCH] add back face cull option. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/edje@46217 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/bin/edje_cc_handlers.c | 20 ++++++++++++++++++++ src/lib/edje_calc.c | 10 ++++++++++ src/lib/edje_data.c | 1 + src/lib/edje_private.h | 1 + 4 files changed, 32 insertions(+) diff --git a/src/bin/edje_cc_handlers.c b/src/bin/edje_cc_handlers.c index 28583bf..104bde0 100644 --- a/src/bin/edje_cc_handlers.c +++ b/src/bin/edje_cc_handlers.c @@ -208,6 +208,7 @@ static void st_collections_group_parts_part_description_map_rotation_x(void); static void st_collections_group_parts_part_description_map_rotation_y(void); static void st_collections_group_parts_part_description_map_rotation_z(void); static void st_collections_group_parts_part_description_map_on(void); +static void st_collections_group_parts_part_description_map_backface_cull(void); static void st_collections_group_parts_part_description_perspective_zplane(void); static void st_collections_group_parts_part_description_perspective_focal(void); static void st_collections_group_parts_part_api(void); @@ -429,6 +430,7 @@ New_Statement_Handler statement_handlers[] = {"collections.group.parts.part.description.map.rotation.y", st_collections_group_parts_part_description_map_rotation_y}, {"collections.group.parts.part.description.map.rotation.z", st_collections_group_parts_part_description_map_rotation_z}, {"collections.group.parts.part.description.map.on", st_collections_group_parts_part_description_map_on}, + {"collections.group.parts.part.description.map.backface_cull", st_collections_group_parts_part_description_map_backface_cull}, {"collections.group.parts.part.description.perspective.zplane", st_collections_group_parts_part_description_perspective_zplane}, {"collections.group.parts.part.description.perspective.focal", st_collections_group_parts_part_description_perspective_focal}, {"collections.group.parts.part.description.params.int", st_collections_group_parts_part_description_params_int}, @@ -3092,6 +3094,7 @@ ob_collections_group_parts_part_description(void) ed->map.rot.y = FROM_DOUBLE(0.0); ed->map.rot.z = FROM_DOUBLE(0.0); ed->map.on = 0; + ed->map.backcull = 0; ed->persp.zplane = 0; ed->persp.focal = 1000; ed->external_params = NULL; @@ -5755,6 +5758,23 @@ st_collections_group_parts_part_description_map_on(void) } static void +st_collections_group_parts_part_description_map_backface_cull(void) +{ + Edje_Part_Collection *pc; + Edje_Part *ep; + Edje_Part_Description *ed; + + check_arg_count(1); + + pc = eina_list_data_get(eina_list_last(edje_collections)); + ep = eina_list_data_get(eina_list_last(pc->parts)); + + ed = ep->default_desc; + if (ep->other_desc) ed = eina_list_data_get(eina_list_last(ep->other_desc)); + ed->map.backcull = parse_bool(0); +} + +static void st_collections_group_parts_part_description_perspective_zplane(void) { Edje_Part_Collection *pc; diff --git a/src/lib/edje_calc.c b/src/lib/edje_calc.c index 54cb206..69061de 100644 --- a/src/lib/edje_calc.c +++ b/src/lib/edje_calc.c @@ -2111,6 +2111,16 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags) } evas_object_map_set(mo, map); evas_object_map_enable_set(mo, 1); + if (ep->param1.description->map.backcull) + { + if (pf->visible) + { + if (evas_map_util_clockwise_get(map)) + evas_object_show(mo); + else + evas_object_hide(mo); + } + } evas_map_free(map); } else diff --git a/src/lib/edje_data.c b/src/lib/edje_data.c index 5e17003..9f9dc90 100644 --- a/src/lib/edje_data.c +++ b/src/lib/edje_data.c @@ -356,6 +356,7 @@ _edje_edd_init(void) EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "map.rot.y", map.rot.y, EDJE_T_FLOAT); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "map.rot.z", map.rot.z, EDJE_T_FLOAT); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "map.on", map.on, EET_T_UCHAR); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "map.backcull", map.backcull, EET_T_UCHAR); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "persp.zplane", persp.zplane, EET_T_INT); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "persp.focal", persp.focal, EET_T_INT); EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_part_description, Edje_Part_Description, "external_params", external_params, _edje_edd_edje_external_param); diff --git a/src/lib/edje_private.h b/src/lib/edje_private.h index c631b56..1d7e112 100644 --- a/src/lib/edje_private.h +++ b/src/lib/edje_private.h @@ -671,6 +671,7 @@ struct _Edje_Part_Description int id_center; FLOAT_T x, y, z; } rot; + unsigned char backcull; unsigned char on; } map; -- 2.7.4