载入中...
搜索中...
未找到
RuntimeGenerationScript.cpp
浏览该文件的文档.
22 "ProcgenCellRequest", std::function<ProcgenCellRequest*()>([]() -> ProcgenCellRequest* { return nullptr; }),
35 "ProcgenRuntimeGeneration", std::function<RuntimeGeneration*()>([]() -> RuntimeGeneration* { return nullptr; }),
41 runtimeGeneration.addFunc("getLevelGenerationRadius", &RuntimeGeneration::getLevelGenerationRadius);
56 runtimeGeneration.addFunc("setMaxGenerationRetries", &RuntimeGeneration::setMaxGenerationRetries);
57 runtimeGeneration.addFunc("getMaxGenerationRetries", &RuntimeGeneration::getMaxGenerationRetries);
64 runtimeGeneration.addFunc("getCommittedRefreshRevision", &RuntimeGeneration::getCommittedRefreshRevision);
79 runtimeGeneration.addFunc("getGenerationSourceCount", &RuntimeGeneration::getGenerationSourceCount);
81 runtimeGeneration.addFunc("refreshGenerationSources", &RuntimeGeneration::refreshGenerationSources);
83 runtimeGeneration.addFunc("isFrustumCullingEnabled", &RuntimeGeneration::isFrustumCullingEnabled);
86 runtimeGeneration.addFunc("getPendingGenerateCount", &RuntimeGeneration::getPendingGenerateCount);
90 runtimeGeneration.addFunc("getCancelledGenerationCount", &RuntimeGeneration::getCancelledGenerationCount);
94 runtimeGeneration.addFunc("nextGenerationJob", [vm = runtimeGeneration.getHandle()](RuntimeGeneration* self) {
96 eve::script::makeOwnedSquirrelInstance<ProcgenGenerationJob>(vm, std::make_unique<ProcgenGenerationJob>());
108 [vm = runtimeGeneration.getHandle()](RuntimeGeneration* self, ProcgenGenerationJob* job, PointSet* output) {
118 "failGenerationJob", [vm = runtimeGeneration.getHandle()](RuntimeGeneration* self, ProcgenGenerationJob* job) {
124 runtimeGeneration.addFunc("nextCleanupRequest", [vm = runtimeGeneration.getHandle()](RuntimeGeneration* self) {
127 eve::script::makeOwnedSquirrelInstance<ProcgenCellRequest>(vm, std::make_unique<ProcgenCellRequest>());
151 runtimeGeneration.addFunc("completeCleanupsAtomic", [vm = runtimeGeneration.getHandle()](RuntimeGeneration* value,
169 "applyCellUpdate", [vm = runtimeGeneration.getHandle()](RuntimeGeneration* value, int level, int x, int z,
174 if (!output || error != std::errc{} || end != revisionText.data() + revisionText.size() || revision == 0)
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 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
One immutable runtime-generation cell request returned to script.
Definition RuntimeGeneration.h:17
uint64_t getTicket() const
Unique scheduler ticket used to reject stale asynchronous completions.
Definition RuntimeGeneration.cpp:38
Copyable generation input issued by one RuntimeGeneration scheduler.
Definition RuntimeGeneration.h:55
float getMaxZ() const
Return the captured upper world-space Z bound.
Definition RuntimeGeneration.cpp:52
float getMaxX() const
Return the captured upper world-space X bound.
Definition RuntimeGeneration.cpp:51
uint32_t getSeed() const
Return the deterministic seed derived from world seed, level and coordinates.
Definition RuntimeGeneration.cpp:47
float getMinX() const
Return the captured lower world-space X bound.
Definition RuntimeGeneration.cpp:49
float getMinZ() const
Return the captured lower world-space Z bound.
Definition RuntimeGeneration.cpp:50
uint64_t getTicket() const
Return the ticket; valid only together with this job's private scheduler identity.
Definition RuntimeGeneration.cpp:48
int getZ() const
Return the cell Z coordinate captured at issue time.
Definition RuntimeGeneration.cpp:46
int getX() const
Return the cell X coordinate captured at issue time.
Definition RuntimeGeneration.cpp:45
int getLevel() const
Return the hierarchical grid level captured at issue time.
Definition RuntimeGeneration.cpp:44
View-driven partition and hierarchical procedural generation scheduler.
Definition RuntimeGeneration.h:115
void setMaxPointsPerCell(int count)
Set the maximum points allowed in one generated cell; zero disables the limit.
Definition RuntimeGeneration.cpp:107
bool completeGeneration(ProcgenCellRequest *request, PointSet *output)
Compatibility-only bool projection of completeGenerationJob; request and output are borrowed.
Definition RuntimeGeneration.cpp:555
bool isFrustumCullingEnabled() const
True when frustum culling enabled.
Definition RuntimeGeneration.cpp:228
bool deserializeCell(const std::string &definition)
Atomically restore one cell produced by serializeCell for this world seed.
Definition RuntimeGenerationAsset.cpp:67
float getFrustumBehindRadius() const
Returns the frustum behind radius.
Definition RuntimeGeneration.cpp:230
int getPendingGenerateCount() const
Returns the pending generate count.
Definition RuntimeGeneration.cpp:397
int trimToResidentPoints(int target)
Schedule lowest-priority active cells for cleanup until at most target points remain.
Definition RuntimeGeneration.cpp:120
bool isRequestCurrent(const ProcgenCellRequest *request) const
Test whether an issued generation or cleanup request still owns its scheduler ticket.
Definition RuntimeGeneration.cpp:546
void beginFrame()
Start a new budget window before consuming generation requests.
Definition RuntimeGeneration.cpp:160
float getLevelCellSize(int level) const
Returns the level cell size.
Definition RuntimeGeneration.cpp:87
int addLevel(float cellSize, float generationRadius, float cleanupMultiplier)
Add a hierarchical grid level.
Definition RuntimeGeneration.cpp:80
int getCancelledGenerationCount() const
Return issued generation requests invalidated before completion.
Definition RuntimeGeneration.cpp:401
float getLevelCleanupRadius(int level) const
Returns the level cleanup radius.
Definition RuntimeGeneration.cpp:95
bool hasCell(int level, int x, int z) const
Definition RuntimeGeneration.cpp:627
int getPendingCleanupCount() const
Returns the pending cleanup count.
Definition RuntimeGeneration.cpp:400
void setFrustumCulling(bool enabled, float halfAngleDegrees, float behindRadius)
Enable view-cone scheduling.
Definition RuntimeGeneration.cpp:221
std::string serializeCell(int level, int x, int z) const
Serialize one active cell cache entry in a deterministic versioned format.
Definition RuntimeGenerationAsset.cpp:11
int getMaxGenerationRetries() const
Return retries allowed after the initial generation attempt.
Definition RuntimeGeneration.cpp:155
uint64_t getCommittedRefreshRevision() const
Return the latest source revision atomically published into generation and cleanup queues.
Definition RuntimeGeneration.cpp:172
bool isRefreshPending() const
Return whether a staged source snapshot still needs planning work.
Definition RuntimeGeneration.cpp:171
uint64_t getCellRevision(int level, int x, int z) const
Returns the cell revision.
Definition RuntimeGeneration.cpp:639
void setFrameTimeBudget(float milliseconds)
CPU issue budget in milliseconds for one frame; zero disables the limit.
Definition RuntimeGeneration.cpp:156
bool failGeneration(ProcgenCellRequest *request)
Compatibility-only bool projection of failGenerationJob; request is borrowed.
Definition RuntimeGeneration.cpp:569
int getRefreshWorkBudget() const
Return the per-call source-refresh candidate budget, or zero when synchronous.
Definition RuntimeGeneration.cpp:170
ProcgenCellRequest * nextGenerate()
Compatibility facade returning a heap request; prefer nextGenerationJob().
Definition RuntimeGeneration.cpp:422
int getMaxResidentPoints() const
Return the total resident-point limit, or zero when unlimited.
Definition RuntimeGeneration.cpp:112
bool removeGenerationSource(const std::string &id)
Removes generation source.
Definition RuntimeGeneration.cpp:201
int getGenerationSourceCount() const
Returns the generation source count.
Definition RuntimeGeneration.cpp:215
PointSet * getCellOutput(int level, int x, int z) const
Returns the cell output.
Definition RuntimeGeneration.cpp:632
float getLevelGenerationRadius(int level) const
Returns the level generation radius.
Definition RuntimeGeneration.cpp:90
int getFailedCellCount() const
Return cells stopped after exhausting the generation retry policy.
Definition RuntimeGeneration.cpp:402
int retryFailedCells()
Reset and requeue all terminally failed cells still tracked by the scheduler.
Definition RuntimeGeneration.cpp:408
float getFrustumHalfAngle() const
Returns the frustum half angle.
Definition RuntimeGeneration.cpp:229
PointDelta * getCellDelta(int level, int x, int z) const
Return a caller-owned copy of the latest committed delta, or null when unavailable....
Definition RuntimeGeneration.cpp:698
bool setGenerationSource(const std::string &id, float x, float z, float directionX, float directionZ, float radiusScale=1.f)
Add or update a named generation source, then rebuild desired cells.
Definition RuntimeGeneration.cpp:184
void updateSource(float x, float z, float directionX, float directionZ)
Recompute desired cells for a generation source.
Definition RuntimeGeneration.cpp:180
std::string getGenerationSourceId(int index) const
Returns the generation source id.
Definition RuntimeGeneration.cpp:216
bool completeCleanup(ProcgenCellRequest *request)
Compatibility-only bool projection of completeCleanupsAtomic; request is borrowed.
Definition RuntimeGeneration.cpp:583
void setMaxGenerating(int count)
Maximum simultaneously issued generation requests.
Definition RuntimeGeneration.cpp:103
void setMaxActiveCells(int count)
Maximum active plus in-flight cells; zero disables the resident-cell limit.
Definition RuntimeGeneration.cpp:105
void setMaxGenerationRetries(int count)
Set retries after the initial generation attempt; zero fails immediately.
Definition RuntimeGeneration.cpp:152
int getMaxPointsPerCell() const
Return the per-cell point limit, or zero when unlimited.
Definition RuntimeGeneration.cpp:108
int getRejectedOutputCount() const
Return generation or restore outputs rejected by point budgets.
Definition RuntimeGeneration.cpp:119
void setDirectionWeight(float weight)
Weight favoring cells in front of the source, clamped to [0,1].
Definition RuntimeGeneration.cpp:99
int getResidentPointCount() const
Return points retained by active or not-yet-acknowledged cleanup cells.
Definition RuntimeGeneration.cpp:113
ProcgenCellRequest * nextCleanup()
Compatibility-only heap projection of nextCleanupRequest; caller owns the returned request.
Definition RuntimeGeneration.cpp:520
void setRefreshWorkBudget(int candidateCells)
Limit source-refresh planning work performed by one call.
Definition RuntimeGeneration.cpp:166
void refreshGenerationSources()
Re-evaluate generation/cleanup queues from every registered source.
Definition RuntimeGeneration.cpp:232
int getMaxActiveCells() const
Return the resident-cell limit, or zero when unlimited.
Definition RuntimeGeneration.cpp:106
void clear()
Remove levels, cells, queues and outputs while retaining the world seed.
Definition RuntimeGeneration.cpp:64
void setMaxResidentPoints(int count)
Set the total point limit across active cell outputs; zero disables the limit.
Definition RuntimeGeneration.cpp:109
@ PointSet
Definition EvpackPointGraphLoader.h:12
void exposeRuntimeGeneration(ssq::Table &table)
Register owner-thread runtime-generation script interfaces.
Definition RuntimeGenerationScript.cpp:9
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
@ InvalidArgument
Definition Container.h:602