Weather module — real-time precipitation / lightning / wind system. 更多...
#include <Weather.h>
类 | |
| struct | Impl |
Public 成员函数 | |
| Module_REG (Weather) | |
| Weather () | |
| ~Weather () override | |
| 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) |
| std::string | getPreset () const |
| void | setIntensity (float v) |
| float | getIntensity () const |
| void | setWindSpeed (float v) |
| float | getWindSpeed () const |
| void | setWindDirection (float degrees) |
| Wind direction in degrees; 0 = toward +Z, 90 = toward -X. | |
| float | getWindDirection () const |
| void | setLightningEnabled (bool on) |
| bool | isLightningEnabled () const |
| 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) |
| float | getSkyColorR () const |
| float | getSkyColorG () const |
| float | getSkyColorB () const |
| void | setSunIntensity (float v) |
| float | getSunIntensity () const |
| void | setFogColor (float r, float g, float b) |
| float | getFogColorR () const |
| float | getFogColorG () const |
| float | getFogColorB () const |
| void | setFogDensity (float v) |
| float | getFogDensity () const |
| float | getAmbientBrightness () const |
| Ambient multiplier that the example should feed into camera.setAmbient(). | |
Public 成员函数 继承自 eve::Module | |
| virtual | ~Module () |
| virtual std::string | getName () const =0 |
静态 Public 属性 | |
| static const char *const | kPresetNames [] |
| static const int | kPresetCount = 6 |
详细描述
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".
构造及析构函数说明
◆ Weather()
| eve::weather::Weather::Weather | ( | ) |
在文件 Weather.cpp 第 280 行定义.
◆ ~Weather()
|
override |
在文件 Weather.cpp 第 282 行定义.
成员函数说明
◆ getAmbientBrightness()
| float eve::weather::Weather::getAmbientBrightness | ( | ) | const |
Ambient multiplier that the example should feed into camera.setAmbient().
在文件 Weather.cpp 第 461 行定义.
◆ 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 第 439 行定义.
◆ getFogColorB()
| float eve::weather::Weather::getFogColorB | ( | ) | const |
在文件 Weather.cpp 第 456 行定义.
◆ getFogColorG()
| float eve::weather::Weather::getFogColorG | ( | ) | const |
在文件 Weather.cpp 第 455 行定义.
◆ getFogColorR()
| float eve::weather::Weather::getFogColorR | ( | ) | const |
在文件 Weather.cpp 第 454 行定义.
◆ getFogDensity()
| float eve::weather::Weather::getFogDensity | ( | ) | const |
在文件 Weather.cpp 第 459 行定义.
◆ getIntensity()
| float eve::weather::Weather::getIntensity | ( | ) | const |
在文件 Weather.cpp 第 418 行定义.
◆ getPreset()
| std::string eve::weather::Weather::getPreset | ( | ) | const |
在文件 Weather.cpp 第 413 行定义.
◆ getSkyColorB()
| float eve::weather::Weather::getSkyColorB | ( | ) | const |
在文件 Weather.cpp 第 446 行定义.
◆ getSkyColorG()
| float eve::weather::Weather::getSkyColorG | ( | ) | const |
在文件 Weather.cpp 第 445 行定义.
◆ getSkyColorR()
| float eve::weather::Weather::getSkyColorR | ( | ) | const |
在文件 Weather.cpp 第 444 行定义.
◆ getSunIntensity()
| float eve::weather::Weather::getSunIntensity | ( | ) | const |
在文件 Weather.cpp 第 449 行定义.
◆ getWindDirection()
| float eve::weather::Weather::getWindDirection | ( | ) | const |
在文件 Weather.cpp 第 424 行定义.
◆ getWindSpeed()
| float eve::weather::Weather::getWindSpeed | ( | ) | const |
在文件 Weather.cpp 第 421 行定义.
◆ init()
| void eve::weather::Weather::init | ( | graphics::Graphics * | gfx | ) |
Idempotent; builds meshes/shaders on first call.
在文件 Weather.cpp 第 323 行定义.
引用了 b, eve::weather::Weather::Impl::boltMats, eve::weather::Weather::Impl::bolts, eve::weather::Weather::Impl::built, eve::weather::Weather::Impl::gfx, m, eve::graphics::Graphics::newMaterial(), eve::graphics::Graphics::newMeshShaderFromSpv(), eve::graphics::Graphics::newTexture(), eve::weather::Weather::Impl::rain, eve::weather::Weather::Impl::rainMat, eve::weather::Weather::Impl::rng, 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::Renderable3D::setTexture(), eve::graphics::Material::setTint(), eve::graphics::Renderable3D::setVisible(), eve::weather::Weather::Impl::snow , 以及 eve::weather::Weather::Impl::snowMat.
被这些函数引用 update().
◆ isLightningEnabled()
| bool eve::weather::Weather::isLightningEnabled | ( | ) | const |
在文件 Weather.cpp 第 427 行定义.
◆ Module_REG()
| eve::weather::Weather::Module_REG | ( | Weather | ) |
◆ setFogColor()
| void eve::weather::Weather::setFogColor | ( | float | r, |
| float | g, | ||
| float | b | ||
| ) |
◆ setFogDensity()
| void eve::weather::Weather::setFogDensity | ( | float | v | ) |
在文件 Weather.cpp 第 458 行定义.
引用了 eve::weather::Weather::Impl::fogDensity , 以及 v.
◆ setIntensity()
| void eve::weather::Weather::setIntensity | ( | float | v | ) |
在文件 Weather.cpp 第 415 行定义.
引用了 eve::weather::Weather::Impl::intensity , 以及 v.
◆ setLightningEnabled()
| void eve::weather::Weather::setLightningEnabled | ( | bool | on | ) |
在文件 Weather.cpp 第 426 行定义.
◆ setPreset()
| void eve::weather::Weather::setPreset | ( | const std::string & | name | ) |
在文件 Weather.cpp 第 404 行定义.
引用了 kPresetCount, kPresetNames, name , 以及 eve::weather::Weather::Impl::preset.
◆ setSkyColor()
| void eve::weather::Weather::setSkyColor | ( | float | r, |
| float | g, | ||
| float | b | ||
| ) |
◆ setSunIntensity()
| void eve::weather::Weather::setSunIntensity | ( | float | v | ) |
在文件 Weather.cpp 第 448 行定义.
引用了 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 第 423 行定义.
◆ setWindSpeed()
| void eve::weather::Weather::setWindSpeed | ( | float | v | ) |
在文件 Weather.cpp 第 420 行定义.
引用了 v , 以及 eve::weather::Weather::Impl::windSpeed.
◆ strike()
| void eve::weather::Weather::strike | ( | ) |
Force a bolt strike this frame (useful for manual testing).
在文件 Weather.cpp 第 429 行定义.
引用了 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 第 469 行定义.
引用了 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, 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::lightningEnabled, eve::weather::Weather::Impl::nextStrike, 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::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, strike(), eve::weather::Weather::Impl::sunIntensity, eve::weather::Weather::Impl::time, eve::weather::Weather::Impl::windDirDeg , 以及 eve::weather::Weather::Impl::windSpeed.
类成员变量说明
◆ kPresetCount
|
static |
被这些函数引用 setPreset().
◆ kPresetNames
|
static |
被这些函数引用 getPreset() , 以及 setPreset().
该类的文档由以下文件生成:
- src/modules/weather/Weather.h
- src/modules/weather/Weather.cpp
Public 成员函数 继承自