SLG / large-map war-fog overlay driven by a dual-scrolling cloud texture and an RGBA mask bridge (R unlock, G select, B dissolve). 更多...
#include <MapFog.h>
Public 成员函数 | |
| MapFog (Graphics *graphics) | |
| Create a fog overlay renderer backed by the supplied graphics device. | |
| ~MapFog () | |
| Map fog. | |
| MapFog (const MapFog &)=delete | |
| MapFog & | operator= (const MapFog &)=delete |
| void | update (float dt) |
| Advance dual-scroll / blink timers. | |
| void | setTime (float time) |
| Override the animated time used by cloud scroll (seconds). | |
| float | getTime () const |
| Return the current animation time in seconds. | |
| void | setCloudTexture (Texture *cloud) |
| Set or replace the repeating cloud/color texture. | |
| Texture * | getCloudTexture () |
| Return the active cloud texture (never null after first ensureCloudTexture). @ownership Borrowed; Graphics owns the texture storage. @lifetime Remains valid until Graphics releases the texture or shutdown. | |
| void | setMaskTexture (Texture *mask) |
| Set the RGBA mask bridge texture. | |
| Texture * | getMaskTexture () const |
| Return the current mask texture, or null if unset. @ownership Borrowed; ownership stays with the provider that created the texture. @lifetime Valid until the provider releases the texture or this MapFog is destroyed. | |
| void | setCloudTiling (float tileA, float tileB) |
| Dual-layer cloud tiling (layer A / B). | |
| void | setCloudSpeed (float speedA, float speedB) |
| Dual-layer scroll speeds in UV units per second. | |
| void | setDistort (float amount) |
| Mask-UV distortion amount from desaturated cloud noise. | |
| void | setDistortFix (float x, float y) |
| Correct additive UV drift introduced by distortion. | |
| void | setFogColor (float r, float g, float b) |
| Fog tint RGB in 0..1. | |
| void | setFogAlpha (float alpha) |
| Overall fog opacity in 0..1. | |
| void | setEdgeSoftness (float softness) |
| Soft edge half-width around the mask R threshold. | |
| void | setShadowEnabled (bool enabled) |
| Enable the pre-pass cloud shadow (must draw before the main pass). | |
| void | setShadow (float offsetX, float offsetY, float strength) |
| Shadow UV offset and strength. | |
| void | setSelectStrength (float strength) |
| Selection blink amplitude for mask G. | |
| void | setDissolveScale (float scale) |
| Dissolve noise tiling scale. | |
| void | setCloudMix (float mix) |
| Mix weight between the two scrolling cloud samples (0..1). | |
| void | setCloudDensity (float contrast, float bias) |
| Shape cloud alpha: contrast (soft→hard) and bias (coverage). | |
| float | getCloudTileA () const |
| Returns the cloud tile a. | |
| float | getCloudTileB () const |
| Returns the cloud tile b. | |
| float | getCloudSpeedA () const |
| Returns the cloud speed a. | |
| float | getCloudSpeedB () const |
| Returns the cloud speed b. | |
| float | getDistort () const |
| Returns the distort. | |
| float | getFogAlpha () const |
| Returns the fog alpha. | |
| float | getEdgeSoftness () const |
| Returns the edge softness. | |
| bool | getShadowEnabled () const |
| Returns the shadow enabled. | |
| float | getSelectStrength () const |
| Returns the select strength. | |
| void | draw (float x, float y, float width, float height) |
| Draw fog over a destination rectangle (shadow pass then main pass). | |
| Texture * | makeCloudTexture (int size=128) |
| Build a seamless procedural cloud noise texture owned by Graphics. | |
详细描述
SLG / large-map war-fog overlay driven by a dual-scrolling cloud texture and an RGBA mask bridge (R unlock, G select, B dissolve).
Presentation only: gameplay unlock state should live in map::Fov / game data; upload that state into the mask R channel and call draw() after the map.
构造及析构函数说明
◆ MapFog() [1/2]
|
explicit |
Create a fog overlay renderer backed by the supplied graphics device.
在文件 MapFog.cpp 第 70 行定义.
引用了 eve::graphics::Shader::declareFloat(), eve::graphics::Graphics::getBackendName(), eve::graphics::Graphics::newShaderFromSpv() , 以及 eve::graphics::Graphics::newShaderFromWgsl().
◆ ~MapFog()
|
default |
Map fog.
◆ MapFog() [2/2]
|
delete |
成员函数说明
◆ draw()
| void eve::graphics::MapFog::draw | ( | float | x, |
| float | y, | ||
| float | width, | ||
| float | height | ||
| ) |
Draw fog over a destination rectangle (shadow pass then main pass).
- 参数
-
x Destination left edge. y Destination top edge. width Destination width. height Destination height.
在文件 MapFog.cpp 第 516 行定义.
引用了 eve::graphics::Graphics::drawTexturedRectShaderDepth(), height, width, x , 以及 y.
◆ getCloudSpeedA()
|
inline |
◆ getCloudSpeedB()
|
inline |
◆ getCloudTexture()
| Texture * eve::graphics::MapFog::getCloudTexture | ( | ) |
Return the active cloud texture (never null after first ensureCloudTexture). @ownership Borrowed; Graphics owns the texture storage. @lifetime Remains valid until Graphics releases the texture or shutdown.
在文件 MapFog.cpp 第 310 行定义.
◆ getCloudTileA()
|
inline |
◆ getCloudTileB()
|
inline |
◆ getDistort()
|
inline |
◆ getEdgeSoftness()
|
inline |
◆ getFogAlpha()
|
inline |
◆ getMaskTexture()
|
inline |
◆ getSelectStrength()
|
inline |
◆ getShadowEnabled()
|
inline |
◆ getTime()
|
inline |
◆ makeCloudTexture()
| Texture * eve::graphics::MapFog::makeCloudTexture | ( | int | size = 128 | ) |
Build a seamless procedural cloud noise texture owned by Graphics.
- 参数
-
size Edge length in pixels (clamped to [16, 512]).
- 返回
- Borrowed Graphics-owned texture, or null on failure. @ownership Graphics owns the returned texture; the caller must not delete it. @lifetime Remains valid until Graphics releases the texture or shutdown.
在文件 MapFog.cpp 第 363 行定义.
引用了 a, b, d, dx, dy, g, h, height, n, eve::graphics::Graphics::newTexture(), nx, ny, nz, p, r, seed, size, t, u, v, x , 以及 y.
◆ operator=()
◆ setCloudDensity()
| void eve::graphics::MapFog::setCloudDensity | ( | float | contrast, |
| float | bias | ||
| ) |
Shape cloud alpha: contrast (soft→hard) and bias (coverage).
在文件 MapFog.cpp 第 358 行定义.
◆ setCloudMix()
| void eve::graphics::MapFog::setCloudMix | ( | float | mix | ) |
Mix weight between the two scrolling cloud samples (0..1).
在文件 MapFog.cpp 第 356 行定义.
◆ setCloudSpeed()
| void eve::graphics::MapFog::setCloudSpeed | ( | float | speedA, |
| float | speedB | ||
| ) |
Dual-layer scroll speeds in UV units per second.
在文件 MapFog.cpp 第 322 行定义.
◆ setCloudTexture()
| void eve::graphics::MapFog::setCloudTexture | ( | Texture * | cloud | ) |
Set or replace the repeating cloud/color texture.
- 参数
-
cloud Borrowed Graphics-owned texture; null falls back to a built-in noise cloud. @ownership Does not take ownership of cloud; Graphics retains texture ownership. @lifetimecloudmust outlive subsequent draw() calls that use it.
在文件 MapFog.cpp 第 308 行定义.
◆ setCloudTiling()
| void eve::graphics::MapFog::setCloudTiling | ( | float | tileA, |
| float | tileB | ||
| ) |
Dual-layer cloud tiling (layer A / B).
在文件 MapFog.cpp 第 317 行定义.
◆ setDissolveScale()
| void eve::graphics::MapFog::setDissolveScale | ( | float | scale | ) |
◆ setDistort()
| void eve::graphics::MapFog::setDistort | ( | float | amount | ) |
Mask-UV distortion amount from desaturated cloud noise.
在文件 MapFog.cpp 第 327 行定义.
◆ setDistortFix()
| void eve::graphics::MapFog::setDistortFix | ( | float | x, |
| float | y | ||
| ) |
◆ setEdgeSoftness()
| void eve::graphics::MapFog::setEdgeSoftness | ( | float | softness | ) |
Soft edge half-width around the mask R threshold.
在文件 MapFog.cpp 第 342 行定义.
◆ setFogAlpha()
| void eve::graphics::MapFog::setFogAlpha | ( | float | alpha | ) |
Overall fog opacity in 0..1.
在文件 MapFog.cpp 第 340 行定义.
◆ setFogColor()
| void eve::graphics::MapFog::setFogColor | ( | float | r, |
| float | g, | ||
| float | b | ||
| ) |
◆ setMaskTexture()
| void eve::graphics::MapFog::setMaskTexture | ( | Texture * | mask | ) |
Set the RGBA mask bridge texture.
- 参数
-
mask Borrowed texture; R=unlocked, G=selected, B=dissolve threshold. @ownership Does not take ownership of mask; the caller/Graphics retains it. @lifetimemaskmust outlive subsequent draw() calls that use it.
在文件 MapFog.cpp 第 315 行定义.
引用了 mask.
◆ setSelectStrength()
| void eve::graphics::MapFog::setSelectStrength | ( | float | strength | ) |
◆ setShadow()
| void eve::graphics::MapFog::setShadow | ( | float | offsetX, |
| float | offsetY, | ||
| float | strength | ||
| ) |
◆ setShadowEnabled()
| void eve::graphics::MapFog::setShadowEnabled | ( | bool | enabled | ) |
Enable the pre-pass cloud shadow (must draw before the main pass).
在文件 MapFog.cpp 第 344 行定义.
引用了 enabled.
◆ setTime()
| void eve::graphics::MapFog::setTime | ( | float | time | ) |
◆ update()
| void eve::graphics::MapFog::update | ( | float | dt | ) |
该类的文档由以下文件生成:
- src/modules/graphics/MapFog.h
- src/modules/graphics/MapFog.cpp