summaryrefslogtreecommitdiff
path: root/legacy/ephysics
diff options
context:
space:
mode:
authorLeandro Dorileo <dorileo@profusion.mobi>2012-12-11 21:11:19 +0000
committerLeandro Dorileo <dorileo@profusion.mobi>2012-12-11 21:11:19 +0000
commit547ade5f6cfd11da1317fb4a8739234bd337bbf3 (patch)
treef3d52bf188f1a0e37c9ec4442b6a035ab68aa44f /legacy/ephysics
parent2ccf6d2a119fc3c31851114aa19bef3f42e6e8cf (diff)
EPhysics: soft_circle and soft_ellipsoid renaming
For sake of consistency moving soft_circle to soft_cylinder and soft_ellipsoid becomes soft_sphere. Their face identification were moved as well. The faces identifications were also unified. SVN revision: 80720
Diffstat (limited to 'legacy/ephysics')
-rw-r--r--legacy/ephysics/src/bin/ephysics_sandbox.c2
-rw-r--r--legacy/ephysics/src/bin/test_soft_body.c4
-rw-r--r--legacy/ephysics/src/bin/test_soft_button.c10
-rw-r--r--legacy/ephysics/src/bin/test_soft_ellipsoid.c6
-rw-r--r--legacy/ephysics/src/lib/EPhysics.h53
-rw-r--r--legacy/ephysics/src/lib/ephysics_body.cpp107
-rw-r--r--legacy/ephysics/src/lib/ephysics_private.h1
7 files changed, 90 insertions, 93 deletions
diff --git a/legacy/ephysics/src/bin/ephysics_sandbox.c b/legacy/ephysics/src/bin/ephysics_sandbox.c
index 3d28ed9a6a..4a00f140e8 100644
--- a/legacy/ephysics/src/bin/ephysics_sandbox.c
+++ b/legacy/ephysics/src/bin/ephysics_sandbox.c
@@ -139,7 +139,7 @@ _type_set_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
139 139
140 if (elm_radio_value_get(obj)) 140 if (elm_radio_value_get(obj))
141 { 141 {
142 body = ephysics_body_soft_circle_add(world); 142 body = ephysics_body_soft_cylinder_add(world);
143 ephysics_body_soft_body_hardness_set( 143 ephysics_body_soft_body_hardness_set(
144 body, elm_slider_value_get(bd->controls.hardness)); 144 body, elm_slider_value_get(bd->controls.hardness));
145 elm_object_disabled_set(bd->controls.hardness, EINA_FALSE); 145 elm_object_disabled_set(bd->controls.hardness, EINA_FALSE);
diff --git a/legacy/ephysics/src/bin/test_soft_body.c b/legacy/ephysics/src/bin/test_soft_body.c
index d99db710dc..4b189e625b 100644
--- a/legacy/ephysics/src/bin/test_soft_body.c
+++ b/legacy/ephysics/src/bin/test_soft_body.c
@@ -26,7 +26,7 @@ _world_populate(Test_Data *test_data)
26 evas_object_show(evas_obj); 26 evas_object_show(evas_obj);
27 test_data->evas_objs = eina_list_append(test_data->evas_objs, evas_obj); 27 test_data->evas_objs = eina_list_append(test_data->evas_objs, evas_obj);
28 28
29 fall_body = ephysics_body_soft_circle_add(test_data->world); 29 fall_body = ephysics_body_soft_cylinder_add(test_data->world);
30 ephysics_body_soft_body_hardness_set(fall_body, 10); 30 ephysics_body_soft_body_hardness_set(fall_body, 10);
31 ephysics_body_evas_object_set(fall_body, evas_obj, EINA_TRUE); 31 ephysics_body_evas_object_set(fall_body, evas_obj, EINA_TRUE);
32 ephysics_body_restitution_set(fall_body, 0.95); 32 ephysics_body_restitution_set(fall_body, 0.95);
@@ -51,7 +51,7 @@ _world_populate(Test_Data *test_data)
51 evas_object_show(evas_obj); 51 evas_object_show(evas_obj);
52 test_data->evas_objs = eina_list_append(test_data->evas_objs, evas_obj); 52 test_data->evas_objs = eina_list_append(test_data->evas_objs, evas_obj);
53 53
54 fall_body = ephysics_body_soft_circle_add(test_data->world); 54 fall_body = ephysics_body_soft_cylinder_add(test_data->world);
55 ephysics_body_soft_body_hardness_set(fall_body, 30); 55 ephysics_body_soft_body_hardness_set(fall_body, 30);
56 ephysics_body_evas_object_set(fall_body, evas_obj, EINA_TRUE); 56 ephysics_body_evas_object_set(fall_body, evas_obj, EINA_TRUE);
57 ephysics_body_restitution_set(fall_body, 0.95); 57 ephysics_body_restitution_set(fall_body, 0.95);
diff --git a/legacy/ephysics/src/bin/test_soft_button.c b/legacy/ephysics/src/bin/test_soft_button.c
index dd09deb030..1f7e768aac 100644
--- a/legacy/ephysics/src/bin/test_soft_button.c
+++ b/legacy/ephysics/src/bin/test_soft_button.c
@@ -30,24 +30,24 @@ _mouse_down_cb(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, v
30} 30}
31 31
32static void 32static void
33_soft_ellipsoid_add(Test_Data *test_data, Evas_Object *front_face, Evas_Object *back_face) 33_soft_sphere_add(Test_Data *test_data, Evas_Object *front_face, Evas_Object *back_face)
34{ 34{
35 EPhysics_Body *body; 35 EPhysics_Body *body;
36 Evas_Coord x, y, w, h; 36 Evas_Coord x, y, w, h;
37 37
38 38
39 body = ephysics_body_soft_ellipsoid_add(test_data->world, 500); 39 body = ephysics_body_soft_sphere_add(test_data->world, 500);
40 40
41 ephysics_body_soft_body_position_iterations_set(body, 16); 41 ephysics_body_soft_body_position_iterations_set(body, 16);
42 ephysics_body_soft_body_anchor_hardness_set(body, 0); 42 ephysics_body_soft_body_anchor_hardness_set(body, 0);
43 ephysics_body_soft_body_hardness_set(body, 3); 43 ephysics_body_soft_body_hardness_set(body, 3);
44 44
45 ephysics_body_face_evas_object_set(body, 45 ephysics_body_face_evas_object_set(body,
46 EPHYSICS_BODY_SOFT_ELLIPSOID_FACE_FRONT, 46 EPHYSICS_BODY_SPHERE_FACE_FRONT,
47 front_face, EINA_TRUE); 47 front_face, EINA_TRUE);
48 48
49 ephysics_body_face_evas_object_set(body, 49 ephysics_body_face_evas_object_set(body,
50 EPHYSICS_BODY_SOFT_ELLIPSOID_FACE_BACK, 50 EPHYSICS_BODY_SPHERE_FACE_BACK,
51 back_face, EINA_TRUE); 51 back_face, EINA_TRUE);
52 52
53 ephysics_body_geometry_get(body, &x, &y, NULL, &w, &h, NULL); 53 ephysics_body_geometry_get(body, &x, &y, NULL, &w, &h, NULL);
@@ -90,7 +90,7 @@ _world_populate(Test_Data *test_data)
90 evas_object_show(back_face); 90 evas_object_show(back_face);
91 test_data->evas_objs = eina_list_append(test_data->evas_objs, back_face); 91 test_data->evas_objs = eina_list_append(test_data->evas_objs, back_face);
92 92
93 _soft_ellipsoid_add(test_data, front_face, back_face); 93 _soft_sphere_add(test_data, front_face, back_face);
94} 94}
95 95
96static void 96static void
diff --git a/legacy/ephysics/src/bin/test_soft_ellipsoid.c b/legacy/ephysics/src/bin/test_soft_ellipsoid.c
index 409146a8f0..393f17d8cd 100644
--- a/legacy/ephysics/src/bin/test_soft_ellipsoid.c
+++ b/legacy/ephysics/src/bin/test_soft_ellipsoid.c
@@ -36,13 +36,13 @@ _soft_ellipsoid_add(Test_Data *test_data, Evas_Object *front_face, Evas_Object *
36 Evas_Coord w, h; 36 Evas_Coord w, h;
37 37
38 38
39 body = ephysics_body_soft_ellipsoid_add(test_data->world, 100); 39 body = ephysics_body_soft_sphere_add(test_data->world, 100);
40 40
41 ephysics_body_face_evas_object_set(body, 41 ephysics_body_face_evas_object_set(body,
42 EPHYSICS_BODY_SOFT_ELLIPSOID_FACE_FRONT, front_face, EINA_TRUE); 42 EPHYSICS_BODY_SPHERE_FACE_FRONT, front_face, EINA_TRUE);
43 43
44 ephysics_body_face_evas_object_set(body, 44 ephysics_body_face_evas_object_set(body,
45 EPHYSICS_BODY_SOFT_ELLIPSOID_FACE_BACK, back_face, EINA_TRUE); 45 EPHYSICS_BODY_SPHERE_FACE_BACK, back_face, EINA_TRUE);
46 46
47 ephysics_body_geometry_get(body, NULL, NULL, NULL, &w, &h, NULL); 47 ephysics_body_geometry_get(body, NULL, NULL, NULL, &w, &h, NULL);
48 ephysics_body_resize(body, w, h, h); 48 ephysics_body_resize(body, w, h, h);
diff --git a/legacy/ephysics/src/lib/EPhysics.h b/legacy/ephysics/src/lib/EPhysics.h
index 888e4be004..e7fc6a8f04 100644
--- a/legacy/ephysics/src/lib/EPhysics.h
+++ b/legacy/ephysics/src/lib/EPhysics.h
@@ -621,7 +621,7 @@ EAPI Eina_Bool ephysics_shape_save(const EPhysics_Shape *shape, const char *file
621 * @li @ref ephysics_body_cylinder_add() 621 * @li @ref ephysics_body_cylinder_add()
622 * @li @ref ephysics_body_box_add() 622 * @li @ref ephysics_body_box_add()
623 * @li @ref ephysics_body_shape_add() 623 * @li @ref ephysics_body_shape_add()
624 * @li @ref ephysics_body_soft_circle_add() 624 * @li @ref ephysics_body_soft_cylinder_add()
625 * @li @ref ephysics_body_soft_box_add() 625 * @li @ref ephysics_body_soft_box_add()
626 * 626 *
627 * and it can be deleted with @ref ephysics_body_del(). 627 * and it can be deleted with @ref ephysics_body_del().
@@ -1959,7 +1959,7 @@ EAPI Eina_Bool ephysics_world_stack_enable_get(const EPhysics_World *world);
1959 * Also they can be soft bodies, that won't act as rigid bodies. They will 1959 * Also they can be soft bodies, that won't act as rigid bodies. They will
1960 * deform its shape under certain circunstances, like under collisions. 1960 * deform its shape under certain circunstances, like under collisions.
1961 * Soft bodies can be created with: 1961 * Soft bodies can be created with:
1962 * @li @ref ephysics_body_soft_circle_add(); 1962 * @li @ref ephysics_body_soft_cylinder_add();
1963 * @li @ref ephysics_body_soft_box_add(); 1963 * @li @ref ephysics_body_soft_box_add();
1964 * 1964 *
1965 * They can collide and have customizable properties, like: 1965 * They can collide and have customizable properties, like:
@@ -2173,6 +2173,8 @@ typedef enum _EPhysics_Body_Cloth_Anchor_Side
2173 * Define in wich body's face the evas object should be set. 2173 * Define in wich body's face the evas object should be set.
2174 * 2174 *
2175 * @see ephysics_body_face_evas_object_set() 2175 * @see ephysics_body_face_evas_object_set()
2176 * @see ephysics_body_face_evas_object_unset()
2177 * @see ephysics_body_face_evas_object_get()
2176 * 2178 *
2177 * @ingroup EPhysics_Body 2179 * @ingroup EPhysics_Body
2178 */ 2180 */
@@ -2187,32 +2189,17 @@ typedef enum _EPhysics_Body_Face
2187 EPHYSICS_BODY_BOX_FACE_TOP, 2189 EPHYSICS_BODY_BOX_FACE_TOP,
2188 EPHYSICS_BODY_BOX_FACE_BOTTOM, 2190 EPHYSICS_BODY_BOX_FACE_BOTTOM,
2189 2191
2192 EPHYSICS_BODY_CLOTH_FACE_FRONT,
2193 EPHYSICS_BODY_CLOTH_FACE_BACK,
2194
2190 EPHYSICS_BODY_CYLINDER_FACE_MIDDLE_FRONT, 2195 EPHYSICS_BODY_CYLINDER_FACE_MIDDLE_FRONT,
2191 EPHYSICS_BODY_CYLINDER_FACE_MIDDLE_BACK, 2196 EPHYSICS_BODY_CYLINDER_FACE_MIDDLE_BACK,
2192 EPHYSICS_BODY_CYLINDER_FACE_FRONT, 2197 EPHYSICS_BODY_CYLINDER_FACE_FRONT,
2193 EPHYSICS_BODY_CYLINDER_FACE_BACK, 2198 EPHYSICS_BODY_CYLINDER_FACE_BACK,
2194 EPHYSICS_BODY_CYLINDER_FACE_CURVED, 2199 EPHYSICS_BODY_CYLINDER_FACE_CURVED,
2195 2200
2196 EPHYSICS_BODY_CLOTH_FACE_FRONT, 2201 EPHYSICS_BODY_SPHERE_FACE_FRONT,
2197 EPHYSICS_BODY_CLOTH_FACE_BACK, 2202 EPHYSICS_BODY_SPHERE_FACE_BACK,
2198
2199 EPHYSICS_BODY_SOFT_ELLIPSOID_FACE_FRONT,
2200 EPHYSICS_BODY_SOFT_ELLIPSOID_FACE_BACK,
2201
2202 EPHYSICS_BODY_SOFT_BOX_FACE_MIDDLE_FRONT,
2203 EPHYSICS_BODY_SOFT_BOX_FACE_MIDDLE_BACK,
2204 EPHYSICS_BODY_SOFT_BOX_FACE_FRONT,
2205 EPHYSICS_BODY_SOFT_BOX_FACE_BACK,
2206 EPHYSICS_BODY_SOFT_BOX_FACE_LEFT,
2207 EPHYSICS_BODY_SOFT_BOX_FACE_RIGHT,
2208 EPHYSICS_BODY_SOFT_BOX_FACE_TOP,
2209 EPHYSICS_BODY_SOFT_BOX_FACE_BOTTOM,
2210
2211 EPHYSICS_BODY_SOFT_CIRCLE_FACE_MIDDLE_FRONT,
2212 EPHYSICS_BODY_SOFT_CIRCLE_FACE_MIDDLE_BACK,
2213 EPHYSICS_BODY_SOFT_CIRCLE_FACE_FRONT,
2214 EPHYSICS_BODY_SOFT_CIRCLE_FACE_BACK,
2215 EPHYSICS_BODY_SOFT_CIRCLE_FACE_CURVED,
2216 2203
2217 EPHYSICS_BODY_FACE_LAST, 2204 EPHYSICS_BODY_FACE_LAST,
2218} EPhysics_Body_Face; 2205} EPhysics_Body_Face;
@@ -2494,15 +2481,15 @@ EAPI int ephysics_body_soft_body_slice_index_get(EPhysics_Body *body, Evas_Objec
2494 2481
2495/** 2482/**
2496 * @brief 2483 * @brief
2497 * Add a soft ellipsoid. 2484 * Add a soft sphere.
2498 * 2485 *
2499 * Add a new soft 3d ellipsoid to the simulation. The @p granularity defines how 2486 * Add a new soft 3d sphere to the simulation. The @p granularity defines how
2500 * many triangles are to be added. 2487 * many triangles are to be added.
2501 * 2488 *
2502 * @note if no @p granularity is informed(i.e @p granularity = 0) the soft body 2489 * @note if no @p granularity is informed(i.e @p granularity = 0) the soft body
2503 * will be created with a triangle mesh of 100. 2490 * will be created with a triangle mesh of 100.
2504 * 2491 *
2505 * @param world The world the new soft ellipsoid is to be added. 2492 * @param world The world the new soft sphere is to be added.
2506 * @param granularity How many triangles the soft body triangle mesh must have. 2493 * @param granularity How many triangles the soft body triangle mesh must have.
2507 * @return a new body or @c NULL on errors. 2494 * @return a new body or @c NULL on errors.
2508 * 2495 *
@@ -2512,7 +2499,7 @@ EAPI int ephysics_body_soft_body_slice_index_get(EPhysics_Body *body, Evas_Objec
2512 * 2499 *
2513 * @ingroup EPhysics_Body 2500 * @ingroup EPhysics_Body
2514 */ 2501 */
2515EAPI EPhysics_Body *ephysics_body_soft_ellipsoid_add(EPhysics_World *world, int granularity); 2502EAPI EPhysics_Body *ephysics_body_soft_sphere_add(EPhysics_World *world, int granularity);
2516 2503
2517/** 2504/**
2518 * @brief 2505 * @brief
@@ -2679,7 +2666,7 @@ EAPI void ephysics_body_soft_body_bending_constraints_add(EPhysics_Body *body, i
2679 * ephysics_body_evas_object_set(), and it will collid as a sphere(even if 2666 * ephysics_body_evas_object_set(), and it will collid as a sphere(even if
2680 * you`ve associated an evas rectangle). 2667 * you`ve associated an evas rectangle).
2681 * 2668 *
2682 * For deformable sphere use @p ephysics_body_soft_ellipsoid_add() instead. 2669 * For deformable sphere use @p ephysics_body_soft_sphere_add() instead.
2683 * 2670 *
2684 * @param world The world this body will belong to. 2671 * @param world The world this body will belong to.
2685 * @return a new body or @c NULL, on errors. 2672 * @return a new body or @c NULL, on errors.
@@ -2704,7 +2691,7 @@ EAPI EPhysics_Body *ephysics_body_sphere_add(EPhysics_World *world);
2704 * and it will collide as a cylinder (even if you have an evas rectangle). 2691 * and it will collide as a cylinder (even if you have an evas rectangle).
2705 * 2692 *
2706 * If a cylinder that could have its shape deformed is required, use 2693 * If a cylinder that could have its shape deformed is required, use
2707 * @ref ephysics_body_soft_circle_add(). 2694 * @ref ephysics_body_soft_cylinder_add().
2708 * 2695 *
2709 * @param world The world this body will belongs to. 2696 * @param world The world this body will belongs to.
2710 * @return a new body or @c NULL, on errors. 2697 * @return a new body or @c NULL, on errors.
@@ -2719,14 +2706,14 @@ EAPI EPhysics_Body *ephysics_body_cylinder_add(EPhysics_World *world);
2719 2706
2720/** 2707/**
2721 * @brief 2708 * @brief
2722 * Create a new deformable circle physics body. 2709 * Create a new deformable cylinder physics body.
2723 * 2710 *
2724 * Its collision shape will be a circle of diameter 1. To change it's size 2711 * Its collision shape will be a cylinder of diameter 1. To change it's size
2725 * @ref ephysics_body_geometry_set() should be used. 2712 * @ref ephysics_body_geometry_set() should be used.
2726 * 2713 *
2727 * Any evas object can be associated to it with 2714 * Any evas object can be associated to it with
2728 * @ref ephysics_body_evas_object_set(), 2715 * @ref ephysics_body_evas_object_set(),
2729 * and it will collide and deform as a circle (even if you have an evas 2716 * and it will collide and deform as a cylinder (even if you have an evas
2730 * rectangle). 2717 * rectangle).
2731 * 2718 *
2732 * Just like rotation, deformation will be applied on associated 2719 * Just like rotation, deformation will be applied on associated
@@ -2747,7 +2734,7 @@ EAPI EPhysics_Body *ephysics_body_cylinder_add(EPhysics_World *world);
2747 * 2734 *
2748 * @ingroup EPhysics_Body 2735 * @ingroup EPhysics_Body
2749 */ 2736 */
2750EAPI EPhysics_Body *ephysics_body_soft_circle_add(EPhysics_World *world); 2737EAPI EPhysics_Body *ephysics_body_soft_cylinder_add(EPhysics_World *world);
2751 2738
2752/** 2739/**
2753 * @brief 2740 * @brief
@@ -3073,7 +3060,7 @@ EAPI EPhysics_World *ephysics_body_world_get(const EPhysics_Body *body);
3073 * @see ephysics_body_box_add(). 3060 * @see ephysics_body_box_add().
3074 * @see ephysics_body_soft_box_add(). 3061 * @see ephysics_body_soft_box_add().
3075 * @see ephysics_body_cylinder_add(). 3062 * @see ephysics_body_cylinder_add().
3076 * @see ephysics_body_soft_circle_add(). 3063 * @see ephysics_body_soft_cylinder_add().
3077 * @see ephysics_body_evas_object_unset(). 3064 * @see ephysics_body_evas_object_unset().
3078 * @see ephysics_world_rate_set(). 3065 * @see ephysics_world_rate_set().
3079 * 3066 *
diff --git a/legacy/ephysics/src/lib/ephysics_body.cpp b/legacy/ephysics/src/lib/ephysics_body.cpp
index 576c2b864a..ebfc9c09eb 100644
--- a/legacy/ephysics/src/lib/ephysics_body.cpp
+++ b/legacy/ephysics/src/lib/ephysics_body.cpp
@@ -2603,7 +2603,7 @@ ephysics_body_soft_body_triangle_index_get(EPhysics_Body *body, Evas_Coord x, Ev
2603} 2603}
2604 2604
2605static EPhysics_Body_Face_Slice * 2605static EPhysics_Body_Face_Slice *
2606_ephysics_body_soft_ellipsoid_face_slices_add(EPhysics_Body *body, EPhysics_Body_Face face, btVector3 center) 2606_ephysics_body_soft_sphere_face_slices_add(EPhysics_Body *body, EPhysics_Body_Face face, btVector3 center)
2607{ 2607{
2608 btSoftBody::Face *bt_face; 2608 btSoftBody::Face *bt_face;
2609 btSoftBody::Node *node; 2609 btSoftBody::Node *node;
@@ -2623,9 +2623,9 @@ _ephysics_body_soft_ellipsoid_face_slices_add(EPhysics_Body *body, EPhysics_Body
2623 for (int n = 0; n < 3; n++) 2623 for (int n = 0; n < 3; n++)
2624 { 2624 {
2625 node = bt_face->m_n[n]; 2625 node = bt_face->m_n[n];
2626 if ((face == EPHYSICS_BODY_SOFT_ELLIPSOID_FACE_FRONT && 2626 if ((face == EPHYSICS_BODY_SPHERE_FACE_FRONT &&
2627 node->m_x.z() > depth_limit) || 2627 node->m_x.z() > depth_limit) ||
2628 (face == EPHYSICS_BODY_SOFT_ELLIPSOID_FACE_BACK && 2628 (face == EPHYSICS_BODY_SPHERE_FACE_BACK &&
2629 node->m_x.z() < depth_limit)) 2629 node->m_x.z() < depth_limit))
2630 out++; 2630 out++;
2631 } 2631 }
@@ -2677,7 +2677,7 @@ no_deform:
2677} 2677}
2678 2678
2679EAPI EPhysics_Body * 2679EAPI EPhysics_Body *
2680ephysics_body_soft_ellipsoid_add(EPhysics_World *world, int granularity) 2680ephysics_body_soft_sphere_add(EPhysics_World *world, int granularity)
2681{ 2681{
2682 EPhysics_Body *body; 2682 EPhysics_Body *body;
2683 EPhysics_Body_Face_Slice *front_face, *back_face; 2683 EPhysics_Body_Face_Slice *front_face, *back_face;
@@ -2690,7 +2690,7 @@ ephysics_body_soft_ellipsoid_add(EPhysics_World *world, int granularity)
2690 2690
2691 if (!world) 2691 if (!world)
2692 { 2692 {
2693 ERR("Can't add circle, world is null."); 2693 ERR("Can't add soft sphere, world is null.");
2694 return NULL; 2694 return NULL;
2695 } 2695 }
2696 2696
@@ -2721,8 +2721,8 @@ ephysics_body_soft_ellipsoid_add(EPhysics_World *world, int granularity)
2721 2721
2722 body->soft_body->setPose(false, true); 2722 body->soft_body->setPose(false, true);
2723 2723
2724 front_face = _ephysics_body_soft_ellipsoid_face_slices_add(body, 2724 front_face = _ephysics_body_soft_sphere_face_slices_add(body,
2725 EPHYSICS_BODY_SOFT_ELLIPSOID_FACE_FRONT, center); 2725 EPHYSICS_BODY_SPHERE_FACE_FRONT, center);
2726 if (!front_face) 2726 if (!front_face)
2727 { 2727 {
2728 ERR("Could not create points of deformation mapping for front face."); 2728 ERR("Could not create points of deformation mapping for front face.");
@@ -2730,15 +2730,15 @@ ephysics_body_soft_ellipsoid_add(EPhysics_World *world, int granularity)
2730 } 2730 }
2731 body->default_face = front_face; 2731 body->default_face = front_face;
2732 2732
2733 back_face = _ephysics_body_soft_ellipsoid_face_slices_add(body, 2733 back_face = _ephysics_body_soft_sphere_face_slices_add(body,
2734 EPHYSICS_BODY_SOFT_ELLIPSOID_FACE_BACK, center); 2734 EPHYSICS_BODY_SPHERE_FACE_BACK, center);
2735 if (!back_face) 2735 if (!back_face)
2736 { 2736 {
2737 ERR("Could not create points of deformation mapping for back face."); 2737 ERR("Could not create points of deformation mapping for back face.");
2738 goto no_back_face; 2738 goto no_back_face;
2739 } 2739 }
2740 2740
2741 body->shape = EPHYSICS_BODY_SHAPE_ELLIPSOID; 2741 body->shape = EPHYSICS_BODY_SHAPE_SPHERE;
2742 ephysics_world_lock_release(world); 2742 ephysics_world_lock_release(world);
2743 return body; 2743 return body;
2744 2744
@@ -2756,7 +2756,7 @@ no_collision_shape:
2756} 2756}
2757 2757
2758EAPI EPhysics_Body * 2758EAPI EPhysics_Body *
2759ephysics_body_soft_circle_add(EPhysics_World *world) 2759ephysics_body_soft_cylinder_add(EPhysics_World *world)
2760{ 2760{
2761 EPhysics_Body *body; 2761 EPhysics_Body *body;
2762 EPhysics_Body_Face_Slice *face_slice; 2762 EPhysics_Body_Face_Slice *face_slice;
@@ -2798,7 +2798,7 @@ ephysics_body_soft_circle_add(EPhysics_World *world)
2798 body->shape = EPHYSICS_BODY_SHAPE_CYLINDER; 2798 body->shape = EPHYSICS_BODY_SHAPE_CYLINDER;
2799 2799
2800 face_slice = _ephysics_body_face_slice_add(body, 2800 face_slice = _ephysics_body_face_slice_add(body,
2801 EPHYSICS_BODY_SOFT_CIRCLE_FACE_FRONT); 2801 EPHYSICS_BODY_CYLINDER_FACE_FRONT);
2802 if (!face_slice) 2802 if (!face_slice)
2803 { 2803 {
2804 ERR("Could not allocate face slice data structure."); 2804 ERR("Could not allocate face slice data structure.");
@@ -2942,7 +2942,7 @@ ephysics_body_soft_box_add(EPhysics_World *world)
2942 body->shape = EPHYSICS_BODY_SHAPE_BOX; 2942 body->shape = EPHYSICS_BODY_SHAPE_BOX;
2943 2943
2944 face_slice = _ephysics_body_face_slice_add(body, 2944 face_slice = _ephysics_body_face_slice_add(body,
2945 EPHYSICS_BODY_SOFT_BOX_FACE_FRONT); 2945 EPHYSICS_BODY_BOX_FACE_FRONT);
2946 if (!face_slice) 2946 if (!face_slice)
2947 { 2947 {
2948 ERR("Could not allocate face slice data structure."); 2948 ERR("Could not allocate face slice data structure.");
@@ -4973,7 +4973,7 @@ _ephysics_body_cloth_face_evas_object_unset(EPhysics_Body *body, EPhysics_Body_F
4973} 4973}
4974 4974
4975static void 4975static void
4976_ephysics_body_ellipsoid_face_obj_resize_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) 4976_ephysics_body_soft_sphere_face_obj_resize_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
4977{ 4977{
4978 EPhysics_Body *body = (EPhysics_Body *) data; 4978 EPhysics_Body *body = (EPhysics_Body *) data;
4979 Evas_Coord bd, w, h; 4979 Evas_Coord bd, w, h;
@@ -4986,7 +4986,7 @@ _ephysics_body_ellipsoid_face_obj_resize_cb(void *data, Evas *e __UNUSED__, Evas
4986} 4986}
4987 4987
4988static void 4988static void
4989_ephysics_body_ellipsoid_face_evas_object_del_cb(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) 4989_ephysics_body_soft_sphere_face_evas_object_del_cb(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
4990{ 4990{
4991 Eina_List *l; 4991 Eina_List *l;
4992 void *ldata; 4992 void *ldata;
@@ -5004,36 +5004,37 @@ _ephysics_body_ellipsoid_face_evas_object_del_cb(void *data, Evas *evas __UNUSED
5004 } 5004 }
5005 5005
5006 _ephysics_body_face_evas_object_del(body, face_obj, 5006 _ephysics_body_face_evas_object_del(body, face_obj,
5007 _ephysics_body_ellipsoid_face_obj_resize_cb); 5007 _ephysics_body_soft_sphere_face_obj_resize_cb);
5008 _ephysics_body_soft_body_slices_clean(face_slice->slices); 5008 _ephysics_body_soft_body_slices_clean(face_slice->slices);
5009 DBG("Ellipsoid's face cleaned up."); 5009
5010 DBG("Soft sphere's face cleaned up.");
5010} 5011}
5011 5012
5012static void 5013static void
5013_ephysics_body_ellipsoid_face_evas_object_clean(EPhysics_Body *body, EPhysics_Body_Face_Obj *face_obj, Eina_List *slices) 5014_ephysics_body_soft_sphere_face_evas_object_clean(EPhysics_Body *body, EPhysics_Body_Face_Obj *face_obj, Eina_List *slices)
5014{ 5015{
5015 evas_object_map_enable_set(face_obj->obj, EINA_FALSE); 5016 evas_object_map_enable_set(face_obj->obj, EINA_FALSE);
5016 evas_object_event_callback_del(face_obj->obj, EVAS_CALLBACK_DEL, 5017 evas_object_event_callback_del(face_obj->obj, EVAS_CALLBACK_DEL,
5017 _ephysics_body_ellipsoid_face_evas_object_del_cb); 5018 _ephysics_body_soft_sphere_face_evas_object_del_cb);
5018 5019
5019 evas_object_event_callback_del(face_obj->obj, EVAS_CALLBACK_RESTACK, 5020 evas_object_event_callback_del(face_obj->obj, EVAS_CALLBACK_RESTACK,
5020 _ephysics_body_soft_body_evas_restack_cb); 5021 _ephysics_body_soft_body_evas_restack_cb);
5021 _ephysics_body_soft_body_slices_clean(slices); 5022 _ephysics_body_soft_body_slices_clean(slices);
5022 5023
5023 _ephysics_body_face_evas_object_del(body, face_obj, 5024 _ephysics_body_face_evas_object_del(body, face_obj,
5024 _ephysics_body_ellipsoid_face_obj_resize_cb); 5025 _ephysics_body_soft_sphere_face_obj_resize_cb);
5025} 5026}
5026 5027
5027static void 5028static void
5028_ephysics_body_ellipsoid_face_evas_object_set(EPhysics_Body *body, EPhysics_Body_Face face, Evas_Object *evas_obj, Eina_Bool use_obj_pos) 5029_ephysics_body_soft_sphere_face_evas_object_set(EPhysics_Body *body, EPhysics_Body_Face face, Evas_Object *evas_obj, Eina_Bool use_obj_pos)
5029{ 5030{
5030 int obj_x, obj_y, obj_w, obj_h, bz, bd; 5031 int obj_x, obj_y, obj_w, obj_h, bz, bd;
5031 double rate; 5032 double rate;
5032 EPhysics_Body_Face_Slice *face_slice = NULL; 5033 EPhysics_Body_Face_Slice *face_slice = NULL;
5033 EPhysics_Body_Face_Obj *face_obj; 5034 EPhysics_Body_Face_Obj *face_obj;
5034 5035
5035 if ((face < EPHYSICS_BODY_SOFT_ELLIPSOID_FACE_FRONT) || 5036 if ((face < EPHYSICS_BODY_SPHERE_FACE_FRONT) ||
5036 (face > EPHYSICS_BODY_SOFT_ELLIPSOID_FACE_BACK)) 5037 (face > EPHYSICS_BODY_SPHERE_FACE_BACK))
5037 { 5038 {
5038 ERR("Can't set evas object to body, face is invalid."); 5039 ERR("Can't set evas object to body, face is invalid.");
5039 return; 5040 return;
@@ -5061,17 +5062,17 @@ _ephysics_body_ellipsoid_face_evas_object_set(EPhysics_Body *body, EPhysics_Body
5061 face_obj = _ephysics_body_face_evas_object_get(body, face); 5062 face_obj = _ephysics_body_face_evas_object_get(body, face);
5062 5063
5063 if (face_obj) 5064 if (face_obj)
5064 _ephysics_body_ellipsoid_face_evas_object_clean(body, face_obj, 5065 _ephysics_body_soft_sphere_face_evas_object_clean(body, face_obj,
5065 face_slice->slices); 5066 face_slice->slices);
5066 5067
5067 evas_object_geometry_get(evas_obj, NULL, NULL, &obj_w, &obj_h); 5068 evas_object_geometry_get(evas_obj, NULL, NULL, &obj_w, &obj_h);
5068 if (!obj_w && !obj_h) evas_object_resize(evas_obj, 1, 1); 5069 if (!obj_w && !obj_h) evas_object_resize(evas_obj, 1, 1);
5069 5070
5070 _ephysics_body_face_evas_object_add(body, face, evas_obj, 5071 _ephysics_body_face_evas_object_add(body, face, evas_obj,
5071 _ephysics_body_ellipsoid_face_obj_resize_cb); 5072 _ephysics_body_soft_sphere_face_obj_resize_cb);
5072 5073
5073 evas_object_event_callback_add(evas_obj, EVAS_CALLBACK_DEL, 5074 evas_object_event_callback_add(evas_obj, EVAS_CALLBACK_DEL,
5074 _ephysics_body_ellipsoid_face_evas_object_del_cb, face_slice); 5075 _ephysics_body_soft_sphere_face_evas_object_del_cb, face_slice);
5075 5076
5076 evas_object_event_callback_add(evas_obj, EVAS_CALLBACK_RESTACK, 5077 evas_object_event_callback_add(evas_obj, EVAS_CALLBACK_RESTACK,
5077 _ephysics_body_soft_body_evas_restack_cb, 5078 _ephysics_body_soft_body_evas_restack_cb,
@@ -5091,16 +5092,17 @@ _ephysics_body_ellipsoid_face_evas_object_set(EPhysics_Body *body, EPhysics_Body
5091 ephysics_world_lock_release(body->world); 5092 ephysics_world_lock_release(body->world);
5092 evas_object_event_callback_add(evas_obj, EVAS_CALLBACK_RESIZE, 5093 evas_object_event_callback_add(evas_obj, EVAS_CALLBACK_RESIZE,
5093 _ephysics_body_evas_obj_resize_cb, body); 5094 _ephysics_body_evas_obj_resize_cb, body);
5094 DBG("Ellipsoid face evas object set."); 5095
5096 DBG("Soft sphere's face evas object set.");
5095} 5097}
5096 5098
5097static Evas_Object * 5099static Evas_Object *
5098_ephysics_body_ellipsoid_face_evas_object_get(const EPhysics_Body *body, EPhysics_Body_Face face) 5100_ephysics_body_soft_sphere_face_evas_object_get(const EPhysics_Body *body, EPhysics_Body_Face face)
5099{ 5101{
5100 EPhysics_Body_Face_Obj *face_obj = NULL; 5102 EPhysics_Body_Face_Obj *face_obj = NULL;
5101 5103
5102 if ((face < EPHYSICS_BODY_SOFT_ELLIPSOID_FACE_FRONT) || 5104 if ((face < EPHYSICS_BODY_SPHERE_FACE_FRONT) ||
5103 (face > EPHYSICS_BODY_SOFT_ELLIPSOID_FACE_BACK)) 5105 (face > EPHYSICS_BODY_SPHERE_FACE_BACK))
5104 { 5106 {
5105 ERR("Can't get evas object from body, face is invalid."); 5107 ERR("Can't get evas object from body, face is invalid.");
5106 return NULL; 5108 return NULL;
@@ -5114,14 +5116,14 @@ _ephysics_body_ellipsoid_face_evas_object_get(const EPhysics_Body *body, EPhysic
5114} 5116}
5115 5117
5116static Evas_Object * 5118static Evas_Object *
5117_ephysics_body_ellipsoid_face_evas_object_unset(EPhysics_Body *body, EPhysics_Body_Face face) 5119_ephysics_body_soft_sphere_face_evas_object_unset(EPhysics_Body *body, EPhysics_Body_Face face)
5118{ 5120{
5119 EPhysics_Body_Face_Slice *face_slice; 5121 EPhysics_Body_Face_Slice *face_slice;
5120 EPhysics_Body_Face_Obj *face_obj = NULL; 5122 EPhysics_Body_Face_Obj *face_obj = NULL;
5121 Evas_Object *obj; 5123 Evas_Object *obj;
5122 5124
5123 if ((face < EPHYSICS_BODY_SOFT_ELLIPSOID_FACE_FRONT) || 5125 if ((face < EPHYSICS_BODY_SPHERE_FACE_FRONT) ||
5124 (face > EPHYSICS_BODY_SOFT_ELLIPSOID_FACE_BACK)) 5126 (face > EPHYSICS_BODY_SPHERE_FACE_BACK))
5125 { 5127 {
5126 ERR("Can't unset evas object from body, face is invalid."); 5128 ERR("Can't unset evas object from body, face is invalid.");
5127 return NULL; 5129 return NULL;
@@ -5133,7 +5135,7 @@ _ephysics_body_ellipsoid_face_evas_object_unset(EPhysics_Body *body, EPhysics_Bo
5133 5135
5134 obj = face_obj->obj; 5136 obj = face_obj->obj;
5135 face_slice = _ephysics_body_face_slice_get(body, face); 5137 face_slice = _ephysics_body_face_slice_get(body, face);
5136 _ephysics_body_ellipsoid_face_evas_object_clean(body, face_obj, 5138 _ephysics_body_soft_sphere_face_evas_object_clean(body, face_obj,
5137 face_slice->slices); 5139 face_slice->slices);
5138 5140
5139 DBG("EPhysics Body face unset."); 5141 DBG("EPhysics Body face unset.");
@@ -5158,15 +5160,18 @@ ephysics_body_face_evas_object_set(EPhysics_Body *body, EPhysics_Body_Face face,
5158 if (body->type == EPHYSICS_BODY_TYPE_CLOTH) 5160 if (body->type == EPHYSICS_BODY_TYPE_CLOTH)
5159 return _ephysics_body_cloth_face_evas_object_set(body, face, evas_obj, 5161 return _ephysics_body_cloth_face_evas_object_set(body, face, evas_obj,
5160 use_obj_pos); 5162 use_obj_pos);
5161 if (body->shape == EPHYSICS_BODY_SHAPE_CYLINDER) 5163 if (body->type == EPHYSICS_BODY_TYPE_RIGID &&
5164 body->shape == EPHYSICS_BODY_SHAPE_CYLINDER)
5162 return _ephysics_body_cylinder_face_evas_object_set(body, face, evas_obj, 5165 return _ephysics_body_cylinder_face_evas_object_set(body, face, evas_obj,
5163 use_obj_pos); 5166 use_obj_pos);
5164 if (body->shape == EPHYSICS_BODY_SHAPE_BOX) 5167 if (body->type == EPHYSICS_BODY_TYPE_RIGID &&
5168 body->shape == EPHYSICS_BODY_SHAPE_BOX)
5165 return _ephysics_body_box_face_evas_object_set(body, face, evas_obj, 5169 return _ephysics_body_box_face_evas_object_set(body, face, evas_obj,
5166 use_obj_pos); 5170 use_obj_pos);
5167 if (body->shape == EPHYSICS_BODY_SHAPE_ELLIPSOID) 5171 if (body->type == EPHYSICS_BODY_TYPE_SOFT &&
5168 return _ephysics_body_ellipsoid_face_evas_object_set(body, face, evas_obj, 5172 body->shape == EPHYSICS_BODY_SHAPE_SPHERE)
5169 use_obj_pos); 5173 return _ephysics_body_soft_sphere_face_evas_object_set(body, face, evas_obj,
5174 use_obj_pos);
5170 5175
5171 ERR("Can't handle body %p type.", body); 5176 ERR("Can't handle body %p type.", body);
5172} 5177}
@@ -5182,12 +5187,15 @@ ephysics_body_face_evas_object_get(const EPhysics_Body *body, EPhysics_Body_Face
5182 5187
5183 if (body->type == EPHYSICS_BODY_TYPE_CLOTH) 5188 if (body->type == EPHYSICS_BODY_TYPE_CLOTH)
5184 return _ephysics_body_cloth_face_evas_object_get(body, face); 5189 return _ephysics_body_cloth_face_evas_object_get(body, face);
5185 if (body->shape == EPHYSICS_BODY_SHAPE_CYLINDER) 5190 if (body->type == EPHYSICS_BODY_TYPE_RIGID &&
5191 body->shape == EPHYSICS_BODY_SHAPE_CYLINDER)
5186 return _ephysics_body_cylinder_face_evas_object_get(body, face); 5192 return _ephysics_body_cylinder_face_evas_object_get(body, face);
5187 if (body->shape == EPHYSICS_BODY_SHAPE_BOX) 5193 if (body->type == EPHYSICS_BODY_TYPE_RIGID &&
5194 body->shape == EPHYSICS_BODY_SHAPE_BOX)
5188 return _ephysics_body_box_face_evas_object_get(body, face); 5195 return _ephysics_body_box_face_evas_object_get(body, face);
5189 if (body->shape == EPHYSICS_BODY_SHAPE_ELLIPSOID) 5196 if (body->type == EPHYSICS_BODY_TYPE_SOFT &&
5190 return _ephysics_body_ellipsoid_face_evas_object_get(body, face); 5197 body->shape == EPHYSICS_BODY_SHAPE_SPHERE)
5198 return _ephysics_body_soft_sphere_face_evas_object_get(body, face);
5191 5199
5192 ERR("Can't handle body %p type.", body); 5200 ERR("Can't handle body %p type.", body);
5193 return NULL; 5201 return NULL;
@@ -5204,12 +5212,15 @@ ephysics_body_face_evas_object_unset(EPhysics_Body *body, EPhysics_Body_Face fac
5204 5212
5205 if (body->type == EPHYSICS_BODY_TYPE_CLOTH) 5213 if (body->type == EPHYSICS_BODY_TYPE_CLOTH)
5206 return _ephysics_body_cloth_face_evas_object_unset(body, face); 5214 return _ephysics_body_cloth_face_evas_object_unset(body, face);
5207 if (body->shape == EPHYSICS_BODY_SHAPE_CYLINDER) 5215 if (body->type == EPHYSICS_BODY_TYPE_RIGID &&
5216 body->shape == EPHYSICS_BODY_SHAPE_CYLINDER)
5208 return _ephysics_body_cylinder_face_evas_object_unset(body, face); 5217 return _ephysics_body_cylinder_face_evas_object_unset(body, face);
5209 if (body->shape == EPHYSICS_BODY_SHAPE_BOX) 5218 if (body->type == EPHYSICS_BODY_TYPE_RIGID &&
5219 body->shape == EPHYSICS_BODY_SHAPE_BOX)
5210 return _ephysics_body_box_face_evas_object_unset(body, face); 5220 return _ephysics_body_box_face_evas_object_unset(body, face);
5211 if (body->shape == EPHYSICS_BODY_SHAPE_ELLIPSOID) 5221 if (body->type == EPHYSICS_BODY_TYPE_SOFT &&
5212 return _ephysics_body_ellipsoid_face_evas_object_unset(body, face); 5222 body->shape == EPHYSICS_BODY_SHAPE_SPHERE)
5223 return _ephysics_body_soft_sphere_face_evas_object_unset(body, face);
5213 5224
5214 ERR("Can't handle body %p type.", body); 5225 ERR("Can't handle body %p type.", body);
5215 return NULL; 5226 return NULL;
diff --git a/legacy/ephysics/src/lib/ephysics_private.h b/legacy/ephysics/src/lib/ephysics_private.h
index 994561a4a9..1f888ca88d 100644
--- a/legacy/ephysics/src/lib/ephysics_private.h
+++ b/legacy/ephysics/src/lib/ephysics_private.h
@@ -67,7 +67,6 @@ typedef enum _EPhysics_Body_Shape
67 EPHYSICS_BODY_SHAPE_CUSTOM, 67 EPHYSICS_BODY_SHAPE_CUSTOM,
68 EPHYSICS_BODY_SHAPE_CYLINDER, 68 EPHYSICS_BODY_SHAPE_CYLINDER,
69 EPHYSICS_BODY_SHAPE_SPHERE, 69 EPHYSICS_BODY_SHAPE_SPHERE,
70 EPHYSICS_BODY_SHAPE_ELLIPSOID,
71 EPHYSICS_BODY_SHAPE_LAST, 70 EPHYSICS_BODY_SHAPE_LAST,
72} EPhysics_Body_Shape; 71} EPhysics_Body_Shape;
73 72