[−][src]Enum glium::draw_parameters::BackfaceCullingMode
Describes how triangles should be filtered before the fragment processing. Backface culling
is purely an optimization. If you don't know what this does, just use CullingDisabled
.
Backface culling
After the vertex shader stage, the GPU knows the 2D coordinates of each vertex of each triangle.
For a given triangle, there are only two situations:
- The vertices are arranged in a clockwise direction on the screen.
- The vertices are arranged in a counterclockwise direction on the screen.
If you wish so, you can ask the GPU to discard all the primitives that belong to one of these two categories.
Example
The vertices of this triangle are counter-clock-wise.
Usage
The trick is that if you make a 180° rotation of a shape, all triangles that were clockwise become counterclockwise and vice versa.
Therefore you can arrange your model so that the triangles that are facing the screen are all either clockwise or counterclockwise, and all the triangle are not facing the screen are the other one.
By doing so you can use backface culling to discard all the triangles that are not facing the screen, and increase your framerate.
Variants
All triangles are always drawn.
Triangles whose vertices are counterclockwise won't be drawn.
Triangles whose vertices are clockwise won't be drawn.
Trait Implementations
impl Clone for BackfaceCullingMode
[src]
fn clone(&self) -> BackfaceCullingMode
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for BackfaceCullingMode
[src]
impl Debug for BackfaceCullingMode
[src]
impl Eq for BackfaceCullingMode
[src]
impl PartialEq<BackfaceCullingMode> for BackfaceCullingMode
[src]
fn eq(&self, other: &BackfaceCullingMode) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl StructuralEq for BackfaceCullingMode
[src]
impl StructuralPartialEq for BackfaceCullingMode
[src]
Auto Trait Implementations
impl RefUnwindSafe for BackfaceCullingMode
impl Send for BackfaceCullingMode
impl Sync for BackfaceCullingMode
impl Unpin for BackfaceCullingMode
impl UnwindSafe for BackfaceCullingMode
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Content for T where
T: Copy,
[src]
T: Copy,
type Owned = T
A type that holds a sized version of the content.
fn read<F, E>(usize, F) -> Result<T, E> where
F: FnOnce(&mut T) -> Result<(), E>,
[src]
F: FnOnce(&mut T) -> Result<(), E>,
fn get_elements_size() -> usize
[src]
fn to_void_ptr(&Self) -> *const ()
[src]
fn ref_from_ptr(*mut (), usize) -> Option<*mut T>
[src]
fn is_size_suitable(usize) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,