summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorse.osadchy <se.osadchy@samsung.com>2016-02-17 14:26:40 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-02-17 16:12:35 +0900
commit780ec5d0297c3645033b64f4e0723c579e12e491 (patch)
tree7130e1e95436eddf0c8b319c832bc1f4fa9afbee /src
parenta1584c8a5db0bdacd8f14669f77d2c4f4de4d1c3 (diff)
evas: Update evas_3d_utils, replace Evas_Vec.
Summary: Change Evas_Vec2(3) to Eina_Vector2(3). Reviewers: cedric, Hermet, jpeg Subscribers: jpeg Differential Revision: https://phab.enlightenment.org/D3686
Diffstat (limited to 'src')
-rw-r--r--src/lib/evas/canvas/evas_canvas3d_camera.c2
-rw-r--r--src/lib/evas/canvas/evas_canvas3d_mesh.c2
-rw-r--r--src/lib/evas/canvas/evas_canvas3d_node.c76
-rw-r--r--src/lib/evas/canvas/evas_canvas3d_scene.c20
-rw-r--r--src/lib/evas/common3d/primitives/primitive_common.c16
-rw-r--r--src/lib/evas/common3d/primitives/primitive_common.h20
-rw-r--r--src/lib/evas/common3d/primitives/solids_of_revolution/cone.c6
-rw-r--r--src/lib/evas/common3d/primitives/solids_of_revolution/cylinder.c6
-rw-r--r--src/lib/evas/common3d/primitives/solids_of_revolution/sphere.c10
-rw-r--r--src/lib/evas/common3d/primitives/solids_of_revolution/torus.c2
-rw-r--r--src/lib/evas/common3d/primitives/surfaces/surface.c10
-rw-r--r--src/lib/evas/common3d/primitives/surfaces/terrain.c2
-rw-r--r--src/lib/evas/include/evas_3d_utils.h870
-rw-r--r--src/lib/evas/include/evas_private.h24
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_3d.c20
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_3d_private.h4
16 files changed, 346 insertions, 744 deletions
diff --git a/src/lib/evas/canvas/evas_canvas3d_camera.c b/src/lib/evas/canvas/evas_canvas3d_camera.c
index 9f874e2..c8ed312 100644
--- a/src/lib/evas/canvas/evas_canvas3d_camera.c
+++ b/src/lib/evas/canvas/evas_canvas3d_camera.c
@@ -163,7 +163,7 @@ _evas_canvas3d_camera_node_visible_get(Eo *obj EINA_UNUSED, Evas_Canvas3D_Camera
163 Eina_Quaternion planes[6]; 163 Eina_Quaternion planes[6];
164 Evas_Canvas3D_Node_Data *pd_node = eo_data_scope_get(node, EVAS_CANVAS3D_NODE_CLASS); 164 Evas_Canvas3D_Node_Data *pd_node = eo_data_scope_get(node, EVAS_CANVAS3D_NODE_CLASS);
165 Evas_Canvas3D_Node_Data *pd_camera = eo_data_scope_get(camera_node, EVAS_CANVAS3D_NODE_CLASS); 165 Evas_Canvas3D_Node_Data *pd_camera = eo_data_scope_get(camera_node, EVAS_CANVAS3D_NODE_CLASS);
166 Evas_Vec3 central_point; 166 Eina_Vector3 central_point;
167 167
168 if (!node || pd_node->type != EVAS_CANVAS3D_NODE_TYPE_MESH) 168 if (!node || pd_node->type != EVAS_CANVAS3D_NODE_TYPE_MESH)
169 { 169 {
diff --git a/src/lib/evas/canvas/evas_canvas3d_mesh.c b/src/lib/evas/canvas/evas_canvas3d_mesh.c
index ead3da0..84403c3 100644
--- a/src/lib/evas/canvas/evas_canvas3d_mesh.c
+++ b/src/lib/evas/canvas/evas_canvas3d_mesh.c
@@ -924,7 +924,7 @@ _evas_canvas3d_mesh_from_primitive_set(Eo *obj,
924} 924}
925 925
926void 926void
927evas_canvas3d_mesh_interpolate_position_get(Evas_Vec3 *out, const Evas_Canvas3D_Vertex_Buffer *pos0, const Evas_Canvas3D_Vertex_Buffer *pos1, 927evas_canvas3d_mesh_interpolate_position_get(Eina_Vector3 *out, const Evas_Canvas3D_Vertex_Buffer *pos0, const Evas_Canvas3D_Vertex_Buffer *pos1,
928 Evas_Real weight, int index) 928 Evas_Real weight, int index)
929{ 929{
930 if (pos1->data == NULL) 930 if (pos1->data == NULL)
diff --git a/src/lib/evas/canvas/evas_canvas3d_node.c b/src/lib/evas/canvas/evas_canvas3d_node.c
index 6cf880d..bf295cb 100644
--- a/src/lib/evas/canvas/evas_canvas3d_node.c
+++ b/src/lib/evas/canvas/evas_canvas3d_node.c
@@ -8,7 +8,7 @@
8Evas_Canvas3D_Mesh_Frame *evas_canvas3d_mesh_frame_find(Evas_Canvas3D_Mesh_Data *pd, int frame); 8Evas_Canvas3D_Mesh_Frame *evas_canvas3d_mesh_frame_find(Evas_Canvas3D_Mesh_Data *pd, int frame);
9 9
10static void 10static void
11_look_at_set(Evas_Canvas3D_Node_Data *pd, Evas_Vec3 *target, Evas_Vec3 *up); 11_look_at_set(Evas_Canvas3D_Node_Data *pd, Eina_Vector3 *target, Eina_Vector3 *up);
12 12
13static Eina_Stringshare * 13static Eina_Stringshare *
14_generate_unic_color_key(Evas_Color *color, Evas_Color *bg_color, Evas_Canvas3D_Node *node, Evas_Canvas3D_Mesh *mesh, 14_generate_unic_color_key(Evas_Color *color, Evas_Color *bg_color, Evas_Canvas3D_Node *node, Evas_Canvas3D_Mesh *mesh,
@@ -240,7 +240,7 @@ _node_transform_update(Evas_Canvas3D_Node *node, void *data EINA_UNUSED)
240 if (pd->parent) 240 if (pd->parent)
241 { 241 {
242 Evas_Canvas3D_Node_Data *pdparent = eo_data_scope_get(pd->parent, MY_CLASS); 242 Evas_Canvas3D_Node_Data *pdparent = eo_data_scope_get(pd->parent, MY_CLASS);
243 const Evas_Vec3 *scale_parent = &pdparent->scale_world; 243 const Eina_Vector3 *scale_parent = &pdparent->scale_world;
244 const Eina_Quaternion *orientation_parent = &pdparent->orientation_world; 244 const Eina_Quaternion *orientation_parent = &pdparent->orientation_world;
245 245
246 /* Orienatation */ 246 /* Orienatation */
@@ -256,17 +256,17 @@ _node_transform_update(Evas_Canvas3D_Node *node, void *data EINA_UNUSED)
256 256
257 /* Scale */ 257 /* Scale */
258 if (pd->scale_inherit) 258 if (pd->scale_inherit)
259 evas_vec3_multiply(&pd->scale_world, scale_parent, &pd->scale); 259 eina_vector3_multiply(&pd->scale_world, scale_parent, &pd->scale);
260 else 260 else
261 pd->scale_world = pd->scale; 261 pd->scale_world = pd->scale;
262 262
263 /* Position */ 263 /* Position */
264 if (pd->position_inherit) 264 if (pd->position_inherit)
265 { 265 {
266 evas_vec3_multiply(&pd->position_world, &pd->position, scale_parent); 266 eina_vector3_multiply(&pd->position_world, &pd->position, scale_parent);
267 evas_vec3_quaternion_rotate(&pd->position_world, &pd->position_world, 267 eina_vector3_quaternion_rotate(&pd->position_world, &pd->position_world,
268 orientation_parent); 268 orientation_parent);
269 evas_vec3_add(&pd->position_world, &pd->position_world, 269 eina_vector3_add(&pd->position_world, &pd->position_world,
270 &pdparent->position_world); 270 &pdparent->position_world);
271 } 271 }
272 else 272 else
@@ -314,16 +314,16 @@ _node_transform_update(Evas_Canvas3D_Node *node, void *data EINA_UNUSED)
314static Eina_Bool 314static Eina_Bool
315_node_billboard_update(Evas_Canvas3D_Node *node, void *data EINA_UNUSED) 315_node_billboard_update(Evas_Canvas3D_Node *node, void *data EINA_UNUSED)
316{ 316{
317 Evas_Vec3 target; 317 Eina_Vector3 target;
318 Evas_Vec3 up; 318 Eina_Vector3 up;
319 Evas_Canvas3D_Node_Data *pd_node = eo_data_scope_get(node, MY_CLASS); 319 Evas_Canvas3D_Node_Data *pd_node = eo_data_scope_get(node, MY_CLASS);
320 if (pd_node->billboard_target) 320 if (pd_node->billboard_target)
321 { 321 {
322 Evas_Canvas3D_Node_Data *pd_target = eo_data_scope_get(pd_node->billboard_target, 322 Evas_Canvas3D_Node_Data *pd_target = eo_data_scope_get(pd_node->billboard_target,
323 MY_CLASS); 323 MY_CLASS);
324 evas_vec3_set(&target, pd_target->position.x, pd_target->position.y, 324 eina_vector3_set(&target, pd_target->position.x, pd_target->position.y,
325 pd_target->position.z); 325 pd_target->position.z);
326 evas_vec3_set(&up, 0, 1, 0); 326 eina_vector3_set(&up, 0, 1, 0);
327 327
328 _look_at_set(pd_node, &target, &up); 328 _look_at_set(pd_node, &target, &up);
329 329
@@ -383,13 +383,13 @@ _node_item_update(Evas_Canvas3D_Node *node, void *data EINA_UNUSED)
383} 383}
384 384
385static void 385static void
386_pack_meshes_vertex_data(Evas_Canvas3D_Node *node, Evas_Vec3 **vertices, int *count) 386_pack_meshes_vertex_data(Evas_Canvas3D_Node *node, Eina_Vector3 **vertices, int *count)
387{ 387{
388 const Eina_List *m, *l; 388 const Eina_List *m, *l;
389 Evas_Canvas3D_Mesh *mesh; 389 Evas_Canvas3D_Mesh *mesh;
390 int j; 390 int j;
391 int frame; 391 int frame;
392 Evas_Vec3 *it; 392 Eina_Vector3 *it;
393 Evas_Canvas3D_Vertex_Buffer pos0, pos1; 393 Evas_Canvas3D_Vertex_Buffer pos0, pos1;
394 Evas_Real pos_weight; 394 Evas_Real pos_weight;
395 395
@@ -410,7 +410,7 @@ _pack_meshes_vertex_data(Evas_Canvas3D_Node *node, Evas_Vec3 **vertices, int *co
410 *count += pos0.size / pos0.stride; 410 *count += pos0.size / pos0.stride;
411 } 411 }
412 } 412 }
413 *vertices = (Evas_Vec3*)malloc(*count * sizeof(Evas_Vec3)); 413 *vertices = (Eina_Vector3*)malloc(*count * sizeof(Eina_Vector3));
414 it = *vertices; 414 it = *vertices;
415 if(!*vertices) 415 if(!*vertices)
416 { 416 {
@@ -446,13 +446,13 @@ _update_node_shapes(Evas_Canvas3D_Node *node)
446{ 446{
447 int i; 447 int i;
448 int count; 448 int count;
449 Evas_Vec3 *vertices = NULL; 449 Eina_Vector3 *vertices = NULL;
450 Evas_Canvas3D_Node_Data *pd = eo_data_scope_get(node, EVAS_CANVAS3D_NODE_CLASS); 450 Evas_Canvas3D_Node_Data *pd = eo_data_scope_get(node, EVAS_CANVAS3D_NODE_CLASS);
451 Eina_Bool transform_orientation_dirty; 451 Eina_Bool transform_orientation_dirty;
452 Eina_Bool transform_position_dirty; 452 Eina_Bool transform_position_dirty;
453 Eina_Bool transform_scale_dirty; 453 Eina_Bool transform_scale_dirty;
454 Eina_Bool mesh_geom_dirty; 454 Eina_Bool mesh_geom_dirty;
455 Evas_Vec3 position = pd->position_world; 455 Eina_Vector3 position = pd->position_world;
456 456
457 if (pd->type != EVAS_CANVAS3D_NODE_TYPE_MESH) 457 if (pd->type != EVAS_CANVAS3D_NODE_TYPE_MESH)
458 { 458 {
@@ -482,15 +482,15 @@ _update_node_shapes(Evas_Canvas3D_Node *node)
482 calculate_box(&pd->obb, count, vertices); 482 calculate_box(&pd->obb, count, vertices);
483 for (i = 0; i < count; i++) 483 for (i = 0; i < count; i++)
484 { 484 {
485 evas_vec3_homogeneous_position_transform(&vertices[i], &vertices[i], &pd->data.mesh.matrix_local_to_world); 485 eina_vector3_homogeneous_position_transform(&vertices[i], &pd->data.mesh.matrix_local_to_world, &vertices[i]);
486 } 486 }
487 calculate_box(&pd->aabb, count, vertices); 487 calculate_box(&pd->aabb, count, vertices);
488 if (transform_position_dirty || transform_scale_dirty || mesh_geom_dirty) 488 if (transform_position_dirty || transform_scale_dirty || mesh_geom_dirty)
489 { 489 {
490 calculate_sphere(&pd->bsphere, count, vertices); 490 calculate_sphere(&pd->bsphere, count, vertices);
491 } 491 }
492 evas_vec3_homogeneous_position_transform(&pd->obb.p0, &pd->obb.p0, &pd->data.mesh.matrix_local_to_world); 492 eina_vector3_homogeneous_position_transform(&pd->obb.p0, &pd->data.mesh.matrix_local_to_world, &pd->obb.p0);
493 evas_vec3_homogeneous_position_transform(&pd->obb.p0, &pd->obb.p0, &pd->data.mesh.matrix_local_to_world); 493 eina_vector3_homogeneous_position_transform(&pd->obb.p0, &pd->data.mesh.matrix_local_to_world, &pd->obb.p0);
494 } 494 }
495 free(vertices); 495 free(vertices);
496 496
@@ -1032,13 +1032,13 @@ _evas_canvas3d_node_constructor(Eo *obj, Evas_Canvas3D_Node_Data *pd, Evas_Canva
1032{ 1032{
1033 eo_do(obj, evas_canvas3d_object_type_set(EVAS_CANVAS3D_OBJECT_TYPE_NODE)); 1033 eo_do(obj, evas_canvas3d_object_type_set(EVAS_CANVAS3D_OBJECT_TYPE_NODE));
1034 1034
1035 evas_vec3_set(&pd->position, 0.0, 0.0, 0.0); 1035 eina_vector3_set(&pd->position, 0.0, 0.0, 0.0);
1036 eina_quaternion_set(&pd->orientation, 0.0, 0.0, 0.0, 1.0); 1036 eina_quaternion_set(&pd->orientation, 0.0, 0.0, 0.0, 1.0);
1037 evas_vec3_set(&pd->scale, 1.0, 1.0, 1.0); 1037 eina_vector3_set(&pd->scale, 1.0, 1.0, 1.0);
1038 1038
1039 evas_vec3_set(&pd->position_world, 0.0, 0.0, 0.0); 1039 eina_vector3_set(&pd->position_world, 0.0, 0.0, 0.0);
1040 eina_quaternion_set(&pd->orientation_world, 0.0, 0.0, 0.0, 1.0); 1040 eina_quaternion_set(&pd->orientation_world, 0.0, 0.0, 0.0, 1.0);
1041 evas_vec3_set(&pd->scale_world, 1.0, 1.0, 1.0); 1041 eina_vector3_set(&pd->scale_world, 1.0, 1.0, 1.0);
1042 1042
1043 pd->position_inherit = EINA_TRUE; 1043 pd->position_inherit = EINA_TRUE;
1044 pd->orientation_inherit = EINA_TRUE; 1044 pd->orientation_inherit = EINA_TRUE;
@@ -1176,10 +1176,10 @@ _evas_canvas3d_node_orientation_angle_axis_set(Eo *obj, Evas_Canvas3D_Node_Data
1176{ 1176{
1177 Evas_Real half_angle = 0.5 * DEGREE_TO_RADIAN(angle); 1177 Evas_Real half_angle = 0.5 * DEGREE_TO_RADIAN(angle);
1178 Evas_Real s = sin(half_angle); 1178 Evas_Real s = sin(half_angle);
1179 Evas_Vec3 axis; 1179 Eina_Vector3 axis;
1180 1180
1181 evas_vec3_set(&axis, x, y, z); 1181 eina_vector3_set(&axis, x, y, z);
1182 evas_vec3_normalize(&axis, &axis); 1182 eina_vector3_normalize(&axis, &axis);
1183 1183
1184 pd->orientation.w = cos(half_angle); 1184 pd->orientation.w = cos(half_angle);
1185 pd->orientation.x = s * axis.x; 1185 pd->orientation.x = s * axis.x;
@@ -1321,18 +1321,18 @@ _evas_canvas3d_node_scale_inherit_get(Eo *obj EINA_UNUSED, Evas_Canvas3D_Node_Da
1321} 1321}
1322 1322
1323static void 1323static void
1324_look_at_set(Evas_Canvas3D_Node_Data *pd, Evas_Vec3 *target, Evas_Vec3 *up) 1324_look_at_set(Evas_Canvas3D_Node_Data *pd, Eina_Vector3 *target, Eina_Vector3 *up)
1325{ 1325{
1326 Evas_Vec3 x, y, z; 1326 Eina_Vector3 x, y, z;
1327 1327
1328 evas_vec3_subtract(&z, &pd->position, target); 1328 eina_vector3_subtract(&z, &pd->position, target);
1329 evas_vec3_normalize(&z, &z); 1329 eina_vector3_normalize(&z, &z);
1330 1330
1331 evas_vec3_cross_product(&x, up, &z); 1331 eina_vector3_cross_product(&x, up, &z);
1332 evas_vec3_normalize(&x, &x); 1332 eina_vector3_normalize(&x, &x);
1333 1333
1334 evas_vec3_cross_product(&y, &z, &x); 1334 eina_vector3_cross_product(&y, &z, &x);
1335 evas_vec3_normalize(&y, &y); 1335 eina_vector3_normalize(&y, &y);
1336 1336
1337 /* Below matrix to quaternion conversion code taken from 1337 /* Below matrix to quaternion conversion code taken from
1338 * http://fabiensanglard.net/doom3_documentation/37726-293748.pdf 1338 * http://fabiensanglard.net/doom3_documentation/37726-293748.pdf
@@ -1386,8 +1386,8 @@ _evas_canvas3d_node_look_at_set(Eo *obj, Evas_Canvas3D_Node_Data *pd,
1386 Evas_Canvas3D_Space target_space, Evas_Real tx, Evas_Real ty, Evas_Real tz, 1386 Evas_Canvas3D_Space target_space, Evas_Real tx, Evas_Real ty, Evas_Real tz,
1387 Evas_Canvas3D_Space up_space, Evas_Real ux, Evas_Real uy, Evas_Real uz) 1387 Evas_Canvas3D_Space up_space, Evas_Real ux, Evas_Real uy, Evas_Real uz)
1388{ 1388{
1389 Evas_Vec3 target; 1389 Eina_Vector3 target;
1390 Evas_Vec3 up; 1390 Eina_Vector3 up;
1391 1391
1392 /* Target position in parent space. */ 1392 /* Target position in parent space. */
1393 if (target_space == EVAS_CANVAS3D_SPACE_LOCAL) 1393 if (target_space == EVAS_CANVAS3D_SPACE_LOCAL)
@@ -1397,7 +1397,7 @@ _evas_canvas3d_node_look_at_set(Eo *obj, Evas_Canvas3D_Node_Data *pd,
1397 } 1397 }
1398 else if (target_space == EVAS_CANVAS3D_SPACE_PARENT) 1398 else if (target_space == EVAS_CANVAS3D_SPACE_PARENT)
1399 { 1399 {
1400 evas_vec3_set(&target, tx, ty, tz); 1400 eina_vector3_set(&target, tx, ty, tz);
1401 } 1401 }
1402 else if (target_space == EVAS_CANVAS3D_SPACE_WORLD) 1402 else if (target_space == EVAS_CANVAS3D_SPACE_WORLD)
1403 { 1403 {
@@ -1413,13 +1413,13 @@ _evas_canvas3d_node_look_at_set(Eo *obj, Evas_Canvas3D_Node_Data *pd,
1413 1413
1414 if (up_space == EVAS_CANVAS3D_SPACE_LOCAL) 1414 if (up_space == EVAS_CANVAS3D_SPACE_LOCAL)
1415 { 1415 {
1416 evas_vec3_set(&up, ux, uy, uz); 1416 eina_vector3_set(&up, ux, uy, uz);
1417 //ERR("TODO:"); 1417 //ERR("TODO:");
1418 //return; 1418 //return;
1419 } 1419 }
1420 else if (up_space == EVAS_CANVAS3D_SPACE_PARENT) 1420 else if (up_space == EVAS_CANVAS3D_SPACE_PARENT)
1421 { 1421 {
1422 evas_vec3_set(&up, ux, uy, uz); 1422 eina_vector3_set(&up, ux, uy, uz);
1423 } 1423 }
1424 else if (up_space == EVAS_CANVAS3D_SPACE_WORLD) 1424 else if (up_space == EVAS_CANVAS3D_SPACE_WORLD)
1425 { 1425 {
diff --git a/src/lib/evas/canvas/evas_canvas3d_scene.c b/src/lib/evas/canvas/evas_canvas3d_scene.c
index c9eb996..3030704 100644
--- a/src/lib/evas/canvas/evas_canvas3d_scene.c
+++ b/src/lib/evas/canvas/evas_canvas3d_scene.c
@@ -176,14 +176,14 @@ static inline Eina_Bool
176_pick_data_triangle_add(Evas_Canvas3D_Pick_Data *data, const Evas_Ray3 *ray, 176_pick_data_triangle_add(Evas_Canvas3D_Pick_Data *data, const Evas_Ray3 *ray,
177 const Evas_Triangle3 *tri) 177 const Evas_Triangle3 *tri)
178{ 178{
179 Evas_Vec3 e1, e2, tvec, pvec, qvec; 179 Eina_Vector3 e1, e2, tvec, pvec, qvec;
180 Evas_Real det, inv_det, u, v, t; 180 Evas_Real det, inv_det, u, v, t;
181 181
182 evas_vec3_subtract(&e1, &tri->p1, &tri->p0); 182 eina_vector3_subtract(&e1, &tri->p1, &tri->p0);
183 evas_vec3_subtract(&e2, &tri->p2, &tri->p0); 183 eina_vector3_subtract(&e2, &tri->p2, &tri->p0);
184 184
185 evas_vec3_cross_product(&pvec, &ray->dir, &e2); 185 eina_vector3_cross_product(&pvec, &ray->dir, &e2);
186 det = evas_vec3_dot_product(&e1, &pvec); 186 det = eina_vector3_dot_product(&e1, &pvec);
187 187
188 /* If determinant is near zero, ray lies in plane of triangle. */ 188 /* If determinant is near zero, ray lies in plane of triangle. */
189 if (det > -0.0000001 && det < 0.0000001) 189 if (det > -0.0000001 && det < 0.0000001)
@@ -192,25 +192,25 @@ _pick_data_triangle_add(Evas_Canvas3D_Pick_Data *data, const Evas_Ray3 *ray,
192 inv_det = 1.0 / det; 192 inv_det = 1.0 / det;
193 193
194 /* Calculate distance from p0 to ray origin. */ 194 /* Calculate distance from p0 to ray origin. */
195 evas_vec3_subtract(&tvec, &ray->org, &tri->p0); 195 eina_vector3_subtract(&tvec, &ray->org, &tri->p0);
196 196
197 /* Calculate U parameter and test bounds. */ 197 /* Calculate U parameter and test bounds. */
198 u = evas_vec3_dot_product(&tvec, &pvec) * inv_det; 198 u = eina_vector3_dot_product(&tvec, &pvec) * inv_det;
199 199
200 if (u < 0.0 || u > 1.0) 200 if (u < 0.0 || u > 1.0)
201 return EINA_FALSE; 201 return EINA_FALSE;
202 202
203 /* Prepare to tst V parameter. */ 203 /* Prepare to tst V parameter. */
204 evas_vec3_cross_product(&qvec, &tvec, &e1); 204 eina_vector3_cross_product(&qvec, &tvec, &e1);
205 205
206 /* Calculate V parameter and test bounds. */ 206 /* Calculate V parameter and test bounds. */
207 v = evas_vec3_dot_product(&ray->dir, &qvec) * inv_det; 207 v = eina_vector3_dot_product(&ray->dir, &qvec) * inv_det;
208 208
209 if (v < 0.0 || u + v > 1.0) 209 if (v < 0.0 || u + v > 1.0)
210 return EINA_FALSE; 210 return EINA_FALSE;
211 211
212 /* Calculate T parameter and test bounds. */ 212 /* Calculate T parameter and test bounds. */
213 t = evas_vec3_dot_product(&e2, &qvec) * inv_det; 213 t = eina_vector3_dot_product(&e2, &qvec) * inv_det;
214 214
215 if (t >= 0.0 && t <= 1.0) 215 if (t >= 0.0 && t <= 1.0)
216 { 216 {
diff --git a/src/lib/evas/common3d/primitives/primitive_common.c b/src/lib/evas/common3d/primitives/primitive_common.c
index 882e952..b80d1dc 100644
--- a/src/lib/evas/common3d/primitives/primitive_common.c
+++ b/src/lib/evas/common3d/primitives/primitive_common.c
@@ -30,7 +30,7 @@ void
30_set_vec3_vertex_data(Evas_Canvas3D_Mesh *mesh, 30_set_vec3_vertex_data(Evas_Canvas3D_Mesh *mesh,
31 int frame, 31 int frame,
32 int vcount, 32 int vcount,
33 Evas_Vec3 *data, 33 Eina_Vector3 *data,
34 Evas_Canvas3D_Vertex_Attrib attr) 34 Evas_Canvas3D_Vertex_Attrib attr)
35{ 35{
36 float *address, *out; 36 float *address, *out;
@@ -56,7 +56,7 @@ void
56_set_vec2_vertex_data(Evas_Canvas3D_Mesh *mesh, 56_set_vec2_vertex_data(Evas_Canvas3D_Mesh *mesh,
57 int frame, 57 int frame,
58 int vcount, 58 int vcount,
59 Evas_Vec2 *data, 59 Eina_Vector2 *data,
60 Evas_Canvas3D_Vertex_Attrib attr) 60 Evas_Canvas3D_Vertex_Attrib attr)
61{ 61{
62 float *address, *out; 62 float *address, *out;
@@ -99,7 +99,7 @@ _generate_indices(unsigned short *indices, int a, int b)
99} 99}
100 100
101void 101void
102_primitives_vec3_copy(Evas_Vec3 *dst, const Evas_Vec3 *src) 102_primitives_vec3_copy(Eina_Vector3 *dst, const Eina_Vector3 *src)
103{ 103{
104 dst->x = src->x; 104 dst->x = src->x;
105 dst->y = src->y; 105 dst->y = src->y;
@@ -107,7 +107,7 @@ _primitives_vec3_copy(Evas_Vec3 *dst, const Evas_Vec3 *src)
107} 107}
108 108
109void 109void
110_primitives_vec3_subtract(Evas_Vec3 *out, const Evas_Vec3 *a, const Evas_Vec3 *b) 110_primitives_vec3_subtract(Eina_Vector3 *out, const Eina_Vector3 *a, const Eina_Vector3 *b)
111{ 111{
112 out->x = a->x - b->x; 112 out->x = a->x - b->x;
113 out->y = a->y - b->y; 113 out->y = a->y - b->y;
@@ -115,9 +115,9 @@ _primitives_vec3_subtract(Evas_Vec3 *out, const Evas_Vec3 *a, const Evas_Vec3 *b
115} 115}
116 116
117void 117void
118_primitives_vec3_cross_product(Evas_Vec3 *out, const Evas_Vec3 *a, const Evas_Vec3 *b) 118_primitives_vec3_cross_product(Eina_Vector3 *out, const Eina_Vector3 *a, const Eina_Vector3 *b)
119{ 119{
120 Evas_Vec3 tmp; 120 Eina_Vector3 tmp;
121 121
122 tmp.x = a->y * b->z - a->z * b->y; 122 tmp.x = a->y * b->z - a->z * b->y;
123 tmp.y = a->z * b->x - a->x * b->z; 123 tmp.y = a->z * b->x - a->x * b->z;
@@ -127,7 +127,7 @@ _primitives_vec3_cross_product(Evas_Vec3 *out, const Evas_Vec3 *a, const Evas_Ve
127} 127}
128 128
129void 129void
130_primitives_vec3_normalize(Evas_Vec3 *out) 130_primitives_vec3_normalize(Eina_Vector3 *out)
131{ 131{
132 Evas_Real size = out->x * out->x + out->y *out->y + out->z * out->z; 132 Evas_Real size = out->x * out->x + out->y *out->y + out->z * out->z;
133 size = sqrt(size); 133 size = sqrt(size);
@@ -144,7 +144,7 @@ evas_common_set_model_from_primitive(Evas_Canvas3D_Mesh *model,
144 Evas_Real ratio = primitive->ratio; 144 Evas_Real ratio = primitive->ratio;
145 int precision = primitive->precision; 145 int precision = primitive->precision;
146 Evas_Canvas3D_Surface_Func *surface = primitive->surface; 146 Evas_Canvas3D_Surface_Func *surface = primitive->surface;
147 Evas_Vec2 tex_scale = primitive->tex_scale; 147 Eina_Vector2 tex_scale = primitive->tex_scale;
148 Evas_Canvas3D_Primitive_Mode mode = primitive->mode; 148 Evas_Canvas3D_Primitive_Mode mode = primitive->mode;
149 149
150 switch (primitive->form) 150 switch (primitive->form)
diff --git a/src/lib/evas/common3d/primitives/primitive_common.h b/src/lib/evas/common3d/primitives/primitive_common.h
index 50092d7..6c0dcf2 100644
--- a/src/lib/evas/common3d/primitives/primitive_common.h
+++ b/src/lib/evas/common3d/primitives/primitive_common.h
@@ -10,10 +10,10 @@
10#include "evas_private.h" 10#include "evas_private.h"
11 11
12#define ALLOCATE_VERTEX_DATA \ 12#define ALLOCATE_VERTEX_DATA \
13 Evas_Vec3 *vertices = malloc(sizeof(Evas_Vec3) * vcount); \ 13 Eina_Vector3 *vertices = malloc(sizeof(Eina_Vector3) * vcount); \
14 Evas_Vec3 *normals = malloc(sizeof(Evas_Vec3) * vcount); \ 14 Eina_Vector3 *normals = malloc(sizeof(Eina_Vector3) * vcount); \
15 Evas_Vec2 *tex_coord = malloc(sizeof(Evas_Vec2) * vcount); \ 15 Eina_Vector2 *tex_coord = malloc(sizeof(Eina_Vector2) * vcount); \
16 Evas_Vec3 *tangents = malloc(sizeof(Evas_Vec3) * vcount); \ 16 Eina_Vector3 *tangents = malloc(sizeof(Eina_Vector3) * vcount); \
17 unsigned short *indices = malloc(sizeof(short) * icount); 17 unsigned short *indices = malloc(sizeof(short) * icount);
18 18
19#define SET_VERTEX_DATA(frame) \ 19#define SET_VERTEX_DATA(frame) \
@@ -56,13 +56,13 @@
56 12, 3, 15, vcount); 56 12, 3, 15, vcount);
57 57
58void _generate_indices(unsigned short *indices, int count, int width); 58void _generate_indices(unsigned short *indices, int count, int width);
59void _set_vec3_vertex_data(Evas_Canvas3D_Mesh *mesh, int frame, int vcount, Evas_Vec3 *data, Evas_Canvas3D_Vertex_Attrib attr); 59void _set_vec3_vertex_data(Evas_Canvas3D_Mesh *mesh, int frame, int vcount, Eina_Vector3 *data, Evas_Canvas3D_Vertex_Attrib attr);
60void _set_vec2_vertex_data(Evas_Canvas3D_Mesh *mesh, int frame, int vcount, Evas_Vec2 *data, Evas_Canvas3D_Vertex_Attrib attr); 60void _set_vec2_vertex_data(Evas_Canvas3D_Mesh *mesh, int frame, int vcount, Eina_Vector2 *data, Evas_Canvas3D_Vertex_Attrib attr);
61void _set_vertex_data_from_array(Evas_Canvas3D_Mesh *mesh, int frame, const float *data, Evas_Canvas3D_Vertex_Attrib attr, int start, int attr_count, int line, int vcount); 61void _set_vertex_data_from_array(Evas_Canvas3D_Mesh *mesh, int frame, const float *data, Evas_Canvas3D_Vertex_Attrib attr, int start, int attr_count, int line, int vcount);
62 62
63void _primitives_vec3_copy(Evas_Vec3 *dst, const Evas_Vec3 *src); 63void _primitives_vec3_copy(Eina_Vector3 *dst, const Eina_Vector3 *src);
64void _primitives_vec3_subtract(Evas_Vec3 *out, const Evas_Vec3 *a, const Evas_Vec3 *b); 64void _primitives_vec3_subtract(Eina_Vector3 *out, const Eina_Vector3 *a, const Eina_Vector3 *b);
65void _primitives_vec3_cross_product(Evas_Vec3 *out, const Evas_Vec3 *a, const Evas_Vec3 *b); 65void _primitives_vec3_cross_product(Eina_Vector3 *out, const Eina_Vector3 *a, const Eina_Vector3 *b);
66void _primitives_vec3_normalize(Evas_Vec3 *out); 66void _primitives_vec3_normalize(Eina_Vector3 *out);
67 67
68#endif //PRIMITIVE_COMMON 68#endif //PRIMITIVE_COMMON
diff --git a/src/lib/evas/common3d/primitives/solids_of_revolution/cone.c b/src/lib/evas/common3d/primitives/solids_of_revolution/cone.c
index 9a48c2a..1a27630 100644
--- a/src/lib/evas/common3d/primitives/solids_of_revolution/cone.c
+++ b/src/lib/evas/common3d/primitives/solids_of_revolution/cone.c
@@ -4,7 +4,7 @@ void
4_set_default_cone(Evas_Canvas3D_Mesh *mesh, 4_set_default_cone(Evas_Canvas3D_Mesh *mesh,
5 int frame, 5 int frame,
6 int p, 6 int p,
7 Evas_Vec2 tex_scale) 7 Eina_Vector2 tex_scale)
8{ 8{
9 int vcount, icount, vccount, i, j, num; 9 int vcount, icount, vccount, i, j, num;
10 double dfi, fi, sinfi, cosfi, nplane, nz; 10 double dfi, fi, sinfi, cosfi, nplane, nz;
@@ -66,7 +66,7 @@ void
66_set_cone_without_base(Evas_Canvas3D_Mesh *mesh, 66_set_cone_without_base(Evas_Canvas3D_Mesh *mesh,
67 int frame, 67 int frame,
68 int p, 68 int p,
69 Evas_Vec2 tex_scale) 69 Eina_Vector2 tex_scale)
70{ 70{
71 int vcount, icount, vccount, i; 71 int vcount, icount, vccount, i;
72 double dfi, fi, sinfi, cosfi, nplane, nz; 72 double dfi, fi, sinfi, cosfi, nplane, nz;
@@ -117,7 +117,7 @@ evas_model_set_from_cone_primitive(Evas_Canvas3D_Mesh *mesh,
117 int frame, 117 int frame,
118 Evas_Canvas3D_Primitive_Mode mode, 118 Evas_Canvas3D_Primitive_Mode mode,
119 int p, 119 int p,
120 Evas_Vec2 tex_scale) 120 Eina_Vector2 tex_scale)
121{ 121{
122 switch (mode) 122 switch (mode)
123 { 123 {
diff --git a/src/lib/evas/common3d/primitives/solids_of_revolution/cylinder.c b/src/lib/evas/common3d/primitives/solids_of_revolution/cylinder.c
index d990a05..5b6e593 100644
--- a/src/lib/evas/common3d/primitives/solids_of_revolution/cylinder.c
+++ b/src/lib/evas/common3d/primitives/solids_of_revolution/cylinder.c
@@ -4,7 +4,7 @@ void
4_set_default_cylinder(Evas_Canvas3D_Mesh *mesh, 4_set_default_cylinder(Evas_Canvas3D_Mesh *mesh,
5 int frame, 5 int frame,
6 int p, 6 int p,
7 Evas_Vec2 tex_scale) 7 Eina_Vector2 tex_scale)
8{ 8{
9 int vcount, icount, vccount, i, j, num; 9 int vcount, icount, vccount, i, j, num;
10 icount = p * 30; 10 icount = p * 30;
@@ -67,7 +67,7 @@ void
67_set_cylinder_without_bases(Evas_Canvas3D_Mesh *mesh, 67_set_cylinder_without_bases(Evas_Canvas3D_Mesh *mesh,
68 int frame, 68 int frame,
69 int p, 69 int p,
70 Evas_Vec2 tex_scale) 70 Eina_Vector2 tex_scale)
71{ 71{
72 int vcount, icount, vccount, i; 72 int vcount, icount, vccount, i;
73 icount = p * 6; 73 icount = p * 6;
@@ -113,7 +113,7 @@ evas_model_set_from_cylinder_primitive(Evas_Canvas3D_Mesh *mesh,
113 int frame, 113 int frame,
114 Evas_Canvas3D_Primitive_Mode mode, 114 Evas_Canvas3D_Primitive_Mode mode,
115 int p, 115 int p,
116 Evas_Vec2 tex_scale) 116 Eina_Vector2 tex_scale)
117{ 117{
118 switch (mode) 118 switch (mode)
119 { 119 {
diff --git a/src/lib/evas/common3d/primitives/solids_of_revolution/sphere.c b/src/lib/evas/common3d/primitives/solids_of_revolution/sphere.c
index adbd22a..f2e81b0 100644
--- a/src/lib/evas/common3d/primitives/solids_of_revolution/sphere.c
+++ b/src/lib/evas/common3d/primitives/solids_of_revolution/sphere.c
@@ -4,7 +4,7 @@ void
4_set_default_sphere(Evas_Canvas3D_Mesh *mesh, 4_set_default_sphere(Evas_Canvas3D_Mesh *mesh,
5 int frame, 5 int frame,
6 int p, 6 int p,
7 Evas_Vec2 tex_scale) 7 Eina_Vector2 tex_scale)
8{ 8{
9 int vcount, icount, vccount, i, j; 9 int vcount, icount, vccount, i, j;
10 icount = p * p * 6; 10 icount = p * p * 6;
@@ -55,7 +55,7 @@ void
55_set_sphere_with_alternative_uv(Evas_Canvas3D_Mesh *mesh, 55_set_sphere_with_alternative_uv(Evas_Canvas3D_Mesh *mesh,
56 int frame, 56 int frame,
57 int p, 57 int p,
58 Evas_Vec2 tex_scale) 58 Eina_Vector2 tex_scale)
59{ 59{
60 int vcount, icount, vccount, i, j; 60 int vcount, icount, vccount, i, j;
61 61
@@ -115,9 +115,9 @@ _set_sphere_with_alternative_uv(Evas_Canvas3D_Mesh *mesh,
115 /* Triangulation of sphere mesh in appliance with buffer of indices. */ 115 /* Triangulation of sphere mesh in appliance with buffer of indices. */
116 for (i = 0; i < icount; i += 3) 116 for (i = 0; i < icount; i += 3)
117 { 117 {
118 Evas_Vec3 e1, e2; 118 Eina_Vector3 e1, e2;
119 float du1, du2, dv1, dv2, f; 119 float du1, du2, dv1, dv2, f;
120 Evas_Vec3 tangent; 120 Eina_Vector3 tangent;
121 int num0, num1, num2; 121 int num0, num1, num2;
122 122
123 num0 = indices[i + 0]; 123 num0 = indices[i + 0];
@@ -166,7 +166,7 @@ evas_model_set_from_sphere_primitive(Evas_Canvas3D_Mesh *mesh,
166 int frame, 166 int frame,
167 Evas_Canvas3D_Primitive_Mode mode, 167 Evas_Canvas3D_Primitive_Mode mode,
168 int p, 168 int p,
169 Evas_Vec2 tex_scale) 169 Eina_Vector2 tex_scale)
170{ 170{
171 switch (mode) 171 switch (mode)
172 { 172 {
diff --git a/src/lib/evas/common3d/primitives/solids_of_revolution/torus.c b/src/lib/evas/common3d/primitives/solids_of_revolution/torus.c
index 9110122..99016c6 100644
--- a/src/lib/evas/common3d/primitives/solids_of_revolution/torus.c
+++ b/src/lib/evas/common3d/primitives/solids_of_revolution/torus.c
@@ -5,7 +5,7 @@ evas_model_set_from_torus_primitive(Evas_Canvas3D_Mesh *mesh,
5 int frame, 5 int frame,
6 Evas_Real ratio, 6 Evas_Real ratio,
7 int p, 7 int p,
8 Evas_Vec2 tex_scale) 8 Eina_Vector2 tex_scale)
9{ 9{
10 int vcount, icount, vccount, i, j; 10 int vcount, icount, vccount, i, j;
11 icount = p * p * 6; 11 icount = p * p * 6;
diff --git a/src/lib/evas/common3d/primitives/surfaces/surface.c b/src/lib/evas/common3d/primitives/surfaces/surface.c
index 8d0bd3f..7698ba5 100644
--- a/src/lib/evas/common3d/primitives/surfaces/surface.c
+++ b/src/lib/evas/common3d/primitives/surfaces/surface.c
@@ -1,8 +1,8 @@
1#include "../primitive_common.h" 1#include "../primitive_common.h"
2 2
3Evas_Vec3 _get_func_normal(Evas_Canvas3D_Surface_Func *func, Evas_Real x, Evas_Real y) 3Eina_Vector3 _get_func_normal(Evas_Canvas3D_Surface_Func *func, Evas_Real x, Evas_Real y)
4{ 4{
5 Evas_Vec3 v00, v01, v10, d1, d2, normal; 5 Eina_Vector3 v00, v01, v10, d1, d2, normal;
6 6
7 func(&v00.x, &v00.y, &v00.z, x, y); 7 func(&v00.x, &v00.y, &v00.z, x, y);
8 func(&v01.x, &v01.y, &v01.z, x, y + 0.01); 8 func(&v01.x, &v01.y, &v01.z, x, y + 0.01);
@@ -18,10 +18,10 @@ Evas_Vec3 _get_func_normal(Evas_Canvas3D_Surface_Func *func, Evas_Real x, Evas_R
18} 18}
19 19
20void 20void
21_normalize(Evas_Vec3 *vertices, Evas_Vec3 *normals, int vcount) 21_normalize(Eina_Vector3 *vertices, Eina_Vector3 *normals, int vcount)
22{ 22{
23 int i; 23 int i;
24 Evas_Vec3 min, max; 24 Eina_Vector3 min, max;
25 min = max = vertices[0]; 25 min = max = vertices[0];
26 26
27#define CHECK_MIN_AND_MAX(coord) \ 27#define CHECK_MIN_AND_MAX(coord) \
@@ -54,7 +54,7 @@ evas_model_set_from_surface_primitive(Evas_Canvas3D_Mesh *mesh,
54 int frame, 54 int frame,
55 Evas_Canvas3D_Surface_Func func, 55 Evas_Canvas3D_Surface_Func func,
56 int p, 56 int p,
57 Evas_Vec2 tex_scale) 57 Eina_Vector2 tex_scale)
58{ 58{
59 int vcount, icount, vccount, i, j, num; 59 int vcount, icount, vccount, i, j, num;
60 icount = p * p * 6; 60 icount = p * p * 6;
diff --git a/src/lib/evas/common3d/primitives/surfaces/terrain.c b/src/lib/evas/common3d/primitives/surfaces/terrain.c
index a71f94f..1f83c08 100644
--- a/src/lib/evas/common3d/primitives/surfaces/terrain.c
+++ b/src/lib/evas/common3d/primitives/surfaces/terrain.c
@@ -79,7 +79,7 @@ void
79evas_model_set_from_terrain_primitive(Evas_Canvas3D_Mesh *mesh, 79evas_model_set_from_terrain_primitive(Evas_Canvas3D_Mesh *mesh,
80 int frame, 80 int frame,
81 int p, 81 int p,
82 Evas_Vec2 tex_scale) 82 Eina_Vector2 tex_scale)
83{ 83{
84 evas_model_set_from_surface_primitive(mesh, frame, _perlin_terrain, p, tex_scale); 84 evas_model_set_from_surface_primitive(mesh, frame, _perlin_terrain, p, tex_scale);
85} 85}
diff --git a/src/lib/evas/include/evas_3d_utils.h b/src/lib/evas/include/evas_3d_utils.h
index bb94a65..3058eb6 100644
--- a/src/lib/evas/include/evas_3d_utils.h
+++ b/src/lib/evas/include/evas_3d_utils.h
@@ -13,8 +13,6 @@
13 (fabs(a - b) > FLT_EPSILON) 13 (fabs(a - b) > FLT_EPSILON)
14 14
15typedef struct _Evas_Color Evas_Color; 15typedef struct _Evas_Color Evas_Color;
16typedef struct _Evas_Vec2 Evas_Vec2;
17typedef struct _Evas_Vec3 Evas_Vec3;
18typedef struct _Evas_Box2 Evas_Box2; 16typedef struct _Evas_Box2 Evas_Box2;
19typedef struct _Evas_Box3 Evas_Box3; 17typedef struct _Evas_Box3 Evas_Box3;
20typedef struct _Evas_Line3 Evas_Line3; 18typedef struct _Evas_Line3 Evas_Line3;
@@ -30,460 +28,64 @@ struct _Evas_Color
30 Evas_Real a; 28 Evas_Real a;
31}; 29};
32 30
33struct _Evas_Vec2
34{
35 Evas_Real x;
36 Evas_Real y;
37};
38
39struct _Evas_Vec3
40{
41 Evas_Real x;
42 Evas_Real y;
43 Evas_Real z;
44};
45
46struct _Evas_Box2 31struct _Evas_Box2
47{ 32{
48 Evas_Vec2 p0; 33 Eina_Vector2 p0;
49 Evas_Vec2 p1; 34 Eina_Vector2 p1;
50}; 35};
51 36
52struct _Evas_Box3 37struct _Evas_Box3
53{ 38{
54 Evas_Vec3 p0; 39 Eina_Vector3 p0;
55 Evas_Vec3 p1; 40 Eina_Vector3 p1;
56}; 41};
57 42
58struct _Evas_Line3 43struct _Evas_Line3
59{ 44{
60 Evas_Vec3 point; 45 Eina_Vector3 point;
61 Evas_Vec3 direction; 46 Eina_Vector3 direction;
62}; 47};
63 48
64struct _Evas_Triangle3 49struct _Evas_Triangle3
65{ 50{
66 Evas_Vec3 p0; 51 Eina_Vector3 p0;
67 Evas_Vec3 p1; 52 Eina_Vector3 p1;
68 Evas_Vec3 p2; 53 Eina_Vector3 p2;
69}; 54};
70 55
71struct _Evas_Ray3 56struct _Evas_Ray3
72{ 57{
73 Evas_Vec3 org; 58 Eina_Vector3 org;
74 Evas_Vec3 dir; 59 Eina_Vector3 dir;
75}; 60};
76 61
77struct _Evas_Sphere 62struct _Evas_Sphere
78{ 63{
79 Evas_Vec3 center; 64 Eina_Vector3 center;
80 Evas_Real radius; 65 Evas_Real radius;
81}; 66};
82 67
83/* 2D vector */
84static inline void
85evas_vec2_set(Evas_Vec2 *dst, Evas_Real x, Evas_Real y)
86{
87 dst->x = x;
88 dst->y = y;
89}
90
91static inline void
92evas_vec2_array_set(Evas_Vec2 *dst, const Evas_Real *v)
93{
94 dst->x = v[0];
95 dst->y = v[1];
96}
97
98static inline void
99evas_vec2_copy(Evas_Vec2 *dst, const Evas_Vec2 *src)
100{
101 dst->x = src->x;
102 dst->y = src->y;
103}
104
105static inline void
106evas_vec2_negate(Evas_Vec2 *out, const Evas_Vec2 *v)
107{
108 out->x = -v->x;
109 out->y = -v->y;
110}
111
112static inline void
113evas_vec2_add(Evas_Vec2 *out, const Evas_Vec2 *a, const Evas_Vec2 *b)
114{
115 out->x = a->x + b->x;
116 out->y = a->y + b->y;
117}
118
119static inline void
120evas_vec2_subtract(Evas_Vec2 *out, const Evas_Vec2 *a, const Evas_Vec2 *b)
121{
122 out->x = a->x - b->x;
123 out->y = a->y - b->y;
124}
125
126static inline void
127evas_vec2_scale(Evas_Vec2 *out, const Evas_Vec2 *v, Evas_Real scale)
128{
129 out->x = scale * v->x;
130 out->y = scale * v->y;
131}
132
133static inline Evas_Real
134evas_vec2_dot_product(const Evas_Vec2 *a, const Evas_Vec2 *b)
135{
136 return (a->x * b->x) + (a->y * b->y);
137}
138
139static inline Evas_Real
140evas_vec2_length_get(const Evas_Vec2 *v)
141{
142 return (Evas_Real)sqrt((double)((v->x * v->x) + (v->y * v->y)));
143}
144
145static inline Evas_Real
146evas_vec2_length_square_get(const Evas_Vec2 *v)
147{
148 return (v->x * v->x) + (v->y * v->y);
149}
150
151static inline Evas_Real
152evas_vec2_distance_get(const Evas_Vec2 *a, const Evas_Vec2 *b)
153{
154 Evas_Vec2 v;
155
156 evas_vec2_subtract(&v, a, b);
157 return evas_vec2_length_get(&v);
158}
159
160static inline Evas_Real
161evas_vec2_distance_square_get(const Evas_Vec2 *a, const Evas_Vec2 *b)
162{
163 Evas_Vec2 v;
164
165 evas_vec2_subtract(&v, a, b);
166 return evas_vec2_length_square_get(&v);
167}
168
169static inline void
170evas_vec2_normalize(Evas_Vec2 *out, const Evas_Vec2 *v)
171{
172 /* Assume "v" is not a zero vector */
173 evas_vec2_scale(out, v, 1.0 / evas_vec2_length_get(v));
174}
175
176static inline void
177evas_vec2_transform(Evas_Vec2 *out, const Eina_Matrix2 *m, const Evas_Vec2 *v)
178{
179 Evas_Vec2 tmp;
180
181 tmp.x = (m->xx * v->x) + (m->yx * v->y);
182 tmp.y = (m->xy * v->x) + (m->yy * v->y);
183
184 evas_vec2_copy(out, &tmp);
185}
186
187static inline void
188evas_vec2_homogeneous_position_transform(Evas_Vec2 *out, const Eina_Matrix3 *m, const Evas_Vec2 *v)
189{
190 Evas_Vec2 tmp;
191
192 tmp.x = (m->xx * v->x) + (m->yx * v->y) + m->zx;
193 tmp.y = (m->xy * v->x) + (m->yy * v->y) + m->zy;
194
195 evas_vec2_scale(out, &tmp, 1.0 / ((m->xz * v->x) + (m->yz * v->y) + m->zz));
196}
197
198static inline void
199evas_vec2_homogeneous_direction_transform(Evas_Vec2 *out, const Eina_Matrix3 *m, const Evas_Vec2 *v)
200{
201 Evas_Vec2 tmp;
202
203 tmp.x = (m->xx * v->x) + (m->yx * v->y);
204 tmp.y = (m->xy * v->x) + (m->yy * v->y);
205
206 evas_vec2_copy(out, &tmp);
207}
208
209/* 3D vector */
210static inline void
211evas_vec3_set(Evas_Vec3 *dst, Evas_Real x, Evas_Real y, Evas_Real z)
212{
213 dst->x = x;
214 dst->y = y;
215 dst->z = z;
216}
217
218static inline void
219evas_vec3_array_set(Evas_Vec3 *dst, const Evas_Real *v)
220{
221 dst->x = v[0];
222 dst->y = v[1];
223 dst->z = v[2];
224}
225
226static inline void
227evas_vec3_copy(Evas_Vec3 *dst, const Evas_Vec3 *src)
228{
229 dst->x = src->x;
230 dst->y = src->y;
231 dst->z = src->z;
232}
233
234static inline void
235evas_vec3_negate(Evas_Vec3 *out, const Evas_Vec3 *v)
236{
237 out->x = -v->x;
238 out->y = -v->y;
239 out->z = -v->z;
240}
241
242static inline void
243evas_vec3_add(Evas_Vec3 *out, const Evas_Vec3 *a, const Evas_Vec3 *b)
244{
245 out->x = a->x + b->x;
246 out->y = a->y + b->y;
247 out->z = a->z + b->z;
248}
249
250static inline void
251evas_vec3_subtract(Evas_Vec3 *out, const Evas_Vec3 *a, const Evas_Vec3 *b)
252{
253 out->x = a->x - b->x;
254 out->y = a->y - b->y;
255 out->z = a->z - b->z;
256}
257
258static inline void
259evas_vec3_scale(Evas_Vec3 *out, const Evas_Vec3 *v, Evas_Real scale)
260{
261 out->x = scale * v->x;
262 out->y = scale * v->y;
263 out->z = scale * v->z;
264}
265
266static inline void
267evas_vec3_multiply(Evas_Vec3 *out, const Evas_Vec3 *a, const Evas_Vec3 *b)
268{
269 out->x = a->x * b->x;
270 out->y = a->y * b->y;
271 out->z = a->z * b->z;
272}
273
274static inline Evas_Real
275evas_vec3_dot_product(const Evas_Vec3 *a, const Evas_Vec3 *b)
276{
277 return (a->x * b->x) + (a->y * b->y) + (a->z * b->z);
278}
279
280static inline void
281evas_vec3_cross_product(Evas_Vec3 *out, const Evas_Vec3 *a, const Evas_Vec3 *b)
282{
283 Evas_Vec3 tmp;
284
285 tmp.x = a->y * b->z - a->z * b->y;
286 tmp.y = a->z * b->x - a->x * b->z;
287 tmp.z = a->x * b->y - a->y * b->x;
288
289 evas_vec3_copy(out, &tmp);
290}
291
292static inline Evas_Real
293evas_vec3_length_get(const Evas_Vec3 *v)
294{
295 return (Evas_Real)sqrt((double)((v->x * v->x) + (v->y * v->y) + (v->z * v->z)));
296}
297
298static inline Evas_Real
299evas_vec3_length_square_get(const Evas_Vec3 *v)
300{
301 return (v->x * v->x) + (v->y * v->y) + (v->z * v->z);
302}
303
304static inline Evas_Real
305evas_vec3_distance_get(const Evas_Vec3 *a, const Evas_Vec3 *b)
306{
307 Evas_Vec3 v;
308
309 evas_vec3_subtract(&v, a, b);
310 return evas_vec3_length_get(&v);
311}
312
313static inline Evas_Real
314evas_vec3_distance_square_get(const Evas_Vec3 *a, const Evas_Vec3 *b)
315{
316 Evas_Vec3 v;
317
318 evas_vec3_subtract(&v, a, b);
319 return evas_vec3_length_square_get(&v);
320}
321
322static inline Evas_Real
323evas_vec3_angle_get(const Evas_Vec3 *a, const Evas_Vec3 *b)
324{
325 Evas_Real angle;
326
327 angle = evas_vec3_dot_product(a, b) / (evas_vec3_length_get(a) * evas_vec3_length_get(b));
328 return angle;
329}
330
331static inline void
332evas_vec3_normalize(Evas_Vec3 *out, const Evas_Vec3 *v)
333{
334 /* Assume "v" is not a zero vector */
335 evas_vec3_scale(out, v, 1.0 / evas_vec3_length_get(v));
336}
337
338static inline void
339evas_vec3_transform(Evas_Vec3 *out, const Evas_Vec3 *v, const Eina_Matrix3 *m)
340{
341 Evas_Vec3 tmp;
342
343 if (eina_matrix3_type_get(m) == EINA_MATRIX_TYPE_IDENTITY)
344 {
345 evas_vec3_copy(out, v);
346 return;
347 }
348
349 tmp.x = (m->xx * v->x) + (m->yx * v->y) + (m->zx * v->z);
350 tmp.y = (m->xy * v->x) + (m->yy * v->y) + (m->zy * v->z);
351 tmp.z = (m->xz * v->x) + (m->yz * v->y) + (m->zz * v->z);
352
353 evas_vec3_copy(out, &tmp);
354}
355
356static inline void
357evas_vec3_homogeneous_position_transform(Evas_Vec3 *out, const Evas_Vec3 *v, const Eina_Matrix4 *m)
358{
359 Evas_Vec3 tmp;
360
361 if (eina_matrix4_type_get(m) == EINA_MATRIX_TYPE_IDENTITY)
362 {
363 evas_vec3_copy(out, v);
364 return;
365 }
366
367 tmp.x = (m->xx * v->x) + (m->yx * v->y) + (m->zx * v->z) + m->wx;
368 tmp.y = (m->xy * v->x) + (m->yy * v->y) + (m->zy * v->z) + m->wy;
369 tmp.z = (m->xz * v->x) + (m->yz * v->y) + (m->zz * v->z) + m->wz;
370
371 evas_vec3_scale(out, &tmp,
372 1.0 / ((m->xw * v->x) + (m->yw * v->y) + (m->zw * v->z) + m->ww));
373}
374
375static inline void
376evas_vec3_homogeneous_direction_transform(Evas_Vec3 *out, const Evas_Vec3 *v, const Eina_Matrix4 *m)
377{
378 Evas_Vec3 tmp;
379
380 if (eina_matrix4_type_get(m) == EINA_MATRIX_TYPE_IDENTITY)
381 {
382 evas_vec3_copy(out, v);
383 return;
384 }
385
386 tmp.x = (m->xx * v->x) + (m->yx * v->y) + (m->zx * v->z);
387 tmp.y = (m->xy * v->x) + (m->yy * v->y) + (m->zy * v->z);
388 tmp.z = (m->xz * v->x) + (m->yz * v->y) + (m->zz * v->z);
389
390 evas_vec3_copy(out, &tmp);
391}
392
393static inline void
394evas_vec3_quaternion_rotate(Evas_Vec3 *out, const Evas_Vec3 *v, const Eina_Quaternion *q)
395{
396 Evas_Vec3 uv, uuv;
397 Evas_Vec3 axis;
398
399 evas_vec3_set(&axis, q->x, q->y, q->z);
400
401 evas_vec3_cross_product(&uv, &axis, v);
402 evas_vec3_cross_product(&uuv, &axis, &uv);
403
404 evas_vec3_scale(&uv, &uv, 2.0 * q->w);
405 evas_vec3_scale(&uuv, &uuv, 2.0);
406
407 out->x = v->x + uv.x + uuv.x;
408 out->y = v->y + uv.y + uuv.y;
409 out->z = v->z + uv.z + uuv.z;
410}
411
412static inline void
413evas_vec3_orthogonal_projection_on_plain(Evas_Vec3 *out, const Evas_Vec3 *v, const Evas_Vec3 *normal)
414{
415 Evas_Real a;
416 Evas_Vec3 projection;
417
418 /* Orthoprojection of vector on the plane is the difference
419 between a vector and its orthogonal projection onto the orthogonal
420 complement to the plane */
421 a = evas_vec3_dot_product(v, normal) / evas_vec3_length_square_get(normal);
422 evas_vec3_scale(&projection, normal, a);
423 evas_vec3_subtract(out, v, &projection);
424
425 return;
426}
427
428static inline void
429evas_vec3_plain_by_points(Eina_Quaternion *out, const Evas_Vec3 *a, const Evas_Vec3 *b, const Evas_Vec3 *c)
430{
431 out->x = (b->y - a->y) * (c->z - a->z) - (b->z - a->z) * (c->y - a->y);
432 out->y = -(b->x - a->x) * (c->z - a->z) + (b->z - a->z) * (c->x - a->x);
433 out->z = (b->x - a->x) * (c->y - a->y) - (b->y - a->y) * (c->x - a->x);
434 out->w = (-a->x) * ((b->y - a->y)*(c->z - a->z) - (b->z - a->z) * (c->y - a->y)) -
435 (-a->y) * ((b->x - a->x) * (c->z - a->z) - (b->z - a->z) * (c->x - a->x)) +
436 (-a->z) * ((b->x - a->x) * (c->y - a->y) - (b->y - a->y) * (c->x - a->x));
437}
438
439static inline void
440evas_vec3_homogeneous_position_set(Evas_Vec3 *out, const Eina_Quaternion *v)
441{
442 /* Assume "v" is a positional vector. (v->w != 0.0) */
443 Evas_Real h = 1.0 / v->w;
444
445 out->x = v->x * h;
446 out->y = v->y * h;
447 out->z = v->z * h;
448}
449
450static inline void
451evas_vec3_homogeneous_direction_set(Evas_Vec3 *out, const Eina_Quaternion *v)
452{
453 /* Assume "v" is a directional vector. (v->w == 0.0) */
454 out->x = v->x;
455 out->y = v->y;
456 out->z = v->z;
457}
458
459static inline Eina_Bool
460evas_vec3_if_equivalent(Evas_Vec3 *a, const Evas_Vec3 *b)
461{
462 /* Assume "v" is a directional vector. (v->w == 0.0) */
463 return ((a->x == b->x) && (a->y == b->y) && (a->z == b->z));
464}
465
466static inline void 68static inline void
467evas_triangle3_set(Evas_Triangle3 *v, Evas_Vec3 *a, Evas_Vec3 *b, Evas_Vec3 *c) 69evas_triangle3_set(Evas_Triangle3 *v, Eina_Vector3 *a, Eina_Vector3 *b, Eina_Vector3 *c)
468{ 70{
469 evas_vec3_copy(&v->p0, a); 71 eina_vector3_copy(&v->p0, a);
470 evas_vec3_copy(&v->p1, b); 72 eina_vector3_copy(&v->p1, b);
471 evas_vec3_copy(&v->p2, c); 73 eina_vector3_copy(&v->p2, c);
472} 74}
473 75
474static inline Eina_Bool 76static inline Eina_Bool
475evas_triangle3_is_line(Evas_Triangle3 *v) 77evas_triangle3_is_line(Evas_Triangle3 *v)
476{ 78{
477 if (evas_vec3_if_equivalent(&v->p0, &v->p1) || 79 if (eina_vector3_equivalent(&v->p0, &v->p1) ||
478 evas_vec3_if_equivalent(&v->p0, &v->p2) || 80 eina_vector3_equivalent(&v->p0, &v->p2) ||
479 evas_vec3_if_equivalent(&v->p1, &v->p2)) 81 eina_vector3_equivalent(&v->p1, &v->p2))
480 return EINA_TRUE; 82 return EINA_TRUE;
481 83
482 return EINA_FALSE; 84 return EINA_FALSE;
483} 85}
484 86
485static inline Eina_Bool 87static inline Eina_Bool
486convex_hull_triangle3_if_not_first_edje(Evas_Triangle3 *v, Evas_Vec3 *a, Evas_Vec3 *b) 88convex_hull_triangle3_not_first_edje(Evas_Triangle3 *v, Eina_Vector3 *a, Eina_Vector3 *b)
487{ 89{
488 if (((v->p1.x == a->x) && (v->p1.y == a->y) && (v->p1.z == a->z)) && 90 if (((v->p1.x == a->x) && (v->p1.y == a->y) && (v->p1.z == a->z)) &&
489 ((v->p2.x == b->x) && (v->p2.y == b->y) && (v->p2.z == b->z))) 91 ((v->p2.x == b->x) && (v->p2.y == b->y) && (v->p2.z == b->z)))
@@ -496,7 +98,7 @@ convex_hull_triangle3_if_not_first_edje(Evas_Triangle3 *v, Evas_Vec3 *a, Evas_Ve
496} 98}
497 99
498static inline Eina_Bool 100static inline Eina_Bool
499convex_hull_triangle3_if_first_edje(Evas_Triangle3 *v, Evas_Vec3 *a, Evas_Vec3 *b) 101convex_hull_triangle3_first_edje(Evas_Triangle3 *v, Eina_Vector3 *a, Eina_Vector3 *b)
500{ 102{
501 if ((!FLT_COMPARISON(v->p0.x, a->x) && !FLT_COMPARISON(v->p0.y, a->y) && 103 if ((!FLT_COMPARISON(v->p0.x, a->x) && !FLT_COMPARISON(v->p0.y, a->y) &&
502 !FLT_COMPARISON(v->p0.z, a->z)) && (!FLT_COMPARISON(v->p1.x, b->x) && 104 !FLT_COMPARISON(v->p0.z, a->z)) && (!FLT_COMPARISON(v->p1.x, b->x) &&
@@ -511,14 +113,14 @@ convex_hull_triangle3_if_first_edje(Evas_Triangle3 *v, Evas_Vec3 *a, Evas_Vec3 *
511} 113}
512 114
513static inline Eina_Bool 115static inline Eina_Bool
514convex_hull_triangle3_if_first_point(Evas_Triangle3 *v, Evas_Vec3 *a) 116convex_hull_triangle3_first_point(Evas_Triangle3 *v, Eina_Vector3 *a)
515{ 117{
516 return ((v->p0.x == a->x) && (v->p0.y == a->y) && (v->p0.z == a->z)); 118 return ((v->p0.x == a->x) && (v->p0.y == a->y) && (v->p0.z == a->z));
517} 119}
518 120
519static inline Eina_Bool 121static inline Eina_Bool
520evas_vec3_if_equivalent_as_triangle(Evas_Vec3 *v0, Evas_Vec3 *v1, Evas_Vec3 *v2, 122eina_vector3_equivalent_as_triangle(Eina_Vector3 *v0, Eina_Vector3 *v1, Eina_Vector3 *v2,
521 Evas_Vec3 *w0, Evas_Vec3 *w1, Evas_Vec3 *w2) 123 Eina_Vector3 *w0, Eina_Vector3 *w1, Eina_Vector3 *w2)
522{ 124{
523 if (((v0->x == w0->x) && (v0->y == w0->y) && (v0->z == w0->z)) && 125 if (((v0->x == w0->x) && (v0->y == w0->y) && (v0->z == w0->z)) &&
524 ((v1->x == w1->x) && (v1->y == w1->y) && (v1->z == w1->z)) && 126 ((v1->x == w1->x) && (v1->y == w1->y) && (v1->z == w1->z)) &&
@@ -529,16 +131,16 @@ evas_vec3_if_equivalent_as_triangle(Evas_Vec3 *v0, Evas_Vec3 *v1, Evas_Vec3 *v2,
529} 131}
530 132
531static inline Eina_Bool 133static inline Eina_Bool
532evas_triangle3_if_equivalent(Evas_Triangle3 *a, Evas_Triangle3 *b) 134evas_triangle3_equivalent(Evas_Triangle3 *a, Evas_Triangle3 *b)
533{ 135{
534 /* to compare two triangles there are six permutations 136 /* to compare two triangles there are six permutations
535 to test because vertices are unordered */ 137 to test because vertices are unordered */
536 if (evas_vec3_if_equivalent_as_triangle(&a->p0, &a->p1, &a->p2, &b->p0, &b->p1, &b->p2) || 138 if (eina_vector3_equivalent_as_triangle(&a->p0, &a->p1, &a->p2, &b->p0, &b->p1, &b->p2) ||
537 evas_vec3_if_equivalent_as_triangle(&a->p0, &a->p1, &a->p2, &b->p0, &b->p2, &b->p1) || 139 eina_vector3_equivalent_as_triangle(&a->p0, &a->p1, &a->p2, &b->p0, &b->p2, &b->p1) ||
538 evas_vec3_if_equivalent_as_triangle(&a->p0, &a->p1, &a->p2, &b->p1, &b->p0, &b->p2) || 140 eina_vector3_equivalent_as_triangle(&a->p0, &a->p1, &a->p2, &b->p1, &b->p0, &b->p2) ||
539 evas_vec3_if_equivalent_as_triangle(&a->p0, &a->p1, &a->p2, &b->p1, &b->p2, &b->p0) || 141 eina_vector3_equivalent_as_triangle(&a->p0, &a->p1, &a->p2, &b->p1, &b->p2, &b->p0) ||
540 evas_vec3_if_equivalent_as_triangle(&a->p0, &a->p1, &a->p2, &b->p2, &b->p0, &b->p1) || 142 eina_vector3_equivalent_as_triangle(&a->p0, &a->p1, &a->p2, &b->p2, &b->p0, &b->p1) ||
541 evas_vec3_if_equivalent_as_triangle(&a->p0, &a->p1, &a->p2, &b->p2, &b->p1, &b->p0)) 143 eina_vector3_equivalent_as_triangle(&a->p0, &a->p1, &a->p2, &b->p2, &b->p1, &b->p0))
542 return EINA_TRUE; 144 return EINA_TRUE;
543 145
544 return EINA_FALSE; 146 return EINA_FALSE;
@@ -546,18 +148,18 @@ evas_triangle3_if_equivalent(Evas_Triangle3 *a, Evas_Triangle3 *b)
546 148
547static inline void 149static inline void
548evas_mat4_look_at_set(Eina_Matrix4 *m, 150evas_mat4_look_at_set(Eina_Matrix4 *m,
549 const Evas_Vec3 *pos, const Evas_Vec3 *center, const Evas_Vec3 *up) 151 const Eina_Vector3 *pos, const Eina_Vector3 *center, const Eina_Vector3 *up)
550{ 152{
551 Evas_Vec3 x, y, z; 153 Eina_Vector3 x, y, z;
552 154
553 evas_vec3_subtract(&z, pos, center); 155 eina_vector3_subtract(&z, pos, center);
554 evas_vec3_normalize(&z, &z); 156 eina_vector3_normalize(&z, &z);
555 157
556 evas_vec3_cross_product(&x, up, &z); 158 eina_vector3_cross_product(&x, up, &z);
557 evas_vec3_normalize(&x, &x); 159 eina_vector3_normalize(&x, &x);
558 160
559 evas_vec3_cross_product(&y, &z, &x); 161 eina_vector3_cross_product(&y, &z, &x);
560 evas_vec3_normalize(&y, &y); 162 eina_vector3_normalize(&y, &y);
561 163
562 m->xx = x.x; 164 m->xx = x.x;
563 m->xy = y.x; 165 m->xy = y.x;
@@ -574,9 +176,9 @@ evas_mat4_look_at_set(Eina_Matrix4 *m,
574 m->zz = z.z; 176 m->zz = z.z;
575 m->zw = 0.0; 177 m->zw = 0.0;
576 178
577 m->wx = -evas_vec3_dot_product(&x, pos); 179 m->wx = -eina_vector3_dot_product(&x, pos);
578 m->wy = -evas_vec3_dot_product(&y, pos); 180 m->wy = -eina_vector3_dot_product(&y, pos);
579 m->wz = -evas_vec3_dot_product(&z, pos); 181 m->wz = -eina_vector3_dot_product(&z, pos);
580 m->ww = 1.0; 182 m->ww = 1.0;
581} 183}
582 184
@@ -636,22 +238,22 @@ evas_box3_set(Evas_Box3 *box, Evas_Real x0, Evas_Real y0, Evas_Real z0,
636static inline void 238static inline void
637evas_box3_empty_set(Evas_Box3 *box) 239evas_box3_empty_set(Evas_Box3 *box)
638{ 240{
639 evas_vec3_set(&box->p0, 0.0, 0.0, 0.0); 241 eina_vector3_set(&box->p0, 0.0, 0.0, 0.0);
640 evas_vec3_set(&box->p1, 0.0, 0.0, 0.0); 242 eina_vector3_set(&box->p1, 0.0, 0.0, 0.0);
641} 243}
642 244
643static inline void 245static inline void
644evas_box3_copy(Evas_Box3 *dst, const Evas_Box3 *src) 246evas_box3_copy(Evas_Box3 *dst, const Evas_Box3 *src)
645{ 247{
646 evas_vec3_copy(&dst->p0, &src->p0); 248 eina_vector3_copy(&dst->p0, &src->p0);
647 evas_vec3_copy(&dst->p1, &src->p1); 249 eina_vector3_copy(&dst->p1, &src->p1);
648} 250}
649 251
650static inline void 252static inline void
651evas_box3_union(Evas_Box3 *out, const Evas_Box3 *a, const Evas_Box3 *b) 253evas_box3_union(Evas_Box3 *out, const Evas_Box3 *a, const Evas_Box3 *b)
652{ 254{
653 evas_vec3_set(&out->p0, MIN(a->p0.x, b->p0.x), MIN(a->p0.y, b->p0.y), MIN(a->p0.z, b->p0.z)); 255 eina_vector3_set(&out->p0, MIN(a->p0.x, b->p0.x), MIN(a->p0.y, b->p0.y), MIN(a->p0.z, b->p0.z));
654 evas_vec3_set(&out->p1, MAX(a->p1.x, b->p1.x), MAX(a->p1.y, b->p1.y), MAX(a->p1.z, b->p1.z)); 256 eina_vector3_set(&out->p1, MAX(a->p1.x, b->p1.x), MAX(a->p1.y, b->p1.y), MAX(a->p1.z, b->p1.z));
655} 257}
656 258
657static inline void 259static inline void
@@ -674,7 +276,7 @@ evas_mat4_position_get(const Eina_Matrix4 *matrix, Eina_Quaternion *position)
674} 276}
675 277
676static inline void 278static inline void
677evas_mat4_direction_get(const Eina_Matrix4 *matrix, Evas_Vec3 *direction) 279evas_mat4_direction_get(const Eina_Matrix4 *matrix, Eina_Vector3 *direction)
678{ 280{
679 /* TODO: Check correctness. */ 281 /* TODO: Check correctness. */
680 282
@@ -694,7 +296,7 @@ evas_mat4_direction_get(const Eina_Matrix4 *matrix, Evas_Vec3 *direction)
694 296
695static inline void 297static inline void
696evas_mat4_build(Eina_Matrix4 *out, 298evas_mat4_build(Eina_Matrix4 *out,
697 const Evas_Vec3 *position, const Eina_Quaternion *orientation, const Evas_Vec3 *scale) 299 const Eina_Vector3 *position, const Eina_Quaternion *orientation, const Eina_Vector3 *scale)
698{ 300{
699 Eina_Matrix3 rot; 301 Eina_Matrix3 rot;
700 302
@@ -722,25 +324,25 @@ evas_mat4_build(Eina_Matrix4 *out,
722} 324}
723 325
724static inline void 326static inline void
725evas_mat4_inverse_build(Eina_Matrix4 *out, const Evas_Vec3 *position, 327evas_mat4_inverse_build(Eina_Matrix4 *out, const Eina_Vector3 *position,
726 const Eina_Quaternion *orientation, const Evas_Vec3 *scale) 328 const Eina_Quaternion *orientation, const Eina_Vector3 *scale)
727{ 329{
728 Eina_Quaternion inv_rotation; 330 Eina_Quaternion inv_rotation;
729 Evas_Vec3 inv_scale; 331 Eina_Vector3 inv_scale;
730 Evas_Vec3 inv_translate; 332 Eina_Vector3 inv_translate;
731 333
732 Eina_Matrix3 rot; 334 Eina_Matrix3 rot;
733 335
734 /* Inverse scale. */ 336 /* Inverse scale. */
735 evas_vec3_set(&inv_scale, 1.0 / scale->x, 1.0 / scale->y, 1.0 / scale->z); 337 eina_vector3_set(&inv_scale, 1.0 / scale->x, 1.0 / scale->y, 1.0 / scale->z);
736 338
737 /* Inverse rotation. */ 339 /* Inverse rotation. */
738 eina_quaternion_inverse(&inv_rotation, orientation); 340 eina_quaternion_inverse(&inv_rotation, orientation);
739 341
740 /* Inverse translation. */ 342 /* Inverse translation. */
741 evas_vec3_negate(&inv_translate, position); 343 eina_vector3_negate(&inv_translate, position);
742 evas_vec3_quaternion_rotate(&inv_translate, &inv_translate, &inv_rotation); 344 eina_vector3_quaternion_rotate(&inv_translate, &inv_translate, &inv_rotation);
743 evas_vec3_multiply(&inv_translate, &inv_translate, &inv_scale); 345 eina_vector3_multiply(&inv_translate, &inv_translate, &inv_scale);
744 346
745 /* Get 3x3 rotation matrix. */ 347 /* Get 3x3 rotation matrix. */
746 eina_quaternion_rotation_matrix3_get(&rot, &inv_rotation); 348 eina_quaternion_rotation_matrix3_get(&rot, &inv_rotation);
@@ -809,7 +411,7 @@ evas_ray3_init(Evas_Ray3 *ray, Evas_Real x, Evas_Real y, const Eina_Matrix4 *mvp
809 dnear.y *= dnear.w; 411 dnear.y *= dnear.w;
810 dnear.z *= dnear.w; 412 dnear.z *= dnear.w;
811 413
812 evas_vec3_set(&ray->org, dnear.x, dnear.y, dnear.z); 414 eina_vector3_set(&ray->org, dnear.x, dnear.y, dnear.z);
813 415
814 /* Transform far point. */ 416 /* Transform far point. */
815 dfar.x = x; 417 dfar.x = x;
@@ -824,11 +426,11 @@ evas_ray3_init(Evas_Ray3 *ray, Evas_Real x, Evas_Real y, const Eina_Matrix4 *mvp
824 dfar.y *= dfar.w; 426 dfar.y *= dfar.w;
825 dfar.z *= dfar.w; 427 dfar.z *= dfar.w;
826 428
827 evas_vec3_set(&ray->dir, dfar.x - dnear.x, dfar.y - dnear.y, dfar.z - dnear.z); 429 eina_vector3_set(&ray->dir, dfar.x - dnear.x, dfar.y - dnear.y, dfar.z - dnear.z);
828} 430}
829 431
830static inline Eina_Bool 432static inline Eina_Bool
831evas_box2_intersect_2d(const Evas_Box2 *box, const Evas_Vec2 *org, const Evas_Vec2 *dir) 433evas_box2_intersect_2d(const Evas_Box2 *box, const Eina_Vector2 *org, const Eina_Vector2 *dir)
832{ 434{
833 Evas_Real t1, t2, t_near = FLT_MIN, t_far = FLT_MAX; 435 Evas_Real t1, t2, t_near = FLT_MIN, t_far = FLT_MAX;
834 /* ray intersects box if its begins in */ 436 /* ray intersects box if its begins in */
@@ -900,8 +502,8 @@ evas_box3_ray3_intersect(const Evas_Box3 *box, const Evas_Ray3 *ray)
900{ 502{
901 Evas_Real t1, t2, t_near = FLT_MIN, t_far = FLT_MAX; 503 Evas_Real t1, t2, t_near = FLT_MIN, t_far = FLT_MAX;
902 Evas_Box2 box2; 504 Evas_Box2 box2;
903 Evas_Vec2 org2; 505 Eina_Vector2 org2;
904 Evas_Vec2 dir2; 506 Eina_Vector2 dir2;
905 Eina_Bool intersect = EINA_FALSE; 507 Eina_Bool intersect = EINA_FALSE;
906 508
907 /* ray intersects box if its begins in */ 509 /* ray intersects box if its begins in */
@@ -974,8 +576,8 @@ evas_box3_ray3_intersect(const Evas_Box3 *box, const Evas_Ray3 *ray)
974 return EINA_FALSE; 576 return EINA_FALSE;
975 else 577 else
976 { 578 {
977 evas_vec2_set(&org2, ray->org.y, ray->org.z); 579 eina_vector2_set(&org2, ray->org.y, ray->org.z);
978 evas_vec2_set(&dir2, ray->dir.y, ray->dir.z); 580 eina_vector2_set(&dir2, ray->dir.y, ray->dir.z);
979 evas_box2_set(&box2, box->p0.y, box->p0.z, box->p1.y, box->p1.z); 581 evas_box2_set(&box2, box->p0.y, box->p0.z, box->p1.y, box->p1.z);
980 intersect = evas_box2_intersect_2d(&box2, &org2, &dir2); 582 intersect = evas_box2_intersect_2d(&box2, &org2, &dir2);
981 } 583 }
@@ -987,8 +589,8 @@ evas_box3_ray3_intersect(const Evas_Box3 *box, const Evas_Ray3 *ray)
987 return EINA_FALSE; 589 return EINA_FALSE;
988 else 590 else
989 { 591 {
990 evas_vec2_set(&org2, ray->org.x, ray->org.z); 592 eina_vector2_set(&org2, ray->org.x, ray->org.z);
991 evas_vec2_set(&dir2, ray->dir.x, ray->dir.z); 593 eina_vector2_set(&dir2, ray->dir.x, ray->dir.z);
992 evas_box2_set(&box2, box->p0.x, box->p0.z, box->p1.x, box->p1.z); 594 evas_box2_set(&box2, box->p0.x, box->p0.z, box->p1.x, box->p1.z);
993 intersect = evas_box2_intersect_2d(&box2, &org2, &dir2); 595 intersect = evas_box2_intersect_2d(&box2, &org2, &dir2);
994 } 596 }
@@ -1000,8 +602,8 @@ evas_box3_ray3_intersect(const Evas_Box3 *box, const Evas_Ray3 *ray)
1000 return EINA_FALSE; 602 return EINA_FALSE;
1001 else 603 else
1002 { 604 {
1003 evas_vec2_set(&org2, ray->org.x, ray->org.y); 605 eina_vector2_set(&org2, ray->org.x, ray->org.y);
1004 evas_vec2_set(&dir2, ray->dir.x, ray->dir.y); 606 eina_vector2_set(&dir2, ray->dir.x, ray->dir.y);
1005 evas_box2_set(&box2, box->p0.x, box->p0.y, box->p1.x, box->p1.y); 607 evas_box2_set(&box2, box->p0.x, box->p0.y, box->p1.x, box->p1.y);
1006 intersect = evas_box2_intersect_2d(&box2, &org2, &dir2); 608 intersect = evas_box2_intersect_2d(&box2, &org2, &dir2);
1007 } 609 }
@@ -1027,12 +629,12 @@ evas_reciprocal_sqrt(Evas_Real x)
1027static inline void 629static inline void
1028evas_build_sphere(const Evas_Box3 *box, Evas_Sphere *sphere) 630evas_build_sphere(const Evas_Box3 *box, Evas_Sphere *sphere)
1029{ 631{
1030 Evas_Vec3 tmp; 632 Eina_Vector3 tmp;
1031 633
1032 evas_vec3_set(&sphere->center, (0.5 * (box->p0.x + box->p1.x)), (0.5 * (box->p0.y + box->p1.y)), (0.5 * (box->p0.z + box->p1.z))); 634 eina_vector3_set(&sphere->center, (0.5 * (box->p0.x + box->p1.x)), (0.5 * (box->p0.y + box->p1.y)), (0.5 * (box->p0.z + box->p1.z)));
1033 evas_vec3_set(&tmp, sphere->center.x - box->p0.x, sphere->center.y - box->p0.y, sphere->center.z - box->p0.z); 635 eina_vector3_set(&tmp, sphere->center.x - box->p0.x, sphere->center.y - box->p0.y, sphere->center.z - box->p0.z);
1034 636
1035 sphere->radius = sqrtf(evas_vec3_dot_product(&tmp, &tmp)); 637 sphere->radius = sqrtf(eina_vector3_dot_product(&tmp, &tmp));
1036} 638}
1037 639
1038static inline void 640static inline void
@@ -1047,10 +649,10 @@ evas_sphere_empty_set(Evas_Sphere *dst)
1047static inline void 649static inline void
1048evas_plane_normalize(Eina_Quaternion *plane) 650evas_plane_normalize(Eina_Quaternion *plane)
1049{ 651{
1050 Evas_Vec3 tmp; 652 Eina_Vector3 tmp;
1051 Evas_Real length; 653 Evas_Real length;
1052 evas_vec3_set(&tmp, plane->x, plane->y, plane->z); 654 eina_vector3_set(&tmp, plane->x, plane->y, plane->z);
1053 length = evas_vec3_length_get(&tmp); 655 length = eina_vector3_length_get(&tmp);
1054 plane->x = plane->x / length; 656 plane->x = plane->x / length;
1055 plane->y = plane->y / length; 657 plane->y = plane->y / length;
1056 plane->z = plane->z / length; 658 plane->z = plane->z / length;
@@ -1058,15 +660,15 @@ evas_plane_normalize(Eina_Quaternion *plane)
1058} 660}
1059 661
1060static inline Eina_Bool 662static inline Eina_Bool
1061evas_intersection_line_of_two_planes(Evas_Line3 *line, Eina_Quaternion *plane1, Eina_Quaternion *plane2) 663evas_intersection_line_of_two_plains(Evas_Line3 *line, Eina_Quaternion *plane1, Eina_Quaternion *plane2)
1062{ 664{
1063 //TODO:parallel case 665 //TODO:parallel case
1064 Evas_Vec3 planes3D[2]; 666 Eina_Vector3 planes3D[2];
1065 667
1066 evas_vec3_set(&planes3D[0], plane1->x, plane1->y, plane1->z); 668 eina_vector3_set(&planes3D[0], plane1->x, plane1->y, plane1->z);
1067 evas_vec3_set(&planes3D[1], plane2->x, plane2->y, plane2->z); 669 eina_vector3_set(&planes3D[1], plane2->x, plane2->y, plane2->z);
1068 670
1069 evas_vec3_cross_product(&line->direction, &planes3D[0], &planes3D[1]); 671 eina_vector3_cross_product(&line->direction, &planes3D[0], &planes3D[1]);
1070 672
1071#define SOLVE_EQUATION(x, y, z) \ 673#define SOLVE_EQUATION(x, y, z) \
1072 line->point.x = 0; \ 674 line->point.x = 0; \
@@ -1091,7 +693,7 @@ evas_intersection_line_of_two_planes(Evas_Line3 *line, Eina_Quaternion *plane1,
1091} 693}
1092 694
1093static inline Eina_Bool 695static inline Eina_Bool
1094evas_intersection_point_of_three_planes(Evas_Vec3 *point, Eina_Quaternion *plane1, Eina_Quaternion *plane2, Eina_Quaternion *plane3) 696evas_intersection_point_of_three_plains(Eina_Vector3 *point, Eina_Quaternion *plane1, Eina_Quaternion *plane2, Eina_Quaternion *plane3)
1095{ 697{
1096 //TODO:parallel case 698 //TODO:parallel case
1097 int i; 699 int i;
@@ -1129,26 +731,26 @@ evas_intersection_point_of_three_planes(Evas_Vec3 *point, Eina_Quaternion *plane
1129 } 731 }
1130 deltaz = evas_determinant_3D(matrix_to_det); 732 deltaz = evas_determinant_3D(matrix_to_det);
1131 733
1132 evas_vec3_set(point, -deltax/delta, -deltay/delta, -deltaz/delta); 734 eina_vector3_set(point, -deltax/delta, -deltay/delta, -deltaz/delta);
1133 735
1134 return EINA_TRUE; 736 return EINA_TRUE;
1135} 737}
1136 738
1137static inline Evas_Real 739static inline Evas_Real
1138evas_point_plane_distance(Evas_Vec3 *point, Eina_Quaternion *plane) 740evas_point_plane_distance(Eina_Vector3 *point, Eina_Quaternion *plane)
1139{ 741{
1140 return plane->x * point->x + plane->y * point->y + plane->z * point->z + plane->w; 742 return plane->x * point->x + plane->y * point->y + plane->z * point->z + plane->w;
1141} 743}
1142 744
1143static inline Evas_Real 745static inline Evas_Real
1144evas_point_line_distance(Evas_Vec3 *point, Evas_Line3 *line) 746evas_point_line_distance(Eina_Vector3 *point, Evas_Line3 *line)
1145{ 747{
1146 Evas_Vec3 temp, sub; 748 Eina_Vector3 temp, sub;
1147 749
1148 evas_vec3_subtract(&sub, point, &line->point); 750 eina_vector3_subtract(&sub, point, &line->point);
1149 evas_vec3_cross_product(&temp, &sub, &line->direction); 751 eina_vector3_cross_product(&temp, &sub, &line->direction);
1150 752
1151 return evas_vec3_length_get(&temp) / evas_vec3_length_get(&line->direction); 753 return eina_vector3_length_get(&temp) / eina_vector3_length_get(&line->direction);
1152} 754}
1153 755
1154static inline Eina_Bool 756static inline Eina_Bool
@@ -1156,10 +758,10 @@ evas_is_sphere_in_frustum(Evas_Sphere *bsphere, Eina_Quaternion *planes)
1156{ 758{
1157 int i; 759 int i;
1158 Evas_Line3 line; 760 Evas_Line3 line;
1159 Evas_Vec3 point, sub; 761 Eina_Vector3 point, sub;
1160 Evas_Real distances[6] = {0}; 762 Evas_Real distances[6] = {0};
1161 int intersected_planes[3]; 763 int intersected_plains[3];
1162 int intersected_planes_count = 0; 764 int intersected_plains_count = 0;
1163 765
1164 for (i = 0; i < 6; i++) 766 for (i = 0; i < 6; i++)
1165 distances[i] = evas_point_plane_distance(&bsphere->center, &planes[i]); 767 distances[i] = evas_point_plane_distance(&bsphere->center, &planes[i]);
@@ -1172,33 +774,33 @@ evas_is_sphere_in_frustum(Evas_Sphere *bsphere, Eina_Quaternion *planes)
1172 } 774 }
1173 else if (distances[i] <= 0) 775 else if (distances[i] <= 0)
1174 { 776 {
1175 intersected_planes[intersected_planes_count] = i; 777 intersected_plains[intersected_plains_count] = i;
1176 intersected_planes_count++; 778 intersected_plains_count++;
1177 } 779 }
1178 } 780 }
1179 781
1180 switch (intersected_planes_count) 782 switch (intersected_plains_count)
1181 { 783 {
1182 case 2: 784 case 2:
1183 evas_intersection_line_of_two_planes(&line, 785 evas_intersection_line_of_two_plains(&line,
1184 &planes[intersected_planes[0]], 786 &planes[intersected_plains[0]],
1185 &planes[intersected_planes[1]]); 787 &planes[intersected_plains[1]]);
1186 return (evas_point_line_distance(&bsphere->center, &line) < 788 return (evas_point_line_distance(&bsphere->center, &line) <
1187 bsphere->radius) ? EINA_TRUE : EINA_FALSE; 789 bsphere->radius) ? EINA_TRUE : EINA_FALSE;
1188 case 3: 790 case 3:
1189 evas_intersection_point_of_three_planes(&point, 791 evas_intersection_point_of_three_plains(&point,
1190 &planes[intersected_planes[0]], 792 &planes[intersected_plains[0]],
1191 &planes[intersected_planes[1]], 793 &planes[intersected_plains[1]],
1192 &planes[intersected_planes[2]]); 794 &planes[intersected_plains[2]]);
1193 evas_vec3_subtract(&sub, &point, &bsphere->center); 795 eina_vector3_subtract(&sub, &point, &bsphere->center);
1194 return (evas_vec3_length_get(&sub) < bsphere->radius) ? EINA_TRUE : EINA_FALSE; 796 return (eina_vector3_length_get(&sub) < bsphere->radius) ? EINA_TRUE : EINA_FALSE;
1195 default: 797 default:
1196 return EINA_TRUE; 798 return EINA_TRUE;
1197 } 799 }
1198} 800}
1199 801
1200static inline Eina_Bool 802static inline Eina_Bool
1201evas_is_point_in_frustum(Evas_Vec3 *point, Eina_Quaternion *planes) 803evas_is_point_in_frustum(Eina_Vector3 *point, Eina_Quaternion *planes)
1202{ 804{
1203 int i; 805 int i;
1204 for (i = 0; i < 6; i++) 806 for (i = 0; i < 6; i++)
@@ -1282,40 +884,40 @@ box_intersection_box(Evas_Box3 *v1, Evas_Box3 *v2)
1282} 884}
1283 885
1284static inline void 886static inline void
1285tangent_new_basis(Evas_Vec3 *out, Evas_Triangle3 *triangle, 887tangent_new_basis(Eina_Vector3 *out, Evas_Triangle3 *triangle,
1286 Evas_Vec2 *a, Evas_Vec2 *b, Evas_Vec2 *c) 888 Eina_Vector2 *a, Eina_Vector2 *b, Eina_Vector2 *c)
1287{ 889{
1288 Evas_Vec2 new1, new2; 890 Eina_Vector2 new1, new2;
1289 Evas_Vec3 old1, old2; 891 Eina_Vector3 old1, old2;
1290 evas_vec3_set(out, 0, 0, 0); 892 eina_vector3_set(out, 0, 0, 0);
1291 893
1292 evas_vec2_subtract(&new1, b, a); 894 eina_vector2_subtract(&new1, b, a);
1293 evas_vec2_subtract(&new2, c, a); 895 eina_vector2_subtract(&new2, c, a);
1294 evas_vec3_subtract(&old1, &(triangle->p1), &(triangle->p0)); 896 eina_vector3_subtract(&old1, &(triangle->p1), &(triangle->p0));
1295 evas_vec3_subtract(&old2, &(triangle->p2), &(triangle->p0)); 897 eina_vector3_subtract(&old2, &(triangle->p2), &(triangle->p0));
1296 898
1297 899
1298 /* calculation of new basis(in system coordinates of texturing) by solution of system of equations */ 900 /* calculation of new basis(in system coordinates of texturing) by solution of system of equations */
1299 if (new2.y != 0) 901 if (new2.y != 0)
1300 { 902 {
1301 evas_vec3_scale(&old2, &old2, (new1.y / new2.y)); 903 eina_vector3_scale(&old2, &old2, (new1.y / new2.y));
1302 evas_vec2_scale(&new2, &new2, (new1.y / new2.y)); 904 eina_vector2_scale(&new2, &new2, (new1.y / new2.y));
1303 905
1304 evas_vec2_subtract(&new1, &new1, &new2); 906 eina_vector2_subtract(&new1, &new1, &new2);
1305 evas_vec3_subtract(&old1, &old1, &old2); 907 eina_vector3_subtract(&old1, &old1, &old2);
1306 908
1307 evas_vec3_scale(out, &old1, 1 / new1.x); 909 eina_vector3_scale(out, &old1, 1 / new1.x);
1308 } 910 }
1309 911
1310 else if (new1.y != 0) 912 else if (new1.y != 0)
1311 { 913 {
1312 evas_vec3_scale(&old1, &old1, (new2.y / new1.y)); 914 eina_vector3_scale(&old1, &old1, (new2.y / new1.y));
1313 evas_vec2_scale(&new1, &new1, (new2.y / new1.y)); 915 eina_vector2_scale(&new1, &new1, (new2.y / new1.y));
1314 916
1315 evas_vec2_subtract(&new2, &new2, &new1); 917 eina_vector2_subtract(&new2, &new2, &new1);
1316 evas_vec3_subtract(&old2, &old2, &old1); 918 eina_vector3_subtract(&old2, &old2, &old1);
1317 919
1318 evas_vec3_scale(out, &old2, 1 / new2.x); 920 eina_vector3_scale(out, &old2, 1 / new2.x);
1319 } 921 }
1320 922
1321 return; 923 return;
@@ -1326,7 +928,7 @@ convex_hull_vertex_set(Evas_Triangle3 *el, unsigned short int *vertex_count, flo
1326 unsigned short int **index, unsigned int k, int *leader, int coord) 928 unsigned short int **index, unsigned int k, int *leader, int coord)
1327{ 929{
1328 int color_coords, normal_coords; 930 int color_coords, normal_coords;
1329 Evas_Vec3 vect = {0, 0, 0}; 931 Eina_Vector3 vect = {0, 0, 0};
1330 switch (coord) 932 switch (coord)
1331 { 933 {
1332 case 0: 934 case 0:
@@ -1363,17 +965,17 @@ convex_hull_first_tr_get(float *data, int count, int stride)
1363{ 965{
1364 Evas_Triangle3 out; 966 Evas_Triangle3 out;
1365 967
1366 Evas_Vec3 triangle1; 968 Eina_Vector3 triangle1;
1367 Evas_Vec3 triangle2, triangle2_candidate; 969 Eina_Vector3 triangle2, triangle2_candidate;
1368 Evas_Vec3 triangle3, triangle3_candidate; 970 Eina_Vector3 triangle3, triangle3_candidate;
1369 Evas_Vec3 first, diagonal, complanar1, complanar2, candidate; 971 Eina_Vector3 first, diagonal, complanar1, complanar2, candidate;
1370 Eina_Quaternion normal_a, normal_b; 972 Eina_Quaternion normal_a, normal_b;
1371 973
1372 Evas_Real cos = 0.0, new_cos = 0.0, sin = 0.0, new_sin = 0.0, cos_2d = 0.0, new_cos_2d = 0.0; 974 Evas_Real cos = 0.0, new_cos = 0.0, sin = 0.0, new_sin = 0.0, cos_2d = 0.0, new_cos_2d = 0.0;
1373 int first_num = 0; 975 int first_num = 0;
1374 int i = 0, j = 0; 976 int i = 0, j = 0;
1375 977
1376 evas_vec3_set(&triangle1, data[0], data[1], data[2]); 978 eina_vector3_set(&triangle1, data[0], data[1], data[2]);
1377 979
1378 for (i = 1, j = stride; i < count; i++, j += stride) 980 for (i = 1, j = stride; i < count; i++, j += stride)
1379 { 981 {
@@ -1381,75 +983,75 @@ convex_hull_first_tr_get(float *data, int count, int stride)
1381 ((triangle1.z == data[j + 2]) && (triangle1.y > data[j + 1])) || 983 ((triangle1.z == data[j + 2]) && (triangle1.y > data[j + 1])) ||
1382 ((triangle1.z == data[j + 2]) && (triangle1.y == data[j + 1]) && (triangle1.x > data[j]))) 984 ((triangle1.z == data[j + 2]) && (triangle1.y == data[j + 1]) && (triangle1.x > data[j])))
1383 { 985 {
1384 evas_vec3_set(&triangle1, data[j], data[j + 1], data[j + 2]); 986 eina_vector3_set(&triangle1, data[j], data[j + 1], data[j + 2]);
1385 first_num = i; 987 first_num = i;
1386 } 988 }
1387 } 989 }
1388 990
1389 if (first_num) 991 if (first_num)
1390 evas_vec3_set(&triangle2, data[0], data[1], data[2]); 992 eina_vector3_set(&triangle2, data[0], data[1], data[2]);
1391 else 993 else
1392 evas_vec3_set(&triangle2, data[3], data[4], data[5]); 994 eina_vector3_set(&triangle2, data[3], data[4], data[5]);
1393 995
1394 evas_vec3_subtract(&diagonal, &triangle2, &triangle1); 996 eina_vector3_subtract(&diagonal, &triangle2, &triangle1);
1395 sin = fabs(triangle2.z - triangle1.z) / evas_vec3_length_get(&diagonal); 997 sin = fabs(triangle2.z - triangle1.z) / eina_vector3_length_get(&diagonal);
1396 998
1397#define COMPARE_ANGLES(trigonom, triangle, previous, big, little) \ 999#define COMPARE_ANGLES(trigonom, triangle, previous, big, little) \
1398 if (little > big + FLT_EPSILON) \ 1000 if (little > big + FLT_EPSILON) \
1399 { \ 1001 { \
1400 trigonom = new_##trigonom; \ 1002 trigonom = new_##trigonom; \
1401 cos_2d = new_cos_2d; \ 1003 cos_2d = new_cos_2d; \
1402 evas_vec3_set(&triangle, data[j], data[j + 1], data[j + 2]); \ 1004 eina_vector3_set(&triangle, data[j], data[j + 1], data[j + 2]); \
1403 } \ 1005 } \
1404 else if(!FLT_COMPARISON(little, big) && \ 1006 else if(!FLT_COMPARISON(little, big) && \
1405 (evas_vec3_distance_get(&triangle##_candidate, &previous) > \ 1007 (eina_vector3_distance_get(&triangle##_candidate, &previous) > \
1406 evas_vec3_distance_get(&triangle, &previous))) \ 1008 eina_vector3_distance_get(&triangle, &previous))) \
1407 { \ 1009 { \
1408 evas_vec3_set(&triangle, data[j], data[j + 1], data[j + 2]); \ 1010 eina_vector3_set(&triangle, data[j], data[j + 1], data[j + 2]); \
1409 } 1011 }
1410 evas_vec3_set(&complanar1, 1, 0, 0); 1012 eina_vector3_set(&complanar1, 1, 0, 0);
1411 for (i = 0, j = 0; i < count; i++, j += stride) 1013 for (i = 0, j = 0; i < count; i++, j += stride)
1412 { 1014 {
1413 if (FLT_COMPARISON(data[j], triangle1.x) || 1015 if (FLT_COMPARISON(data[j], triangle1.x) ||
1414 FLT_COMPARISON(data[j + 1], triangle1.y) || 1016 FLT_COMPARISON(data[j + 1], triangle1.y) ||
1415 FLT_COMPARISON(data[j + 2], triangle1.z)) 1017 FLT_COMPARISON(data[j + 2], triangle1.z))
1416 { 1018 {
1417 evas_vec3_set(&triangle2_candidate, data[j], data[j + 1], data[j + 2]); 1019 eina_vector3_set(&triangle2_candidate, data[j], data[j + 1], data[j + 2]);
1418 evas_vec3_subtract(&diagonal, &triangle2_candidate, &triangle1); 1020 eina_vector3_subtract(&diagonal, &triangle2_candidate, &triangle1);
1419 new_sin = fabs(data[j + 2] - triangle1.z) / evas_vec3_length_get(&diagonal); 1021 new_sin = fabs(data[j + 2] - triangle1.z) / eina_vector3_length_get(&diagonal);
1420 1022
1421 if (sin > new_sin + FLT_EPSILON) 1023 if (sin > new_sin + FLT_EPSILON)
1422 { 1024 {
1423 sin = new_sin; 1025 sin = new_sin;
1424 evas_vec3_set(&triangle2, data[j], data[j + 1], data[j + 2]); 1026 eina_vector3_set(&triangle2, data[j], data[j + 1], data[j + 2]);
1425 evas_vec3_subtract(&diagonal, &triangle2, &triangle1); 1027 eina_vector3_subtract(&diagonal, &triangle2, &triangle1);
1426 cos_2d = evas_vec3_angle_get(&complanar1, &diagonal); 1028 cos_2d = eina_vector3_angle_get(&complanar1, &diagonal);
1427 } 1029 }
1428 else if (!FLT_COMPARISON(sin, new_sin)) 1030 else if (!FLT_COMPARISON(sin, new_sin))
1429 { 1031 {
1430 evas_vec3_subtract(&diagonal, &triangle2_candidate, &triangle1); 1032 eina_vector3_subtract(&diagonal, &triangle2_candidate, &triangle1);
1431 new_cos_2d = evas_vec3_angle_get(&complanar1, &diagonal); 1033 new_cos_2d = eina_vector3_angle_get(&complanar1, &diagonal);
1432 1034
1433 COMPARE_ANGLES(cos, triangle2, triangle1, cos_2d, new_cos_2d) 1035 COMPARE_ANGLES(cos, triangle2, triangle1, cos_2d, new_cos_2d)
1434 } 1036 }
1435 } 1037 }
1436 } 1038 }
1437 1039
1438 evas_vec3_set(&complanar1, triangle1.x + 1, triangle1.y, triangle1.z); 1040 eina_vector3_set(&complanar1, triangle1.x + 1, triangle1.y, triangle1.z);
1439 evas_vec3_set(&complanar2, triangle1.x, triangle1.y + 1, triangle1.z); 1041 eina_vector3_set(&complanar2, triangle1.x, triangle1.y + 1, triangle1.z);
1440 evas_vec3_plain_by_points(&normal_a, &triangle1, &complanar1, &complanar2); 1042 eina_vector3_plane_by_points(&normal_a, &triangle1, &complanar1, &complanar2);
1441 1043
1442 if (normal_a.z < 0) 1044 if (normal_a.z < 0)
1443 eina_quaternion_scale(&normal_a, &normal_a, -1); 1045 eina_quaternion_scale(&normal_a, &normal_a, -1);
1444 1046
1445 evas_vec3_set(&triangle3, data[0], data[1], data[2]); 1047 eina_vector3_set(&triangle3, data[0], data[1], data[2]);
1446 1048
1447 cos = -1.0; 1049 cos = -1.0;
1448 cos_2d = 1.0; 1050 cos_2d = 1.0;
1449 1051
1450 for (i = 0, j = 0; i < count; i++, j += stride) 1052 for (i = 0, j = 0; i < count; i++, j += stride)
1451 { 1053 {
1452 evas_vec3_set(&candidate, data[j], data[j + 1], data[j + 2]); 1054 eina_vector3_set(&candidate, data[j], data[j + 1], data[j + 2]);
1453 1055
1454 if ((FLT_COMPARISON(data[j], triangle1.x) || 1056 if ((FLT_COMPARISON(data[j], triangle1.x) ||
1455 FLT_COMPARISON(data[j + 1], triangle1.y) || 1057 FLT_COMPARISON(data[j + 1], triangle1.y) ||
@@ -1458,7 +1060,7 @@ convex_hull_first_tr_get(float *data, int count, int stride)
1458 FLT_COMPARISON(data[j + 1], triangle2.y) || 1060 FLT_COMPARISON(data[j + 1], triangle2.y) ||
1459 FLT_COMPARISON(data[j + 2], triangle2.z))) 1061 FLT_COMPARISON(data[j + 2], triangle2.z)))
1460 { 1062 {
1461 evas_vec3_plain_by_points(&normal_b, &triangle1, &candidate, &triangle2); 1063 eina_vector3_plane_by_points(&normal_b, &triangle1, &candidate, &triangle2);
1462 1064
1463 if (normal_b.z < 0) 1065 if (normal_b.z < 0)
1464 eina_quaternion_scale(&normal_b, &normal_b, -1); 1066 eina_quaternion_scale(&normal_b, &normal_b, -1);
@@ -1467,19 +1069,19 @@ convex_hull_first_tr_get(float *data, int count, int stride)
1467 1069
1468 if (new_cos > cos + FLT_EPSILON) 1070 if (new_cos > cos + FLT_EPSILON)
1469 { 1071 {
1470 evas_vec3_set(&triangle3_candidate, data[j], data[j + 1], data[j + 2]); 1072 eina_vector3_set(&triangle3_candidate, data[j], data[j + 1], data[j + 2]);
1471 evas_vec3_subtract(&first, &triangle2, &triangle1); 1073 eina_vector3_subtract(&first, &triangle2, &triangle1);
1472 evas_vec3_subtract(&diagonal, &triangle3, &triangle1); 1074 eina_vector3_subtract(&diagonal, &triangle3, &triangle1);
1473 cos = new_cos; 1075 cos = new_cos;
1474 evas_vec3_set(&triangle3, data[j], data[j + 1], data[j + 2]); 1076 eina_vector3_set(&triangle3, data[j], data[j + 1], data[j + 2]);
1475 cos_2d = evas_vec3_angle_get(&diagonal, &first); 1077 cos_2d = eina_vector3_angle_get(&diagonal, &first);
1476 } 1078 }
1477 else if (!FLT_COMPARISON(new_cos, cos)) 1079 else if (!FLT_COMPARISON(new_cos, cos))
1478 { 1080 {
1479 evas_vec3_set(&triangle3_candidate, data[j], data[j + 1], data[j + 2]); 1081 eina_vector3_set(&triangle3_candidate, data[j], data[j + 1], data[j + 2]);
1480 evas_vec3_subtract(&first, &triangle1, &triangle2); 1082 eina_vector3_subtract(&first, &triangle1, &triangle2);
1481 evas_vec3_subtract(&diagonal, &triangle3_candidate, &triangle2); 1083 eina_vector3_subtract(&diagonal, &triangle3_candidate, &triangle2);
1482 new_cos_2d = evas_vec3_angle_get(&first, &diagonal); 1084 new_cos_2d = eina_vector3_angle_get(&first, &diagonal);
1483 1085
1484 COMPARE_ANGLES(cos, triangle3, triangle2, new_cos_2d, cos_2d) 1086 COMPARE_ANGLES(cos, triangle3, triangle2, new_cos_2d, cos_2d)
1485 } 1087 }
@@ -1498,8 +1100,8 @@ evas_convex_hull_get(float *data, int count, int stride, Eina_Inarray *vertex,
1498{ 1100{
1499 Evas_Triangle3 first_elem, second_elem, *third_elem = NULL, *el = NULL; 1101 Evas_Triangle3 first_elem, second_elem, *third_elem = NULL, *el = NULL;
1500 1102
1501 Evas_Vec3 *next = NULL, *best = NULL, *next_2d = NULL, *el_vec3 = NULL; 1103 Eina_Vector3 *next = NULL, *best = NULL, *next_2d = NULL, *el_vec3 = NULL;
1502 Evas_Vec3 tmp1, tmp2; 1104 Eina_Vector3 tmp1, tmp2;
1503 Eina_Quaternion normal_a, normal_b; 1105 Eina_Quaternion normal_a, normal_b;
1504 1106
1505 Eina_Array arr_elems; 1107 Eina_Array arr_elems;
@@ -1517,7 +1119,7 @@ evas_convex_hull_get(float *data, int count, int stride, Eina_Inarray *vertex,
1517 1119
1518 Eina_Bool exist1 = EINA_FALSE, pushed; 1120 Eina_Bool exist1 = EINA_FALSE, pushed;
1519 Eina_Bool equivalent_triangle = EINA_FALSE, triangle_chain = EINA_FALSE; 1121 Eina_Bool equivalent_triangle = EINA_FALSE, triangle_chain = EINA_FALSE;
1520 Eina_Bool on_plain = EINA_FALSE, right = EINA_FALSE; 1122 Eina_Bool on_plane = EINA_FALSE, right = EINA_FALSE;
1521 1123
1522 eina_array_step_set(&arr_elems, sizeof(Eina_Array), 1); 1124 eina_array_step_set(&arr_elems, sizeof(Eina_Array), 1);
1523 eina_array_step_set(&arr_triangles, sizeof(Eina_Array), 1); 1125 eina_array_step_set(&arr_triangles, sizeof(Eina_Array), 1);
@@ -1563,15 +1165,15 @@ evas_convex_hull_get(float *data, int count, int stride, Eina_Inarray *vertex,
1563 (FLT_COMPARISON(elem->p2.x, data[j]) || FLT_COMPARISON(elem->p2.y, data[j + 1]) || 1165 (FLT_COMPARISON(elem->p2.x, data[j]) || FLT_COMPARISON(elem->p2.y, data[j + 1]) ||
1564 FLT_COMPARISON(elem->p2.z, data[j + 2]))) 1166 FLT_COMPARISON(elem->p2.z, data[j + 2])))
1565 { 1167 {
1566 next = malloc(sizeof(Evas_Vec3)); 1168 next = malloc(sizeof(Eina_Vector3));
1567 evas_vec3_set(next, data[j], data[j + 1], data[j + 2]); 1169 eina_vector3_set(next, data[j], data[j + 1], data[j + 2]);
1568 pushed = EINA_FALSE; 1170 pushed = EINA_FALSE;
1569 1171
1570 /* something like the dihedral angle between the triangles 1172 /* something like the dihedral angle between the triangles
1571 is a determining factor in searching the necessary points */ 1173 is a determining factor in searching the necessary points */
1572 1174
1573 evas_vec3_plain_by_points(&normal_a, &elem->p0, &elem->p1, &elem->p2); 1175 eina_vector3_plane_by_points(&normal_a, &elem->p0, &elem->p1, &elem->p2);
1574 evas_vec3_plain_by_points(&normal_b, &elem->p0, &elem->p1, next); 1176 eina_vector3_plane_by_points(&normal_b, &elem->p0, &elem->p1, next);
1575 1177
1576 /* MIN_DIFF because vertices that belong to plain shouldn't be included */ 1178 /* MIN_DIFF because vertices that belong to plain shouldn't be included */
1577 if (fabs(normal_a.x * data[j] + normal_a.y * data[j + 1] + normal_a.z * data[j + 2] + normal_a.w) < MIN_DIFF) 1179 if (fabs(normal_a.x * data[j] + normal_a.y * data[j + 1] + normal_a.z * data[j + 2] + normal_a.w) < MIN_DIFF)
@@ -1615,7 +1217,7 @@ evas_convex_hull_get(float *data, int count, int stride, Eina_Inarray *vertex,
1615 for (k = 0; (k < eina_array_count(&arr_candidates)) && !exist1; k++) 1217 for (k = 0; (k < eina_array_count(&arr_candidates)) && !exist1; k++)
1616 { 1218 {
1617 next_2d = eina_array_data_get(&arr_candidates, k); 1219 next_2d = eina_array_data_get(&arr_candidates, k);
1618 exist1 = evas_vec3_if_equivalent(next, next_2d); 1220 exist1 = eina_vector3_equivalent(next, next_2d);
1619 } 1221 }
1620 if (!exist1) 1222 if (!exist1)
1621 { 1223 {
@@ -1629,7 +1231,7 @@ evas_convex_hull_get(float *data, int count, int stride, Eina_Inarray *vertex,
1629 } 1231 }
1630 } 1232 }
1631 1233
1632 on_plain = EINA_FALSE; 1234 on_plane = EINA_FALSE;
1633 right = EINA_FALSE; 1235 right = EINA_FALSE;
1634 1236
1635 /* The case when several points are found, is discussed below. 1237 /* The case when several points are found, is discussed below.
@@ -1637,17 +1239,17 @@ evas_convex_hull_get(float *data, int count, int stride, Eina_Inarray *vertex,
1637 two-dimensional subspace should be filled further */ 1239 two-dimensional subspace should be filled further */
1638 if ((cos != 1.0) && (1 < eina_array_count(&arr_candidates))) 1240 if ((cos != 1.0) && (1 < eina_array_count(&arr_candidates)))
1639 { 1241 {
1640 Evas_Vec3 angle_from, angle_to; 1242 Eina_Vector3 angle_from, angle_to;
1641 next_2d = eina_array_data_get(&arr_candidates, 0); 1243 next_2d = eina_array_data_get(&arr_candidates, 0);
1642 evas_vec3_plain_by_points(&normal_b, &elem->p1, &elem->p0, next_2d); 1244 eina_vector3_plane_by_points(&normal_b, &elem->p1, &elem->p0, next_2d);
1643 1245
1644 if (normal_b.x * elem->p2.x + normal_b.y * elem->p2.y + normal_b.z * elem->p2.z + normal_b.w > 0) 1246 if (normal_b.x * elem->p2.x + normal_b.y * elem->p2.y + normal_b.z * elem->p2.z + normal_b.w > 0)
1645 { 1247 {
1646 evas_vec3_subtract(&angle_from, &elem->p0, &elem->p1); 1248 eina_vector3_subtract(&angle_from, &elem->p0, &elem->p1);
1647 right = EINA_TRUE; 1249 right = EINA_TRUE;
1648 } 1250 }
1649 else 1251 else
1650 evas_vec3_subtract(&angle_from, &elem->p1, &elem->p0); 1252 eina_vector3_subtract(&angle_from, &elem->p1, &elem->p0);
1651 1253
1652 cos_2d = -1.0; 1254 cos_2d = -1.0;
1653 1255
@@ -1655,12 +1257,12 @@ evas_convex_hull_get(float *data, int count, int stride, Eina_Inarray *vertex,
1655 { 1257 {
1656 /* Selection of the required vertex occurs on the basis of a specific angle */ 1258 /* Selection of the required vertex occurs on the basis of a specific angle */
1657 if (right) 1259 if (right)
1658 evas_vec3_subtract(&angle_to, next_2d, &elem->p0); 1260 eina_vector3_subtract(&angle_to, next_2d, &elem->p0);
1659 else 1261 else
1660 evas_vec3_subtract(&angle_to, next_2d, &elem->p1); 1262 eina_vector3_subtract(&angle_to, next_2d, &elem->p1);
1661 1263
1662 new_cos = evas_vec3_dot_product(&angle_from, &angle_to) / 1264 new_cos = eina_vector3_dot_product(&angle_from, &angle_to) /
1663 (evas_vec3_length_get(&angle_from) * evas_vec3_length_get(&angle_to)); 1265 (eina_vector3_length_get(&angle_from) * eina_vector3_length_get(&angle_to));
1664 if (new_cos > cos_2d + FLT_EPSILON) 1266 if (new_cos > cos_2d + FLT_EPSILON)
1665 { 1267 {
1666 cos_2d = new_cos; 1268 cos_2d = new_cos;
@@ -1668,8 +1270,8 @@ evas_convex_hull_get(float *data, int count, int stride, Eina_Inarray *vertex,
1668 } 1270 }
1669 else if (!FLT_COMPARISON(new_cos, cos_2d)) 1271 else if (!FLT_COMPARISON(new_cos, cos_2d))
1670 { 1272 {
1671 if ((right && (evas_vec3_distance_get(best, &elem->p0) < evas_vec3_length_get(&angle_from))) || 1273 if ((right && (eina_vector3_distance_get(best, &elem->p0) < eina_vector3_length_get(&angle_from))) ||
1672 (!right && (evas_vec3_distance_get(best, &elem->p1) < evas_vec3_length_get(&angle_from)))) 1274 (!right && (eina_vector3_distance_get(best, &elem->p1) < eina_vector3_length_get(&angle_from))))
1673 best = eina_array_data_get(&arr_candidates, k); 1275 best = eina_array_data_get(&arr_candidates, k);
1674 } 1276 }
1675 } 1277 }
@@ -1680,19 +1282,19 @@ evas_convex_hull_get(float *data, int count, int stride, Eina_Inarray *vertex,
1680 convex hull allows to fill it fan counterclockwise when viewed from the inside */ 1282 convex hull allows to fill it fan counterclockwise when viewed from the inside */
1681 else if ((cos == 1.0) && (1 < eina_array_count(&arr_candidates))) 1283 else if ((cos == 1.0) && (1 < eina_array_count(&arr_candidates)))
1682 { 1284 {
1683 Evas_Vec3 angle_from, angle_to; 1285 Eina_Vector3 angle_from, angle_to;
1684 evas_vec3_subtract(&angle_from, &elem->p0, &elem->p1); 1286 eina_vector3_subtract(&angle_from, &elem->p0, &elem->p1);
1685 cos_2d = -1.0; 1287 cos_2d = -1.0;
1686 EINA_ARRAY_ITER_NEXT(&arr_candidates, k, next_2d, iterator) 1288 EINA_ARRAY_ITER_NEXT(&arr_candidates, k, next_2d, iterator)
1687 { 1289 {
1688 evas_vec3_subtract(&angle_to, next_2d, &elem->p0); 1290 eina_vector3_subtract(&angle_to, next_2d, &elem->p0);
1689 1291
1690 evas_vec3_plain_by_points(&normal_a, &elem->p0, &elem->p1, &elem->p2); 1292 eina_vector3_plane_by_points(&normal_a, &elem->p0, &elem->p1, &elem->p2);
1691 evas_vec3_plain_by_points(&normal_b, &elem->p0, &elem->p1, next_2d); 1293 eina_vector3_plane_by_points(&normal_b, &elem->p0, &elem->p1, next_2d);
1692 if ((normal_a.x * normal_b.x <= 0) && (normal_a.y * normal_b.y <= 0) && (normal_a.z * normal_b.z <= 0)) 1294 if ((normal_a.x * normal_b.x <= 0) && (normal_a.y * normal_b.y <= 0) && (normal_a.z * normal_b.z <= 0))
1693 { 1295 {
1694 new_cos = evas_vec3_dot_product(&angle_from, &angle_to) / 1296 new_cos = eina_vector3_dot_product(&angle_from, &angle_to) /
1695 (evas_vec3_length_get(&angle_from) * evas_vec3_length_get(&angle_to)); 1297 (eina_vector3_length_get(&angle_from) * eina_vector3_length_get(&angle_to));
1696 if (new_cos > cos_2d + FLT_EPSILON) 1298 if (new_cos > cos_2d + FLT_EPSILON)
1697 { 1299 {
1698 cos_2d = new_cos; 1300 cos_2d = new_cos;
@@ -1700,10 +1302,10 @@ evas_convex_hull_get(float *data, int count, int stride, Eina_Inarray *vertex,
1700 } 1302 }
1701 else if (!FLT_COMPARISON(new_cos, cos_2d)) 1303 else if (!FLT_COMPARISON(new_cos, cos_2d))
1702 { 1304 {
1703 if (evas_vec3_distance_get(best, &elem->p0) < evas_vec3_length_get(&angle_to)) 1305 if (eina_vector3_distance_get(best, &elem->p0) < eina_vector3_length_get(&angle_to))
1704 best = eina_array_data_get(&arr_candidates, k); 1306 best = eina_array_data_get(&arr_candidates, k);
1705 } 1307 }
1706 on_plain = EINA_TRUE; 1308 on_plane = EINA_TRUE;
1707 } 1309 }
1708 } 1310 }
1709 } 1311 }
@@ -1711,15 +1313,15 @@ evas_convex_hull_get(float *data, int count, int stride, Eina_Inarray *vertex,
1711 else 1313 else
1712 best = eina_array_data_get(&arr_candidates, 0); 1314 best = eina_array_data_get(&arr_candidates, 0);
1713 1315
1714 evas_vec3_plain_by_points(&normal_b, &elem->p0, &elem->p1, best); 1316 eina_vector3_plane_by_points(&normal_b, &elem->p0, &elem->p1, best);
1715 1317
1716 if_two = 0; 1318 if_two = 0;
1717 first_exist_twice = 0; 1319 first_exist_twice = 0;
1718 second_exist_twice = 0; 1320 second_exist_twice = 0;
1719 equivalent_triangle = EINA_FALSE; 1321 equivalent_triangle = EINA_FALSE;
1720 triangle_chain = EINA_FALSE; 1322 triangle_chain = EINA_FALSE;
1721 evas_vec3_copy(&tmp1, &elem->p0); 1323 eina_vector3_copy(&tmp1, &elem->p0);
1722 evas_vec3_copy(&tmp2, &elem->p1); 1324 eina_vector3_copy(&tmp2, &elem->p1);
1723 new_elem1 = malloc(sizeof(Evas_Triangle3)); 1325 new_elem1 = malloc(sizeof(Evas_Triangle3));
1724 evas_triangle3_set(new_elem1, best, &tmp1, &tmp2); 1326 evas_triangle3_set(new_elem1, best, &tmp1, &tmp2);
1725 pushed = EINA_FALSE; 1327 pushed = EINA_FALSE;
@@ -1727,22 +1329,22 @@ evas_convex_hull_get(float *data, int count, int stride, Eina_Inarray *vertex,
1727 /* verification that the edje has not been found previously */ 1329 /* verification that the edje has not been found previously */
1728 EINA_ARRAY_ITER_NEXT(&arr_triangles, k, el, iterator) 1330 EINA_ARRAY_ITER_NEXT(&arr_triangles, k, el, iterator)
1729 { 1331 {
1730 if (convex_hull_triangle3_if_first_edje(el, &elem->p0, &elem->p1)) 1332 if (convex_hull_triangle3_first_edje(el, &elem->p0, &elem->p1))
1731 if_two++; 1333 if_two++;
1732 if (evas_triangle3_if_equivalent(el, new_elem1)) 1334 if (evas_triangle3_equivalent(el, new_elem1))
1733 equivalent_triangle++; 1335 equivalent_triangle++;
1734 } 1336 }
1735 1337
1736 1338
1737 EINA_ARRAY_ITER_NEXT(&arr_triangles, k, el, iterator) 1339 EINA_ARRAY_ITER_NEXT(&arr_triangles, k, el, iterator)
1738 { 1340 {
1739 if ((k > 2) && (convex_hull_triangle3_if_not_first_edje(el, &elem->p0, best) || 1341 if ((k > 2) && (convex_hull_triangle3_not_first_edje(el, &elem->p0, best) ||
1740 convex_hull_triangle3_if_not_first_edje(el, &elem->p1, best))) 1342 convex_hull_triangle3_not_first_edje(el, &elem->p1, best)))
1741 triangle_chain = EINA_TRUE; 1343 triangle_chain = EINA_TRUE;
1742 } 1344 }
1743 1345
1744 /* There is a specific order according to which the edjes are entered in arr_elems */ 1346 /* There is a specific order according to which the edjes are entered in arr_elems */
1745 if (!on_plain && !right) 1347 if (!on_plane && !right)
1746 { 1348 {
1747 if ((!equivalent_triangle) && (!second_exist_twice) && (!triangle_chain) && (if_two < 2)) 1349 if ((!equivalent_triangle) && (!second_exist_twice) && (!triangle_chain) && (if_two < 2))
1748 { 1350 {
@@ -1859,31 +1461,31 @@ evas_convex_hull_get(float *data, int count, int stride, Eina_Inarray *vertex,
1859} 1461}
1860 1462
1861static inline void 1463static inline void
1862tangent_space_weighted_sum(Evas_Vec3 *big_t, Evas_Vec3 *little_t, 1464tangent_space_weighted_sum(Eina_Vector3 *big_t, Eina_Vector3 *little_t,
1863 Evas_Real *big_angle, Evas_Real little_angle) 1465 Evas_Real *big_angle, Evas_Real little_angle)
1864{ 1466{
1865 /* one way to calculate tangent in vertex that is found in many triangles */ 1467 /* one way to calculate tangent in vertex that is found in many triangles */
1866 evas_vec3_scale(big_t, big_t, *big_angle / (*big_angle + little_angle)); 1468 eina_vector3_scale(big_t, big_t, *big_angle / (*big_angle + little_angle));
1867 evas_vec3_scale(little_t, little_t, little_angle / (*big_angle + little_angle)); 1469 eina_vector3_scale(little_t, little_t, little_angle / (*big_angle + little_angle));
1868 evas_vec3_add(big_t, big_t, little_t); 1470 eina_vector3_add(big_t, big_t, little_t);
1869 *big_angle += little_angle; 1471 *big_angle += little_angle;
1870 return; 1472 return;
1871} 1473}
1872 1474
1873 1475
1874static inline Evas_Real 1476static inline Evas_Real
1875tangent_space_triangle_angle_get(Evas_Vec3 *first, Evas_Vec3 *second, Evas_Vec3 *third) 1477tangent_space_triangle_angle_get(Eina_Vector3 *first, Eina_Vector3 *second, Eina_Vector3 *third)
1876{ 1478{
1877 Evas_Vec3 a, b, c; 1479 Eina_Vector3 a, b, c;
1878 Evas_Real cos, arccos; 1480 Evas_Real cos, arccos;
1879 1481
1880 evas_vec3_subtract(&a, second, third); 1482 eina_vector3_subtract(&a, second, third);
1881 evas_vec3_subtract(&b, third, first); 1483 eina_vector3_subtract(&b, third, first);
1882 evas_vec3_subtract(&c, first, second); 1484 eina_vector3_subtract(&c, first, second);
1883 1485
1884 cos = -(evas_vec3_length_square_get(&a) - evas_vec3_length_square_get(&b) - 1486 cos = -(eina_vector3_length_square_get(&a) - eina_vector3_length_square_get(&b) -
1885 evas_vec3_length_square_get(&c)) / (2 * evas_vec3_length_get(&b) * 1487 eina_vector3_length_square_get(&c)) / (2 * eina_vector3_length_get(&b) *
1886 evas_vec3_length_get(&c)); 1488 eina_vector3_length_get(&c));
1887 arccos = acos(cos); 1489 arccos = acos(cos);
1888 1490
1889 return arccos; 1491 return arccos;
@@ -1896,8 +1498,8 @@ evas_tangent_space_get(float *data, float *tex_data, float *normal_data, unsigne
1896 Eina_Bool if_not_primitive = EINA_FALSE; 1498 Eina_Bool if_not_primitive = EINA_FALSE;
1897 Evas_Real big_angle, little_angle; 1499 Evas_Real big_angle, little_angle;
1898 Evas_Triangle3 triangle; 1500 Evas_Triangle3 triangle;
1899 Evas_Vec2 tex1, tex2, tex3; 1501 Eina_Vector2 tex1, tex2, tex3;
1900 Evas_Vec3 big_tangent, little_tangent, normal; 1502 Eina_Vector3 big_tangent, little_tangent, normal;
1901 Eina_Quaternion *plain = NULL; 1503 Eina_Quaternion *plain = NULL;
1902 int i, j, k, l, m, found_index = 0; 1504 int i, j, k, l, m, found_index = 0;
1903 int indexes[3]; 1505 int indexes[3];
@@ -1929,7 +1531,7 @@ evas_tangent_space_get(float *data, float *tex_data, float *normal_data, unsigne
1929 1531
1930 for (i = 0, j = 0, k = 0; i < vertex_count; i++, j += stride, k += normal_stride) 1532 for (i = 0, j = 0, k = 0; i < vertex_count; i++, j += stride, k += normal_stride)
1931 { 1533 {
1932 evas_vec3_set(&big_tangent, 0.0, 0.0, 0.0); 1534 eina_vector3_set(&big_tangent, 0.0, 0.0, 0.0);
1933 big_angle = 0.0; 1535 big_angle = 0.0;
1934 for (l = 0, m = 0; l < vertex_count; l++, m += stride) 1536 for (l = 0, m = 0; l < vertex_count; l++, m += stride)
1935 { 1537 {
@@ -1962,14 +1564,14 @@ evas_tangent_space_get(float *data, float *tex_data, float *normal_data, unsigne
1962 (found_index == indexes[1]) || 1564 (found_index == indexes[1]) ||
1963 (found_index == indexes[2])) 1565 (found_index == indexes[2]))
1964 { 1566 {
1965 evas_vec3_set(&triangle.p0, data[indexes[0] * stride], data[indexes[0] * stride + 1], data[indexes[0] * stride + 2]); 1567 eina_vector3_set(&triangle.p0, data[indexes[0] * stride], data[indexes[0] * stride + 1], data[indexes[0] * stride + 2]);
1966 evas_vec3_set(&triangle.p1, data[indexes[1] * stride], data[indexes[1] * stride + 1], data[indexes[1] * stride + 2]); 1568 eina_vector3_set(&triangle.p1, data[indexes[1] * stride], data[indexes[1] * stride + 1], data[indexes[1] * stride + 2]);
1967 evas_vec3_set(&triangle.p2, data[indexes[2] * stride], data[indexes[2] * stride + 1], data[indexes[2] * stride + 2]); 1569 eina_vector3_set(&triangle.p2, data[indexes[2] * stride], data[indexes[2] * stride + 1], data[indexes[2] * stride + 2]);
1968 if (plain) 1570 if (plain)
1969 free(plain); 1571 free(plain);
1970 plain = malloc(sizeof(Eina_Quaternion)); 1572 plain = malloc(sizeof(Eina_Quaternion));
1971 1573
1972 evas_vec3_plain_by_points(plain, &triangle.p0, &triangle.p1, &triangle.p2); 1574 eina_vector3_plane_by_points(plain, &triangle.p0, &triangle.p1, &triangle.p2);
1973 tex1.x = tex_data[indexes[0] * tex_stride]; 1575 tex1.x = tex_data[indexes[0] * tex_stride];
1974 tex1.y = tex_data[indexes[0] * tex_stride + 1]; 1576 tex1.y = tex_data[indexes[0] * tex_stride + 1];
1975 tex2.x = tex_data[indexes[1] * tex_stride]; 1577 tex2.x = tex_data[indexes[1] * tex_stride];
@@ -1980,7 +1582,7 @@ evas_tangent_space_get(float *data, float *tex_data, float *normal_data, unsigne
1980 /* calculate the tangent */ 1582 /* calculate the tangent */
1981 tangent_new_basis(&little_tangent, &triangle, 1583 tangent_new_basis(&little_tangent, &triangle,
1982 &tex1, &tex2, &tex3); 1584 &tex1, &tex2, &tex3);
1983 evas_vec3_normalize(&little_tangent, &little_tangent); 1585 eina_vector3_normalize(&little_tangent, &little_tangent);
1984 1586
1985 /* founding the angle in triangle in founded vertex */ 1587 /* founding the angle in triangle in founded vertex */
1986 if (found_index == indexes[0]) 1588 if (found_index == indexes[0])
@@ -1993,7 +1595,7 @@ evas_tangent_space_get(float *data, float *tex_data, float *normal_data, unsigne
1993 little_angle = tangent_space_triangle_angle_get(&triangle.p2, &triangle.p0, &triangle.p1); 1595 little_angle = tangent_space_triangle_angle_get(&triangle.p2, &triangle.p0, &triangle.p1);
1994 1596
1995 if (evas_triangle3_is_line(&triangle)) 1597 if (evas_triangle3_is_line(&triangle))
1996 evas_vec3_set(&big_tangent, 1.0, 0.0, 0.0); 1598 eina_vector3_set(&big_tangent, 1.0, 0.0, 0.0);
1997 1599
1998 else 1600 else
1999 tangent_space_weighted_sum(&big_tangent, &little_tangent, &big_angle, little_angle); 1601 tangent_space_weighted_sum(&big_tangent, &little_tangent, &big_angle, little_angle);
@@ -2001,9 +1603,9 @@ evas_tangent_space_get(float *data, float *tex_data, float *normal_data, unsigne
2001 } 1603 }
2002 } 1604 }
2003 } 1605 }
2004 evas_vec3_set(&normal, normal_data[j], normal_data[j + 1], normal_data[j + 2]); 1606 eina_vector3_set(&normal, normal_data[j], normal_data[j + 1], normal_data[j + 2]);
2005 evas_vec3_orthogonal_projection_on_plain(&big_tangent, &big_tangent, &normal); 1607 eina_vector3_orthogonal_projection_on_plane(&big_tangent, &big_tangent, &normal);
2006 evas_vec3_normalize(&big_tangent, &big_tangent); 1608 eina_vector3_normalize(&big_tangent, &big_tangent);
2007 tmp_tangent[i * 3] = big_tangent.x; 1609 tmp_tangent[i * 3] = big_tangent.x;
2008 tmp_tangent[i * 3 + 1] = big_tangent.y; 1610 tmp_tangent[i * 3 + 1] = big_tangent.y;
2009 tmp_tangent[i * 3 + 2] = big_tangent.z; 1611 tmp_tangent[i * 3 + 2] = big_tangent.z;
@@ -2018,7 +1620,7 @@ evas_tangent_space_get(float *data, float *tex_data, float *normal_data, unsigne
2018} 1620}
2019 1621
2020static inline void 1622static inline void
2021calculate_box(Evas_Box3 *box3, int vertex_count, Evas_Vec3 *vertex_position) 1623calculate_box(Evas_Box3 *box3, int vertex_count, Eina_Vector3 *vertex_position)
2022{ 1624{
2023 int i = 0; 1625 int i = 0;
2024 float vxmin, vymin, vzmin, vxmax, vymax, vzmax; 1626 float vxmin, vymin, vzmin, vxmax, vymax, vzmax;
@@ -2040,10 +1642,10 @@ calculate_box(Evas_Box3 *box3, int vertex_count, Evas_Vec3 *vertex_position)
2040} 1642}
2041 1643
2042static inline void 1644static inline void
2043calculate_sphere(Evas_Sphere *sphere, int vertex_count, Evas_Vec3 *vertex_position) 1645calculate_sphere(Evas_Sphere *sphere, int vertex_count, Eina_Vector3 *vertex_position)
2044{ 1646{
2045 float radius = 0.0001f; 1647 float radius = 0.0001f;
2046 Evas_Vec3 center, pos, diff; 1648 Eina_Vector3 center, pos, diff;
2047 float len, alpha, alpha2; 1649 float len, alpha, alpha2;
2048 int i, k; 1650 int i, k;
2049 1651
@@ -2063,17 +1665,17 @@ calculate_sphere(Evas_Sphere *sphere, int vertex_count, Evas_Vec3 *vertex_posit
2063 for (i = 0; i < vertex_count; ++i) 1665 for (i = 0; i < vertex_count; ++i)
2064 { 1666 {
2065 pos = vertex_position[i]; 1667 pos = vertex_position[i];
2066 evas_vec3_subtract(&diff, &pos, &center); 1668 eina_vector3_subtract(&diff, &pos, &center);
2067 len = evas_vec3_length_get(&diff); 1669 len = eina_vector3_length_get(&diff);
2068 if (len > radius) 1670 if (len > radius)
2069 { 1671 {
2070 alpha = len / radius; 1672 alpha = len / radius;
2071 alpha2 = alpha * alpha; 1673 alpha2 = alpha * alpha;
2072 radius = 0.5f * (alpha + 1 / alpha) * radius; 1674 radius = 0.5f * (alpha + 1 / alpha) * radius;
2073 evas_vec3_scale(&pos, &pos, 1 - 1 / alpha2); 1675 eina_vector3_scale(&pos, &pos, 1 - 1 / alpha2);
2074 evas_vec3_scale(&center, &center, (1 + 1 / alpha2)); 1676 eina_vector3_scale(&center, &center, (1 + 1 / alpha2));
2075 evas_vec3_add(&center, &center, &pos); 1677 eina_vector3_add(&center, &center, &pos);
2076 evas_vec3_scale(&center, &center, 0.5f); 1678 eina_vector3_scale(&center, &center, 0.5f);
2077 } 1679 }
2078 } 1680 }
2079 } 1681 }
@@ -2081,14 +1683,14 @@ calculate_sphere(Evas_Sphere *sphere, int vertex_count, Evas_Vec3 *vertex_posit
2081 for (i = 0; i < vertex_count; ++i) 1683 for (i = 0; i < vertex_count; ++i)
2082 { 1684 {
2083 pos = vertex_position[i]; 1685 pos = vertex_position[i];
2084 evas_vec3_subtract(&diff, &pos, &center); 1686 eina_vector3_subtract(&diff, &pos, &center);
2085 len = evas_vec3_length_get(&diff); 1687 len = eina_vector3_length_get(&diff);
2086 1688
2087 if (len > radius) 1689 if (len > radius)
2088 { 1690 {
2089 radius = (radius + len) / 2.0f; 1691 radius = (radius + len) / 2.0f;
2090 evas_vec3_scale(&diff, &diff, (len - radius) / len); 1692 eina_vector3_scale(&diff, &diff, (len - radius) / len);
2091 evas_vec3_add(&center, &center, &diff); 1693 eina_vector3_add(&center, &center, &diff);
2092 } 1694 }
2093 } 1695 }
2094 1696
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index acad8c4..c5146f4 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -247,13 +247,13 @@ struct _Evas_Canvas3D_Node
247 Evas_Canvas3D_Node *parent; 247 Evas_Canvas3D_Node *parent;
248 Evas_Canvas3D_Node *billboard_target; 248 Evas_Canvas3D_Node *billboard_target;
249 249
250 Evas_Vec3 position; 250 Eina_Vector3 position;
251 Eina_Quaternion orientation; 251 Eina_Quaternion orientation;
252 Evas_Vec3 scale; 252 Eina_Vector3 scale;
253 253
254 Evas_Vec3 position_world; 254 Eina_Vector3 position_world;
255 Eina_Quaternion orientation_world; 255 Eina_Quaternion orientation_world;
256 Evas_Vec3 scale_world; 256 Eina_Vector3 scale_world;
257 257
258 Evas_Box3 aabb; 258 Evas_Box3 aabb;
259 Evas_Box3 obb; 259 Evas_Box3 obb;
@@ -426,7 +426,7 @@ struct _Evas_Canvas3D_Primitive
426 int precision; 426 int precision;
427 Evas_Canvas3D_Surface_Func *surface; 427 Evas_Canvas3D_Surface_Func *surface;
428 428
429 Evas_Vec2 tex_scale; 429 Eina_Vector2 tex_scale;
430}; 430};
431 431
432struct _Evas_Canvas3D_Scene_Public_Data 432struct _Evas_Canvas3D_Scene_Public_Data
@@ -1763,7 +1763,7 @@ void evas_canvas3d_light_node_del(Evas_Canvas3D_Light *light, Evas_Canvas3D_Node
1763/* Mesh functions. */ 1763/* Mesh functions. */
1764void evas_canvas3d_mesh_node_add(Evas_Canvas3D_Mesh *mesh, Evas_Canvas3D_Node *node); 1764void evas_canvas3d_mesh_node_add(Evas_Canvas3D_Mesh *mesh, Evas_Canvas3D_Node *node);
1765void evas_canvas3d_mesh_node_del(Evas_Canvas3D_Mesh *mesh, Evas_Canvas3D_Node *node); 1765void evas_canvas3d_mesh_node_del(Evas_Canvas3D_Mesh *mesh, Evas_Canvas3D_Node *node);
1766void evas_canvas3d_mesh_interpolate_position_get(Evas_Vec3 *out, const Evas_Canvas3D_Vertex_Buffer *pos0, const Evas_Canvas3D_Vertex_Buffer *pos1, Evas_Real weight, int index); 1766void evas_canvas3d_mesh_interpolate_position_get(Eina_Vector3 *out, const Evas_Canvas3D_Vertex_Buffer *pos0, const Evas_Canvas3D_Vertex_Buffer *pos1, Evas_Real weight, int index);
1767void evas_canvas3d_mesh_interpolate_vertex_buffer_get(Evas_Canvas3D_Mesh *mesh, int frame, Evas_Canvas3D_Vertex_Attrib attrib, Evas_Canvas3D_Vertex_Buffer *buffer0, Evas_Canvas3D_Vertex_Buffer *buffer1, Evas_Real *weight); 1767void evas_canvas3d_mesh_interpolate_vertex_buffer_get(Evas_Canvas3D_Mesh *mesh, int frame, Evas_Canvas3D_Vertex_Attrib attrib, Evas_Canvas3D_Vertex_Buffer *buffer0, Evas_Canvas3D_Vertex_Buffer *buffer1, Evas_Real *weight);
1768void evas_canvas3d_mesh_file_md2_set(Evas_Canvas3D_Mesh *mesh, const char *file); 1768void evas_canvas3d_mesh_file_md2_set(Evas_Canvas3D_Mesh *mesh, const char *file);
1769void evas_canvas3d_mesh_save_obj(Evas_Canvas3D_Mesh *mesh, const char *file, Evas_Canvas3D_Mesh_Frame *f); 1769void evas_canvas3d_mesh_save_obj(Evas_Canvas3D_Mesh *mesh, const char *file, Evas_Canvas3D_Mesh_Frame *f);
@@ -1818,12 +1818,12 @@ void evas_model_save_file_ply(const Evas_Canvas3D_Mesh *mesh, const char *file,
1818void evas_common_set_model_from_primitive(Evas_Canvas3D_Mesh *model, int frame, Evas_Canvas3D_Primitive_Data *primitive); 1818void evas_common_set_model_from_primitive(Evas_Canvas3D_Mesh *model, int frame, Evas_Canvas3D_Primitive_Data *primitive);
1819void evas_model_set_from_square_primitive(Evas_Canvas3D_Mesh *mesh, int frame); 1819void evas_model_set_from_square_primitive(Evas_Canvas3D_Mesh *mesh, int frame);
1820void evas_model_set_from_cube_primitive(Evas_Canvas3D_Mesh *mesh, int frame); 1820void evas_model_set_from_cube_primitive(Evas_Canvas3D_Mesh *mesh, int frame);
1821void evas_model_set_from_cylinder_primitive(Evas_Canvas3D_Mesh *mesh, int frame, Evas_Canvas3D_Primitive_Mode mode, int precision, Evas_Vec2 tex_scale); 1821void evas_model_set_from_cylinder_primitive(Evas_Canvas3D_Mesh *mesh, int frame, Evas_Canvas3D_Primitive_Mode mode, int precision, Eina_Vector2 tex_scale);
1822void evas_model_set_from_cone_primitive(Evas_Canvas3D_Mesh *mesh, int frame, Evas_Canvas3D_Primitive_Mode mode, int precision, Evas_Vec2 tex_scale); 1822void evas_model_set_from_cone_primitive(Evas_Canvas3D_Mesh *mesh, int frame, Evas_Canvas3D_Primitive_Mode mode, int precision, Eina_Vector2 tex_scale);
1823void evas_model_set_from_sphere_primitive(Evas_Canvas3D_Mesh *mesh, int frame, Evas_Canvas3D_Primitive_Mode mode, int precision, Evas_Vec2 tex_scale); 1823void evas_model_set_from_sphere_primitive(Evas_Canvas3D_Mesh *mesh, int frame, Evas_Canvas3D_Primitive_Mode mode, int precision, Eina_Vector2 tex_scale);
1824void evas_model_set_from_torus_primitive(Evas_Canvas3D_Mesh *mesh, int frame, Evas_Real ratio, int precision, Evas_Vec2 tex_scale); 1824void evas_model_set_from_torus_primitive(Evas_Canvas3D_Mesh *mesh, int frame, Evas_Real ratio, int precision, Eina_Vector2 tex_scale);
1825void evas_model_set_from_surface_primitive(Evas_Canvas3D_Mesh *mesh, int frame, Evas_Canvas3D_Surface_Func func, int precision, Evas_Vec2 tex_scale); 1825void evas_model_set_from_surface_primitive(Evas_Canvas3D_Mesh *mesh, int frame, Evas_Canvas3D_Surface_Func func, int precision, Eina_Vector2 tex_scale);
1826void evas_model_set_from_terrain_primitive(Evas_Canvas3D_Mesh *mesh, int frame, int precision, Evas_Vec2 tex_scale); 1826void evas_model_set_from_terrain_primitive(Evas_Canvas3D_Mesh *mesh, int frame, int precision, Eina_Vector2 tex_scale);
1827 1827
1828/* Filter functions */ 1828/* Filter functions */
1829Eina_Bool evas_filter_object_render(Eo *eo_obj, Evas_Object_Protected_Data *obj, void *output, void *context, void *surface, int x, int y, Eina_Bool do_async, Eina_Bool alpha); 1829Eina_Bool evas_filter_object_render(Eo *eo_obj, Evas_Object_Protected_Data *obj, void *output, void *context, void *surface, int x, int y, Eina_Bool do_async, Eina_Bool alpha);
diff --git a/src/modules/evas/engines/gl_common/evas_gl_3d.c b/src/modules/evas/engines/gl_common/evas_gl_3d.c
index 3bacf2c..fd3e264 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_3d.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_3d.c
@@ -899,7 +899,7 @@ _light_build(E3D_Draw_Data *data,
899 Evas_Canvas3D_Node_Data *pd_light_node = eo_data_scope_get(light, EVAS_CANVAS3D_NODE_CLASS); 899 Evas_Canvas3D_Node_Data *pd_light_node = eo_data_scope_get(light, EVAS_CANVAS3D_NODE_CLASS);
900 Evas_Canvas3D_Light *l = pd_light_node ? pd_light_node->data.light.light : NULL; 900 Evas_Canvas3D_Light *l = pd_light_node ? pd_light_node->data.light.light : NULL;
901 Evas_Canvas3D_Light_Data *pdl = l ? eo_data_scope_get(l, EVAS_CANVAS3D_LIGHT_CLASS) : NULL; 901 Evas_Canvas3D_Light_Data *pdl = l ? eo_data_scope_get(l, EVAS_CANVAS3D_LIGHT_CLASS) : NULL;
902 Evas_Vec3 pos, dir; 902 Eina_Vector3 pos, dir;
903 903
904 if (pdl == NULL) 904 if (pdl == NULL)
905 return; 905 return;
@@ -910,12 +910,12 @@ _light_build(E3D_Draw_Data *data,
910 data->flags |= E3D_SHADER_FLAG_LIGHT_DIRECTIONAL; 910 data->flags |= E3D_SHADER_FLAG_LIGHT_DIRECTIONAL;
911 911
912 /* Negative Z. */ 912 /* Negative Z. */
913 evas_vec3_set(&dir, 0.0, 0.0, 1.0); 913 eina_vector3_set(&dir, 0.0, 0.0, 1.0);
914 evas_vec3_quaternion_rotate(&dir, &dir, &pd_light_node->orientation); 914 eina_vector3_quaternion_rotate(&dir, &dir, &pd_light_node->orientation);
915 915
916 /* Transform to eye space. */ 916 /* Transform to eye space. */
917 evas_vec3_homogeneous_direction_transform(&dir, &dir, matrix_eye); 917 eina_vector3_homogeneous_direction_transform(&dir, matrix_eye, &dir);
918 evas_vec3_normalize(&dir, &dir); 918 eina_vector3_normalize(&dir, &dir);
919 919
920 data->light.position.x = dir.x; 920 data->light.position.x = dir.x;
921 data->light.position.y = dir.y; 921 data->light.position.y = dir.y;
@@ -924,8 +924,8 @@ _light_build(E3D_Draw_Data *data,
924 } 924 }
925 else 925 else
926 { 926 {
927 evas_vec3_copy(&pos, &pd_light_node->position_world); 927 eina_vector3_copy(&pos, &pd_light_node->position_world);
928 evas_vec3_homogeneous_position_transform(&pos, &pos, matrix_eye); 928 eina_vector3_homogeneous_position_transform(&pos, matrix_eye, &pos);
929 929
930 data->light.position.x = pos.x; 930 data->light.position.x = pos.x;
931 data->light.position.y = pos.y; 931 data->light.position.y = pos.y;
@@ -944,9 +944,9 @@ _light_build(E3D_Draw_Data *data,
944 if (pdl->spot_cutoff < 180.0) 944 if (pdl->spot_cutoff < 180.0)
945 { 945 {
946 data->flags |= E3D_SHADER_FLAG_LIGHT_SPOT; 946 data->flags |= E3D_SHADER_FLAG_LIGHT_SPOT;
947 evas_vec3_set(&dir, 0.0, 0.0, -1.0); 947 eina_vector3_set(&dir, 0.0, 0.0, -1.0);
948 evas_vec3_quaternion_rotate(&dir, &dir, &pd_light_node->orientation); 948 eina_vector3_quaternion_rotate(&dir, &dir, &pd_light_node->orientation);
949 evas_vec3_homogeneous_direction_transform(&dir, &dir, matrix_eye); 949 eina_vector3_homogeneous_direction_transform(&dir, matrix_eye, &dir);
950 950
951 data->light.spot_dir = dir; 951 data->light.spot_dir = dir;
952 data->light.spot_exp = pdl->spot_exp; 952 data->light.spot_exp = pdl->spot_exp;
diff --git a/src/modules/evas/engines/gl_common/evas_gl_3d_private.h b/src/modules/evas/engines/gl_common/evas_gl_3d_private.h
index 9478093..da508d2 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_3d_private.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_3d_private.h
@@ -98,10 +98,10 @@ struct _E3D_Draw_Data
98 98
99 struct { 99 struct {
100 Eina_Quaternion position; 100 Eina_Quaternion position;
101 Evas_Vec3 spot_dir; 101 Eina_Vector3 spot_dir;
102 Evas_Real spot_exp; 102 Evas_Real spot_exp;
103 Evas_Real spot_cutoff_cos; 103 Evas_Real spot_cutoff_cos;
104 Evas_Vec3 atten; 104 Eina_Vector3 atten;
105 Evas_Color ambient; 105 Evas_Color ambient;
106 Evas_Color diffuse; 106 Evas_Color diffuse;
107 Evas_Color specular; 107 Evas_Color specular;