载入中...
搜索中...
未找到
OceanRenderBindings.cpp
浏览该文件的文档.
49Result<HullMaskScriptPublication> decodeHullMask(const Value& value, std::shared_ptr<OceanRenderer> renderer) {
57 if (!volumes.isArray() || volumes.arraySize() > 32) throw std::runtime_error("At most 32 hull volumes");
59 if (!v.isArray() || v.arraySize() != 4) throw std::runtime_error("Four plane/quaternion components");
71 if (!bevels.isArray() || bevels.arraySize() > 10) throw std::runtime_error("At most ten hull bevels");
72 for (std::size_t j = 0; j < bevels.arraySize(); ++j) hull.bevels.push_back(vector4(bevels.at(j)));
94 if (!segments.isInt64() || segments.asInt() < 16 || segments.asInt() > 1024 || !rings.isInt64() ||
101 out.backend = backend.asString() == "gpu" ? OceanRenderBackend::GpuResident : OceanRenderBackend::CpuReference;
112 return Result<Placement>::success({ocean_codec::vector(ocean_codec::field(v.value(), "center")),
143 "build", [vm](GpuBuilder*, OceanSpectrum* spectrum, graphics::Graphics* graphics, gpgpu::Gpgpu* compute) {
149 vm, Result<GpuOcean>::success({std::shared_ptr<OceanGpuSpectrum>(std::move(built).takeValue())}));
151 auto gpu = table.addClass<GpuOcean>("OceanGpuSpectrum", std::function<GpuOcean*()>([] { return nullptr; }), true);
164 token.addFunc("time", [](OceanGpuFrameToken* self) { return static_cast<float>(self->time()); });
188 auto render = table.addClass<Renderer>("OceanRenderer", std::function<Renderer*()>([] { return nullptr; }), true);
195 "OceanHullMaskPublication", std::function<HullMaskScriptPublication*()>([] { return nullptr; }), true);
203 render.addFunc("draw", [vm](Renderer* self) { return script::projectResult(vm, self->value->draw()); });
204 render.addFunc("frameBuilder", [vm](Renderer* self, ssq::Object frame, ssq::Object wake, ssq::Object placement) {
207 if (!frame.to<OceanSpectrumFrame*>()) return script::projectStatusResult(vm, invalid("Missing spectral frame"));
212 render.addFunc("gpuFrameBuilder", [vm](Renderer* self, GpuOcean* source, OceanGpuFrameToken* token,
214 if (!source || !token) return script::projectStatusResult(vm, invalid("Missing GPU projection/token"));
223 publication.addFunc("publish", [vm](Publication* self) { return script::projectResult(vm, publish(*self)); });
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.cpp:19
Opaque revision of a completed GPU ocean; copying does not extend resource lifetime.
Definition OceanGpuSpectrum.h:22
Prepare GPU allocation from an owning immutable spectrum lease; providers borrowed through build().
Definition OceanGpuSpectrum.h:90
EVENGINE_API_DOMAINS Result< std::unique_ptr< OceanGpuSpectrum > > build() const
Allocate compiled pipelines and band buffers; Unsupported explicitly selects a caller-chosen CPU path...
Definition OceanGpuSpectrum.cpp:79
Synchronous borrowed geometry preparation, with no provider dependency.
Definition OceanHullMask.h:50
EVENGINE_API_DOMAINS Result< OceanHullMaskFrame > build() const
Validate the entire batch then return its owning render projection.
Definition OceanHullMask.cpp:13
Prepare renderer quality; borrows Graphics only until build returns.
Definition OceanRenderer.h:60
Immutable spatial projection at one simulation timestamp, independent of its spectrum owner....
Definition OceanSpectrum.h:61
Immutable initial spectrum; data is shared only with owning frame builders.
Definition OceanSpectrum.h:96
Caller-owned wave field with finite-depth gravity dispersion and absorbing boundaries....
Definition OceanWake.h:53
GPGPU module — compute shaders + storage buffers via the active Graphics backend. Uses the graphics q...
Definition Gpgpu.h:23
Definition Graphics.h:134
std::variant< std::monostate, std::int64_t, double, std::string, bool > Value
Definition Database.h:27
void keys(const Value &value, std::initializer_list< const char * > names)
Definition OceanCodecInternal.h:8
glm::dvec2 vector(const Value &value)
Definition OceanCodecInternal.h:31
glm::dvec3 vector3(const Value &value)
Definition OceanCodecInternal.h:36
const Value & field(const Value &value, const char *name)
Borrow a required child of value; throws on a missing field.
Definition OceanCodecInternal.h:20
ssq::Table ownedResult(HSQUIRRELVM vm, Result< T > result)
Definition OceanBindingInternal.h:16
Result< FixedTime > fixedTime(SQInteger tick, SQInteger rate)
Definition OceanBindingInternal.h:27
Status invalid(const char *message)
Definition OceanBindingInternal.h:21
OceanRenderBackend
Explicit projection backend; GPU mode never silently substitutes CPU vertex uploads.
Definition OceanRenderer.h:20
@ CpuReference
@ GpuResident
EVENGINE_API_DOMAINS void exposeOceanRenderTypes(ssq::Table &table)
Register owning render projections on the VM/render thread; table is borrowed only during registratio...
Definition OceanRenderBindings.cpp:138
Result< int > publish(Heightmap &target, std::vector< float > candidate)
Publish.
Definition TerrainRasterInternal.h:62
ssq::Table projectStatusResult(HSQUIRRELVM vm, const Status &status)
Project a checked native status that carries no payload.
Definition SquirrelBinding.cpp:524
ssq::Table projectResult(HSQUIRRELVM vm, Result< void > &&result)
Consume and project a void native Result using the common schema.
Definition SquirrelBinding.cpp:540
Result< Value > valueFromSquirrel(HSQUIRRELVM vm, SQInteger index, const SquirrelValueOptions &options)
Convert one Squirrel value into the canonical owning Value tree.
Definition SquirrelBinding.cpp:412