Dense grass + sparse dark tufts on a mesh. Caller owns GrassField*; GPU Mesh / Shader / Texture are owned by Graphics. 更多...
#include <Grass.h>
类 | |
| struct | BakeParams |
| BakeParams public API. 更多... | |
Public 成员函数 | |
| GrassField (Graphics *gfx) | |
| ~GrassField () | |
| GrassField (const GrassField &)=delete | |
| GrassField & | operator= (const GrassField &)=delete |
| void | bake (const float *posXYZ, const float *nrmXYZ, int vertexCount, const uint32_t *indices, int indexCount, const BakeParams ¶ms) |
| void | bakePlane (float sizeX, float sizeZ, int segX, int segZ) |
| void | bakePlane (float sizeX, float sizeZ, int segX, int segZ, const BakeParams ¶ms) |
| Result< int > | bakePoints (const std::vector< grass::Point > &points, float width, float height) |
| Upload explicit grass roots without resampling, using the built-in four-frame atlas. | |
| Result< int > | bakeTexturedPoints (const std::vector< grass::Point > &points, float width, float height, const image::ImageData &image) |
| Upload roots with one static RGBA8 image, preserving original RGB and alpha. Image storage is borrowed only during upload; the resulting texture belongs to Graphics. Same thread, atomic publication and point validation contract as bakePoints. Image dimensions must be positive with complete RGBA8 storage. No atlas slicing or generated animation is applied. | |
| Result< int > | bakeFoliagePoints (const std::vector< grass::Point > &points, float width, float height, const image::ImageData &albedo, const image::ImageData &normal, const image::ImageData &mask, const grass::GrassFoliageSettings &settings) |
| Upload static foliage albedo, tangent normal and metallic/occlusion/thickness/smoothness masks. All images must be complete, equally sized RGBA8 data. Validation and GPU publication are atomic. Textures are copied during the call and then owned by Graphics. Called on the Graphics owner thread. | |
| Result< int > | setTerrainDetailOverwrite (const grass::TerrainDetailOverwriteSettings &settings) |
| Apply Pcg terrain detail hard distance, shader fade and density to an uploaded foliage field. | |
| float | getTerrainDetailHardDistance () const noexcept |
| Return the currently applied Unity-style hard detail distance. | |
| float | getTerrainDetailDensity () const noexcept |
| Return the currently applied normalized detail density. | |
| void | setPhotoModeAuthority (bool enabled) |
| Register or revoke this field as the unique Pcg photo-mode grass authority. | |
| float | getPhotoModeDensity () const noexcept |
| Return the Pcg global density multiplier. | |
| float | getPhotoModeDistance () const noexcept |
| Return the Pcg global distance multiplier. | |
| float | getPhotoModeCellDistance () const noexcept |
| Return the effective camera-cell distance multiplier. | |
| int | getPhotoModeCellSubdivision () const noexcept |
| Return the signed camera-cell subdivision level. | |
| PhotoModeFieldAcceptance | acceptsPhotoModeField (const PhotoModeAssignment &assignment) const noexcept override |
| Return true only for fields owned by this provider. | |
| Result< void > | applyPhotoModeField (const PhotoModeAssignment &assignment) override |
| Apply one accepted assignment atomically on the game thread. | |
| void | update (float dt) |
| void | setTime (float seconds) |
| float | getTime () const |
| void | setFrameDuration (float seconds) |
| float | getFrameDuration () const |
| void | draw (const glm::mat4 &model) |
| void | draw () |
| void | setReflectionCaptureEnabled (bool enabled) |
| Enable or disable inclusion in reflection-probe captures. | |
| bool | getReflectionCaptureEnabled () const |
| Return whether this field is included in reflection-probe captures. | |
| void | setReflectionCaptureMask (uint32_t mask) |
| Set the reflection-capture visibility layer mask. | |
| uint32_t | getReflectionCaptureMask () const |
| Return the reflection-capture visibility layer mask. | |
| Mesh * | getDenseMesh () const |
| Borrow the dense mesh on the owner thread; valid until this field rebakes or is destroyed. | |
| Mesh * | getSparseMesh () const |
| Borrow the sparse mesh on the owner thread; valid until this field rebakes or is destroyed. | |
| Shader * | getShader () const |
| Borrow the shader on the owner thread; valid until this field is destroyed. | |
| Texture * | getAtlas () const |
| Borrow the atlas on the owner thread; valid until this field uploads another atlas or is destroyed. | |
| int | getDenseCount () const |
| int | getSparseCount () const |
Public 成员函数 继承自 eve::IPhotoModeFieldSink | |
| virtual | ~IPhotoModeFieldSink ()=default |
| Releases IPhotoModeFieldSink resources. | |
额外继承的成员函数 | |
静态 Public 属性 继承自 eve::IPhotoModeFieldSink | |
| static constexpr const char * | capabilityName ="eve.photo-mode.field" |
详细描述
Dense grass + sparse dark tufts on a mesh. Caller owns GrassField*; GPU Mesh / Shader / Texture are owned by Graphics.
构造及析构函数说明
◆ GrassField() [1/2]
|
explicit |
◆ ~GrassField()
| eve::graphics::GrassField::~GrassField | ( | ) |
◆ GrassField() [2/2]
|
delete |
成员函数说明
◆ acceptsPhotoModeField()
|
overridevirtualnoexcept |
Return true only for fields owned by this provider.
引用了 a, eve::Accepted, eve::Grass , 以及 eve::Rejected.
◆ applyPhotoModeField()
|
overridevirtual |
Apply one accepted assignment atomically on the game thread.
引用了 a, eve::Diagnostic::error(), f, eve::Result< T >::failure(), eve::InvalidArgument, m , 以及 eve::Result< T >::success().
◆ bake()
| void eve::graphics::GrassField::bake | ( | const float * | posXYZ, |
| const float * | nrmXYZ, | ||
| int | vertexCount, | ||
| const uint32_t * | indices, | ||
| int | indexCount, | ||
| const BakeParams & | params | ||
| ) |
引用了 eve::graphics::grass::bindAtlasLayout(), eve::graphics::grass::bindDefaults(), eve::graphics::grass::buildBillboards(), eve::graphics::grass::createShader(), eve::graphics::grass::createSwayAtlas(), eve::graphics::grass::createSwayAtlasFromFiles(), indexCount, indices, layout, eve::graphics::grass::SampleParams::maxPoints, eve::graphics::grass::SampleParams::minSlopeDot, eve::graphics::Graphics::newMeshFromArrays(), params, eve::graphics::grass::SampleParams::radius, eve::graphics::grass::samplePoisson(), eve::graphics::grass::SampleParams::seed, eve::graphics::Shader::sendFloat() , 以及 vertexCount.
被这些函数引用 bakePlane().
◆ bakeFoliagePoints()
| Result< int > eve::graphics::GrassField::bakeFoliagePoints | ( | const std::vector< grass::Point > & | points, |
| float | width, | ||
| float | height, | ||
| const image::ImageData & | albedo, | ||
| const image::ImageData & | normal, | ||
| const image::ImageData & | mask, | ||
| const grass::GrassFoliageSettings & | settings | ||
| ) |
Upload static foliage albedo, tangent normal and metallic/occlusion/thickness/smoothness masks. All images must be complete, equally sized RGBA8 data. Validation and GPU publication are atomic. Textures are copied during the call and then owned by Graphics. Called on the Graphics owner thread.
- 返回
- Uploaded point count or InvalidArgument while preserving the prior published field.
在文件 GrassPoints.cpp 第 15 行定义.
引用了 albedo, height, mask, normal, points, settings , 以及 width.
◆ bakePlane() [1/2]
| void eve::graphics::GrassField::bakePlane | ( | float | sizeX, |
| float | sizeZ, | ||
| int | segX, | ||
| int | segZ | ||
| ) |
◆ bakePlane() [2/2]
| void eve::graphics::GrassField::bakePlane | ( | float | sizeX, |
| float | sizeZ, | ||
| int | segX, | ||
| int | segZ, | ||
| const BakeParams & | params | ||
| ) |
◆ bakePoints()
| Result< int > eve::graphics::GrassField::bakePoints | ( | const std::vector< grass::Point > & | points, |
| float | width, | ||
| float | height | ||
| ) |
Upload explicit grass roots without resampling, using the built-in four-frame atlas.
- 参数
-
points Borrowed finite world roots and height scales greater than 0.001 and nonnegative independent width scales; IDs fit 24 bits. width Positive finite billboard width. height Positive finite billboard height.
- 返回
- Uploaded count or InvalidArgument; validation failure preserves the previous field. GPU creation/allocation exceptions also preserve published field pointers. Graphics owns newly allocated meshes, shaders and textures until its teardown, including interrupted uploads. Called on the Graphics owner thread, outside draw/capture callbacks. Retains no input references. Replaces both previous layers with one dense layer; empty input clears their published meshes.
在文件 GrassPoints.cpp 第 8 行定义.
◆ bakeTexturedPoints()
| Result< int > eve::graphics::GrassField::bakeTexturedPoints | ( | const std::vector< grass::Point > & | points, |
| float | width, | ||
| float | height, | ||
| const image::ImageData & | image | ||
| ) |
Upload roots with one static RGBA8 image, preserving original RGB and alpha. Image storage is borrowed only during upload; the resulting texture belongs to Graphics. Same thread, atomic publication and point validation contract as bakePoints. Image dimensions must be positive with complete RGBA8 storage. No atlas slicing or generated animation is applied.
- 返回
- Uploaded count or InvalidArgument; invalid image leaves the previous field unchanged.
在文件 GrassPoints.cpp 第 11 行定义.
◆ draw() [1/2]
| void eve::graphics::GrassField::draw | ( | ) |
◆ draw() [2/2]
| void eve::graphics::GrassField::draw | ( | const glm::mat4 & | model | ) |
◆ getAtlas()
|
inline |
◆ getDenseCount()
◆ getDenseMesh()
|
inline |
◆ getFrameDuration()
◆ getPhotoModeCellDistance()
|
inlinenoexcept |
◆ getPhotoModeCellSubdivision()
|
inlinenoexcept |
◆ getPhotoModeDensity()
|
inlinenoexcept |
◆ getPhotoModeDistance()
|
inlinenoexcept |
◆ getReflectionCaptureEnabled()
|
inline |
◆ getReflectionCaptureMask()
|
inline |
◆ getShader()
|
inline |
◆ getSparseCount()
◆ getSparseMesh()
|
inline |
◆ getTerrainDetailDensity()
|
inlinenoexcept |
◆ getTerrainDetailHardDistance()
|
inlinenoexcept |
◆ getTime()
◆ operator=()
|
delete |
◆ setFrameDuration()
| void eve::graphics::GrassField::setFrameDuration | ( | float | seconds | ) |
◆ setPhotoModeAuthority()
| void eve::graphics::GrassField::setPhotoModeAuthority | ( | bool | enabled | ) |
◆ setReflectionCaptureEnabled()
|
inline |
◆ setReflectionCaptureMask()
|
inline |
◆ setTerrainDetailOverwrite()
| Result< int > eve::graphics::GrassField::setTerrainDetailOverwrite | ( | const grass::TerrainDetailOverwriteSettings & | settings | ) |
Apply Pcg terrain detail hard distance, shader fade and density to an uploaded foliage field.
- 返回
- Derived TerrainDetailQuality ordinal, or InvalidArgument without changing the live shader state. @ownership Settings are copied; no caller data or callback is retained. Owner-thread only.
在文件 GrassPoints.cpp 第 20 行定义.
引用了 eve::graphics::grass::applyTerrainDetailOverwrite(), eve::graphics::grass::GrassFoliageSettings::density, eve::Diagnostic::error(), eve::graphics::grass::GrassFoliageSettings::fadeRange, eve::Result< T >::failure(), eve::graphics::grass::GrassFoliageSettings::hardRenderDistance, eve::InvalidArgument, eve::graphics::Shader::pushConstantData(), eve::graphics::grass::GrassFoliageSettings::renderDistance , 以及 settings.
◆ setTime()
| void eve::graphics::GrassField::setTime | ( | float | seconds | ) |
◆ update()
| void eve::graphics::GrassField::update | ( | float | dt | ) |
该类的文档由以下文件生成:
- src/modules/graphics/Grass.h
- src/modules/graphics/Grass.cpp
- src/modules/graphics/GrassPoints.cpp
Public 成员函数 继承自