@wave3d/core 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 +21 -0
- package/README.md +60 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/config/model.d.ts +240 -0
- package/dist/config/model.js +496 -0
- package/dist/config/model.js.map +1 -0
- package/dist/core-loader.d.ts +10 -0
- package/dist/core-loader.js +12 -0
- package/dist/core-loader.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -0
- package/dist/presets.d.ts +8 -0
- package/dist/presets.js +544 -0
- package/dist/presets.js.map +1 -0
- package/dist/renderer/WaveGeometry.d.ts +31 -0
- package/dist/renderer/WaveGeometry.js +92 -0
- package/dist/renderer/WaveGeometry.js.map +1 -0
- package/dist/renderer/WaveRenderer.d.ts +232 -0
- package/dist/renderer/WaveRenderer.js +1118 -0
- package/dist/renderer/WaveRenderer.js.map +1 -0
- package/dist/renderer/heroPalette.d.ts +10 -0
- package/dist/renderer/heroPalette.js +34 -0
- package/dist/renderer/heroPalette.js.map +1 -0
- package/dist/renderer/index.d.ts +4 -0
- package/dist/renderer/index.js +4 -0
- package/dist/renderer/palette.d.ts +67 -0
- package/dist/renderer/palette.js +535 -0
- package/dist/renderer/palette.js.map +1 -0
- package/dist/renderer/shaders.js +545 -0
- package/dist/renderer/shaders.js.map +1 -0
- package/dist/shell/createWave.d.ts +58 -0
- package/dist/shell/createWave.js +161 -0
- package/dist/shell/createWave.js.map +1 -0
- package/dist/shell/poster.js +64 -0
- package/dist/shell/poster.js.map +1 -0
- package/dist/shell/probe.js +34 -0
- package/dist/shell/probe.js.map +1 -0
- package/dist/standalone/wave3d.standalone.js +13507 -0
- package/dist/standalone.d.ts +13 -0
- package/dist/standalone.js +17 -0
- package/dist/standalone.js.map +1 -0
- package/dist/studio/StudioWaveRenderer.d.ts +187 -0
- package/dist/studio/StudioWaveRenderer.js +905 -0
- package/dist/studio/StudioWaveRenderer.js.map +1 -0
- package/dist/studio/index.d.ts +3 -0
- package/dist/studio/index.js +3 -0
- package/dist/studio/randomize.d.ts +28 -0
- package/dist/studio/randomize.js +264 -0
- package/dist/studio/randomize.js.map +1 -0
- package/dist/util/base64.js +14 -0
- package/dist/util/base64.js.map +1 -0
- package/dist/util/math.js +18 -0
- package/dist/util/math.js.map +1 -0
- package/package.json +76 -0
- package/skills/wave3d/SKILL.md +158 -0
package/dist/presets.js
ADDED
|
@@ -0,0 +1,544 @@
|
|
|
1
|
+
import { createDefaultConfig, makeStops, makeWaveSpread } from "./config/model.js";
|
|
2
|
+
//#region src/presets.ts
|
|
3
|
+
/**
|
|
4
|
+
* Built-in presets: each a complete studio config (scene + one or more waves) in the wave model.
|
|
5
|
+
* IP-clean — no copyrighted assets. The studio layers its own extra presets (and its historical
|
|
6
|
+
* "Stripe *" display names) on top; see apps/studio/src/presets.ts.
|
|
7
|
+
*/
|
|
8
|
+
const RAD = 180 / Math.PI;
|
|
9
|
+
/** Build a preset from a set of wave parameters. rotation/hue are given in RADIANS and
|
|
10
|
+
* converted to degrees. All presets are solid-theme, so they reuse the hero palette +
|
|
11
|
+
* surfaceColor fibers (600/0.2) and sheen 0, like the hero. camTarget/zoom frame the
|
|
12
|
+
* wave (we pan the look-at to centre each one). */
|
|
13
|
+
function buildPreset(p) {
|
|
14
|
+
const c = createDefaultConfig();
|
|
15
|
+
const w = c.waves[0];
|
|
16
|
+
w.speed = p.speed;
|
|
17
|
+
w.colorContrast = p.contrast;
|
|
18
|
+
w.colorSaturation = p.sat;
|
|
19
|
+
w.hueShift = p.hueRad * RAD;
|
|
20
|
+
w.displaceFrequency = {
|
|
21
|
+
x: p.dispX,
|
|
22
|
+
y: p.dispZ
|
|
23
|
+
};
|
|
24
|
+
w.displaceAmount = p.dispAmt;
|
|
25
|
+
w.position = {
|
|
26
|
+
x: p.pos[0],
|
|
27
|
+
y: p.pos[1],
|
|
28
|
+
z: p.pos[2]
|
|
29
|
+
};
|
|
30
|
+
w.rotation = {
|
|
31
|
+
x: p.rotRad[0] * RAD,
|
|
32
|
+
y: p.rotRad[1] * RAD,
|
|
33
|
+
z: p.rotRad[2] * RAD
|
|
34
|
+
};
|
|
35
|
+
w.scale = {
|
|
36
|
+
x: p.scale[0],
|
|
37
|
+
y: p.scale[1],
|
|
38
|
+
z: p.scale[2]
|
|
39
|
+
};
|
|
40
|
+
w.twistFrequency = {
|
|
41
|
+
x: p.twF[0],
|
|
42
|
+
y: p.twF[1],
|
|
43
|
+
z: p.twF[2]
|
|
44
|
+
};
|
|
45
|
+
w.twistPower = {
|
|
46
|
+
x: p.twP[0],
|
|
47
|
+
y: p.twP[1],
|
|
48
|
+
z: p.twP[2]
|
|
49
|
+
};
|
|
50
|
+
w.creaseLight = p.glow[0];
|
|
51
|
+
w.creaseSharpness = p.glow[1];
|
|
52
|
+
w.creaseSoftness = p.glow[2];
|
|
53
|
+
if (p.noiseBands) w.noiseBands = p.noiseBands;
|
|
54
|
+
if (p.twistMotion) w.twistMotion = true;
|
|
55
|
+
c.grain = p.grain;
|
|
56
|
+
c.blur = p.blur;
|
|
57
|
+
c.cameraPosition = {
|
|
58
|
+
x: 100,
|
|
59
|
+
y: 0,
|
|
60
|
+
z: 5e3
|
|
61
|
+
};
|
|
62
|
+
c.cameraTarget = {
|
|
63
|
+
x: p.camTarget[0],
|
|
64
|
+
y: p.camTarget[1],
|
|
65
|
+
z: 0
|
|
66
|
+
};
|
|
67
|
+
c.cameraZoom = p.zoom;
|
|
68
|
+
return c;
|
|
69
|
+
}
|
|
70
|
+
/** Presets: each a complete studio config (scene + one or more waves) in the wave model. */
|
|
71
|
+
const PRESETS = {
|
|
72
|
+
Hero: () => buildPreset({
|
|
73
|
+
speed: .04,
|
|
74
|
+
contrast: 1,
|
|
75
|
+
sat: 1,
|
|
76
|
+
hueRad: -.00159265,
|
|
77
|
+
dispX: .005831,
|
|
78
|
+
dispZ: .016001,
|
|
79
|
+
dispAmt: -7.821,
|
|
80
|
+
pos: [
|
|
81
|
+
380,
|
|
82
|
+
-301.7,
|
|
83
|
+
-11.1
|
|
84
|
+
],
|
|
85
|
+
rotRad: [
|
|
86
|
+
-.44959,
|
|
87
|
+
-.11759,
|
|
88
|
+
1.874407
|
|
89
|
+
],
|
|
90
|
+
scale: [
|
|
91
|
+
9,
|
|
92
|
+
8,
|
|
93
|
+
5
|
|
94
|
+
],
|
|
95
|
+
twF: [
|
|
96
|
+
-.65,
|
|
97
|
+
.41,
|
|
98
|
+
-.58
|
|
99
|
+
],
|
|
100
|
+
twP: [
|
|
101
|
+
3.63,
|
|
102
|
+
.7,
|
|
103
|
+
3.95
|
|
104
|
+
],
|
|
105
|
+
glow: [
|
|
106
|
+
1.98,
|
|
107
|
+
.806,
|
|
108
|
+
.834
|
|
109
|
+
],
|
|
110
|
+
grain: 1.1,
|
|
111
|
+
blur: .02,
|
|
112
|
+
zoom: .55,
|
|
113
|
+
camTarget: [-420, -200]
|
|
114
|
+
}),
|
|
115
|
+
"Wave 2": () => createDefaultConfig(),
|
|
116
|
+
"Wave 3": () => buildPreset({
|
|
117
|
+
speed: .08,
|
|
118
|
+
contrast: 1,
|
|
119
|
+
sat: 1,
|
|
120
|
+
hueRad: -.00159265,
|
|
121
|
+
dispX: .005831,
|
|
122
|
+
dispZ: .016001,
|
|
123
|
+
dispAmt: -7.821,
|
|
124
|
+
pos: [
|
|
125
|
+
-200.7,
|
|
126
|
+
-65.4,
|
|
127
|
+
-11.1
|
|
128
|
+
],
|
|
129
|
+
rotRad: [
|
|
130
|
+
-2.875593,
|
|
131
|
+
3.095927,
|
|
132
|
+
-2.925927
|
|
133
|
+
],
|
|
134
|
+
scale: [
|
|
135
|
+
3,
|
|
136
|
+
3,
|
|
137
|
+
3
|
|
138
|
+
],
|
|
139
|
+
twF: [
|
|
140
|
+
.059,
|
|
141
|
+
.32,
|
|
142
|
+
-.397
|
|
143
|
+
],
|
|
144
|
+
twP: [
|
|
145
|
+
3.63,
|
|
146
|
+
.44,
|
|
147
|
+
5.99
|
|
148
|
+
],
|
|
149
|
+
glow: [
|
|
150
|
+
3.86,
|
|
151
|
+
.923,
|
|
152
|
+
1
|
|
153
|
+
],
|
|
154
|
+
grain: 1.2,
|
|
155
|
+
blur: .02,
|
|
156
|
+
zoom: 1.3,
|
|
157
|
+
camTarget: [-104, 13]
|
|
158
|
+
}),
|
|
159
|
+
"Wave 4": () => buildPreset({
|
|
160
|
+
speed: .0525,
|
|
161
|
+
contrast: .969,
|
|
162
|
+
sat: 1.383,
|
|
163
|
+
hueRad: .0376991,
|
|
164
|
+
dispX: .005,
|
|
165
|
+
dispZ: .0212,
|
|
166
|
+
dispAmt: 6.68,
|
|
167
|
+
pos: [
|
|
168
|
+
206.1,
|
|
169
|
+
-438,
|
|
170
|
+
-11.1
|
|
171
|
+
],
|
|
172
|
+
rotRad: [
|
|
173
|
+
-.666018,
|
|
174
|
+
-.031416,
|
|
175
|
+
.779115
|
|
176
|
+
],
|
|
177
|
+
scale: [
|
|
178
|
+
6.0501,
|
|
179
|
+
8.3983,
|
|
180
|
+
6.9854
|
|
181
|
+
],
|
|
182
|
+
twF: [
|
|
183
|
+
-.424,
|
|
184
|
+
.024,
|
|
185
|
+
-1.312
|
|
186
|
+
],
|
|
187
|
+
twP: [
|
|
188
|
+
1.81,
|
|
189
|
+
.94,
|
|
190
|
+
4.76
|
|
191
|
+
],
|
|
192
|
+
glow: [
|
|
193
|
+
1.55,
|
|
194
|
+
1.174,
|
|
195
|
+
.972
|
|
196
|
+
],
|
|
197
|
+
grain: .576,
|
|
198
|
+
blur: 0,
|
|
199
|
+
zoom: .9316,
|
|
200
|
+
camTarget: [194, -402],
|
|
201
|
+
twistMotion: true,
|
|
202
|
+
noiseBands: [{
|
|
203
|
+
startX: .856,
|
|
204
|
+
endX: 1,
|
|
205
|
+
startY: 0,
|
|
206
|
+
endY: .913,
|
|
207
|
+
feather: .5,
|
|
208
|
+
strength: .346,
|
|
209
|
+
frequency: 1018,
|
|
210
|
+
colorAttenuation: 1,
|
|
211
|
+
parabolaPower: 0
|
|
212
|
+
}, {
|
|
213
|
+
startX: .038,
|
|
214
|
+
endX: .538,
|
|
215
|
+
startY: .105,
|
|
216
|
+
endY: 1,
|
|
217
|
+
feather: .3315,
|
|
218
|
+
strength: 1,
|
|
219
|
+
frequency: 190,
|
|
220
|
+
colorAttenuation: 0,
|
|
221
|
+
parabolaPower: 2.11
|
|
222
|
+
}]
|
|
223
|
+
}),
|
|
224
|
+
Wireframe: () => {
|
|
225
|
+
const c = createDefaultConfig();
|
|
226
|
+
c.waves[0].theme = "wireframe";
|
|
227
|
+
c.grain = 1.2;
|
|
228
|
+
c.background = "#0a2540";
|
|
229
|
+
c.transparentBackground = false;
|
|
230
|
+
return c;
|
|
231
|
+
},
|
|
232
|
+
"Neon Dark Multistrand": () => {
|
|
233
|
+
const c = createDefaultConfig();
|
|
234
|
+
const w = c.waves[0];
|
|
235
|
+
w.theme = "wireframe";
|
|
236
|
+
w.blendMode = "additive";
|
|
237
|
+
w.palette = makeStops([
|
|
238
|
+
"#00f5d4",
|
|
239
|
+
"#00bbf9",
|
|
240
|
+
"#9b5de5",
|
|
241
|
+
"#f15bb5",
|
|
242
|
+
"#fee440"
|
|
243
|
+
]);
|
|
244
|
+
w.creaseLight = 1;
|
|
245
|
+
c.background = "#05060c";
|
|
246
|
+
c.transparentBackground = false;
|
|
247
|
+
c.waves = makeWaveSpread(w, 3);
|
|
248
|
+
c.waveCount = 3;
|
|
249
|
+
return c;
|
|
250
|
+
},
|
|
251
|
+
"Mesh Gradient": () => {
|
|
252
|
+
const c = PRESETS["Hero"]();
|
|
253
|
+
const w = c.waves[0];
|
|
254
|
+
w.gradientType = "mesh";
|
|
255
|
+
w.meshGradientPoints = [
|
|
256
|
+
{
|
|
257
|
+
color: "#0a84ff",
|
|
258
|
+
x: .06,
|
|
259
|
+
y: .9,
|
|
260
|
+
influence: .68
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
color: "#64d2ff",
|
|
264
|
+
x: .88,
|
|
265
|
+
y: .92,
|
|
266
|
+
influence: .72
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
color: "#bf5af2",
|
|
270
|
+
x: .5,
|
|
271
|
+
y: .64,
|
|
272
|
+
influence: .58
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
color: "#ff375f",
|
|
276
|
+
x: .1,
|
|
277
|
+
y: .14,
|
|
278
|
+
influence: .7
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
color: "#ff9f0a",
|
|
282
|
+
x: .84,
|
|
283
|
+
y: .12,
|
|
284
|
+
influence: .74
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
color: "#30d158",
|
|
288
|
+
x: .94,
|
|
289
|
+
y: .5,
|
|
290
|
+
influence: .54
|
|
291
|
+
}
|
|
292
|
+
];
|
|
293
|
+
w.meshGradientSoftness = .68;
|
|
294
|
+
w.blendMode = "normal";
|
|
295
|
+
w.hueShift = 0;
|
|
296
|
+
w.colorContrast = 1.06;
|
|
297
|
+
w.colorSaturation = 1.12;
|
|
298
|
+
w.fiberStrength = .14;
|
|
299
|
+
c.grain = .3;
|
|
300
|
+
c.blur = .008;
|
|
301
|
+
c.background = "#070914";
|
|
302
|
+
c.backgroundMode = "color";
|
|
303
|
+
c.transparentBackground = false;
|
|
304
|
+
return c;
|
|
305
|
+
},
|
|
306
|
+
"Solar Bloom": () => {
|
|
307
|
+
const c = PRESETS["Hero"]();
|
|
308
|
+
const w = c.waves[0];
|
|
309
|
+
w.usePaletteTexture = false;
|
|
310
|
+
w.gradientType = "radial";
|
|
311
|
+
w.gradientShift = .14;
|
|
312
|
+
w.palette = [
|
|
313
|
+
{
|
|
314
|
+
color: "#fff3c4",
|
|
315
|
+
pos: 0
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
color: "#ffd166",
|
|
319
|
+
pos: .22
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
color: "#ff8c42",
|
|
323
|
+
pos: .42
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
color: "#ff5d8f",
|
|
327
|
+
pos: .62
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
color: "#a64dff",
|
|
331
|
+
pos: .82
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
color: "#241246",
|
|
335
|
+
pos: 1
|
|
336
|
+
}
|
|
337
|
+
];
|
|
338
|
+
w.blendMode = "normal";
|
|
339
|
+
w.hueShift = 0;
|
|
340
|
+
w.colorContrast = 1.05;
|
|
341
|
+
w.colorSaturation = 1.18;
|
|
342
|
+
w.fiberStrength = .12;
|
|
343
|
+
c.grain = .3;
|
|
344
|
+
c.blur = .01;
|
|
345
|
+
c.background = "#0a0714";
|
|
346
|
+
c.backgroundMode = "gradient";
|
|
347
|
+
c.backgroundGradientType = "radial";
|
|
348
|
+
c.backgroundGradientSource = "stops";
|
|
349
|
+
c.backgroundPalette = makeStops(["#2a1330", "#08040f"]);
|
|
350
|
+
c.transparentBackground = false;
|
|
351
|
+
return c;
|
|
352
|
+
},
|
|
353
|
+
Holographic: () => {
|
|
354
|
+
const c = PRESETS["Hero"]();
|
|
355
|
+
const w = c.waves[0];
|
|
356
|
+
w.usePaletteTexture = false;
|
|
357
|
+
w.gradientType = "conic";
|
|
358
|
+
w.gradientShift = .08;
|
|
359
|
+
w.palette = [
|
|
360
|
+
{
|
|
361
|
+
color: "#8ef6e4",
|
|
362
|
+
pos: 0
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
color: "#6ec3ff",
|
|
366
|
+
pos: .18
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
color: "#9b8cff",
|
|
370
|
+
pos: .36
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
color: "#ff8ad8",
|
|
374
|
+
pos: .54
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
color: "#ffd98e",
|
|
378
|
+
pos: .72
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
color: "#a0f0c8",
|
|
382
|
+
pos: .88
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
color: "#8ef6e4",
|
|
386
|
+
pos: 1
|
|
387
|
+
}
|
|
388
|
+
];
|
|
389
|
+
w.blendMode = "normal";
|
|
390
|
+
w.hueShift = 0;
|
|
391
|
+
w.colorContrast = 1.04;
|
|
392
|
+
w.colorSaturation = 1.12;
|
|
393
|
+
w.fiberStrength = .12;
|
|
394
|
+
c.grain = .28;
|
|
395
|
+
c.blur = .01;
|
|
396
|
+
c.background = "#05060c";
|
|
397
|
+
c.backgroundMode = "gradient";
|
|
398
|
+
c.backgroundGradientType = "linear";
|
|
399
|
+
c.backgroundGradientAngle = 135;
|
|
400
|
+
c.backgroundGradientSource = "stops";
|
|
401
|
+
c.backgroundPalette = makeStops(["#04121a", "#0a0518"]);
|
|
402
|
+
c.transparentBackground = false;
|
|
403
|
+
return c;
|
|
404
|
+
},
|
|
405
|
+
Aurora: () => {
|
|
406
|
+
const c = PRESETS["Hero"]();
|
|
407
|
+
const w = c.waves[0];
|
|
408
|
+
w.gradientType = "mesh";
|
|
409
|
+
w.meshGradientPoints = [
|
|
410
|
+
{
|
|
411
|
+
color: "#0a1f3c",
|
|
412
|
+
x: .08,
|
|
413
|
+
y: .12,
|
|
414
|
+
influence: .62
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
color: "#1fddb0",
|
|
418
|
+
x: .3,
|
|
419
|
+
y: .7,
|
|
420
|
+
influence: .78
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
color: "#57f5a3",
|
|
424
|
+
x: .58,
|
|
425
|
+
y: .86,
|
|
426
|
+
influence: .7
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
color: "#3a86ff",
|
|
430
|
+
x: .82,
|
|
431
|
+
y: .55,
|
|
432
|
+
influence: .62
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
color: "#a15cff",
|
|
436
|
+
x: .5,
|
|
437
|
+
y: .32,
|
|
438
|
+
influence: .7
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
color: "#071433",
|
|
442
|
+
x: .92,
|
|
443
|
+
y: .08,
|
|
444
|
+
influence: .6
|
|
445
|
+
}
|
|
446
|
+
];
|
|
447
|
+
w.meshGradientSoftness = .72;
|
|
448
|
+
w.blendMode = "normal";
|
|
449
|
+
w.hueShift = 0;
|
|
450
|
+
w.colorContrast = 1.05;
|
|
451
|
+
w.colorSaturation = 1.18;
|
|
452
|
+
w.fiberStrength = .12;
|
|
453
|
+
c.grain = .3;
|
|
454
|
+
c.blur = .008;
|
|
455
|
+
c.background = "#03060f";
|
|
456
|
+
c.backgroundMode = "gradient";
|
|
457
|
+
c.backgroundGradientType = "mesh";
|
|
458
|
+
c.backgroundMeshPoints = [
|
|
459
|
+
{
|
|
460
|
+
color: "#02040c",
|
|
461
|
+
x: .15,
|
|
462
|
+
y: .85,
|
|
463
|
+
influence: .7
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
color: "#08243a",
|
|
467
|
+
x: .5,
|
|
468
|
+
y: .5,
|
|
469
|
+
influence: .75
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
color: "#0a0f2e",
|
|
473
|
+
x: .85,
|
|
474
|
+
y: .7,
|
|
475
|
+
influence: .7
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
color: "#04121a",
|
|
479
|
+
x: .7,
|
|
480
|
+
y: .2,
|
|
481
|
+
influence: .6
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
color: "#000208",
|
|
485
|
+
x: .12,
|
|
486
|
+
y: .12,
|
|
487
|
+
influence: .6
|
|
488
|
+
}
|
|
489
|
+
];
|
|
490
|
+
c.backgroundMeshSoftness = .75;
|
|
491
|
+
c.transparentBackground = false;
|
|
492
|
+
return c;
|
|
493
|
+
},
|
|
494
|
+
Palestine: () => {
|
|
495
|
+
const c = PRESETS["Hero"]();
|
|
496
|
+
const w = c.waves[0];
|
|
497
|
+
w.paletteSource = "palestine";
|
|
498
|
+
w.blendMode = "normal";
|
|
499
|
+
w.hueShift = 0;
|
|
500
|
+
w.colorContrast = 1;
|
|
501
|
+
w.colorSaturation = 1;
|
|
502
|
+
c.grain = .35;
|
|
503
|
+
c.background = "#f2efe8";
|
|
504
|
+
c.transparentBackground = true;
|
|
505
|
+
return c;
|
|
506
|
+
},
|
|
507
|
+
"Vaporwave Sunset": () => {
|
|
508
|
+
const c = PRESETS["Hero"]();
|
|
509
|
+
const w = c.waves[0];
|
|
510
|
+
w.position.x = 525;
|
|
511
|
+
w.rotation.x = -.64 * RAD;
|
|
512
|
+
w.rotation.z = 1.68 * RAD;
|
|
513
|
+
w.paletteSource = "vaporwave";
|
|
514
|
+
w.blendMode = "normal";
|
|
515
|
+
w.hueShift = 0;
|
|
516
|
+
w.colorContrast = 1.08;
|
|
517
|
+
w.colorSaturation = 1.15;
|
|
518
|
+
w.creaseLight = 1.25;
|
|
519
|
+
c.cameraZoom = 1.1;
|
|
520
|
+
c.cameraTarget = {
|
|
521
|
+
x: 150,
|
|
522
|
+
y: 360,
|
|
523
|
+
z: 0
|
|
524
|
+
};
|
|
525
|
+
c.background = "#09051f";
|
|
526
|
+
c.transparentBackground = false;
|
|
527
|
+
return c;
|
|
528
|
+
},
|
|
529
|
+
Kaleidoscope: () => {
|
|
530
|
+
const c = PRESETS["Wave 3"]();
|
|
531
|
+
const w = c.waves[0];
|
|
532
|
+
w.paletteSource = "kaleidoscope";
|
|
533
|
+
w.blendMode = "normal";
|
|
534
|
+
w.hueShift = 0;
|
|
535
|
+
w.colorContrast = 1.05;
|
|
536
|
+
w.colorSaturation = 1.12;
|
|
537
|
+
c.grain = .5;
|
|
538
|
+
return c;
|
|
539
|
+
}
|
|
540
|
+
};
|
|
541
|
+
//#endregion
|
|
542
|
+
export { PRESETS };
|
|
543
|
+
|
|
544
|
+
//# sourceMappingURL=presets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presets.js","names":[],"sources":["../src/presets.ts"],"sourcesContent":["/**\n * Built-in presets: each a complete studio config (scene + one or more waves) in the wave model.\n * IP-clean — no copyrighted assets. The studio layers its own extra presets (and its historical\n * \"Stripe *\" display names) on top; see apps/studio/src/presets.ts.\n */\nimport { createDefaultConfig, makeStops, makeWaveSpread } from \"./config/model\";\nimport type { StudioConfig, NoiseBand } from \"./config/model\";\n\nconst RAD = 180 / Math.PI;\n\n/** Build a preset from a set of wave parameters. rotation/hue are given in RADIANS and\n * converted to degrees. All presets are solid-theme, so they reuse the hero palette +\n * surfaceColor fibers (600/0.2) and sheen 0, like the hero. camTarget/zoom frame the\n * wave (we pan the look-at to centre each one). */\nfunction buildPreset(p: {\n speed: number;\n contrast: number;\n sat: number;\n hueRad: number;\n dispX: number;\n dispZ: number;\n dispAmt: number;\n pos: [number, number, number];\n rotRad: [number, number, number];\n scale: [number, number, number];\n twF: [number, number, number];\n twP: [number, number, number];\n glow: [number, number, number];\n grain: number;\n blur: number;\n zoom: number;\n camTarget: [number, number];\n noiseBands?: NoiseBand[];\n twistMotion?: boolean;\n}): StudioConfig {\n const c = createDefaultConfig();\n const w = c.waves[0];\n w.speed = p.speed;\n w.colorContrast = p.contrast;\n w.colorSaturation = p.sat;\n w.hueShift = p.hueRad * RAD;\n w.displaceFrequency = { x: p.dispX, y: p.dispZ };\n w.displaceAmount = p.dispAmt;\n w.position = { x: p.pos[0], y: p.pos[1], z: p.pos[2] };\n w.rotation = { x: p.rotRad[0] * RAD, y: p.rotRad[1] * RAD, z: p.rotRad[2] * RAD };\n w.scale = { x: p.scale[0], y: p.scale[1], z: p.scale[2] };\n w.twistFrequency = { x: p.twF[0], y: p.twF[1], z: p.twF[2] };\n w.twistPower = { x: p.twP[0], y: p.twP[1], z: p.twP[2] };\n w.creaseLight = p.glow[0];\n w.creaseSharpness = p.glow[1];\n w.creaseSoftness = p.glow[2];\n if (p.noiseBands) w.noiseBands = p.noiseBands;\n if (p.twistMotion) w.twistMotion = true;\n c.grain = p.grain;\n c.blur = p.blur;\n c.cameraPosition = { x: 100, y: 0, z: 5000 };\n c.cameraTarget = { x: p.camTarget[0], y: p.camTarget[1], z: 0 };\n c.cameraZoom = p.zoom;\n return c;\n}\n\n/** Presets: each a complete studio config (scene + one or more waves) in the wave model. */\nexport const PRESETS: Record<string, () => StudioConfig> = {\n // The app's default wave: a centred, full-frame ribbon (window-independent framing).\n // Shown first and named \"Hero\"; several presets below derive from it.\n Hero: () =>\n buildPreset({\n speed: 0.04,\n contrast: 1,\n sat: 1,\n hueRad: -0.00159265,\n dispX: 0.005831,\n dispZ: 0.016001,\n dispAmt: -7.821,\n pos: [380, -301.7, -11.1],\n rotRad: [-0.44959, -0.11759, 1.874407],\n scale: [9, 8, 5],\n twF: [-0.65, 0.41, -0.58],\n twP: [3.63, 0.7, 3.95],\n glow: [1.98, 0.806, 0.834],\n grain: 1.1,\n blur: 0.02,\n zoom: 0.55,\n camTarget: [-420, -200], // user-tuned default framing\n }),\n // Stripe's real hero, recreated faithfully: an orthographic ×10 scene that overflows the\n // frame, so only the twisted crop shows. This is the model's plain default config.\n \"Wave 2\": () => createDefaultConfig(),\n // camTarget on the waves below is a first-pass centring; tune per-wave. NOTE: Wave 4 also\n // uses a variant vertex shader (animated twist-X wobble) we don't fully replicate — its\n // STATIC frame is close, the motion differs.\n \"Wave 3\": () =>\n buildPreset({\n speed: 0.08,\n contrast: 1,\n sat: 1,\n hueRad: -0.00159265,\n dispX: 0.005831,\n dispZ: 0.016001,\n dispAmt: -7.821,\n pos: [-200.7, -65.4, -11.1],\n rotRad: [-2.875593, 3.095927, -2.925927],\n scale: [3, 3, 3],\n twF: [0.059, 0.32, -0.397],\n twP: [3.63, 0.44, 5.99],\n glow: [3.86, 0.923, 1],\n grain: 1.2,\n blur: 0.02,\n zoom: 1.3,\n camTarget: [-104, 13], // centred; zoomed in (wide/flat wave)\n }),\n \"Wave 4\": () =>\n buildPreset({\n speed: 0.0525,\n contrast: 0.969,\n sat: 1.383,\n hueRad: 0.0376991,\n dispX: 0.005,\n dispZ: 0.0212,\n dispAmt: 6.68,\n pos: [206.1, -438, -11.1],\n rotRad: [-0.666018, -0.031416, 0.779115],\n scale: [6.0501, 8.3983, 6.9854],\n twF: [-0.424, 0.024, -1.312],\n twP: [1.81, 0.94, 4.76],\n glow: [1.55, 1.174, 0.972],\n grain: 0.576,\n blur: 0,\n zoom: 0.9316,\n camTarget: [194, -402], // centred on the wave\n twistMotion: true, // variant vertex shader — animated twist-X wobble\n noiseBands: [\n {\n startX: 0.856,\n endX: 1,\n startY: 0,\n endY: 0.913,\n feather: 0.5,\n strength: 0.346,\n frequency: 1018,\n colorAttenuation: 1,\n parabolaPower: 0,\n },\n {\n startX: 0.038,\n endX: 0.538,\n startY: 0.105,\n endY: 1,\n feather: 0.3315,\n strength: 1,\n frequency: 190,\n colorAttenuation: 0,\n parabolaPower: 2.11,\n },\n ],\n }),\n // The dark-background hero: identical geometry/camera to the default hero, but theme\n // \"wireframe\" → the line shader on a dark page background, with grain 1.2. Same palette.\n Wireframe: () => {\n const c = createDefaultConfig();\n c.waves[0].theme = \"wireframe\";\n c.grain = 1.2;\n c.background = \"#0a2540\"; // dark navy page background\n c.transparentBackground = false;\n return c;\n },\n \"Neon Dark Multistrand\": () => {\n const c = createDefaultConfig();\n const w = c.waves[0];\n w.theme = \"wireframe\"; // line shader on the near-black background — neon wireframe look\n w.blendMode = \"additive\";\n w.palette = makeStops([\"#00f5d4\", \"#00bbf9\", \"#9b5de5\", \"#f15bb5\", \"#fee440\"]);\n w.creaseLight = 1.0;\n c.background = \"#05060c\";\n c.transparentBackground = false; // fill the dark bg so the neon lines read on black (not the page)\n c.waves = makeWaveSpread(w, 3); // three overlapping neon waves\n c.waveCount = 3;\n return c;\n },\n \"Mesh Gradient\": () => {\n const c = PRESETS[\"Hero\"](); // the centred default \"Hero\" wave\n const w = c.waves[0];\n w.gradientType = \"mesh\";\n w.meshGradientPoints = [\n { color: \"#0a84ff\", x: 0.06, y: 0.9, influence: 0.68 },\n { color: \"#64d2ff\", x: 0.88, y: 0.92, influence: 0.72 },\n { color: \"#bf5af2\", x: 0.5, y: 0.64, influence: 0.58 },\n { color: \"#ff375f\", x: 0.1, y: 0.14, influence: 0.7 },\n { color: \"#ff9f0a\", x: 0.84, y: 0.12, influence: 0.74 },\n { color: \"#30d158\", x: 0.94, y: 0.5, influence: 0.54 },\n ];\n w.meshGradientSoftness = 0.68;\n w.blendMode = \"normal\";\n w.hueShift = 0;\n w.colorContrast = 1.06;\n w.colorSaturation = 1.12;\n w.fiberStrength = 0.14;\n c.grain = 0.3;\n c.blur = 0.008;\n c.background = \"#070914\";\n c.backgroundMode = \"color\";\n c.transparentBackground = false;\n return c;\n },\n \"Solar Bloom\": () => {\n // Radial gradient: a warm core blooming out to a deep-indigo edge. usePaletteTexture off so\n // our own stops map along the radial gradCoord instead of sampling the baked hero LUT.\n const c = PRESETS[\"Hero\"]();\n const w = c.waves[0];\n w.usePaletteTexture = false;\n w.gradientType = \"radial\";\n w.gradientShift = 0.14;\n w.palette = [\n { color: \"#fff3c4\", pos: 0 }, // warm-white core\n { color: \"#ffd166\", pos: 0.22 }, // gold\n { color: \"#ff8c42\", pos: 0.42 }, // orange\n { color: \"#ff5d8f\", pos: 0.62 }, // coral-pink\n { color: \"#a64dff\", pos: 0.82 }, // violet\n { color: \"#241246\", pos: 1 }, // deep indigo edge\n ];\n w.blendMode = \"normal\";\n w.hueShift = 0;\n w.colorContrast = 1.05;\n w.colorSaturation = 1.18;\n w.fiberStrength = 0.12;\n c.grain = 0.3;\n c.blur = 0.01;\n // Deep warm radial vignette behind the bloom.\n c.background = \"#0a0714\";\n c.backgroundMode = \"gradient\";\n c.backgroundGradientType = \"radial\";\n c.backgroundGradientSource = \"stops\";\n c.backgroundPalette = makeStops([\"#2a1330\", \"#08040f\"]);\n c.transparentBackground = false;\n return c;\n },\n Holographic: () => {\n // Conic gradient: an iridescent oil-slick sweep. The palette wraps (first ≈ last stop) so\n // the conic seam is invisible.\n const c = PRESETS[\"Hero\"]();\n const w = c.waves[0];\n w.usePaletteTexture = false;\n w.gradientType = \"conic\";\n w.gradientShift = 0.08;\n w.palette = [\n { color: \"#8ef6e4\", pos: 0 }, // mint (seam)\n { color: \"#6ec3ff\", pos: 0.18 }, // sky\n { color: \"#9b8cff\", pos: 0.36 }, // periwinkle\n { color: \"#ff8ad8\", pos: 0.54 }, // pink\n { color: \"#ffd98e\", pos: 0.72 }, // peach\n { color: \"#a0f0c8\", pos: 0.88 }, // seafoam\n { color: \"#8ef6e4\", pos: 1 }, // mint again (seamless wrap)\n ];\n w.blendMode = \"normal\";\n w.hueShift = 0;\n w.colorContrast = 1.04;\n w.colorSaturation = 1.12;\n w.fiberStrength = 0.12;\n c.grain = 0.28;\n c.blur = 0.01;\n // Subtle deep teal → violet wash behind the iridescence.\n c.background = \"#05060c\";\n c.backgroundMode = \"gradient\";\n c.backgroundGradientType = \"linear\";\n c.backgroundGradientAngle = 135;\n c.backgroundGradientSource = \"stops\";\n c.backgroundPalette = makeStops([\"#04121a\", \"#0a0518\"]);\n c.transparentBackground = false;\n return c;\n },\n Aurora: () => {\n // Mesh gradient: a moody aurora — teals/greens drifting into violet over a night-sky base\n // (distinct from the brighter iOS-style \"Mesh Gradient\").\n const c = PRESETS[\"Hero\"]();\n const w = c.waves[0];\n w.gradientType = \"mesh\";\n w.meshGradientPoints = [\n { color: \"#0a1f3c\", x: 0.08, y: 0.12, influence: 0.62 },\n { color: \"#1fddb0\", x: 0.3, y: 0.7, influence: 0.78 },\n { color: \"#57f5a3\", x: 0.58, y: 0.86, influence: 0.7 },\n { color: \"#3a86ff\", x: 0.82, y: 0.55, influence: 0.62 },\n { color: \"#a15cff\", x: 0.5, y: 0.32, influence: 0.7 },\n { color: \"#071433\", x: 0.92, y: 0.08, influence: 0.6 },\n ];\n w.meshGradientSoftness = 0.72;\n w.blendMode = \"normal\";\n w.hueShift = 0;\n w.colorContrast = 1.05;\n w.colorSaturation = 1.18;\n w.fiberStrength = 0.12;\n c.grain = 0.3;\n c.blur = 0.008;\n // Dark night-sky MESH backdrop (also shows off the mesh background type).\n c.background = \"#03060f\";\n c.backgroundMode = \"gradient\";\n c.backgroundGradientType = \"mesh\";\n c.backgroundMeshPoints = [\n { color: \"#02040c\", x: 0.15, y: 0.85, influence: 0.7 },\n { color: \"#08243a\", x: 0.5, y: 0.5, influence: 0.75 },\n { color: \"#0a0f2e\", x: 0.85, y: 0.7, influence: 0.7 },\n { color: \"#04121a\", x: 0.7, y: 0.2, influence: 0.6 },\n { color: \"#000208\", x: 0.12, y: 0.12, influence: 0.6 },\n ];\n c.backgroundMeshSoftness = 0.75;\n c.transparentBackground = false;\n return c;\n },\n Palestine: () => {\n const c = PRESETS[\"Hero\"](); // the centred default \"Hero\" wave\n const w = c.waves[0];\n w.paletteSource = \"palestine\";\n w.blendMode = \"normal\";\n w.hueShift = 0;\n w.colorContrast = 1;\n w.colorSaturation = 1;\n c.grain = 0.35;\n c.background = \"#f2efe8\";\n c.transparentBackground = true;\n return c;\n },\n \"Vaporwave Sunset\": () => {\n // The Hero wave re-posed/re-framed, plus the vaporwave palette.\n const c = PRESETS[\"Hero\"](); // the centred default \"Hero\" wave\n const w = c.waves[0];\n w.position.x = 525;\n w.rotation.x = -0.64 * RAD;\n w.rotation.z = 1.68 * RAD;\n w.paletteSource = \"vaporwave\";\n w.blendMode = \"normal\";\n w.hueShift = 0;\n w.colorContrast = 1.08;\n w.colorSaturation = 1.15;\n w.creaseLight = 1.25;\n c.cameraZoom = 1.1;\n c.cameraTarget = { x: 150, y: 360, z: 0 };\n c.background = \"#09051f\";\n c.transparentBackground = false;\n return c;\n },\n Kaleidoscope: () => {\n const c = PRESETS[\"Wave 3\"]();\n const w = c.waves[0];\n w.paletteSource = \"kaleidoscope\";\n w.blendMode = \"normal\";\n w.hueShift = 0;\n w.colorContrast = 1.05;\n w.colorSaturation = 1.12;\n c.grain = 0.5;\n return c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|
|
4
|
+
/**
|
|
5
|
+
* Base wave geometry — `folded()`: a flat PlaneGeometry folded into a hairpin
|
|
6
|
+
* (sideways-U) cross-section, then stood up so the fold runs along the wave's length.
|
|
7
|
+
*
|
|
8
|
+
* - Each vertex gets a half-thickness `r` (per-vertex math below): tight along the
|
|
9
|
+
* width centreline, flaring toward the long edges.
|
|
10
|
+
* - The strip |x| < FOLD_X becomes a semicircular hinge; the plane's two halves bend
|
|
11
|
+
* around it into parallel arms offset to +r and -r.
|
|
12
|
+
* - Two −90° rotations (about X then Y) orient the U upright and down its length.
|
|
13
|
+
*
|
|
14
|
+
* folded() leaves the U open along one side and hollow at both ends, so at oblique
|
|
15
|
+
* camera angles you could see straight through it. We weld the open side and cap both
|
|
16
|
+
* ends with extra triangles so the mesh is a watertight solid — welding/capping adds
|
|
17
|
+
* faces only, no vertex positions move.
|
|
18
|
+
*
|
|
19
|
+
* All further deformation (displacement, twist, transform) happens in the vertex shader
|
|
20
|
+
* on top of this base. UVs: u along the fold/length, v across the width.
|
|
21
|
+
*/
|
|
22
|
+
declare class WaveGeometry {
|
|
23
|
+
readonly geometry: THREE.BufferGeometry;
|
|
24
|
+
private segments;
|
|
25
|
+
constructor(segments: number);
|
|
26
|
+
resize(segments: number): void;
|
|
27
|
+
dispose(): void;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { WaveGeometry };
|
|
31
|
+
//# sourceMappingURL=WaveGeometry.d.ts.map
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
//#region src/renderer/WaveGeometry.ts
|
|
3
|
+
/** Native plane size for folded() — keep this exact (400) so the vertex
|
|
4
|
+
* shader's displace/twist frequencies (calibrated to this scale) stay faithful. */
|
|
5
|
+
const NATIVE = 400;
|
|
6
|
+
const FOLD_X = 16;
|
|
7
|
+
const SHIFT = NATIVE / 4;
|
|
8
|
+
const X_AXIS = new THREE.Vector3(1, 0, 0);
|
|
9
|
+
const Y_AXIS = new THREE.Vector3(0, 1, 0);
|
|
10
|
+
/**
|
|
11
|
+
* Base wave geometry — `folded()`: a flat PlaneGeometry folded into a hairpin
|
|
12
|
+
* (sideways-U) cross-section, then stood up so the fold runs along the wave's length.
|
|
13
|
+
*
|
|
14
|
+
* - Each vertex gets a half-thickness `r` (per-vertex math below): tight along the
|
|
15
|
+
* width centreline, flaring toward the long edges.
|
|
16
|
+
* - The strip |x| < FOLD_X becomes a semicircular hinge; the plane's two halves bend
|
|
17
|
+
* around it into parallel arms offset to +r and -r.
|
|
18
|
+
* - Two −90° rotations (about X then Y) orient the U upright and down its length.
|
|
19
|
+
*
|
|
20
|
+
* folded() leaves the U open along one side and hollow at both ends, so at oblique
|
|
21
|
+
* camera angles you could see straight through it. We weld the open side and cap both
|
|
22
|
+
* ends with extra triangles so the mesh is a watertight solid — welding/capping adds
|
|
23
|
+
* faces only, no vertex positions move.
|
|
24
|
+
*
|
|
25
|
+
* All further deformation (displacement, twist, transform) happens in the vertex shader
|
|
26
|
+
* on top of this base. UVs: u along the fold/length, v across the width.
|
|
27
|
+
*/
|
|
28
|
+
var WaveGeometry = class {
|
|
29
|
+
geometry;
|
|
30
|
+
segments = -1;
|
|
31
|
+
constructor(segments) {
|
|
32
|
+
this.geometry = new THREE.BufferGeometry();
|
|
33
|
+
this.resize(segments);
|
|
34
|
+
}
|
|
35
|
+
resize(segments) {
|
|
36
|
+
if (segments === this.segments) return;
|
|
37
|
+
this.segments = segments;
|
|
38
|
+
const subX = THREE.MathUtils.clamp(Math.round(segments), 48, 200);
|
|
39
|
+
const subY = subX * 2;
|
|
40
|
+
const plane = new THREE.PlaneGeometry(NATIVE, NATIVE, subX, subY);
|
|
41
|
+
const pos = plane.attributes.position;
|
|
42
|
+
const uv = plane.attributes.uv;
|
|
43
|
+
const v = new THREE.Vector3();
|
|
44
|
+
for (let i = 0; i < pos.count; i++) {
|
|
45
|
+
v.fromBufferAttribute(pos, i);
|
|
46
|
+
const uy = uv.getY(i);
|
|
47
|
+
const r = 4 - 2 * Math.pow(4 * uy * (1 - uy), 9.5);
|
|
48
|
+
if (v.x < -16) v.z += r;
|
|
49
|
+
else if (v.x < FOLD_X) {
|
|
50
|
+
v.z = Math.cos(THREE.MathUtils.mapLinear(v.x, -16, FOLD_X, 0, Math.PI)) * r;
|
|
51
|
+
v.x = Math.cos(THREE.MathUtils.mapLinear(v.x, -16, FOLD_X, -Math.PI / 2, Math.PI / 2)) * r - FOLD_X;
|
|
52
|
+
} else {
|
|
53
|
+
v.z -= r;
|
|
54
|
+
v.x = -v.x;
|
|
55
|
+
}
|
|
56
|
+
v.x += SHIFT;
|
|
57
|
+
v.applyAxisAngle(X_AXIS, -Math.PI / 2);
|
|
58
|
+
v.applyAxisAngle(Y_AXIS, -Math.PI / 2);
|
|
59
|
+
pos.setXYZ(i, v.x, v.y, v.z);
|
|
60
|
+
}
|
|
61
|
+
pos.needsUpdate = true;
|
|
62
|
+
const cols = subX + 1;
|
|
63
|
+
const srcIdx = plane.getIndex();
|
|
64
|
+
const merged = srcIdx ? Array.from(srcIdx.array) : [];
|
|
65
|
+
for (let iy = 0; iy < subY; iy++) {
|
|
66
|
+
const a = iy * cols;
|
|
67
|
+
const b = (iy + 1) * cols;
|
|
68
|
+
const c = a + subX;
|
|
69
|
+
const d = b + subX;
|
|
70
|
+
merged.push(a, c, b, b, c, d);
|
|
71
|
+
}
|
|
72
|
+
for (const row of [0, subY]) {
|
|
73
|
+
const apex = row * cols;
|
|
74
|
+
for (let ix = 1; ix < subX; ix++) merged.push(apex, row * cols + ix, row * cols + ix + 1);
|
|
75
|
+
}
|
|
76
|
+
plane.setIndex(merged);
|
|
77
|
+
plane.computeVertexNormals();
|
|
78
|
+
this.geometry.setIndex(plane.getIndex());
|
|
79
|
+
this.geometry.setAttribute("position", plane.getAttribute("position"));
|
|
80
|
+
this.geometry.setAttribute("uv", plane.getAttribute("uv"));
|
|
81
|
+
this.geometry.setAttribute("normal", plane.getAttribute("normal"));
|
|
82
|
+
this.geometry.computeBoundingSphere();
|
|
83
|
+
plane.dispose();
|
|
84
|
+
}
|
|
85
|
+
dispose() {
|
|
86
|
+
this.geometry.dispose();
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
//#endregion
|
|
90
|
+
export { WaveGeometry };
|
|
91
|
+
|
|
92
|
+
//# sourceMappingURL=WaveGeometry.js.map
|