Refactor structure, implement layers, add Erode/Fill/layer panel
- Restructure folder hierarchy: max 4 .rs per dir using subfolders (ops/operations -> brush/ + shaping/, model/ -> world/, io/* -> subtypes, etc.) - Fix golden_test.rs comment, extract BrushApply helper, add World::with_heightmap - Implement 6 layer data generators (Caves, River, Frost, Trees, Biome, Resources) with noise-based (OpenSimplex) and terrain-derived algorithms - Fix clippy warnings, dead code cleanup, import path fixes - GUI: add Erode&Fill tool modes with radio buttons/sliders/apply_tool - GUI: add Layers panel with 6 checkboxes + CPU viewport overlay rendering
This commit is contained in:
parent
3d3798136d
commit
bdd4564240
104 changed files with 5184 additions and 3912 deletions
|
|
@ -1,64 +0,0 @@
|
|||
use clap::Args;
|
||||
use std::path::Path;
|
||||
|
||||
use crate::util::output::{self, OutputFormat};
|
||||
use crate::util::{load_world, progress};
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct ExportArgs {
|
||||
/// Path to Terrafier world directory
|
||||
pub world: String,
|
||||
/// Output directory for Minecraft save
|
||||
#[arg(short, long)]
|
||||
pub output: String,
|
||||
/// Minecraft data version (default: 3954 for 1.21)
|
||||
#[arg(long, default_value = "3954")]
|
||||
pub data_version: i32,
|
||||
}
|
||||
|
||||
pub fn cmd_export(
|
||||
args: ExportArgs,
|
||||
format: &OutputFormat,
|
||||
dry_run: bool,
|
||||
validate: bool,
|
||||
) -> anyhow::Result<()> {
|
||||
let world_path = Path::new(&args.world);
|
||||
log::info!("Exporting world from: {}", world_path.display());
|
||||
|
||||
let world = load_world(world_path)?;
|
||||
terrafier_core::io::export::validate_export(&world)?;
|
||||
|
||||
let tile_count: usize = world.dimensions.iter().map(|d| d.tiles.len()).sum();
|
||||
|
||||
if validate || dry_run {
|
||||
output::print_result(
|
||||
format,
|
||||
&serde_json::json!({
|
||||
"status": "validated",
|
||||
"input": args.world,
|
||||
"output": args.output,
|
||||
"tiles": tile_count,
|
||||
}),
|
||||
);
|
||||
if dry_run {
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
|
||||
let bar = progress::new_bar(tile_count as u64, "Exporting...");
|
||||
terrafier_core::io::export::export_to_save(&world, Path::new(&args.output))?;
|
||||
progress::finish_with("Export complete", bar);
|
||||
|
||||
log::info!("World exported to: {}", args.output);
|
||||
output::print_result(
|
||||
format,
|
||||
&serde_json::json!({
|
||||
"status": "exported",
|
||||
"input": args.world,
|
||||
"output": args.output,
|
||||
"tiles": tile_count,
|
||||
}),
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue