Expand description
Shared material and rendering components for voxel chunks.
Provides two rendering paths for voxel chunks:
-
Texture array path (opt-in) — when
ChunkTextureArrayis inserted as a resource before the plugin initialises, chunks are rendered withChunkMaterial, a custom PBR material that samples atexture_2d_array. The embedded WGSL shader applies per-vertex AO and simple diffuse lighting. -
Fallback path (default) — when
ChunkTextureArrayis absent, chunks use a sharedbevy::pbr::StandardMaterialwith vertex colors. This path requires no texture assets and is compatible with allVoxelTypepalettes.
Structs§
- Chunk
Material - Custom chunk material that samples a GPU
texture_2d_array. - Chunk
Material Config - Configuration for the fallback
StandardMaterialchunk material. - Chunk
Material Handle - Internal resource that tracks which material handle all chunk entities share.
- Chunk
Rendered - Marker component indicating a chunk entity has been set up for rendering.
- Chunk
Texture Array - Optional resource that opts chunks into the texture-array rendering path.
Functions§
- build_
texture_ array - Assembles N identically-sized
Images into a single GPUtexture_2d_array. - chunk_
aabb - Creates an axis-aligned bounding box sized for a standard voxel chunk.
- setup_
chunk_ material - Startup system that creates the shared chunk material.
- upgrade_
to_ texture_ material - Upgrades existing chunk entities from
StandardMaterialtoChunkMaterialonceChunkTextureArraybecomes available (i.e. after async texture loading).