summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/evas/canvas')
-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
4 files changed, 50 insertions, 50 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 {