pub struct TerrainMesh {
pub size: usize,
pub tiles_per_side: usize,
pub vertices: Vec<TerrainVertex>,
pub indices: Vec<u16>,
}Expand description
The terrain mesh: tiles of TILE_CELLS × TILE_CELLS cells, each with its own vertices,
and one index list that every tile uses.
Fields§
§size: usizeThe terrain’s size in cells, 2n.
tiles_per_side: usizeThe number of tiles on each side.
vertices: Vec<TerrainVertex>The vertices: tiles_per_side² blocks of TILE_VERTS² vertices, tile by tile, row by row.
indices: Vec<u16>Indices for one tile (two triangles per cell).
Implementations§
Source§impl TerrainMesh
impl TerrainMesh
Sourcepub fn build(grid: &HeightGrid<'_>, size: usize) -> TerrainMesh
pub fn build(grid: &HeightGrid<'_>, size: usize) -> TerrainMesh
The mesh of a terrain of size cells.
Sourcepub fn vertex_bytes(&self) -> Vec<u8> ⓘ
pub fn vertex_bytes(&self) -> Vec<u8> ⓘ
The vertices as bytes, ready for a GPU vertex buffer.
Auto Trait Implementations§
impl Freeze for TerrainMesh
impl RefUnwindSafe for TerrainMesh
impl Send for TerrainMesh
impl Sync for TerrainMesh
impl Unpin for TerrainMesh
impl UnsafeUnpin for TerrainMesh
impl UnwindSafe for TerrainMesh
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
Mutably borrows from an owned value. Read more