Skip to main content

HiZPyramid

Struct HiZPyramid 

Source
pub struct HiZPyramid {
    pub width: u32,
    pub height: u32,
    pub levels: Vec<Vec<f32>>,
}
Expand description

Pyramide aus minimierten Tiefen (0 = nah, 1 = fern).

Level 0 ist die Auflösung des Depth-Buffers; jedes folgende Level ist die 2×2-Min-Reduktion des vorigen („nächste Tiefe der Region“). Die GPU-Fassung macht dasselbe per Compute/Mip-Generation mit Min-Filter.

Fields§

§width: u32§height: u32§levels: Vec<Vec<f32>>

Level 0 zuerst; jedes Level l hat ceil(width/2^l) × ceil(height/2^l).

Implementations§

Source§

impl HiZPyramid

Source

pub fn new(width: u32, height: u32) -> Self

Pyramide der gegebenen Größe; alle Level initial 1.0 (= fern, verdeckt nichts).

Source

pub fn level_count(&self) -> u32

Anzahl Level.

Source

pub fn build_from_depth(&mut self, depth: &[f32])

Pyramide aus einem Depth-Buffer (Level-0-Größe) aufbauen. Falsche Datenlänge ist ein Aufrufer-Fehler → Panic mit Ansage.

Source

pub fn level_width(&self, l: u32) -> u32

Source

pub fn level_height(&self, l: u32) -> u32

Source

pub fn level_for_size(w: u32, h: u32) -> u32

Level, auf dem ein w×h großes Bildschirm-Fenster in genau ein Texel passt (log2 der Kantenlänge, aufwärts).

Source

pub fn min_depth_in( &self, level: u32, x0: u32, y0: u32, x1: u32, y1: u32, ) -> f32

Nächste Szenentiefe (Minimum) im Fenster [x0..x1) × [y0..y1) eines Levels, geclampt auf die Level-Grenzen.

Source

pub fn occludes( &self, level: u32, tx: u32, ty: u32, near_depth: f32, epsilon: f32, ) -> bool

Konservativer Okklusionstest: Ist ein Objekt, dessen Bildschirm-
fenster auf Level level in das Texel (tx, ty) fällt und dessen naheste Tiefe near_depth ist, vollständig verdeckt?

Verdeckt, wenn die nächste Szenentiefe im Region-Minimum (<= near_depth + epsilon) nicht hinter dem Objektnahrand liegt.

Trait Implementations§

Source§

impl Clone for HiZPyramid

Source§

fn clone(&self) -> HiZPyramid

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HiZPyramid

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for HiZPyramid

Source§

fn eq(&self, other: &HiZPyramid) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for HiZPyramid

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.