Skip to main content

Mesh

Struct Mesh 

Source
pub struct Mesh { /* private fields */ }
Expand description

A primitive mesh: a Geometry with a Material.

use autumn_plugin_three::{Color, Mesh};

let knot = Mesh::torus_knot(0.8, 0.25)
    .color(Color::hex(0xff7a18))
    .metalness(0.3)
    .roughness(0.4)
    .spin([0.0, 45.0, 0.0]);

Implementations§

Source§

impl Mesh

Source

pub const fn new(geometry: Geometry) -> Self

Makes a mesh with the default material.

Source

pub const fn cube(size: f32) -> Self

A cube with edge length size.

Source

pub const fn cuboid(width: f32, height: f32, depth: f32) -> Self

A box.

Source

pub const fn sphere(radius: f32) -> Self

A sphere.

Source

pub const fn plane(width: f32, height: f32) -> Self

A flat plane.

Source

pub const fn torus(radius: f32, tube: f32) -> Self

A torus.

Source

pub const fn torus_knot(radius: f32, tube: f32) -> Self

A torus knot.

Source

pub const fn cylinder(radius_top: f32, radius_bottom: f32, height: f32) -> Self

A cylinder.

Source

pub const fn cone(radius: f32, height: f32) -> Self

A cone.

Source

pub const fn capsule(radius: f32, length: f32) -> Self

A capsule.

Source

pub const fn icosahedron(radius: f32) -> Self

An icosahedron.

Source

pub const fn dodecahedron(radius: f32) -> Self

A dodecahedron.

Source

pub const fn octahedron(radius: f32) -> Self

An octahedron.

Source

pub const fn tetrahedron(radius: f32) -> Self

A tetrahedron.

Source

pub const fn ring(inner_radius: f32, outer_radius: f32) -> Self

A flat ring.

Source

pub const fn material(self, material: Material) -> Self

Sets the material. Default: Material::Standard.

Source

pub const fn color(self, color: Color) -> Self

Sets the base color. Default: white.

Source

pub const fn emissive(self, color: Color) -> Self

Sets the emissive (glow) color. Lit materials only.

Source

pub const fn metalness(self, value: f32) -> Self

Sets the metalness, 0..=1. PBR materials only.

Source

pub const fn roughness(self, value: f32) -> Self

Sets the roughness, 0..=1. PBR materials only.

Source

pub const fn opacity(self, value: f32) -> Self

Sets the opacity, 0..=1. A value below 1 makes the material transparent.

Source

pub const fn wireframe(self) -> Self

Renders the edges only.

Source

pub fn position(self, position: impl Into<Vec3>) -> Self

Sets the position.

Source

pub fn rotation(self, degrees: impl Into<Vec3>) -> Self

Sets the rotation in degrees (X, Y, Z order).

Source

pub fn scale(self, scale: impl Into<Vec3>) -> Self

Sets the scale. Use Vec3::splat for a uniform scale.

Source

pub fn spin(self, degrees_per_second: impl Into<Vec3>) -> Self

Spins the object, in degrees per second on each axis.

Spin stops when the user prefers reduced motion, unless the scene calls Scene::animate_reduced_motion.

Trait Implementations§

Source§

impl Clone for Mesh

Source§

fn clone(&self) -> Self

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 Copy for Mesh

Source§

impl Debug for Mesh

Source§

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

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

impl From<Mesh> for SceneObject

Source§

fn from(mesh: Mesh) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Mesh

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl Render for Mesh

Source§

fn render(&self) -> Markup

Renders self as a block of Markup.
Source§

fn render_to(&self, buffer: &mut String)

Appends a representation of self to the given buffer. Read more
Source§

impl StructuralPartialEq for Mesh

Auto Trait Implementations§

§

impl Forget for Mesh

§

impl Freeze for Mesh

§

impl RefUnwindSafe for Mesh

§

impl Send for Mesh

§

impl Sync for Mesh

§

impl Unpin for Mesh

§

impl UnsafeUnpin for Mesh

§

impl UnwindSafe for Mesh

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Scoped for T
where T: Send + Sync + 'static,

Source§

fn scope(ctx: &PolicyContext) -> ScopeQuery<'_, Self>

Open a deferred ScopeQuery for this type. Resolves the registered scope at .load() time, not here.
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 = !

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

fn try_from(value: U) -> Result<T, !>

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more