wde_terrain/
lib.rs

1//! This crate provides a terrain system for the game.
2//! The terrain is divided into tiles, each of which has its own heightmap and splat maps for texture blending. The terrain system is designed to be efficient and flexible, allowing for dynamic updates to the terrain data and seamless integration with the rendering and physics systems.
3//!
4//! This module is still WIP.
5//!
6//! # Example
7//! ```
8//! fn init(mut commands: Commands, asset_server: Res<AssetServer>) {
9//!     // Load the terrain from the specified path
10//!     commands.spawn((
11//!         Terrain::load("tests/terrain"),
12//!         TerrainRenderer::new(&asset_server),
13//!         TerrainPhysics::default()
14//!     ));
15//! }
16
17use bevy::prelude::*;
18
19use crate::{
20    physics::TerrainPhysicsPlugin, render::TerrainRenderPlugin, utils::TerrainUtilsPlugin
21};
22
23pub(crate) mod manager;
24pub(crate) mod physics;
25pub mod render;
26pub(crate) mod utils;
27
28#[doc(hidden)]
29pub mod prelude {
30    pub use crate::manager::*;
31    pub use crate::physics::terrain_physics::TerrainPhysics;
32    pub use crate::render::extractor::*;
33    pub use crate::render::renderer::TerrainRenderer;
34    pub use crate::render::renderer_gpu::TerrainRendererGPU;
35    pub use crate::utils::cursor_pos::TerrainCursorPos;
36}
37
38pub struct TerrainPlugin;
39impl Plugin for TerrainPlugin {
40    fn build(&self, app: &mut App) {
41        app.add_plugins((
42            TerrainRenderPlugin,
43            TerrainPhysicsPlugin,
44            TerrainUtilsPlugin
45        ));
46    }
47}