载入中...
搜索中...
未找到
TerrainWorldScript.cpp
浏览该文件的文档.
2#include "common/Capability.h"
4#include "procgen/MeshBuild.h"
6#include "procgen/PointSet.h"
30
41
42#include <functional>
43#include <limits>
44#include <type_traits>
45
46namespace eve::procgen {
47namespace {
48template <class T>
49ResultRef<T> borrowRoadArgument(const ssq::Object& object, const char* path) {
50 if (object.isNull())
52 DiagnosticCode::InvalidArgument, "road terrain argument is required", path, {}, "procgen.squirrel"));
53 if (object.getType() != ssq::Type::INSTANCE || object.getTypeTag() != ssq::detail::stableTypeHash<T*>())
56 std::string("road terrain argument has the wrong instance type: ") + object.getTypeStr(),
57 path, {}, "procgen.squirrel"));
58 auto* value = object.toPtrUnsafe<T*>();
59 if (!value)
61 "road terrain argument has no live native instance", path, {},
62 "procgen.squirrel"));
63 if constexpr (std::is_same_v<T, MeshBuild> || std::is_same_v<T, Heightmap>) {
64 using Ref =
65 std::conditional_t<std::is_same_v<T, MeshBuild>, ProcgenMeshBuildHandleRef, ProcgenHeightmapHandleRef>;
66 if (auto reference = nativeProxyReference<Ref>(value)) {
67 auto* owner = liveProcgen();
68 auto resolved = [&]() -> eve::script::Borrowed<T> {
69 if (!owner) return {};
70 if constexpr (std::is_same_v<T, MeshBuild>)
71 return owner->resolveMeshBuild(*reference);
72 else
73 return owner->resolveHeightmap(*reference);
74 }();
75 if (!resolved.isBound() || resolved.get() != value)
77 "road terrain argument owner or generation is stale",
78 path, {}, "procgen.squirrel"));
79 }
80 }
81 return ResultRef<T>::success(std::ref(*value));
82}
83Result<int> missingRaster() {
85 Diagnostic::error(DiagnosticCode::InvalidArgument, "terrain operation requires non-null rasters and settings"));
86}
87} // namespace
88void exposeTerrainWorldCreationBindings(ssq::Table& table) {
89 auto worldSettings =
90 table.addClass("TerrainWorldCreationSettings", ssq::Class::Ctor<TerrainWorldCreationSettings()>());
91 worldSettings.addVar("tilesX", &TerrainWorldCreationSettings::tilesX);
92 worldSettings.addVar("tilesZ", &TerrainWorldCreationSettings::tilesZ);
93 worldSettings.addVar("tileSize", &TerrainWorldCreationSettings::tileSize);
94 worldSettings.addVar("tileHeight", &TerrainWorldCreationSettings::tileHeight);
95 worldSettings.addVar("centerX", &TerrainWorldCreationSettings::centerX);
96 worldSettings.addVar("centerZ", &TerrainWorldCreationSettings::centerZ);
97 worldSettings.addVar("heightmapResolution", &TerrainWorldCreationSettings::heightmapResolution);
98 worldSettings.addVar("controlTextureResolution", &TerrainWorldCreationSettings::controlTextureResolution);
99 worldSettings.addVar("detailResolution", &TerrainWorldCreationSettings::detailResolution);
100 worldSettings.addVar("treeResolution", &TerrainWorldCreationSettings::treeResolution);
101 worldSettings.addVar("objectResolution", &TerrainWorldCreationSettings::objectResolution);
102 worldSettings.addVar("splatLayers", &TerrainWorldCreationSettings::splatLayers);
103 worldSettings.addVar("defaultSplatLayer", &TerrainWorldCreationSettings::defaultSplatLayer);
104 worldSettings.addVar("defaultDetailDensity", &TerrainWorldCreationSettings::defaultDetailDensity);
105 worldSettings.addVar("worldMap", &TerrainWorldCreationSettings::worldMap);
106 worldSettings.addVar("namePrefix", &TerrainWorldCreationSettings::namePrefix);
107 worldSettings.addVar("nameSuffix", &TerrainWorldCreationSettings::nameSuffix);
108 worldSettings.addVar("originY", &TerrainWorldCreationSettings::originY);
109}
110
111void exposeTerrainWorldBindings(ssq::Table& table) {
112 auto roadWrite = table.addClass("RoadTerrainWriteOptions", ssq::Class::Ctor<road::RoadTerrainWriteOptions()>());
113 roadWrite.addVar("blendDistance", &road::RoadTerrainWriteOptions::blendDistance);
114 roadWrite.addVar("maxVerticalDelta", &road::RoadTerrainWriteOptions::maxVerticalDelta);
115 roadWrite.addVar("splatLayer", &road::RoadTerrainWriteOptions::splatLayer);
116 roadWrite.addVar("splatOpacity", &road::RoadTerrainWriteOptions::splatOpacity);
117 roadWrite.addVar("clearDetails", &road::RoadTerrainWriteOptions::clearDetails);
118 roadWrite.addVar("clearTrees", &road::RoadTerrainWriteOptions::clearTrees);
119 roadWrite.addVar("cutTunnelHoles", &road::RoadTerrainWriteOptions::cutTunnelHoles);
120 roadWrite.addVar("tunnelHolesAtPortalsOnly", &road::RoadTerrainWriteOptions::tunnelHolesAtPortalsOnly);
121 roadWrite.addFunc("setMaximumWork", [vm = table.getHandle()](road::RoadTerrainWriteOptions* self, int visits) {
122 auto result = [&]() -> Result<int> {
123 if (visits <= 0)
124 return Result<int>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument,
125 "road terrain work budget must be positive",
126 "maximumWork", {}, "procgen.squirrel"));
127 self->maximumWork = static_cast<std::size_t>(visits);
128 return Result<int>::success(visits);
129 }();
130 return eve::script::projectResult(vm, std::move(result), [](int n) { return eve::Value(n); });
131 });
132 roadWrite.addFunc("getMaximumWork", [](const road::RoadTerrainWriteOptions* self) {
133 return static_cast<std::int64_t>(self->maximumWork);
134 });
135 auto world = table.addClass("TerrainWorldWorkspace", ssq::Class::Ctor<TerrainWorldWorkspace()>());
136 world.addFunc("conformRoadBatch", [vm = table.getHandle()](TerrainWorldWorkspace* self, ssq::Object meshes,
137 ssq::Object policies, ssq::Object budget) {
138 auto result = [&]() -> Result<int> {
139 if (budget.getType() != ssq::Type::INTEGER)
141 "road terrain batch budget must be an integer",
142 "maximumWork", {}, "procgen.squirrel"));
143 const auto maximumWork = budget.toInt();
144 if (maximumWork <= 0 || static_cast<std::uint64_t>(maximumWork) > std::numeric_limits<std::size_t>::max())
146 "road terrain batch budget is out of range",
147 "maximumWork", {}, "procgen.squirrel"));
148 if (meshes.getType() != ssq::Type::ARRAY || policies.getType() != ssq::Type::ARRAY)
150 "road terrain batch requires mesh and policy arrays",
151 "writes", {}, "procgen.squirrel"));
152 auto sources = meshes.toArray();
153 auto options = policies.toArray();
154 const auto count = sources.size();
155 if (count == 0 || count > 4096u || options.size() != count)
157 DiagnosticCode::InvalidArgument, "road terrain batch arrays must have matching sizes in [1,4096]",
158 "writes", {}, "procgen.squirrel"));
159 std::vector<road::RoadTerrainWrite> writes;
160 writes.reserve(count);
161 for (std::size_t i = 0; i < count; ++i) {
162 const auto sourcePath = "meshes[" + std::to_string(i) + "]";
163 auto source = borrowRoadArgument<MeshBuild>(sources.get<ssq::Object>(i), sourcePath.c_str());
164 if (!source.ok()) return Result<int>::failure(source.status());
165 const auto policyPath = "policies[" + std::to_string(i) + "]";
166 auto policy =
167 borrowRoadArgument<road::RoadTerrainWriteOptions>(options.get<ssq::Object>(i), policyPath.c_str());
168 if (!policy.ok()) return Result<int>::failure(policy.status());
169 writes.push_back({std::cref(source.value().get()), policy.value().get()});
170 }
171 return self->conformRoadBatch(writes, static_cast<std::size_t>(maximumWork));
172 }();
173 return eve::script::projectResult(vm, std::move(result), [](int n) { return eve::Value(n); });
174 });
175 world.addFunc("conformRoad",
176 [vm = table.getHandle()](TerrainWorldWorkspace* self, ssq::Object mesh, ssq::Object options) {
177 auto result = [&]() -> Result<int> {
178 auto source = borrowRoadArgument<MeshBuild>(mesh, "mesh");
179 if (!source.ok()) return Result<int>::failure(source.status());
180 auto policy = borrowRoadArgument<road::RoadTerrainWriteOptions>(options, "options");
181 if (!policy.ok()) return Result<int>::failure(policy.status());
182 return self->conformRoad(source.value().get(), policy.value().get());
183 }();
184 return eve::script::projectResult(vm, std::move(result), [](int n) { return eve::Value(n); });
185 });
186 world.addFunc(
187 "copyHoles", [vm = table.getHandle()](const TerrainWorldWorkspace* self, int index, ssq::Object output) {
188 auto destination = borrowRoadArgument<Heightmap>(output, "output");
189 if (!destination.ok())
190 return eve::script::projectResult(vm, Result<int>::failure(destination.status()),
191 [](int n) { return eve::Value(n); });
192 auto result = self->copyHoles(index);
193 if (!result.ok())
195 [](int n) { return eve::Value(n); });
196 auto& raster = destination.value().get();
197 raster = std::move(result).takeValue();
198 return eve::script::projectResult(vm, Result<int>::success(raster.getWidth() * raster.getHeight()),
199 [](int n) { return eve::Value(n); });
200 });
201 world.addFunc("create",
202 [vm = table.getHandle()](TerrainWorldWorkspace* self, const TerrainWorldCreationSettings* settings) {
203 auto result = settings ? self->create(*settings) : missingRaster();
204 return eve::script::projectResult(vm, std::move(result), [](int n) { return eve::Value(n); });
205 });
206 world.addFunc("stamp", [vm = table.getHandle()](TerrainWorldWorkspace* self, const Heightmap* stamp,
207 const TerrainStampSettings* settings, const Heightmap* local,
208 const Heightmap* global) {
209 auto result =
210 stamp && settings && local && global ? self->stamp(*stamp, *settings, *local, *global) : missingRaster();
211 return eve::script::projectResult(vm, std::move(result), [](int n) { return eve::Value(n); });
212 });
213 world.addFunc("paintSplat", [vm = table.getHandle()](TerrainWorldWorkspace* self, const Heightmap* paint, int layer,
214 const TerrainStampSettings* operation) {
215 auto result = paint && operation ? self->paintSplat(*paint, layer, *operation) : missingRaster();
216 return eve::script::projectResult(vm, std::move(result), [](int n) { return eve::Value(n); });
217 });
218 world.addFunc("spawn", [vm = table.getHandle()](TerrainWorldWorkspace* self, const TerrainSpawnPlan* plan) {
219 auto result = plan ? self->spawn(*plan) : missingRaster();
220 return eve::script::projectResult(vm, std::move(result), [](int n) { return eve::Value(n); });
221 });
222 world.addFunc("spawnBiome",
223 [vm = table.getHandle()](TerrainWorldWorkspace* self, const TerrainBiomePreset* preset) {
224 auto result = preset ? self->spawnBiome(*preset) : missingRaster();
225 return eve::script::projectResult(vm, std::move(result), [](int n) { return eve::Value(n); });
226 });
227 world.addFunc("spawnStamper",
228 [vm = table.getHandle()](TerrainWorldWorkspace* self, const TerrainBiomePreset* preset) {
229 auto result = preset ? self->spawnStamper(*preset) : missingRaster();
230 return eve::script::projectResult(vm, std::move(result), [](int n) { return eve::Value(n); });
231 });
232 world.addFunc("beginSpawn", [vm = table.getHandle()](TerrainWorldWorkspace* self, const TerrainSpawnPlan* plan) {
233 auto result = plan ? self->beginSpawn(*plan)
235 DiagnosticCode::InvalidArgument, "terrain.world.beginSpawn: plan required"));
236 return eve::script::projectResult(vm, std::move(result),
237 [](TerrainWorldRunStatus status) { return eve::Value(int(status)); });
238 });
239 world.addFunc("beginSpawnBiome", [vm = table.getHandle()](TerrainWorldWorkspace* self,
240 const TerrainBiomePreset* preset) {
241 auto result = preset ? self->beginSpawnBiome(*preset)
243 DiagnosticCode::InvalidArgument, "terrain.world.beginSpawnBiome: preset required"));
244 return eve::script::projectResult(vm, std::move(result),
245 [](TerrainWorldRunStatus status) { return eve::Value(int(status)); });
246 });
247 world.addFunc(
248 "beginSpawnStamper", [vm = table.getHandle()](TerrainWorldWorkspace* self, const TerrainBiomePreset* preset) {
249 auto result =
250 preset ? self->beginSpawnStamper(*preset)
252 DiagnosticCode::InvalidArgument, "terrain.world.beginSpawnStamper: preset required"));
253 return eve::script::projectResult(vm, std::move(result),
254 [](TerrainWorldRunStatus status) { return eve::Value(int(status)); });
255 });
256 world.addFunc("stepSpawn", [vm = table.getHandle()](TerrainWorldWorkspace* self, int maxRules) {
257 return eve::script::projectResult(vm, self->stepSpawn(maxRules),
258 [](TerrainWorldRunStatus status) { return eve::Value(int(status)); });
259 });
260 world.addFunc("cancelSpawn", [vm = table.getHandle()](TerrainWorldWorkspace* self) {
261 return eve::script::projectResult(vm, self->cancelSpawn(),
262 [](TerrainWorldRunStatus status) { return eve::Value(int(status)); });
263 });
264 world.addFunc("getSpawnStatus", [](const TerrainWorldWorkspace* self) { return int(self->getSpawnStatus()); });
265 world.addFunc("getSpawnCompletedRules",
266 [](const TerrainWorldWorkspace* self) { return self->getSpawnCompletedRules(); });
267 world.addFunc("applyDetail", [vm = table.getHandle()](TerrainWorldWorkspace* self, const Heightmap* fitness,
268 const TerrainDetailSettings* settings,
269 const TerrainStampSettings* operation, int mode, int seed) {
270 auto result = fitness && settings && operation ? self->applyDetail(*fitness, *settings, *operation,
271 static_cast<TerrainDetailMode>(mode), seed)
272 : missingRaster();
273 return eve::script::projectResult(vm, std::move(result), [](int n) { return eve::Value(n); });
274 });
275 world.addFunc("applyTrees", [vm = table.getHandle()](TerrainWorldWorkspace* self, const Heightmap* fitness,
276 const TerrainTreePlacementSettings* settings,
277 const TerrainStampSettings* operation, int mode) {
278 auto result = fitness && settings && operation ? self->applyTrees(*fitness, *settings, *operation,
279 static_cast<TerrainTreeOperationMode>(mode))
280 : missingRaster();
281 return eve::script::projectResult(vm, std::move(result), [](int n) { return eve::Value(n); });
282 });
283 world.addFunc("applyObjects", [vm = table.getHandle()](TerrainWorldWorkspace* self, const Heightmap* fitness,
284 const TerrainObjectPlacementSettings* settings,
285 const TerrainStampSettings* operation, int mode) {
286 auto result =
287 fitness && settings && operation
288 ? self->applyObjects(*fitness, *settings, *operation, static_cast<TerrainObjectOperationMode>(mode))
289 : missingRaster();
290 return eve::script::projectResult(vm, std::move(result), [](int n) { return eve::Value(n); });
291 });
292 world.addFunc("applyProbes", [vm = table.getHandle()](TerrainWorldWorkspace* self, const Heightmap* fitness,
293 const TerrainProbePlacementSettings* settings,
294 const TerrainStampSettings* operation, int mode, int type) {
295 auto result = [&]() -> Result<int> {
296 if (!fitness || !settings || !operation) return missingRaster();
297 auto copy = *settings;
298 copy.type = static_cast<TerrainProbeType>(type);
299 return self->applyProbes(*fitness, copy, *operation, static_cast<TerrainProbeOperationMode>(mode));
300 }();
301 return eve::script::projectResult(vm, std::move(result), [](int n) { return eve::Value(n); });
302 });
303 auto worldClear = table.addClass("TerrainWorldClearSettings", ssq::Class::Ctor<TerrainWorldClearSettings()>());
304 worldClear.addVar("details", &TerrainWorldClearSettings::details);
305 worldClear.addVar("trees", &TerrainWorldClearSettings::trees);
306 worldClear.addVar("objects", &TerrainWorldClearSettings::objects);
307 worldClear.addVar("probes", &TerrainWorldClearSettings::probes);
308 worldClear.addVar("sourceNamespace", &TerrainWorldClearSettings::sourceNamespace);
309 world.addFunc("flatten", [vm = table.getHandle()](TerrainWorldWorkspace* self) {
310 return eve::script::projectResult(vm, self->flatten(), [](int n) { return eve::Value(n); });
311 });
312 world.addFunc("setHeightWorldUnits", [vm = table.getHandle()](TerrainWorldWorkspace* self, float heightWorldUnits,
313 float worldHeightSpan) {
314 return eve::script::projectResult(vm, self->setHeightWorldUnits(heightWorldUnits, worldHeightSpan),
315 [](int n) { return eve::Value(n); });
316 });
317 world.addFunc("clearSpawns",
318 [vm = table.getHandle()](TerrainWorldWorkspace* self, const TerrainWorldClearSettings* settings) {
319 auto result = settings ? self->clearSpawns(*settings) : missingRaster();
320 return eve::script::projectResult(vm, std::move(result), [](int n) { return eve::Value(n); });
321 });
322 world.addFunc("copyHeightmap",
323 [vm = table.getHandle()](const TerrainWorldWorkspace* self, int index, Heightmap* output) {
324 auto result = output ? self->copyHeightmap(index, *output) : missingRaster();
325 return eve::script::projectResult(vm, std::move(result), [](int n) { return eve::Value(n); });
326 });
327 world.addFunc("copySplatmap",
328 [vm = table.getHandle()](const TerrainWorldWorkspace* self, int index, TerrainSplatmap* output) {
329 auto result = output ? self->copySplatmap(index, *output) : missingRaster();
330 return eve::script::projectResult(vm, std::move(result), [](int n) { return eve::Value(n); });
331 });
332 world.addFunc("copyDetail",
333 [vm = table.getHandle()](const TerrainWorldWorkspace* self, int index, TerrainDetailLayer* output) {
334 auto result = output ? self->copyDetail(index, *output) : missingRaster();
335 return eve::script::projectResult(vm, std::move(result), [](int n) { return eve::Value(n); });
336 });
337 world.addFunc("copyTrees",
338 [vm = table.getHandle()](const TerrainWorldWorkspace* self, int index, PointSet* output) {
339 auto result = output ? self->copyTrees(index, *output) : missingRaster();
340 return eve::script::projectResult(vm, std::move(result), [](int n) { return eve::Value(n); });
341 });
342 world.addFunc("copyObjects",
343 [vm = table.getHandle()](const TerrainWorldWorkspace* self, int index, PointSet* output) {
344 auto result = output ? self->copyObjects(index, *output) : missingRaster();
345 return eve::script::projectResult(vm, std::move(result), [](int n) { return eve::Value(n); });
346 });
347 world.addFunc("copyProbes",
348 [vm = table.getHandle()](const TerrainWorldWorkspace* self, int index, PointSet* output) {
349 auto result = output ? self->copyProbes(index, *output) : missingRaster();
350 return eve::script::projectResult(vm, std::move(result), [](int n) { return eve::Value(n); });
351 });
352 world.addFunc("getTileName", [vm = table.getHandle()](const TerrainWorldWorkspace* self, int index) {
353 return eve::script::projectResult(vm, self->getTileName(index),
354 [](const std::string& value) { return eve::Value(value); });
355 });
356 world.addFunc("getTileOriginX", [vm = table.getHandle()](const TerrainWorldWorkspace* self, int index) {
357 return eve::script::projectResult(vm, self->getTileOriginX(index),
358 [](double value) { return eve::Value(value); });
359 });
360 world.addFunc("getTileOriginZ", [vm = table.getHandle()](const TerrainWorldWorkspace* self, int index) {
361 return eve::script::projectResult(vm, self->getTileOriginZ(index),
362 [](double value) { return eve::Value(value); });
363 });
364 world.addFunc("getTileOriginY", [vm = table.getHandle()](const TerrainWorldWorkspace* self, int index) {
365 return eve::script::projectResult(vm, self->getTileOriginY(index),
366 [](double value) { return eve::Value(value); });
367 });
368 world.addFunc("undo", [vm = table.getHandle()](TerrainWorldWorkspace* self) {
369 return eve::script::projectResult(vm, self->undo(), [](int n) { return eve::Value(n); });
370 });
371 world.addFunc("redo", [vm = table.getHandle()](TerrainWorldWorkspace* self) {
372 return eve::script::projectResult(vm, self->redo(), [](int n) { return eve::Value(n); });
373 });
374 world.addFunc("getTileCount", [](const TerrainWorldWorkspace* self) { return self->getTileCount(); });
375 world.addFunc("getLastChangedSamples",
376 [](const TerrainWorldWorkspace* self) { return self->getLastChangedSamples(); });
377 world.addFunc("getLastAffectedTiles",
378 [](const TerrainWorldWorkspace* self) { return self->getLastAffectedTiles(); });
379 world.addFunc("getOperationCount", [](const TerrainWorldWorkspace* self) { return self->getOperationCount(); });
380 world.addFunc("getAppliedCount", [](const TerrainWorldWorkspace* self) { return self->getAppliedCount(); });
381}
382} // namespace eve::procgen
ActionParameterOperation operation
std::string output
AuthorityStoreHandleRef reference
Definition Authority.cpp:24
Vocabulary aliases for nullable and checked borrowed references.
HSQUIRRELVM vm
Definition ECS.cpp:38
wgpu::PopErrorScopeStatus status
glm::vec3 n
Definition Grass.cpp:63
std::string local
Poco::JSON::Object::Ptr result
OceanWakeSettings settings
std::shared_ptr< OceanGpuSpectrum > owner
OceanMeshSettings mesh
std::vector< std::pair< std::uint64_t, OceanBoatReceipt > > sources
TileLayer * layer
std::string path
Definition PlayHost.cpp:111
Object::Ptr value
RoadNetwork resolved
std::string_view source
const SquirrelValueOptions & options
int count
The single Squirrel projection for common Result, Status and Value.
Heightmap stamp
Heightmap global
std::string sourcePath
uint32_t seed
Definition TreeMesh.cpp:276
uint32_t index
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
static Result success(T value)
Construct a successful result owning value.
Definition Result.h:185
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
The canonical owning dynamic value used by data-facing protocols.
Definition Value.h:31
Non-owning observation of a registry-owned object.
void exposeTerrainWorldBindings(ssq::Table &table)
eve::script::RuntimeHandleRef< ProcgenMeshBuildHandleTag > ProcgenMeshBuildHandleRef
Definition Procgen.h:128
TerrainProbeOperationMode
Mutation performed by a multi-terrain probe rule.
TerrainProbeType
Pcg probe resource kind.
Procgen * liveProcgen() noexcept
Returns the currently live Procgen module instance, or nullptr.
eve::script::RuntimeHandleRef< ProcgenHeightmapHandleTag > ProcgenHeightmapHandleRef
Definition Procgen.h:124
TerrainDetailMode
Native detail-density operation corresponding to Pcg SpawnMode.
TerrainWorldRunStatus
Observable lifecycle of a caller-driven staged world spawn.
void exposeTerrainWorldCreationBindings(ssq::Table &table)
TerrainObjectOperationMode
Mutation performed by a multi-terrain game-object operation.
TerrainTreeOperationMode
Pcg SetTerrainTrees operation branch. Add and Replace both append after upstream clearing policy.
std::unordered_map< std::string, SkillDefinition > & table()
Definition Skill.cpp:73
ssq::Table projectResult(HSQUIRRELVM vm, Result< void > &&result)
Consume and project a void native Result using the common schema.
@ TypeMismatch
A stable reference resolved to a different canonical domain type.
std::uint64_t sourceNamespace
Zero clears any source; non-zero clears only points emitted by that stable namespace.
Validated Pcg-style centered terrain-grid topology.
float originY
Finite world baseline shared by road projection and terrain-relative placements.
Explicit channel selection for one all-tile atomic write; no implicit optional providers.
bool tunnelHolesAtPortalsOnly
Cut authored portal surfaces; false selects the legacy full footprint.
float splatOpacity
Finite [0,1] target weight ceiling; multiplies coverage for splats only.
int splatLayer
Negative one preserves texture weights; otherwise paints the selected layer.