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();
更多...
#include <Procgen.h>
Public 成员函数 | |
| Module_REG (Procgen) | |
| Procgen () | |
| ~Procgen () override=default | |
| Params * | newParams () |
| OutputSpec * | newOutput () |
| Grid2D * | newGrid (int width, int height) |
| Grid2D * | generate (const std::string &algorithmId, Params *params) |
| bool | generateTo (const std::string &algorithmId, Params *params, OutputSpec *output) |
| bool | applyToLayer (Grid2D *grid, const std::string &palette, map::TileLayer *layer) |
| void | setPaletteGid (const std::string &palette, const std::string &semantic, int gid) |
| int | getPaletteGid (const std::string &palette, const std::string &semantic) const |
| int | getAlgorithmCount () const |
| std::string | getAlgorithmId (int index) const |
| bool | hasAlgorithm (const std::string &algorithmId) const |
| bool | autotileGrid (Grid2D *grid) |
Post-process a generated grid: fill each wall cell's detail with an 8-bit neighbour mask (autotile directions). Mutates grid in place. | |
| uint32_t | randomSeed () |
| Fresh non-zero seed for regenerating a level. | |
| std::string | lastError () const |
| std::string | gridToJson (Grid2D *grid) const |
| image::ImageData * | generateImage (const std::string &recipeId, Params *params) |
| RGBA8 ImageData (caller owns). Pixel-friendly recipes: tex.soil/stone/marble/water/sky_cloud. | |
| image::ImageData * | generateNormalImage (const std::string &recipeId, Params *params) |
| Normal map derived from albedo luminance (caller owns). | |
| graphics::Texture * | generateTexture (const std::string &recipeId, Params *params, graphics::Graphics *gfx) |
| Upload recipe to GPU. repeatU/V follow params "seamless" (default on). Caller owns Texture*. | |
| int | getTextureRecipeCount () const |
| std::string | getTextureRecipeId (int index) const |
| bool | hasTextureRecipe (const std::string &recipeId) const |
| CloudField * | newCloudField () |
| New deterministic, tiling, time-animated cloud field (caller owns). | |
| CloudShadow * | newCloudShadow () |
| New sun projection over a cloud field → ground shadows (caller owns). | |
| float | cloudCoverageAt (CloudField *field, float x, float z, float time) |
| Cloud coverage at world (x, z) and time (via a CloudField). | |
| float | cloudShadowFactor (CloudShadow *shadow, float x, float z, float time) |
| Light multiplier in [0,1] from a CloudShadow at world (x, z) and time. | |
| void | sampleCloud (CloudField *field, float *out, int w, int h, float time, float x0, float z0, float extent) |
| void | sampleCloudShadow (CloudShadow *shadow, float *out, int w, int h, float time, float x0, float z0, float extent) |
| PbrTextureSet * | generatePbrMaterial (const std::string &recipeId, Params *params) |
| Full metallic-roughness PBR set (albedo/normal/roughness/metallic/height/ao) derived from a single displacement field. Caller owns the returned set (call PbrTextureSet::destroy()). Recipes: pbr.soil/stone/rock/marble/water/ ripple/wood/cloth/ornament/spot/zebra/wall/cement/mud/sky_cloud. | |
| int | getPbrRecipeCount () const |
| std::string | getPbrRecipeId (int index) const |
| bool | hasPbrRecipe (const std::string &recipeId) const |
| MeshBuild * | buildMesh (const std::string &recipeId, Params *params) |
| CPU mesh (caller owns). Recipes: mesh.marchingcubes, mesh.hexplanet. | |
| graphics::Mesh * | generateMesh (const std::string &recipeId, Params *params, graphics::Graphics *gfx) |
| Build + upload to GPU Mesh (owned by Graphics). | |
| int | getMeshRecipeCount () const |
| std::string | getMeshRecipeId (int index) const |
| bool | hasMeshRecipe (const std::string &recipeId) const |
| TerrainSampler * | newTerrainSampler () |
| Sampling function over continuous map coordinates (caller owns). | |
| Heightmap * | newHeightmap (int width, int height) |
| Empty in-memory heightmap (caller owns). | |
| Heightmap * | generateHeightmap (Params *params) |
| Build a sampler from params (seed/scale/octaves/…) and materialize it (caller owns). | |
| bool | heightmapToGrid (Heightmap *heightmap, Params *params, Grid2D *out) |
| Classify a heightmap into a semantic Grid2D using params bands (waterMax…). | |
| PaletteTable & | palettes () |
Public 成员函数 继承自 eve::Module | |
| virtual | ~Module () |
| virtual std::string | getName () const =0 |
详细描述
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();
构造及析构函数说明
◆ Procgen()
| eve::procgen::Procgen::Procgen | ( | ) |
在文件 Procgen.cpp 第 28 行定义.
引用了 eve::procgen::MeshRecipeRegistry::instance(), eve::procgen::GeneratorRegistry::instance(), eve::procgen::PbrRecipeRegistry::instance(), eve::procgen::TextureRecipeRegistry::instance(), eve::procgen::MeshRecipeRegistry::registerBuiltins(), eve::procgen::GeneratorRegistry::registerBuiltins(), eve::procgen::TextureRecipeRegistry::registerBuiltins(), eve::procgen::PbrRecipeRegistry::registerPbrBuiltins(), eve::procgen::registerProcgenCapabilities() , 以及 setPaletteGid().
◆ ~Procgen()
|
overridedefault |
成员函数说明
◆ applyToLayer()
| bool eve::procgen::Procgen::applyToLayer | ( | Grid2D * | grid, |
| const std::string & | palette, | ||
| map::TileLayer * | layer | ||
| ) |
在文件 Procgen.cpp 第 113 行定义.
引用了 eve::procgen::PaletteTable::applyToLayer() , 以及 layer.
被这些函数引用 generateTo().
◆ autotileGrid()
| bool eve::procgen::Procgen::autotileGrid | ( | Grid2D * | grid | ) |
Post-process a generated grid: fill each wall cell's detail with an 8-bit neighbour mask (autotile directions). Mutates grid in place.
在文件 Procgen.cpp 第 145 行定义.
◆ buildMesh()
CPU mesh (caller owns). Recipes: mesh.marchingcubes, mesh.hexplanet.
在文件 Procgen.cpp 第 304 行定义.
引用了 generate(), eve::procgen::MeshRecipeRegistry::instance(), mesh , 以及 eve::procgen::MeshRecipeRegistry::registerBuiltins().
被这些函数引用 generateMesh().
◆ cloudCoverageAt()
| float eve::procgen::Procgen::cloudCoverageAt | ( | CloudField * | field, |
| float | x, | ||
| float | z, | ||
| float | time | ||
| ) |
Cloud coverage at world (x, z) and time (via a CloudField).
在文件 Procgen.cpp 第 234 行定义.
引用了 eve::procgen::CloudField::coverageAt(), x , 以及 z.
◆ cloudShadowFactor()
| float eve::procgen::Procgen::cloudShadowFactor | ( | CloudShadow * | shadow, |
| float | x, | ||
| float | z, | ||
| float | time | ||
| ) |
Light multiplier in [0,1] from a CloudShadow at world (x, z) and time.
在文件 Procgen.cpp 第 243 行定义.
引用了 eve::procgen::CloudShadow::shadowFactorAt(), x , 以及 z.
◆ generate()
在文件 Procgen.cpp 第 72 行定义.
被这些函数引用 buildMesh().
◆ generateHeightmap()
Build a sampler from params (seed/scale/octaves/…) and materialize it (caller owns).
在文件 Procgen.cpp 第 361 行定义.
引用了 eve::procgen::TerrainSampler::fromParams(), eve::procgen::Heightmap::generate(), eve::procgen::Params::getHeight() , 以及 eve::procgen::Params::getWidth().
◆ generateImage()
| image::ImageData * eve::procgen::Procgen::generateImage | ( | const std::string & | recipeId, |
| Params * | params | ||
| ) |
RGBA8 ImageData (caller owns). Pixel-friendly recipes: tex.soil/stone/marble/water/sky_cloud.
在文件 Procgen.cpp 第 162 行定义.
引用了 eve::procgen::TextureRecipeRegistry::generate(), eve::procgen::TextureRecipeRegistry::instance() , 以及 eve::procgen::TextureRecipeRegistry::registerBuiltins().
被这些函数引用 generateNormalImage() , 以及 generateTexture().
◆ generateMesh()
| graphics::Mesh * eve::procgen::Procgen::generateMesh | ( | const std::string & | recipeId, |
| Params * | params, | ||
| graphics::Graphics * | gfx | ||
| ) |
Build + upload to GPU Mesh (owned by Graphics).
在文件 Procgen.cpp 第 320 行定义.
引用了 buildMesh(), eve::procgen::MeshBuild::getIndexCount(), eve::procgen::MeshBuild::getVertexCount(), eve::procgen::MeshBuild::indices(), eve::graphics::Graphics::newMeshFromArrays(), eve::procgen::MeshBuild::normals(), eve::procgen::MeshBuild::positions() , 以及 eve::procgen::MeshBuild::uvs().
◆ generateNormalImage()
| image::ImageData * eve::procgen::Procgen::generateNormalImage | ( | const std::string & | recipeId, |
| Params * | params | ||
| ) |
Normal map derived from albedo luminance (caller owns).
在文件 Procgen.cpp 第 175 行定义.
引用了 albedo, generateImage(), eve::procgen::Params::getFloat(), eve::procgen::Params::getInt(), h, height, eve::procgen::heightToNormalImage(), px , 以及 w.
◆ generatePbrMaterial()
| PbrTextureSet * eve::procgen::Procgen::generatePbrMaterial | ( | const std::string & | recipeId, |
| Params * | params | ||
| ) |
Full metallic-roughness PBR set (albedo/normal/roughness/metallic/height/ao) derived from a single displacement field. Caller owns the returned set (call PbrTextureSet::destroy()). Recipes: pbr.soil/stone/rock/marble/water/ ripple/wood/cloth/ornament/spot/zebra/wall/cement/mud/sky_cloud.
在文件 Procgen.cpp 第 272 行定义.
引用了 eve::procgen::PbrRecipeRegistry::generate(), eve::procgen::PbrRecipeRegistry::instance() , 以及 eve::procgen::PbrRecipeRegistry::registerPbrBuiltins().
◆ generateTexture()
| graphics::Texture * eve::procgen::Procgen::generateTexture | ( | const std::string & | recipeId, |
| Params * | params, | ||
| graphics::Graphics * | gfx | ||
| ) |
Upload recipe to GPU. repeatU/V follow params "seamless" (default on). Caller owns Texture*.
在文件 Procgen.cpp 第 195 行定义.
引用了 generateImage(), eve::image::ImageData::getData(), eve::image::ImageData::getHeight(), eve::procgen::Params::getInt(), eve::image::ImageData::getWidth() , 以及 eve::graphics::Graphics::newTexture().
◆ generateTo()
| bool eve::procgen::Procgen::generateTo | ( | const std::string & | algorithmId, |
| Params * | params, | ||
| OutputSpec * | output | ||
| ) |
◆ getAlgorithmCount()
| int eve::procgen::Procgen::getAlgorithmCount | ( | ) | const |
在文件 Procgen.cpp 第 130 行定义.
引用了 eve::procgen::GeneratorRegistry::instance() , 以及 eve::procgen::GeneratorRegistry::list().
◆ getAlgorithmId()
| std::string eve::procgen::Procgen::getAlgorithmId | ( | int | index | ) | const |
在文件 Procgen.cpp 第 135 行定义.
引用了 eve::procgen::GeneratorRegistry::instance() , 以及 eve::procgen::GeneratorRegistry::list().
◆ getMeshRecipeCount()
| int eve::procgen::Procgen::getMeshRecipeCount | ( | ) | const |
◆ getMeshRecipeId()
| std::string eve::procgen::Procgen::getMeshRecipeId | ( | int | index | ) | const |
◆ getPaletteGid()
| int eve::procgen::Procgen::getPaletteGid | ( | const std::string & | palette, |
| const std::string & | semantic | ||
| ) | const |
在文件 Procgen.cpp 第 126 行定义.
引用了 eve::procgen::PaletteTable::getGid() , 以及 semantic.
◆ getPbrRecipeCount()
| int eve::procgen::Procgen::getPbrRecipeCount | ( | ) | const |
◆ getPbrRecipeId()
| std::string eve::procgen::Procgen::getPbrRecipeId | ( | int | index | ) | const |
◆ getTextureRecipeCount()
| int eve::procgen::Procgen::getTextureRecipeCount | ( | ) | const |
◆ getTextureRecipeId()
| std::string eve::procgen::Procgen::getTextureRecipeId | ( | int | index | ) | const |
◆ gridToJson()
| std::string eve::procgen::Procgen::gridToJson | ( | Grid2D * | grid | ) | const |
在文件 Procgen.cpp 第 157 行定义.
◆ hasAlgorithm()
| bool eve::procgen::Procgen::hasAlgorithm | ( | const std::string & | algorithmId | ) | const |
在文件 Procgen.cpp 第 141 行定义.
引用了 eve::procgen::GeneratorRegistry::has() , 以及 eve::procgen::GeneratorRegistry::instance().
◆ hasMeshRecipe()
| bool eve::procgen::Procgen::hasMeshRecipe | ( | const std::string & | recipeId | ) | const |
◆ hasPbrRecipe()
| bool eve::procgen::Procgen::hasPbrRecipe | ( | const std::string & | recipeId | ) | const |
◆ hasTextureRecipe()
| bool eve::procgen::Procgen::hasTextureRecipe | ( | const std::string & | recipeId | ) | const |
◆ heightmapToGrid()
| bool eve::procgen::Procgen::heightmapToGrid | ( | Heightmap * | heightmap, |
| Params * | params, | ||
| Grid2D * | out | ||
| ) |
Classify a heightmap into a semantic Grid2D using params bands (waterMax…).
在文件 Procgen.cpp 第 371 行定义.
引用了 eve::procgen::TerrainBands::fromParams() , 以及 eve::procgen::Heightmap::toGrid().
◆ lastError()
| std::string eve::procgen::Procgen::lastError | ( | ) | const |
在文件 Procgen.cpp 第 155 行定义.
◆ Module_REG()
| eve::procgen::Procgen::Module_REG | ( | Procgen | ) |
◆ newCloudField()
| CloudField * eve::procgen::Procgen::newCloudField | ( | ) |
New deterministic, tiling, time-animated cloud field (caller owns).
在文件 Procgen.cpp 第 230 行定义.
◆ newCloudShadow()
| CloudShadow * eve::procgen::Procgen::newCloudShadow | ( | ) |
New sun projection over a cloud field → ground shadows (caller owns).
在文件 Procgen.cpp 第 232 行定义.
◆ newGrid()
| Grid2D * eve::procgen::Procgen::newGrid | ( | int | width, |
| int | height | ||
| ) |
在文件 Procgen.cpp 第 56 行定义.
◆ newHeightmap()
| Heightmap * eve::procgen::Procgen::newHeightmap | ( | int | width, |
| int | height | ||
| ) |
◆ newOutput()
| OutputSpec * eve::procgen::Procgen::newOutput | ( | ) |
在文件 Procgen.cpp 第 54 行定义.
◆ newParams()
| Params * eve::procgen::Procgen::newParams | ( | ) |
在文件 Procgen.cpp 第 53 行定义.
◆ newTerrainSampler()
| TerrainSampler * eve::procgen::Procgen::newTerrainSampler | ( | ) |
Sampling function over continuous map coordinates (caller owns).
在文件 Procgen.cpp 第 355 行定义.
◆ palettes()
|
inline |
◆ randomSeed()
| uint32_t eve::procgen::Procgen::randomSeed | ( | ) |
Fresh non-zero seed for regenerating a level.
在文件 Procgen.cpp 第 153 行定义.
◆ sampleCloud()
| void eve::procgen::Procgen::sampleCloud | ( | CloudField * | field, |
| float * | out, | ||
| int | w, | ||
| int | h, | ||
| float | time, | ||
| float | x0, | ||
| float | z0, | ||
| float | extent | ||
| ) |
Sample coverage/factor into a caller-owned float buffer (w*h).
在文件 Procgen.cpp 第 252 行定义.
引用了 h, eve::procgen::CloudField::sample() , 以及 w.
◆ sampleCloudShadow()
| void eve::procgen::Procgen::sampleCloudShadow | ( | CloudShadow * | shadow, |
| float * | out, | ||
| int | w, | ||
| int | h, | ||
| float | time, | ||
| float | x0, | ||
| float | z0, | ||
| float | extent | ||
| ) |
在文件 Procgen.cpp 第 262 行定义.
引用了 h, eve::procgen::CloudShadow::sampleCoverage() , 以及 w.
◆ setPaletteGid()
| void eve::procgen::Procgen::setPaletteGid | ( | const std::string & | palette, |
| const std::string & | semantic, | ||
| int | gid | ||
| ) |
在文件 Procgen.cpp 第 122 行定义.
引用了 semantic , 以及 eve::procgen::PaletteTable::setGid().
被这些函数引用 Procgen().
该类的文档由以下文件生成:
- src/modules/procgen/Procgen.h
- src/modules/procgen/Procgen.cpp
Public 成员函数 继承自