pub(in worldgen::feature) enum Rotation {
None,
Clockwise90,
Clockwise180,
CounterClockwise90,
}Expand description
Horizontal rotation around the Y axis.
Variants§
None
0°.
Clockwise90
90° clockwise.
Clockwise180
180°.
CounterClockwise90
270° clockwise (= 90° counter-clockwise).
Implementations§
Source§impl Rotation
impl Rotation
Sourcepub fn get_random(rng: &mut impl Random) -> Rotation
pub fn get_random(rng: &mut impl Random) -> Rotation
Matches vanilla’s Rotation.getRandom(random).
Sourcepub fn get_shuffled(rng: &mut impl Random) -> [Rotation; 4]
pub fn get_shuffled(rng: &mut impl Random) -> [Rotation; 4]
Matches vanilla’s Util.shuffledCopy(values(), random) (reverse Fisher-Yates).
Sourcepub const fn rotate(self, dir: Direction) -> Direction
pub const fn rotate(self, dir: Direction) -> Direction
Vertical directions (Up/Down) are unchanged.
Sourcepub const fn then(self, other: Rotation) -> Rotation
pub const fn then(self, other: Rotation) -> Rotation
self.then(other) = apply self first, then other.
Sourcepub const fn transform_pos(self, pos: IVec3, pivot: IVec3) -> IVec3
pub const fn transform_pos(self, pos: IVec3, pivot: IVec3) -> IVec3
Matches vanilla’s StructureTemplate.transform(pos, Mirror.NONE, rotation, pivot).
pivot.y is ignored (only the XZ plane matters).
Sourcepub const fn rotate_size(self, size: IVec3) -> IVec3
pub const fn rotate_size(self, size: IVec3) -> IVec3
90°/270° swap the X and Z dimensions.
Sourcepub const fn transform_pos_mirrored(
self,
pos: IVec3,
pivot: IVec3,
mirror_front_back: bool,
) -> IVec3
pub const fn transform_pos_mirrored( self, pos: IVec3, pivot: IVec3, mirror_front_back: bool, ) -> IVec3
Matches vanilla’s StructureTemplate.transform(pos, Mirror.FRONT_BACK, rotation, pivot).
Sourcepub fn get_bounding_box_full(
self,
pos: IVec3,
size: IVec3,
pivot: IVec3,
mirror_front_back: bool,
) -> Aabb<IVec3, Structure>
pub fn get_bounding_box_full( self, pos: IVec3, size: IVec3, pivot: IVec3, mirror_front_back: bool, ) -> Aabb<IVec3, Structure>
Matches vanilla’s StructureTemplate.getBoundingBox(position, rotation, pivot, mirror, size).
Trait Implementations§
impl Copy for Rotation
impl Eq for Rotation
impl StructuralPartialEq for Rotation
Auto Trait Implementations§
impl Freeze for Rotation
impl RefUnwindSafe for Rotation
impl Send for Rotation
impl Sync for Rotation
impl Unpin for Rotation
impl UnsafeUnpin for Rotation
impl UnwindSafe for Rotation
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
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
Checks if this value is equivalent to the given key. Read more
§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
Compare self to
key and return true if they are equal.§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
Compares
self with key and returns true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreWraps this value in an
Arc<SyncMutex<>>