载入中...
搜索中...
未找到
CollapseBakeRecipeBindings.cpp
浏览该文件的文档.
1#include <simplesquirrel/simplesquirrel.hpp>
2#include "CollapseBakeBuildIdentity.h"
6
7namespace eve::physics {
8void exposeCollapseBakeRecipe(ssq::Table& table) {
9 auto recipe = table.addClass<CollapseBakeRecipe>("CollapseBakeRecipe");
10 const auto vm = table.getHandle();
11 recipe.addFunc("producerBuildRevision",
12 [](CollapseBakeRecipe*) { return std::string(EVENGINE_COLLAPSE_PRODUCER_REVISION); });
13 recipe.addFunc("box3DBackendRevision",
14 [](CollapseBakeRecipe*) { return std::string(EVENGINE_COLLAPSE_BOX3D_REVISION); });
15 recipe.addFunc("setProducer", [vm](CollapseBakeRecipe* self, const std::string& revision) {
17 });
18 recipe.addFunc("setBackend", [vm](CollapseBakeRecipe* self, const std::string& revision) {
20 });
21 recipe.addFunc("setParameters", [vm](CollapseBakeRecipe* self, const std::string& bytes) {
23 });
24 recipe.addFunc("setSource", [vm](CollapseBakeRecipe* self, const std::string& name, const std::string& bytes) {
26 });
27 recipe.addFunc("setTiming", [vm](CollapseBakeRecipe* self, float seconds, int stride) {
28 if (stride <= 0)
30 vm, Result<void>::failure(collapse_detail::invalid("sample stride must be positive")));
31 return script::projectResult(vm, self->setTiming(seconds, static_cast<std::uint32_t>(stride)));
32 });
33 recipe.addFunc("setRandomStream", [vm](CollapseBakeRecipe* self, const std::string& name, int seed) {
34 if (seed < 0)
36 vm, Result<void>::failure(collapse_detail::invalid("script RNG seed must be nonnegative")));
37 return script::projectResult(vm, self->setRandomStream(name, static_cast<std::uint64_t>(seed)));
38 });
39 recipe.addFunc("key", [vm](CollapseBakeRecipe* self) {
40 return script::projectResult(vm, self->key(), [](const std::string& key) { return Value::string(key); });
41 });
42}
43} // namespace eve::physics
std::uint64_t revision
HSQUIRRELVM vm
Definition ECS.cpp:38
SQObjectPtr key
Definition ECS.cpp:155
std::string name
Definition ECS.cpp:154
std::uint64_t bytes
BakeRecipe recipe
The single Squirrel projection for common Result, Status and Value.
uint32_t seed
Definition TreeMesh.cpp:276
Move-only operation result carrying either a value or Status.
Definition Result.h:176
Bounded provenance builder for explicit-coordinate baked recordings. @ownership Owns names and conten...
Definition BakeRecipe.h:21
Result< void > setTiming(float stepSeconds, std::uint32_t sampleStride)
Set the actual finite positive simulation step in seconds and positive ticks per captured sample.
Result< std::string > key() const
Compute the noncryptographic cache key of the complete canonical recipe. @cost Linear in bounded meta...
Result< void > setParameters(std::string_view bytes)
Digest complete parameter bytes, including defaults resolved by the producer. @cost Linear in bytes; ...
Result< void > setBackend(std::string_view revision)
Set the explicit backend and its revision; never infer it from the player platform.
Result< void > setSource(std::string_view name, std::string_view bytes)
Insert or replace a named dependency digest; names are stable logical IDs, not absolute paths....
Result< void > setRandomStream(std::string_view name, std::uint64_t seed)
Insert or replace one of at most 64 named RNG seeds. Empty stream sets explicitly mean no RNG.
Result< void > setProducer(std::string_view revision)
Set an explicit algorithm/build revision token; invalid input leaves the builder unchanged.
Diagnostic invalid(const char *message)
Optional physics backend for vehicle mobility and body attach.
Definition Climbing.h:36
EVENGINE_API_DOMAINS void exposeCollapseBakeRecipe(ssq::Table &table)
Register the owning recipe builder and checked script admission methods.
ssq::Table projectResult(HSQUIRRELVM vm, Result< void > &&result)
Consume and project a void native Result using the common schema.