Struct glium::draw_parameters::Depth
source · pub struct Depth {
pub test: DepthTest,
pub write: bool,
pub range: (f32, f32),
pub clamp: DepthClamp,
}
Expand description
Represents the depth parameters of a draw command.
Fields§
§test: DepthTest
The function that the GPU will use to determine whether to write over an existing pixel
on the target. Don’t forget to set depth_write
appropriately if you use a depth test.
See the DepthTest
documentation for more details.
The default is Overwrite
.
write: bool
Sets whether the GPU will write the depth values on the depth buffer if they pass the depth test.
The default is false
. You most likely want true
if you’re doing depth testing.
If you pass true
but don’t have a depth buffer available, drawing will produce
a NoDepthBuffer
error.
range: (f32, f32)
The range of possible Z values in surface coordinates.
Just like OpenGL turns X and Y coordinates between -1.0
and 1.0
into surface
coordinates, it will also map your Z coordinates to a certain range which you can
specify here.
The two values must be between 0.0
and 1.0
, anything outside this range will result
in a panic. By default the depth range is (0.0, 1.0)
.
The first value of the tuple must be the “near” value, where -1.0
will be mapped.
The second value must be the “far” value, where 1.0
will be mapped.
It is possible for the “near” value to be greater than the “far” value.
clamp: DepthClamp
Sets whether the depth values of samples should be clamped to 0.0
and 1.0
.
The default value is NoClamp
.
Trait Implementations§
impl Copy for Depth
Auto Trait Implementations§
impl RefUnwindSafe for Depth
impl Send for Depth
impl Sync for Depth
impl Unpin for Depth
impl UnwindSafe for Depth
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Content for Twhere
T: Copy,
impl<T> Content for Twhere
T: Copy,
source§unsafe fn read<F, E>(size: usize, f: F) -> Result<T, E>
unsafe fn read<F, E>(size: usize, f: F) -> Result<T, E>
Owned
.
User-provided closure F
must only write to and not read from &mut Self
.source§fn get_elements_size() -> usize
fn get_elements_size() -> usize
source§fn to_void_ptr(&self) -> *const ()
fn to_void_ptr(&self) -> *const ()
source§fn ref_from_ptr<'a>(ptr: *mut (), size: usize) -> Option<*mut T>
fn ref_from_ptr<'a>(ptr: *mut (), size: usize) -> Option<*mut T>
source§fn is_size_suitable(size: usize) -> bool
fn is_size_suitable(size: usize) -> bool
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.