forked from enlightenment/efl
evas: use switch instead of a serie of if for cleaner example.
This commit is contained in:
parent
f44c1aaf7f
commit
4935582355
|
@ -106,7 +106,9 @@ _redraw_bounding_object(void *data)
|
|||
eo_do(scene->mesh_node, evas_3d_node_mesh_del(current_mesh));
|
||||
}
|
||||
|
||||
if (key == EVAS_3D_FRUSTUM_MODE_BSPHERE)
|
||||
switch (key)
|
||||
{
|
||||
case EVAS_3D_FRUSTUM_MODE_BSPHERE:
|
||||
{
|
||||
eo_do(scene->mesh_node_model,
|
||||
evas_3d_node_bounding_sphere_get(&x0, &y0, &z0, &radius));
|
||||
|
@ -115,10 +117,12 @@ _redraw_bounding_object(void *data)
|
|||
py = y0;
|
||||
pz = z0;
|
||||
sx = sy = sz = 2.0 * radius;
|
||||
break;
|
||||
}
|
||||
else if (key == EVAS_3D_FRUSTUM_MODE_AABB)
|
||||
case EVAS_3D_FRUSTUM_MODE_AABB:
|
||||
{
|
||||
eo_do(scene->mesh_node_model, evas_3d_node_bounding_box_get(&x0, &y0, &z0,
|
||||
eo_do(scene->mesh_node_model,
|
||||
evas_3d_node_bounding_box_get(&x0, &y0, &z0,
|
||||
&x1, &y1, &z1));
|
||||
current_mesh = scene->mesh_aabb;
|
||||
px = (x1 + x0) / 2;
|
||||
|
@ -127,8 +131,9 @@ _redraw_bounding_object(void *data)
|
|||
sx = x1 - x0;
|
||||
sy = y1 - y0;
|
||||
sz = z1 - z0;
|
||||
break;
|
||||
}
|
||||
else if (key == EVAS_3D_FRUSTUM_MODE_CENTRAL_POINT)
|
||||
case EVAS_3D_FRUSTUM_MODE_CENTRAL_POINT:
|
||||
{
|
||||
eo_do(scene->mesh_node_model,
|
||||
evas_3d_node_bounding_sphere_get(&x0, &y0, &z0, &radius));
|
||||
|
@ -137,9 +142,14 @@ _redraw_bounding_object(void *data)
|
|||
py = y0;
|
||||
pz = z0;
|
||||
sx = sy = sz = 0.1 * radius;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
eo_do(scene->mesh_node, evas_3d_node_mesh_add(current_mesh),
|
||||
eo_do(scene->mesh_node,
|
||||
evas_3d_node_mesh_add(current_mesh),
|
||||
evas_3d_node_position_set(px, py, pz),
|
||||
evas_3d_node_scale_set(sx, sy, sz));
|
||||
|
||||
|
|
Loading…
Reference in New Issue