t3ssel8r-style stylized grass. 更多...
类 | |
| struct | BillboardMesh |
| BillboardMesh public API. 更多... | |
| struct | GrassFoliageSettings |
| Pcg-style static foliage surface controls packed into the grass shader profile. Values are copied during upload; colors are linear RGB. 更多... | |
| struct | PackedAtlasInfo |
| Layout of a packed 2x2-per-variant sway atlas (4 grass + 2 leaf typical). 更多... | |
| struct | Point |
| Point public API. 更多... | |
| struct | SampleParams |
| SampleParams public API. 更多... | |
| struct | TerrainDetailOverwriteSettings |
| Runtime terrain-detail overrides kept distinct from foliage material settings. 更多... | |
枚举 | |
| enum class | TerrainDetailQuality { VeryLow64 , Low32 , Medium16 , High8 , VeryHigh4 , Ultra2 } |
| Pcg quality category derived from detailResolutionPerPatch. 更多... | |
函数 | |
| void | bindAtlasLayout (Shader *shader, const PackedAtlasInfo &info) |
| Binds atlas layout. | |
| void | bindLayer (Shader *shader, bool alwaysDark) |
| Binds layer. | |
| void | setTime (Shader *shader, float seconds) |
| Sets the time. | |
| void | setFrameDuration (Shader *shader, float seconds) |
| Sets the frame duration. | |
| Shader * | createShader (Graphics *gfx) |
| Creates shader. | |
| int | swayFrame (float time, float frameDuration, uint32_t instanceId, int frameCount=4) |
| Discrete 4-frame index with a per-instance phase offset. | |
| int | swayAtlasWidth (int frameW, int frames) |
| Sway atlas width. | |
| int | swayAtlasHeight (int frameH) |
| Sway atlas height. | |
| void | makeSwayAtlasRGBA (int frameW, int frameH, int frames, std::vector< uint8_t > &rgbaOut) |
| Procedural 4-frame fallback atlas (horizontal strip). GPU paths should load authored 2x2 PNG masks via packSwayAtlasRGBA / createSwayAtlasFromFiles. | |
| Texture * | createSwayAtlas (Graphics *gfx, int frameW=64, int frameH=64, int frames=4) |
| Creates sway atlas. | |
| void | packSwayAtlasRGBA (const std::vector< std::string > &grassFiles, const std::vector< std::string > &leafFiles, std::vector< uint8_t > &rgbaOut, PackedAtlasInfo &info) |
| Load white-on-black (or RGBA) 2x2 sway PNGs and pack them into one atlas. | |
| Texture * | createSwayAtlasFromFiles (Graphics *gfx, const std::vector< std::string > &grassFiles, const std::vector< std::string > &leafFiles, PackedAtlasInfo *infoOut=nullptr) |
| Creates sway atlas from files. | |
| std::vector< Point > | sampleHalton (const float *posXYZ, const float *nrmXYZ, int vertexCount, const uint32_t *indices, int indexCount, int count, uint32_t seed=1, float minSlopeDot=0.25f) |
| Area-weighted Halton samples (deterministic, evenly spread). | |
| std::vector< Point > | samplePoisson (const float *posXYZ, const float *nrmXYZ, int vertexCount, const uint32_t *indices, int indexCount, const SampleParams ¶ms={}) |
| Fast Poisson-disk / dart-throwing blue noise on a triangle mesh. | |
| void | makePlane (float sizeX, float sizeZ, int segX, int segZ, std::vector< float > &posXYZ, std::vector< float > &nrmXYZ, std::vector< uint32_t > &indices) |
| Unit XZ plane (Y-up) for tests / demos. | |
| EVENGINE_API_BACKENDS TerrainDetailQuality | terrainDetailQuality (int resolutionPerPatch) noexcept |
| Classify a Unity terrain detail patch resolution with Pcg's exact default mapping. | |
| EVENGINE_API_BACKENDS Result< int > | applyTerrainDetailOverwrite (GrassFoliageSettings &foliage, const TerrainDetailOverwriteSettings &settings) |
| Validate and copy TerrainDetailOverwrite distances/density into a foliage profile atomically. | |
| EVENGINE_API_BACKENDS BillboardMesh | buildBillboards (const std::vector< Point > &points, float width=0.62f, float height=0.95f, bool alwaysDark=false) |
| Expand a unit rectangle per point. Vertex layout: pos = grass root uv = quad corner in [0,1]^2 (0.5, 0) is the root normal.x = animation id, normal.y = height scale. normal.z uses legacy 0/1 for uniform width; independent width w encodes -w for dense or 1+w for dark grass. A normalized tint encodes RGB8 as negative normal.x; legacy tint {-1,-1,-1} retains id. The shader derives animation identity from the local root for tinted points, so model transforms do not change the wind phase. Alpha remains texture-owned. | |
| EVENGINE_API_BACKENDS void | bindDefaults (Shader *shader) |
| Binds defaults. | |
| EVENGINE_API_BACKENDS void | bindFoliage (Shader *shader, const GrassFoliageSettings &settings) |
| Select the static foliage profile and copy its validated surface parameters. | |
| EVENGINE_API_BACKENDS int | paramCount () |
| Param count. | |
| EVENGINE_API_BACKENDS std::string | paramName (int index) |
| Param name. | |
详细描述
t3ssel8r-style stylized grass.
Pipeline:
- Blue-noise (Poisson disk) or Halton samples on a terrain mesh
- Expand a root-pivoted rectangle into a GPU mesh (one quad per sample)
- Vertex shader cylindrical-billboards each card around its root
- 4-frame sway atlas, phase-offset by instance id
- Shadow map → mix(light green, dark green)
- Sparse second pass, always dark, as decoration
枚举类型说明
◆ TerrainDetailQuality
|
strong |
函数说明
◆ applyTerrainDetailOverwrite()
| Result< int > eve::graphics::grass::applyTerrainDetailOverwrite | ( | GrassFoliageSettings & | foliage, |
| const TerrainDetailOverwriteSettings & | settings | ||
| ) |
Validate and copy TerrainDetailOverwrite distances/density into a foliage profile atomically.
在文件 GrassParameters.cpp 第 90 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::graphics::grass::GrassFoliageSettings::renderDistance, settings, eve::Result< T >::success() , 以及 terrainDetailQuality().
被这些函数引用 eve::graphics::GrassField::setTerrainDetailOverwrite().
◆ bindAtlasLayout()
| void eve::graphics::grass::bindAtlasLayout | ( | Shader * | shader, |
| const PackedAtlasInfo & | info | ||
| ) |
Binds atlas layout.
被这些函数引用 eve::graphics::GrassField::bake().
◆ bindDefaults()
| void eve::graphics::grass::bindDefaults | ( | Shader * | shader | ) |
Binds defaults.
在文件 GrassParameters.cpp 第 22 行定义.
引用了 shader.
被这些函数引用 eve::graphics::GrassField::bake(), bindFoliage() , 以及 createShader().
◆ bindFoliage()
| void eve::graphics::grass::bindFoliage | ( | Shader * | shader, |
| const GrassFoliageSettings & | settings | ||
| ) |
Select the static foliage profile and copy its validated surface parameters.
在文件 GrassParameters.cpp 第 64 行定义.
引用了 bindDefaults(), s , 以及 shader.
◆ bindLayer()
| EVENGINE_API_BACKENDS void eve::graphics::grass::bindLayer | ( | Shader * | shader, |
| bool | alwaysDark | ||
| ) |
◆ buildBillboards()
| BillboardMesh eve::graphics::grass::buildBillboards | ( | const std::vector< Point > & | points, |
| float | width = 0.62f, |
||
| float | height = 0.95f, |
||
| bool | alwaysDark = false |
||
| ) |
Expand a unit rectangle per point. Vertex layout: pos = grass root uv = quad corner in [0,1]^2 (0.5, 0) is the root normal.x = animation id, normal.y = height scale. normal.z uses legacy 0/1 for uniform width; independent width w encodes -w for dense or 1+w for dark grass. A normalized tint encodes RGB8 as negative normal.x; legacy tint {-1,-1,-1} retains id. The shader derives animation identity from the local root for tinted points, so model transforms do not change the wind phase. Alpha remains texture-owned.
在文件 GrassBillboards.cpp 第 13 行定义.
引用了 c, height, mesh, n, p, points, eve::graphics::grass::BillboardMesh::posXYZ , 以及 width.
被这些函数引用 eve::graphics::GrassField::bake().
◆ createShader()
Creates shader.
引用了 bindDefaults(), frag, eve::graphics::Graphics::getBackendName(), eve::graphics::Shader::gpuHandle, eve::graphics::shaders::kGrassFragWgsl, eve::graphics::shaders::kGrassVertWgsl, eve::graphics::Graphics::newMeshShaderFromSpv(), eve::graphics::Graphics::newMeshShaderFromWgsl() , 以及 vert.
被这些函数引用 eve::graphics::GrassField::bake().
◆ createSwayAtlas()
| Texture * eve::graphics::grass::createSwayAtlas | ( | Graphics * | gfx, |
| int | frameW, | ||
| int | frameH, | ||
| int | frames | ||
| ) |
◆ createSwayAtlasFromFiles()
| Texture * eve::graphics::grass::createSwayAtlasFromFiles | ( | Graphics * | gfx, |
| const std::vector< std::string > & | grassFiles, | ||
| const std::vector< std::string > & | leafFiles, | ||
| PackedAtlasInfo * | infoOut | ||
| ) |
Creates sway atlas from files.
引用了 info, eve::graphics::TextureSampler::linear(), eve::graphics::Graphics::newTexture(), packSwayAtlasRGBA() , 以及 eve::graphics::TextureCreateInfo::sampler.
被这些函数引用 eve::graphics::GrassField::bake().
◆ makePlane()
| EVENGINE_API_BACKENDS void eve::graphics::grass::makePlane | ( | float | sizeX, |
| float | sizeZ, | ||
| int | segX, | ||
| int | segZ, | ||
| std::vector< float > & | posXYZ, | ||
| std::vector< float > & | nrmXYZ, | ||
| std::vector< uint32_t > & | indices | ||
| ) |
◆ makeSwayAtlasRGBA()
| EVENGINE_API_BACKENDS void eve::graphics::grass::makeSwayAtlasRGBA | ( | int | frameW, |
| int | frameH, | ||
| int | frames, | ||
| std::vector< uint8_t > & | rgbaOut | ||
| ) |
Procedural 4-frame fallback atlas (horizontal strip). GPU paths should load authored 2x2 PNG masks via packSwayAtlasRGBA / createSwayAtlasFromFiles.
引用了 f, h, swayAtlasHeight(), swayAtlasWidth() , 以及 w.
被这些函数引用 createSwayAtlas().
◆ packSwayAtlasRGBA()
| EVENGINE_API_BACKENDS void eve::graphics::grass::packSwayAtlasRGBA | ( | const std::vector< std::string > & | grassFiles, |
| const std::vector< std::string > & | leafFiles, | ||
| std::vector< uint8_t > & | rgbaOut, | ||
| PackedAtlasInfo & | info | ||
| ) |
Load white-on-black (or RGBA) 2x2 sway PNGs and pack them into one atlas.
引用了 h, info, kind, eve::Loaded, p, path , 以及 w.
被这些函数引用 createSwayAtlasFromFiles().
◆ paramCount()
| int eve::graphics::grass::paramCount | ( | ) |
Param count.
在文件 GrassParameters.cpp 第 15 行定义.
◆ paramName()
| std::string eve::graphics::grass::paramName | ( | int | index | ) |
◆ sampleHalton()
| EVENGINE_API_BACKENDS std::vector< Point > eve::graphics::grass::sampleHalton | ( | const float * | posXYZ, |
| const float * | nrmXYZ, | ||
| int | vertexCount, | ||
| const uint32_t * | indices, | ||
| int | indexCount, | ||
| int | count, | ||
| uint32_t | seed, | ||
| float | minSlopeDot | ||
| ) |
◆ samplePoisson()
| EVENGINE_API_BACKENDS std::vector< Point > eve::graphics::grass::samplePoisson | ( | const float * | posXYZ, |
| const float * | nrmXYZ, | ||
| int | vertexCount, | ||
| const uint32_t * | indices, | ||
| int | indexCount, | ||
| const SampleParams & | params | ||
| ) |
Fast Poisson-disk / dart-throwing blue noise on a triangle mesh.
引用了 cell, idx, indexCount, indices, n, p, params, pos, eve::graphics::grass::Point::position, u, v , 以及 vertexCount.
被这些函数引用 eve::graphics::GrassField::bake().
◆ setFrameDuration()
| void eve::graphics::grass::setFrameDuration | ( | Shader * | shader, |
| float | seconds | ||
| ) |
Sets the frame duration.
引用了 shader.
被这些函数引用 eve::graphics::GrassField::draw() , 以及 eve::graphics::GrassField::setFrameDuration().
◆ setTime()
| void eve::graphics::grass::setTime | ( | Shader * | shader, |
| float | seconds | ||
| ) |
Sets the time.
引用了 shader.
被这些函数引用 eve::graphics::GrassField::draw(), eve::graphics::GrassField::setTime() , 以及 eve::graphics::GrassField::update().
◆ swayAtlasHeight()
| EVENGINE_API_BACKENDS int eve::graphics::grass::swayAtlasHeight | ( | int | frameH | ) |
◆ swayAtlasWidth()
| EVENGINE_API_BACKENDS int eve::graphics::grass::swayAtlasWidth | ( | int | frameW, |
| int | frames | ||
| ) |
◆ swayFrame()
| EVENGINE_API_BACKENDS int eve::graphics::grass::swayFrame | ( | float | time, |
| float | frameDuration, | ||
| uint32_t | instanceId, | ||
| int | frameCount | ||
| ) |
◆ terrainDetailQuality()
|
noexcept |
Classify a Unity terrain detail patch resolution with Pcg's exact default mapping.
在文件 GrassParameters.cpp 第 79 行定义.
引用了 High8, Low32, Medium16, Ultra2, VeryHigh4 , 以及 VeryLow64.
被这些函数引用 applyTerrainDetailOverwrite().