forked from enlightenment/efl
ephysics: support light on soft bodies
SVN revision: 78476
This commit is contained in:
parent
b13d5d054f
commit
3804a911e1
|
@ -156,6 +156,9 @@ test_flag(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info _
|
|||
WIDTH - 100, FLOOR_Y - 40, DEPTH);
|
||||
test_data->world = world;
|
||||
|
||||
ephysics_world_light_set(world, 300, 50, -200, 255, 255, 255, 0, 0, 0);
|
||||
ephysics_world_light_all_bodies_set(world, EINA_TRUE);
|
||||
|
||||
boundary = ephysics_body_bottom_boundary_add(test_data->world);
|
||||
ephysics_body_restitution_set(boundary, 0.65);
|
||||
ephysics_body_friction_set(boundary, 4);
|
||||
|
|
|
@ -75,6 +75,9 @@ _ephysics_body_soft_body_slices_apply(void *data __UNUSED__, Evas *e __UNUSED__,
|
|||
EPhysics_Body_Soft_Body_Data *soft_data;
|
||||
EPhysics_Body *body;
|
||||
btVector3 b0, b1;
|
||||
int lr, lg, lb, ar, ag, ab;
|
||||
Evas_Coord lx, ly, lz;
|
||||
Eina_Bool light = EINA_FALSE;
|
||||
|
||||
soft_data = (EPhysics_Body_Soft_Body_Data *)evas_object_data_get(obj,
|
||||
SOFT_DATA);
|
||||
|
@ -83,6 +86,16 @@ _ephysics_body_soft_body_slices_apply(void *data __UNUSED__, Evas *e __UNUSED__,
|
|||
|
||||
ephysics_world_render_geometry_get(body->world, NULL, &wy, NULL, NULL, &wh,
|
||||
NULL);
|
||||
|
||||
if ((body->light_apply) ||
|
||||
(ephysics_world_light_all_bodies_get(body->world)))
|
||||
{
|
||||
|
||||
if (ephysics_world_light_get(body->world, &lx, &ly, &lz,
|
||||
&lr, &lg, &lb, &ar, &ag, &ab))
|
||||
light = EINA_TRUE;
|
||||
}
|
||||
|
||||
EINA_LIST_FOREACH(soft_data->slices, l, list_data)
|
||||
{
|
||||
slice = (EPhysics_Body_Soft_Body_Slice *)list_data;
|
||||
|
@ -118,6 +131,9 @@ _ephysics_body_soft_body_slices_apply(void *data __UNUSED__, Evas *e __UNUSED__,
|
|||
evas_map_point_coord_set(map, 2, x2, y2, z2);
|
||||
evas_map_point_coord_set(map, 3, x2, y2, z2);
|
||||
|
||||
if (light)
|
||||
evas_map_util_3d_lighting(map, lx, ly, lz, lr, lg, lb, ar, ag, ab);
|
||||
|
||||
evas_object_map_set(slice->evas_obj, map);
|
||||
evas_object_map_enable_set(slice->evas_obj, EINA_TRUE);
|
||||
evas_map_free(map);
|
||||
|
|
Loading…
Reference in New Issue