summaryrefslogtreecommitdiff
path: root/src/lib/evas/include/evas_3d_utils.h
diff options
context:
space:
mode:
authorBogdan Devichev <b.devichev@samsung.com>2015-02-05 15:06:10 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-02-05 15:37:15 +0100
commit36515241b9a45436dc2202728904fe00925cd0ae (patch)
treea60e376e838dfd7276f9257d29dfedf2b315961a /src/lib/evas/include/evas_3d_utils.h
parentd503dbeed1b2e26272893f86c37df3eaeb270e30 (diff)
evas: Evas_3D - fix when bounding sphere is large, situation with incorrect frustum calculation was possible.
Summary: When center of bounding sphere was out of frustum and number of intersections between bs and planes of frustum was more then 3, objects disappeared. @fix Reviewers: Hermet, raster, cedric Reviewed By: cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D1938 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to 'src/lib/evas/include/evas_3d_utils.h')
-rw-r--r--src/lib/evas/include/evas_3d_utils.h29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/lib/evas/include/evas_3d_utils.h b/src/lib/evas/include/evas_3d_utils.h
index b6d52e9b17..0cf9f34928 100644
--- a/src/lib/evas/include/evas_3d_utils.h
+++ b/src/lib/evas/include/evas_3d_utils.h
@@ -1881,9 +1881,7 @@ evas_is_sphere_in_frustum(Evas_Sphere *bsphere, Evas_Vec4 *planes)
1881 int intersected_planes_count = 0; 1881 int intersected_planes_count = 0;
1882 1882
1883 for (i = 0; i < 6; i++) 1883 for (i = 0; i < 6; i++)
1884 { 1884 distances[i] = evas_point_plane_distance(&bsphere->center, &planes[i]);
1885 distances[i] = evas_point_plane_distance(&bsphere->center, &planes[i]);
1886 }
1887 1885
1888 for (i = 0; i < 6; i++) 1886 for (i = 0; i < 6; i++)
1889 { 1887 {
@@ -1898,21 +1896,24 @@ evas_is_sphere_in_frustum(Evas_Sphere *bsphere, Evas_Vec4 *planes)
1898 } 1896 }
1899 } 1897 }
1900 1898
1901 if ((intersected_planes_count == 0) || (intersected_planes_count == 1)) 1899 switch (intersected_planes_count)
1902 return EINA_TRUE;
1903 else if (intersected_planes_count == 2)
1904 {
1905 evas_intersection_line_of_two_planes(&line, &planes[intersected_planes[0]], &planes[intersected_planes[1]]);
1906 return (evas_point_line_distance(&bsphere->center, &line) < bsphere->radius) ? EINA_TRUE : EINA_FALSE;
1907 }
1908 else if (intersected_planes_count == 3)
1909 { 1900 {
1910 evas_intersection_point_of_three_planes(&point, &planes[intersected_planes[0]], &planes[intersected_planes[1]], &planes[intersected_planes[2]]); 1901 case 2:
1902 evas_intersection_line_of_two_planes(&line,
1903 &planes[intersected_planes[0]],
1904 &planes[intersected_planes[1]]);
1905 return (evas_point_line_distance(&bsphere->center, &line) <
1906 bsphere->radius) ? EINA_TRUE : EINA_FALSE;
1907 case 3:
1908 evas_intersection_point_of_three_planes(&point,
1909 &planes[intersected_planes[0]],
1910 &planes[intersected_planes[1]],
1911 &planes[intersected_planes[2]]);
1911 evas_vec3_subtract(&sub, &point, &bsphere->center); 1912 evas_vec3_subtract(&sub, &point, &bsphere->center);
1912 return (evas_vec3_length_get(&sub) < bsphere->radius) ? EINA_TRUE : EINA_FALSE; 1913 return (evas_vec3_length_get(&sub) < bsphere->radius) ? EINA_TRUE : EINA_FALSE;
1914 default:
1915 return EINA_TRUE;
1913 } 1916 }
1914
1915 return EINA_FALSE;
1916} 1917}
1917 1918
1918static inline Eina_Bool 1919static inline Eina_Bool