Runtime decal module — project surface effects (blood, dirt, scorch, dents via normal maps, ...) onto any world geometry. 更多...
#include <Decal.h>
类 | |
| struct | ProceduralBakeCache |
Public 成员函数 | |
| Module_REG (Decal) | |
| Decal () | |
| Decal. | |
| ~Decal () override | |
| Decal. | |
| int | project (float x, float y, float z, float nx, float ny, float nz, graphics::Texture *albedo, const std::string &kind, float size, float depth, bool randomYaw, int seed, float fadeIn, float lifetime, float fadeOut) |
| Spawn a decal at (x,y,z) facing along (nx,ny,nz); returns id. | |
| bool | setStrength (int id, float normalStrength, float roughnessStrength, float metalStrength, float emissiveStrength) |
| Per-channel blend strengths for a live decal (0 disables). | |
| bool | setUvRect (int id, float x, float y, float w, float h) |
| Atlas region [x, y, w, h] (normalized) for a live decal. | |
| bool | setTextures (int id, graphics::Texture *normal, graphics::Texture *params) |
| Optional normal / params (roughness, metallic, emissive) textures. | |
| bool | setBlend (int id, const std::string &mode) |
| Blend mode: "over" (default) or "add" (emissive). | |
| DecalProjectionStatus | setProjection (int id, const std::string &mode, float blendSharpness) |
| Projection: "planar", "triplanar", "spherical", or world-aligned "world". | |
| DecalParallaxStatus | setParallax (int id, float scale, float minLayers, float maxLayers) |
| Configure params-alpha POM; scale zero disables it. | |
| DecalEdgeFadeStatus | setEdgeFade (int id, float width) |
| Configure normalized edge-mask feather width in [0, 0.49]. | |
| bool | remove (int id) |
| Removes . | |
| void | clearAll () |
| Clears all. | |
| int | count () |
| Returns the number of . | |
| void | setLimit (const std::string &kind, int limit) |
| Sets the limit. | |
| void | update (float dt) |
| Advance ages / evict expired; call once per frame. | |
| void | setEnabled (graphics::Graphics *gfx, bool enabled) |
| Toggle the graphics "decal" feature on the given backend. | |
| std::string | proceduralPresets () const |
| Return the stable comma-separated Procedural Decal preset names. | |
| graphics::Texture * | bakePresetTexture (graphics::Graphics *gfx, const std::string &preset, std::uint32_t seed, int resolution, const std::string &channel) |
| Bake one channel of a named Procedural Decal preset and upload it. | |
| graphics::Texture * | bakeSbsprsTexture (graphics::Graphics *gfx, const std::string &xml, int resolution, const std::string &channel) |
Import a Procedural Decal .sbsprs document, bake it, and upload one channel. | |
Public 成员函数 继承自 eve::Module | |
| virtual | ~Module () |
| Module. | |
| virtual std::string | getName () const =0 |
| Returns the name. | |
详细描述
Runtime decal module — project surface effects (blood, dirt, scorch, dents via normal maps, ...) onto any world geometry.
Script: decal <- eve.Decal();
Rendering: screen-space box-projected decals. The module registers a RenderSystem3D decal drawer; the "decal" RenderControl feature gates the pass (see setEnabled). decal.update(dt) must be called each frame to advance fades and evict expired instances.
构造及析构函数说明
◆ Decal()
| eve::decal::Decal::Decal | ( | ) |
◆ ~Decal()
|
override |
成员函数说明
◆ bakePresetTexture()
| graphics::Texture * eve::decal::Decal::bakePresetTexture | ( | graphics::Graphics * | gfx, |
| const std::string & | preset, | ||
| std::uint32_t | seed, | ||
| int | resolution, | ||
| const std::string & | channel | ||
| ) |
Bake one channel of a named Procedural Decal preset and upload it.
- 参数
-
gfx Graphics service that owns the returned texture. preset Preset listed by proceduralPresets(). seed Deterministic authoring seed. resolution Square output size in the inclusive range 1..4096. channel One of "albedo", "normal", or "params".
- 返回
- Borrowed texture owned by gfx; it remains valid according to the graphics resource lifetime. @cost The first unique preset/seed/resolution request is linear in pixel count and blur radius; adjacent channel requests reuse one bounded CPU bake result. Bake during load or authoring.
- 异常
-
eve::Exception when arguments or the recipe are invalid. @thread Must run on the graphics service's resource-creation thread. @reentrancy Does not invoke scripts or callbacks.
引用了 eve::decal::bakeProceduralDecal(), bytes, eve::graphics::Graphics::newTexture(), eve::decal::proceduralDecalPreset(), seed , 以及 source.
◆ bakeSbsprsTexture()
| graphics::Texture * eve::decal::Decal::bakeSbsprsTexture | ( | graphics::Graphics * | gfx, |
| const std::string & | xml, | ||
| int | resolution, | ||
| const std::string & | channel | ||
| ) |
Import a Procedural Decal .sbsprs document, bake it, and upload one channel.
- 参数
-
gfx Graphics service that owns the returned texture. xml UTF-8 Substance preset document. resolution Square output size in the inclusive range 1..4096. channel One of "albedo", "normal", or "params".
- 返回
- Borrowed texture owned by gfx. @cost The first unique document/resolution request is linear in XML size, pixel count, and blur radius; adjacent channel requests reuse one bounded CPU bake result. Admission/loading only.
- 异常
-
eve::Exception when import, bake, channel selection, or upload fails. @thread Must run on the graphics service's resource-creation thread. @reentrancy Does not invoke scripts or callbacks.
引用了 eve::decal::bakeProceduralDecal(), bytes, eve::decal::importProceduralDecalSbsprs(), eve::graphics::Graphics::newTexture() , 以及 source.
◆ clearAll()
| void eve::decal::Decal::clearAll | ( | ) |
Clears all.
引用了 eve::decal::DecalManager::clearAll() , 以及 eve::decal::DecalManager::inst().
◆ count()
| int eve::decal::Decal::count | ( | ) |
Returns the number of .
引用了 eve::decal::DecalManager::count() , 以及 eve::decal::DecalManager::inst().
◆ Module_REG()
| eve::decal::Decal::Module_REG | ( | Decal | ) |
◆ proceduralPresets()
| std::string eve::decal::Decal::proceduralPresets | ( | ) | const |
◆ project()
| int eve::decal::Decal::project | ( | float | x, |
| float | y, | ||
| float | z, | ||
| float | nx, | ||
| float | ny, | ||
| float | nz, | ||
| graphics::Texture * | albedo, | ||
| const std::string & | kind, | ||
| float | size, | ||
| float | depth, | ||
| bool | randomYaw, | ||
| int | seed, | ||
| float | fadeIn, | ||
| float | lifetime, | ||
| float | fadeOut | ||
| ) |
◆ remove()
| bool eve::decal::Decal::remove | ( | int | id | ) |
Removes .
引用了 eve::decal::DecalManager::inst() , 以及 eve::decal::DecalManager::remove().
◆ setBlend()
| bool eve::decal::Decal::setBlend | ( | int | id, |
| const std::string & | mode | ||
| ) |
Blend mode: "over" (default) or "add" (emissive).
引用了 eve::decal::DecalManager::inst() , 以及 eve::decal::DecalManager::setBlend().
◆ setEdgeFade()
| DecalEdgeFadeStatus eve::decal::Decal::setEdgeFade | ( | int | id, |
| float | width | ||
| ) |
Configure normalized edge-mask feather width in [0, 0.49].
引用了 eve::decal::DecalManager::inst(), eve::decal::DecalManager::setEdgeFade() , 以及 width.
◆ setEnabled()
| void eve::decal::Decal::setEnabled | ( | graphics::Graphics * | gfx, |
| bool | enabled | ||
| ) |
Toggle the graphics "decal" feature on the given backend.
引用了 enabled , 以及 eve::graphics::Graphics::getRenderControl().
◆ setLimit()
| void eve::decal::Decal::setLimit | ( | const std::string & | kind, |
| int | limit | ||
| ) |
Sets the limit.
引用了 eve::decal::DecalManager::inst(), kind, limit , 以及 eve::decal::DecalManager::setLimit().
◆ setParallax()
| DecalParallaxStatus eve::decal::Decal::setParallax | ( | int | id, |
| float | scale, | ||
| float | minLayers, | ||
| float | maxLayers | ||
| ) |
Configure params-alpha POM; scale zero disables it.
引用了 eve::decal::DecalManager::inst(), scale , 以及 eve::decal::DecalManager::setParallax().
◆ setProjection()
| DecalProjectionStatus eve::decal::Decal::setProjection | ( | int | id, |
| const std::string & | mode, | ||
| float | blendSharpness | ||
| ) |
Projection: "planar", "triplanar", "spherical", or world-aligned "world".
- 参数
-
blendSharpness Triplanar blend exponent (typical 2–10; default 4).
- 返回
- DecalProjectionStatus::Applied on success.
引用了 eve::decal::DecalManager::inst() , 以及 eve::decal::DecalManager::setProjection().
◆ setStrength()
| bool eve::decal::Decal::setStrength | ( | int | id, |
| float | normalStrength, | ||
| float | roughnessStrength, | ||
| float | metalStrength, | ||
| float | emissiveStrength | ||
| ) |
Per-channel blend strengths for a live decal (0 disables).
引用了 eve::decal::DecalManager::inst(), normalStrength , 以及 eve::decal::DecalManager::setStrength().
◆ setTextures()
| bool eve::decal::Decal::setTextures | ( | int | id, |
| graphics::Texture * | normal, | ||
| graphics::Texture * | params | ||
| ) |
Optional normal / params (roughness, metallic, emissive) textures.
引用了 eve::decal::DecalManager::inst(), normal, params , 以及 eve::decal::DecalManager::setTextures().
◆ setUvRect()
| bool eve::decal::Decal::setUvRect | ( | int | id, |
| float | x, | ||
| float | y, | ||
| float | w, | ||
| float | h | ||
| ) |
Atlas region [x, y, w, h] (normalized) for a live decal.
引用了 h, eve::decal::DecalManager::inst(), eve::decal::DecalManager::setUvRect(), w, x , 以及 y.
◆ update()
| void eve::decal::Decal::update | ( | float | dt | ) |
Advance ages / evict expired; call once per frame.
引用了 eve::decal::DecalManager::inst() , 以及 eve::decal::DecalManager::update().
该类的文档由以下文件生成:
Public 成员函数 继承自