cogl/
depth_state.rs

1use glib::translate::*;
2use std::mem;
3
4#[repr(C)]
5#[derive(Clone, Copy, Debug)] // PartialEq, Eq, Hash
6pub struct DepthState {
7    pub private_member_magic: u32,
8    pub private_member_test_enabled: bool,  // CoglBool
9    pub private_member_test_function: i32, // CoglDepthTestFunction, // TODO: possible should be enum
10    pub private_member_write_enabled: bool, // CoglBool
11    pub private_member_range_near: f32,
12    pub private_member_range_far: f32,
13    pub private_member_padding0: u32,
14    pub private_member_padding1: u32,
15    pub private_member_padding2: u32,
16    pub private_member_padding3: u32,
17    pub private_member_padding4: u32,
18    pub private_member_padding5: u32,
19    pub private_member_padding6: u32,
20    pub private_member_padding7: u32,
21    pub private_member_padding8: u32,
22    pub private_member_padding9: u32,
23}
24
25//pub const COGL_DEPTH_TEST_FUNCTION_NEVER: CoglDepthTestFunction = 512;
26//pub const COGL_DEPTH_TEST_FUNCTION_LESS: CoglDepthTestFunction = 513;
27//pub const COGL_DEPTH_TEST_FUNCTION_EQUAL: CoglDepthTestFunction = 514;
28//pub const COGL_DEPTH_TEST_FUNCTION_LEQUAL: CoglDepthTestFunction = 515;
29//pub const COGL_DEPTH_TEST_FUNCTION_GREATER: CoglDepthTestFunction = 516;
30//pub const COGL_DEPTH_TEST_FUNCTION_NOTEQUAL: CoglDepthTestFunction = 517;
31//pub const COGL_DEPTH_TEST_FUNCTION_GEQUAL: CoglDepthTestFunction = 518;
32//pub const COGL_DEPTH_TEST_FUNCTION_ALWAYS: CoglDepthTestFunction = 519;
33
34#[doc(hidden)]
35impl Uninitialized for DepthState {
36    #[inline]
37    unsafe fn uninitialized() -> Self {
38        mem::zeroed()
39    }
40}
41
42#[doc(hidden)]
43impl<'a> ToGlibPtr<'a, *const ffi::CoglDepthState> for DepthState {
44    type Storage = &'a Self;
45
46    #[inline]
47    fn to_glib_none(&'a self) -> Stash<'a, *const ffi::CoglDepthState, Self> {
48        let ptr: *const DepthState = &*self;
49        Stash(ptr as *const ffi::CoglDepthState, self)
50    }
51}
52
53#[doc(hidden)]
54impl<'a> ToGlibPtrMut<'a, *mut ffi::CoglDepthState> for DepthState {
55    type Storage = &'a mut Self;
56
57    #[inline]
58    fn to_glib_none_mut(&'a mut self) -> StashMut<'a, *mut ffi::CoglDepthState, Self> {
59        let ptr: *mut DepthState = &mut *self;
60        StashMut(ptr as *mut ffi::CoglDepthState, self)
61    }
62}
63
64#[doc(hidden)]
65impl FromGlibPtrNone<*const ffi::CoglDepthState> for DepthState {
66    unsafe fn from_glib_none(ptr: *const ffi::CoglDepthState) -> Self {
67        *(ptr as *const DepthState)
68    }
69}
70
71#[doc(hidden)]
72impl FromGlibPtrNone<*mut ffi::CoglDepthState> for DepthState {
73    unsafe fn from_glib_none(ptr: *mut ffi::CoglDepthState) -> Self {
74        *(ptr as *mut DepthState)
75    }
76}
77
78#[doc(hidden)]
79impl FromGlibPtrBorrow<*mut ffi::CoglDepthState> for DepthState {
80    unsafe fn from_glib_borrow(ptr: *mut ffi::CoglDepthState) -> glib::translate::Borrowed<Self> {
81        glib::translate::Borrowed::new(*(ptr as *mut DepthState))
82    }
83}
84
85#[doc(hidden)]
86impl FromGlibPtrBorrow<*const ffi::CoglDepthState> for DepthState {
87    unsafe fn from_glib_borrow(ptr: *const ffi::CoglDepthState) -> glib::translate::Borrowed<Self> {
88        glib::translate::Borrowed::new(*(ptr as *const DepthState))
89    }
90}