Skip to main content

ProceduralMesh

Struct ProceduralMesh 

Source
pub struct ProceduralMesh {
Show 22 fields pub asset_id: AssetId, pub generator: String, pub half_width: f32, pub half_depth: f32, pub ceiling_height: f32, pub half_extents: Option<[f32; 3]>, pub radius: Option<f32>, pub height: Option<f32>, pub segments: Option<u32>, pub rings: Option<u32>, pub subdivisions: Option<u32>, pub amplitude: Option<f32>, pub source: Option<String>, pub elevation_min: Option<f32>, pub elevation_max: Option<f32>, pub size: Option<f32>, pub profile: Option<Vec<[f32; 2]>>, pub corner_radius: Option<f32>, pub corner_segments: Option<u32>, pub lod_levels: u32, pub lod_distances: Vec<f32>, pub locator: Option<PayloadLocator>,
}
Expand description

Geometry built by a named generator at compile time. Use for standard shapes.

For custom / hand-authored geometry use Mesh instead.

Built-in generators:

ProceduralMesh {
    generator: "room".into(),
    half_width: 16.0,
    half_depth: 20.0,
    ceiling_height: 3.5,
    ..Default::default()
};

Fields§

§asset_id: AssetId

Asset identity; injected via inject_name. Not part of args.

§generator: String

Built-in generator name (required), e.g. room, box, cylinder, sphere, terrain, heightfield, skybox, or extrude.

§half_width: f32

Half-width along X (room / box / plane / terrain), in world units.

§half_depth: f32

Half-depth along Z (room / box / plane / terrain), in world units.

§ceiling_height: f32

Ceiling height for the room generator, in world units.

§half_extents: Option<[f32; 3]>

Half-extents [x, y, z] for the box generator.

§radius: Option<f32>

Radius for the cylinder and sphere generators.

§height: Option<f32>

Height for the cylinder and extrude generators.

§segments: Option<u32>

Number of radial segments around the cylinder and sphere generators.

§rings: Option<u32>

Number of horizontal rings on the sphere generator.

§subdivisions: Option<u32>

Grid subdivisions for the terrain and heightfield generators. Higher is more detailed.

§amplitude: Option<f32>

Maximum height variation for the terrain generator, in world units.

§source: Option<String>

Path to a grayscale heightmap image for the heightfield generator.

§elevation_min: Option<f32>

Height mapped to black pixels in the heightfield source, in world units.

§elevation_max: Option<f32>

Height mapped to white pixels in the heightfield source, in world units.

§size: Option<f32>

Half-extent on all axes for the skybox generator, in world units. Keep it below the camera’s far plane so the sky is not clipped.

§profile: Option<Vec<[f32; 2]>>

2D outline [[x, z], ...] extruded by the extrude generator.

§corner_radius: Option<f32>

Corner-rounding radius for the extrude generator. 0 keeps sharp corners.

§corner_segments: Option<u32>

Number of segments used to round each corner in the extrude generator.

§lod_levels: u32

Number of level-of-detail versions to generate, including the original. 1 (the default) generates none; values are clamped to [1, 8].

§lod_distances: Vec<f32>

Camera distances at which to switch to each lower-detail version; length should be lod_levels - 1. Empty lets the build choose defaults.

§locator: Option<PayloadLocator>

Injected at load time from the compiled blob payload.

Trait Implementations§

Source§

impl Clone for ProceduralMesh

Source§

fn clone(&self) -> ProceduralMesh

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 Component for ProceduralMesh

Source§

const NAME: &'static str = "ProceduralMesh"

The registry name a world authors this component under.
Source§

fn inject_locator(&mut self, locator: PayloadLocator)

Called after construction to inject the payload locator from the blob def. Only meaningful for components with a compiled payload. The default implementation does nothing (correct for most components).
Source§

fn inject_name(&mut self, id: AssetId)

Called after construction to inject the asset’s identity from the blob def. Only meaningful for components that look themselves up by id at runtime. The default implementation does nothing.
Source§

fn from_baked(bytes: &[u8]) -> Result<Self, CnResult>

Reconstruct this component from a blob record, whose bytes are the serialized runtime component (cook already ran the asset -> component translation). The default rejects: runtime-only components are never stored in a blob, so only loadable types provide an implementation.
Source§

impl ComponentSlot for ProceduralMesh

Source§

const DISCRIMINANT: u8

The component type’s stable id, used as its ComponentId.
Source§

fn slot(s: &ComponentStorage) -> &Column<Self>

Borrow this type’s column out of the storage.
Source§

fn slot_mut(s: &mut ComponentStorage) -> &mut Column<Self>

Mutably borrow this type’s column out of the storage.
Source§

impl Debug for ProceduralMesh

Source§

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

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

impl Default for ProceduralMesh

Source§

fn default() -> ProceduralMesh

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ProceduralMesh

Source§

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

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

impl From<ProceduralMesh> for ComponentAsset

Source§

fn from(c: ProceduralMesh) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for ProceduralMesh

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl RuntimeComponent for ProceduralMesh

Source§

impl Serialize for ProceduralMesh

Source§

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

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

impl StructuralPartialEq for ProceduralMesh

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

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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