Weather module — real-time precipitation / lightning / wind system. 更多...
#include <Weather.h>
类 | |
| struct | Impl |
Public 成员函数 | |
| Module_REG (Weather) | |
| Weather () | |
| Weather. | |
| ~Weather () override | |
| Weather. | |
| void | init (graphics::Graphics *gfx) |
| Idempotent; builds meshes/shaders on first call. | |
| void | update (float dt, graphics::Graphics *gfx) |
| Advance sim + push per-frame uniforms; must run before gfx.render3D(). | |
| void | setPreset (const std::string &name) |
| Sets the preset. | |
| std::string | getPreset () const |
| Returns the preset. | |
| PhotoModeFieldAcceptance | acceptsPhotoModeField (const PhotoModeAssignment &assignment) const noexcept override |
| Return whether this module owns a Pcg weather photo-mode field. | |
| Result< void > | applyPhotoModeField (const PhotoModeAssignment &assignment) override |
| Atomically apply one Pcg weather field to this authoritative weather state. | |
| bool | getPcgWeatherEnabled () const |
| Return Pcg's master weather-enabled state. | |
| bool | getPcgRainEnabled () const |
| Return Pcg's independent rain playback state. | |
| bool | getPcgSnowEnabled () const |
| Return Pcg's independent snow playback state. | |
| bool | getPcgWindOverride () const |
| Return whether photo mode overrides the captured wind. | |
| void | setIntensity (float v) |
| Sets the intensity. | |
| float | getIntensity () const |
| Returns the intensity. | |
| void | setWindSpeed (float v) |
| Sets the wind speed. | |
| float | getWindSpeed () const |
| Returns the wind speed. | |
| void | setWindDirection (float degrees) |
| Wind direction in degrees; 0 = toward +Z, 90 = toward -X. | |
| float | getWindDirection () const |
| Returns the wind direction. | |
| Result< void > | setSnowWind (float x, float y, float z) |
| Override snow world velocity exactly as Pcg SnowWindDir. | |
| void | clearSnowWind () |
| Return to horizontal wind plus the native default fall speed. | |
| bool | hasSnowWind () const |
| Return whether a Pcg snow velocity override is active. | |
| float | getSnowWindX () const |
| Returns the snow wind x. | |
| float | getSnowWindY () const |
| Returns the snow wind y. | |
| float | getSnowWindZ () const |
| Returns the snow wind z. | |
| Result< PcgInteriorWeatherTransition > | applyInteriorVolume (const PcgInteriorWeatherVolume &volume, float x, float y, float z) |
| Sample a bounds-driven interior volume and atomically apply an enter/exit transition. | |
| Result< PcgInteriorWeatherTransition > | setInteriorVolumeState (const PcgInteriorWeatherVolume &volume, bool inside) |
| Apply a trigger-driven enter/exit event without retaining the volume. | |
| void | clearInteriorWeather () |
| Clear interior state and restore the last sampled exterior reverb preset. | |
| bool | isInsideInteriorWeather () const |
| True when inside interior weather. | |
| bool | isInteriorWeatherCollisionRequested () const |
| True when interior weather collision requested. | |
| int | getCurrentWeatherReverbPreset () const |
| Returns the current weather reverb preset. | |
| void | setLightningEnabled (bool on) |
| Sets the lightning enabled. | |
| bool | isLightningEnabled () const |
| True when lightning enabled. | |
| void | strike () |
| Force a bolt strike this frame (useful for manual testing). | |
| float | getFlash () const |
| How bright the current flash is (0..1), sampled by the scene for a key light. | |
| void | setSkyColor (float r, float g, float b) |
| Sets the sky color. | |
| float | getSkyColorR () const |
| Returns the sky color r. | |
| float | getSkyColorG () const |
| Returns the sky color g. | |
| float | getSkyColorB () const |
| Returns the sky color b. | |
| void | setSunIntensity (float v) |
| Sets the sun intensity. | |
| float | getSunIntensity () const |
| Returns the sun intensity. | |
| void | setFogColor (float r, float g, float b) |
| Sets the fog color. | |
| float | getFogColorR () const |
| Returns the fog color r. | |
| float | getFogColorG () const |
| Returns the fog color g. | |
| float | getFogColorB () const |
| Returns the fog color b. | |
| void | setFogDensity (float v) |
| Sets the fog density. | |
| float | getFogDensity () const |
| Returns the fog density. | |
| void | setEnvironmentEnabled (bool enabled) |
| Enable legacy weather-owned sky and directional lighting. | |
| bool | isEnvironmentEnabled () const |
| True when environment enabled. | |
| float | getAmbientBrightness () const |
| Ambient multiplier that the example should feed into camera.setAmbient(). | |
Public 成员函数 继承自 eve::Module | |
| virtual | ~Module () |
| Module. | |
| virtual std::string | getName () const =0 |
| Returns the name. | |
Public 成员函数 继承自 eve::IPhotoModeFieldSink | |
| virtual | ~IPhotoModeFieldSink ()=default |
| Releases IPhotoModeFieldSink resources. | |
静态 Public 属性 | |
| static const char *const | kPresetNames [] = {"clear", "drizzle", "rain", "storm", "snow", "fog", "wind", "blizzard"} |
| static const int | kPresetCount = 8 |
静态 Public 属性 继承自 eve::IPhotoModeFieldSink | |
| static constexpr const char * | capabilityName ="eve.photo-mode.field" |
详细描述
Weather module — real-time precipitation / lightning / wind system.
Drives a set of camera-facing Renderable3D meshes (rain streaks, snow flakes, lightning bolts) whose geometry is animated in the vertex shader from a small set of per-frame uniforms (time, wind, intensity). Meshes and shaders are built lazily on first use and reused, so nothing is allocated per-frame.
Usage from script: weather.setPreset("storm"); weather.setIntensity(0.8); weather.setWindSpeed(12.0); // each frame before gfx.render3D(): weather.update(dt, gfx);
Presets: "clear", "drizzle", "rain", "storm", "snow", "fog", "wind", "blizzard".
构造及析构函数说明
◆ Weather()
| eve::weather::Weather::Weather | ( | ) |
在文件 Weather.cpp 第 319 行定义.
◆ ~Weather()
|
override |
在文件 Weather.cpp 第 321 行定义.
成员函数说明
◆ acceptsPhotoModeField()
|
overridevirtualnoexcept |
Return whether this module owns a Pcg weather photo-mode field.
在文件 Weather.cpp 第 457 行定义.
引用了 a, eve::Accepted, eve::Rejected , 以及 eve::Weather.
◆ applyInteriorVolume()
| Result< PcgInteriorWeatherTransition > eve::weather::Weather::applyInteriorVolume | ( | const PcgInteriorWeatherVolume & | volume, |
| float | x, | ||
| float | y, | ||
| float | z | ||
| ) |
Sample a bounds-driven interior volume and atomically apply an enter/exit transition.
在文件 Weather.cpp 第 525 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, setInteriorVolumeState(), volume, x, y , 以及 z.
◆ applyPhotoModeField()
|
overridevirtual |
Atomically apply one Pcg weather field to this authoritative weather state.
在文件 Weather.cpp 第 460 行定义.
引用了 a, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::weather::Weather::Impl::pcgMode, eve::weather::Weather::Impl::pcgRain, eve::weather::Weather::Impl::pcgSnow, eve::weather::Weather::Impl::pcgWeatherEnabled, eve::weather::Weather::Impl::pcgWindOverride, eve::Result< T >::success(), v, eve::Weather, eve::weather::Weather::Impl::windDirDeg , 以及 eve::weather::Weather::Impl::windSpeed.
◆ clearInteriorWeather()
| void eve::weather::Weather::clearInteriorWeather | ( | ) |
Clear interior state and restore the last sampled exterior reverb preset.
在文件 Weather.cpp 第 533 行定义.
引用了 eve::weather::Weather::Impl::currentReverbPreset, eve::weather::Weather::Impl::exteriorReverbPreset , 以及 eve::weather::Weather::Impl::interiorWeather.
◆ clearSnowWind()
| void eve::weather::Weather::clearSnowWind | ( | ) |
Return to horizontal wind plus the native default fall speed.
在文件 Weather.cpp 第 506 行定义.
◆ getAmbientBrightness()
| float eve::weather::Weather::getAmbientBrightness | ( | ) | const |
Ambient multiplier that the example should feed into camera.setAmbient().
在文件 Weather.cpp 第 581 行定义.
引用了 eve::weather::Weather::Impl::intensityCur , 以及 eve::weather::Weather::Impl::preset.
◆ getCurrentWeatherReverbPreset()
| int eve::weather::Weather::getCurrentWeatherReverbPreset | ( | ) | const |
Returns the current weather reverb preset.
在文件 Weather.cpp 第 541 行定义.
◆ getFlash()
| float eve::weather::Weather::getFlash | ( | ) | const |
How bright the current flash is (0..1), sampled by the scene for a key light.
在文件 Weather.cpp 第 556 行定义.
◆ getFogColorB()
| float eve::weather::Weather::getFogColorB | ( | ) | const |
◆ getFogColorG()
| float eve::weather::Weather::getFogColorG | ( | ) | const |
◆ getFogColorR()
| float eve::weather::Weather::getFogColorR | ( | ) | const |
◆ getFogDensity()
| float eve::weather::Weather::getFogDensity | ( | ) | const |
◆ getIntensity()
| float eve::weather::Weather::getIntensity | ( | ) | const |
◆ getPcgRainEnabled()
| bool eve::weather::Weather::getPcgRainEnabled | ( | ) | const |
Return Pcg's independent rain playback state.
在文件 Weather.cpp 第 474 行定义.
◆ getPcgSnowEnabled()
| bool eve::weather::Weather::getPcgSnowEnabled | ( | ) | const |
Return Pcg's independent snow playback state.
在文件 Weather.cpp 第 475 行定义.
◆ getPcgWeatherEnabled()
| bool eve::weather::Weather::getPcgWeatherEnabled | ( | ) | const |
Return Pcg's master weather-enabled state.
在文件 Weather.cpp 第 473 行定义.
◆ getPcgWindOverride()
| bool eve::weather::Weather::getPcgWindOverride | ( | ) | const |
Return whether photo mode overrides the captured wind.
在文件 Weather.cpp 第 476 行定义.
◆ getPreset()
| std::string eve::weather::Weather::getPreset | ( | ) | const |
Returns the preset.
在文件 Weather.cpp 第 487 行定义.
◆ getSkyColorB()
| float eve::weather::Weather::getSkyColorB | ( | ) | const |
◆ getSkyColorG()
| float eve::weather::Weather::getSkyColorG | ( | ) | const |
◆ getSkyColorR()
| float eve::weather::Weather::getSkyColorR | ( | ) | const |
◆ getSnowWindX()
| float eve::weather::Weather::getSnowWindX | ( | ) | const |
◆ getSnowWindY()
| float eve::weather::Weather::getSnowWindY | ( | ) | const |
◆ getSnowWindZ()
| float eve::weather::Weather::getSnowWindZ | ( | ) | const |
◆ getSunIntensity()
| float eve::weather::Weather::getSunIntensity | ( | ) | const |
Returns the sun intensity.
在文件 Weather.cpp 第 566 行定义.
◆ getWindDirection()
| float eve::weather::Weather::getWindDirection | ( | ) | const |
◆ getWindSpeed()
| float eve::weather::Weather::getWindSpeed | ( | ) | const |
◆ hasSnowWind()
| bool eve::weather::Weather::hasSnowWind | ( | ) | const |
Return whether a Pcg snow velocity override is active.
在文件 Weather.cpp 第 507 行定义.
◆ init()
| void eve::weather::Weather::init | ( | graphics::Graphics * | gfx | ) |
Idempotent; builds meshes/shaders on first call.
在文件 Weather.cpp 第 365 行定义.
引用了 b, eve::weather::Weather::Impl::boltMats, eve::weather::Weather::Impl::bolts, eve::weather::Weather::Impl::built, eve::graphics::Graphics::getBackendName(), eve::weather::Weather::Impl::gfx, eve::weather::shaders::kBoltFragWgsl, eve::weather::shaders::kBoltVertWgsl, eve::weather::shaders::kWeatherFragWgsl, eve::weather::shaders::kWeatherVertWgsl, m, eve::graphics::Graphics::newMaterial(), eve::graphics::Graphics::newMeshShaderFromSpv(), eve::graphics::Graphics::newMeshShaderFromWgsl(), eve::graphics::Graphics::newTexture(), eve::weather::Weather::Impl::rain, eve::weather::Weather::Impl::rainMat, eve::weather::Weather::Impl::rng, eve::graphics::Material::setAlbedoTexture(), eve::graphics::Material::setCastOcclusion(), eve::graphics::Material::setCastShadow(), eve::graphics::Renderable3D::setMaterial(), eve::graphics::Renderable3D::setMesh(), eve::graphics::Material::setReceiveLight(), eve::graphics::Material::setReceiveShadow(), eve::graphics::Material::setShader(), eve::graphics::Material::setShadingModel(), eve::graphics::Material::setTint(), eve::graphics::Renderable3D::setVisible(), eve::weather::Weather::Impl::snow, eve::weather::Weather::Impl::snowMat , 以及 top.
被这些函数引用 update().
◆ isEnvironmentEnabled()
| bool eve::weather::Weather::isEnvironmentEnabled | ( | ) | const |
True when environment enabled.
在文件 Weather.cpp 第 579 行定义.
◆ isInsideInteriorWeather()
| bool eve::weather::Weather::isInsideInteriorWeather | ( | ) | const |
True when inside interior weather.
在文件 Weather.cpp 第 537 行定义.
◆ isInteriorWeatherCollisionRequested()
| bool eve::weather::Weather::isInteriorWeatherCollisionRequested | ( | ) | const |
True when interior weather collision requested.
在文件 Weather.cpp 第 538 行定义.
引用了 eve::weather::Collision, eve::weather::Weather::Impl::interiorMode , 以及 eve::weather::Weather::Impl::interiorWeather.
◆ isLightningEnabled()
| bool eve::weather::Weather::isLightningEnabled | ( | ) | const |
True when lightning enabled.
在文件 Weather.cpp 第 544 行定义.
◆ Module_REG()
| eve::weather::Weather::Module_REG | ( | Weather | ) |
◆ setEnvironmentEnabled()
| void eve::weather::Weather::setEnvironmentEnabled | ( | bool | enabled | ) |
Enable legacy weather-owned sky and directional lighting.
Disable this when DayNight owns the environment; precipitation and lightning geometry continue to render and getFlash() remains available.
在文件 Weather.cpp 第 578 行定义.
引用了 enabled , 以及 eve::weather::Weather::Impl::environmentEnabled.
被这些函数引用 eve::lighting_editing::EnvironmentRuntimeApplier::applyWeather().
◆ setFogColor()
| void eve::weather::Weather::setFogColor | ( | float | r, |
| float | g, | ||
| float | b | ||
| ) |
Sets the fog color.
在文件 Weather.cpp 第 568 行定义.
引用了 b, eve::weather::Weather::Impl::fogB, eve::weather::Weather::Impl::fogG, eve::weather::Weather::Impl::fogR, g , 以及 r.
被这些函数引用 eve::lighting_editing::EnvironmentRuntimeApplier::applyWeather().
◆ setFogDensity()
| void eve::weather::Weather::setFogDensity | ( | float | v | ) |
Sets the fog density.
在文件 Weather.cpp 第 575 行定义.
引用了 eve::weather::Weather::Impl::fogDensity , 以及 v.
被这些函数引用 eve::lighting_editing::EnvironmentRuntimeApplier::applyWeather().
◆ setIntensity()
| void eve::weather::Weather::setIntensity | ( | float | v | ) |
Sets the intensity.
在文件 Weather.cpp 第 489 行定义.
引用了 eve::weather::Weather::Impl::intensity , 以及 v.
被这些函数引用 eve::lighting_editing::EnvironmentRuntimeApplier::applyWeather().
◆ setInteriorVolumeState()
| Result< PcgInteriorWeatherTransition > eve::weather::Weather::setInteriorVolumeState | ( | const PcgInteriorWeatherVolume & | volume, |
| bool | inside | ||
| ) |
Apply a trigger-driven enter/exit event without retaining the volume.
在文件 Weather.cpp 第 512 行定义.
引用了 eve::weather::Weather::Impl::currentReverbPreset, eve::weather::Entered, eve::weather::Exited, eve::weather::Weather::Impl::exteriorReverbPreset, inside, eve::weather::Weather::Impl::interiorMode, eve::weather::Weather::Impl::interiorReverbPreset, eve::weather::Weather::Impl::interiorWeather, eve::Result< T >::success(), eve::weather::Unchanged , 以及 volume.
被这些函数引用 applyInteriorVolume().
◆ setLightningEnabled()
| void eve::weather::Weather::setLightningEnabled | ( | bool | on | ) |
Sets the lightning enabled.
在文件 Weather.cpp 第 543 行定义.
引用了 eve::weather::Weather::Impl::lightningEnabled.
被这些函数引用 eve::lighting_editing::EnvironmentRuntimeApplier::applyWeather().
◆ setPreset()
| void eve::weather::Weather::setPreset | ( | const std::string & | name | ) |
Sets the preset.
在文件 Weather.cpp 第 477 行定义.
引用了 kPresetCount, kPresetNames, name, eve::weather::Weather::Impl::pcgMode , 以及 eve::weather::Weather::Impl::preset.
被这些函数引用 eve::lighting_editing::EnvironmentRuntimeApplier::applyWeather().
◆ setSkyColor()
| void eve::weather::Weather::setSkyColor | ( | float | r, |
| float | g, | ||
| float | b | ||
| ) |
Sets the sky color.
在文件 Weather.cpp 第 558 行定义.
引用了 b, g, r, eve::weather::Weather::Impl::skyB, eve::weather::Weather::Impl::skyG , 以及 eve::weather::Weather::Impl::skyR.
被这些函数引用 eve::lighting_editing::EnvironmentRuntimeApplier::applyWeather().
◆ setSnowWind()
| Result< void > eve::weather::Weather::setSnowWind | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
Override snow world velocity exactly as Pcg SnowWindDir.
在文件 Weather.cpp 第 499 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::weather::Weather::Impl::snowWindOverride, eve::weather::Weather::Impl::snowWindX, eve::weather::Weather::Impl::snowWindY, eve::weather::Weather::Impl::snowWindZ, eve::Result< T >::success(), x, y , 以及 z.
◆ setSunIntensity()
| void eve::weather::Weather::setSunIntensity | ( | float | v | ) |
Sets the sun intensity.
在文件 Weather.cpp 第 565 行定义.
引用了 eve::weather::Weather::Impl::sunIntensity , 以及 v.
◆ setWindDirection()
| void eve::weather::Weather::setWindDirection | ( | float | degrees | ) |
Wind direction in degrees; 0 = toward +Z, 90 = toward -X.
在文件 Weather.cpp 第 497 行定义.
引用了 eve::weather::Weather::Impl::windDirDeg.
被这些函数引用 eve::lighting_editing::EnvironmentRuntimeApplier::applyWeather().
◆ setWindSpeed()
| void eve::weather::Weather::setWindSpeed | ( | float | v | ) |
Sets the wind speed.
在文件 Weather.cpp 第 494 行定义.
引用了 v , 以及 eve::weather::Weather::Impl::windSpeed.
被这些函数引用 eve::lighting_editing::EnvironmentRuntimeApplier::applyWeather().
◆ strike()
| void eve::weather::Weather::strike | ( | ) |
Force a bolt strike this frame (useful for manual testing).
在文件 Weather.cpp 第 546 行定义.
引用了 eve::weather::Weather::Impl::activeBolt, eve::weather::Weather::Impl::boltLife, eve::weather::Weather::Impl::boltOnceFired, eve::weather::Weather::Impl::bolts, eve::weather::Weather::Impl::built, eve::weather::Weather::Impl::flash, eve::weather::Weather::Impl::flashTimer, eve::weather::Weather::Impl::nextStrike , 以及 eve::weather::Weather::Impl::rng.
被这些函数引用 update().
◆ update()
| void eve::weather::Weather::update | ( | float | dt, |
| graphics::Graphics * | gfx | ||
| ) |
Advance sim + push per-frame uniforms; must run before gfx.render3D().
在文件 Weather.cpp 第 590 行定义.
引用了 eve::weather::Weather::Impl::activeBolt, eve::weather::Weather::Impl::boltLife, eve::weather::Weather::Impl::boltMats, eve::weather::Weather::Impl::bolts, eve::weather::Weather::Impl::built, eve::weather::DisableVfx, eve::weather::Weather::Impl::environmentEnabled, f, eve::weather::Weather::Impl::flash, eve::weather::Weather::Impl::flashTimer, eve::weather::Weather::Impl::fogB, eve::weather::Weather::Impl::fogDensity, eve::weather::Weather::Impl::fogG, eve::weather::Weather::Impl::fogR, eve::weather::Weather::Impl::gfx, init(), eve::weather::Weather::Impl::intensity, eve::weather::Weather::Impl::intensityCur, eve::weather::Weather::Impl::interiorMode, eve::weather::Weather::Impl::interiorWeather, eve::weather::Weather::Impl::lightningEnabled, eve::weather::Weather::Impl::nextStrike, eve::weather::Weather::Impl::pcgMode, eve::weather::Weather::Impl::pcgRain, eve::weather::Weather::Impl::pcgSnow, eve::weather::Weather::Impl::pcgWeatherEnabled, eve::weather::Weather::Impl::preset, eve::weather::Weather::Impl::rain, eve::weather::Weather::Impl::rainMat, eve::graphics::Graphics::setBackgroundColorRGBA(), eve::graphics::Graphics::setDirectionalLight(), eve::graphics::Material::setFloat(), eve::graphics::Renderable3D::setVisible(), eve::weather::Weather::Impl::skyB, eve::weather::Weather::Impl::skyG, eve::weather::Weather::Impl::skyR, eve::weather::Weather::Impl::snow, eve::weather::Weather::Impl::snowMat, eve::weather::Weather::Impl::snowWindOverride, eve::weather::Weather::Impl::snowWindX, eve::weather::Weather::Impl::snowWindY, eve::weather::Weather::Impl::snowWindZ, strike(), eve::weather::Weather::Impl::sunIntensity, target, time, eve::weather::Weather::Impl::time, eve::weather::Weather::Impl::windDirDeg, eve::weather::Weather::Impl::windOffsetX, eve::weather::Weather::Impl::windOffsetZ , 以及 eve::weather::Weather::Impl::windSpeed.
类成员变量说明
◆ kPresetCount
|
static |
被这些函数引用 setPreset().
◆ kPresetNames
|
static |
被这些函数引用 getPreset() , 以及 setPreset().
该类的文档由以下文件生成:
- src/modules/weather/Weather.h
- src/modules/weather/Weather.cpp
Public 成员函数 继承自