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,42 +106,52 @@ _redraw_bounding_object(void *data)
|
||||||
eo_do(scene->mesh_node, evas_3d_node_mesh_del(current_mesh));
|
eo_do(scene->mesh_node, evas_3d_node_mesh_del(current_mesh));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key == EVAS_3D_FRUSTUM_MODE_BSPHERE)
|
switch (key)
|
||||||
{
|
{
|
||||||
eo_do(scene->mesh_node_model,
|
case EVAS_3D_FRUSTUM_MODE_BSPHERE:
|
||||||
evas_3d_node_bounding_sphere_get(&x0, &y0, &z0, &radius));
|
{
|
||||||
current_mesh = scene->mesh_sphere;
|
eo_do(scene->mesh_node_model,
|
||||||
px = x0;
|
evas_3d_node_bounding_sphere_get(&x0, &y0, &z0, &radius));
|
||||||
py = y0;
|
current_mesh = scene->mesh_sphere;
|
||||||
pz = z0;
|
px = x0;
|
||||||
sx = sy = sz = 2.0 * radius;
|
py = y0;
|
||||||
}
|
pz = z0;
|
||||||
else if (key == EVAS_3D_FRUSTUM_MODE_AABB)
|
sx = sy = sz = 2.0 * radius;
|
||||||
{
|
break;
|
||||||
eo_do(scene->mesh_node_model, evas_3d_node_bounding_box_get(&x0, &y0, &z0,
|
}
|
||||||
&x1, &y1, &z1));
|
case EVAS_3D_FRUSTUM_MODE_AABB:
|
||||||
current_mesh = scene->mesh_aabb;
|
{
|
||||||
px = (x1 + x0) / 2;
|
eo_do(scene->mesh_node_model,
|
||||||
py = (y1 + y0) / 2;
|
evas_3d_node_bounding_box_get(&x0, &y0, &z0,
|
||||||
pz = (z1 + z0) / 2;
|
&x1, &y1, &z1));
|
||||||
sx = x1 - x0;
|
current_mesh = scene->mesh_aabb;
|
||||||
sy = y1 - y0;
|
px = (x1 + x0) / 2;
|
||||||
sz = z1 - z0;
|
py = (y1 + y0) / 2;
|
||||||
}
|
pz = (z1 + z0) / 2;
|
||||||
else if (key == EVAS_3D_FRUSTUM_MODE_CENTRAL_POINT)
|
sx = x1 - x0;
|
||||||
{
|
sy = y1 - y0;
|
||||||
eo_do(scene->mesh_node_model,
|
sz = z1 - z0;
|
||||||
evas_3d_node_bounding_sphere_get(&x0, &y0, &z0, &radius));
|
break;
|
||||||
current_mesh = scene->mesh_sphere;
|
}
|
||||||
px = x0;
|
case EVAS_3D_FRUSTUM_MODE_CENTRAL_POINT:
|
||||||
py = y0;
|
{
|
||||||
pz = z0;
|
eo_do(scene->mesh_node_model,
|
||||||
sx = sy = sz = 0.1 * radius;
|
evas_3d_node_bounding_sphere_get(&x0, &y0, &z0, &radius));
|
||||||
|
current_mesh = scene->mesh_sphere;
|
||||||
|
px = x0;
|
||||||
|
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_position_set(px, py, pz),
|
evas_3d_node_mesh_add(current_mesh),
|
||||||
evas_3d_node_scale_set(sx, sy, sz));
|
evas_3d_node_position_set(px, py, pz),
|
||||||
|
evas_3d_node_scale_set(sx, sy, sz));
|
||||||
|
|
||||||
return ECORE_CALLBACK_RENEW;
|
return ECORE_CALLBACK_RENEW;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue