#[repr(u8)]pub enum CubeFace {
PosX = 0,
NegX = 1,
PosY = 2,
NegY = 3,
PosZ = 4,
NegZ = 5,
}Expand description
One of the six faces of an axis-aligned cube.
The discriminants are stable (u8) and match the wgpu cubemap face
ordering, so CubeFace::index can be used directly to address a
texture_cube_array layer set.
Variants§
PosX = 0
+X face.
NegX = 1
-X face.
PosY = 2
+Y face.
NegY = 3
-Y face.
PosZ = 4
+Z face.
NegZ = 5
-Z face.
Implementations§
Source§impl CubeFace
impl CubeFace
Sourcepub const ALL: [CubeFace; 6]
pub const ALL: [CubeFace; 6]
All six faces in wgpu cubemap order: [+X, -X, +Y, -Y, +Z, -Z].
Use this with Iterator::map or array .map() to produce per-face
data structures (view matrices, render passes, atlas slots…) in a
stable order that matches the GPU’s expectation.
Sourcepub const fn index(self) -> usize
pub const fn index(self) -> usize
Returns the layer index this face occupies inside a
texture_cube_array slice (0..=5).
Sourcepub const fn forward(self) -> Vec3
pub const fn forward(self) -> Vec3
World-space direction the rendering camera looks toward when rasterising this face.
Sourcepub const fn up(self) -> Vec3
pub const fn up(self) -> Vec3
World-space “up” direction matching the wgpu / Vulkan / D3D11
cubemap convention. The ±Y faces use ±Z as their up vector to keep
look_at_rh(eye, eye + face.forward(), face.up()) non-degenerate.
Sourcepub fn from_direction(dir: Vec3) -> CubeFace
pub fn from_direction(dir: Vec3) -> CubeFace
Picks the face whose forward axis is most aligned
with dir (largest absolute component wins, sign chooses the
half-axis).
This is the major-axis selection used in CPU-side cubemap sampling
debug paths and unit tests; the GPU equivalent runs in hardware
during textureSampleCompareLevel(cube, ...).
Trait Implementations§
impl Copy for CubeFace
impl Eq for CubeFace
impl StructuralPartialEq for CubeFace
Auto Trait Implementations§
impl Freeze for CubeFace
impl RefUnwindSafe for CubeFace
impl Send for CubeFace
impl Sync for CubeFace
impl Unpin for CubeFace
impl UnsafeUnpin for CubeFace
impl UnwindSafe for CubeFace
Blanket Implementations§
Source§impl<T> AppLifecycle for Twhere
T: ?Sized,
impl<T> AppLifecycle for Twhere
T: ?Sized,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.