Reorganized the code structure, fix a lot of issues.

This commit is contained in:
2026-04-28 21:05:43 +02:00
parent 81616f8a5d
commit 9ce6e4accd
14 changed files with 1213 additions and 1373 deletions

View File

@@ -1,18 +1,14 @@
# Cartograph
A browser-based world map creation tool inspired by Wonderdraft and Inkarnate. Uses shape-based terrain generation with procedural detail.
A browser-based world map creation tool inspired by Wonderdraft and Inkarnate. Uses line-strip vector shapes with procedural geometry.
## Features (planned)
## Features
- **Shapes** — the fundamental building block. Each shape has:
- **Height** — additive (raise terrain) or subtractive (lower terrain)
- **Biome** — determines the sampled texture applied to the shape
- **Intensity** — blending weight of the biome texture
- **Roughness** — edge noise amount (voronoi-like jagged edges at maximum)
- **Shape editing** — select, move, rotate, scale individual shapes
- **Groups** — combine shapes into groups for batch operations
- **Shake landmass** — procedurally decompose a shape into a more complex set of shapes
- **Viewport** — zoom and pan across the map canvas
- **Shapes** — procedural circles and stars with per-instance transforms (position, scale, rotation)
- **Shape editing** — select, move, rotate, scale individual shapes; rect-select multiple shapes
- **Undo/redo** — property-level history stack (position, scale, rotation, color) with edit session capture and batch operations
- **Spatial index** — hash grid for fast hit testing and rect-selection queries on large shape counts
- **Viewport** — zoom and pan with screen↔world coordinate transforms
## Tech stack
@@ -44,12 +40,16 @@ Output is `app.html`, served by Emscripten's built-in web server or any static s
```
src/
main.c Entry point, sokol init, render loop, input handling
api.h Central include — all library headers and project-wide defines
sprite.h Sprite batching, texture management, file import
main.c Entry point, sokol init, render loop, input handling, UI panels, debug stats
api.h Central include — all library headers, ALLOC/FREE macros
camera.h Viewport state, zoom/pan, MVP matrix, screen↔world transforms
render.h Shape pipeline init/shutdown, per-shape draw calls
shape.h Shape geometry types, procedural generation, hit testing, buffer management
spatial.h Spatial hash grid for accelerated hit tests and rect-select queries
history.h Undo/redo stack with property-level tracking and batch operations
util.h Vector (dynamic array) and memory pool data structures
rand.h Xorshift32 PRNG utilities
shaders/ WGSL shader sources
shaders/ WGSL shader sources (shape, sprite)
generated/ xxd-generated C headers from shaders
lib/
sokol/ Sokol single-file headers (gfx, app, glue, log)