From c2b0c76b74a05eadc9f0b18db02ec54d822c22e5 Mon Sep 17 00:00:00 2001 From: Bruno Dilly Date: Mon, 15 Oct 2012 21:54:29 +0000 Subject: [PATCH] ephysics: add front and back boundaries Use it on test "Bouncing 3D" SVN revision: 78015 --- legacy/ephysics/src/bin/ephysics_logo.c | 3 +- legacy/ephysics/src/bin/ephysics_sandbox.c | 6 +- legacy/ephysics/src/bin/ephysics_test.h | 1 + legacy/ephysics/src/bin/test_bouncing_3d.c | 11 +- legacy/ephysics/src/bin/test_bouncing_ball.c | 3 +- legacy/ephysics/src/bin/test_bouncing_text.c | 3 +- legacy/ephysics/src/bin/test_camera.c | 5 +- legacy/ephysics/src/bin/test_camera_track.c | 3 +- .../ephysics/src/bin/test_colliding_balls.c | 3 +- .../src/bin/test_collision_detection.c | 3 +- .../ephysics/src/bin/test_collision_filter.c | 3 +- .../ephysics/src/bin/test_collision_speed.c | 3 +- legacy/ephysics/src/bin/test_constraint.c | 3 +- legacy/ephysics/src/bin/test_delete.c | 3 +- .../ephysics/src/bin/test_falling_letters.c | 3 +- legacy/ephysics/src/bin/test_flag.c | 3 +- legacy/ephysics/src/bin/test_forces.c | 3 +- legacy/ephysics/src/bin/test_grab.c | 3 +- legacy/ephysics/src/bin/test_growing_balls.c | 3 +- legacy/ephysics/src/bin/test_heavy.c | 3 +- legacy/ephysics/src/bin/test_jumping_balls.c | 3 +- legacy/ephysics/src/bin/test_light.c | 3 +- legacy/ephysics/src/bin/test_material.c | 3 +- legacy/ephysics/src/bin/test_no_gravity.c | 3 +- legacy/ephysics/src/bin/test_rotate.c | 3 +- .../ephysics/src/bin/test_rotating_forever.c | 3 +- legacy/ephysics/src/bin/test_shapes.c | 3 +- .../src/bin/test_sleeping_threshold.c | 3 +- legacy/ephysics/src/bin/test_slider.c | 3 +- legacy/ephysics/src/bin/test_soft_body.c | 3 +- legacy/ephysics/src/bin/test_velocity.c | 3 +- legacy/ephysics/src/bin/test_win_resize.c | 7 +- legacy/ephysics/src/lib/EPhysics.h | 46 ++++++- legacy/ephysics/src/lib/ephysics_body.cpp | 113 ++++++++++++------ legacy/ephysics/src/lib/ephysics_camera.cpp | 3 +- legacy/ephysics/src/lib/ephysics_private.h | 2 + legacy/ephysics/src/lib/ephysics_world.cpp | 39 ++++-- 37 files changed, 226 insertions(+), 88 deletions(-) diff --git a/legacy/ephysics/src/bin/ephysics_logo.c b/legacy/ephysics/src/bin/ephysics_logo.c index 308b2e8ed8..423908aa8c 100644 --- a/legacy/ephysics/src/bin/ephysics_logo.c +++ b/legacy/ephysics/src/bin/ephysics_logo.c @@ -8,6 +8,7 @@ #define WIDTH (512) #define HEIGHT (384) +#define DEPTH (100) #define FLOOR_Y (HEIGHT - 80) #define SH_THRESHOLD (250) #define SH_OFFSET_X (- 16) @@ -214,7 +215,7 @@ elm_main(int argc __UNUSED__, char **argv __UNUSED__) evas_object_show(bg); world = ephysics_world_new(); - ephysics_world_render_geometry_set(world, 0, 0, WIDTH, HEIGHT); + ephysics_world_render_geometry_set(world, 0, 0, -50, WIDTH, HEIGHT, DEPTH); ground_body = ephysics_body_box_add(world); ephysics_body_mass_set(ground_body, EPHYSICS_BODY_MASS_STATIC); diff --git a/legacy/ephysics/src/bin/ephysics_sandbox.c b/legacy/ephysics/src/bin/ephysics_sandbox.c index edea23d1a1..7c97b6744b 100644 --- a/legacy/ephysics/src/bin/ephysics_sandbox.c +++ b/legacy/ephysics/src/bin/ephysics_sandbox.c @@ -11,6 +11,7 @@ #define SANDBOX_THEME "ephysics_sandbox" #define WIDTH (1280) #define HEIGHT (720) +#define DEPTH (100) typedef struct _Sandie_Data { Evas_Object *win; @@ -844,8 +845,9 @@ _sandie_world_add(Evas_Object *win) EPhysics_World *world; world = ephysics_world_new(); - ephysics_world_render_geometry_set(world, 80, 80, (int) WIDTH * 0.7 - 160, - HEIGHT - 160); + ephysics_world_render_geometry_set(world, 80, 80, -50, + (int) WIDTH * 0.7 - 160, HEIGHT - 160, + DEPTH); evas_object_data_set(win, "top", ephysics_body_top_boundary_add(world)); evas_object_data_set(win, "bottom", ephysics_body_bottom_boundary_add(world)); diff --git a/legacy/ephysics/src/bin/ephysics_test.h b/legacy/ephysics/src/bin/ephysics_test.h index b8ba28c99d..56db5957b1 100644 --- a/legacy/ephysics/src/bin/ephysics_test.h +++ b/legacy/ephysics/src/bin/ephysics_test.h @@ -41,6 +41,7 @@ #define EPHYSICS_TEST_THEME "ephysics_test" #define WIDTH (512) #define HEIGHT (384) +#define DEPTH (100) #define SHADOW_ALPHA_ID (1) #define FLOOR_Y (344) #define FLOOR_WIDTH (750) diff --git a/legacy/ephysics/src/bin/test_bouncing_3d.c b/legacy/ephysics/src/bin/test_bouncing_3d.c index 4eeb773867..19956b13ee 100644 --- a/legacy/ephysics/src/bin/test_bouncing_3d.c +++ b/legacy/ephysics/src/bin/test_bouncing_3d.c @@ -122,7 +122,8 @@ test_bouncing_3d(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event elm_object_signal_emit(test_data->layout, "controls,show", "ephysics_test"); world = ephysics_world_new(); - ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); + ephysics_world_render_geometry_set(world, 50, 40, -50, + WIDTH - 100, FLOOR_Y - 40, DEPTH); test_data->world = world; boundary = ephysics_body_bottom_boundary_add(test_data->world); @@ -137,6 +138,14 @@ test_bouncing_3d(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event ephysics_body_restitution_set(boundary, 0.4); ephysics_body_friction_set(boundary, 3); + boundary = ephysics_body_front_boundary_add(test_data->world); + ephysics_body_restitution_set(boundary, 0.4); + ephysics_body_friction_set(boundary, 3); + + boundary = ephysics_body_back_boundary_add(test_data->world); + ephysics_body_restitution_set(boundary, 0.4); + ephysics_body_friction_set(boundary, 3); + ephysics_body_top_boundary_add(test_data->world); _world_populate(test_data); diff --git a/legacy/ephysics/src/bin/test_bouncing_ball.c b/legacy/ephysics/src/bin/test_bouncing_ball.c index 7ba51b0680..7991571502 100644 --- a/legacy/ephysics/src/bin/test_bouncing_ball.c +++ b/legacy/ephysics/src/bin/test_bouncing_ball.c @@ -88,7 +88,8 @@ test_bouncing_ball(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *eve elm_object_signal_emit(test_data->layout, "arrows,show", "ephysics_test"); world = ephysics_world_new(); - ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); + ephysics_world_render_geometry_set(world, 50, 40, -50, + WIDTH - 100, FLOOR_Y - 40, DEPTH); test_data->world = world; boundary = ephysics_body_bottom_boundary_add(test_data->world); diff --git a/legacy/ephysics/src/bin/test_bouncing_text.c b/legacy/ephysics/src/bin/test_bouncing_text.c index 6170c8834d..c2d7d09c3e 100644 --- a/legacy/ephysics/src/bin/test_bouncing_text.c +++ b/legacy/ephysics/src/bin/test_bouncing_text.c @@ -55,7 +55,8 @@ test_bouncing_text(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *eve _restart, test_data); world = ephysics_world_new(); - ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); + ephysics_world_render_geometry_set(world, 50, 40, -50, + WIDTH - 100, FLOOR_Y - 40, 100); test_data->world = world; boundary = ephysics_body_bottom_boundary_add(test_data->world); diff --git a/legacy/ephysics/src/bin/test_camera.c b/legacy/ephysics/src/bin/test_camera.c index 2c9adb6187..92fc181c50 100644 --- a/legacy/ephysics/src/bin/test_camera.c +++ b/legacy/ephysics/src/bin/test_camera.c @@ -53,7 +53,7 @@ _camera_move_cb(void *data) int x, y, w; ephysics_world_render_geometry_get(camera_data->base.world, - NULL, NULL, &w, NULL); + NULL, NULL, NULL, &w, NULL, NULL); camera = ephysics_world_camera_get(camera_data->base.world); ephysics_camera_position_get(camera, &x, &y); @@ -219,7 +219,8 @@ test_camera(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info evas_object_data_set(camera_data->base.layout, "floor2", floor_obj); world = ephysics_world_new(); - ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); + ephysics_world_render_geometry_set(world, 50, 40, -50, + WIDTH - 100, FLOOR_Y - 40, DEPTH); ephysics_world_event_callback_add(world, EPHYSICS_CALLBACK_WORLD_CAMERA_MOVED, _camera_moved_cb, camera_data); diff --git a/legacy/ephysics/src/bin/test_camera_track.c b/legacy/ephysics/src/bin/test_camera_track.c index 631bf72fdc..5bc5b534b7 100644 --- a/legacy/ephysics/src/bin/test_camera_track.c +++ b/legacy/ephysics/src/bin/test_camera_track.c @@ -230,7 +230,8 @@ test_camera_track(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *even evas_object_data_set(track_data->base.layout, "floor2", floor_obj); world = ephysics_world_new(); - ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); + ephysics_world_render_geometry_set(world, 50, 40, -50, + WIDTH - 100, FLOOR_Y - 40, DEPTH); track_data->base.world = world; ephysics_world_event_callback_add(world, EPHYSICS_CALLBACK_WORLD_CAMERA_MOVED, diff --git a/legacy/ephysics/src/bin/test_colliding_balls.c b/legacy/ephysics/src/bin/test_colliding_balls.c index 44b4723b74..4d00ad07a5 100644 --- a/legacy/ephysics/src/bin/test_colliding_balls.c +++ b/legacy/ephysics/src/bin/test_colliding_balls.c @@ -74,7 +74,8 @@ test_colliding_balls(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *e _restart, test_data); world = ephysics_world_new(); - ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); + ephysics_world_render_geometry_set(world, 50, 40, -50, + WIDTH - 100, FLOOR_Y - 40, DEPTH); test_data->world = world; boundary = ephysics_body_bottom_boundary_add(test_data->world); diff --git a/legacy/ephysics/src/bin/test_collision_detection.c b/legacy/ephysics/src/bin/test_collision_detection.c index b5a4359640..6978d3dafd 100644 --- a/legacy/ephysics/src/bin/test_collision_detection.c +++ b/legacy/ephysics/src/bin/test_collision_detection.c @@ -165,7 +165,8 @@ test_collision(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_i "test-theme", _restart, collision_data); world = ephysics_world_new(); - ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); + ephysics_world_render_geometry_set(world, 50, 40, -50, + WIDTH - 100, FLOOR_Y - 40, DEPTH); collision_data->base.world = world; boundary = ephysics_body_bottom_boundary_add(collision_data->base.world); diff --git a/legacy/ephysics/src/bin/test_collision_filter.c b/legacy/ephysics/src/bin/test_collision_filter.c index 4759b6103f..5b92135c87 100644 --- a/legacy/ephysics/src/bin/test_collision_filter.c +++ b/legacy/ephysics/src/bin/test_collision_filter.c @@ -67,7 +67,8 @@ test_collision_filter(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void * _restart, test_data); world = ephysics_world_new(); - ephysics_world_render_geometry_set(world, 60, 40, WIDTH - 120, FLOOR_Y - 32); + ephysics_world_render_geometry_set(world, 60, 40, -50, + WIDTH - 120, FLOOR_Y - 32, DEPTH); test_data->world = world; boundary = ephysics_body_bottom_boundary_add(test_data->world); diff --git a/legacy/ephysics/src/bin/test_collision_speed.c b/legacy/ephysics/src/bin/test_collision_speed.c index 6c4ce25a4b..39e4180fa0 100644 --- a/legacy/ephysics/src/bin/test_collision_speed.c +++ b/legacy/ephysics/src/bin/test_collision_speed.c @@ -126,7 +126,8 @@ test_collision_speed(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *e speed_data->sp = sp; world = ephysics_world_new(); - ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); + ephysics_world_render_geometry_set(world, 50, 40, -50, + WIDTH - 100, FLOOR_Y - 40, DEPTH); ephysics_world_simulation_set(world, 1/260.f, 5); speed_data->base.world = world; diff --git a/legacy/ephysics/src/bin/test_constraint.c b/legacy/ephysics/src/bin/test_constraint.c index 946d4943ac..617b19e1f3 100644 --- a/legacy/ephysics/src/bin/test_constraint.c +++ b/legacy/ephysics/src/bin/test_constraint.c @@ -93,7 +93,8 @@ test_constraint(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_ _restart, test_data); world = ephysics_world_new(); - ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); + ephysics_world_render_geometry_set(world, 50, 40, -50, + WIDTH - 100, FLOOR_Y - 40, DEPTH); test_data->world = world; boundary = ephysics_body_bottom_boundary_add(test_data->world); diff --git a/legacy/ephysics/src/bin/test_delete.c b/legacy/ephysics/src/bin/test_delete.c index 781910bb32..958f5aaf59 100644 --- a/legacy/ephysics/src/bin/test_delete.c +++ b/legacy/ephysics/src/bin/test_delete.c @@ -173,7 +173,8 @@ test_delete(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info "test-theme", _restart, collision_data); world = ephysics_world_new(); - ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); + ephysics_world_render_geometry_set(world, 50, 40, -50, + WIDTH - 100, FLOOR_Y - 40, DEPTH); collision_data->base.world = world; boundary = ephysics_body_bottom_boundary_add(collision_data->base.world); diff --git a/legacy/ephysics/src/bin/test_falling_letters.c b/legacy/ephysics/src/bin/test_falling_letters.c index 3fb8c3da89..29fd28f5b1 100644 --- a/legacy/ephysics/src/bin/test_falling_letters.c +++ b/legacy/ephysics/src/bin/test_falling_letters.c @@ -64,7 +64,8 @@ test_falling_letters(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *e _restart, test_data); world = ephysics_world_new(); - ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); + ephysics_world_render_geometry_set(world, 50, 40, -50, + WIDTH - 100, FLOOR_Y - 40, DEPTH); test_data->world = world; boundary = ephysics_body_bottom_boundary_add(test_data->world); diff --git a/legacy/ephysics/src/bin/test_flag.c b/legacy/ephysics/src/bin/test_flag.c index 85fd728086..afa1406ace 100644 --- a/legacy/ephysics/src/bin/test_flag.c +++ b/legacy/ephysics/src/bin/test_flag.c @@ -74,7 +74,8 @@ test_flag(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info _ world = ephysics_world_new(); ephysics_world_simulation_set(world, 1/160.f, 10); - ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); + ephysics_world_render_geometry_set(world, 50, 40, -50, + WIDTH - 100, FLOOR_Y - 40, DEPTH); test_data->world = world; boundary = ephysics_body_bottom_boundary_add(test_data->world); diff --git a/legacy/ephysics/src/bin/test_forces.c b/legacy/ephysics/src/bin/test_forces.c index d5628c1a82..639c3d7494 100644 --- a/legacy/ephysics/src/bin/test_forces.c +++ b/legacy/ephysics/src/bin/test_forces.c @@ -88,7 +88,8 @@ test_forces(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info _restart, test_data); world = ephysics_world_new(); - ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); + ephysics_world_render_geometry_set(world, 50, 40, -50, + WIDTH - 100, FLOOR_Y - 40, DEPTH); test_data->world = world; boundary = ephysics_body_bottom_boundary_add(test_data->world); diff --git a/legacy/ephysics/src/bin/test_grab.c b/legacy/ephysics/src/bin/test_grab.c index 8da3da3cd1..82ebd0df35 100644 --- a/legacy/ephysics/src/bin/test_grab.c +++ b/legacy/ephysics/src/bin/test_grab.c @@ -153,7 +153,8 @@ test_grab(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info _ elm_object_signal_emit(test_data->layout, "grab,show", "ephysics_test"); world = ephysics_world_new(); - ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); + ephysics_world_render_geometry_set(world, 50, 40, -50, + WIDTH - 100, FLOOR_Y - 40, DEPTH); test_data->world = world; boundary = ephysics_body_bottom_boundary_add(test_data->world); diff --git a/legacy/ephysics/src/bin/test_growing_balls.c b/legacy/ephysics/src/bin/test_growing_balls.c index cc246ad605..0f252e6f89 100644 --- a/legacy/ephysics/src/bin/test_growing_balls.c +++ b/legacy/ephysics/src/bin/test_growing_balls.c @@ -104,7 +104,8 @@ test_growing_balls(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *eve _restart, test_data); world = ephysics_world_new(); - ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); + ephysics_world_render_geometry_set(world, 50, 40, -50, + WIDTH - 100, FLOOR_Y - 40, DEPTH); test_data->world = world; boundary = ephysics_body_bottom_boundary_add(test_data->world); diff --git a/legacy/ephysics/src/bin/test_heavy.c b/legacy/ephysics/src/bin/test_heavy.c index ad90b9fd1f..d0f530271f 100644 --- a/legacy/ephysics/src/bin/test_heavy.c +++ b/legacy/ephysics/src/bin/test_heavy.c @@ -59,7 +59,8 @@ test_heavy(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info "ephysics_test"); world = ephysics_world_new(); - ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); + ephysics_world_render_geometry_set(world, 50, 40, -50, + WIDTH - 100, FLOOR_Y - 40, DEPTH); test_data->world = world; boundary = ephysics_body_bottom_boundary_add(test_data->world); diff --git a/legacy/ephysics/src/bin/test_jumping_balls.c b/legacy/ephysics/src/bin/test_jumping_balls.c index 0bd15f7495..f250a63936 100644 --- a/legacy/ephysics/src/bin/test_jumping_balls.c +++ b/legacy/ephysics/src/bin/test_jumping_balls.c @@ -118,7 +118,8 @@ test_jumping_balls(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *eve _restart, test_data); world = ephysics_world_new(); - ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); + ephysics_world_render_geometry_set(world, 50, 40, -50, + WIDTH - 100, FLOOR_Y - 40, DEPTH); test_data->world = world; bt = elm_button_add(test_data->win); diff --git a/legacy/ephysics/src/bin/test_light.c b/legacy/ephysics/src/bin/test_light.c index 655adbd0e3..c0733d2393 100644 --- a/legacy/ephysics/src/bin/test_light.c +++ b/legacy/ephysics/src/bin/test_light.c @@ -67,7 +67,8 @@ test_light(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info elm_object_signal_emit(test_data->layout, "borders,show", "ephysics_test"); world = ephysics_world_new(); - ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); + ephysics_world_render_geometry_set(world, 50, 40, -50, + WIDTH - 100, FLOOR_Y - 40, DEPTH); test_data->world = world; boundary = ephysics_body_bottom_boundary_add(test_data->world); diff --git a/legacy/ephysics/src/bin/test_material.c b/legacy/ephysics/src/bin/test_material.c index 7b2c3fc295..aa043a074c 100644 --- a/legacy/ephysics/src/bin/test_material.c +++ b/legacy/ephysics/src/bin/test_material.c @@ -111,7 +111,8 @@ test_material(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in test_data->data = sp; world = ephysics_world_new(); - ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); + ephysics_world_render_geometry_set(world, 50, 40, -50, + WIDTH - 100, FLOOR_Y - 40, DEPTH); test_data->world = world; boundary = ephysics_body_bottom_boundary_add(test_data->world); diff --git a/legacy/ephysics/src/bin/test_no_gravity.c b/legacy/ephysics/src/bin/test_no_gravity.c index b659ea0963..0052bd2082 100644 --- a/legacy/ephysics/src/bin/test_no_gravity.c +++ b/legacy/ephysics/src/bin/test_no_gravity.c @@ -108,7 +108,8 @@ test_no_gravity(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_ evas_object_smart_callback_add(bt, "clicked", _stop, test_data); world = ephysics_world_new(); - ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); + ephysics_world_render_geometry_set(world, 50, 40, -50, + WIDTH - 100, FLOOR_Y - 40, DEPTH); test_data->world = world; boundary = ephysics_body_bottom_boundary_add(test_data->world); diff --git a/legacy/ephysics/src/bin/test_rotate.c b/legacy/ephysics/src/bin/test_rotate.c index 53f6436ab9..a09a0ee54d 100644 --- a/legacy/ephysics/src/bin/test_rotate.c +++ b/legacy/ephysics/src/bin/test_rotate.c @@ -87,7 +87,8 @@ test_rotate(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info _restart, test_data); world = ephysics_world_new(); - ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); + ephysics_world_render_geometry_set(world, 50, 40, -50, + WIDTH - 100, FLOOR_Y - 40, DEPTH); test_data->world = world; boundary = ephysics_body_bottom_boundary_add(test_data->world); diff --git a/legacy/ephysics/src/bin/test_rotating_forever.c b/legacy/ephysics/src/bin/test_rotating_forever.c index 7741036201..474c8e957d 100644 --- a/legacy/ephysics/src/bin/test_rotating_forever.c +++ b/legacy/ephysics/src/bin/test_rotating_forever.c @@ -191,7 +191,8 @@ test_rotating_forever(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void * _restart, test_data); world = ephysics_world_new(); - ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); + ephysics_world_render_geometry_set(world, 50, 40, -50, + WIDTH - 100, FLOOR_Y - 40, DEPTH); test_data->world = world; ephysics_world_gravity_set(world, 0, 0, 0); diff --git a/legacy/ephysics/src/bin/test_shapes.c b/legacy/ephysics/src/bin/test_shapes.c index 5af0fa549c..8b01222211 100644 --- a/legacy/ephysics/src/bin/test_shapes.c +++ b/legacy/ephysics/src/bin/test_shapes.c @@ -95,7 +95,8 @@ test_shapes(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info _restart, test_data); world = ephysics_world_new(); - ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); + ephysics_world_render_geometry_set(world, 50, 40, -50, + WIDTH - 100, FLOOR_Y - 40, DEPTH); test_data->world = world; boundary = ephysics_body_bottom_boundary_add(test_data->world); diff --git a/legacy/ephysics/src/bin/test_sleeping_threshold.c b/legacy/ephysics/src/bin/test_sleeping_threshold.c index c78d642cee..195f291907 100644 --- a/legacy/ephysics/src/bin/test_sleeping_threshold.c +++ b/legacy/ephysics/src/bin/test_sleeping_threshold.c @@ -100,7 +100,8 @@ test_sleeping(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in "test-theme", _restart, test_data); world = ephysics_world_new(); - ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); + ephysics_world_render_geometry_set(world, 50, 40, -50, + WIDTH - 100, FLOOR_Y - 40, DEPTH); test_data->world = world; ephysics_world_max_sleeping_time_set(world, 0.3); diff --git a/legacy/ephysics/src/bin/test_slider.c b/legacy/ephysics/src/bin/test_slider.c index 3dea4a0bf0..6bb840e6a5 100644 --- a/legacy/ephysics/src/bin/test_slider.c +++ b/legacy/ephysics/src/bin/test_slider.c @@ -157,7 +157,8 @@ test_slider(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info _restart, test_data); world = ephysics_world_new(); - ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); + ephysics_world_render_geometry_set(world, 50, 40, -50, + WIDTH - 100, FLOOR_Y - 40, DEPTH); test_data->world = world; boundary = ephysics_body_bottom_boundary_add(test_data->world); diff --git a/legacy/ephysics/src/bin/test_soft_body.c b/legacy/ephysics/src/bin/test_soft_body.c index 83798255bf..0519554264 100644 --- a/legacy/ephysics/src/bin/test_soft_body.c +++ b/legacy/ephysics/src/bin/test_soft_body.c @@ -143,7 +143,8 @@ test_soft_body(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_i world = ephysics_world_new(); ephysics_world_simulation_set(world, 1/150.f, 5); - ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); + ephysics_world_render_geometry_set(world, 50, 40, -50, + WIDTH - 100, FLOOR_Y - 40, DEPTH); test_data->world = world; boundary = ephysics_body_bottom_boundary_add(test_data->world); diff --git a/legacy/ephysics/src/bin/test_velocity.c b/legacy/ephysics/src/bin/test_velocity.c index e2149d7834..4cfa1c2e75 100644 --- a/legacy/ephysics/src/bin/test_velocity.c +++ b/legacy/ephysics/src/bin/test_velocity.c @@ -181,7 +181,8 @@ test_velocity(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in "ephysics_test"); world = ephysics_world_new(); - ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); + ephysics_world_render_geometry_set(world, 50, 40, -50, + WIDTH - 100, FLOOR_Y - 40, DEPTH); velocity_data->base.world = world; boundary = ephysics_body_bottom_boundary_add(velocity_data->base.world); diff --git a/legacy/ephysics/src/bin/test_win_resize.c b/legacy/ephysics/src/bin/test_win_resize.c index a1462f4558..6c4b0c4779 100644 --- a/legacy/ephysics/src/bin/test_win_resize.c +++ b/legacy/ephysics/src/bin/test_win_resize.c @@ -51,8 +51,10 @@ _win_resize_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_inf evas_object_resize(test_data->layout, ww, wh); ephysics_world_rate_set(test_data->world, 30 * rateh); ephysics_world_render_geometry_set(test_data->world, 50 * ratew, 40 *rateh, + -50, (WIDTH - 100) * ratew, - (FLOOR_Y - 40) * rateh); + (FLOOR_Y - 40) * rateh, + DEPTH); old_rate = test_data->data; if (!old_rate) return; @@ -179,7 +181,8 @@ test_win_resize(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_ _win_del, test_data->data); world = ephysics_world_new(); - ephysics_world_render_geometry_set(world, 50, 40, WIDTH - 100, FLOOR_Y - 40); + ephysics_world_render_geometry_set(world, 50, 40, -50, + WIDTH - 100, FLOOR_Y - 40, DEPTH); test_data->world = world; boundary = ephysics_body_bottom_boundary_add(test_data->world); diff --git a/legacy/ephysics/src/lib/EPhysics.h b/legacy/ephysics/src/lib/EPhysics.h index efc7fe2925..6884b5fe85 100644 --- a/legacy/ephysics/src/lib/EPhysics.h +++ b/legacy/ephysics/src/lib/EPhysics.h @@ -559,13 +559,17 @@ EAPI EPhysics_World *ephysics_world_new(void); * @li @ref ephysics_body_top_boundary_add(), * @li @ref ephysics_body_bottom_boundary_add(), * @li @ref ephysics_body_left_boundary_add(), - * @li @ref ephysics_body_right_boundary_add(). + * @li @ref ephysics_body_right_boundary_add(), + * @li @ref ephysics_body_front_boundary_add(), + * @li @ref ephysics_body_back_boundary_add(). * * @param world the world to be configured. * @param x Coordinate x of the top left point of rendered area, in pixels. * @param y Coordinate y of the top left point of rendered area, in pixels. + * @param z Coordinate z of the rendered area, in pixels. * @param w rendered area width, in pixels. * @param h rendered area height, in pixels. + * @param d rendered area depth, in pixels. * * @note The unit used for geometry is Evas coordinates. * @@ -575,7 +579,7 @@ EAPI EPhysics_World *ephysics_world_new(void); * * @ingroup EPhysics_World */ -EAPI void ephysics_world_render_geometry_set(EPhysics_World *world, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h); +EAPI void ephysics_world_render_geometry_set(EPhysics_World *world, Evas_Coord x, Evas_Coord y, Evas_Coord z, Evas_Coord w, Evas_Coord h, Evas_Coord d); /** * @brief @@ -584,14 +588,16 @@ EAPI void ephysics_world_render_geometry_set(EPhysics_World *world, Evas_Coord x * @param world the world to be configured. * @param x Coordinate x of the top left point of rendered area, in pixels. * @param y Coordinate y of the top left point of rendered area, in pixels. + * @param z Coordinate z of the rendered area, in pixels. * @param w rendered area width, in pixels. * @param h rendered area height, in pixels. + * @param d rendered area depth, in pixels. * * @see ephysics_world_render_geometry_set() for more information. * * @ingroup EPhysics_World */ -EAPI void ephysics_world_render_geometry_get(const EPhysics_World *world, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); +EAPI void ephysics_world_render_geometry_get(const EPhysics_World *world, Evas_Coord *x, Evas_Coord *y, Evas_Coord *z, Evas_Coord *w, Evas_Coord *h, Evas_Coord *d); /** * @brief @@ -1963,6 +1969,40 @@ EAPI EPhysics_Body *ephysics_body_left_boundary_add(EPhysics_World *world); */ EAPI EPhysics_Body *ephysics_body_right_boundary_add(EPhysics_World *world); +/** + * @brief + * Create a physic front boundary. + * + * A physic front boundary will limit the bodies area and placed on the + * front of worlds render geometry - defined with + * @ref ephysics_world_render_geometry_set(). + * It is placed on x-y plane, from x to x + width, from y to y + height. + * + * @param world The world this body will belong to. + * @return a new body or @c NULL, on erros. + * @see ephysics_world_render_geometry_set() + * + * @ingroup EPhysics_Body + */ +EAPI EPhysics_Body *ephysics_body_front_boundary_add(EPhysics_World *world); + +/** + * @brief + * Create a physic back boundary. + * + * A physic front boundary will limit the bodies area and placed on the + * back of worlds render geometry - defined with + * @ref ephysics_world_render_geometry_set(). + * It is placed on x-y plane, from x to x + width, from y to y + height. + * + * @param world The world this body will belong to. + * @return a new body or @c NULL, on erros. + * @see ephysics_world_render_geometry_set() + * + * @ingroup EPhysics_Body + */ +EAPI EPhysics_Body *ephysics_body_back_boundary_add(EPhysics_World *world); + /** * @brief * Delete a physics body. diff --git a/legacy/ephysics/src/lib/ephysics_body.cpp b/legacy/ephysics/src/lib/ephysics_body.cpp index 90f81fa096..983704f506 100644 --- a/legacy/ephysics/src/lib/ephysics_body.cpp +++ b/legacy/ephysics/src/lib/ephysics_body.cpp @@ -99,7 +99,8 @@ _ephysics_body_soft_body_slices_apply(Evas_Object *obj) EPHYSICS_BODY_SOFT_BODY_SMART_DATA_GET(obj, smart_data); body = smart_data->body; rate = ephysics_world_rate_get(body->world); - ephysics_world_render_geometry_get(body->world, NULL, &wy, NULL, &wh); + ephysics_world_render_geometry_get(body->world, NULL, &wy, NULL, + NULL, &wh, NULL); EINA_LIST_FOREACH(smart_data->slices, l, data) { slice = (EPhysics_Body_Soft_Body_Slice *)data; @@ -189,7 +190,8 @@ _ephysics_body_soft_body_slices_init(EPhysics_Body *body, Evas_Object *obj) evas = evas_object_evas_get(body->evas_obj); EPHYSICS_BODY_SOFT_BODY_SMART_DATA_GET(obj, smart_data); - ephysics_world_render_geometry_get(body->world, NULL, &wy, NULL, &wh); + ephysics_world_render_geometry_get(body->world, NULL, &wy, NULL, NULL, + &wh, NULL); rate = ephysics_world_rate_get(body->world); for (int i = 0; i < body->slices; i++) @@ -874,7 +876,8 @@ _ephysics_body_move(EPhysics_Body *body, Evas_Coord x, Evas_Coord y, Evas_Coord btVector3 body_scale; rate = ephysics_world_rate_get(body->world); - ephysics_world_render_geometry_get(body->world, NULL, &wy, NULL, &height); + ephysics_world_render_geometry_get(body->world, NULL, &wy, NULL, + NULL, &height, NULL); height += wy; mx = (x + body->w * body->cm.x) / rate; @@ -899,7 +902,8 @@ _ephysics_body_geometry_set(EPhysics_Body *body, Evas_Coord x, Evas_Coord y, Eva int wy, height; btVector3 body_scale; - ephysics_world_render_geometry_get(body->world, NULL, &wy, NULL, &height); + ephysics_world_render_geometry_get(body->world, NULL, &wy, NULL, + NULL, &height, NULL); height += wy; mx = (x + w * body->cm.x) / rate; @@ -1015,7 +1019,8 @@ _ephysics_body_evas_object_default_update(EPhysics_Body *body) return; trans = _ephysics_body_transform_get(body); - ephysics_world_render_geometry_get(body->world, &wx, &wy, NULL, &wh); + ephysics_world_render_geometry_get(body->world, &wx, &wy, NULL, + NULL, &wh, NULL); camera = ephysics_world_camera_get(body->world); ephysics_camera_position_get(camera, &cx, &cy); cx -= wx; @@ -1068,7 +1073,8 @@ _ephysics_body_outside_render_area_check(EPhysics_Body *body) { int wx, wy, ww, wh, bx, by, bw, bh; - ephysics_world_render_geometry_get(body->world, &wx, &wy, &ww, &wh); + ephysics_world_render_geometry_get(body->world, &wx, &wy, NULL, + &ww, &wh, NULL); ephysics_body_geometry_get(body, &bx, &by, NULL, &bw, &bh, NULL); // FIXME: check what should be done regarding rotated bodies @@ -1186,7 +1192,7 @@ ephysics_body_contact_processed(EPhysics_Body *body, EPhysics_Body *contact_body } world = contact_body->world; - ephysics_world_render_geometry_get(world, NULL, &wy, NULL, &wh); + ephysics_world_render_geometry_get(world, NULL, &wy, NULL, NULL, &wh, NULL); rate = ephysics_world_rate_get(world); collision->contact_body = contact_body; @@ -1761,30 +1767,38 @@ ephysics_body_shape_add(EPhysics_World *world, EPhysics_Shape *shape) void ephysics_body_world_boundaries_resize(EPhysics_World *world) { - Evas_Coord x, y, width, height; - EPhysics_Body *bottom, *top, *left, *right; + Evas_Coord x, y, z, w, h, d; + EPhysics_Body *bound; - ephysics_world_render_geometry_get(world, &x, &y, &width, &height); + ephysics_world_render_geometry_get(world, &x, &y, &z, &w, &h, &d); - bottom = ephysics_world_boundary_get(world, EPHYSICS_WORLD_BOUNDARY_BOTTOM); - if (bottom) - ephysics_body_geometry_set(bottom, x, y + height, -5, width, 10, 10); + bound = ephysics_world_boundary_get(world, EPHYSICS_WORLD_BOUNDARY_BOTTOM); + if (bound) + ephysics_body_geometry_set(bound, x, y + h, z, w, 10, d); - right = ephysics_world_boundary_get(world, EPHYSICS_WORLD_BOUNDARY_RIGHT); - if (right) - ephysics_body_geometry_set(right, x + width, y, -5, 10, height, 10); + bound = ephysics_world_boundary_get(world, EPHYSICS_WORLD_BOUNDARY_RIGHT); + if (bound) + ephysics_body_geometry_set(bound, x + w, y, z, 10, h, d); - left = ephysics_world_boundary_get(world, EPHYSICS_WORLD_BOUNDARY_LEFT); - if (left) - ephysics_body_geometry_set(left, x - 10, y, -5, 10, height, 10); + bound = ephysics_world_boundary_get(world, EPHYSICS_WORLD_BOUNDARY_LEFT); + if (bound) + ephysics_body_geometry_set(bound, x - 10, y, z, 10, h, d); - top = ephysics_world_boundary_get(world, EPHYSICS_WORLD_BOUNDARY_TOP); - if (top) - ephysics_body_geometry_set(top, x, y - 10, -5, width, 10, 10); + bound = ephysics_world_boundary_get(world, EPHYSICS_WORLD_BOUNDARY_TOP); + if (bound) + ephysics_body_geometry_set(bound, x, y - 10, z, w, 10, d); + + bound = ephysics_world_boundary_get(world, EPHYSICS_WORLD_BOUNDARY_FRONT); + if (bound) + ephysics_body_geometry_set(bound, x, y, z - 10, w, h, 10); + + bound = ephysics_world_boundary_get(world, EPHYSICS_WORLD_BOUNDARY_BACK); + if (bound) + ephysics_body_geometry_set(bound, x, y, z + d, w, h, 10); } static EPhysics_Body * -_ephysics_body_boundary_add(EPhysics_World *world, EPhysics_World_Boundary boundary, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) +_ephysics_body_boundary_add(EPhysics_World *world, EPhysics_World_Boundary boundary, Evas_Coord x, Evas_Coord y, Evas_Coord z, Evas_Coord w, Evas_Coord h, Evas_Coord d) { EPhysics_Body *body; @@ -1804,7 +1818,7 @@ _ephysics_body_boundary_add(EPhysics_World *world, EPhysics_World_Boundary bound ephysics_body_mass_set(body, 0); ephysics_world_boundary_set(world, boundary, body); - ephysics_body_geometry_set(body, x, y, -5, w, h, 10); + ephysics_body_geometry_set(body, x, y, z, w, h, d); return body; } @@ -1812,48 +1826,72 @@ _ephysics_body_boundary_add(EPhysics_World *world, EPhysics_World_Boundary bound EAPI EPhysics_Body * ephysics_body_top_boundary_add(EPhysics_World *world) { + Evas_Coord x, y, z, w, d; EPhysics_Body *body; - Evas_Coord x, y, w; - ephysics_world_render_geometry_get(world, &x, &y, &w, NULL); + ephysics_world_render_geometry_get(world, &x, &y, &z, &w, NULL, &d); body = _ephysics_body_boundary_add(world, EPHYSICS_WORLD_BOUNDARY_TOP, - x, y - 10, w, 10); + x, y - 10, z, w, 10, d); return body; } EAPI EPhysics_Body * ephysics_body_bottom_boundary_add(EPhysics_World *world) { - Evas_Coord x, y, w, h; + Evas_Coord x, y, z, w, h, d; EPhysics_Body *body; - ephysics_world_render_geometry_get(world, &x, &y, &w, &h); + ephysics_world_render_geometry_get(world, &x, &y, &z, &w, &h, &d); body = _ephysics_body_boundary_add(world, EPHYSICS_WORLD_BOUNDARY_BOTTOM, - x, y + h, w, 10); + x, y + h, z, w, 10, d); return body; } EAPI EPhysics_Body * ephysics_body_left_boundary_add(EPhysics_World *world) { + Evas_Coord x, y, z, h, d; EPhysics_Body *body; - Evas_Coord x, y, h; - ephysics_world_render_geometry_get(world, &x, &y, NULL, &h); + ephysics_world_render_geometry_get(world, &x, &y, &z, NULL, &h, &d); body = _ephysics_body_boundary_add(world, EPHYSICS_WORLD_BOUNDARY_LEFT, - x - 10, y, 10, h); + x - 10, y, z, 10, h, d); return body; } EAPI EPhysics_Body * ephysics_body_right_boundary_add(EPhysics_World *world) { - Evas_Coord x, y, w, h; + Evas_Coord x, y, z, w, h, d; EPhysics_Body *body; - ephysics_world_render_geometry_get(world, &x, &y, &w, &h); + ephysics_world_render_geometry_get(world, &x, &y, &z, &w, &h, &d); body = _ephysics_body_boundary_add(world, EPHYSICS_WORLD_BOUNDARY_RIGHT, - x + w, y, 10, h); + x + w, y, z, 10, h, d); + return body; +} + +EAPI EPhysics_Body * +ephysics_body_front_boundary_add(EPhysics_World *world) +{ + Evas_Coord x, y, z, w, h; + EPhysics_Body *body; + + ephysics_world_render_geometry_get(world, &x, &y, &z, &w, &h, NULL); + body = _ephysics_body_boundary_add(world, EPHYSICS_WORLD_BOUNDARY_FRONT, + x, y, z - 10, w, h, 10); + return body; +} + +EAPI EPhysics_Body * +ephysics_body_back_boundary_add(EPhysics_World *world) +{ + Evas_Coord x, y, z, w, h, d; + EPhysics_Body *body; + + ephysics_world_render_geometry_get(world, &x, &y, &z, &w, &h, &d); + body = _ephysics_body_boundary_add(world, EPHYSICS_WORLD_BOUNDARY_BACK, + x, y, z + d, w, h, 10); return body; } @@ -2059,7 +2097,8 @@ ephysics_body_geometry_get(const EPhysics_Body *body, Evas_Coord *x, Evas_Coord scale = _ephysics_body_scale_get(body); rate = ephysics_world_rate_get(body->world); - ephysics_world_render_geometry_get(body->world, NULL, &wy, NULL, &height); + ephysics_world_render_geometry_get(body->world, NULL, &wy, NULL, + NULL, &height, NULL); height += wy; if (x) *x = round((trans.getOrigin().getX() - scale.x() / 2) * rate); diff --git a/legacy/ephysics/src/lib/ephysics_camera.cpp b/legacy/ephysics/src/lib/ephysics_camera.cpp index 5d24cfe225..9d48c264fb 100644 --- a/legacy/ephysics/src/lib/ephysics_camera.cpp +++ b/legacy/ephysics/src/lib/ephysics_camera.cpp @@ -37,7 +37,8 @@ ephysics_camera_target_moved(EPhysics_Camera *camera, EPhysics_Body *body) int x, y, w, h, ww, wh, new_x, new_y; ephysics_body_geometry_get(body, &x, &y, NULL, &w, &h, NULL); - ephysics_world_render_geometry_get(camera->world, NULL, NULL, &ww, &wh); + ephysics_world_render_geometry_get(camera->world, NULL, NULL, NULL, + &ww, &wh, NULL); if (camera->track_horizontal) { diff --git a/legacy/ephysics/src/lib/ephysics_private.h b/legacy/ephysics/src/lib/ephysics_private.h index b9f8b7d22a..48e1ce20fc 100644 --- a/legacy/ephysics/src/lib/ephysics_private.h +++ b/legacy/ephysics/src/lib/ephysics_private.h @@ -56,6 +56,8 @@ typedef enum _EPhysics_World_Boundary EPHYSICS_WORLD_BOUNDARY_BOTTOM, EPHYSICS_WORLD_BOUNDARY_LEFT, EPHYSICS_WORLD_BOUNDARY_RIGHT, + EPHYSICS_WORLD_BOUNDARY_FRONT, + EPHYSICS_WORLD_BOUNDARY_BACK, EPHYSICS_WORLD_BOUNDARY_LAST } EPhysics_World_Boundary; diff --git a/legacy/ephysics/src/lib/ephysics_world.cpp b/legacy/ephysics/src/lib/ephysics_world.cpp index 462e0c33b2..d4981458b2 100644 --- a/legacy/ephysics/src/lib/ephysics_world.cpp +++ b/legacy/ephysics/src/lib/ephysics_world.cpp @@ -49,6 +49,16 @@ struct _EPhysics_Light { struct _EPhysics_World { EINA_INLIST; + + struct { + Evas_Coord x; + Evas_Coord y; + Evas_Coord z; + Evas_Coord w; + Evas_Coord h; + Evas_Coord d; + } geometry; + btBroadphaseInterface *broadphase; btDefaultCollisionConfiguration *collision; btCollisionDispatcher *dispatcher; @@ -58,10 +68,9 @@ struct _EPhysics_World { btSoftBodySolver *soft_solver; btOverlapFilterCallback *filter_cb; - EPhysics_Body *boundaries[4]; + EPhysics_Body *boundaries[6]; EPhysics_Camera *camera; EPhysics_Light *light; - Evas_Coord x, y, w, h; Eina_Inlist *callbacks; Eina_Inlist *bodies; Eina_List *to_delete; @@ -1196,7 +1205,7 @@ ephysics_world_bodies_get(const EPhysics_World *world) } EAPI void -ephysics_world_render_geometry_set(EPhysics_World *world, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) +ephysics_world_render_geometry_set(EPhysics_World *world, Evas_Coord x, Evas_Coord y, Evas_Coord z, Evas_Coord w, Evas_Coord h, Evas_Coord d) { if (!world) { @@ -1204,23 +1213,25 @@ ephysics_world_render_geometry_set(EPhysics_World *world, Evas_Coord x, Evas_Coo return; } - if ((w <= 0) || (h <= 0)) + if ((w <= 0) || (h <= 0) || (d <= 0)) { ERR("Invalid width or height sizes. They must to be positive values."); return; } - world->x = x; - world->y = y; - world->w = w; - world->h = h; + world->geometry.x = x; + world->geometry.y = y; + world->geometry.z = z; + world->geometry.w = w; + world->geometry.h = h; + world->geometry.d = d; ephysics_body_world_boundaries_resize(world); ephysics_camera_position_set(world->camera, x, y); } EAPI void -ephysics_world_render_geometry_get(const EPhysics_World *world, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) +ephysics_world_render_geometry_get(const EPhysics_World *world, Evas_Coord *x, Evas_Coord *y, Evas_Coord *z, Evas_Coord *w, Evas_Coord *h, Evas_Coord *d) { if (!world) { @@ -1228,10 +1239,12 @@ ephysics_world_render_geometry_get(const EPhysics_World *world, Evas_Coord *x, E return; } - if (x) *x = world->x; - if (y) *y = world->y; - if (w) *w = world->w; - if (h) *h = world->h; + if (x) *x = world->geometry.x; + if (y) *y = world->geometry.y; + if (z) *z = world->geometry.z; + if (w) *w = world->geometry.w; + if (h) *h = world->geometry.h; + if (d) *d = world->geometry.d; } EAPI void