Skip to main content

Modifier

Enum Modifier 

Source
pub enum Modifier {
Show 14 variants Array { enabled: bool, count: i32, offset: Vec3, rotation: Vec3, scale: f32, }, Mirror { enabled: bool, x: bool, y: bool, z: bool, }, Subdivide { enabled: bool, levels: i32, smooth: f32, }, Displace { enabled: bool, strength: f32, scale: f32, seed: i32, }, Twist { enabled: bool, angle: f32, axis: ModAxis, }, Bend { enabled: bool, angle: f32, axis: ModAxis, }, Taper { enabled: bool, amount: f32, axis: ModAxis, }, Solidify { enabled: bool, thickness: f32, }, Wave { enabled: bool, amplitude: f32, wavelength: f32, axis: ModAxis, phase: f32, }, Cast { enabled: bool, factor: f32, }, Shear { enabled: bool, amount: f32, axis: ModAxis, }, Smooth { enabled: bool, iterations: i32, factor: f32, }, Jitter { enabled: bool, amount: f32, seed: i32, }, RadialArray { enabled: bool, count: i32, radius: f32, axis: ModAxis, face_outward: bool, },
}
Expand description

One entry of the stack. Fields are public so scripts can build stacks in code.

Variants§

§

Array

Repeats the mesh count times, each copy moved, rotated and scaled relative to the previous one.

Fields

§enabled: bool

Whether the modifier is applied.

§count: i32

Number of copies including the original (1..64).

§offset: Vec3

Offset between copies in local metres.

§rotation: Vec3

Extra rotation per copy in degrees.

§scale: f32

Scale multiplier per copy (1 = unchanged).

§

Mirror

Adds mirrored copies across the chosen local planes.

Fields

§enabled: bool

Whether the modifier is applied.

§x: bool

Mirror across the YZ plane.

§y: bool

Mirror across the XZ plane.

§z: bool

Mirror across the XY plane.

§

Subdivide

Splits every triangle into four, levels times (more vertices for Displace / Bend).

Fields

§enabled: bool

Whether the modifier is applied.

§levels: i32

Number of subdivision passes (1..4).

§smooth: f32

Pull new vertices onto a sphere of the original size, rounding the shape.

§

Displace

Pushes vertices along their normals by noise.

Fields

§enabled: bool

Whether the modifier is applied.

§strength: f32

Displacement in metres.

§scale: f32

Noise features per metre.

§seed: i32

Noise seed.

§

Twist

Rotates slices of the mesh progressively around an axis (a screw / wring).

Fields

§enabled: bool

Whether the modifier is applied.

§angle: f32

Total twist in degrees from one end to the other.

§axis: ModAxis

Axis the twist runs along.

§

Bend

Curves the mesh along an axis.

Fields

§enabled: bool

Whether the modifier is applied.

§angle: f32

Total bend in degrees from one end to the other.

§axis: ModAxis

Axis that gets bent.

§

Taper

Scales the cross-section along an axis: pointed or flared shapes.

Fields

§enabled: bool

Whether the modifier is applied.

§amount: f32

-1 pinches the top, +1 doubles it.

§axis: ModAxis

Axis the taper runs along.

§

Solidify

Gives surfaces thickness by adding an inner shell.

Fields

§enabled: bool

Whether the modifier is applied.

§thickness: f32

Shell thickness in metres.

§

Wave

Ripples the surface like a flag or water: a sine wave along one axis lifts the vertices.

Fields

§enabled: bool

Whether the modifier is applied.

§amplitude: f32

Height of the ripples in metres.

§wavelength: f32

Distance between crests in metres.

§axis: ModAxis

Axis the wave travels along.

§phase: f32

Shifts the wave pattern (0..1 = one full wavelength).

§

Cast

Pulls vertices towards a sphere (or pushes them away): turns boxes into balls.

Fields

§enabled: bool

Whether the modifier is applied.

§factor: f32

0 = unchanged, 1 = a perfect sphere, negative = inflated spikes.

§

Shear

Slants the mesh: the further along the axis, the more it leans sideways.

Fields

§enabled: bool

Whether the modifier is applied.

§amount: f32

Lean per metre along the axis.

§axis: ModAxis

Axis that decides how far each vertex leans.

§

Smooth

Averages every vertex with its neighbours: rounds off hard edges and noise.

Fields

§enabled: bool

Whether the modifier is applied.

§iterations: i32

Passes (1..10).

§factor: f32

How far each pass moves a vertex towards its neighbours, 0..1.

§

Jitter

Random push of every vertex: rough stone, crumpled paper, broken glass.

Fields

§enabled: bool

Whether the modifier is applied.

§amount: f32

Maximum offset in metres.

§seed: i32

Random seed.

§

RadialArray

Copies the mesh around a circle (columns of a temple, a fence ring, a wheel of spokes).

Fields

§enabled: bool

Whether the modifier is applied.

§count: i32

Copies including the original (2..64).

§radius: f32

Distance of each copy from the centre in metres.

§axis: ModAxis

Axis the circle turns around.

§face_outward: bool

Turn every copy to face outwards.

Implementations§

Source§

impl Modifier

Source

pub const NAMES: &'static [&'static str]

Names accepted by Self::named, in menu order.

Source

pub fn array(count: i32, offset: Vec3) -> Self

Default array: count copies spaced by offset.

Source

pub fn named(name: &str) -> Option<Self>

Default instance of a kind by name (“Array”, “Mirror”, …), used by the editor’s Add menu.

Source

pub fn name(&self) -> &'static str

Display name of this modifier.

Source

pub fn enabled(&self) -> bool

Whether the modifier is applied.

Source

pub fn fields(&mut self) -> Vec<Field<'_>>

Inspector fields of this modifier (including the enabled switch).

Trait Implementations§

Source§

impl Clone for Modifier

Source§

fn clone(&self) -> Modifier

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 Modifier

Source§

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

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

impl<'de> Deserialize<'de> for Modifier

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Modifier

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for Modifier

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Modifier

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSend for T
where T: Any + Send,

§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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 more
§

impl<T> MaybeSync for T
where T: Sync + ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.