@margoengine/terrain 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE +4 -0
- package/README.md +1808 -3
- package/dist/blend.d.ts +70 -0
- package/dist/blend.js +159 -0
- package/dist/colors.d.ts +164 -0
- package/dist/deform.d.ts +103 -0
- package/dist/deform.js +322 -0
- package/dist/displace.d.ts +60 -0
- package/dist/displace.js +254 -0
- package/dist/dunes.d.ts +86 -0
- package/dist/dunes.js +88 -0
- package/dist/errors-fc4i1pSL.js +7 -0
- package/dist/grid.d.ts +11 -0
- package/dist/ground-change-settings.d.ts +29 -0
- package/dist/ground-change-settings.js +69 -0
- package/dist/ground-change.d.ts +227 -0
- package/dist/ground-change.js +1291 -0
- package/dist/ground-model.d.ts +290 -0
- package/dist/hdr-format-DRhzGS7G.js +30 -0
- package/dist/height-grid.d.ts +65 -0
- package/dist/height-grid.js +74 -0
- package/dist/heightfield.d.ts +38 -0
- package/dist/holes.d.ts +37 -0
- package/dist/holes.js +97 -0
- package/dist/imagery.d.ts +109 -0
- package/dist/imagery.js +472 -0
- package/dist/index.d.ts +297 -0
- package/dist/index.js +1 -0
- package/dist/layers-pbr.d.ts +78 -0
- package/dist/layers-pbr.js +128 -0
- package/dist/lighting-layout-CaDtDa5G.js +34 -0
- package/dist/lighting-layout.d.ts +5 -0
- package/dist/mesh-patch-BThCHCeS.js +21 -0
- package/dist/mesh-patch.d.ts +14 -0
- package/dist/noise3-sQdnbz4B.js +11 -0
- package/dist/noise3.d.ts +3 -0
- package/dist/overlays.d.ts +74 -0
- package/dist/overlays.js +297 -0
- package/dist/planet-craters.d.ts +55 -0
- package/dist/planet-recipes.d.ts +75 -0
- package/dist/planet-recipes.js +216 -0
- package/dist/planet.d.ts +139 -0
- package/dist/planet.js +602 -0
- package/dist/query.d.ts +150 -0
- package/dist/query.js +243 -0
- package/dist/relief-lighting.d.ts +46 -0
- package/dist/relief-lighting.js +208 -0
- package/dist/require-webgpu--tUXPsmA.js +7 -0
- package/dist/rock-settings.d.ts +39 -0
- package/dist/rock-settings.js +84 -0
- package/dist/rock-surface.d.ts +111 -0
- package/dist/rock-surface.js +368 -0
- package/dist/rocks.d.ts +258 -0
- package/dist/rocks.js +488 -0
- package/dist/rvt.d.ts +136 -0
- package/dist/rvt.js +518 -0
- package/dist/sculpt.d.ts +103 -0
- package/dist/sculpt.js +361 -0
- package/dist/settings-B9BSdnhD.js +72 -0
- package/dist/settings.d.ts +81 -0
- package/dist/settings.js +152 -0
- package/dist/shader.d.ts +61 -0
- package/dist/shared/settings.d.ts +89 -0
- package/dist/src-C6dtSaAb.js +1155 -0
- package/dist/stream.d.ts +100 -0
- package/dist/stream.js +339 -0
- package/dist/surface-height.d.ts +16 -0
- package/dist/wet-ground.d.ts +82 -0
- package/dist/wet-ground.js +147 -0
- package/package.json +148 -6
package/dist/sculpt.js
ADDED
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
// @margo/core-built 0.1.0
|
|
2
|
+
import {coreRequirement as __margoCoreRequirement,assertCore as __margoAssertCore} from '@margoengine/core/extension';
|
|
3
|
+
const e=(engine,version="0.1.0",source=import.meta.url)=>__margoRuntime(engine,version,source);
|
|
4
|
+
import { engineRuntime as __margoRuntime } from "@margoengine/core/extension";
|
|
5
|
+
import { MargoError as t } from "@margoengine/math/errors";
|
|
6
|
+
//#region src/sculpt.ts
|
|
7
|
+
var n = (e) => `
|
|
8
|
+
struct Dab {center:vec2f,radius:f32,strength:f32,amount:f32,goal:f32,mode:u32,falloff:u32,lo:vec2i,hi:vec2i,origin:vec2i,spacing:vec2f,paint:vec4f}
|
|
9
|
+
@group(0) @binding(0) var<uniform> dab:Dab;
|
|
10
|
+
@group(0) @binding(1) var source:texture_2d<f32>;
|
|
11
|
+
@group(0) @binding(2) var dest:texture_storage_2d<${e},write>;
|
|
12
|
+
fn fall(t:f32)->f32 {
|
|
13
|
+
if(t>=1.0){return 0.0;}if(dab.falloff==1u){return 1.0-t;}if(dab.falloff==2u){return 1.0;}
|
|
14
|
+
let s=1.0-t;return s*s*s*s*(4.0*t+1.0);
|
|
15
|
+
}
|
|
16
|
+
fn at(p:vec2i)->vec4f {return textureLoad(source,clamp(p-dab.origin,vec2i(0),vec2i(textureDimensions(source))-vec2i(1)),0);}
|
|
17
|
+
@compute @workgroup_size(8,8) fn main(@builtin(global_invocation_id) id:vec3u) {
|
|
18
|
+
let p=dab.lo+vec2i(id.xy);if(any(p>=dab.hi)){return;}
|
|
19
|
+
let f=fall(length((vec2f(p)-dab.center)*dab.spacing)/dab.radius)*dab.strength;let h=at(p);var out=h;
|
|
20
|
+
${e === "rgba8unorm" ? "let d=dab.paint-h;let s=d*f;out=h+select(s,sign(d)*min(abs(d),vec4f(1.0/255.0)),(abs(s)<vec4f(0.5/255.0))&(abs(d)>vec4f(0.0))&vec4<bool>(f>0.0));" : "switch dab.mode {\n case 0u:{out.x=h.x+dab.amount*f;}\n case 1u:{out.x=h.x-dab.amount*f;}\n case 2u:{var k=array<f32,5>(1,4,6,4,1);var s=0.0;for(var j=-2;j<=2;j++){for(var i=-2;i<=2;i++){s+=k[i+2]*k[j+2]*at(p+vec2i(i,j)).x;}}out.x=mix(h.x,s/256.0,f);}\n default:{out.x=mix(h.x,dab.goal,f);}\n }"}
|
|
21
|
+
textureStore(dest,p,out);
|
|
22
|
+
}`, r = 0, i = {
|
|
23
|
+
raise: 0,
|
|
24
|
+
lower: 1,
|
|
25
|
+
smooth: 2,
|
|
26
|
+
flatten: 3,
|
|
27
|
+
paint: 4
|
|
28
|
+
}, a = {
|
|
29
|
+
smooth: 0,
|
|
30
|
+
linear: 1,
|
|
31
|
+
constant: 2
|
|
32
|
+
};
|
|
33
|
+
async function o(e, t, n, r, i) {
|
|
34
|
+
let a = n.u1 - n.u0, o = n.v1 - n.v0, s = Math.ceil(a * r / 256) * 256, c = e.createBuffer({
|
|
35
|
+
size: s * o,
|
|
36
|
+
usage: GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST
|
|
37
|
+
}), l = e.createCommandEncoder();
|
|
38
|
+
l.copyTextureToBuffer({
|
|
39
|
+
texture: t,
|
|
40
|
+
origin: [n.u0, n.v0]
|
|
41
|
+
}, {
|
|
42
|
+
buffer: c,
|
|
43
|
+
bytesPerRow: s,
|
|
44
|
+
rowsPerImage: o
|
|
45
|
+
}, [a, o]), e.queue.submit([l.finish()]);
|
|
46
|
+
try {
|
|
47
|
+
await c.mapAsync(GPUMapMode.READ), i?.throwIfAborted();
|
|
48
|
+
let e = new Uint8Array(c.getMappedRange()), t = new Uint8Array(a * o * r);
|
|
49
|
+
for (let n = 0; n < o; n++) t.set(e.subarray(n * s, n * s + a * r), n * a * r);
|
|
50
|
+
return t;
|
|
51
|
+
} finally {
|
|
52
|
+
c.destroy();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
var s = class s {coreRequirement=__margoCoreRequirement("0.1.0",import.meta.url);
|
|
56
|
+
#e;
|
|
57
|
+
#t;
|
|
58
|
+
#n;
|
|
59
|
+
#r;
|
|
60
|
+
#i;
|
|
61
|
+
#a;
|
|
62
|
+
#o;
|
|
63
|
+
#s;
|
|
64
|
+
#c;
|
|
65
|
+
#l;
|
|
66
|
+
#u;
|
|
67
|
+
#d;
|
|
68
|
+
#f;
|
|
69
|
+
#p;
|
|
70
|
+
constructor(e, t) {
|
|
71
|
+
if (this.name = "terrain-sculpt:" + r++, this.columns = 0, this.rows = 0, this.weights = [], this.disposed = !1, this.#n = [], this.#r = [], this.#i = /* @__PURE__ */ new Set(), this.#s = [], this.#c = /* @__PURE__ */ new Map(), this.#u = /* @__PURE__ */ new Map(), this.#f = Promise.resolve(), this.#e = e, this.#t = t.undoLimit ?? 32, !Number.isInteger(this.#t) || this.#t < 0 || this.#t > 1e3) throw RangeError("Invalid terrain sculpt undoLimit; give a whole number from 0 to 1000 (default 32).");
|
|
72
|
+
this.brush = {
|
|
73
|
+
brush: "raise",
|
|
74
|
+
radius: 8,
|
|
75
|
+
strength: .5,
|
|
76
|
+
falloff: "smooth",
|
|
77
|
+
layer: 0,
|
|
78
|
+
...this.#_(t)
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
static async attach(t, n, r = {}) {__margoAssertCore(t,__margoCoreRequirement("0.1.0",import.meta.url));
|
|
82
|
+
if (!n || typeof n.invalidate != "function") throw TypeError("Invalid terrain sculpt; pass a Terrain attached to the engine.");
|
|
83
|
+
let i = new s(n, r);
|
|
84
|
+
e(t).use(i);
|
|
85
|
+
try {
|
|
86
|
+
await i.#h(r.signal);
|
|
87
|
+
} catch (e) {
|
|
88
|
+
throw i.dispose(), e;
|
|
89
|
+
}
|
|
90
|
+
return i;
|
|
91
|
+
}
|
|
92
|
+
setup(e) {
|
|
93
|
+
if (this.disposed || !e.gpu || !this.#e.heightmap) throw new t(this.disposed ? "disposed" : "unsupported", "Terrain sculpting requires WebGPU and an attached terrain; attach the Terrain first, on a WebGPU engine");
|
|
94
|
+
this.#a = e, this.#o = e.gpu, this.#m();
|
|
95
|
+
}
|
|
96
|
+
#m() {
|
|
97
|
+
let e = this.#e.heightmap, t = GPUTextureUsage.STORAGE_BINDING | GPUTextureUsage.COPY_SRC | GPUTextureUsage.COPY_DST, n = [...new Set(this.#e.weights ?? [])];
|
|
98
|
+
if (e.format !== "r32float" || (e.usage & t) !== t) throw TypeError("Terrain sculpting needs an r32float heightmap with STORAGE_BINDING, COPY_SRC and COPY_DST usage (15 with TEXTURE_BINDING); create it so in the textures factory.");
|
|
99
|
+
if (n.some((e) => e.format !== "rgba8unorm" || (e.usage & t) !== t)) throw TypeError("Terrain weight painting needs rgba8unorm weights with STORAGE_BINDING, COPY_SRC and COPY_DST usage (15 with TEXTURE_BINDING); create them so in the textures factory.");
|
|
100
|
+
let r = this.#s;
|
|
101
|
+
this.#s = [e, ...n].map((e, t) => ({
|
|
102
|
+
texture: e,
|
|
103
|
+
columns: e.width,
|
|
104
|
+
rows: e.height,
|
|
105
|
+
channels: t ? 4 : 1,
|
|
106
|
+
data: r[t]?.data ?? (t ? new Uint8Array(e.width * e.height * 4) : new Float32Array(e.width * e.height))
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
async #h(e) {
|
|
110
|
+
let t = this.#o;
|
|
111
|
+
for (let n of this.#s) {
|
|
112
|
+
let r = await o(t, n.texture, {
|
|
113
|
+
u0: 0,
|
|
114
|
+
v0: 0,
|
|
115
|
+
u1: n.columns,
|
|
116
|
+
v1: n.rows
|
|
117
|
+
}, 4, e);
|
|
118
|
+
n.data = n.channels === 1 ? new Float32Array(r.buffer) : r;
|
|
119
|
+
}
|
|
120
|
+
this.#g();
|
|
121
|
+
}
|
|
122
|
+
#g() {
|
|
123
|
+
let [e, ...t] = this.#s;
|
|
124
|
+
this.heights = e.data, this.columns = e.columns, this.rows = e.rows, this.weights = t.map((e) => ({
|
|
125
|
+
data: e.data,
|
|
126
|
+
columns: e.columns,
|
|
127
|
+
rows: e.rows
|
|
128
|
+
}));
|
|
129
|
+
}
|
|
130
|
+
#_(e) {
|
|
131
|
+
let t = e ?? {}, n = this.#e.options.layers.length;
|
|
132
|
+
if (t.brush !== void 0 && !(t.brush in i) || t.falloff !== void 0 && !(t.falloff in a) || t.radius !== void 0 && !(t.radius > 0 && Number.isFinite(t.radius)) || t.strength !== void 0 && !(t.strength >= 0 && t.strength <= 1) || t.amount !== void 0 && !(t.amount > 0 && Number.isFinite(t.amount)) || t.height !== void 0 && !Number.isFinite(t.height) || t.layer !== void 0 && !(Number.isInteger(t.layer) && t.layer >= 0 && t.layer < n)) throw RangeError(`Invalid terrain brush; give brush raise, lower, smooth, flatten or paint, falloff smooth, linear or constant, radius and amount above 0, strength 0..1, a finite height and a layer 0..${n - 1}.`);
|
|
133
|
+
let r = {};
|
|
134
|
+
for (let e of [
|
|
135
|
+
"brush",
|
|
136
|
+
"radius",
|
|
137
|
+
"strength",
|
|
138
|
+
"falloff",
|
|
139
|
+
"amount",
|
|
140
|
+
"height",
|
|
141
|
+
"layer"
|
|
142
|
+
]) t[e] !== void 0 && (r[e] = t[e]);
|
|
143
|
+
return r;
|
|
144
|
+
}
|
|
145
|
+
stroke(e = {}) {
|
|
146
|
+
if (this.#w(), this.#d) throw new t("state", "A terrain stroke is already open; end it before starting another");
|
|
147
|
+
let n = this.#d = {
|
|
148
|
+
options: this.#_(e),
|
|
149
|
+
dirty: /* @__PURE__ */ new Map()
|
|
150
|
+
}, r = () => {
|
|
151
|
+
this.#d === n && (this.#d = void 0, n.dirty.size && this.#b(n.dirty));
|
|
152
|
+
};
|
|
153
|
+
return {
|
|
154
|
+
end: r,
|
|
155
|
+
[Symbol.dispose]: r
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
dab(e, t, n = {}) {
|
|
159
|
+
if (this.#w(), !Number.isFinite(e) || !Number.isFinite(t)) throw TypeError("Invalid terrain dab; pass a finite world x and z.");
|
|
160
|
+
let r = this.#d ? void 0 : this.stroke();
|
|
161
|
+
try {
|
|
162
|
+
let r = this.#d, o = {
|
|
163
|
+
...this.brush,
|
|
164
|
+
...r.options,
|
|
165
|
+
...this.#_(n)
|
|
166
|
+
}, s = this.#e.options, [c, l] = s.origin ?? [0, 0], [u, d] = s.size, f = s.heightScale ?? 100, p = s.heightOffset ?? 0;
|
|
167
|
+
o.brush === "flatten" && (r.target ??= o.height === void 0 ? this.#v(e, t) : (o.height - p) / f);
|
|
168
|
+
let m = o.brush === "paint";
|
|
169
|
+
if (m && this.#s.length < 2) throw RangeError("Invalid terrain brush; paint needs a terrain with weights.");
|
|
170
|
+
let h = m ? this.#s.slice(1).map((e, t) => [t + 1, e]) : [[0, this.#s[0]]];
|
|
171
|
+
for (let [n, s] of h) {
|
|
172
|
+
let p = m ? u / s.columns : u / Math.max(s.columns - 1, 1), h = m ? d / s.rows : d / Math.max(s.rows - 1, 1), g = (e - c) / p - (m ? .5 : 0), _ = (t - l) / h - (m ? .5 : 0), v = {
|
|
173
|
+
u0: Math.max(0, Math.floor(g - o.radius / p)),
|
|
174
|
+
v0: Math.max(0, Math.floor(_ - o.radius / h)),
|
|
175
|
+
u1: Math.min(s.columns, Math.ceil(g + o.radius / p) + 1),
|
|
176
|
+
v1: Math.min(s.rows, Math.ceil(_ + o.radius / h) + 1)
|
|
177
|
+
};
|
|
178
|
+
if (v.u1 <= v.u0 || v.v1 <= v.v0) continue;
|
|
179
|
+
let y = /* @__PURE__ */ new Float32Array(4);
|
|
180
|
+
m && Math.floor(o.layer / 4) === n - 1 && (y[o.layer % 4] = 1), this.#y(s, v, [g, _], [p, h], {
|
|
181
|
+
radius: o.radius,
|
|
182
|
+
strength: o.strength,
|
|
183
|
+
amount: (o.amount ?? o.radius / 10) / f,
|
|
184
|
+
target: r.target ?? 0,
|
|
185
|
+
mode: i[o.brush],
|
|
186
|
+
falloff: a[o.falloff],
|
|
187
|
+
paint: y
|
|
188
|
+
});
|
|
189
|
+
let b = r.dirty.get(n);
|
|
190
|
+
b ? (b.u0 = Math.min(b.u0, v.u0), b.v0 = Math.min(b.v0, v.v0), b.u1 = Math.max(b.u1, v.u1), b.v1 = Math.max(b.v1, v.v1)) : r.dirty.set(n, { ...v });
|
|
191
|
+
}
|
|
192
|
+
this.#e.invalidate();
|
|
193
|
+
} finally {
|
|
194
|
+
r?.end();
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
#v(e, t) {
|
|
198
|
+
let n = this.#e.options, [r, i] = n.origin ?? [0, 0], a = this.columns, o = this.rows, s = Math.min(Math.max((e - r) / n.size[0] * (a - 1), 0), a - 1), c = Math.min(Math.max((t - i) / n.size[1] * (o - 1), 0), o - 1), l = Math.floor(s), u = Math.floor(c), d = Math.min(l + 1, a - 1), f = Math.min(u + 1, o - 1), p = this.heights, m = p[u * a + l] + (p[u * a + d] - p[u * a + l]) * (s - l);
|
|
199
|
+
return m + (p[f * a + l] + (p[f * a + d] - p[f * a + l]) * (s - l) - m) * (c - u);
|
|
200
|
+
}
|
|
201
|
+
#y(e, t, r, i, a) {
|
|
202
|
+
let o = this.#o, s = e.texture.format, c = [Math.max(0, t.u0 - 2), Math.max(0, t.v0 - 2)], l = [Math.min(e.columns, t.u1 + 2), Math.min(e.rows, t.v1 + 2)], u = l[0] - c[0], d = l[1] - c[1], f = this.#u.get(s);
|
|
203
|
+
if (!f || f.width < u || f.height < d) {
|
|
204
|
+
f?.destroy();
|
|
205
|
+
let e = (e) => 2 ** Math.ceil(Math.log2(Math.max(e, 16)));
|
|
206
|
+
f = o.createTexture({
|
|
207
|
+
size: [Math.max(e(u), f?.width ?? 0), Math.max(e(d), f?.height ?? 0)],
|
|
208
|
+
format: s,
|
|
209
|
+
usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST
|
|
210
|
+
}), this.#u.set(s, f);
|
|
211
|
+
}
|
|
212
|
+
let p = this.#c.get(s);
|
|
213
|
+
p || (p = o.createComputePipeline({
|
|
214
|
+
layout: "auto",
|
|
215
|
+
compute: {
|
|
216
|
+
module: o.createShaderModule({ code: n(s) }),
|
|
217
|
+
entryPoint: "main"
|
|
218
|
+
}
|
|
219
|
+
}), this.#c.set(s, p)), this.#l ??= o.createBuffer({
|
|
220
|
+
size: 80,
|
|
221
|
+
usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST
|
|
222
|
+
});
|
|
223
|
+
let m = /* @__PURE__ */ new ArrayBuffer(80), h = new Float32Array(m), g = new Int32Array(m), _ = new Uint32Array(m);
|
|
224
|
+
h.set([
|
|
225
|
+
r[0],
|
|
226
|
+
r[1],
|
|
227
|
+
a.radius,
|
|
228
|
+
a.strength,
|
|
229
|
+
a.amount,
|
|
230
|
+
a.target
|
|
231
|
+
]), _[6] = a.mode, _[7] = a.falloff, g.set([
|
|
232
|
+
t.u0,
|
|
233
|
+
t.v0,
|
|
234
|
+
t.u1,
|
|
235
|
+
t.v1,
|
|
236
|
+
c[0],
|
|
237
|
+
c[1]
|
|
238
|
+
], 8), h.set(i, 14), h.set(a.paint, 16), o.queue.writeBuffer(this.#l, 0, m);
|
|
239
|
+
let v = o.createCommandEncoder();
|
|
240
|
+
v.copyTextureToTexture({
|
|
241
|
+
texture: e.texture,
|
|
242
|
+
origin: c
|
|
243
|
+
}, { texture: f }, [u, d]);
|
|
244
|
+
let y = v.beginComputePass();
|
|
245
|
+
y.setPipeline(p), y.setBindGroup(0, o.createBindGroup({
|
|
246
|
+
layout: p.getBindGroupLayout(0),
|
|
247
|
+
entries: [
|
|
248
|
+
{
|
|
249
|
+
binding: 0,
|
|
250
|
+
resource: { buffer: this.#l }
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
binding: 1,
|
|
254
|
+
resource: f.createView()
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
binding: 2,
|
|
258
|
+
resource: e.texture.createView()
|
|
259
|
+
}
|
|
260
|
+
]
|
|
261
|
+
})), y.dispatchWorkgroups(Math.ceil((t.u1 - t.u0) / 8), Math.ceil((t.v1 - t.v0) / 8)), y.end(), o.queue.submit([v.finish()]);
|
|
262
|
+
}
|
|
263
|
+
#b(e) {
|
|
264
|
+
let t = this.#o, n = [...e].map(([e, n]) => {
|
|
265
|
+
let r = this.#s[e];
|
|
266
|
+
return o(t, r.texture, n, 4).then((t) => ({
|
|
267
|
+
index: e,
|
|
268
|
+
rect: n,
|
|
269
|
+
bytes: t
|
|
270
|
+
}));
|
|
271
|
+
});
|
|
272
|
+
this.#r.length = 0, this.#f = this.#f.then(async () => {
|
|
273
|
+
let e = [];
|
|
274
|
+
for (let { index: t, rect: r, bytes: i } of await Promise.all(n)) {
|
|
275
|
+
let n = this.#s[t], a = n.channels === 1 ? new Float32Array(i.buffer) : i;
|
|
276
|
+
e.push({
|
|
277
|
+
map: t,
|
|
278
|
+
u: r.u0,
|
|
279
|
+
v: r.v0,
|
|
280
|
+
width: r.u1 - r.u0,
|
|
281
|
+
depth: r.v1 - r.v0,
|
|
282
|
+
before: this.#x(n, r),
|
|
283
|
+
after: a
|
|
284
|
+
}), this.#S(t, r, a);
|
|
285
|
+
}
|
|
286
|
+
this.#t && (this.#n.push(e), this.#n.length > this.#t && this.#n.shift());
|
|
287
|
+
}), this.#f.catch((e) => this.#p ??= e);
|
|
288
|
+
}
|
|
289
|
+
#x(e, t) {
|
|
290
|
+
let n = e.channels, r = (t.u1 - t.u0) * n, i = n === 1 ? new Float32Array(r * (t.v1 - t.v0)) : new Uint8Array(r * (t.v1 - t.v0));
|
|
291
|
+
for (let a = t.v0; a < t.v1; a++) i.set(e.data.subarray((a * e.columns + t.u0) * n, (a * e.columns + t.u1) * n), (a - t.v0) * r);
|
|
292
|
+
return i;
|
|
293
|
+
}
|
|
294
|
+
#S(e, t, n) {
|
|
295
|
+
let r = this.#s[e], i = r.channels, a = (t.u1 - t.u0) * i;
|
|
296
|
+
for (let e = t.v0; e < t.v1; e++) r.data.set(n.subarray((e - t.v0) * a, (e - t.v0 + 1) * a), (e * r.columns + t.u0) * i);
|
|
297
|
+
let o = {
|
|
298
|
+
u: t.u0,
|
|
299
|
+
v: t.v0,
|
|
300
|
+
width: t.u1 - t.u0,
|
|
301
|
+
depth: t.v1 - t.v0
|
|
302
|
+
};
|
|
303
|
+
for (let t of [...this.#i]) t(e ? {
|
|
304
|
+
...o,
|
|
305
|
+
weights: e - 1
|
|
306
|
+
} : o);
|
|
307
|
+
}
|
|
308
|
+
#C(e, t) {
|
|
309
|
+
let n = this.#o.queue;
|
|
310
|
+
for (let r of e) {
|
|
311
|
+
let e = this.#s[r.map], i = r[t], a = {
|
|
312
|
+
u0: r.u,
|
|
313
|
+
v0: r.v,
|
|
314
|
+
u1: r.u + r.width,
|
|
315
|
+
v1: r.v + r.depth
|
|
316
|
+
};
|
|
317
|
+
n.writeTexture({
|
|
318
|
+
texture: e.texture,
|
|
319
|
+
origin: [r.u, r.v]
|
|
320
|
+
}, i, { bytesPerRow: r.width * 4 }, [r.width, r.depth]), this.#S(r.map, a, i);
|
|
321
|
+
}
|
|
322
|
+
this.#e.invalidate();
|
|
323
|
+
}
|
|
324
|
+
async undo() {
|
|
325
|
+
await this.flush();
|
|
326
|
+
let e = this.#n.pop();
|
|
327
|
+
return e ? (this.#C(e, "before"), this.#r.push(e), !0) : !1;
|
|
328
|
+
}
|
|
329
|
+
async redo() {
|
|
330
|
+
await this.flush();
|
|
331
|
+
let e = this.#r.pop();
|
|
332
|
+
return e ? (this.#C(e, "after"), this.#n.push(e), !0) : !1;
|
|
333
|
+
}
|
|
334
|
+
async flush() {
|
|
335
|
+
if (this.#w(), await this.#f, this.#p) throw this.#p;
|
|
336
|
+
}
|
|
337
|
+
onChange(e) {
|
|
338
|
+
if (typeof e != "function") throw TypeError("Invalid terrain sculpt listener; pass a function.");
|
|
339
|
+
return this.#i.add(e), () => this.#i.delete(e);
|
|
340
|
+
}
|
|
341
|
+
onDeviceRestored(e) {
|
|
342
|
+
this.#o = e.gpu ?? void 0, this.#c.clear(), this.#u.clear(), this.#l = void 0, this.#m();
|
|
343
|
+
for (let e of this.#s) this.#o.queue.writeTexture({ texture: e.texture }, e.data, { bytesPerRow: e.columns * 4 }, [e.columns, e.rows]);
|
|
344
|
+
this.#g(), this.#e.invalidate();
|
|
345
|
+
}
|
|
346
|
+
#w() {
|
|
347
|
+
if (this.disposed || !this.#o) throw new t("disposed", "This terrain sculpt was disposed; attach a new TerrainSculpt");
|
|
348
|
+
}
|
|
349
|
+
dispose() {
|
|
350
|
+
if (!this.disposed) {
|
|
351
|
+
this.disposed = !0, this.#d = void 0, this.#a?.sceneOf(this)?.removePlugin(this.name);
|
|
352
|
+
for (let e of this.#u.values()) e.destroy();
|
|
353
|
+
this.#u.clear(), this.#l?.destroy(), this.#i.clear(), this.#n.length = this.#r.length = 0, this.#a = this.#o = this.#l = void 0;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
[Symbol.dispose ?? Symbol()]() {
|
|
357
|
+
this.dispose();
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
//#endregion
|
|
361
|
+
export { s as TerrainSculpt };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
//#region ../shared/settings.js
|
|
2
|
+
var e = (e, t, n) => typeof e == "number" && e >= t && e <= n, t = (t, n, r) => Array.isArray(t) && t.length === 3 && t.every((t) => e(t, n, r)), n = (e) => e.stopKey ?? "elevation", r = (e, t, n, r, i, a, o, s, c = !0) => ({
|
|
3
|
+
name: e,
|
|
4
|
+
group: t,
|
|
5
|
+
kind: "number",
|
|
6
|
+
default: n,
|
|
7
|
+
min: r,
|
|
8
|
+
max: i,
|
|
9
|
+
step: a,
|
|
10
|
+
unit: o,
|
|
11
|
+
about: s,
|
|
12
|
+
live: c
|
|
13
|
+
}), i = (e, t, n, r, i, a, o = !0) => ({
|
|
14
|
+
name: e,
|
|
15
|
+
group: t,
|
|
16
|
+
kind: "color",
|
|
17
|
+
default: n,
|
|
18
|
+
min: r,
|
|
19
|
+
max: i,
|
|
20
|
+
step: .01,
|
|
21
|
+
unit: "",
|
|
22
|
+
about: a,
|
|
23
|
+
live: o
|
|
24
|
+
}), a = (e, t) => ({
|
|
25
|
+
...e,
|
|
26
|
+
default: null,
|
|
27
|
+
nullable: !0,
|
|
28
|
+
weather: t
|
|
29
|
+
}), o = Symbol.for("margoengine.weather-held");
|
|
30
|
+
function s(e, t, n = !0) {
|
|
31
|
+
if (typeof e != "object" || !e) return;
|
|
32
|
+
let r = e[o];
|
|
33
|
+
n ? (r || Object.defineProperty(e, o, {
|
|
34
|
+
value: r = /* @__PURE__ */ new Set(),
|
|
35
|
+
configurable: !0
|
|
36
|
+
}), r.add(t)) : r?.delete(t);
|
|
37
|
+
}
|
|
38
|
+
var c = (e, t) => JSON.stringify(e) === JSON.stringify(t);
|
|
39
|
+
function l(e) {
|
|
40
|
+
return Array.isArray(e) ? typeof e[0] == "object" ? e.map((e) => ({
|
|
41
|
+
...e,
|
|
42
|
+
color: [...e.color]
|
|
43
|
+
})) : [...e] : e;
|
|
44
|
+
}
|
|
45
|
+
function u(e) {
|
|
46
|
+
return Object.fromEntries(e.map((e) => [e.name, l(e.default)]));
|
|
47
|
+
}
|
|
48
|
+
var d = (e) => e.filter((e) => e.live), f = (e) => new Map(e.map((e) => [e.name, e]));
|
|
49
|
+
function p(r, i, a) {
|
|
50
|
+
let o = r.min ?? -Infinity, s = r.max ?? Infinity, c;
|
|
51
|
+
if (i === null) c = !!r.nullable;
|
|
52
|
+
else if (r.kind === "number") c = e(i, o, s);
|
|
53
|
+
else if (r.kind === "color") c = t(i, o, s);
|
|
54
|
+
else if (r.kind === "choice") c = r.choices.includes(i);
|
|
55
|
+
else {
|
|
56
|
+
let a = n(r);
|
|
57
|
+
c = Array.isArray(i) && i.length >= 2 && i.length <= 8 && i.every((n, r) => typeof n == "object" && !!n && e(n[a], o, s) && t(n.color, 0, 1) && (r === 0 || n[a] > i[r - 1][a]));
|
|
58
|
+
}
|
|
59
|
+
if (c) return;
|
|
60
|
+
let l = r.nullable ? r.weather ? ` or null (follow the weather's ${r.weather})` : " or null" : "", u = r.kind === "number" ? `a number from ${o} to ${s}${l}` : r.kind === "color" ? `three numbers from ${o} to ${s} (linear RGB)${l}` : r.kind === "choice" ? r.choices.map((e) => `'${e}'`).join(" or ") + l : `2 to 8 stops {${n(r)}, color}, ${n(r)} ${o} to ${s} rising, colours 0 to 1${l}`;
|
|
61
|
+
throw RangeError(`Invalid ${a} setting ${r.name}; use ${u}`);
|
|
62
|
+
}
|
|
63
|
+
function m(e, t, n, r = `the rows in @margoengine/${n}/settings`) {
|
|
64
|
+
let i = e instanceof Map ? e : f(e);
|
|
65
|
+
for (let e of Object.keys(t)) {
|
|
66
|
+
let a = i.get(e);
|
|
67
|
+
if (!a) throw TypeError(`Unknown ${n} setting ${e}; use a name from ${r}`);
|
|
68
|
+
p(a, t[e], n);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { d as a, u as c, s as i, f as l, i as n, r as o, a as r, c as s, m as t };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { type SettingRow } from './shared/settings.js';
|
|
2
|
+
import type { TerrainColors } from './colors.js';
|
|
3
|
+
/** A colour value: linear RGB. */
|
|
4
|
+
export type TerrainSettingColor = readonly [number, number, number];
|
|
5
|
+
/** One value of a setting: a number, a colour, or null where `nullable`. */
|
|
6
|
+
export type TerrainSettingValue = number | TerrainSettingColor | null;
|
|
7
|
+
/** Values by setting name; a name left out takes its default. */
|
|
8
|
+
export type TerrainSettingValues = Readonly<Record<string, TerrainSettingValue>>;
|
|
9
|
+
/** The panel a setting sits in. */
|
|
10
|
+
export type TerrainSettingGroup = 'sand' | 'ripples' | 'colors' | 'bands' | 'wet';
|
|
11
|
+
/** One control: the shared row shape with the terrain's groups. */
|
|
12
|
+
export interface TerrainSetting extends SettingRow {
|
|
13
|
+
readonly group: TerrainSettingGroup;
|
|
14
|
+
readonly default: TerrainSettingValue;
|
|
15
|
+
}
|
|
16
|
+
/** Every terrain look control, in panel order. Defaults are the values TerrainColors uses without the option. */
|
|
17
|
+
export declare const TERRAIN_SETTINGS: readonly TerrainSetting[];
|
|
18
|
+
/** The rows that can change every frame (all of them). */
|
|
19
|
+
export declare const TERRAIN_LIVE_SETTINGS: readonly TerrainSetting[];
|
|
20
|
+
/** Every setting at its default, as a fresh object to edit (a slider panel's state). */
|
|
21
|
+
export declare function terrainSettingDefaults(): Record<string, TerrainSettingValue>;
|
|
22
|
+
/**
|
|
23
|
+
* Named looks, each only values of {@link TERRAIN_SETTINGS} (a name left out keeps its default): pass one to
|
|
24
|
+
* {@link applyTerrainSettings}, or spread it under your own values.
|
|
25
|
+
*/
|
|
26
|
+
export declare const TERRAIN_LOOKS: {
|
|
27
|
+
/** Today's defaults: every row at its default, as the terrain draws with no settings. */
|
|
28
|
+
readonly natural: {};
|
|
29
|
+
/** Pale desert sand with sharp ripples and strong streaks. */
|
|
30
|
+
readonly paleDesert: {
|
|
31
|
+
readonly 'sand.color': readonly [0.62, 0.52, 0.36];
|
|
32
|
+
readonly 'sand.ripples': 1.3;
|
|
33
|
+
readonly 'sand.streaks': 1;
|
|
34
|
+
readonly 'sand.broad': 0.6;
|
|
35
|
+
};
|
|
36
|
+
/** Red desert sand with long scour bands. */
|
|
37
|
+
readonly redDesert: {
|
|
38
|
+
readonly 'sand.color': readonly [0.55, 0.3, 0.18];
|
|
39
|
+
readonly 'sand.ripples': 1;
|
|
40
|
+
readonly 'sand.broad': 1;
|
|
41
|
+
};
|
|
42
|
+
/** Dark volcanic beach sand, wetter and darker at the waterline. */
|
|
43
|
+
readonly volcanicBeach: {
|
|
44
|
+
readonly 'sand.color': readonly [0.08, 0.08, 0.09];
|
|
45
|
+
readonly 'wet.darkening': 0.45;
|
|
46
|
+
readonly 'sand.ripples': 0.5;
|
|
47
|
+
readonly 'sand.streaks': 0.3;
|
|
48
|
+
};
|
|
49
|
+
/** A salt flat: pale, nearly flat, no ripples to speak of. */
|
|
50
|
+
readonly saltFlat: {
|
|
51
|
+
readonly 'sand.color': readonly [0.8, 0.78, 0.72];
|
|
52
|
+
readonly 'sand.ripples': 0.2;
|
|
53
|
+
readonly 'sand.streaks': 0.2;
|
|
54
|
+
readonly 'sand.sorting': 0.2;
|
|
55
|
+
readonly 'wet.darkening': 0.8;
|
|
56
|
+
};
|
|
57
|
+
/** The animatedFeature family: larger colour masses, softer fine detail, a clean wet band at the waterline. */
|
|
58
|
+
readonly animatedFeature: {
|
|
59
|
+
readonly 'sand.color': readonly [0.62, 0.5, 0.34];
|
|
60
|
+
readonly 'sand.ripples': 0.6;
|
|
61
|
+
readonly 'sand.streaks': 0.5;
|
|
62
|
+
readonly 'sand.broad': 0.8;
|
|
63
|
+
readonly 'meadow.low': readonly [0.16, 0.33, 0.05];
|
|
64
|
+
readonly 'meadow.high': readonly [0.3, 0.42, 0.09];
|
|
65
|
+
readonly 'stone.color': readonly [0.3, 0.26, 0.21];
|
|
66
|
+
readonly 'wet.darkening': 0.5;
|
|
67
|
+
readonly 'wet.heightStart': -0.05;
|
|
68
|
+
readonly 'wet.heightEnd': 0.3;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
/** The name of a look in {@link TERRAIN_LOOKS}. */
|
|
72
|
+
export type TerrainLookName = keyof typeof TERRAIN_LOOKS;
|
|
73
|
+
/**
|
|
74
|
+
* Writes `values` onto a {@link TerrainColors} (a name left out takes its default) with one `setLook` call, so the
|
|
75
|
+
* terrain shows exactly that state. A row at its default draws as TerrainColors does without the option. A null
|
|
76
|
+
* `sand.windDirection` leaves the wind to whatever last set it (the weather drive, or the +x default).
|
|
77
|
+
* @throws TypeError for a name not in {@link TERRAIN_SETTINGS}, or a sand row moved on a TerrainColors built without a
|
|
78
|
+
* sand surface; RangeError for a value outside its row's range or kind, or a range whose start is not below its end.
|
|
79
|
+
* @example applyTerrainSettings(colors, { ...TERRAIN_LOOKS.paleDesert, 'sand.windDirection': 45 });
|
|
80
|
+
*/
|
|
81
|
+
export declare function applyTerrainSettings(colors: TerrainColors, values?: TerrainSettingValues): void;
|
package/dist/settings.js
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { a as e, c as t, l as n, n as r, o as i, r as a, s as o, t as s } from "./settings-B9BSdnhD.js";
|
|
2
|
+
//#region src/settings.ts
|
|
3
|
+
var c = (e, t, n, r, a, o, s, c) => i(e, t, n, r, a, o, s, c), l = (e, t, n, i) => r(e, t, n, 0, 1, i), u = (e, t) => ({
|
|
4
|
+
...e,
|
|
5
|
+
default: null,
|
|
6
|
+
nullable: !0,
|
|
7
|
+
about: t
|
|
8
|
+
}), d = [
|
|
9
|
+
l("sand.color", "sand", [
|
|
10
|
+
.5,
|
|
11
|
+
.42,
|
|
12
|
+
.29
|
|
13
|
+
], "Beach and dune sand colour: dry sand has an albedo of about 0.4."),
|
|
14
|
+
{ ...a(c("sand.windDirection", "sand", 0, 0, 360, 1, "degrees", "The way the wind blows over the sand: 0 toward +x, 90 toward +z. Null follows the weather."), "windDirection") },
|
|
15
|
+
c("sand.ripples", "ripples", 1, 0, 2, .01, "", "Ripple relief: 0 flat, 1 the real shape (height 1/15 of the spacing), 2 twice as steep."),
|
|
16
|
+
c("sand.ripple", "ripples", .1, .02, 1, .005, "m", "Ripple spacing: impact ripples of fine to medium sand are 5 to 20 cm apart."),
|
|
17
|
+
c("sand.streaks", "ripples", 1, 0, 1, .01, "", "Streak contrast along the wind: albedo varies by up to 8% either way at 1."),
|
|
18
|
+
c("sand.sorting", "ripples", 1, 0, 1, .01, "", "Sorting by slope: lee slip faces paler, windward faces darker."),
|
|
19
|
+
c("sand.broad", "ripples", 0, 0, 1, .01, "", "Broad scour bands along the wind (8 to 15 m wide) that stay at every distance."),
|
|
20
|
+
l("meadow.low", "colors", [
|
|
21
|
+
.133,
|
|
22
|
+
.263,
|
|
23
|
+
.033
|
|
24
|
+
], "Meadow colour at its lowest."),
|
|
25
|
+
l("meadow.high", "colors", [
|
|
26
|
+
.274,
|
|
27
|
+
.342,
|
|
28
|
+
.064
|
|
29
|
+
], "Meadow colour at its highest."),
|
|
30
|
+
l("stone.color", "colors", [
|
|
31
|
+
.253,
|
|
32
|
+
.223,
|
|
33
|
+
.187
|
|
34
|
+
], "Rock colour, above the stone height and on steep slopes."),
|
|
35
|
+
c("shore.start", "bands", .3, -1e3, 1e4, .01, "m", "World height where the beach starts to give way to meadow."),
|
|
36
|
+
c("shore.end", "bands", 1.5, -1e3, 1e4, .01, "m", "World height above which there is no sand. Keep it above shore.start."),
|
|
37
|
+
u(c("meadow.heightStart", "bands", 0, -1e3, 1e4, .01, "m", ""), "World height where the low meadow colour starts to give way to the high one; null is the mesh's lowest point."),
|
|
38
|
+
u(c("meadow.heightEnd", "bands", 0, -1e3, 1e4, .01, "m", ""), "World height of the high meadow colour; null is the mesh's highest point. Keep it above meadow.heightStart."),
|
|
39
|
+
u(c("stone.heightStart", "bands", 0, -1e3, 1e4, .01, "m", ""), "World height where meadow starts to give way to rock; null is above the mesh's highest point (only slopes are stone)."),
|
|
40
|
+
u(c("stone.heightEnd", "bands", 0, -1e3, 1e4, .01, "m", ""), "World height above which all is rock; null as stone.heightStart. Keep it above stone.heightStart."),
|
|
41
|
+
c("stone.normalStart", "bands", .75, 0, 1, .005, "", "Surface normal Y (0 vertical, 1 flat) below which steep ground starts to turn to rock: 0.75 is 41 degrees."),
|
|
42
|
+
c("stone.normalEnd", "bands", .85, 0, 1, .005, "", "Surface normal Y above which ground is meadow again: 0.85 is 32 degrees. Keep it above stone.normalStart."),
|
|
43
|
+
c("wet.darkening", "wet", .6, 0, 1, .01, "", "Albedo of fully wet ground (1 is no darkening); wet ground is also up to 40% smoother."),
|
|
44
|
+
c("wet.heightStart", "wet", -.1, -1e3, 1e4, .01, "m", "World height where the wet band starts to dry, just above sea level."),
|
|
45
|
+
c("wet.heightEnd", "wet", .4, -1e3, 1e4, .01, "m", "World height above which the ground is dry. Keep it above wet.heightStart."),
|
|
46
|
+
c("wet.dryTime", "wet", 900, 1, 604800, 1, "s", "With a wetness map: seconds over which sand the water has left dries to 1/e of its moisture."),
|
|
47
|
+
c("wet.glossTime", "wet", 20, .1, 3600, .1, "s", "With a wetness map: seconds over which the glossy water film on sand the water has left drains to 1/e.")
|
|
48
|
+
], f = e(d), p = n(d);
|
|
49
|
+
function m() {
|
|
50
|
+
return t(d);
|
|
51
|
+
}
|
|
52
|
+
var h = {
|
|
53
|
+
natural: {},
|
|
54
|
+
paleDesert: {
|
|
55
|
+
"sand.color": [
|
|
56
|
+
.62,
|
|
57
|
+
.52,
|
|
58
|
+
.36
|
|
59
|
+
],
|
|
60
|
+
"sand.ripples": 1.3,
|
|
61
|
+
"sand.streaks": 1,
|
|
62
|
+
"sand.broad": .6
|
|
63
|
+
},
|
|
64
|
+
redDesert: {
|
|
65
|
+
"sand.color": [
|
|
66
|
+
.55,
|
|
67
|
+
.3,
|
|
68
|
+
.18
|
|
69
|
+
],
|
|
70
|
+
"sand.ripples": 1,
|
|
71
|
+
"sand.broad": 1
|
|
72
|
+
},
|
|
73
|
+
volcanicBeach: {
|
|
74
|
+
"sand.color": [
|
|
75
|
+
.08,
|
|
76
|
+
.08,
|
|
77
|
+
.09
|
|
78
|
+
],
|
|
79
|
+
"wet.darkening": .45,
|
|
80
|
+
"sand.ripples": .5,
|
|
81
|
+
"sand.streaks": .3
|
|
82
|
+
},
|
|
83
|
+
saltFlat: {
|
|
84
|
+
"sand.color": [
|
|
85
|
+
.8,
|
|
86
|
+
.78,
|
|
87
|
+
.72
|
|
88
|
+
],
|
|
89
|
+
"sand.ripples": .2,
|
|
90
|
+
"sand.streaks": .2,
|
|
91
|
+
"sand.sorting": .2,
|
|
92
|
+
"wet.darkening": .8
|
|
93
|
+
},
|
|
94
|
+
animatedFeature: {
|
|
95
|
+
"sand.color": [
|
|
96
|
+
.62,
|
|
97
|
+
.5,
|
|
98
|
+
.34
|
|
99
|
+
],
|
|
100
|
+
"sand.ripples": .6,
|
|
101
|
+
"sand.streaks": .5,
|
|
102
|
+
"sand.broad": .8,
|
|
103
|
+
"meadow.low": [
|
|
104
|
+
.16,
|
|
105
|
+
.33,
|
|
106
|
+
.05
|
|
107
|
+
],
|
|
108
|
+
"meadow.high": [
|
|
109
|
+
.3,
|
|
110
|
+
.42,
|
|
111
|
+
.09
|
|
112
|
+
],
|
|
113
|
+
"stone.color": [
|
|
114
|
+
.3,
|
|
115
|
+
.26,
|
|
116
|
+
.21
|
|
117
|
+
],
|
|
118
|
+
"wet.darkening": .5,
|
|
119
|
+
"wet.heightStart": -.05,
|
|
120
|
+
"wet.heightEnd": .3
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
function g(e, t = {}) {
|
|
124
|
+
s(p, t, "terrain", "TERRAIN_SETTINGS in @margoengine/terrain/settings");
|
|
125
|
+
let n = (e) => e in t ? t[e] : p.get(e).default, r = (e, t) => n(e) === null && n(t) === null ? null : [n(e), n(t)], i = d.some((e) => e.name.startsWith("sand.") && e.name !== "sand.color" && e.name in t && !o(t[e.name], e.default)), a = n("sand.windDirection"), c = {
|
|
126
|
+
sand: n("sand.color"),
|
|
127
|
+
meadow: [n("meadow.low"), n("meadow.high")],
|
|
128
|
+
stone: n("stone.color"),
|
|
129
|
+
shore: [n("shore.start"), n("shore.end")],
|
|
130
|
+
meadowHeight: r("meadow.heightStart", "meadow.heightEnd"),
|
|
131
|
+
stoneHeight: r("stone.heightStart", "stone.heightEnd"),
|
|
132
|
+
stoneNormal: [n("stone.normalStart"), n("stone.normalEnd")],
|
|
133
|
+
wetHeight: [n("wet.heightStart"), n("wet.heightEnd")],
|
|
134
|
+
wetDarkening: n("wet.darkening"),
|
|
135
|
+
wetDryTime: n("wet.dryTime"),
|
|
136
|
+
wetGlossTime: n("wet.glossTime")
|
|
137
|
+
};
|
|
138
|
+
if (i || a !== null || e.sandSurfaceOn) {
|
|
139
|
+
let e = (a ?? 0) * Math.PI / 180;
|
|
140
|
+
c.sandSurface = {
|
|
141
|
+
...a === null ? {} : { wind: [Math.cos(e), Math.sin(e)] },
|
|
142
|
+
ripple: n("sand.ripple"),
|
|
143
|
+
ripples: n("sand.ripples"),
|
|
144
|
+
streaks: n("sand.streaks"),
|
|
145
|
+
sorting: n("sand.sorting"),
|
|
146
|
+
broad: n("sand.broad")
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
e.setLook(c);
|
|
150
|
+
}
|
|
151
|
+
//#endregion
|
|
152
|
+
export { f as TERRAIN_LIVE_SETTINGS, h as TERRAIN_LOOKS, d as TERRAIN_SETTINGS, g as applyTerrainSettings, m as terrainSettingDefaults };
|