summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Furs <i.furs@samsung.com>2015-05-26 18:29:18 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-05-27 00:31:06 +0200
commitab147386adddd057834bda274a2edbcda890cb4d (patch)
tree08c78b49ca28524fbdd8222672db9752dfd372a0
parent69857d7f7ca5888f7fc88ab34ca5f7ff5bd433fa (diff)
evas: fix errors when updating the bounding box of Evas_3d_Node.
Summary: For calculation 'aabb' need to know how mesh was transformed. So for primary data of mesh was calculate all transformation. Reviewers: Hermet, cedric Reviewed By: cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2563 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--src/lib/evas/canvas/evas_3d_node.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/lib/evas/canvas/evas_3d_node.c b/src/lib/evas/canvas/evas_3d_node.c
index 92c6f3bbd6..ea54ca30c4 100644
--- a/src/lib/evas/canvas/evas_3d_node.c
+++ b/src/lib/evas/canvas/evas_3d_node.c
@@ -557,30 +557,28 @@ _update_node_shapes(Evas_3D_Node *node)
557 _pack_meshes_vertex_data(node, &vertices, &count); 557 _pack_meshes_vertex_data(node, &vertices, &count);
558 if (count > 0) 558 if (count > 0)
559 { 559 {
560 _scale_vertices(&pd->scale_world, count, vertices); 560 //For aabb calculate to need all transformations(scale, orientation, position) of primary data of vertices.
561 if (mesh_geom_dirty) 561 _scale_vertices(&pd->scale_world, count, vertices);
562 _calculate_box(&pd->local_obb, count, vertices); 562 _calculate_box(&pd->local_obb, count, vertices);
563 563 _rotate_vertices(&pd->orientation_world, count, vertices);
564 if (transform_scale_dirty || mesh_geom_dirty) 564 _calculate_box(&pd->local_aabb, count, vertices);
565 { 565 if (transform_scale_dirty || mesh_geom_dirty)
566 _calculate_sphere(&pd->local_bsphere, count, vertices); 566 {
567 } 567 _calculate_sphere(&pd->local_bsphere, count, vertices);
568 if (transform_orientation_dirty || mesh_geom_dirty) 568 }
569 {
570 _rotate_vertices(&pd->orientation_world, count, vertices);
571 _calculate_box(&pd->local_aabb, count, vertices);
572 }
573 } 569 }
574 free(vertices); 570 free(vertices);
575 } 571 }
576 572
577 pd->bsphere.radius = pd->local_bsphere.radius; 573 pd->bsphere.radius = pd->local_bsphere.radius;
578 evas_vec3_quaternion_rotate(&pd->bsphere.center, &pd->local_bsphere.center, &pd->orientation_world); 574 evas_vec3_quaternion_rotate(&pd->bsphere.center, &pd->local_bsphere.center, &pd->orientation_world);
575 evas_vec3_quaternion_rotate(&pd->obb.p0, &pd->local_obb.p0, &pd->orientation_world);
576 evas_vec3_quaternion_rotate(&pd->obb.p1, &pd->local_obb.p1, &pd->orientation_world);
579 evas_vec3_add(&pd->obb.p0, &position, &pd->local_obb.p0); 577 evas_vec3_add(&pd->obb.p0, &position, &pd->local_obb.p0);
580 evas_vec3_add(&pd->obb.p1, &position, &pd->local_obb.p1); 578 evas_vec3_add(&pd->obb.p1, &position, &pd->local_obb.p1);
581 evas_vec3_add(&pd->aabb.p0, &position, &pd->local_aabb.p0); 579 evas_vec3_add(&pd->aabb.p0, &position, &pd->local_aabb.p0);
582 evas_vec3_add(&pd->aabb.p1, &position, &pd->local_aabb.p1); 580 evas_vec3_add(&pd->aabb.p1, &position, &pd->local_aabb.p1);
583 evas_vec3_add(&pd->bsphere.center, &position, &pd->bsphere.center); 581 evas_vec3_add(&pd->bsphere.center, &position, &pd->local_bsphere.center);
584} 582}
585 583
586static Eina_Bool 584static Eina_Bool
@@ -612,9 +610,9 @@ _node_aabb_update(Evas_3D_Node *node, void *data EINA_UNUSED)
612 Evas_3D_Node_Data *datapd = eo_data_scope_get(datanode, EVAS_3D_NODE_CLASS); 610 Evas_3D_Node_Data *datapd = eo_data_scope_get(datanode, EVAS_3D_NODE_CLASS);
613 evas_box3_union(&pd->obb, &pd->obb, &datapd->obb); 611 evas_box3_union(&pd->obb, &pd->obb, &datapd->obb);
614 evas_box3_union(&pd->aabb, &pd->aabb, &datapd->aabb); 612 evas_box3_union(&pd->aabb, &pd->aabb, &datapd->aabb);
615 evas_build_sphere(&pd->aabb, &pd->bsphere);
616 } 613 }
617 614
615 evas_build_sphere(&pd->aabb, &pd->bsphere);
618 eo_desc = eo_base_legacy_only_event_description_get("collision,private"); 616 eo_desc = eo_base_legacy_only_event_description_get("collision,private");
619 eo_do(node, eo_event_callback_call(eo_desc, (void *)node)); 617 eo_do(node, eo_event_callback_call(eo_desc, (void *)node));
620 618