HeightMap: add terrain generation methods (closes #195)
Add seven terrain generation methods wrapping libtcod heightmap functions: - add_hill(center, radius, height): Add smooth hill - dig_hill(center, radius, depth): Dig crater (use negative depth) - add_voronoi(num_points, coefficients, seed): Voronoi-based features - mid_point_displacement(roughness, seed): Diamond-square terrain - rain_erosion(drops, erosion, sedimentation, seed): Erosion simulation - dig_bezier(points, start_radius, end_radius, start_depth, end_depth): Carve paths - smooth(iterations): Average neighboring cells All methods return self for chaining. Includes 24 unit tests. Note: dig_hill and dig_bezier use libtcod's "dig" semantics - use negative depth values to actually dig below current terrain level. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
d92d5f0274
commit
f2711e553f
3 changed files with 763 additions and 0 deletions
|
|
@ -45,6 +45,15 @@ public:
|
|||
static PyObject* threshold_binary(PyHeightMapObject* self, PyObject* args, PyObject* kwds);
|
||||
static PyObject* inverse(PyHeightMapObject* self, PyObject* Py_UNUSED(args));
|
||||
|
||||
// Terrain generation methods (#195) - mutate self, return self for chaining
|
||||
static PyObject* add_hill(PyHeightMapObject* self, PyObject* args, PyObject* kwds);
|
||||
static PyObject* dig_hill(PyHeightMapObject* self, PyObject* args, PyObject* kwds);
|
||||
static PyObject* add_voronoi(PyHeightMapObject* self, PyObject* args, PyObject* kwds);
|
||||
static PyObject* mid_point_displacement(PyHeightMapObject* self, PyObject* args, PyObject* kwds);
|
||||
static PyObject* rain_erosion(PyHeightMapObject* self, PyObject* args, PyObject* kwds);
|
||||
static PyObject* dig_bezier(PyHeightMapObject* self, PyObject* args, PyObject* kwds);
|
||||
static PyObject* smooth(PyHeightMapObject* self, PyObject* args, PyObject* kwds);
|
||||
|
||||
// Subscript support for hmap[x, y] syntax
|
||||
static PyObject* subscript(PyHeightMapObject* self, PyObject* key);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue