载入中...
搜索中...
未找到
eve::procgen::TerrainGenerationSession类 参考

Owned in-memory terrain operation session; records native stamps, scalar effects and erosion. Owns baseline, current terrain, sediment, water and immutable copies of operation inputs. No borrowed raster, scene object, script callback or GPU resource survives a call. Replays use the same CPU kernels and inputs in order; determinism is same-build floating arithmetic. All access is serialized by the caller on its owning thread. History mutations and terrain, sediment and all water channels publish together after successful evaluation; allocation failure preserves all state. Snapshots are copies, never a second writable view of the authoritative terrain. Versioned snapshots retain the baseline, every owned command, enabled flags, cursor and access policy. Asynchronous worker tickets and a generic gameplay object model are not introduced. 更多...

#include <TerrainGenerationSession.h>

类

struct  Command
 
struct  Impl
 

Public 成员函数

 TerrainGenerationSession ()
 Construct an empty editable session.
 
 ~TerrainGenerationSession ()
 Destroy owned terrain and command snapshots.
 
 TerrainGenerationSession (TerrainGenerationSession &&) noexcept
 Transfer state; moved-from session is empty and resettable.
 
TerrainGenerationSession & operator= (TerrainGenerationSession &&) noexcept
 Transfer state and release previously owned snapshots.
 
 TerrainGenerationSession (const TerrainGenerationSession &)=delete
 One mutable owner; implicit copies are prohibited.
 
TerrainGenerationSession & operator= (const TerrainGenerationSession &)=delete
 One mutable owner; implicit copies are prohibited.
 
Result< int > reset (const Heightmap &baseline)
 Copy a finite baseline, zero sediment/water and clear history atomically; locked sessions reject reset.
 
Result< int > stamp (const Heightmap &stamp, const TerrainStampSettings &settings, const Heightmap &localMask, const Heightmap &globalMask)
 Append an owned stamp command, truncating redo only on success; locked sessions reject it.
 
Result< int > contrast (const Heightmap &mask, float strength, float featureSize)
 Record nine-tap contrast; copies all borrowed inputs and values.
 
Result< int > smooth (const Heightmap &mask, const TerrainSmoothSettings &settings)
 Record two-pass smoothing; copies all borrowed inputs and values.
 
Result< int > ridges (const Heightmap &mask, const TerrainRidgeSettings &settings)
 Record ridge iteration; copies all borrowed inputs and values.
 
Result< int > terrace (const Heightmap &mask, const TerrainTerraceSettings &settings)
 Record terracing; copies all borrowed inputs and values.
 
Result< int > power (const Heightmap &mask, float power)
 Record power transform; copies all borrowed inputs and values.
 
Result< int > heightCurve (const Heightmap &mask, const Heightmap &curve, float minimum, float maximum)
 Record height-curve transform; copies all borrowed inputs and values.
 
Result< int > heightMix (const Heightmap &local, const Heightmap &global, const TerrainHeightMixSettings &settings)
 Record height mixing; copies all borrowed inputs and values.
 
Result< int > resetSimulation (float depth=0)
 Record a simulation reset: zero sediment, flux and velocity; set uniform nonnegative water depth. Terrain is unchanged. Use before hydraulic to start a fresh erosion operation; otherwise erosion continues the preceding simulation state. Reset is undoable and rejects nonfinite/negative depth atomically.
 
Result< int > thermal (const TerrainThermalSettings &settings)
 Record thermal erosion using accumulated sediment; water is preserved. Settings are copied.
 
Result< int > hydraulic (const TerrainWaterSettings &water, const TerrainSedimentSettings &sediment, const TerrainThermalSettings &thermal, int iterations)
 Record complete water/sediment/thermal iterations using preceding simulation state. Settings and explicit iteration count are copied; no implicit reset, clock or UI unit conversion.
 
Result< int > copySediment (Heightmap &output) const
 Copy signed current sediment into a matching finite output, including while locked.
 
Result< int > exportWater (Heightmap &output, TerrainWaterChannel channel) const
 Copy a raw water channel into a matching finite output, including while locked.
 
Result< int > replay ()
 Re-evaluate the applied history prefix from baseline atomically; locked sessions reject it.
 
Result< TerrainSessionRunStatus > beginReplay ()
 Start replaying the applied history into a private candidate without changing current terrain.
 
Result< TerrainSessionRunStatus > stepReplay (int maxOperations)
 Execute at most maxOperations commands and publish once when the candidate completes.
 
Result< TerrainSessionRunStatus > cancelReplay ()
 Cancel a pending replay and discard its private candidate without changing current terrain.
 
TerrainSessionRunStatus getReplayStatus () const noexcept
 Return the staged replay lifecycle status.
 
int getReplayCompletedOperations () const noexcept
 Return commands visited by the current or most recent staged replay.
 
Result< int > undo ()
 Move the applied prefix back one command and replay; no history returns InvalidArgument.
 
Result< int > redo ()
 Move the applied prefix forward one command and replay; no redo returns InvalidArgument.
 
Result< int > setOperationEnabled (int index, bool enabled)
 Toggle a command and replay the applied prefix atomically; index is history-local, not a stable ID.
 
Result< bool > operationEnabled (int index) const
 Read a command's enabled flag, or InvalidArgument for an out-of-range history index.
 
Result< int > copyTerrain (Heightmap &output) const
 Copy current terrain into an existing matching finite output; allowed while locked.
 
Result< void > setAccess (TerrainSessionAccess access)
 Change only the edit policy; unlocking is always permitted, invalid enum values are rejected.
 
TerrainSessionAccess getAccess () const noexcept
 Read current edit policy; moved-from sessions are editable.
 
int getOperationCount () const noexcept
 Count all recorded commands, including the redo suffix.
 
int getAppliedCount () const noexcept
 Count commands in the applied prefix, including disabled commands.
 
Result< std::string > snapshotJson () const
 Serialize schema version 1 with the complete replayable operation history.
 
Result< void > restoreJson (const std::string &json)
 Atomically restore schema version 1 and rebuild the applied prefix before publication.
 

详细描述

Owned in-memory terrain operation session; records native stamps, scalar effects and erosion. Owns baseline, current terrain, sediment, water and immutable copies of operation inputs. No borrowed raster, scene object, script callback or GPU resource survives a call. Replays use the same CPU kernels and inputs in order; determinism is same-build floating arithmetic. All access is serialized by the caller on its owning thread. History mutations and terrain, sediment and all water channels publish together after successful evaluation; allocation failure preserves all state. Snapshots are copies, never a second writable view of the authoritative terrain. Versioned snapshots retain the baseline, every owned command, enabled flags, cursor and access policy. Asynchronous worker tickets and a generic gameplay object model are not introduced.

在文件 TerrainGenerationSession.h 第 32 行定义.

构造及析构函数说明

◆ TerrainGenerationSession() [1/3]

eve::procgen::TerrainGenerationSession::TerrainGenerationSession ( )
default

Construct an empty editable session.

◆ ~TerrainGenerationSession()

eve::procgen::TerrainGenerationSession::~TerrainGenerationSession ( )
default

Destroy owned terrain and command snapshots.

◆ TerrainGenerationSession() [2/3]

eve::procgen::TerrainGenerationSession::TerrainGenerationSession ( TerrainGenerationSession &&  )
defaultnoexcept

Transfer state; moved-from session is empty and resettable.

◆ TerrainGenerationSession() [3/3]

eve::procgen::TerrainGenerationSession::TerrainGenerationSession ( const TerrainGenerationSession &  )
delete

One mutable owner; implicit copies are prohibited.

成员函数说明

◆ beginReplay()

Result< TerrainSessionRunStatus > eve::procgen::TerrainGenerationSession::beginReplay ( )

Start replaying the applied history into a private candidate without changing current terrain.

在文件 TerrainGenerationSession.cpp 第 365 行定义.

引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::procgen::Pending , 以及 eve::Result< T >::success().

◆ cancelReplay()

Result< TerrainSessionRunStatus > eve::procgen::TerrainGenerationSession::cancelReplay ( )

Cancel a pending replay and discard its private candidate without changing current terrain.

在文件 TerrainGenerationSession.cpp 第 408 行定义.

引用了 eve::procgen::Cancelled, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::procgen::Pending , 以及 eve::Result< T >::success().

◆ contrast()

Result< int > eve::procgen::TerrainGenerationSession::contrast ( const Heightmap &  mask,
float  strength,
float  featureSize 
)

Record nine-tap contrast; copies all borrowed inputs and values.

返回
Changed terrain sample count; invalid inputs/locked session leave terrain and history unchanged.

在文件 TerrainGenerationSession.cpp 第 306 行定义.

引用了 featureSize, mask , 以及 strength.

◆ copySediment()

Result< int > eve::procgen::TerrainGenerationSession::copySediment ( Heightmap &  output) const

Copy signed current sediment into a matching finite output, including while locked.

返回
Changed output sample count or InvalidArgument; failure preserves output.

在文件 TerrainGenerationSession.cpp 第 340 行定义.

引用了 eve::procgen::raster_detail::invalid(), output, eve::procgen::raster_detail::publish() , 以及 eve::procgen::raster_detail::validRaster().

◆ copyTerrain()

Result< int > eve::procgen::TerrainGenerationSession::copyTerrain ( Heightmap &  output) const

Copy current terrain into an existing matching finite output; allowed while locked.

返回
Changed output sample count or InvalidArgument; failure leaves output unchanged.

在文件 TerrainGenerationSession.cpp 第 437 行定义.

引用了 eve::procgen::raster_detail::invalid(), output, eve::procgen::raster_detail::publish() , 以及 eve::procgen::raster_detail::validRaster().

◆ exportWater()

Result< int > eve::procgen::TerrainGenerationSession::exportWater ( Heightmap &  output,
TerrainWaterChannel  channel 
) const

Copy a raw water channel into a matching finite output, including while locked.

返回
Changed output sample count or InvalidArgument; no mutable simulation view is exposed.

在文件 TerrainGenerationSession.cpp 第 346 行定义.

引用了 eve::procgen::raster_detail::invalid() , 以及 output.

◆ getAccess()

TerrainSessionAccess eve::procgen::TerrainGenerationSession::getAccess ( ) const
noexcept

Read current edit policy; moved-from sessions are editable.

在文件 TerrainGenerationSession.cpp 第 254 行定义.

引用了 eve::procgen::Editable.

被这些函数引用 reset().

◆ getAppliedCount()

int eve::procgen::TerrainGenerationSession::getAppliedCount ( ) const
noexcept

Count commands in the applied prefix, including disabled commands.

在文件 TerrainGenerationSession.cpp 第 264 行定义.

◆ getOperationCount()

int eve::procgen::TerrainGenerationSession::getOperationCount ( ) const
noexcept

Count all recorded commands, including the redo suffix.

在文件 TerrainGenerationSession.cpp 第 263 行定义.

◆ getReplayCompletedOperations()

int eve::procgen::TerrainGenerationSession::getReplayCompletedOperations ( ) const
noexcept

Return commands visited by the current or most recent staged replay.

在文件 TerrainGenerationSession.cpp 第 260 行定义.

◆ getReplayStatus()

TerrainSessionRunStatus eve::procgen::TerrainGenerationSession::getReplayStatus ( ) const
noexcept

Return the staged replay lifecycle status.

在文件 TerrainGenerationSession.cpp 第 257 行定义.

引用了 eve::procgen::Idle.

◆ heightCurve()

Result< int > eve::procgen::TerrainGenerationSession::heightCurve ( const Heightmap &  mask,
const Heightmap &  curve,
float  minimum,
float  maximum 
)

Record height-curve transform; copies all borrowed inputs and values.

返回
Changed terrain sample count; invalid inputs/locked session leave terrain and history unchanged.

在文件 TerrainGenerationSession.cpp 第 321 行定义.

引用了 curve, mask, maximum , 以及 minimum.

◆ heightMix()

Result< int > eve::procgen::TerrainGenerationSession::heightMix ( const Heightmap &  local,
const Heightmap &  global,
const TerrainHeightMixSettings &  settings 
)

Record height mixing; copies all borrowed inputs and values.

返回
Changed terrain sample count; invalid inputs/locked session leave terrain and history unchanged.

在文件 TerrainGenerationSession.cpp 第 325 行定义.

引用了 global, local , 以及 settings.

◆ hydraulic()

Result< int > eve::procgen::TerrainGenerationSession::hydraulic ( const TerrainWaterSettings &  water,
const TerrainSedimentSettings &  sediment,
const TerrainThermalSettings &  thermal,
int  iterations 
)

Record complete water/sediment/thermal iterations using preceding simulation state. Settings and explicit iteration count are copied; no implicit reset, clock or UI unit conversion.

返回
Changed terrain sample count or InvalidArgument; failure preserves every channel and history.

在文件 TerrainGenerationSession.cpp 第 335 行定义.

引用了 iterations, sediment, thermal , 以及 water.

◆ operationEnabled()

Result< bool > eve::procgen::TerrainGenerationSession::operationEnabled ( int  index) const

Read a command's enabled flag, or InvalidArgument for an out-of-range history index.

在文件 TerrainGenerationSession.cpp 第 431 行定义.

引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), index, eve::InvalidArgument , 以及 eve::Result< T >::success().

◆ operator=() [1/2]

TerrainGenerationSession & eve::procgen::TerrainGenerationSession::operator= ( const TerrainGenerationSession &  )
delete

One mutable owner; implicit copies are prohibited.

◆ operator=() [2/2]

TerrainGenerationSession & eve::procgen::TerrainGenerationSession::operator= ( TerrainGenerationSession &&  )
defaultnoexcept

Transfer state and release previously owned snapshots.

◆ power()

Result< int > eve::procgen::TerrainGenerationSession::power ( const Heightmap &  mask,
float  power 
)

Record power transform; copies all borrowed inputs and values.

返回
Changed terrain sample count; invalid inputs/locked session leave terrain and history unchanged.

在文件 TerrainGenerationSession.cpp 第 318 行定义.

引用了 mask , 以及 power.

◆ redo()

Result< int > eve::procgen::TerrainGenerationSession::redo ( )

Move the applied prefix forward one command and replay; no redo returns InvalidArgument.

返回
Changed terrain sample count, atomically; locked sessions reject it.

在文件 TerrainGenerationSession.cpp 第 417 行定义.

◆ replay()

Result< int > eve::procgen::TerrainGenerationSession::replay ( )

Re-evaluate the applied history prefix from baseline atomically; locked sessions reject it.

返回
Changed terrain sample count or InvalidArgument.

在文件 TerrainGenerationSession.cpp 第 364 行定义.

◆ reset()

Result< int > eve::procgen::TerrainGenerationSession::reset ( const Heightmap &  baseline)

Copy a finite baseline, zero sediment/water and clear history atomically; locked sessions reject reset.

返回
Baseline sample count or InvalidArgument.

在文件 TerrainGenerationSession.cpp 第 276 行定义.

引用了 eve::procgen::Heightmap::data(), getAccess(), eve::procgen::raster_detail::invalid(), eve::procgen::Locked, eve::Result< T >::success() , 以及 eve::procgen::raster_detail::validRaster().

◆ resetSimulation()

Result< int > eve::procgen::TerrainGenerationSession::resetSimulation ( float  depth = 0)

Record a simulation reset: zero sediment, flux and velocity; set uniform nonnegative water depth. Terrain is unchanged. Use before hydraulic to start a fresh erosion operation; otherwise erosion continues the preceding simulation state. Reset is undoable and rejects nonfinite/negative depth atomically.

返回
Changed terrain sample count (zero), or InvalidArgument; locked sessions reject it.

在文件 TerrainGenerationSession.cpp 第 329 行定义.

引用了 depth.

◆ restoreJson()

Result< void > eve::procgen::TerrainGenerationSession::restoreJson ( const std::string &  json)

◆ ridges()

Result< int > eve::procgen::TerrainGenerationSession::ridges ( const Heightmap &  mask,
const TerrainRidgeSettings &  settings 
)

Record ridge iteration; copies all borrowed inputs and values.

返回
Changed terrain sample count; invalid inputs/locked session leave terrain and history unchanged.

在文件 TerrainGenerationSession.cpp 第 312 行定义.

引用了 mask , 以及 settings.

◆ setAccess()

Result< void > eve::procgen::TerrainGenerationSession::setAccess ( TerrainSessionAccess  access)

Change only the edit policy; unlocking is always permitted, invalid enum values are rejected.

在文件 TerrainGenerationSession.cpp 第 265 行定义.

引用了 eve::procgen::Editable, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::procgen::Locked, eve::procgen::Pending , 以及 eve::Result< T >::success().

◆ setOperationEnabled()

Result< int > eve::procgen::TerrainGenerationSession::setOperationEnabled ( int  index,
bool  enabled 
)

Toggle a command and replay the applied prefix atomically; index is history-local, not a stable ID.

返回
Changed terrain sample count or InvalidArgument; locked sessions reject it.

在文件 TerrainGenerationSession.cpp 第 418 行定义.

引用了 enabled, eve::procgen::Idle, index , 以及 eve::procgen::raster_detail::invalid().

◆ smooth()

Result< int > eve::procgen::TerrainGenerationSession::smooth ( const Heightmap &  mask,
const TerrainSmoothSettings &  settings 
)

Record two-pass smoothing; copies all borrowed inputs and values.

返回
Changed terrain sample count; invalid inputs/locked session leave terrain and history unchanged.

在文件 TerrainGenerationSession.cpp 第 309 行定义.

引用了 mask , 以及 settings.

◆ snapshotJson()

Result< std::string > eve::procgen::TerrainGenerationSession::snapshotJson ( ) const

Serialize schema version 1 with the complete replayable operation history.

在文件 TerrainGenerationSession.cpp 第 444 行定义.

引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::procgen::Pending, root, value , 以及 eve::procgen::Value.

◆ stamp()

Result< int > eve::procgen::TerrainGenerationSession::stamp ( const Heightmap &  stamp,
const TerrainStampSettings &  settings,
const Heightmap &  localMask,
const Heightmap &  globalMask 
)

Append an owned stamp command, truncating redo only on success; locked sessions reject it.

参数
stampBorrowed stamp raster, copied into history.
settingsValue settings captured for replay.
localMaskBorrowed local mask, copied into history.
globalMaskBorrowed global mask, copied into history.
返回
Changed terrain sample count or InvalidArgument; failed commands are never recorded.

在文件 TerrainGenerationSession.cpp 第 286 行定义.

引用了 global, local, settings , 以及 stamp.

◆ stepReplay()

Result< TerrainSessionRunStatus > eve::procgen::TerrainGenerationSession::stepReplay ( int  maxOperations)

Execute at most maxOperations commands and publish once when the candidate completes.

在文件 TerrainGenerationSession.cpp 第 380 行定义.

引用了 eve::procgen::Completed, eve::Diagnostic::error(), eve::procgen::Failed, eve::Result< T >::failure(), eve::InvalidArgument, operation, eve::procgen::Pending , 以及 eve::Result< T >::success().

◆ terrace()

Result< int > eve::procgen::TerrainGenerationSession::terrace ( const Heightmap &  mask,
const TerrainTerraceSettings &  settings 
)

Record terracing; copies all borrowed inputs and values.

返回
Changed terrain sample count; invalid inputs/locked session leave terrain and history unchanged.

在文件 TerrainGenerationSession.cpp 第 315 行定义.

引用了 mask , 以及 settings.

◆ thermal()

Result< int > eve::procgen::TerrainGenerationSession::thermal ( const TerrainThermalSettings &  settings)

Record thermal erosion using accumulated sediment; water is preserved. Settings are copied.

返回
Changed terrain sample count or InvalidArgument; all generated state and history publish atomically.

在文件 TerrainGenerationSession.cpp 第 332 行定义.

引用了 settings.

◆ undo()

Result< int > eve::procgen::TerrainGenerationSession::undo ( )

Move the applied prefix back one command and replay; no history returns InvalidArgument.

返回
Changed terrain sample count, atomically; locked sessions reject it.

在文件 TerrainGenerationSession.cpp 第 416 行定义.


该类的文档由以下文件生成: