载入中...
搜索中...
未找到
eve::weather::Weather类 参考

Weather module — real-time precipitation / lightning / wind system. 更多...

#include <Weather.h>

类 eve::weather::Weather 继承关系图:
eve::Module eve::IPhotoModeFieldSink

类

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.h 第 36 行定义.

构造及析构函数说明

◆ Weather()

eve::weather::Weather::Weather ( )

Weather.

在文件 Weather.cpp 第 319 行定义.

◆ ~Weather()

eve::weather::Weather::~Weather ( )
override

Weather.

在文件 Weather.cpp 第 321 行定义.

成员函数说明

◆ acceptsPhotoModeField()

PhotoModeFieldAcceptance eve::weather::Weather::acceptsPhotoModeField ( const PhotoModeAssignment &  assignment) const
overridevirtualnoexcept

Return whether this module owns a Pcg weather photo-mode field.

实现了 eve::IPhotoModeFieldSink.

在文件 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()

◆ 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 行定义.

引用了 eve::weather::Weather::Impl::snowWindOverride.

◆ 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 行定义.

引用了 eve::weather::Weather::Impl::currentReverbPreset.

◆ 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 行定义.

引用了 eve::weather::Weather::Impl::flash.

◆ getFogColorB()

float eve::weather::Weather::getFogColorB ( ) const

Returns the fog color b.

在文件 Weather.cpp 第 573 行定义.

引用了 eve::weather::Weather::Impl::fogB.

◆ getFogColorG()

float eve::weather::Weather::getFogColorG ( ) const

Returns the fog color g.

在文件 Weather.cpp 第 572 行定义.

引用了 eve::weather::Weather::Impl::fogG.

◆ getFogColorR()

float eve::weather::Weather::getFogColorR ( ) const

Returns the fog color r.

在文件 Weather.cpp 第 571 行定义.

引用了 eve::weather::Weather::Impl::fogR.

◆ getFogDensity()

float eve::weather::Weather::getFogDensity ( ) const

Returns the fog density.

在文件 Weather.cpp 第 576 行定义.

引用了 eve::weather::Weather::Impl::fogDensity.

◆ getIntensity()

float eve::weather::Weather::getIntensity ( ) const

Returns the intensity.

在文件 Weather.cpp 第 492 行定义.

引用了 eve::weather::Weather::Impl::intensity.

◆ getPcgRainEnabled()

bool eve::weather::Weather::getPcgRainEnabled ( ) const

Return Pcg's independent rain playback state.

在文件 Weather.cpp 第 474 行定义.

引用了 eve::weather::Weather::Impl::pcgRain.

◆ getPcgSnowEnabled()

bool eve::weather::Weather::getPcgSnowEnabled ( ) const

Return Pcg's independent snow playback state.

在文件 Weather.cpp 第 475 行定义.

引用了 eve::weather::Weather::Impl::pcgSnow.

◆ getPcgWeatherEnabled()

bool eve::weather::Weather::getPcgWeatherEnabled ( ) const

Return Pcg's master weather-enabled state.

在文件 Weather.cpp 第 473 行定义.

引用了 eve::weather::Weather::Impl::pcgWeatherEnabled.

◆ getPcgWindOverride()

bool eve::weather::Weather::getPcgWindOverride ( ) const

Return whether photo mode overrides the captured wind.

在文件 Weather.cpp 第 476 行定义.

引用了 eve::weather::Weather::Impl::pcgWindOverride.

◆ getPreset()

std::string eve::weather::Weather::getPreset ( ) const

Returns the preset.

在文件 Weather.cpp 第 487 行定义.

引用了 kPresetNames , 以及 eve::weather::Weather::Impl::preset.

◆ getSkyColorB()

float eve::weather::Weather::getSkyColorB ( ) const

Returns the sky color b.

在文件 Weather.cpp 第 563 行定义.

引用了 eve::weather::Weather::Impl::skyB.

◆ getSkyColorG()

float eve::weather::Weather::getSkyColorG ( ) const

Returns the sky color g.

在文件 Weather.cpp 第 562 行定义.

引用了 eve::weather::Weather::Impl::skyG.

◆ getSkyColorR()

float eve::weather::Weather::getSkyColorR ( ) const

Returns the sky color r.

在文件 Weather.cpp 第 561 行定义.

引用了 eve::weather::Weather::Impl::skyR.

◆ getSnowWindX()

float eve::weather::Weather::getSnowWindX ( ) const

Returns the snow wind x.

在文件 Weather.cpp 第 508 行定义.

引用了 eve::weather::Weather::Impl::snowWindX.

◆ getSnowWindY()

float eve::weather::Weather::getSnowWindY ( ) const

Returns the snow wind y.

在文件 Weather.cpp 第 509 行定义.

引用了 eve::weather::Weather::Impl::snowWindY.

◆ getSnowWindZ()

float eve::weather::Weather::getSnowWindZ ( ) const

Returns the snow wind z.

在文件 Weather.cpp 第 510 行定义.

引用了 eve::weather::Weather::Impl::snowWindZ.

◆ getSunIntensity()

float eve::weather::Weather::getSunIntensity ( ) const

Returns the sun intensity.

在文件 Weather.cpp 第 566 行定义.

引用了 eve::weather::Weather::Impl::sunIntensity.

◆ getWindDirection()

float eve::weather::Weather::getWindDirection ( ) const

Returns the wind direction.

在文件 Weather.cpp 第 498 行定义.

引用了 eve::weather::Weather::Impl::windDirDeg.

◆ getWindSpeed()

float eve::weather::Weather::getWindSpeed ( ) const

Returns the wind speed.

在文件 Weather.cpp 第 495 行定义.

引用了 eve::weather::Weather::Impl::windSpeed.

◆ hasSnowWind()

bool eve::weather::Weather::hasSnowWind ( ) const

Return whether a Pcg snow velocity override is active.

在文件 Weather.cpp 第 507 行定义.

引用了 eve::weather::Weather::Impl::snowWindOverride.

◆ init()

◆ isEnvironmentEnabled()

bool eve::weather::Weather::isEnvironmentEnabled ( ) const

True when environment enabled.

在文件 Weather.cpp 第 579 行定义.

引用了 eve::weather::Weather::Impl::environmentEnabled.

◆ isInsideInteriorWeather()

bool eve::weather::Weather::isInsideInteriorWeather ( ) const

True when inside interior weather.

在文件 Weather.cpp 第 537 行定义.

引用了 eve::weather::Weather::Impl::interiorWeather.

◆ 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 行定义.

引用了 eve::weather::Weather::Impl::lightningEnabled.

◆ 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 
)

◆ 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()

◆ 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)

◆ setSkyColor()

void eve::weather::Weather::setSkyColor ( float  r,
float  g,
float  b 
)

◆ setSnowWind()

Result< void > eve::weather::Weather::setSnowWind ( float  x,
float  y,
float  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()

◆ 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

const int eve::weather::Weather::kPresetCount = 8
static

在文件 Weather.h 第 56 行定义.

被这些函数引用 setPreset().

◆ kPresetNames

const char *const eve::weather::Weather::kPresetNames = {"clear", "drizzle", "rain", "storm", "snow", "fog", "wind", "blizzard"}
static

在文件 Weather.h 第 55 行定义.

被这些函数引用 getPreset() , 以及 setPreset().


该类的文档由以下文件生成: