1use crate::{ffi, Box, Point3D, Sphere};
6use glib::translate::*;
7
8glib::wrapper! {
9    pub struct Frustum(BoxedInline<ffi::graphene_frustum_t>);
14
15    match fn {
16        copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::graphene_frustum_get_type(), ptr as *mut _) as *mut ffi::graphene_frustum_t,
17        free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::graphene_frustum_get_type(), ptr as *mut _),
18        type_ => || ffi::graphene_frustum_get_type(),
19    }
20}
21
22impl Frustum {
23    #[doc(alias = "graphene_frustum_contains_point")]
32    pub fn contains_point(&self, point: &Point3D) -> bool {
33        unsafe {
34            ffi::graphene_frustum_contains_point(self.to_glib_none().0, point.to_glib_none().0)
35        }
36    }
37
38    #[doc(alias = "graphene_frustum_equal")]
39    fn equal(&self, b: &Frustum) -> bool {
40        unsafe { ffi::graphene_frustum_equal(self.to_glib_none().0, b.to_glib_none().0) }
41    }
42
43    #[doc(alias = "graphene_frustum_intersects_box")]
52    pub fn intersects_box(&self, box_: &Box) -> bool {
53        unsafe {
54            ffi::graphene_frustum_intersects_box(self.to_glib_none().0, box_.to_glib_none().0)
55        }
56    }
57
58    #[doc(alias = "graphene_frustum_intersects_sphere")]
67    pub fn intersects_sphere(&self, sphere: &Sphere) -> bool {
68        unsafe {
69            ffi::graphene_frustum_intersects_sphere(self.to_glib_none().0, sphere.to_glib_none().0)
70        }
71    }
72}
73
74impl PartialEq for Frustum {
75    #[inline]
76    fn eq(&self, other: &Self) -> bool {
77        self.equal(other)
78    }
79}
80
81impl Eq for Frustum {}