Skip to main content

ClusterGrid

Struct ClusterGrid 

Source
pub struct ClusterGrid {
    pub tiles_x: u32,
    pub tiles_y: u32,
    /* private fields */
}
Expand description

Bildschirm-Kachelraster × logarithmische Tiefenscheiben.

Fields§

§tiles_x: u32

Kacheln waagerecht.

§tiles_y: u32

Kacheln senkrecht.

Implementations§

Source§

impl ClusterGrid

Source

pub fn new(tiles_x: u32, tiles_y: u32, slices: u32, near: f32, far: f32) -> Self

Raster mit tiles_x·tiles_y Kacheln und slices Scheiben über near..far. Alle Achsen mindestens 1; far <= near wird auf near · 1.001 gehoben.

Source

pub fn for_render_size( render_size: [u32; 2], tile_size: u32, slices: u32, near: f32, far: f32, ) -> Self

Kachelraster für eine Rendergröße: tiles = ceil(size / tile_size), mindestens 1 je Achse.

Source

pub fn slice_count(&self) -> u32

Anzahl Tiefenscheiben.

Source

pub fn cluster_count(&self) -> u32

Gesamtzahl Cluster.

Source

pub fn slice_bounds(&self, slice: u32) -> Option<(f32, f32)>

Grenzen der Scheibe slice als (near, far) dieser Scheibe.

Source

pub fn index(&self, tile_x: u32, tile_y: u32, slice: u32) -> u32

Linearer Cluster-Index: x am schnellsten, dann y, dann Scheibe — benachbarte Kacheln liegen also beieinander (gutmütig für Speicherzugriff-Muster auf der GPU).

Source

pub fn coords(&self, index: u32) -> Option<(u32, u32, u32)>

Umkehrung von Self::index. None außerhalb des Rasters.

Source

pub fn slice_of(&self, view_depth: f32) -> Option<u32>

Scheibe einer Sichttiefe. None außerhalb near..far. Scheibengrenzen gehören zur unteren Scheibe (nur near selbst startet Scheibe 0) — so ist die Zuordnung eindeutig.

Source

pub fn locate( &self, pixel_x: u32, pixel_y: u32, tile_size: u32, view_depth: f32, ) -> Option<u32>

Cluster für einen Pixel (pixel_x, pixel_y) bei gegebener Kachelgröße und Sichttiefe. Pixel außerhalb des Rasters werden auf die Randkachel geklemmt (Raster deckt die Rendergröße vollständig).

Trait Implementations§

Source§

impl Clone for ClusterGrid

Source§

fn clone(&self) -> ClusterGrid

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 ClusterGrid

Source§

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

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

impl PartialEq for ClusterGrid

Source§

fn eq(&self, other: &ClusterGrid) -> 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 ClusterGrid

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.