Skip to main content

Crate viewport_lib_terrain

Crate viewport_lib_terrain 

Source
Expand description

Heightmap and splatmap terrain rendering for viewport-lib.

The plugin registers as a viewport-lib ItemTypePlugin and draws terrain inside the standard scene pass, picking up shadows, clipping, selection outline, picking, and frustum culling from the lib automatically.

renderer.with_item_type_plugin(device, Box::new(TerrainPlugin::new()));

// Each frame:
frame.scene.submit_plugin_items(
    TYPE_NAME,
    TerrainCollection { items: vec![] },
);

See examples/eframe_terrain.rs for a runnable demo.

Structs§

DetailLayer
A single scatter recipe over the terrain surface.
DetailScatterOutput
Output batches built by scatter_terrain_details.
DetailScatterParams
Per-frame scatter inputs read from the host’s camera state.
LayerTextures
A per-layer texture array (diffuse or normal), packed so every layer samples from a single binding.
SplatmapData
Per-channel layer weights painted across the terrain.
TerrainCollection
Per-frame collection of terrains.
TerrainItem
One terrain submission for the current frame.
TerrainLayer
One surface layer in a splatmap-blended terrain.
TerrainPlugin

Enums§

DetailKind
What a DetailLayer emits per scatter point.

Constants§

LAYER_COUNT
Number of surface layers in a TerrainItem. Two splatmaps carry four channels each; channels map to layers in order.
TYPE_NAME
Stable name used as the SceneFrame::submit_plugin_items key. Match this against TerrainPlugin::type_name when wiring the host side.

Functions§

scatter_terrain_details
Build per-frame sprite/mesh batches for the given detail layers.