1use crate::{ffi, Box, Point3D, Sphere};
6use glib::translate::*;
7
8glib::wrapper! {
9 pub struct Frustum(BoxedInline<ffi::graphene_frustum_t>);
10
11 match fn {
12 copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::graphene_frustum_get_type(), ptr as *mut _) as *mut ffi::graphene_frustum_t,
13 free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::graphene_frustum_get_type(), ptr as *mut _),
14 type_ => || ffi::graphene_frustum_get_type(),
15 }
16}
17
18impl Frustum {
19 #[doc(alias = "graphene_frustum_contains_point")]
20 pub fn contains_point(&self, point: &Point3D) -> bool {
21 unsafe {
22 ffi::graphene_frustum_contains_point(self.to_glib_none().0, point.to_glib_none().0)
23 }
24 }
25
26 #[doc(alias = "graphene_frustum_equal")]
27 fn equal(&self, b: &Frustum) -> bool {
28 unsafe { ffi::graphene_frustum_equal(self.to_glib_none().0, b.to_glib_none().0) }
29 }
30
31 #[doc(alias = "graphene_frustum_intersects_box")]
32 pub fn intersects_box(&self, box_: &Box) -> bool {
33 unsafe {
34 ffi::graphene_frustum_intersects_box(self.to_glib_none().0, box_.to_glib_none().0)
35 }
36 }
37
38 #[doc(alias = "graphene_frustum_intersects_sphere")]
39 pub fn intersects_sphere(&self, sphere: &Sphere) -> bool {
40 unsafe {
41 ffi::graphene_frustum_intersects_sphere(self.to_glib_none().0, sphere.to_glib_none().0)
42 }
43 }
44}
45
46impl PartialEq for Frustum {
47 #[inline]
48 fn eq(&self, other: &Self) -> bool {
49 self.equal(other)
50 }
51}
52
53impl Eq for Frustum {}