Skip to main content

TerrainMeshData

Struct TerrainMeshData 

Source
pub struct TerrainMeshData {
    pub tile: TileId,
    pub elevation_source_tile: TileId,
    pub elevation_region: TileTextureRegion,
    pub positions: Vec<[f64; 3]>,
    pub uvs: Vec<[f32; 2]>,
    pub normals: Vec<[f32; 3]>,
    pub indices: Vec<u32>,
    pub generation: u64,
    pub grid_resolution: u16,
    pub vertical_exaggeration: f32,
    pub elevation_texture: Option<TerrainElevationTexture>,
}
Expand description

CPU-side terrain mesh data ready for GPU upload.

Fields§

§tile: TileId

Tile this mesh represents.

§elevation_source_tile: TileId

Elevation source tile that backs this mesh.

When terrain display zoom exceeds the DEM source max zoom, multiple child meshes reuse a parent DEM tile. This field identifies that parent.

§elevation_region: TileTextureRegion

Normalized sub-region of the elevation texture to sample for this mesh.

FULL when the elevation texture matches the display tile. For overzoomed terrain meshes this is the child sub-rect inside the parent DEM tile.

§positions: Vec<[f64; 3]>

Vertex positions in world-space (f64 for precision, cast to f32 at upload).

For the reusable-grid path these positions represent the planar base surface before elevation displacement. Elevation is supplied separately via [elevation_texture] for GPU sampling.

§uvs: Vec<[f32; 2]>

Texture coordinates.

§normals: Vec<[f32; 3]>

Surface normals.

For reusable-grid terrain these are base-grid normals. Final terrain shading may derive finer normals in the renderer from sampled heights.

§indices: Vec<u32>

Triangle indices.

§generation: u64

Generation counter from the terrain manager’s elevation cache.

Increments whenever the elevation source delivers new data. Renderers compare this against the value stored on their entity to detect when a mesh must be rebuilt (e.g. when a flat placeholder is replaced by real elevation data).

§grid_resolution: u16

Grid resolution used to build the reusable terrain mesh.

§vertical_exaggeration: f32

Vertical exaggeration already selected for this tile.

§elevation_texture: Option<TerrainElevationTexture>

Optional GPU-sampleable elevation payload for this tile.

Trait Implementations§

Source§

impl Clone for TerrainMeshData

Source§

fn clone(&self) -> TerrainMeshData

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TerrainMeshData

Source§

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

Formats the value using the given formatter. Read more

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