pub struct HeightGrid<'a> {
pub width: usize,
pub heights: &'a [i16],
}Expand description
The heights of a map as a save stores them, for queries and for the mesh: width² values, row
by row (see Generator::heights).
Fields§
§width: usizeThe number of samples on each side, 2n + 1.
heights: &'a [i16]The heights, height × 256.
Implementations§
Source§impl HeightGrid<'_>
impl HeightGrid<'_>
Source§impl HeightGrid<'_>
impl HeightGrid<'_>
Sourcepub fn intersect(
&self,
origin: [f32; 3],
direction: [f32; 3],
maximum: f32,
) -> Option<(f32, [f32; 3])>
pub fn intersect( &self, origin: [f32; 3], direction: [f32; 3], maximum: f32, ) -> Option<(f32, [f32; 3])>
Where a ray first hits the ground, no farther than maximum: the distance and the point.
The game uses it to stop picking at the ground.
Deviation: the port tests every cell in the rectangle the ray crosses, where the original walks the cells along the ray.
Original: FUN_1400afef0; its walk along the ray is FUN_1400afa00.
Sourcepub fn normal_below(&self, x: f32, y: f32, top: f32, length: f32) -> [f32; 3]
pub fn normal_below(&self, x: f32, y: f32, top: f32, length: f32) -> [f32; 3]
The normal of the ground under (x, y): a ray straight down from height top, at most
length long. It is zero when the ray hits nothing.
Original: FUN_1400afef0.
Sourcepub fn ground(&self, x: f32, y: f32, normal: &mut [f32; 3]) -> f32
pub fn ground(&self, x: f32, y: f32, normal: &mut [f32; 3]) -> f32
Ground height at a map position (0 when no triangle is hit). normal receives the hit
triangle’s normal and is left unchanged otherwise.
Original: FUN_1400b6460.
Sourcepub fn natural_cell_type(&self, map_size: usize, index: usize) -> CellType
pub fn natural_cell_type(&self, map_size: usize, index: usize) -> CellType
The natural type of gameplay map cell index (row-major over map_size²). The gameplay map
is n × n cells centred on the 2n-cell terrain.
Original: FUN_1400a3790.