cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=ab147386adddd057834bda274a2edbcda890cb4d

commit ab147386adddd057834bda274a2edbcda890cb4d
Author: Ivan Furs <i.f...@samsung.com>
Date:   Tue May 26 18:29:18 2015 +0200

    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 <ced...@osg.samsung.com>
---
 src/lib/evas/canvas/evas_3d_node.c | 28 +++++++++++++---------------
 1 file 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 92c6f3b..ea54ca3 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)
         _pack_meshes_vertex_data(node, &vertices, &count);
         if (count > 0)
           {
-             _scale_vertices(&pd->scale_world, count, vertices);
-             if (mesh_geom_dirty)
-               _calculate_box(&pd->local_obb, count, vertices);
-
-             if (transform_scale_dirty || mesh_geom_dirty)
-               {
-                  _calculate_sphere(&pd->local_bsphere, count, vertices);
-               }
-             if (transform_orientation_dirty || mesh_geom_dirty)
-               {
-                  _rotate_vertices(&pd->orientation_world, count, vertices);
-                  _calculate_box(&pd->local_aabb, count, vertices);
-               }
+            //For aabb calculate to need all transformations(scale, 
orientation, position) of primary data of vertices.
+            _scale_vertices(&pd->scale_world, count, vertices);
+            _calculate_box(&pd->local_obb, count, vertices);
+            _rotate_vertices(&pd->orientation_world, count, vertices);
+            _calculate_box(&pd->local_aabb, count, vertices);
+            if (transform_scale_dirty || mesh_geom_dirty)
+              {
+                 _calculate_sphere(&pd->local_bsphere, count, vertices);
+              }
           }
         free(vertices);
      }
 
    pd->bsphere.radius = pd->local_bsphere.radius;
    evas_vec3_quaternion_rotate(&pd->bsphere.center, &pd->local_bsphere.center, 
&pd->orientation_world);
+   evas_vec3_quaternion_rotate(&pd->obb.p0, &pd->local_obb.p0, 
&pd->orientation_world);
+   evas_vec3_quaternion_rotate(&pd->obb.p1, &pd->local_obb.p1, 
&pd->orientation_world);
    evas_vec3_add(&pd->obb.p0, &position, &pd->local_obb.p0);
    evas_vec3_add(&pd->obb.p1, &position, &pd->local_obb.p1);
    evas_vec3_add(&pd->aabb.p0, &position, &pd->local_aabb.p0);
    evas_vec3_add(&pd->aabb.p1, &position, &pd->local_aabb.p1);
-   evas_vec3_add(&pd->bsphere.center, &position, &pd->bsphere.center);
+   evas_vec3_add(&pd->bsphere.center, &position, &pd->local_bsphere.center);
 }
 
 static Eina_Bool
@@ -612,9 +610,9 @@ _node_aabb_update(Evas_3D_Node *node, void *data 
EINA_UNUSED)
         Evas_3D_Node_Data *datapd = eo_data_scope_get(datanode, 
EVAS_3D_NODE_CLASS);
         evas_box3_union(&pd->obb, &pd->obb, &datapd->obb);
         evas_box3_union(&pd->aabb, &pd->aabb, &datapd->aabb);
-        evas_build_sphere(&pd->aabb, &pd->bsphere);
      }
 
+   evas_build_sphere(&pd->aabb, &pd->bsphere);
    eo_desc = eo_base_legacy_only_event_description_get("collision,private");
    eo_do(node, eo_event_callback_call(eo_desc, (void *)node));
 

-- 


Reply via email to