载入中...
搜索中...
未找到
SkyScriptBindings.cpp
浏览该文件的文档.
16 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, message, "sky.script"));
25 {"cloudTravelXZ", Value::array({frame.simulation.cloudTravelXZ[0], frame.simulation.cloudTravelXZ[1]})},
31 {"sunDirection", Value::array({frame.sunDirection[0], frame.sunDirection[1], frame.sunDirection[2]})},
32 {"sunIrradiance", Value::array({frame.sunIrradiance[0], frame.sunIrradiance[1], frame.sunIrradiance[2]})}});
42 daynightClass.addFunc("prepareSky", [vm](DayNight*, graphics::Graphics* graphics, const std::string& profileJson) {
58 auto prepared = SkyRuntime::prepare(*graphics, profile.value().settings(), profile.value().atmosphere(),
The single Squirrel projection for common Result, Status and Value.
Explicit Value/Owned/Borrowed semantics at the Squirrel boundary.
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< Duration > fromSeconds(double seconds)
Convert finite seconds to the nearest nanosecond.
Definition Time.cpp:16
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.h:81
static Result< Value > fromJson(std::string_view json)
Parse one strict JSON value into an owning Value.
Definition Value.cpp:57
DayNight module — a time-of-day cycle that drives the sun, sky and light.
Definition DayNight.h:94
static Result< SkyProfile > decode(const Value &document)
Validate a complete profile without creating GPU resources or changing any runtime.
Definition SkyProfile.cpp:72
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
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
Definition Graphics.h:125
static Result< SkyWispsAsset > generate(uint32_t seed)
Generate a complete independent sky using a named procedural-v1 seed.
Definition SkyProceduralAsset.cpp:64
static Result< SkyWispsAsset > load(const std::string &manifestPath)
Read and decode the complete asset before publishing owned data.
Definition SkyWispsAsset.cpp:71
std::variant< std::monostate, std::int64_t, double, std::string, bool > Value
Definition Database.h:26
Definition DayNight.cpp:18
void exposeSkyScriptBindings(ssq::Table &table, ssq::Class &daynightClass)
Register independent sky bindings on the VM/graphics owner thread.
Definition SkyScriptBindings.cpp:35
ssq::Table projectStatusResult(HSQUIRRELVM vm, const Status &status)
Project a checked native status that carries no payload.
Definition SquirrelBinding.cpp:454
ssq::Table projectResult(HSQUIRRELVM vm, Result< void > &&result)
Consume and project a void native Result using the common schema.
Definition SquirrelBinding.cpp:470
eve::Result< ssq::Object > makeOwnedSquirrelInstance(HSQUIRRELVM vm, Owned< T > object)
Creates a Squirrel instance that owns a C++ wrapper through a release hook.
Definition SquirrelOwnership.h:241
@ InvalidArgument