载入中...
搜索中...
未找到
HeightmapTargetModule.cpp
浏览该文件的文档.
30int HeightmapTargetModule::applyBrush(procgen::Heightmap* heightmap, float centerX, float centerY, float radius,
32 auto result = procgen_editing::applyHeightmapBrush(heightmap, centerX, centerY, radius, strength);
36graphics::Mesh* HeightmapTargetModule::newMesh(procgen::Heightmap* heightmap, float cellSize, float heightScale) const {
37 auto result = procgen_graphics_editing::createHeightmapMesh(heightmap, cellSize, heightScale, false);
43 return procgen_graphics_editing::updateHeightmapMesh(mesh, graphics, heightmap, cellSize, heightScale, false).ok();
46graphics::Mesh* HeightmapTargetModule::newSmoothMesh(procgen::Heightmap* heightmap, float cellSize,
48 auto result = procgen_graphics_editing::createHeightmapMesh(heightmap, cellSize, heightScale, true);
54 return procgen_graphics_editing::updateHeightmapMesh(mesh, graphics, heightmap, cellSize, heightScale, true).ok();
57Result<std::string> HeightmapTargetModule::encodeDocument(const procgen::Heightmap* heightmap, float spacingX,
68Result<void> HeightmapTargetModule::decodeDocument(std::string_view json, procgen::Heightmap* heightmap) const {
105 cls.addFunc("create", [](HeightmapTargetModule* self, const std::string& id, procgen::Heightmap* heightmap) {
114 cls.addFunc("encodeDocument", [vm = cls.getHandle()](HeightmapTargetModule* self, procgen::Heightmap* heightmap,
The single Squirrel projection for common Result, Status and Value.
Versioned editor persistence for editable heightfields.
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
Hosts interchangeable editor tools and routes their lifecycle/input.
Definition EditorSession.h:30
Definition Graphics.h:125
Script-facing composition module for live heightmap editing targets.
Definition HeightmapTargetModule.h:28
int applyBrush(procgen::Heightmap *heightmap, float centerX, float centerY, float radius, float strength) const
Compatibility projection of the canonical structured brush result for scripts.
Definition HeightmapTargetModule.cpp:30
std::unique_ptr< procgen_editing::HeightmapTarget > newTarget(std::string id, procgen::Heightmap *heightmap) const
Create an independently owned adapter over a borrowed heightmap.
Definition HeightmapTargetModule.cpp:21
Result< std::string > encodeDocument(const procgen::Heightmap *heightmap, float spacingX, float spacingZ) const
Encode an editable heightmap as the versioned terrain editor JSON document.
Definition HeightmapTargetModule.cpp:57
void bind(editor::EditorSession *session, procgen_editing::HeightmapTarget *target) const
Bind borrowed target and session objects without taking ownership. @thread Owner-thread only.
Definition HeightmapTargetModule.cpp:26
Result< void > decodeDocument(std::string_view json, procgen::Heightmap *heightmap) const
Atomically replace a heightmap from a validated terrain editor JSON document.
Definition HeightmapTargetModule.cpp:68
bool updateSmoothMesh(graphics::Mesh *mesh, graphics::Graphics *graphics, procgen::Heightmap *heightmap, float cellSize, float heightScale) const
Compatibility projection that updates a smooth-normal preview mesh. @thread Render-thread only.
Definition HeightmapTargetModule.cpp:52
graphics::Mesh * newSmoothMesh(procgen::Heightmap *heightmap, float cellSize, float heightScale) const
Compatibility projection that creates a smooth-normal preview mesh. @thread Render-thread only.
Definition HeightmapTargetModule.cpp:46
graphics::Mesh * newMesh(procgen::Heightmap *heightmap, float cellSize, float heightScale) const
Compatibility projection that creates a flat-shaded preview mesh. @thread Render-thread only.
Definition HeightmapTargetModule.cpp:36
bool updateMesh(graphics::Mesh *mesh, graphics::Graphics *graphics, procgen::Heightmap *heightmap, float cellSize, float heightScale) const
Compatibility projection that updates a flat-shaded preview mesh. @thread Render-thread only.
Definition HeightmapTargetModule.cpp:41
In-memory terrain heightmap: a dense float grid (row-major, index = y * width + x) materialized from ...
Definition Heightmap.h:21
Non-owning scalar-field adapter for a live procedural heightmap.
Definition HeightmapTarget.h:17
editing::FieldWriteStatus writeScalar(int x, int y, float value) override
Writes scalar.
Definition HeightmapTarget.cpp:19
editor::Result< TerrainDocumentData > decodeTerrainDocument(const editor::EditorValue &value, const TerrainDocumentLimits &limits)
Validate and atomically decode one terrain editor snapshot.
Definition TerrainDocumentCodec.cpp:73
editor::Result< editor::EditorValue > encodeTerrainDocument(const procgen::Heightmap &heightmap, float spacingX, float spacingZ, const TerrainDocumentLimits &limits)
Encode the current authoritative heightmap as eve.terrain-editor-document/1.
Definition TerrainDocumentCodec.cpp:43
EVENGINE_API_ORCHESTRATION editing::Result< int > applyHeightmapBrush(procgen::Heightmap *heightmap, float centerX, float centerY, float radius, float strength)
Apply the legacy circular brush through the procgen authoring satellite.
Definition HeightmapTarget.cpp:36
std::unique_ptr< HeightmapTarget > createHeightmapTarget(std::string id, procgen::Heightmap *heightmap)
Create a heightmap adapter.
Definition HeightmapTarget.cpp:31
editing::Result< graphics::Mesh * > createHeightmapMesh(procgen::Heightmap *heightmap, float cellSize, float heightScale, bool smoothNormals)
Build a heightmap preview mesh through the linked Graphics module.
Definition HeightmapMesh.cpp:127
editing::Result< void > updateHeightmapMesh(graphics::Mesh *mesh, graphics::Graphics *graphics, procgen::Heightmap *heightmap, float cellSize, float heightScale, bool smoothNormals)
Update preview vertices without replacing the mesh identity.
Definition HeightmapMesh.cpp:150
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