载入中...
搜索中...
未找到
eve::procgen 命名空间参考

命名空间

namespace  dtlutil
 
namespace  Semantic
 Stable semantic cell ids stored in Grid2D.cells (not tile GIDs).
 

class  CloudField
 Deterministic, seamlessly-tiling, time-animated procedural cloud field. 更多...
 
class  CloudShadow
 Cloud shadows cast onto the ground plane. 更多...
 
struct  ColorRamp
 Piecewise-linear color ramp in t∈[0,1], with optional hard banding. 更多...
 
class  GeneratorRegistry
 
class  Grid2D
 Intermediate 2D generation result. cells store semantic ids (see Semantic.h), not tile GIDs — convert via Palette when applying to a TileLayer. 更多...
 
class  Heightmap
 In-memory terrain heightmap: a dense float grid (row-major, index = y * width + x) materialized from a TerrainSampler or filled by hand. 更多...
 
class  MeshBuild
 CPU triangle mesh from procedural mesh recipes (e.g. marching cubes). Positions/normals are xyz-packed; uvs are st-packed; indices are triangles. 更多...
 
class  MeshRecipeRegistry
 
struct  NoiseField
 Deterministic value-noise helpers for pixel textures. When periodX/periodY > 0, lattice wraps for seamless tiling. 更多...
 
class  OutputSpec
 Configurable generation sink. target: "grid" | "tilelayer" | "json" 更多...
 
class  PaletteTable
 Named palette: semantic name -> tile GID. Unmapped semantics become GID 0. 更多...
 
class  Params
 Generation parameters. Algorithm-specific keys live in values as strings (no overloads; typed setters/getters for script convenience). 更多...
 
struct  PbrParams
 PBR surface defaults for a generated material. Every map in a PBR set is derived from the same displacement field (see TextureRecipeDef). 更多...
 
class  PbrRecipeRegistry
 
struct  PbrTextureSet
 Full metallic-roughness PBR map set. All maps are caller-owned; call destroy() (or delete each pointer) when done. Maps are derived from one shared displacement field so albedo, normal, height, roughness, metallic and AO line up pixel-for-pixel. 更多...
 
class  Procgen
 Procedural generation module. Phase A: runtime maps (semantic Grid2D → TileLayer). Phase B: runtime textures (ImageData / Texture). Phase C (partial): mesh recipes (Marching Cubes → MeshBuild / Mesh). Script: procgen <- eve.Procgen(); 更多...
 
struct  Rgba8
 
struct  TerrainBands
 
class  TerrainSampler
 Deterministic terrain height sampling (Red Blob Games / Perlin fBm recipe). 更多...
 
struct  TextureGenContext
 
struct  TextureRecipeDef
 A procedural texture is fully described by an albedo ramp + a displacement field + PBR knobs. From one definition both an albedo recipe (ImageData) and a full PBR set (albedo/normal/roughness/metallic/height/ao) are produced. 更多...
 
class  TextureRecipeRegistry
 

类型定义

using MeshRecipeFn = std::function< bool(const Params &params, MeshBuild &out, std::string &error)>
 
using GeneratorFn = std::function< bool(const Params &params, Grid2D &out, std::string &error)>
 
using PbrRecipeFn = std::function< PbrTextureSet *(const Params &params, std::string &error)>
 Recipe returns a full PBR set (caller owns), or nullptr on failure.
 
using TextureRecipeFn = std::function< image::ImageData *(const Params &params, std::string &error)>
 Recipe returns a new RGBA8 ImageData (caller owns), or nullptr on failure.
 

函数

void registerWfcSimple (GeneratorRegistry &registry)
 
void registerTerrainHeightmapAlgorithm (GeneratorRegistry &registry)
 
bool generateBushMesh (const Params &params, MeshBuild &out, std::string &error)
 Build a deterministic procedural small bush. Registered as the mesh.bush recipe.
 
bool generateLinearStructure (const std::string &kind, const Params &params, MeshBuild &out, std::string &error)
 Procedural linear, tileable structures (fences, walls, bridges, the Great Wall, hedges, cheval de frise, ...). Each recipe builds one tileable unit segment from axis-aligned boxes and oriented beams, then repeats it segments times along the X axis so units join seamlessly end-to-end.
 
void registerLinearStructureRecipes (MeshRecipeRegistry &registry)
 Register all built-in linear structure mesh recipes into a registry.
 
bool generateHexPlanetMesh (const Params &params, MeshBuild &out, std::string &error)
 Build the dual of a subdivided icosahedron. The result is a closed planet made of hexagonal cells plus the twelve pentagons required by spherical topology. Params: radius (1), subdivisions (2), tileInset (0.06, in [0, 0.5)).
 
bool marchingCubes (const float *density, int nx, int ny, int nz, float isolevel, MeshBuild &out, std::string *error=nullptr)
 Classic Marching Cubes (Lorensen & Cline) over a regular scalar volume. Density >= isolevel is treated as solid; normals point toward empty space.
 
bool fillDensityField (const Params &params, std::vector< float > &density, int &nx, int &ny, int &nz, std::string &error)
 Fill a density volume from a named field recipe (sphere / noise / terrain / torus).
 
bool generateMarchingCubesMesh (const Params &params, MeshBuild &out, std::string &error)
 Build mesh from Params (field + resolution + isolevel).
 
bool generateRockMesh (const Params &params, MeshBuild &out, std::string &error)
 Build a shared-vertex, deformed icosphere rock for economical game props.
 
void registerRoguelikeGenerator (GeneratorRegistry &registry)
 Register the "level.roguelike" algorithm (idempotent).
 
bool autotileGridInPlace (Grid2D &grid)
 Post-process any generated Grid2D: fill each wall cell's detail with an 8-bit neighbour mask describing which adjacent cells are walkable. Useful to add direction-aware wall tiles to levels from other generators. Returns false if the grid has no wall cells (still clears detail).
 
uint32_t randomSeedValue ()
 Produce a fresh seed suitable for regenerating a level (never 0).
 
bool generateSkyscraperMesh (const Params &params, MeshBuild &out, std::string &error)
 Build a deterministic procedural skyscraper. Registered as the mesh.skyscraper recipe.
 
bool generateTreeMesh (const Params &params, MeshBuild &out, std::string &error)
 Build a deterministic procedural tree. Registered as the mesh.tree recipe.
 
std::string gridToJson (const Grid2D &grid)
 Compact JSON for debugging / reload workflows (not full Tiled).
 
bool writeGridJson (const Grid2D &grid, const std::string &path, std::string *error)
 
 Module_IMPL (Procgen, new Procgen())
 
void registerProcgenCapabilities ()
 
const char * semanticName (uint32_t id)
 
uint32_t semanticId (const std::string &name)
 
const std::vector< TextureRecipeDef > & builtinTextureDefs ()
 All built-in texture definitions (albedo + PBR). Populated lazily.
 
image::ImageDatagrayscaleImage (const std::vector< float > &values, int w, int h)
 Build a grayscale RGBA8 image from per-pixel values in [0,1]. Caller owns.
 
PbrTextureSetgeneratePbrSet (const TextureRecipeDef &def, const Params &params, std::string &error)
 Build a full PBR set from a texture definition. Caller owns the result.
 
void fillHeightField (const TextureGenContext &ctx, const std::function< float(float, float, const NoiseField &)> &fn, std::vector< float > &height)
 Sample a height function over the full [w×h] grid into height (clamped to [0,1]).
 
void paintHeightToImage (image::ImageData &img, const std::vector< float > &height, int w, int h, const ColorRamp &ramp, int bands, int pixelSize)
 
image::ImageDataheightToNormalImage (const std::vector< float > &height, int w, int h, float strength, bool seamless)
 

类型定义说明

◆ GeneratorFn

using eve::procgen::GeneratorFn = typedef std::function<bool(const Params &params, Grid2D &out, std::string &error)>

在文件 GeneratorRegistry.h13 行定义.

◆ MeshRecipeFn

using eve::procgen::MeshRecipeFn = typedef std::function<bool(const Params &params, MeshBuild &out, std::string &error)>

在文件 MarchingCubes.h37 行定义.

◆ PbrRecipeFn

using eve::procgen::PbrRecipeFn = typedef std::function<PbrTextureSet *(const Params &params, std::string &error)>

Recipe returns a full PBR set (caller owns), or nullptr on failure.

在文件 PbrMaterial.h44 行定义.

◆ TextureRecipeFn

using eve::procgen::TextureRecipeFn = typedef std::function<image::ImageData *(const Params &params, std::string &error)>

Recipe returns a new RGBA8 ImageData (caller owns), or nullptr on failure.

在文件 TextureRecipe.h20 行定义.

函数说明

◆ autotileGridInPlace()

bool eve::procgen::autotileGridInPlace ( Grid2D grid)

Post-process any generated Grid2D: fill each wall cell's detail with an 8-bit neighbour mask describing which adjacent cells are walkable. Useful to add direction-aware wall tiles to levels from other generators. Returns false if the grid has no wall cells (still clears detail).

在文件 RoguelikeGenerator.cpp347 行定义.

引用了 eve::procgen::Grid2D::getHeight() , 以及 eve::procgen::Grid2D::getWidth().

被这些函数引用 eve::procgen::Procgen::autotileGrid().

◆ builtinTextureDefs()

const std::vector< TextureRecipeDef > & eve::procgen::builtinTextureDefs ( )

All built-in texture definitions (albedo + PBR). Populated lazily.

在文件 BuiltinTextures.cpp479 行定义.

被这些函数引用 eve::procgen::TextureRecipeRegistry::registerBuiltins() , 以及 eve::procgen::PbrRecipeRegistry::registerPbrBuiltins().

◆ fillDensityField()

bool eve::procgen::fillDensityField ( const Params params,
std::vector< float > &  density,
int &  nx,
int &  ny,
int &  nz,
std::string &  error 
)

◆ fillHeightField()

void eve::procgen::fillHeightField ( const TextureGenContext ctx,
const std::function< float(float, float, const NoiseField &)> &  fn,
std::vector< float > &  height 
)

◆ generateBushMesh()

bool eve::procgen::generateBushMesh ( const Params params,
MeshBuild out,
std::string &  error 
)

◆ generateHexPlanetMesh()

bool eve::procgen::generateHexPlanetMesh ( const Params params,
MeshBuild out,
std::string &  error 
)

Build the dual of a subdivided icosahedron. The result is a closed planet made of hexagonal cells plus the twelve pentagons required by spherical topology. Params: radius (1), subdivisions (2), tileInset (0.06, in [0, 0.5)).

在文件 MarchingCubes.cpp149 行定义.

引用了 error, f, eve::procgen::Params::getFloat(), eve::procgen::Params::getInt() , 以及 v.

被这些函数引用 eve::procgen::MeshRecipeRegistry::registerBuiltins().

◆ generateLinearStructure()

bool eve::procgen::generateLinearStructure ( const std::string &  kind,
const Params params,
MeshBuild out,
std::string &  error 
)

Procedural linear, tileable structures (fences, walls, bridges, the Great Wall, hedges, cheval de frise, ...). Each recipe builds one tileable unit segment from axis-aligned boxes and oriented beams, then repeats it segments times along the X axis so units join seamlessly end-to-end.

Shared params:

  • segments: int, repeat count along X (default 6)
  • segLength: float, length of one unit in world units (default 1.0)
  • height: float, overall height override (per-kind default)
  • depth: float, thickness along Z override (per-kind default)
  • thickness: float, plank / rail / beam thickness override (per-kind default)
  • scale: float, uniform world scale (default 1.0)
  • uvRepeat: float, texture repeats per world unit so grain/brick tiling stays continuous across unit seams (default 2.0)

在文件 LinearStructure.cpp223 行定义.

引用了 eve::procgen::MeshBuild::clear(), eve::procgen::MeshBuild::empty(), error, eve::procgen::Params::getFloat(), eve::procgen::Params::getInt(), kind, p, eve::procgen::MeshBuild::positions(), eve::procgen::MeshBuild::reserve(), scale , 以及 eve::procgen::MeshBuild::setMeta().

被这些函数引用 registerLinearStructureRecipes().

◆ generateMarchingCubesMesh()

bool eve::procgen::generateMarchingCubesMesh ( const Params params,
MeshBuild out,
std::string &  error 
)

◆ generatePbrSet()

◆ generateRockMesh()

◆ generateSkyscraperMesh()

bool eve::procgen::generateSkyscraperMesh ( const Params params,
MeshBuild out,
std::string &  error 
)

Build a deterministic procedural skyscraper. Registered as the mesh.skyscraper recipe.

The tower is a stack of setback tiers, each a solid box whose footprint shrinks as it rises. Every facade is a subdivided window grid: each cell emits a small window quad raised slightly in front of the wall plane (a thin windowDepth lip), so openings read under directional lighting without coplanar z-fighting. An optional spire / antenna cap finishes the roof.

Parameters (all optional): seed reproducible RNG (default 1) baseWidth footprint extent along X (default 10) baseDepth footprint extent along Z (default 10) tiers number of setback levels (default 5, range [1, 24]) tierHeight height of one tier (default 6) setback per-tier footprint shrink fraction (default 0.08, range [0, 0.6)) windowCols window columns per facade (default 6, range [1, 24]) windowRows window rows per tier (default 4, range [1, 24]) windowDepth window lip height above the wall (default 0.04) spireHeight antenna / spire height (default 0, disabled)

UV convention: wall quads sample the lower-left texel region (0.25, 0.5), window quads the upper-right texel region (0.75, 0.5), so a tiny 2x2 atlas can tint openings bright vs walls dark, or a full facade texture can be used with the same mapping per-cell.

在文件 SkyscraperMesh.cpp102 行定义.

引用了 eve::procgen::MeshBuild::clear(), cx, eve::procgen::MeshBuild::empty(), error, eve::procgen::Params::getFloat(), eve::procgen::Params::getInt(), s , 以及 eve::procgen::MeshBuild::setMeta().

被这些函数引用 eve::procgen::MeshRecipeRegistry::registerBuiltins().

◆ generateTreeMesh()

◆ grayscaleImage()

image::ImageData * eve::procgen::grayscaleImage ( const std::vector< float > &  values,
int  w,
int  h 
)

Build a grayscale RGBA8 image from per-pixel values in [0,1]. Caller owns.

在文件 PbrMaterial.cpp54 行定义.

引用了 h, v, values , 以及 w.

被这些函数引用 generatePbrSet().

◆ gridToJson()

◆ heightToNormalImage()

image::ImageData * eve::procgen::heightToNormalImage ( const std::vector< float > &  height,
int  w,
int  h,
float  strength,
bool  seamless 
)

在文件 TextureRecipe.cpp106 行定义.

引用了 h, height, w, x , 以及 y.

被这些函数引用 eve::procgen::Procgen::generateNormalImage() , 以及 generatePbrSet().

◆ marchingCubes()

bool eve::procgen::marchingCubes ( const float *  density,
int  nx,
int  ny,
int  nz,
float  isolevel,
MeshBuild out,
std::string *  error = nullptr 
)

Classic Marching Cubes (Lorensen & Cline) over a regular scalar volume. Density >= isolevel is treated as solid; normals point toward empty space.

density is row-major: index = x + y * nx + z * nx * ny, size nx*ny*nz. Cell (x,y,z) spans corners [x..x+1]×[y..y+1]×[z..z+1] (so loops are nx-1 etc.).

在文件 MarchingCubes.cpp239 行定义.

引用了 a, eve::procgen::MeshBuild::addTriangle(), eve::procgen::MeshBuild::addVertex(), b, eve::procgen::MeshBuild::clear(), cx, cy, error, eve::procgen::MeshBuild::getVertexCount(), marchingCubes(), px, eve::procgen::MeshBuild::reserve(), eve::procgen::MeshBuild::setMeta(), x, y , 以及 z.

被这些函数引用 generateMarchingCubesMesh() , 以及 marchingCubes().

◆ Module_IMPL()

eve::procgen::Module_IMPL ( Procgen  ,
new   Procgen() 
)

◆ paintHeightToImage()

void eve::procgen::paintHeightToImage ( image::ImageData img,
const std::vector< float > &  height,
int  w,
int  h,
const ColorRamp ramp,
int  bands,
int  pixelSize 
)

◆ randomSeedValue()

uint32_t eve::procgen::randomSeedValue ( )

Produce a fresh seed suitable for regenerating a level (never 0).

在文件 RoguelikeGenerator.cpp352 行定义.

引用了 v.

被这些函数引用 eve::procgen::Procgen::randomSeed().

◆ registerLinearStructureRecipes()

void eve::procgen::registerLinearStructureRecipes ( MeshRecipeRegistry registry)

Register all built-in linear structure mesh recipes into a registry.

在文件 LinearStructure.cpp283 行定义.

引用了 generateLinearStructure(), p , 以及 eve::procgen::MeshRecipeRegistry::registerRecipe().

被这些函数引用 eve::procgen::MeshRecipeRegistry::registerBuiltins().

◆ registerProcgenCapabilities()

void eve::procgen::registerProcgenCapabilities ( )

在文件 ProcgenCapabilities.cpp101 行定义.

引用了 impl , 以及 eve::cap::query().

被这些函数引用 eve::procgen::Procgen::Procgen().

◆ registerRoguelikeGenerator()

void eve::procgen::registerRoguelikeGenerator ( GeneratorRegistry registry)

Register the "level.roguelike" algorithm (idempotent).

在文件 RoguelikeGenerator.cpp343 行定义.

引用了 eve::procgen::GeneratorRegistry::registerAlgorithm().

被这些函数引用 eve::procgen::GeneratorRegistry::registerBuiltins().

◆ registerTerrainHeightmapAlgorithm()

void eve::procgen::registerTerrainHeightmapAlgorithm ( GeneratorRegistry registry)

◆ registerWfcSimple()

void eve::procgen::registerWfcSimple ( GeneratorRegistry registry)

◆ semanticId()

uint32_t eve::procgen::semanticId ( const std::string &  name)

在文件 Semantic.cpp39 行定义.

引用了 eve::procgen::Semantic::Empty , 以及 name.

◆ semanticName()

◆ writeGridJson()

bool eve::procgen::writeGridJson ( const Grid2D grid,
const std::string &  path,
std::string *  error 
)

在文件 JsonExport.cpp56 行定义.

引用了 error , 以及 gridToJson().

被这些函数引用 eve::procgen::Procgen::generateTo().