diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 72873ab..249ea11 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -110,7 +110,7 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Generate SVG - run: cargo run -p hex-grid --example svg --release -- 3 2.0 > hex-grid.svg + run: cargo run -p apicult-desigual --example svg --release -- 3 2.0 > apicult-desigual.svg - name: Create release and attach SVG env: @@ -118,4 +118,4 @@ jobs: run: | TAG="${{ inputs.tag || github.ref_name }}" gh release create "$TAG" --generate-notes || true - gh release upload "$TAG" hex-grid.svg --clobber + gh release upload "$TAG" apicult-desigual.svg --clobber diff --git a/.github/workflows/svg-preview.yml b/.github/workflows/svg-preview.yml index 4ec2dbf..285c21e 100644 --- a/.github/workflows/svg-preview.yml +++ b/.github/workflows/svg-preview.yml @@ -3,7 +3,7 @@ name: SVG Preview on: push: paths: - - "crates/hex-grid/**" + - "crates/apicult-desigual/**" - "web/svg-preview.html" - "web/hex-terrain.html" - "web/hex-terrain.js" diff --git a/Cargo.lock b/Cargo.lock index b41e8d1..761b003 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -202,6 +202,15 @@ version = "1.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" +[[package]] +name = "apicult-desigual" +version = "0.1.0" +dependencies = [ + "glam", + "hexx", + "noise", +] + [[package]] name = "approx" version = "0.5.1" @@ -2925,25 +2934,16 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" -[[package]] -name = "hex-grid" -version = "0.1.0" -dependencies = [ - "glam", - "hexx", - "noise", -] - [[package]] name = "hex-terrain" version = "0.0.7" dependencies = [ + "apicult-desigual", "bevy", "bevy-inspector-egui", "bevy_egui", "clap", "flora", - "hex-grid", "hexx", "mesh-gradient", "noise", diff --git a/Cargo.toml b/Cargo.toml index de5fd6f..0ca486b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -members = ["crates/mesh-gradient", "crates/hex-grid", "crates/flora"] +members = ["crates/mesh-gradient", "crates/apicult-desigual", "crates/flora"] [package] name = "hex-terrain" @@ -54,7 +54,7 @@ bevy-inspector-egui = { version = "0.36", optional = true } bevy_egui = "0.39" hexx = { version = "0.24.0", features = ["bevy"] } mesh-gradient = { path = "crates/mesh-gradient" } -hex-grid = { path = "crates/hex-grid" } +apicult-desigual = { path = "crates/apicult-desigual" } flora = { path = "crates/flora" } [lints.rust] diff --git a/Makefile b/Makefile index e58a8b3..0b80598 100644 --- a/Makefile +++ b/Makefile @@ -61,16 +61,16 @@ svg-prep: @mkdir -p $(SVG_OUT) svg-plain: svg-prep - cargo run -q -p hex-grid --example geo_export --release -- $(SVG_RADIUS) $(SVG_PAD) > $(SVG_OUT)/hex-grid.svg + cargo run -q -p apicult-desigual --example geo_export --release -- $(SVG_RADIUS) $(SVG_PAD) > $(SVG_OUT)/apicult-desigual.svg svg-rich: svg-prep - cargo run -q -p hex-grid --example geo_export --release -- $(SVG_RADIUS) $(SVG_PAD) --format svg-rich > $(SVG_OUT)/hex-grid-rich.svg + cargo run -q -p apicult-desigual --example geo_export --release -- $(SVG_RADIUS) $(SVG_PAD) --format svg-rich > $(SVG_OUT)/apicult-desigual-rich.svg svg-json: svg-prep - cargo run -q -p hex-grid --example geo_export --release -- $(SVG_RADIUS) $(SVG_PAD) --format json-v1 > $(SVG_OUT)/hex-grid.json + cargo run -q -p apicult-desigual --example geo_export --release -- $(SVG_RADIUS) $(SVG_PAD) --format json-v1 > $(SVG_OUT)/apicult-desigual.json svg-json-v2: svg-prep - cargo run -q -p hex-grid --example geo_export --release -- $(SVG_RADIUS) $(SVG_PAD) --format json-v2 > $(SVG_OUT)/hex-terrain.json + cargo run -q -p apicult-desigual --example geo_export --release -- $(SVG_RADIUS) $(SVG_PAD) --format json-v2 > $(SVG_OUT)/hex-terrain.json svg-html: svg-prep sed "s|__SHA__|$(SHORT_SHA)|g" web/svg-preview.html > $(SVG_OUT)/index.html diff --git a/README.md b/README.md index 69632f7..3f3d3a9 100644 --- a/README.md +++ b/README.md @@ -107,4 +107,4 @@ graph LR end ``` -![hex-grid preview](https://dynnamitt.github.io/hex-terrain/svg/hex-grid.svg) +![apicult-desigual preview](https://dynnamitt.github.io/hex-terrain/svg/apicult-desigual.svg) diff --git a/crates/hex-grid/Cargo.toml b/crates/apicult-desigual/Cargo.toml similarity index 87% rename from crates/hex-grid/Cargo.toml rename to crates/apicult-desigual/Cargo.toml index 9166ae4..3f48cdf 100644 --- a/crates/hex-grid/Cargo.toml +++ b/crates/apicult-desigual/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "hex-grid" +name = "apicult-desigual" version = "0.1.0" edition = "2024" diff --git a/crates/hex-grid/README.md b/crates/apicult-desigual/README.md similarity index 81% rename from crates/hex-grid/README.md rename to crates/apicult-desigual/README.md index 94034df..9ab5e29 100644 --- a/crates/hex-grid/README.md +++ b/crates/apicult-desigual/README.md @@ -1,4 +1,4 @@ -# hex-grid +# apicult-desigual ## 🌐 [**Live WebGL demo →**](https://dynnamitt.github.io/hex-terrain/svg/) @@ -20,7 +20,7 @@ Zero game-engine dependencies -- uses `glam` for vectors, `hexx` for hex coordin ## Usage ```rust -use hex_grid::{HGridLayout, HGridSettings}; +use apicult_desigual::{HGridLayout, HGridSettings}; let settings = HGridSettings { radius: 10, ..HGridSettings::default() }; let layout = HGridLayout::from_settings(&settings); @@ -38,10 +38,10 @@ let tris = layout.all_tris(); The `geo_export` example streams the grid to stdout in any of the supported formats. It's the same binary that drives the [live WebGL demo](https://dynnamitt.github.io/hex-terrain/svg/): ```sh -cargo run -p hex-grid --example geo_export # plain SVG (gray, no labels) -cargo run -p hex-grid --example geo_export -- 5 2.0 --format svg-rich # green fill, outlined strokes, height labels -cargo run -p hex-grid --example geo_export -- 5 2.0 --format json-v1 # gen1: {hexes, edges, quads, tris} -cargo run -p hex-grid --example geo_export -- 5 2.0 --format json-v2 # gen2: {version: 2, tris} — welded-mesh consumers +cargo run -p apicult-desigual --example geo_export # plain SVG (gray, no labels) +cargo run -p apicult-desigual --example geo_export -- 5 2.0 --format svg-rich # green fill, outlined strokes, height labels +cargo run -p apicult-desigual --example geo_export -- 5 2.0 --format json-v1 # gen1: {hexes, edges, quads, tris} +cargo run -p apicult-desigual --example geo_export -- 5 2.0 --format json-v2 # gen2: {version: 2, tris} — welded-mesh consumers ``` `--rich` and `--json` remain as backward-compat aliases for `--format svg-rich` and `--format json-v1`. diff --git a/crates/hex-grid/examples/geo_export.rs b/crates/apicult-desigual/examples/geo_export.rs similarity index 72% rename from crates/hex-grid/examples/geo_export.rs rename to crates/apicult-desigual/examples/geo_export.rs index d82a33a..53f137d 100644 --- a/crates/hex-grid/examples/geo_export.rs +++ b/crates/apicult-desigual/examples/geo_export.rs @@ -1,18 +1,20 @@ -//! Export hex-grid geometry as SVG or JSON via the [`SerializeGeo`] trait. +//! Export apicult-desigual geometry as SVG or JSON via the [`SerializeGeo`] trait. //! //! ```sh -//! cargo run -p hex-grid --example geo_export # plain SVG -//! cargo run -p hex-grid --example geo_export -- 5 2.0 # plain SVG, custom radius/pad -//! cargo run -p hex-grid --example geo_export -- 5 2.0 --format svg-rich # rich SVG -//! cargo run -p hex-grid --example geo_export -- 5 2.0 --format json-v1 # gen1 JSON -//! cargo run -p hex-grid --example geo_export -- 5 2.0 --format json-v2 # gen2 JSON (tris only) +//! cargo run -p apicult-desigual --example geo_export # plain SVG +//! cargo run -p apicult-desigual --example geo_export -- 5 2.0 # plain SVG, custom radius/pad +//! cargo run -p apicult-desigual --example geo_export -- 5 2.0 --format svg-rich # rich SVG +//! cargo run -p apicult-desigual --example geo_export -- 5 2.0 --format json-v1 # gen1 JSON +//! cargo run -p apicult-desigual --example geo_export -- 5 2.0 --format json-v2 # gen2 JSON (tris only) //! ``` //! //! Backward-compat aliases: `--rich` → `--format svg-rich`, `--json` → `--format json-v1`. use std::io::{self, Write}; -use hex_grid::{HGridLayout, HGridSettings, JsonV1, JsonV2, SerializeGeo, SvgPlain, SvgRich}; +use apicult_desigual::{ + HGridLayout, HGridSettings, JsonV1, JsonV2, SerializeGeo, SvgPlain, SvgRich, +}; fn main() { let mut positional: Vec = Vec::new(); diff --git a/crates/hex-grid/src/layout.rs b/crates/apicult-desigual/src/layout.rs similarity index 100% rename from crates/hex-grid/src/layout.rs rename to crates/apicult-desigual/src/layout.rs diff --git a/crates/hex-grid/src/lib.rs b/crates/apicult-desigual/src/lib.rs similarity index 100% rename from crates/hex-grid/src/lib.rs rename to crates/apicult-desigual/src/lib.rs diff --git a/crates/hex-grid/src/math.rs b/crates/apicult-desigual/src/math.rs similarity index 98% rename from crates/hex-grid/src/math.rs rename to crates/apicult-desigual/src/math.rs index 98ad43c..b7b653c 100644 --- a/crates/hex-grid/src/math.rs +++ b/crates/apicult-desigual/src/math.rs @@ -1,4 +1,4 @@ -//! Pure computation helpers for hex-grid geometry. +//! Pure computation helpers for apicult-desigual geometry. //! //! All functions operate on plain numeric / `glam` inputs with no ECS dependencies. @@ -12,7 +12,7 @@ use hexx::{EdgeDirection, GridVertex, Hex, VertexDirection}; /// /// # Examples /// ``` -/// # use hex_grid::math::map_noise_to_range; +/// # use apicult_desigual::math::map_noise_to_range; /// assert_eq!(map_noise_to_range(-1.0, 0.0, 10.0), 0.0); /// assert_eq!(map_noise_to_range( 1.0, 0.0, 10.0), 10.0); /// assert_eq!(map_noise_to_range( 0.0, 2.0, 6.0), 4.0); @@ -41,7 +41,7 @@ pub fn gap_vertex_data(world_verts: &[Vec3], flat: bool) -> (Vec<[f32; 3]>, [f32 } /// Count total (quads, tris) for a grid using the same ownership rules -/// as hex-grid generation: quads on even edges \[0,2,4\] where neighbor exists, +/// as apicult-desigual generation: quads on even edges \[0,2,4\] where neighbor exists, /// tris on vertices \[0,1\] with canonical ownership and all 3 coords in grid. pub fn gap_filler(grid: &[Hex]) -> (usize, usize) { let quads = grid diff --git a/crates/hex-grid/src/serialize.rs b/crates/apicult-desigual/src/serialize.rs similarity index 99% rename from crates/hex-grid/src/serialize.rs rename to crates/apicult-desigual/src/serialize.rs index 5bdd67b..83b9dcb 100644 --- a/crates/hex-grid/src/serialize.rs +++ b/crates/apicult-desigual/src/serialize.rs @@ -11,7 +11,7 @@ use hexx::{Hex, shapes}; use crate::HGridLayout; -/// Streamed serialization of a hex-grid layout to bytes. +/// Streamed serialization of an apicult-desigual layout to bytes. pub trait SerializeGeo { fn write(&self, layout: &HGridLayout, out: &mut dyn io::Write) -> io::Result<()>; } diff --git a/src/h_terrain.rs b/src/h_terrain.rs index 491b4db..70c43ca 100644 --- a/src/h_terrain.rs +++ b/src/h_terrain.rs @@ -21,8 +21,8 @@ use bevy::prelude::*; use crate::{DebugFlag, GameState}; use fov_overlay::FovMaterial; +pub use apicult_desigual::edge_cuboid_transform; pub use entities::InSight; -pub use hex_grid::edge_cuboid_transform; /// Pipeline ordering for h_terrain update systems. #[derive(SystemSet, Debug, Clone, PartialEq, Eq, Hash)] @@ -120,7 +120,7 @@ pub struct HGridSettings { pub flat_gap_normals: bool, } -impl From<&HGridSettings> for hex_grid::HGridSettings { +impl From<&HGridSettings> for apicult_desigual::HGridSettings { fn from(s: &HGridSettings) -> Self { Self { radius: s.radius, diff --git a/src/h_terrain/flora_spawn.rs b/src/h_terrain/flora_spawn.rs index 7e72070..f0294d3 100644 --- a/src/h_terrain/flora_spawn.rs +++ b/src/h_terrain/flora_spawn.rs @@ -4,9 +4,9 @@ use bevy::platform::collections::HashMap; use bevy::prelude::*; use hexx::Hex; +use apicult_desigual::HGridLayout; use flora::cluster::shimeji_cluster; use flora::{FloraCfg, FloraMaterials}; -use hex_grid::HGridLayout; use super::mineral::{Mineral, hash_hex}; diff --git a/src/h_terrain/gaps.rs b/src/h_terrain/gaps.rs index aee2d5a..a640485 100644 --- a/src/h_terrain/gaps.rs +++ b/src/h_terrain/gaps.rs @@ -18,7 +18,7 @@ use super::entities::{ }; use super::h_grid_layout::HGridLayout; use super::mineral::Mineral; -use hex_grid::{edge_cuboid_transform, gap_vertex_data, quad_corner_indices}; +use apicult_desigual::{edge_cuboid_transform, gap_vertex_data, quad_corner_indices}; pub(super) const EDGE_THICKNESS: f32 = 0.03; pub(super) const DBG_NORMAL_LEN: f32 = 0.3; diff --git a/src/h_terrain/h_grid_layout.rs b/src/h_terrain/h_grid_layout.rs index 6eb0d88..2b2c920 100644 --- a/src/h_terrain/h_grid_layout.rs +++ b/src/h_terrain/h_grid_layout.rs @@ -1,12 +1,12 @@ -//! Re-exports [`hex_grid::HGridLayout`] and bridges from h_terrain's [`HGridSettings`]. +//! Re-exports [`apicult_desigual::HGridLayout`] and bridges from h_terrain's [`HGridSettings`]. use super::HGridSettings; -pub use hex_grid::HGridLayout; +pub use apicult_desigual::HGridLayout; impl HGridSettings { /// Build an [`HGridLayout`] from these settings. pub fn build_layout(&self) -> HGridLayout { - HGridLayout::from_settings(&hex_grid::HGridSettings::from(self)) + HGridLayout::from_settings(&apicult_desigual::HGridSettings::from(self)) } } diff --git a/src/h_terrain/startup_systems.rs b/src/h_terrain/startup_systems.rs index 2a2ddc6..481a8ae 100644 --- a/src/h_terrain/startup_systems.rs +++ b/src/h_terrain/startup_systems.rs @@ -16,7 +16,7 @@ use super::gaps; use super::materials::TerrainMaterials; use super::mineral::Mineral; use crate::DebugFlag; -use hex_grid::{edge_cuboid_transform, gap_filler}; +use apicult_desigual::{edge_cuboid_transform, gap_filler}; /// Spawns the [`HGrid`] entity with [`HCell`] children, [`Corner`] grandchildren, /// and Quad/Tri gap geometry with distributed emitter markers. diff --git a/src/h_terrain/tests.rs b/src/h_terrain/tests.rs index 882c2e8..2d247b9 100644 --- a/src/h_terrain/tests.rs +++ b/src/h_terrain/tests.rs @@ -12,7 +12,7 @@ use super::fov_overlay::FovMaterial; use super::materials::TerrainMaterials; use super::{HTerrainConfig, HTerrainPhase, materials, startup_systems, systems}; use crate::{DebugFlag, GameState, GroundLevel, PlayerMoved, PlayerPos}; -use hex_grid::gap_filler; +use apicult_desigual::gap_filler; fn test_config() -> HTerrainConfig { HTerrainConfig { diff --git a/web/hex-terrain.md b/web/hex-terrain.md index 3cd9ce9..ea57f05 100644 --- a/web/hex-terrain.md +++ b/web/hex-terrain.md @@ -38,7 +38,7 @@ not a performance term. seams, you'd get hairline cracks where a hex face meets a gap quad — not from rendering artifacts but from floating-point drift if positions were re-emitted from different code paths. The Rust crate's - `HGridLayout::vertex(hex, i)` (`crates/hex-grid/src/layout.rs:143-150`) + `HGridLayout::vertex(hex, i)` (`crates/apicult-desigual/src/layout.rs:143-150`) returning identical `Vec3` for shared corners is what makes the weld watertight. 2. **Free smooth shading at seams** — when `computeVertexNormals()` runs diff --git a/web/svg-preview.html b/web/svg-preview.html index 9a2154e..2e33c1b 100644 --- a/web/svg-preview.html +++ b/web/svg-preview.html @@ -3,7 +3,7 @@ -hex-grid preview +apicult-desigual preview