ugly-game 0.15.11 → 0.15.13

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 (47) hide show
  1. package/dist/gpuShadow.d.ts +131 -18
  2. package/dist/gpuShadow.js +1080 -200
  3. package/package.json +1 -1
  4. package/dist/anim/animBlend.d.ts +0 -24
  5. package/dist/anim/animBlend.js +0 -156
  6. package/dist/anim/animCook.d.ts +0 -78
  7. package/dist/anim/animCook.js +0 -233
  8. package/dist/anim/animEval.d.ts +0 -47
  9. package/dist/anim/animEval.js +0 -203
  10. package/dist/anim/animFootPlant.d.ts +0 -220
  11. package/dist/anim/animFootPlant.js +0 -311
  12. package/dist/anim/animGlb.d.ts +0 -98
  13. package/dist/anim/animGlb.js +0 -216
  14. package/dist/anim/animHandIk.d.ts +0 -56
  15. package/dist/anim/animHandIk.js +0 -67
  16. package/dist/anim/animHold.d.ts +0 -32
  17. package/dist/anim/animHold.js +0 -82
  18. package/dist/anim/animIR.d.ts +0 -95
  19. package/dist/anim/animIR.js +0 -167
  20. package/dist/anim/animIk.d.ts +0 -79
  21. package/dist/anim/animIk.js +0 -189
  22. package/dist/anim/animLocomotion.d.ts +0 -243
  23. package/dist/anim/animLocomotion.js +0 -525
  24. package/dist/anim/animLookAt.d.ts +0 -74
  25. package/dist/anim/animLookAt.js +0 -128
  26. package/dist/anim/animMask.d.ts +0 -25
  27. package/dist/anim/animMask.js +0 -82
  28. package/dist/anim/animMirror.d.ts +0 -45
  29. package/dist/anim/animMirror.js +0 -110
  30. package/dist/anim/animMotion.d.ts +0 -288
  31. package/dist/anim/animMotion.js +0 -619
  32. package/dist/anim/animOracle.d.ts +0 -66
  33. package/dist/anim/animOracle.js +0 -121
  34. package/dist/anim/animQuality.d.ts +0 -95
  35. package/dist/anim/animQuality.js +0 -428
  36. package/dist/anim/animRef.d.ts +0 -71
  37. package/dist/anim/animRef.js +0 -243
  38. package/dist/anim/animSample.d.ts +0 -4
  39. package/dist/anim/animSample.js +0 -57
  40. package/dist/anim/animSockets.d.ts +0 -141
  41. package/dist/anim/animSockets.js +0 -258
  42. package/dist/anim/animThresholds.d.ts +0 -29
  43. package/dist/anim/animThresholds.js +0 -197
  44. package/dist/anim/animTypes.d.ts +0 -122
  45. package/dist/anim/animTypes.js +0 -69
  46. package/dist/anim/animUgm.d.ts +0 -75
  47. package/dist/anim/animUgm.js +0 -352
@@ -82,15 +82,34 @@ export declare const CUBE: {
82
82
  pos: string;
83
83
  nrm: string;
84
84
  };
85
+ /**
86
+ * HOW MANY SEGMENTS A ROUNDED CORNER IS CUT INTO. 1 is what this file did for its whole life: a
87
+ * chamfer, one flat 45° face per edge and one flat triangle per corner.
88
+ *
89
+ * ⚠️ A CHAMFER IS NOT A RADIUS, and only the EDGES got away with it. A band's shading normal sweeps
90
+ * 90° across the strip, which shades almost exactly like a cylinder, so a flat edge reads round. A
91
+ * corner has nowhere to sweep to: it is one triangle with one plane, its silhouette is a straight
92
+ * cut, and no amount of normal work fixes that. Reported as "all corners should be radiused, it
93
+ * seems like you are trying to draw a simple triangle for the corners" — which is what it was.
94
+ *
95
+ * The band's end arc and the facet's edge arc are THE SAME CIRCLE — radius b, centred at the corner
96
+ * pulled in by b on all three axes — so subdividing both is one construction and they meet arc for
97
+ * arc at every step. At 1 it reproduces the old geometry exactly.
98
+ */
99
+ export declare const BEVEL_SEG = 1;
85
100
  /** Vertex counts for the two cube geometries the camera pass can draw. */
86
101
  export declare const SHARP_VERTS = 36;
87
- export declare const BEVEL_VERTS = 276;
102
+ export declare const BEVEL_VERTS: number;
88
103
  /** What a vertex is, which decides how it is allowed to move. */
89
104
  export declare const ROLE_SHARP = 0;
90
105
  export declare const ROLE_CENTER = 1;
91
106
  export declare const ROLE_RIM = 2;
92
107
  export declare const ROLE_BAND = 3;
93
108
  export declare const ROLE_FACET = 4;
109
+ export declare const ROLE_FRIM = 5;
110
+ export declare const ROLE_FMID = 6;
111
+ export declare const ROLE_CARVE = 7;
112
+ export declare const ROLE_BASE = 8;
94
113
  export interface BevelCube {
95
114
  /** Which of the 8 sharp corners each vertex sits on — always (±0.5, ±0.5, ±0.5), except a fan
96
115
  * hub, which sits at its face centre. */
@@ -105,6 +124,8 @@ export interface BevelCube {
105
124
  * face's two in-plane axes stays put), which is what splits one corner into two
106
125
  * points and turns the quad into a pentagon.
107
126
  * ROLE_FACET — the cube edge this facet vertex belongs to.
127
+ * ROLE_CARVE — the cube edge this patch vertex runs `b` down, which is the ONE axis it moves
128
+ * along. One per axis, so the three of them are the patch's three corners.
108
129
  * Zero for every other role. */
109
130
  axis: [number, number, number][];
110
131
  cornerWgsl: string;
@@ -124,27 +145,30 @@ export declare function occSolid(mask: number, o: readonly [number, number, numb
124
145
  * one that knows the other block is there.
125
146
  */
126
147
  export declare function edgeOpen(mask: number, a: readonly [number, number, number], b: readonly [number, number, number]): number;
148
+ /** `edgeOpen`, asked of the cell one step away at `off` — is the NEIGHBOUR chamfering this edge? */
149
+ export declare function edgeOpenAt(mask: number, off: readonly [number, number, number], a: readonly [number, number, number], b: readonly [number, number, number]): number;
127
150
  /**
128
- * THE TAPER — does this edge keep going in the next cell along it?
151
+ * Does the edge between exposed face `home` and its in-plane neighbour `e` get a FILLET?
129
152
  *
130
- * A chamfer used to be all-or-nothing per cell, so where a chamfered edge met a block that does not
131
- * chamfer (its own neighbour is solid) the rounding STOPPED DEAD in a step the height of the bevel.
132
- * That is the "concave corners are not rendering correctly" report: at every inside junction a
133
- * rounded edge ran into a square one and left a hard notch.
153
+ * Two bits, read from an exposed face, classify every edge there is — and they are the whole edge
154
+ * table from the design, with no case left over:
134
155
  *
135
- * `j` is the edge's own direction, signed toward the end this vertex sits at. Evaluating `edgeOpen`
136
- * one cell further along it asks whether the neighbour chamfers the same edge; multiplying, the band
137
- * fades to nothing across the last block instead of ending in a wall.
156
+ * occ(e) occ(home+e) cells solid class operation
157
+ * 0 0 1 convex CHAMFER (edgeOpen)
158
+ * 1 0 2 adj flat nothing
159
+ * 1 1 3 concave FILLET
160
+ * 0 1 2 diag saddle FILLET
138
161
  *
139
- * ⚠️ AND THIS IS WHY IT CANNOT TEAR, which the previous attempt at the same symptom could not claim.
140
- * Take the two cells sharing a vertex along the edge: one computes `edgeOpen(here) · edgeOpen(there)`
141
- * and the other computes `edgeOpen(there) · edgeOpen(here)`. The product is SYMMETRIC, so they agree
142
- * by construction rather than by luck — no block can cut a shared corner its neighbour keeps.
162
+ * So the fillet gate is just `occ(home+e)` on an exposed face — the cell diagonally across the edge
163
+ * being solid is exactly the thing that makes a groove. ⚠️ THE SADDLE FALLS OUT FOR FREE and needs no
164
+ * code of its own: from either solid cube's side, its near quadrant is an ordinary concave groove.
143
165
  *
144
- * Every cell it reads (a+j, b+j, a+b+j) has all components in {-1,0,1}, so it stays inside the
145
- * 27-neighbourhood the mask carries.
166
+ * ⚠️ A FILLET ADDS MATERIAL, WHICH IS WHY IT CANNOT OPEN A HOLE. Every other rounding term in this
167
+ * file is guarded against tearing the surface, because cutting is what tears. Filling never does —
168
+ * and it is why the diagonal case, which three earlier versions tried to CUT into a connection and
169
+ * turned into a see-through diamond, is safe here.
146
170
  */
147
- export declare function edgeOpenTapered(mask: number, a: readonly [number, number, number], b: readonly [number, number, number], j: readonly [number, number, number]): number;
171
+ export declare function edgeFillet(mask: number, home: readonly [number, number, number], e: readonly [number, number, number]): number;
148
172
  /**
149
173
  * THE NOTCH — the exact complement of `edgeOpen`: both faces SOLID, the diagonal between them AIR.
150
174
  *
@@ -189,7 +213,95 @@ export declare const NOTCH_SCALE = 0.5;
189
213
  * ground — "concave corners are not rendering correctly". The step is the correct trade.
190
214
  */
191
215
  export declare function case3(mask: number, a: readonly [number, number, number], corner: readonly [number, number, number]): number;
192
- export declare function bevelVertex(corner: readonly [number, number, number], home: readonly [number, number, number], mask: number, bevel: number, role?: number, axis?: readonly [number, number, number]): [number, number, number];
216
+ /**
217
+ * THE INSIDE CORNER, as an EIGHT-CELL configuration — `case3` plus the three cells above it.
218
+ *
219
+ * `case3` alone says the surface turns a corner here. It does NOT say the two chamfers this patch
220
+ * has to meet actually exist, and that is a different question: the neighbour at `fa` chamfers its
221
+ * edge into the notch only if the cells above IT and above the notch are air too. Where they are
222
+ * not, there is no band end to land on, the patch's sides find no partner, and both halves of this
223
+ * change open holes instead of closing them (measured: the random field went 21 unpaired edges to
224
+ * 34, six of them the patch's own sides).
225
+ *
226
+ * So the gate is the whole corner, all eight cells around the lattice point:
227
+ *
228
+ * LOWER layer — this cube SOLID, both in-plane neighbours SOLID, the notch AIR
229
+ * UPPER layer — all four AIR
230
+ *
231
+ * ⚠️ THIS IS A CASE TABLE ENTRY, NOT A HEURISTIC, and the narrowness is the point. It is the ONE
232
+ * configuration whose patch is watertight by construction, because every one of the three points is
233
+ * then already emitted by a neighbour. Any other corner is left exactly as it was — the design's own
234
+ * conclusion that a corner is a 256-case marching-cubes configuration rather than something to be
235
+ * hand-enumerated, and the rest of that table is not built yet.
236
+ *
237
+ * ⚠️ AND IT GATES THE RIM RETREAT TOO, not just the patch. The retreat is only safe where the
238
+ * neighbour retreats its own rim by the same b, which is the same condition. See bevelVertex.
239
+ */
240
+ export declare function carveOpen(mask: number, home: readonly [number, number, number], corner: readonly [number, number, number]): number;
241
+ /**
242
+ * THE BASE CORNER — one convex edge meeting two concave ones, asked by any of the eight cells.
243
+ * Returns the direction of the ALL-SOLID layer, or null.
244
+ *
245
+ * A block standing on a plane, at its base: the block's vertical edge is convex and chamfered, and
246
+ * its two junctions with the plane are concave and filleted. Reported from production as "all convex
247
+ * edges that merge with two concave edges in a corner look broken" — the fillets run along each wall
248
+ * and stop dead at the block's vertical edge instead of wrapping it, leaving a notch you can see
249
+ * through. 83% of every corner in a real terrain sample that does not close.
250
+ */
251
+ export declare function baseAt(mask: number, corner: readonly [number, number, number]): [number, number, number] | null;
252
+ /**
253
+ * …and whether THIS cube is the one that emits the patch: the cell of the flat surface that sits on
254
+ * the 3D diagonal from the block.
255
+ *
256
+ * ⚠️ THE FLAT SURFACE OWNS IT, NOT THE BLOCK, and that is not arbitrary. The patch is a piece of
257
+ * FILLET wrapping the block's corner, and the design's rule for fillets is that each half is emitted
258
+ * by the cube whose face it grows out of. Emitting the whole thing from the block put its shading
259
+ * normal on a face the geometry does not lie on — it hangs BELOW the block — and it shipped as black
260
+ * wedges. From the surface cell the normal is that cell's own top face, which is where the patch
261
+ * actually sits, and bevelConsistent's shading check passes by construction rather than by choice.
262
+ * The diagonal cell is the one neither wall's fillet already covers.
263
+ */
264
+ export declare function baseOwner(mask: number, corner: readonly [number, number, number]): [number, number, number] | null;
265
+ /**
266
+ * THE SAME INSIDE CORNER, ASKED BY ANY OF THE EIGHT CELLS — the direction of the all-air layer, or
267
+ * null. `carveOpen` can only be asked by the ONE cube whose exposed face turns the corner; this is
268
+ * the frame-independent form, and the two neighbours need it.
269
+ *
270
+ * ⚠️ THEY NEED IT BECAUSE A FACE THAT DOES NOT RETREAT COVERS THE PATCH. The corner cube's two side
271
+ * faces at such a corner are BURIED — each is shared with one of the neighbours — so nothing in the
272
+ * chamfer rules touches them, and they keep their full square corner while the carve cuts the corner
273
+ * away in front of them. What is left is a thin triangular sheet of each standing in open air, two
274
+ * of them meeting in a V exactly where the rounded corner should be: the patch is drawn, and you
275
+ * cannot see it. It is the "little sheets between each cube" report again, at a carved corner.
276
+ *
277
+ * A buried face is drawn by BOTH cubes that share it, so both have to reach the same verdict or the
278
+ * clip opens a seam. Both see all eight cells (they are all within one step of either cube), and
279
+ * this asks only about those eight — so they cannot disagree.
280
+ */
281
+ export declare function carveCorner(mask: number, corner: readonly [number, number, number]): [number, number, number] | null;
282
+ /**
283
+ * WHICH face at this corner is the exposed one that the carve fires on — or null if none is.
284
+ *
285
+ * The corner carve (section 6) is a property of the CORNER, but a triangle's texture and shading
286
+ * normal come from a `home` face, and which of the three faces meeting here is the exposed one is
287
+ * something only the mask knows. So the patch's `home` is resolved at draw time, from this.
288
+ *
289
+ * ⚠️ AT MOST ONE FACE CAN ANSWER, which is what makes "the corner's verdict" well defined and means
290
+ * no election is needed. The gate on face `h` needs `h` AIR and both its in-plane neighbours SOLID;
291
+ * any other face at this corner is one of those in-plane neighbours, so it is solid and its own gate
292
+ * is false. The three tests are mutually exclusive by construction.
293
+ *
294
+ * ⚠️ AND ONLY ONE OF THE EIGHT CELLS CAN ANSWER AT ALL, which is what makes the patch need no
295
+ * ownership election. Of the three solid cells at such a corner, the two neighbours each see the
296
+ * notch across a FACE, not diagonally, so their own in-plane pair is never both-solid.
297
+ */
298
+ export declare function carveFace(mask: number, corner: readonly [number, number, number]): [number, number, number] | null;
299
+ export declare function bevelVertex(corner: readonly [number, number, number], home: readonly [number, number, number], mask: number, bevel: number, role?: number, axis?: readonly [number, number, number],
300
+ /** The CONCAVE radius. Separate from `bevel` (the convex one) so the two halves of the rounding
301
+ * can be turned up, down and off independently — the only way to tell which one a defect is in.
302
+ * Defaults to the convex radius, which is the "one uniformly rounded solid" the design wants. */
303
+ concave?: number): [number, number, number];
304
+ export declare const COMMON_WGSL: string;
193
305
  export declare class GpuShadowRenderer {
194
306
  private device;
195
307
  private instBuf;
@@ -245,6 +357,7 @@ export declare class GpuShadowRenderer {
245
357
  private matCutoff;
246
358
  private eye;
247
359
  private bevel;
360
+ private fillet;
248
361
  private alphaPipe;
249
362
  private alphaBGL;
250
363
  private overlayBuf;
@@ -349,7 +462,7 @@ export declare class GpuShadowRenderer {
349
462
  * The shadow pass keeps the sharp cube either way. At 0 the vertex count drops back to 36, so
350
463
  * leaving this alone costs exactly what it cost before the feature existed.
351
464
  */
352
- setBevel(amount: number): void;
465
+ setBevel(amount: number, concave?: number): void;
353
466
  setAtlas(tex: GPUTexture, layout: AtlasLayout): void;
354
467
  /** Static scene: sizes the buffer to exactly these instances. */
355
468
  setScene(instances: CubeInstance[]): void;