pub struct VoxelChunk {
pub asset_id: AssetId,
pub palette: Vec<AssetId>,
pub dim: [u32; 3],
pub block_size: f32,
pub blocks: Vec<u32>,
pub lod_levels: u32,
pub lod_distances: Vec<f32>,
pub locator: Option<PayloadLocator>,
}Expand description
A voxel grid that compiles into a single mesh.
A dense grid of blocks compiled into a single mesh at build time. Use one
chunk per region of a voxel/Minecraft-style world; reference it from a
Prop’s mesh field. Hidden faces between two solid blocks are
dropped, so a fully filled chunk contributes zero triangles to its interior.
The palette must contain at least one entry whose BlockType has
solid: false (typically named air); cells whose palette entry is
non-solid emit no faces. Faces are only emitted between a solid block and
either an empty neighbour or the outside of the chunk.
Fields§
§asset_id: AssetIdAsset identity; injected via inject_name. Not part of args.
palette: Vec<AssetId>BlockType asset names. blocks[i] is an index into this list.
dim: [u32; 3]Chunk dimensions [dx, dy, dz] in blocks.
block_size: f32World units per block edge.
blocks: Vec<u32>Flat block array, length dx*dy*dz. Index = x + y*dx + z*dx*dy.
lod_levels: u32Number of level-of-detail versions to generate, including the original.
1 (the default) generates none.
lod_distances: Vec<f32>Camera distances at which to switch to each lower-detail version; empty lets the build choose defaults.
locator: Option<PayloadLocator>Injected at load time from the compiled blob payload.
Trait Implementations§
Source§impl Clone for VoxelChunk
impl Clone for VoxelChunk
Source§fn clone(&self) -> VoxelChunk
fn clone(&self) -> VoxelChunk
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Component for VoxelChunk
impl Component for VoxelChunk
Source§const NAME: &'static str = "VoxelChunk"
const NAME: &'static str = "VoxelChunk"
Source§fn inject_locator(&mut self, locator: PayloadLocator)
fn inject_locator(&mut self, locator: PayloadLocator)
Source§fn inject_name(&mut self, id: AssetId)
fn inject_name(&mut self, id: AssetId)
Source§fn from_baked(bytes: &[u8]) -> Result<VoxelChunk, CnResult>
fn from_baked(bytes: &[u8]) -> Result<VoxelChunk, CnResult>
Source§impl ComponentSlot for VoxelChunk
impl ComponentSlot for VoxelChunk
Source§const DISCRIMINANT: u8
const DISCRIMINANT: u8
ComponentId.Source§fn slot(s: &ComponentStorage) -> &Column<VoxelChunk>
fn slot(s: &ComponentStorage) -> &Column<VoxelChunk>
Source§fn slot_mut(s: &mut ComponentStorage) -> &mut Column<VoxelChunk>
fn slot_mut(s: &mut ComponentStorage) -> &mut Column<VoxelChunk>
Source§impl Debug for VoxelChunk
impl Debug for VoxelChunk
Source§impl Default for VoxelChunk
impl Default for VoxelChunk
Source§fn default() -> VoxelChunk
fn default() -> VoxelChunk
Source§impl<'de> Deserialize<'de> for VoxelChunkwhere
VoxelChunk: Default,
impl<'de> Deserialize<'de> for VoxelChunkwhere
VoxelChunk: Default,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<VoxelChunk, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<VoxelChunk, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<VoxelChunk> for ComponentAsset
impl From<VoxelChunk> for ComponentAsset
Source§fn from(c: VoxelChunk) -> ComponentAsset
fn from(c: VoxelChunk) -> ComponentAsset
impl RuntimeComponent for VoxelChunk
Source§impl Serialize for VoxelChunk
impl Serialize for VoxelChunk
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for VoxelChunk
impl RefUnwindSafe for VoxelChunk
impl Send for VoxelChunk
impl Sync for VoxelChunk
impl Unpin for VoxelChunk
impl UnsafeUnpin for VoxelChunk
impl UnwindSafe for VoxelChunk
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> 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> ⓘ
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> ⓘ
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 moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().