summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleksandr Shcherbina <o.shcherbina@samsung.com>2015-02-05 15:17:43 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-02-05 15:37:15 +0100
commit0c4de0235c0a0ff14896c6e1ba49c1664f908999 (patch)
treea92f93a0dcce6034ca62e88010fcd453e43dc88b
parentc5c70e54fc9ffd155fbc35d179ec00861bcfe9db (diff)
evas: Evas_3D - fix evas_3d_scene_pick when trying to get empty texcoords from mesh.
Summary: During filling evas pick public data by API evas_3d_scene_pick segfault can occur if mesh was created without texcoords. See functions - _pick_data_mesh_add, _pick_data_texcoord_update @fix Reviewers: cedric, Hermet, raster Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D1941 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--src/lib/evas/canvas/evas_3d_scene.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/lib/evas/canvas/evas_3d_scene.c b/src/lib/evas/canvas/evas_3d_scene.c
index c8a2c67d93..0e177a74ca 100644
--- a/src/lib/evas/canvas/evas_3d_scene.c
+++ b/src/lib/evas/canvas/evas_3d_scene.c
@@ -352,7 +352,8 @@ _pick_data_mesh_add(Evas_3D_Pick_Data *data, const Evas_Ray3 *ray,
352 352
353 if (_pick_data_triangle_add(data, ray, &tri)) 353 if (_pick_data_triangle_add(data, ray, &tri))
354 { 354 {
355 _pick_data_texcoord_update(data, &tex0, &tex1, tex_weight, i0, i1, i2); 355 if (tex0.data)
356 _pick_data_texcoord_update(data, &tex0, &tex1, tex_weight, i0, i1, i2);
356 data->mesh = mesh; 357 data->mesh = mesh;
357 data->node = node; 358 data->node = node;
358 } 359 }
@@ -399,7 +400,8 @@ _pick_data_mesh_add(Evas_3D_Pick_Data *data, const Evas_Ray3 *ray,
399 i1 = ((unsigned char *)pdmesh->indices)[i + 1]; 400 i1 = ((unsigned char *)pdmesh->indices)[i + 1];
400 } 401 }
401 402
402 _pick_data_texcoord_update(data, &tex0, &tex1, tex_weight, i0, i1, i2); 403 if (tex0.data)
404 _pick_data_texcoord_update(data, &tex0, &tex1, tex_weight, i0, i1, i2);
403 data->mesh = mesh; 405 data->mesh = mesh;
404 data->node = node; 406 data->node = node;
405 } 407 }
@@ -439,7 +441,8 @@ _pick_data_mesh_add(Evas_3D_Pick_Data *data, const Evas_Ray3 *ray,
439 else 441 else
440 i1 = ((unsigned char *)pdmesh->indices)[i]; 442 i1 = ((unsigned char *)pdmesh->indices)[i];
441 443
442 _pick_data_texcoord_update(data, &tex0, &tex1, tex_weight, i0, i1, i2); 444 if (tex0.data)
445 _pick_data_texcoord_update(data, &tex0, &tex1, tex_weight, i0, i1, i2);
443 data->mesh = mesh; 446 data->mesh = mesh;
444 data->node = node; 447 data->node = node;
445 } 448 }
@@ -458,7 +461,8 @@ _pick_data_mesh_add(Evas_3D_Pick_Data *data, const Evas_Ray3 *ray,
458 461
459 if (_pick_data_triangle_add(data, ray, &tri)) 462 if (_pick_data_triangle_add(data, ray, &tri))
460 { 463 {
461 _pick_data_texcoord_update(data, &tex0, &tex1, tex_weight, i, i + 1, i + 2); 464 if (tex0.data)
465 _pick_data_texcoord_update(data, &tex0, &tex1, tex_weight, i, i + 1, i + 2);
462 data->mesh = mesh; 466 data->mesh = mesh;
463 data->node = node; 467 data->node = node;
464 } 468 }
@@ -478,7 +482,8 @@ _pick_data_mesh_add(Evas_3D_Pick_Data *data, const Evas_Ray3 *ray,
478 482
479 if (_pick_data_triangle_add(data, ray, &tri)) 483 if (_pick_data_triangle_add(data, ray, &tri))
480 { 484 {
481 _pick_data_texcoord_update(data, &tex0, &tex1, tex_weight, i, i + 1, i + 2); 485 if (tex0.data)
486 _pick_data_texcoord_update(data, &tex0, &tex1, tex_weight, i, i + 1, i + 2);
482 data->mesh = mesh; 487 data->mesh = mesh;
483 data->node = node; 488 data->node = node;
484 } 489 }
@@ -497,7 +502,8 @@ _pick_data_mesh_add(Evas_3D_Pick_Data *data, const Evas_Ray3 *ray,
497 502
498 if (_pick_data_triangle_add(data, ray, &tri)) 503 if (_pick_data_triangle_add(data, ray, &tri))
499 { 504 {
500 _pick_data_texcoord_update(data, &tex0, &tex1, tex_weight, 0, i, i + 1); 505 if (tex0.data)
506 _pick_data_texcoord_update(data, &tex0, &tex1, tex_weight, 0, i, i + 1);
501 data->mesh = mesh; 507 data->mesh = mesh;
502 data->node = node; 508 data->node = node;
503 } 509 }
@@ -516,7 +522,8 @@ _pick_data_mesh_add(Evas_3D_Pick_Data *data, const Evas_Ray3 *ray,
516 522
517 if (_pick_data_triangle_add(data, ray, &tri)) 523 if (_pick_data_triangle_add(data, ray, &tri))
518 { 524 {
519 _pick_data_texcoord_update(data, &tex0, &tex1, tex_weight, i, i + 1, i + 2); 525 if (tex0.data)
526 _pick_data_texcoord_update(data, &tex0, &tex1, tex_weight, i, i + 1, i + 2);
520 data->mesh = mesh; 527 data->mesh = mesh;
521 data->node = node; 528 data->node = node;
522 } 529 }
@@ -536,7 +543,8 @@ _pick_data_mesh_add(Evas_3D_Pick_Data *data, const Evas_Ray3 *ray,
536 543
537 if (_pick_data_triangle_add(data, ray, &tri)) 544 if (_pick_data_triangle_add(data, ray, &tri))
538 { 545 {
539 _pick_data_texcoord_update(data, &tex0, &tex1, tex_weight, i, i + 1, i + 2); 546 if (tex0.data)
547 _pick_data_texcoord_update(data, &tex0, &tex1, tex_weight, i, i + 1, i + 2);
540 data->mesh = mesh; 548 data->mesh = mesh;
541 data->node = node; 549 data->node = node;
542 } 550 }
@@ -555,7 +563,8 @@ _pick_data_mesh_add(Evas_3D_Pick_Data *data, const Evas_Ray3 *ray,
555 563
556 if (_pick_data_triangle_add(data, ray, &tri)) 564 if (_pick_data_triangle_add(data, ray, &tri))
557 { 565 {
558 _pick_data_texcoord_update(data, &tex0, &tex1, tex_weight, 0, i, i + 1); 566 if (tex0.data)
567 _pick_data_texcoord_update(data, &tex0, &tex1, tex_weight, 0, i, i + 1);
559 data->mesh = mesh; 568 data->mesh = mesh;
560 data->node = node; 569 data->node = node;
561 } 570 }