From 12cdbca6818894af302eb9d8fd7bfdc921cfd2a4 Mon Sep 17 00:00:00 2001 From: Bruno Dilly Date: Mon, 10 Dec 2012 17:46:44 +0000 Subject: [PATCH] edje: enable / disable movements per axis With the movement_freedom block it's possible to allow rotation on axis x and y (not default), for example. Backface cull support is added in this commit too. SVN revision: 80616 --- legacy/edje/data/edc.vim | 5 +- legacy/edje/data/include/edje.inc | 5 +- legacy/edje/src/bin/edje_cc_handlers.c | 108 ++++++++++++ legacy/edje/src/examples/Makefile.am | 1 + legacy/edje/src/examples/physics_3d.edc | 217 ++++++++++++++++++++++++ legacy/edje/src/lib/edje_calc.c | 30 ++++ legacy/edje/src/lib/edje_data.c | 14 ++ legacy/edje/src/lib/edje_embryo.c | 38 +++++ legacy/edje/src/lib/edje_private.h | 33 +++- 9 files changed, 446 insertions(+), 5 deletions(-) create mode 100644 legacy/edje/src/examples/physics_3d.edc diff --git a/legacy/edje/data/edc.vim b/legacy/edje/data/edc.vim index 5bb7cc6b67..e1895deb07 100644 --- a/legacy/edje/data/edc.vim +++ b/legacy/edje/data/edc.vim @@ -25,7 +25,7 @@ syn keyword cStructure part parts dragable description rel1 rel2 syn keyword cStatement text image font fill origin size tag syn keyword cStructure programs program script script_only lua_script lua_script_only styles style base syn keyword cStructure spectra spectrum box -syn keyword cStructure physics +syn keyword cStructure physics movement_freedom syn match cType "+ + +;" contained syn keyword cLabel item name min max type effect @@ -47,7 +47,8 @@ syn keyword cLabel external params size_range border_scale minmul syn keyword cLabel mass density material restitution friction syn keyword cLabel ignore_part_pos light_on damping sleep -syn keyword cLabel physics_body hardness +syn keyword cLabel physics_body hardness linear angular +syn keyword cLabel backface_cull syn keyword cConditional if else switch syn keyword cRepeat while for do diff --git a/legacy/edje/data/include/edje.inc b/legacy/edje/data/include/edje.inc index 2eead3bc87..3c2c996393 100644 --- a/legacy/edje/data/include/edje.inc +++ b/legacy/edje/data/include/edje.inc @@ -220,7 +220,10 @@ enum State_Param STATE_PHYSICS_DENSITY = 49, STATE_PHYSICS_IGNORE_PART_POS = 50, STATE_PHYSICS_LIGHT_ON = 51, - STATE_PHYSICS_HARDNESS = 52 + STATE_PHYSICS_HARDNESS = 52, + STATE_PHYSICS_MOV_FREEDOM_LIN = 53, + STATE_PHYSICS_MOV_FREEDOM_ANG = 54, + STATE_PHYSICS_BACK_CULL = 55 }; native set_state_val(part_id, State_Param:p, ...); diff --git a/legacy/edje/src/bin/edje_cc_handlers.c b/legacy/edje/src/bin/edje_cc_handlers.c index 85b6ce0bec..b425d5b4e6 100644 --- a/legacy/edje/src/bin/edje_cc_handlers.c +++ b/legacy/edje/src/bin/edje_cc_handlers.c @@ -320,6 +320,9 @@ static void st_collections_group_parts_part_description_physics_density(void); static void st_collections_group_parts_part_description_physics_hardness(void); static void st_collections_group_parts_part_description_physics_ignore_part_pos(void); static void st_collections_group_parts_part_description_physics_light_on(void); +static void st_collections_group_parts_part_description_physics_movement_freedom_linear(void); +static void st_collections_group_parts_part_description_physics_movement_freedom_angular(void); +static void st_collections_group_parts_part_description_physics_backface_cull(void); #endif static void st_collections_group_parts_part_description_map_perspective(void); static void st_collections_group_parts_part_description_map_light(void); @@ -610,8 +613,11 @@ New_Statement_Handler statement_handlers[] = {"collections.group.parts.part.description.physics.material", st_collections_group_parts_part_description_physics_material}, {"collections.group.parts.part.description.physics.density", st_collections_group_parts_part_description_physics_density}, {"collections.group.parts.part.description.physics.hardness", st_collections_group_parts_part_description_physics_hardness}, + {"collections.group.parts.part.description.physics.movement_freedom.linear", st_collections_group_parts_part_description_physics_movement_freedom_linear}, + {"collections.group.parts.part.description.physics.movement_freedom.angular", st_collections_group_parts_part_description_physics_movement_freedom_angular}, {"collections.group.parts.part.description.physics.ignore_part_pos", st_collections_group_parts_part_description_physics_ignore_part_pos}, {"collections.group.parts.part.description.physics.light_on", st_collections_group_parts_part_description_physics_light_on}, + {"collections.group.parts.part.description.physics.backface_cull", st_collections_group_parts_part_description_physics_backface_cull}, #endif {"collections.group.parts.part.description.map.perspective", st_collections_group_parts_part_description_map_perspective}, {"collections.group.parts.part.description.map.light", st_collections_group_parts_part_description_map_light}, @@ -860,6 +866,7 @@ New_Object_Handler object_handlers[] = {"collections.group.parts.part.description.table", NULL}, #ifdef HAVE_EPHYSICS {"collections.group.parts.part.description.physics", NULL}, + {"collections.group.parts.part.description.physics.movement_freedom", NULL}, #endif {"collections.group.parts.part.description.map", NULL}, {"collections.group.parts.part.description.map.rotation", NULL}, @@ -1107,6 +1114,9 @@ _edje_part_description_alloc(unsigned char type, const char *collection, const c result->physics.sleep.angular = FROM_DOUBLE(57.29); result->physics.hardness = FROM_DOUBLE(1.0); result->physics.ignore_part_pos = 1; + result->physics.mov_freedom.lin.x = 1; + result->physics.mov_freedom.lin.y = 1; + result->physics.mov_freedom.ang.z = 1; #endif return result; @@ -7206,6 +7216,10 @@ st_collections_group_parts_part_description_table_min(void) density: 3.2; hardness: 0.42; light_on: 1; + movement_freedom { + linear: 1 1 0; + angular: 0 0 1; + } } .. } @@ -7494,6 +7508,100 @@ st_collections_group_parts_part_description_physics_light_on(void) } #endif +/** + @page edcref + @property + backface_cull + @parameters + [1 or 0] + @effect + This enables backface culling (when the rotated part that normally faces + the camera is facing away after being rotated etc.). + This means that the object will be hidden when "backface culled". + @endproperty + @since 1.8.0 +*/ +#ifdef HAVE_EPHYSICS +static void +st_collections_group_parts_part_description_physics_backface_cull(void) +{ + check_arg_count(1); + + current_desc->physics.backcull = parse_bool(0); +} +#endif + +/** + @page edcref + @block + movement_freedom + @context + description { + .. + physics { + ... + movement_freedom { + linear: 1 1 0; + angular: 0 0 1; + } + } + .. + } + + @description + The "movement_freedom" block consists of two blocks to describe all + the allowed movements for a body. + It's set by default to allow just 2D movement (linear moves on + x and y axis and rotations on x-y plane). + @endblock + + @property + linear + @parameters + [x-axis (1 or 0)] [y-axis (1 or 0)] [z-axis (1 or 0)] + @effect + Block "linear" can be used to allow linear movements in the three + axes. Allowed values are 0 or 1. + Axes x and y are enabled by default. + @endproperty + @since 1.8.0 +*/ +#ifdef HAVE_EPHYSICS +static void +st_collections_group_parts_part_description_physics_movement_freedom_linear(void) +{ + check_arg_count(3); + + current_desc->physics.mov_freedom.lin.x = parse_bool(0); + current_desc->physics.mov_freedom.lin.y = parse_bool(1); + current_desc->physics.mov_freedom.lin.z = parse_bool(2); +} +#endif + +/** + @page edcref + @property + angular + @parameters + [x-axis (1 or 0)] [y-axis (1 or 0)] [z-axis (1 or 0)] + @effect + Block "angular" can be used to allow angular movements around the three + axes. Allowed values are 0 or 1. + Z axis is enabled by default. + @endproperty + @since 1.8.0 +*/ +#ifdef HAVE_EPHYSICS +static void +st_collections_group_parts_part_description_physics_movement_freedom_angular(void) +{ + check_arg_count(3); + + current_desc->physics.mov_freedom.ang.x = parse_bool(0); + current_desc->physics.mov_freedom.ang.y = parse_bool(1); + current_desc->physics.mov_freedom.ang.z = parse_bool(2); +} +#endif /** @edcsubsection{collections_group_parts_description_map,Map} diff --git a/legacy/edje/src/examples/Makefile.am b/legacy/edje/src/examples/Makefile.am index 31dc21b5a7..8d39dc687b 100644 --- a/legacy/edje/src/examples/Makefile.am +++ b/legacy/edje/src/examples/Makefile.am @@ -54,6 +54,7 @@ endif if ENABLE_EPHYSICS EDCS += \ +physics_3d.edc \ physics_actions.edc \ physics_basic.edc \ physics_complex.edc \ diff --git a/legacy/edje/src/examples/physics_3d.edc b/legacy/edje/src/examples/physics_3d.edc new file mode 100644 index 0000000000..0e659a5dcc --- /dev/null +++ b/legacy/edje/src/examples/physics_3d.edc @@ -0,0 +1,217 @@ +/* It can be tested with edje_player slave mode + * $ edje_player -S -p physics_3d.edj + * + * signal on backcull -> allow movement in all axes, enable backface cull + * signal off backcull -> allow movement in all axes, disable backface cull + * + * message 1 FLOAT_SET 3 50 -100 0 -> apply an impulse on red box with + * x = 50, y = -100, z = 0, for example + * message 2 FLOAT_SET 3 0 0 8.2 -> apply a torque impulse on red box with + * x = 4, y = 0, z = 0.8, for example + * message 3 FLOAT_SET 3 0 1 0 -> allow linear movement on axes x, y, z + * message 4 FLOAT_SET 3 0 1 0 -> allow angular movement on axes x, y, z + * message 5 STRING "linear" -> return a message with part's movement freedom + * for "linear" or "angular. + */ + +#define ID_IMPULSE (1) +#define ID_TORQUE_IMPULSE (2) +#define ID_LIN_SET (3) +#define ID_ANG_SET (4) +#define ID_GET (5) + +collections { + + group { + name: "example_group"; + + script { + public message(Msg_Type:type, id, ...) { + if ((id == ID_IMPULSE) && (type == MSG_FLOAT_SET)) { + new Float:x, Float:y, Float:z; + new n = numargs(); + if (n < 5) return; + x = getfarg(2); + y = getfarg(3); + z = getfarg(4); + physics_impulse(PART:"red_box", x, y, z); + } + else if ((id == ID_TORQUE_IMPULSE) && (type == MSG_FLOAT_SET)) { + new Float:x, Float:y, Float:z; + new n = numargs(); + if (n < 5) return; + x = getfarg(2); + y = getfarg(3); + z = getfarg(4); + physics_torque_impulse(PART:"red_box", x, y, z); + } + else if ((id == ID_LIN_SET) && (type == MSG_FLOAT_SET)) { + new Float:x, Float:y, Float:z; + new n = numargs(); + if (n < 5) return; + x = getfarg(2); + y = getfarg(3); + z = getfarg(4); + custom_state(PART:"red_box", "default", 0.0); + set_state_val(PART:"red_box", STATE_PHYSICS_MOV_FREEDOM_LIN, + x, y, z); + set_state(PART:"red_box", "custom", 0.0); + } + else if ((id == ID_ANG_SET) && (type == MSG_FLOAT_SET)) { + new Float:x, Float:y, Float:z; + new n = numargs(); + if (n < 5) return; + x = getfarg(2); + y = getfarg(3); + z = getfarg(4); + custom_state(PART:"red_box", "default", 0.0); + set_state_val(PART:"red_box", STATE_PHYSICS_MOV_FREEDOM_ANG, + x, y, z); + set_state(PART:"red_box", "custom", 0.0); + } + else if ((id == ID_GET) && (type == MSG_STRING)) { + new Float:x, Float:y, Float:z; + new name[1024]; + getsarg(2, name, sizeof(name)); + if (!strcmp(name, "linear")) + { + get_state_val(PART:"red_box", + STATE_PHYSICS_MOV_FREEDOM_LIN, x, y, z); + send_message(MSG_STRING_FLOAT_SET, 1, "Linear", x, y, z); + } + else if (!strcmp(name, "angular")) + { + get_state_val(PART:"red_box", + STATE_PHYSICS_MOV_FREEDOM_ANG, x, y, z); + send_message(MSG_STRING_FLOAT_SET, 1, "Angular", x, y, z); + } + } + } + } + + parts { + part { + name: "background"; + type: RECT; + physics_body: NONE; + description { + state: "default" 0.0; + color: 255 255 255 255; /* white */ + rel1.relative: 0.0 0.0; + rel2.relative: 1.0 1.0; + } + } + + part { + name: "red_box"; + type: RECT; + physics_body: RIGID_BOX; + description { + state: "default" 0.0; + color: 255 0 0 255; /* light red */ + rel1.relative: 0.45 0.1; + rel2.relative: 0.55 0.2; + aspect: 1 1; + physics { + mass: 30; + restitution: 0.85; + movement_freedom { + linear: 1 1 1; + angular: 1 1 1; + } + } + } + description { + state: "backface_culled" 0.0; + inherit: "default" 0.0; + physics.backface_cull: 1; + } + } + + part { + name: "floor"; + type: RECT; + physics_body: BOUNDARY_BOTTOM; + description { + state: "default" 0.0; + visible: 0; + physics { + restitution: 0.8; + } + } + } + + part { + name: "front"; + type: RECT; + physics_body: BOUNDARY_FRONT; + description { + state: "default" 0.0; + visible: 0; + physics { + restitution: 0.4; + } + } + } + + part { + name: "back"; + type: RECT; + physics_body: BOUNDARY_BACK; + description { + state: "default" 0.0; + visible: 0; + physics { + restitution: 0.4; + } + } + } + + part { + name: "left"; + type: RECT; + physics_body: BOUNDARY_LEFT; + description { + state: "default" 0.0; + visible: 0; + physics { + restitution: 0.4; + } + } + } + + part { + name: "right"; + type: RECT; + physics_body: BOUNDARY_RIGHT; + description { + state: "default" 0.0; + visible: 0; + physics { + restitution: 0.4; + } + } + } + } + + programs { + program { + name: "backcull,on"; + signal: "on"; + source: "backcull"; + action: STATE_SET "backface_culled" 0.0; + target: "red_box"; + } + + program { + name: "backcull,off"; + signal: "off"; + source: "backcull"; + action: STATE_SET "default" 0.0; + target: "red_box"; + } + + } + + } +} diff --git a/legacy/edje/src/lib/edje_calc.c b/legacy/edje/src/lib/edje_calc.c index a94fbf0f05..6aa4d753b7 100644 --- a/legacy/edje/src/lib/edje_calc.c +++ b/legacy/edje/src/lib/edje_calc.c @@ -2308,6 +2308,13 @@ _edje_part_recalc_single(Edje *ed, params->physics.hardness = desc->physics.hardness; params->physics.ignore_part_pos = desc->physics.ignore_part_pos; params->physics.light_on = desc->physics.light_on; + params->physics.mov_freedom.lin.x = desc->physics.mov_freedom.lin.x; + params->physics.mov_freedom.lin.y = desc->physics.mov_freedom.lin.y; + params->physics.mov_freedom.lin.z = desc->physics.mov_freedom.lin.z; + params->physics.mov_freedom.ang.x = desc->physics.mov_freedom.ang.x; + params->physics.mov_freedom.ang.y = desc->physics.mov_freedom.ang.y; + params->physics.mov_freedom.ang.z = desc->physics.mov_freedom.ang.z; + params->physics.backcull = desc->physics.backcull; #endif _edje_part_recalc_single_map(ed, ep, center, light, persp, desc, chosen_desc, params); } @@ -2464,6 +2471,14 @@ _edje_physics_world_geometry_check(EPhysics_World *world) static void _edje_physics_body_props_update(Edje_Real_Part *ep, Edje_Calc_Params *pf, Eina_Bool pos_update) { + ephysics_body_linear_movement_enable_set(ep->body, + pf->physics.mov_freedom.lin.x, + pf->physics.mov_freedom.lin.y, + pf->physics.mov_freedom.lin.z); + ephysics_body_angular_movement_enable_set(ep->body, + pf->physics.mov_freedom.ang.x, + pf->physics.mov_freedom.ang.y, + pf->physics.mov_freedom.ang.z); /* Boundaries geometry and mass shouldn't be changed */ if (ep->part->physics_body < EDJE_PART_PHYSICS_BODY_BOUNDARY_TOP) { @@ -2507,6 +2522,7 @@ _edje_physics_body_props_update(Edje_Real_Part *ep, Edje_Calc_Params *pf, Eina_B ephysics_body_sleeping_threshold_set(ep->body, pf->physics.sleep.linear, pf->physics.sleep.angular); ephysics_body_light_set(ep->body, pf->physics.light_on); + ephysics_body_back_face_culling_set(ep->body, pf->physics.backcull); } static void @@ -2984,6 +3000,20 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta p3->physics.material = EPHYSICS_BODY_MATERIAL_CUSTOM; p3->physics.light_on = p1->physics.light_on || p2->physics.light_on; + p3->physics.backcull = p1->physics.backcull || p2->physics.backcull; + + p3->physics.mov_freedom.lin.x = p1->physics.mov_freedom.lin.x || + p2->physics.mov_freedom.lin.x; + p3->physics.mov_freedom.lin.y = p1->physics.mov_freedom.lin.y || + p2->physics.mov_freedom.lin.y; + p3->physics.mov_freedom.lin.z = p1->physics.mov_freedom.lin.z || + p2->physics.mov_freedom.lin.z; + p3->physics.mov_freedom.ang.x = p1->physics.mov_freedom.ang.x || + p2->physics.mov_freedom.ang.x; + p3->physics.mov_freedom.ang.y = p1->physics.mov_freedom.ang.y || + p2->physics.mov_freedom.ang.y; + p3->physics.mov_freedom.ang.z = p1->physics.mov_freedom.ang.z || + p2->physics.mov_freedom.ang.z; #endif switch (part_type) diff --git a/legacy/edje/src/lib/edje_data.c b/legacy/edje/src/lib/edje_data.c index 37ad445f69..6b74631f7b 100644 --- a/legacy/edje/src/lib/edje_data.c +++ b/legacy/edje/src/lib/edje_data.c @@ -532,6 +532,13 @@ _edje_edd_init(void) EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.hardness", physics.hardness, EET_T_DOUBLE); \ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.ignore_part_pos", physics.ignore_part_pos, EET_T_UCHAR); \ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.light_on", physics.light_on, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.backcull", physics.backcull, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.lin.x", physics.mov_freedom.lin.x, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.lin.y", physics.mov_freedom.lin.y, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.lin.z", physics.mov_freedom.lin.z, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.ang.x", physics.mov_freedom.ang.x, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.ang.y", physics.mov_freedom.ang.y, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.ang.z", physics.mov_freedom.ang.z, EET_T_UCHAR); \ } #else #define EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON(Edd, Type) \ @@ -608,6 +615,13 @@ _edje_edd_init(void) EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.hardness", Dec.physics.hardness, EET_T_DOUBLE); \ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.ignore_part_pos", Dec.physics.ignore_part_pos, EET_T_UCHAR); \ EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.light_on", Dec.physics.light_on, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.backcull", Dec.physics.backcull, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.lin.x", Dec.physics.mov_freedom.lin.x, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.lin.y", Dec.physics.mov_freedom.lin.y, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.lin.z", Dec.physics.mov_freedom.lin.z, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.ang.x", Dec.physics.mov_freedom.ang.x, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.ang.y", Dec.physics.mov_freedom.ang.y, EET_T_UCHAR); \ + EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "physics.mov_freedom.ang.z", Dec.physics.mov_freedom.ang.z, EET_T_UCHAR); \ } #else #define EDJE_DATA_DESCRIPTOR_DESCRIPTION_COMMON_SUB(Edd, Type, Dec) \ diff --git a/legacy/edje/src/lib/edje_embryo.c b/legacy/edje/src/lib/edje_embryo.c index 0050c673e8..898df51407 100644 --- a/legacy/edje/src/lib/edje_embryo.c +++ b/legacy/edje/src/lib/edje_embryo.c @@ -2319,6 +2319,25 @@ _edje_embryo_fn_set_state_val(Embryo_Program *ep, Embryo_Cell *params) GETINT(rp->custom->description->physics.light_on, params[3]); break; + case EDJE_STATE_PARAM_PHYSICS_MOV_FREEDOM_LIN: + CHKPARAM(5); + + GETINT(rp->custom->description->physics.mov_freedom.lin.x, params[3]); + GETINT(rp->custom->description->physics.mov_freedom.lin.y, params[4]); + GETINT(rp->custom->description->physics.mov_freedom.lin.z, params[5]); + break; + case EDJE_STATE_PARAM_PHYSICS_MOV_FREEDOM_ANG: + CHKPARAM(5); + + GETINT(rp->custom->description->physics.mov_freedom.ang.x, params[3]); + GETINT(rp->custom->description->physics.mov_freedom.ang.y, params[4]); + GETINT(rp->custom->description->physics.mov_freedom.ang.z, params[5]); + break; + case EDJE_STATE_PARAM_PHYSICS_BACK_CULL: + CHKPARAM(3); + + GETINT(rp->custom->description->physics.backcull, params[3]); + break; #endif default: break; @@ -2828,6 +2847,25 @@ _edje_embryo_fn_get_state_val(Embryo_Program *ep, Embryo_Cell *params) SETINT(rp->custom->description->physics.light_on, params[3]); break; + case EDJE_STATE_PARAM_PHYSICS_MOV_FREEDOM_LIN: + CHKPARAM(5); + + SETINT(rp->custom->description->physics.mov_freedom.lin.x, params[3]); + SETINT(rp->custom->description->physics.mov_freedom.lin.y, params[4]); + SETINT(rp->custom->description->physics.mov_freedom.lin.z, params[5]); + break; + case EDJE_STATE_PARAM_PHYSICS_MOV_FREEDOM_ANG: + CHKPARAM(5); + + SETINT(rp->custom->description->physics.mov_freedom.ang.x, params[3]); + SETINT(rp->custom->description->physics.mov_freedom.ang.y, params[4]); + SETINT(rp->custom->description->physics.mov_freedom.ang.z, params[5]); + break; + case EDJE_STATE_PARAM_PHYSICS_BACK_CULL: + CHKPARAM(3); + + SETINT(rp->custom->description->physics.backcull, params[3]); + break; #endif default: break; diff --git a/legacy/edje/src/lib/edje_private.h b/legacy/edje/src/lib/edje_private.h index 27172f84b9..72b40b7021 100644 --- a/legacy/edje/src/lib/edje_private.h +++ b/legacy/edje/src/lib/edje_private.h @@ -424,7 +424,10 @@ typedef struct _Edje_Markup_Filter_Callback Edje_Markup_Filter_Callback; #define EDJE_STATE_PARAM_PHYSICS_IGNORE_PART_POS 50 #define EDJE_STATE_PARAM_PHYSICS_LIGHT_ON 51 #define EDJE_STATE_PARAM_PHYSICS_HARDNESS 52 -#define EDJE_STATE_PARAM_LAST 53 +#define EDJE_STATE_PARAM_PHYSICS_MOV_FREEDOM_LIN 53 +#define EDJE_STATE_PARAM_PHYSICS_MOV_FREEDOM_ANG 54 +#define EDJE_STATE_PARAM_PHYSICS_BACK_CULL 55 +#define EDJE_STATE_PARAM_LAST 56 #define EDJE_ENTRY_EDIT_MODE_NONE 0 #define EDJE_ENTRY_EDIT_MODE_SELECTABLE 1 @@ -991,6 +994,19 @@ struct _Edje_Part_Description_Common double linear; double angular; } sleep; + struct { + struct { + unsigned char x; + unsigned char y; + unsigned char z; + } lin; + struct { + unsigned char x; + unsigned char y; + unsigned char z; + } ang; + } mov_freedom; + unsigned char backcull; unsigned char material; /* (custom, iron, wood, ...) */ unsigned char light_on; unsigned char ignore_part_pos; @@ -1340,10 +1356,23 @@ struct _Edje_Calc_Params double linear; //8 double angular; //8 } sleep; // 16 + struct { + struct { + unsigned char x; + unsigned char y; + unsigned char z; + } lin; // 3 + struct { + unsigned char x; + unsigned char y; + unsigned char z; + } ang; // 3 + } mov_freedom; // 6 + unsigned char backcull; unsigned char material; // 1 unsigned char light_on; // 1 unsigned char ignore_part_pos; //1 - } physics; // 75 + } physics; #endif unsigned char persp_on : 1; unsigned char lighted : 1;