[−][src]Struct web_glitz::pipeline::graphics::PolygonOffset
Specifies an offset modifier for for depth values from polygonal fragments.
When a DepthTest specifies a polygon offset, then an offset is applied to depth values for
fragments from polygonal primitives (triangles) before they are tested and before the depth
value is written to the depth buffer. This offset is computed as factor * DZ + r * units
,
where factor
is the [factor] specified by the PolygonOffset instance, DZ
is a measurement
of the fragment's rate of change in depth relative to the screen area of the polygon, units
is
the [units] value specified by the PolygonOffset instance, and r
is the smallest value that
is guaranteed to produce a resolvable offset for a given implementation.
A polygon offset is useful when rendering coplanar primitives, such as when rendering hidden-line images, when applying decals to surfaces, and when rendering solids with highlighted edges. Can be used to prevent what is called "stitching", "bleeding" or "Z-fighting", where fragments with very similar z-values do not always produce predictable results.
Only applies to fragments from polygonal primitives (triangles); ignored for fragments from other primitives (points, lines). If you are rendering e.g. a coplanar triangle and line, specify a polygon offset to "push back" the triangle, rather than attempting to "push forward" the line.
May be instantiated with default values through Default:
use web_glitz::pipeline::graphics::PolygonOffset; assert_eq!(PolygonOffset::default(), PolygonOffset { factor: 0.0, units: 0.0, });
Fields
factor: f32
Specifies a scale factor that is used to create a variable depth offset for each polygon.
See the type documentation for PolygonOffset for details.
Defaults to 0.0
.
units: f32
Is multiplied by an implementation-specific value to create a constant depth offset.
See the type documentation for PolygonOffset for details.
Defaults to 0.0
.
Trait Implementations
impl Default for PolygonOffset
[src]
fn default() -> PolygonOffset
[src]
impl Clone for PolygonOffset
[src]
fn clone(&self) -> PolygonOffset
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl PartialEq<PolygonOffset> for PolygonOffset
[src]
fn eq(&self, other: &PolygonOffset) -> bool
[src]
fn ne(&self, other: &PolygonOffset) -> bool
[src]
impl Debug for PolygonOffset
[src]
Auto Trait Implementations
impl Send for PolygonOffset
impl Unpin for PolygonOffset
impl Sync for PolygonOffset
impl UnwindSafe for PolygonOffset
impl RefUnwindSafe for PolygonOffset
Blanket Implementations
impl<D, T> IntoBuffer<T> for D where
D: Borrow<T> + 'static,
T: Copy + 'static,
[src]
D: Borrow<T> + 'static,
T: Copy + 'static,
fn into_buffer<Rc>(Self, &Rc, UsageHint) -> Buffer<T> where
Rc: RenderingContext + Clone + 'static,
[src]
Rc: RenderingContext + Clone + 'static,
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> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for 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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,