@woosh/meep-engine 3.78.1 → 3.78.2

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.
Files changed (25) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/package.json +1 -1
  3. package/src/generation/grid/generation/discrete/GridTaskWaveFunctionCollapse.d.ts +119 -0
  4. package/src/generation/grid/generation/discrete/GridTaskWaveFunctionCollapse.d.ts.map +1 -0
  5. package/src/generation/grid/generation/discrete/GridTaskWaveFunctionCollapse.js +563 -0
  6. package/src/generation/wfc/GRID_WFC_PIECE_SOCKET_PREFIX.d.ts +11 -0
  7. package/src/generation/wfc/GRID_WFC_PIECE_SOCKET_PREFIX.d.ts.map +1 -0
  8. package/src/generation/wfc/GRID_WFC_PIECE_SOCKET_PREFIX.js +10 -0
  9. package/src/generation/wfc/GridWFCCompiledTileSet.d.ts +123 -0
  10. package/src/generation/wfc/GridWFCCompiledTileSet.d.ts.map +1 -0
  11. package/src/generation/wfc/GridWFCCompiledTileSet.js +355 -0
  12. package/src/generation/wfc/GridWFCEdge.d.ts +13 -0
  13. package/src/generation/wfc/GridWFCEdge.d.ts.map +1 -0
  14. package/src/generation/wfc/GridWFCEdge.js +14 -0
  15. package/src/generation/wfc/GridWFCTileSet.d.ts +120 -0
  16. package/src/generation/wfc/GridWFCTileSet.d.ts.map +1 -0
  17. package/src/generation/wfc/GridWFCTileSet.js +275 -0
  18. package/src/shade/renderer/hair/GPUHairSystem.d.ts.map +1 -1
  19. package/src/shade/renderer/hair/GPUHairSystem.js +28 -9
  20. package/src/shade/renderer/hair/HAIR_SIMULATION.d.ts +50 -9
  21. package/src/shade/renderer/hair/HAIR_SIMULATION.d.ts.map +1 -1
  22. package/src/shade/renderer/hair/HAIR_SIMULATION.js +71 -11
  23. package/src/shade/renderer/hair/shader_hair_simulate.d.ts +22 -16
  24. package/src/shade/renderer/hair/shader_hair_simulate.d.ts.map +1 -1
  25. package/src/shade/renderer/hair/shader_hair_simulate.js +151 -78
@@ -0,0 +1,275 @@
1
+ import { assert } from "../../core/assert.js";
2
+ import { GRID_WFC_PIECE_SOCKET_PREFIX } from "./GRID_WFC_PIECE_SOCKET_PREFIX.js";
3
+ import { GridWFCCompiledTileSet } from "./GridWFCCompiledTileSet.js";
4
+ import { GridWFCEdge } from "./GridWFCEdge.js";
5
+
6
+ /**
7
+ * @param {string} socket
8
+ * @param {string} what
9
+ */
10
+ function assert_socket(socket, what) {
11
+ assert.isString(socket, what);
12
+
13
+ if (socket.startsWith(GRID_WFC_PIECE_SOCKET_PREFIX)) {
14
+ throw new Error(`${what}: a socket name may not start with U+0000`);
15
+ }
16
+ }
17
+
18
+ /**
19
+ * @param {string[]} edges
20
+ * @param {string} what
21
+ */
22
+ function assert_edges(edges, what) {
23
+ assert.isArray(edges, what);
24
+ assert.equal(edges.length, 4, `${what}.length`);
25
+
26
+ for (let e = 0; e < 4; e++) {
27
+ assert_socket(edges[e], `${what}[${e}]`);
28
+ }
29
+ }
30
+
31
+ /**
32
+ * @param {number} weight
33
+ * @param {number} rotations
34
+ * @param {string[]} tags
35
+ */
36
+ function assert_tile_options(weight, rotations, tags) {
37
+ assert.isNumber(weight, 'weight');
38
+ assert.greaterThan(weight, 0, 'weight');
39
+ assert.isOneOf(rotations, [1, 2, 4], 'rotations');
40
+ assert.isArray(tags, 'tags');
41
+ }
42
+
43
+ /**
44
+ * @param {GridCellAction|null} action
45
+ * @param {string} what
46
+ */
47
+ function assert_action(action, what) {
48
+ if (action !== null) {
49
+ assert.equal(action.isGridCellAction, true, `${what}.isGridCellAction !== true`);
50
+ }
51
+ }
52
+
53
+ /**
54
+ * Cell offset of a step across each edge, in {@link GridWFCEdge} order.
55
+ *
56
+ * @type {number[][]}
57
+ */
58
+ const EDGE_STEP = [];
59
+ EDGE_STEP[GridWFCEdge.NegativeX] = [-1, 0];
60
+ EDGE_STEP[GridWFCEdge.PositiveX] = [1, 0];
61
+ EDGE_STEP[GridWFCEdge.NegativeY] = [0, -1];
62
+ EDGE_STEP[GridWFCEdge.PositiveY] = [0, 1];
63
+
64
+ /**
65
+ * A set of tiles for a 2D grid, described the way they are drawn: each tile names the **socket**
66
+ * on each of its four edges, and two tiles may sit side by side when the sockets on their shared
67
+ * edge are the same.
68
+ *
69
+ * This is the authoring half of wave function collapse. The solver in `core/wfc/` knows a tile
70
+ * only as an integer and a rule only as a bit; {@link compile} is what turns turned copies and
71
+ * multi-cell pieces into distinct integers and their sockets into that table.
72
+ *
73
+ * ```js
74
+ * const tiles = new GridWFCTileSet();
75
+ *
76
+ * // -x +x -y +y
77
+ * tiles.add({ name: 'open', edges: ['open', 'open', 'open', 'open'], weight: 20, tags: ['walkable'] });
78
+ * tiles.add({ name: 'wall', edges: ['wall', 'wall', 'open', 'open'], rotations: 2, action: place_wall });
79
+ * tiles.add({ name: 'bend', edges: ['open', 'wall', 'open', 'wall'], rotations: 4, action: place_bend });
80
+ * ```
81
+ *
82
+ * A socket has no handedness: it matches itself, read from either side. That is enough for
83
+ * anything centred on its edge (a wall, a path, a region's border) and is not enough for a feature
84
+ * that crosses an edge off-centre.
85
+ */
86
+ export class GridWFCTileSet {
87
+
88
+ /**
89
+ * Tiles as they were added — one per {@link add} call, one per cell of an {@link add_piece}.
90
+ *
91
+ * @type {{name:string, edges:string[], weight:number, rotations:number, tags:string[], action:(GridCellAction|null)}[]}
92
+ */
93
+ prototypes = [];
94
+
95
+ /**
96
+ * @type {number}
97
+ * @private
98
+ */
99
+ __piece_count = 0;
100
+
101
+ /**
102
+ * @type {GridWFCCompiledTileSet|null}
103
+ * @private
104
+ */
105
+ __compiled = null;
106
+
107
+ /**
108
+ * Add a tile that occupies one cell.
109
+ *
110
+ * @param {Object} options
111
+ * @param {string} options.name for diagnostics, and how {@link GridWFCCompiledTileSet#prototype_named} finds it
112
+ * @param {string[]} options.edges socket per edge, in {@link GridWFCEdge} order: -x, +x, -y, +y
113
+ * @param {number} [options.weight=1] relative likelihood of the tile, shared between its turned copies
114
+ * @param {number} [options.rotations=1] how many distinct quarter turns it has: 1 for a tile
115
+ * that looks the same turned any way, 2 for one with a half-turn symmetry (a straight
116
+ * wall), 4 for one with none (a bend)
117
+ * @param {string[]} [options.tags] what the tile is, for restricting cells to a kind of tile
118
+ * @param {GridCellAction|null} [options.action] run on the cell the tile lands in, with the
119
+ * tile's rotation in radians
120
+ * @returns {number} index of the prototype
121
+ */
122
+ add({ name, edges, weight = 1, rotations = 1, tags = [], action = null }) {
123
+ assert.isString(name, 'name');
124
+ assert_edges(edges, 'edges');
125
+ assert_tile_options(weight, rotations, tags);
126
+ assert_action(action, 'action');
127
+
128
+ return this.__push({ name, edges: edges.slice(), weight, rotations, tags: tags.slice(), action });
129
+ }
130
+
131
+ /**
132
+ * Add a piece that occupies several cells and only ever appears whole: a building two cells by
133
+ * three, a gatehouse with its two towers.
134
+ *
135
+ * Each cell becomes a tile of its own, and the edges between the piece's cells get sockets
136
+ * nothing else carries — so wherever one cell of it lands, propagation forces the rest.
137
+ *
138
+ * @param {Object} options
139
+ * @param {string} options.name
140
+ * @param {{x:number, y:number, edges?:string[], tags?:string[], action?:(GridCellAction|null)}[]} options.cells
141
+ * offsets of the piece's cells at rotation 0, every cell sharing an edge with another —
142
+ * cells that only touch at a corner, or not at all, would be placed apart, so they are an
143
+ * error. `edges` gives a cell's OUTWARD-facing
144
+ * sockets (entries for edges that face another cell of the piece are ignored) and
145
+ * defaults to `edge` all round. `action` usually sits on one cell only — the one the
146
+ * piece's model stands on.
147
+ * @param {string} [options.edge] socket of every outward-facing edge a cell does not name
148
+ * @param {number} [options.weight=1]
149
+ * @param {number} [options.rotations=1]
150
+ * @param {string[]} [options.tags] carried by every cell of the piece, with the cell's own
151
+ * @returns {number[]} index of each cell's prototype, in the order of `cells`
152
+ */
153
+ add_piece({ name, cells, edge, weight = 1, rotations = 1, tags = [] }) {
154
+ assert.isString(name, 'name');
155
+ assert.isArray(cells, 'cells');
156
+ assert.greaterThan(cells.length, 0, 'cells.length');
157
+ assert_tile_options(weight, rotations, tags);
158
+
159
+ if (edge !== undefined) {
160
+ assert_socket(edge, 'edge');
161
+ }
162
+
163
+ const at = new Map();
164
+
165
+ for (let i = 0; i < cells.length; i++) {
166
+ const { x, y } = cells[i];
167
+
168
+ assert.isInteger(x, `cells[${i}].x`);
169
+ assert.isInteger(y, `cells[${i}].y`);
170
+
171
+ if (at.has(`${x},${y}`)) {
172
+ throw new Error(`piece '${name}': two cells at (${x}, ${y})`);
173
+ }
174
+
175
+ at.set(`${x},${y}`, i);
176
+ }
177
+
178
+ // Only the sockets between cells hold a piece together, so a cell joined to the rest by no
179
+ // edge is a separate tile that happens to share a name: it would be placed anywhere, alone.
180
+ // A real throw — the result would look fine and be wrong.
181
+ const reached = [0];
182
+ const seen = new Set([0]);
183
+
184
+ for (let k = 0; k < reached.length; k++) {
185
+ const { x, y } = cells[reached[k]];
186
+
187
+ for (let e = 0; e < 4; e++) {
188
+ const neighbour = at.get(`${x + EDGE_STEP[e][0]},${y + EDGE_STEP[e][1]}`);
189
+
190
+ if (neighbour !== undefined && !seen.has(neighbour)) {
191
+ seen.add(neighbour);
192
+ reached.push(neighbour);
193
+ }
194
+ }
195
+ }
196
+
197
+ if (reached.length !== cells.length) {
198
+ const apart = cells.findIndex((cell, i) => !seen.has(i));
199
+
200
+ throw new Error(`piece '${name}': cell ${apart} shares no edge with cell 0 or any cell joined to it`);
201
+ }
202
+
203
+ const piece = this.__piece_count++;
204
+ const result = [];
205
+
206
+ for (let i = 0; i < cells.length; i++) {
207
+ const cell = cells[i];
208
+ const outward = cell.edges;
209
+ const cell_action = cell.action ?? null;
210
+
211
+ if (outward !== undefined) {
212
+ assert_edges(outward, `cells[${i}].edges`);
213
+ } else if (edge === undefined) {
214
+ throw new Error(`piece '${name}': cell ${i} names no edges and the piece has no default 'edge'`);
215
+ }
216
+
217
+ if (cell.tags !== undefined) {
218
+ assert.isArray(cell.tags, `cells[${i}].tags`);
219
+ }
220
+
221
+ assert_action(cell_action, `cells[${i}].action`);
222
+
223
+ const edges = [];
224
+
225
+ for (let e = 0; e < 4; e++) {
226
+ const neighbour = at.get(`${cell.x + EDGE_STEP[e][0]},${cell.y + EDGE_STEP[e][1]}`);
227
+
228
+ if (neighbour === undefined) {
229
+ edges[e] = outward !== undefined ? outward[e] : edge;
230
+ } else {
231
+ // one name per pair of cells, the same from both sides
232
+ const low = Math.min(i, neighbour), high = Math.max(i, neighbour);
233
+
234
+ edges[e] = `${GRID_WFC_PIECE_SOCKET_PREFIX}${piece}:${low}:${high}`;
235
+ }
236
+ }
237
+
238
+ result.push(this.__push({
239
+ name: `${name}#${i}`,
240
+ edges,
241
+ weight,
242
+ rotations,
243
+ tags: tags.concat(cell.tags ?? []),
244
+ action: cell_action
245
+ }));
246
+ }
247
+
248
+ return result;
249
+ }
250
+
251
+ /**
252
+ * @param {{name:string, edges:string[], weight:number, rotations:number, tags:string[], action:(GridCellAction|null)}} prototype
253
+ * @returns {number}
254
+ * @private
255
+ */
256
+ __push(prototype) {
257
+ this.prototypes.push(prototype);
258
+ this.__compiled = null;
259
+
260
+ return this.prototypes.length - 1;
261
+ }
262
+
263
+ /**
264
+ * The set as the solver takes it. Built once and kept until a tile is added.
265
+ *
266
+ * @returns {GridWFCCompiledTileSet}
267
+ */
268
+ compile() {
269
+ if (this.__compiled === null) {
270
+ this.__compiled = new GridWFCCompiledTileSet(this.prototypes);
271
+ }
272
+
273
+ return this.__compiled;
274
+ }
275
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"GPUHairSystem.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/GPUHairSystem.js"],"names":[],"mappings":"AAkIA;;;;GAIG;AACH,+BAFU,MAAM,CAEkB;AAElC;;;GAGG;AACH,wCAFU,MAAM,CAE6B;AAc7C;;GAEG;AACH;IACI,6CAA6C;IAC7C,SADW,MAAM,CACH;IAEd,kEAAkE;IAClE,SADW,MAAM,CACL;IAEZ,mDAAmD;IACnD,KADW,YAAY,CACW;IAElC,oDAAoD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;;;;OAMG;IACH,kBAFW,YAAY,QAsXtB;IAsHD;;;;;OAKG;IACH,mBAFW,YAAY,QAmGtB;IAED,gBAiBC;;CAiqBJ;oBA3nEY,OAAO,wCAAwC,EAAE,KAAK;2BACtD,OAAO,8BAA8B,EAAE,YAAY;8BACnD,OAAO,uBAAuB,EAAE,eAAe;4BAjFhC,gCAAgC;2BADjC,yBAAyB"}
1
+ {"version":3,"file":"GPUHairSystem.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/GPUHairSystem.js"],"names":[],"mappings":"AAuIA;;;;GAIG;AACH,+BAFU,MAAM,CAEkB;AAElC;;;GAGG;AACH,wCAFU,MAAM,CAE6B;AAc7C;;GAEG;AACH;IACI,6CAA6C;IAC7C,SADW,MAAM,CACH;IAEd,kEAAkE;IAClE,SADW,MAAM,CACL;IAEZ,mDAAmD;IACnD,KADW,YAAY,CACW;IAElC,oDAAoD;IACpD,WADW,MAAM,CACD;IAEhB;;OAEG;IACH,YAFW,YAAY,QAOtB;IAED;;;OAGG;IACH,cAHW,YAAY,GACV,OAAO,CASnB;CACJ;AAED;;;GAGG;AACH;IACI,gCAAgC;IAChC,SADW,MAAM,CACL;IAEZ,gCAAgC;IAChC,mBADW,MAAM,CACM;IAEvB,+CAA+C;IAC/C,oBADW,MAAM,CACQ;IAEzB,gCAAgC;IAChC,kBADW,MAAM,CACK;IAEtB,qBAAqB;IACrB,UADW,MAAM,CACF;IAEf,4BAA4B;IAC5B,WADW,MAAM,CACH;IAEd;;OAEG;IACH,YAFW,oBAAoB,QAS9B;IAED;;;OAGG;IACH,cAHW,oBAAoB,GAClB,OAAO,CASnB;CACJ;AAiBD;;GAEG;AACH;IACI,yBAAyB;IACzB,OADW,KAAK,GAAC,IAAI,CACR;IAEb,iFAAiF;IACjF,MADW,MAAM,EAAE,CACT;IAEV,wDAAwD;IACxD,MADW,MAAM,CACR;IAET,gDAAgD;IAChD,UADW,YAAY,CACO;IAE9B,kGAAkG;IAClG,UADW,oBA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AFW,MAAM,QAMhB;IAED;;;;;;;OAOG;IACH,sBAHW,cAAc,YACd,oBAAoB,GAAC,IAAI,QAwCnC;IAED;;;;;;;;;;;;OAYG;IACH,qBALW,cAAc,aACd,MAAM,YACN,OAAO,gCAAgC,EAAE,eAAe,GAAC,IAAI,gBAC7D,MAAM,QA2FhB;IAED;;;;;OAKG;IACH,eAFW,cAAc,QAaxB;IAED;;;;;;;OAOG;IACH,uBAJW,cAAc,SACd,WAAW,SACX,MAAM,QAYhB;IAED;;;;;;;OAOG;IACH,WALW,KAAK,QACL,MAAM,YACN,YAAY,GACV,cAAc,GAAC,IAAI,CA+B/B;IAED;;;;;OAKG;IACH,kBAHW,cAAc,QACd,MAAM,QAYhB;IAED;;;OAGG;IACH,sBAHW,cAAc,YACd,YAAY,QAUtB;IAED;;OAEG;IACH,gBAFW,cAAc,QA6CxB;IAED;;OAEG;IACH,eAUC;IAED;;;;;;OAMG;IACH,kBAFW,YAAY,QAsXtB;IAsHD;;;;;OAKG;IACH,mBAFW,YAAY,QAmGtB;IAED,gBAiBC;;CAyqBJ;oBAzoEY,OAAO,wCAAwC,EAAE,KAAK;2BACtD,OAAO,8BAA8B,EAAE,YAAY;8BACnD,OAAO,uBAAuB,EAAE,eAAe;4BAtFhC,gCAAgC;2BADjC,yBAAyB"}
@@ -56,14 +56,19 @@ import {
56
56
  HAIR_BINDING_NONE,
57
57
  HAIR_COLLIDER_LIMIT,
58
58
  HAIR_COLLIDER_WORDS,
59
- HAIR_FRAME_STEP_MAX,
59
+ hair_frame_steps,
60
+ HAIR_FRAME_STEPS_BLEND,
61
+ HAIR_FRAME_STEPS_COUNT,
62
+ HAIR_FRAME_STEPS_FIRST,
63
+ HAIR_FRAME_STEPS_OWED,
64
+ HAIR_FRAME_STEPS_STRIDE,
60
65
  HAIR_ROOT_FRAME_VECTORS,
61
66
  HAIR_GUIDE_BOUNDS_WORDS,
62
67
  HAIR_GUIDE_RECORD_WORDS,
63
68
  HAIR_STATE_HEADER,
64
69
  HAIR_STATE_NONE,
65
70
  HAIR_STATE_PLANES,
66
- HAIR_SUBSTEP_MAX
71
+ HAIR_STEP
67
72
  } from "./HAIR_SIMULATION.js";
68
73
  import { HAIR_EPOCH_MASK } from "./chunk_hair_guide.js";
69
74
  import {
@@ -464,9 +469,15 @@ export class GPUHairSystem {
464
469
  /** @type {number} entities whose hair is simulated */
465
470
  #simulated = 0;
466
471
 
467
- /** @type {number} seconds the scene's clock moved that the guides were not stepped through */
472
+ /** @type {number} seconds the scene's clock moved since the guides' frame was last recorded */
468
473
  #pending_time = 0;
469
474
 
475
+ /** @type {number} seconds the frames recorded have run past the guides' last step, less than a step */
476
+ #owed_time = 0;
477
+
478
+ /** @type {Float64Array} how the frame's time is cut into steps (`hair_frame_steps`) */
479
+ #frame_steps = new Float64Array(5);
480
+
470
481
  /** @type {number} the scene context's frame the guides were last stepped in, -1 for none */
471
482
  #simulated_frame = -1;
472
483
 
@@ -1923,8 +1934,9 @@ export class GPUHairSystem {
1923
1934
  /**
1924
1935
  * Step the guides of every simulated instance through the time the scene's clock moved, once a frame: the first
1925
1936
  * view to draw hair records it, the begin pass, the colliders' poses and the solver (`shader_hair_simulate.js`).
1926
- * A frame step is the time owed, at most `HAIR_FRAME_STEP_MAX`, in as few substeps as keep each within
1927
- * `HAIR_SUBSTEP_MAX`; a frame owing none still lays new states at rest and follows the anchors.
1937
+ * The time is stepped through in whole steps of `HAIR_STEP`, what is left of it owed to the next frame
1938
+ * (`hair_frame_steps`); a frame that takes no step still lays new states at rest, follows the anchors and draws
1939
+ * the guides between their last two steps.
1928
1940
  *
1929
1941
  * @param {import("../../../engine/graphics/render/frame_graph/FrameGraph.js").FrameGraph} graph
1930
1942
  * @param {Object} scene the view's scene context
@@ -1958,9 +1970,12 @@ export class GPUHairSystem {
1958
1970
  return { state, bounds };
1959
1971
  }
1960
1972
 
1961
- const seconds = Math.min(this.#pending_time, HAIR_FRAME_STEP_MAX);
1962
- const substeps = seconds > 0 ? Math.ceil(seconds / HAIR_SUBSTEP_MAX) : 0;
1973
+ const seconds = this.#pending_time;
1974
+ const steps = this.#frame_steps;
1975
+
1976
+ hair_frame_steps(steps, this.#owed_time, seconds);
1963
1977
 
1978
+ this.#owed_time = steps[HAIR_FRAME_STEPS_OWED];
1964
1979
  this.#pending_time = 0;
1965
1980
  this.#simulated_frame = scene.frame;
1966
1981
 
@@ -2043,8 +2058,12 @@ export class GPUHairSystem {
2043
2058
  hair_guide_bounds: current.bounds,
2044
2059
  settings: {
2045
2060
  gravity: this.gravity,
2046
- step: substeps > 0 ? seconds / substeps : 0,
2047
- substeps,
2061
+ step: HAIR_STEP,
2062
+ steps: steps[HAIR_FRAME_STEPS_COUNT],
2063
+ first: steps[HAIR_FRAME_STEPS_FIRST],
2064
+ stride: steps[HAIR_FRAME_STEPS_STRIDE],
2065
+ blend: steps[HAIR_FRAME_STEPS_BLEND],
2066
+ seconds,
2048
2067
  },
2049
2068
  };
2050
2069
 
@@ -1,3 +1,16 @@
1
+ /**
2
+ * How a frame's time is cut into the solver's steps. The time not yet stepped through, `owed` from the frames
3
+ * before and this frame's `seconds` (at most {@link HAIR_FRAME_STEP_MAX} of them), is stepped through in whole
4
+ * steps of {@link HAIR_STEP}; what is left is owed to the next frame. A step falls at a time within the frame, and
5
+ * reads the world there: the share of the frame's motion, from a frame ago at 0 to now at 1, is `first` for the
6
+ * frame's first step and `stride` more for each after it. The drawn state is `blend` of the way from the step
7
+ * before the last to the last: a step behind the scene's clock, always.
8
+ *
9
+ * @param {Float64Array|number[]} result written: the `HAIR_FRAME_STEPS_*` words
10
+ * @param {number} owed seconds the frames before ran past their last step, in `[0, HAIR_STEP)`
11
+ * @param {number} seconds the scene's clock moved this frame
12
+ */
13
+ export function hair_frame_steps(result: Float64Array | number[], owed: number, seconds: number): void;
1
14
  /**
2
15
  * The rate a node's velocity relaxes toward the air's by drag, per second: the drag of the wisp its guide stands for,
3
16
  * a cylinder of diameter `diameter` across the flow at relative speed `speed`, over the wisp's mass a unit length,
@@ -24,19 +37,31 @@ export function hair_drag_rate(speed: number, diameter: number, mass_per_length:
24
37
  * for `P` nodes a guide and `G` guides, so the threads of neighbouring guides read neighbouring vectors.
25
38
  *
26
39
  * Positions are metres from the instance's **anchor**, its entity's translation this frame, along the world's axes:
27
- * near zero wherever the entity is, so a substep's small moves keep their precision far from the world's origin.
40
+ * near zero wherever the entity is, so a step's small moves keep their precision far from the world's origin.
41
+ *
42
+ * The guides are solved in steps of {@link HAIR_STEP}, whatever the frames' lengths ({@link hair_frame_steps}), and
43
+ * drawn between the last two steps: what the strands read is the **drawn** state, the solver's own is the **solved**
44
+ * one. The drawn state is blended in the frame of the guide's root (the entity's, or its strand's root frame on a bound
45
+ * mesh), from the step before the last to the last by the share of a step the frames have run past the last, and
46
+ * carried by the root's frame now: a guide's drawn root is its root this frame, and a root that turns or moves between
47
+ * steps carries its guide rigidly.
28
48
  *
29
49
  * ```
30
50
  * header 0 the anchor, world metres; w: the epoch the state was made for, u32 bits
31
- * 1 the anchor's move since the state was last stepped; w: 1 when the state is to be laid at rest
51
+ * 1 the anchor's move since the frame before; w: 1 when the state is to be laid at rest
32
52
  * 2..4 the entity's world matrix now, its columns' x, y and z, translation dropped
33
53
  * 5..7 the same a frame ago
34
54
  * 8 where the entity's origin was a frame ago, from the anchor
35
- * plane 0 a node's position
36
- * 1 its velocity, metres a second
37
- * 2 its frame: the rotation, a unit quaternion, from its rest frame carried by the entity to where it is
38
- * 3 its position a frame ago, from this frame's anchor
39
- * 4 its frame a frame ago
55
+ * plane 0 a node's drawn position
56
+ * 1 its solved velocity, metres a second, at the last step
57
+ * 2 its drawn frame: the rotation, a unit quaternion, from its rest frame carried by the entity to where it is
58
+ * 3 its drawn position a frame ago, from this frame's anchor
59
+ * 4 its drawn frame a frame ago
60
+ * 5 its solved position at the last step
61
+ * 6 its solved rotation at the last step, a unit quaternion: from the groom's rest space to the world, scale
62
+ * left out. The root node's is its root frame's.
63
+ * 7 its solved position a step before the last: from its guide's root, along the root frame's axes
64
+ * 8 its solved rotation a step before the last, in the root frame's axes
40
65
  * ```
41
66
  */
42
67
  /**
@@ -70,6 +95,10 @@ export const HAIR_STATE_VELOCITY: 1;
70
95
  export const HAIR_STATE_FRAME: 2;
71
96
  export const HAIR_STATE_LAST_POSITION: 3;
72
97
  export const HAIR_STATE_LAST_FRAME: 4;
98
+ export const HAIR_STATE_SOLVED_POSITION: 5;
99
+ export const HAIR_STATE_SOLVED_ROTATION: 6;
100
+ export const HAIR_STATE_PREVIOUS_POSITION: 7;
101
+ export const HAIR_STATE_PREVIOUS_ROTATION: 8;
73
102
  /**
74
103
  * Words of a guide's record in the groom pool: its strand's rank, its wisp's strand count, its wisp's diameter and
75
104
  * its length (f32 bits each, groom metres).
@@ -77,10 +106,21 @@ export const HAIR_STATE_LAST_FRAME: 4;
77
106
  */
78
107
  export const HAIR_GUIDE_RECORD_WORDS: number;
79
108
  /**
80
- * The longest substep, seconds: a frame is cut into as many as keep each within it.
109
+ * The solver's step, seconds: every step is this long, whatever the frames' lengths, so the hair's pose and its
110
+ * stability do not follow the frame rate.
81
111
  * @type {number}
82
112
  */
83
- export const HAIR_SUBSTEP_MAX: number;
113
+ export const HAIR_STEP: number;
114
+ /** Steps the solver takes this frame, in {@link hair_frame_steps}' result. */
115
+ export const HAIR_FRAME_STEPS_COUNT: 0;
116
+ /** Seconds the frames have run past the last step, less than {@link HAIR_STEP}, in {@link hair_frame_steps}' result. */
117
+ export const HAIR_FRAME_STEPS_OWED: 1;
118
+ /** The share of the frame's motion the first step falls at, in {@link hair_frame_steps}' result. */
119
+ export const HAIR_FRAME_STEPS_FIRST: 2;
120
+ /** The share of the frame's motion from a step to the next, in {@link hair_frame_steps}' result. */
121
+ export const HAIR_FRAME_STEPS_STRIDE: 3;
122
+ /** How far the drawn state is from the step before the last, 0, to the last, 1, in {@link hair_frame_steps}' result. */
123
+ export const HAIR_FRAME_STEPS_BLEND: 4;
84
124
  /**
85
125
  * The longest frame the simulation steps, seconds, as the animation clamps its own: a stall slows the hair rather
86
126
  * than throwing it.
@@ -124,6 +164,7 @@ export const HAIR_COLLIDER_LIMIT: number;
124
164
  * 8 .. 11 from the world to its own frame, as the pose pass writes it: the rotation, a unit quaternion
125
165
  * 12 .. 14 the translation after it
126
166
  * 15 the scale after that: distances in its frame are the world's times it
167
+ * 16 .. 23 the same a frame ago
127
168
  * ```
128
169
  *
129
170
  * @type {number}
@@ -1 +1 @@
1
- {"version":3,"file":"HAIR_SIMULATION.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/HAIR_SIMULATION.js"],"names":[],"mappings":"AA8IA;;;;;;;;;;;GAWG;AACH,sCALW,MAAM,YACN,MAAM,mBACN,MAAM,GACJ,MAAM,CAOlB;AA/JD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH;;;GAGG;AACH,8BAFU,MAAM,CAE0B;AAE1C;;;GAGG;AACH,gCAFU,MAAM,CAE4B;AAE5C;;;;GAIG;AACH,sCAFU,MAAM,CAEyB;AAEzC;;;GAGG;AACH,gCAFU,MAAM,CAEmB;AAEnC;;;GAGG;AACH,gCAFU,MAAM,CAEmB;AAEnC,oCAAqC;AACrC,oCAAqC;AACrC,iCAAkC;AAClC,yCAA0C;AAC1C,sCAAuC;AAEvC;;;;GAIG;AACH,sCAFU,MAAM,CAEyB;AAEzC;;;GAGG;AACH,+BAFU,MAAM,CAEuB;AAEvC;;;;GAIG;AACH,kCAFU,MAAM,CAE0B;AAE1C;;;GAGG;AACH,+BAFU,MAAM,CAEsB;AAEtC;;;GAGG;AACH,iCAFU,MAAM,CAE0B;AAE1C;;;GAGG;AACH,iCAFU,MAAM,CAEuB;AAEvC;;;;GAIG;AACH,6CAFU,MAAM,CAEkC;AAElD;;;GAGG;AACH,kCAFU,MAAM,CAEsB;AAEtC;;;;;;;;;;;;;;GAcG;AACH,kCAFU,MAAM,CAEsB;AAEtC;;;;;GAKG;AACH,sCAFU,MAAM,CAEyB"}
1
+ {"version":3,"file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AAM,CAEyB"}
@@ -11,19 +11,31 @@
11
11
  * for `P` nodes a guide and `G` guides, so the threads of neighbouring guides read neighbouring vectors.
12
12
  *
13
13
  * Positions are metres from the instance's **anchor**, its entity's translation this frame, along the world's axes:
14
- * near zero wherever the entity is, so a substep's small moves keep their precision far from the world's origin.
14
+ * near zero wherever the entity is, so a step's small moves keep their precision far from the world's origin.
15
+ *
16
+ * The guides are solved in steps of {@link HAIR_STEP}, whatever the frames' lengths ({@link hair_frame_steps}), and
17
+ * drawn between the last two steps: what the strands read is the **drawn** state, the solver's own is the **solved**
18
+ * one. The drawn state is blended in the frame of the guide's root (the entity's, or its strand's root frame on a bound
19
+ * mesh), from the step before the last to the last by the share of a step the frames have run past the last, and
20
+ * carried by the root's frame now: a guide's drawn root is its root this frame, and a root that turns or moves between
21
+ * steps carries its guide rigidly.
15
22
  *
16
23
  * ```
17
24
  * header 0 the anchor, world metres; w: the epoch the state was made for, u32 bits
18
- * 1 the anchor's move since the state was last stepped; w: 1 when the state is to be laid at rest
25
+ * 1 the anchor's move since the frame before; w: 1 when the state is to be laid at rest
19
26
  * 2..4 the entity's world matrix now, its columns' x, y and z, translation dropped
20
27
  * 5..7 the same a frame ago
21
28
  * 8 where the entity's origin was a frame ago, from the anchor
22
- * plane 0 a node's position
23
- * 1 its velocity, metres a second
24
- * 2 its frame: the rotation, a unit quaternion, from its rest frame carried by the entity to where it is
25
- * 3 its position a frame ago, from this frame's anchor
26
- * 4 its frame a frame ago
29
+ * plane 0 a node's drawn position
30
+ * 1 its solved velocity, metres a second, at the last step
31
+ * 2 its drawn frame: the rotation, a unit quaternion, from its rest frame carried by the entity to where it is
32
+ * 3 its drawn position a frame ago, from this frame's anchor
33
+ * 4 its drawn frame a frame ago
34
+ * 5 its solved position at the last step
35
+ * 6 its solved rotation at the last step, a unit quaternion: from the groom's rest space to the world, scale
36
+ * left out. The root node's is its root frame's.
37
+ * 7 its solved position a step before the last: from its guide's root, along the root frame's axes
38
+ * 8 its solved rotation a step before the last, in the root frame's axes
27
39
  * ```
28
40
  */
29
41
 
@@ -56,13 +68,17 @@ export const HAIR_STATE_HEADER = 9;
56
68
  * Planes of a guide state, a vector a node each.
57
69
  * @type {number}
58
70
  */
59
- export const HAIR_STATE_PLANES = 5;
71
+ export const HAIR_STATE_PLANES = 9;
60
72
 
61
73
  export const HAIR_STATE_POSITION = 0;
62
74
  export const HAIR_STATE_VELOCITY = 1;
63
75
  export const HAIR_STATE_FRAME = 2;
64
76
  export const HAIR_STATE_LAST_POSITION = 3;
65
77
  export const HAIR_STATE_LAST_FRAME = 4;
78
+ export const HAIR_STATE_SOLVED_POSITION = 5;
79
+ export const HAIR_STATE_SOLVED_ROTATION = 6;
80
+ export const HAIR_STATE_PREVIOUS_POSITION = 7;
81
+ export const HAIR_STATE_PREVIOUS_ROTATION = 8;
66
82
 
67
83
  /**
68
84
  * Words of a guide's record in the groom pool: its strand's rank, its wisp's strand count, its wisp's diameter and
@@ -72,10 +88,53 @@ export const HAIR_STATE_LAST_FRAME = 4;
72
88
  export const HAIR_GUIDE_RECORD_WORDS = 4;
73
89
 
74
90
  /**
75
- * The longest substep, seconds: a frame is cut into as many as keep each within it.
91
+ * The solver's step, seconds: every step is this long, whatever the frames' lengths, so the hair's pose and its
92
+ * stability do not follow the frame rate.
76
93
  * @type {number}
77
94
  */
78
- export const HAIR_SUBSTEP_MAX = 1 / 60;
95
+ export const HAIR_STEP = 1 / 60;
96
+
97
+ /** Steps the solver takes this frame, in {@link hair_frame_steps}' result. */
98
+ export const HAIR_FRAME_STEPS_COUNT = 0;
99
+
100
+ /** Seconds the frames have run past the last step, less than {@link HAIR_STEP}, in {@link hair_frame_steps}' result. */
101
+ export const HAIR_FRAME_STEPS_OWED = 1;
102
+
103
+ /** The share of the frame's motion the first step falls at, in {@link hair_frame_steps}' result. */
104
+ export const HAIR_FRAME_STEPS_FIRST = 2;
105
+
106
+ /** The share of the frame's motion from a step to the next, in {@link hair_frame_steps}' result. */
107
+ export const HAIR_FRAME_STEPS_STRIDE = 3;
108
+
109
+ /** How far the drawn state is from the step before the last, 0, to the last, 1, in {@link hair_frame_steps}' result. */
110
+ export const HAIR_FRAME_STEPS_BLEND = 4;
111
+
112
+ /**
113
+ * How a frame's time is cut into the solver's steps. The time not yet stepped through, `owed` from the frames
114
+ * before and this frame's `seconds` (at most {@link HAIR_FRAME_STEP_MAX} of them), is stepped through in whole
115
+ * steps of {@link HAIR_STEP}; what is left is owed to the next frame. A step falls at a time within the frame, and
116
+ * reads the world there: the share of the frame's motion, from a frame ago at 0 to now at 1, is `first` for the
117
+ * frame's first step and `stride` more for each after it. The drawn state is `blend` of the way from the step
118
+ * before the last to the last: a step behind the scene's clock, always.
119
+ *
120
+ * @param {Float64Array|number[]} result written: the `HAIR_FRAME_STEPS_*` words
121
+ * @param {number} owed seconds the frames before ran past their last step, in `[0, HAIR_STEP)`
122
+ * @param {number} seconds the scene's clock moved this frame
123
+ */
124
+ export function hair_frame_steps(result, owed, seconds) {
125
+ const frame = Math.min(seconds, HAIR_FRAME_STEP_MAX);
126
+ const time = owed + frame;
127
+ const count = Math.floor(time / HAIR_STEP);
128
+
129
+ // never negative, and never a whole step: the count is what the division's rounding made it
130
+ const left = Math.min(Math.max(time - count * HAIR_STEP, 0), HAIR_STEP * (1 - Number.EPSILON));
131
+
132
+ result[HAIR_FRAME_STEPS_COUNT] = count;
133
+ result[HAIR_FRAME_STEPS_OWED] = left;
134
+ result[HAIR_FRAME_STEPS_FIRST] = count > 0 ? Math.min((HAIR_STEP - owed) / frame, 1) : 0;
135
+ result[HAIR_FRAME_STEPS_STRIDE] = count > 0 ? HAIR_STEP / frame : 0;
136
+ result[HAIR_FRAME_STEPS_BLEND] = left / HAIR_STEP;
137
+ }
79
138
 
80
139
  /**
81
140
  * The longest frame the simulation steps, seconds, as the animation clamps its own: a stall slows the hair rather
@@ -126,11 +185,12 @@ export const HAIR_COLLIDER_LIMIT = 32;
126
185
  * 8 .. 11 from the world to its own frame, as the pose pass writes it: the rotation, a unit quaternion
127
186
  * 12 .. 14 the translation after it
128
187
  * 15 the scale after that: distances in its frame are the world's times it
188
+ * 16 .. 23 the same a frame ago
129
189
  * ```
130
190
  *
131
191
  * @type {number}
132
192
  */
133
- export const HAIR_COLLIDER_WORDS = 16;
193
+ export const HAIR_COLLIDER_WORDS = 24;
134
194
 
135
195
  /**
136
196
  * Words of an instance's guide bounds a row: the largest of each coordinate over its nodes, then the smallest, as