summaryrefslogtreecommitdiff
path: root/src/examples
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-03-19 17:34:46 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-03-19 17:34:46 +0100
commit4935582355d240ba5600ffb9354bb4185575afb3 (patch)
tree1b80f8cd9f4a83e9120685bf7b5f9fdebde0e78e /src/examples
parentf44c1aaf7f601fb402eff1e7248601b6a03a12f6 (diff)
evas: use switch instead of a serie of if for cleaner example.
Diffstat (limited to 'src/examples')
-rw-r--r--src/examples/evas/evas-3d-frustum.c76
1 files changed, 43 insertions, 33 deletions
diff --git a/src/examples/evas/evas-3d-frustum.c b/src/examples/evas/evas-3d-frustum.c
index 462159a..efeb8b3 100644
--- a/src/examples/evas/evas-3d-frustum.c
+++ b/src/examples/evas/evas-3d-frustum.c
@@ -106,42 +106,52 @@ _redraw_bounding_object(void *data)
106 eo_do(scene->mesh_node, evas_3d_node_mesh_del(current_mesh)); 106 eo_do(scene->mesh_node, evas_3d_node_mesh_del(current_mesh));
107 } 107 }
108 108
109 if (key == EVAS_3D_FRUSTUM_MODE_BSPHERE) 109 switch (key)
110 { 110 {
111 eo_do(scene->mesh_node_model, 111 case EVAS_3D_FRUSTUM_MODE_BSPHERE:
112 evas_3d_node_bounding_sphere_get(&x0, &y0, &z0, &radius)); 112 {
113 current_mesh = scene->mesh_sphere; 113 eo_do(scene->mesh_node_model,
114 px = x0; 114 evas_3d_node_bounding_sphere_get(&x0, &y0, &z0, &radius));
115 py = y0; 115 current_mesh = scene->mesh_sphere;
116 pz = z0; 116 px = x0;
117 sx = sy = sz = 2.0 * radius; 117 py = y0;
118 } 118 pz = z0;
119 else if (key == EVAS_3D_FRUSTUM_MODE_AABB) 119 sx = sy = sz = 2.0 * radius;
120 { 120 break;
121 eo_do(scene->mesh_node_model, evas_3d_node_bounding_box_get(&x0, &y0, &z0, 121 }
122 &x1, &y1, &z1)); 122 case EVAS_3D_FRUSTUM_MODE_AABB:
123 current_mesh = scene->mesh_aabb; 123 {
124 px = (x1 + x0) / 2; 124 eo_do(scene->mesh_node_model,
125 py = (y1 + y0) / 2; 125 evas_3d_node_bounding_box_get(&x0, &y0, &z0,
126 pz = (z1 + z0) / 2; 126 &x1, &y1, &z1));
127 sx = x1 - x0; 127 current_mesh = scene->mesh_aabb;
128 sy = y1 - y0; 128 px = (x1 + x0) / 2;
129 sz = z1 - z0; 129 py = (y1 + y0) / 2;
130 } 130 pz = (z1 + z0) / 2;
131 else if (key == EVAS_3D_FRUSTUM_MODE_CENTRAL_POINT) 131 sx = x1 - x0;
132 { 132 sy = y1 - y0;
133 eo_do(scene->mesh_node_model, 133 sz = z1 - z0;
134 evas_3d_node_bounding_sphere_get(&x0, &y0, &z0, &radius)); 134 break;
135 current_mesh = scene->mesh_sphere; 135 }
136 px = x0; 136 case EVAS_3D_FRUSTUM_MODE_CENTRAL_POINT:
137 py = y0; 137 {
138 pz = z0; 138 eo_do(scene->mesh_node_model,
139 sx = sy = sz = 0.1 * radius; 139 evas_3d_node_bounding_sphere_get(&x0, &y0, &z0, &radius));
140 current_mesh = scene->mesh_sphere;
141 px = x0;
142 py = y0;
143 pz = z0;
144 sx = sy = sz = 0.1 * radius;
145 break;
146 }
147 default:
148 return ECORE_CALLBACK_RENEW;
140 } 149 }
141 150
142 eo_do(scene->mesh_node, evas_3d_node_mesh_add(current_mesh), 151 eo_do(scene->mesh_node,
143 evas_3d_node_position_set(px, py, pz), 152 evas_3d_node_mesh_add(current_mesh),
144 evas_3d_node_scale_set(sx, sy, sz)); 153 evas_3d_node_position_set(px, py, pz),
154 evas_3d_node_scale_set(sx, sy, sz));
145 155
146 return ECORE_CALLBACK_RENEW; 156 return ECORE_CALLBACK_RENEW;
147} 157}