stdlib/terrainView source ↗
terrain
20 items · generated by scribe fromstdlib/terrain.fd· synced 2026-11-15
Contents
- Terrain (struct)
- terrain_create (function)
- terrain_set_origin (function)
- terrain_set_height (function)
- terrain_get_height_grid (function)
- terrain_height_at (function)
- terrain_normal_at (function)
- terrain_generate_sine (function)
- terrain_generate_flat (function)
- terrain_generate_noise (function)
- terrain_raise_circle (function)
- terrain_to_mesh (function)
- terrain_world_width (function)
- terrain_world_depth (function)
- terrain_vertex_count (function)
- terrain_triangle_count (function)
- terrain_in_bounds (function)
- terrain_smooth (function)
Terrain
pub struct Terrain {Fields:
| Name | Type |
|---|---|
width | i64 |
height | i64 |
spacing | f64 |
heights | Vec<f64> |
origin_x | f64 |
origin_z | f64 |
max_height | f64 |
min_height | f64 |
Defined at line 20
terrain_create
Create a terrain grid.
pub fn terrain_create(width: i64, height: i64, spacing: f64) -> Terrain {Parameters:
width:i64height:i64spacing:f64
Returns: Terrain
Defined at line 37
terrain_set_origin
Set the terrain origin (world-space offset).
pub fn terrain_set_origin(t: & mut Terrain, x: f64, z: f64) -> void {Parameters:
t:& mut Terrainx:f64z:f64
Returns: void
Defined at line 50
terrain_set_height
Set the height at a grid point.
pub fn terrain_set_height(t: & mut Terrain, gx: i64, gy: i64, h: f64) -> void {Parameters:
t:& mut Terraingx:i64gy:i64h:f64
Returns: void
Defined at line 56
terrain_get_height_grid
Get the height at a grid point.
pub fn terrain_get_height_grid(t: & Terrain, gx: i64, gy: i64) -> f64 {Parameters:
t:& Terraingx:i64gy:i64
Returns: f64
Defined at line 64
terrain_height_at
Get the height at a world-space (x, z) position using bilinear interpolation.
pub fn terrain_height_at(t: & Terrain, wx: f64, wz: f64) -> f64 {Parameters:
t:& Terrainwx:f64wz:f64
Returns: f64
Defined at line 72
terrain_normal_at
Compute the normal at a world-space (x, z) position using finite differences.
pub fn terrain_normal_at(t: & Terrain, wx: f64, wz: f64) -> vec3 {Parameters:
t:& Terrainwx:f64wz:f64
Returns: vec3
Defined at line 112
terrain_generate_sine
Generate terrain using a sine wave pattern.
pub fn terrain_generate_sine(t: & mut Terrain) -> void {Parameters:
t:& mut Terrain
Returns: void
Defined at line 131
terrain_generate_flat
Generate flat terrain (all zeros).
pub fn terrain_generate_flat(t: & mut Terrain) -> void {Parameters:
t:& mut Terrain
Returns: void
Defined at line 158
terrain_generate_noise
Generate terrain using a pseudo-random noise function.
pub fn terrain_generate_noise(t: & mut Terrain, amplitude: f64) -> void {Parameters:
t:& mut Terrainamplitude:f64
Returns: void
Defined at line 169
terrain_raise_circle
Raise a circular area of the terrain.
pub fn terrain_raise_circle(t: & mut Terrain, cx: f64, cz: f64, radius: f64, amount: f64) -> void {Parameters:
t:& mut Terraincx:f64cz:f64radius:f64amount:f64
Returns: void
Defined at line 196
terrain_to_mesh
Convert the terrain to a mesh for rendering.
pub fn terrain_to_mesh(t: & Terrain) -> Mesh {Parameters:
t:& Terrain
Returns: Mesh
Defined at line 236
terrain_world_width
Get the total world-space width of the terrain.
pub fn terrain_world_width(t: & Terrain) -> f64 {Parameters:
t:& Terrain
Returns: f64
Defined at line 285
terrain_world_depth
Get the total world-space depth of the terrain.
pub fn terrain_world_depth(t: & Terrain) -> f64 {Parameters:
t:& Terrain
Returns: f64
Defined at line 290
terrain_vertex_count
Get the number of vertices.
pub fn terrain_vertex_count(t: & Terrain) -> i64 {Parameters:
t:& Terrain
Returns: i64
Defined at line 295
terrain_triangle_count
Get the number of triangles.
pub fn terrain_triangle_count(t: & Terrain) -> i64 {Parameters:
t:& Terrain
Returns: i64
Defined at line 300
terrain_in_bounds
Check if a world-space point is within the terrain bounds.
pub fn terrain_in_bounds(t: & Terrain, wx: f64, wz: f64) -> bool {Parameters:
t:& Terrainwx:f64wz:f64
Returns: bool
Defined at line 305
terrain_smooth
Smooth the terrain using a simple box filter.
pub fn terrain_smooth(t: & mut Terrain) -> void {Parameters:
t:& mut Terrain
Returns: void
Defined at line 314
Generated by scribe, the Fides documentation generator