载入中...
搜索中...
未找到
SkyRuntime.cpp
浏览该文件的文档.
13Result<Light> solarLight(const SkySolarOrbit& orbit, double hour, const std::array<float, 3>& base) {
26float dayPhase(double hour) { return std::min(static_cast<float>(hour / 24.0), std::nextafter(1.f, 0.f)); }
28 return Diagnostic::error(DiagnosticCode::StaleHandle, "Sky graphics provider retired", "sky.runtime");
32 const auto multiplier = [](double value) { return std::isfinite(value) && value >= 0 && value <= 1000; };
33 if (!std::isfinite(phase) || std::abs(phase) > 1e6 || !multiplier(speed) || !multiplier(timeScale) ||
36 Diagnostic::error(DiagnosticCode::InvalidArgument, "Invalid cloud motion controls", "sky.motion"));
81 DiagnosticCode::InvalidArgument, "Solar irradiance must be finite and nonnegative", "sky.runtime"));
88 std::make_unique<Impl>(std::move(timeline).takeValue(), std::move(orbit).takeValue(), settings.sunIrradiance);
98 pass.value()->setFrame({light.value(), cloud.value().second, dayPhase(result->impl_->timeline.frame().hour)});
117 auto applied = impl_->atmosphere->setFrame({light.value(), cloud.value().second, dayPhase(candidate.frame().hour)});
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
Owns independent sky simulation and its prepared atmospheric contributor.
Definition SkyRuntime.h:46
static Result< std::unique_ptr< SkyRuntime > > prepare(graphics::Graphics &graphics, const SkyRuntimeSettings &settings, const graphics::SkyAtmosphereParameters &atmosphere, const graphics::SkyWispsLayer *wisps=nullptr)
Validate settings and prepare all atmospheric resources before publication.
Definition SkyRuntime.cpp:67
Result< void > attach()
Attach the prepared main-view and reflection contributors, idempotently.
Definition SkyRuntime.cpp:140
Result< void > advance(Duration duration)
Advance one simulation clock and atomically publish solar lighting/cloud phase; invalid time preserve...
Definition SkyRuntime.cpp:108
Result< void > transitionTo(const SkyWeather &target, Duration duration)
Start a validated weather transition without advancing simulation time.
Definition SkyRuntime.cpp:125
SkyRuntimeFrame frame() const noexcept
Copy current simulation and solar lighting without advancing either.
Definition SkyRuntime.cpp:129
void detach() noexcept
Unregister both contributors; simulation and prepared resources remain owned.
Definition SkyRuntime.cpp:144
~SkyRuntime()
Non-astronomical daily solar orbit, matching the reference's manual pitch/yaw mode.
Definition SkySolarOrbit.h:12
static Result< SkySolarOrbit > create(double pitchDegrees, double yawDegrees)
Prepare a daily orbit with pitch [-90,90] and yaw [-360,360] degrees.
Definition SkySolarOrbit.cpp:14
Owns one independent sky clock, weather transition and integrated cloud travel.
Definition SkyTimeline.h:42
static Result< SkyTimeline > create(const SkyClock &clock, const SkyWeather &weather)
Construct validated state. Clock hours are [0,24), speed [0,24] hours/second.
Definition SkyTimeline.cpp:22
Definition Graphics.h:125
std::weak_ptr< const void > resourceLifetime() const
Observe this provider's resource lifetime without extending it.
Definition GraphicsLifetime.cpp:27
static Result< std::unique_ptr< SkyAtmospherePass > > prepare(Graphics &graphics, const SkyAtmosphereParameters ¶meters, const SkyWispsLayer *wisps=nullptr)
Prepare an independent atmospheric program and immutable coefficient buffer.
Definition SkyAtmospherePass.cpp:110
Definition DayNight.cpp:18
@ InvalidArgument
@ StaleHandle
Definition Container.h:602
Source cloud-time controls; phase is additive, speed is source time per injected second.
Definition SkyRuntime.h:15
EVENGINE_API_WORLD Result< void > validate() const
Reject nonfinite values, phase outside +/-1e6 and multipliers outside [0,1000].
Definition SkyRuntime.cpp:31
Copied simulation and evaluated solar lighting used by every view.
Definition SkyRuntime.h:30
std::array< double, 3 > sunDirection
Definition SkyRuntime.h:34
std::array< float, 3 > sunIrradiance
Definition SkyRuntime.h:35
Independent runtime settings; not a serialized profile or a legacy DayNight override.
Definition SkyRuntime.h:21
std::weak_ptr< const void > lifetime
Definition SkyRuntime.cpp:59
std::unique_ptr< graphics::SkyAtmospherePass > atmosphere
Definition SkyRuntime.cpp:60
Impl(SkyTimeline time, SkySolarOrbit solar, std::array< float, 3 > irradiance)
Definition SkyRuntime.cpp:61
Result< std::pair< double, float > > cloudSample(double seconds) const
Definition SkyRuntime.cpp:47
Independent sky weather values; distances are metres and wind is metres/second.
Definition SkyTimeline.h:10
Spherical atmospheric coefficients in inverse kilometres and kilometre heights.
Definition SkyAtmospherePass.h:39
Borrowed authored thin-cloud layer, consumed synchronously by sky preparation.
Definition SkyWispsLayer.h:53