Struct Mesh3d

Source
pub struct Mesh3d {
    pub mesh: Mesh,
    /* private fields */
}
Expand description

Construct once and draw many times. Mesh dimensions are baked into vertices; draw transforms use only rotation/translation to keep normals correct.

Fields§

§mesh: Mesh

Implementations§

Source§

impl Mesh3d

Source

pub fn from_mesh(mesh: Mesh) -> Mesh3d

Source

pub fn invalidate_gpu(&mut self)

Invalidate the GPU snapshot after editing the public source mesh.

Source

pub fn resident(&self) -> &ResidentMesh

Source

pub fn draw_transformed(&self, model: Mat4)

Source

pub fn draw_immediate(&self, model: Mat4)

CPU path for geometry whose exact submission order must be preserved.

Source

pub fn plane(size: Vec2, color: Color, subdivisions: u16) -> Mesh3d

Tessellated XZ ground plane centered at the origin, facing positive Y. Subdivision provides nearby vertices for vertex lighting/distance fog on large surfaces. Bounded to 1..=28 cells per side to keep low-poly scenes inexpensive.

Source

pub fn cylinder(radius: f32, height: f32, color: Color, segments: u16) -> Mesh3d

Flat-shaded, capped cylinder along Y. Construct once and reuse for props.

Source

pub fn cone(radius: f32, height: f32, color: Color, segments: u16) -> Mesh3d

Flat-shaded cone along Y, with its tip at positive Y.

Source

pub fn frustum( bottom: f32, top: f32, height: f32, color: Color, segments: u16, ) -> Mesh3d

Capped tapered prism; radii are at negative/positive Y respectively. Zero-radius caps are omitted. Tessellation is bounded to 3..=128 sides.

Source

pub fn cuboid(size: Vec3, color: Color) -> Mesh3d

Source

pub fn sphere(radius: f32, color: Color, segments: u16, rings: u16) -> Mesh3d

Faceted sphere. Latitude rings are bounded to retain a low-poly budget.

Source

pub fn draw(&self, position: Vec3, rotation: Quat)

Auto Trait Implementations§

§

impl !Freeze for Mesh3d

§

impl !RefUnwindSafe for Mesh3d

§

impl !Send for Mesh3d

§

impl !Sync for Mesh3d

§

impl Unpin for Mesh3d

§

impl UnwindSafe for Mesh3d

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> 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, 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.