@opsydyn/effect-three 0.3.0 → 0.4.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.
Files changed (125) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +12 -0
  3. package/dist/{index-8cf8t6by.js → index-h3vf50fn.js} +2113 -83
  4. package/dist/index-h3vf50fn.js.map +53 -0
  5. package/dist/index-ttwy0znv.js +145 -0
  6. package/dist/index-ttwy0znv.js.map +12 -0
  7. package/dist/index.js +488 -147
  8. package/dist/index.js.map +8 -6
  9. package/dist/kernel/boxSelect.d.ts +22 -0
  10. package/dist/kernel/boxSelect.d.ts.map +1 -0
  11. package/dist/kernel/build.d.ts +142 -6
  12. package/dist/kernel/build.d.ts.map +1 -1
  13. package/dist/kernel/cameraShake.d.ts.map +1 -1
  14. package/dist/kernel/describeScene.d.ts +50 -0
  15. package/dist/kernel/describeScene.d.ts.map +1 -0
  16. package/dist/kernel/description.d.ts +155 -1
  17. package/dist/kernel/description.d.ts.map +1 -1
  18. package/dist/kernel/diff.d.ts +15 -0
  19. package/dist/kernel/diff.d.ts.map +1 -1
  20. package/dist/kernel/equality.d.ts +9 -1
  21. package/dist/kernel/equality.d.ts.map +1 -1
  22. package/dist/kernel/gizmo.d.ts +69 -0
  23. package/dist/kernel/gizmo.d.ts.map +1 -0
  24. package/dist/kernel/history.d.ts +61 -0
  25. package/dist/kernel/history.d.ts.map +1 -0
  26. package/dist/kernel/index.d.ts +13 -2
  27. package/dist/kernel/index.d.ts.map +1 -1
  28. package/dist/kernel/index.js +106 -3
  29. package/dist/kernel/index.js.map +1 -1
  30. package/dist/kernel/inspect.d.ts +85 -0
  31. package/dist/kernel/inspect.d.ts.map +1 -0
  32. package/dist/kernel/lineGeometry.d.ts +25 -0
  33. package/dist/kernel/lineGeometry.d.ts.map +1 -0
  34. package/dist/kernel/lockstep.d.ts +114 -0
  35. package/dist/kernel/lockstep.d.ts.map +1 -0
  36. package/dist/kernel/loop.d.ts.map +1 -1
  37. package/dist/kernel/materials.d.ts.map +1 -1
  38. package/dist/kernel/pivot.d.ts +54 -0
  39. package/dist/kernel/pivot.d.ts.map +1 -0
  40. package/dist/kernel/pointBuffers.d.ts +17 -0
  41. package/dist/kernel/pointBuffers.d.ts.map +1 -0
  42. package/dist/kernel/pointer.d.ts +12 -0
  43. package/dist/kernel/pointer.d.ts.map +1 -1
  44. package/dist/kernel/renderKit.d.ts +21 -1
  45. package/dist/kernel/renderKit.d.ts.map +1 -1
  46. package/dist/kernel/renderer.d.ts +6 -0
  47. package/dist/kernel/renderer.d.ts.map +1 -1
  48. package/dist/kernel/sceneChanges.d.ts +87 -0
  49. package/dist/kernel/sceneChanges.d.ts.map +1 -0
  50. package/dist/kernel/sceneGraph.d.ts +6 -0
  51. package/dist/kernel/sceneGraph.d.ts.map +1 -1
  52. package/dist/kernel/seeded.d.ts +9 -0
  53. package/dist/kernel/seeded.d.ts.map +1 -0
  54. package/dist/kernel/shots.d.ts +26 -0
  55. package/dist/kernel/shots.d.ts.map +1 -0
  56. package/dist/kernel/tape.d.ts +38 -0
  57. package/dist/kernel/tape.d.ts.map +1 -0
  58. package/dist/kernel/trail.d.ts +31 -0
  59. package/dist/kernel/trail.d.ts.map +1 -0
  60. package/dist/kernel/viewportGizmo.d.ts +25 -0
  61. package/dist/kernel/viewportGizmo.d.ts.map +1 -0
  62. package/dist/runtime/Inspector.d.ts +20 -0
  63. package/dist/runtime/Inspector.d.ts.map +1 -0
  64. package/dist/runtime/SceneFile.d.ts +448 -0
  65. package/dist/runtime/SceneFile.d.ts.map +1 -0
  66. package/dist/runtime/SceneSchema.d.ts +318 -0
  67. package/dist/runtime/SceneSchema.d.ts.map +1 -1
  68. package/dist/runtime/errors.d.ts +9 -0
  69. package/dist/runtime/errors.d.ts.map +1 -1
  70. package/dist/runtime/index.d.ts +3 -1
  71. package/dist/runtime/index.d.ts.map +1 -1
  72. package/dist/webgl/index.d.ts.map +1 -1
  73. package/dist/webgl/index.js +228 -3
  74. package/dist/webgl/index.js.map +6 -4
  75. package/dist/webgl/line.d.ts +4 -0
  76. package/dist/webgl/line.d.ts.map +1 -0
  77. package/dist/webgl/points.d.ts +4 -0
  78. package/dist/webgl/points.d.ts.map +1 -0
  79. package/dist/webgpu/index.d.ts.map +1 -1
  80. package/dist/webgpu/index.js +206 -26
  81. package/dist/webgpu/index.js.map +6 -4
  82. package/dist/webgpu/line.d.ts +4 -0
  83. package/dist/webgpu/line.d.ts.map +1 -0
  84. package/dist/webgpu/points.d.ts +4 -0
  85. package/dist/webgpu/points.d.ts.map +1 -0
  86. package/package.json +2 -1
  87. package/src/kernel/boxSelect.ts +73 -0
  88. package/src/kernel/build.ts +332 -0
  89. package/src/kernel/cameraShake.ts +3 -13
  90. package/src/kernel/describeScene.ts +224 -0
  91. package/src/kernel/description.ts +175 -0
  92. package/src/kernel/diff.ts +39 -0
  93. package/src/kernel/equality.ts +101 -0
  94. package/src/kernel/gizmo.ts +478 -0
  95. package/src/kernel/history.ts +118 -0
  96. package/src/kernel/index.ts +97 -0
  97. package/src/kernel/inspect.ts +214 -0
  98. package/src/kernel/lineGeometry.ts +75 -0
  99. package/src/kernel/lockstep.ts +237 -0
  100. package/src/kernel/loop.ts +5 -0
  101. package/src/kernel/materials.ts +3 -0
  102. package/src/kernel/pivot.ts +418 -0
  103. package/src/kernel/pointBuffers.ts +115 -0
  104. package/src/kernel/pointer.ts +55 -12
  105. package/src/kernel/renderKit.ts +23 -1
  106. package/src/kernel/renderer.ts +6 -0
  107. package/src/kernel/sceneChanges.ts +265 -0
  108. package/src/kernel/sceneGraph.ts +319 -8
  109. package/src/kernel/seeded.ts +18 -0
  110. package/src/kernel/shots.ts +167 -0
  111. package/src/kernel/tape.ts +124 -0
  112. package/src/kernel/trail.ts +170 -0
  113. package/src/kernel/viewportGizmo.ts +194 -0
  114. package/src/runtime/Inspector.ts +43 -0
  115. package/src/runtime/SceneFile.ts +46 -0
  116. package/src/runtime/SceneSchema.ts +247 -0
  117. package/src/runtime/errors.ts +6 -0
  118. package/src/runtime/index.ts +3 -1
  119. package/src/webgl/index.ts +4 -0
  120. package/src/webgl/line.ts +66 -0
  121. package/src/webgl/points.ts +205 -0
  122. package/src/webgpu/index.ts +4 -0
  123. package/src/webgpu/line.ts +67 -0
  124. package/src/webgpu/points.ts +193 -0
  125. package/dist/index-8cf8t6by.js.map +0 -41
@@ -68,6 +68,15 @@ import {
68
68
  sharedMaterial2,
69
69
  group2,
70
70
  detailed2,
71
+ line2,
72
+ points2,
73
+ sparkles2,
74
+ stars2,
75
+ catmullRomPoints2,
76
+ catmullRomPointAt2,
77
+ catmullRomColors2,
78
+ cubicBezierPoints2,
79
+ quadraticBezierPoints2,
71
80
  headSpace2,
72
81
  jointSpace2,
73
82
  controllerSpace2,
@@ -78,6 +87,8 @@ import {
78
87
  xrMesh2,
79
88
  xrAnchor2,
80
89
  mesh2,
90
+ trail2,
91
+ edges2,
81
92
  body2,
82
93
  interactionGroups2,
83
94
  cuboidCollider2,
@@ -124,6 +135,7 @@ import {
124
135
  sky2,
125
136
  contactShadows2,
126
137
  overlay2,
138
+ hud2,
127
139
  scene2,
128
140
  emptyIndex2,
129
141
  indexScene2,
@@ -167,9 +179,51 @@ import {
167
179
  createPointerTracker2,
168
180
  createSceneLoop2,
169
181
  recordingRendererFactory2,
170
- createSceneGraph2
171
- } from "../index-8cf8t6by.js";
182
+ createSceneGraph2,
183
+ gizmo2,
184
+ pressGizmo2,
185
+ releaseGizmo2,
186
+ hoverGizmo2,
187
+ dragGizmo2,
188
+ movedAlike2,
189
+ gizmoHandleOf2,
190
+ gizmoNodes2,
191
+ boxSelect2,
192
+ exports_history,
193
+ exports_lockstep,
194
+ thingsBounds2,
195
+ describeScene2,
196
+ formatSummary2,
197
+ shotAngles2,
198
+ shotCamera2,
199
+ moods2,
200
+ moodStaging2,
201
+ inspectFields2,
202
+ setAt2,
203
+ sceneChanges2,
204
+ formatChanges2,
205
+ tape2,
206
+ placeTapeEnd2,
207
+ pointTape2,
208
+ clearTape2,
209
+ tapeLength2,
210
+ tapeMiddle2,
211
+ tapeNodes2,
212
+ pivot2,
213
+ pressPivot2,
214
+ releasePivot2,
215
+ hoverPivot2,
216
+ dragPivot2,
217
+ pivotHandleOf2,
218
+ pivotNodes2,
219
+ viewportGizmoNodes2,
220
+ viewportAxisOf2,
221
+ cameraAlong2
222
+ } from "../index-h3vf50fn.js";
223
+ import"../index-ttwy0znv.js";
172
224
  export {
225
+ exports_history as History,
226
+ exports_lockstep as Lockstep,
173
227
  ambientLight2 as ambientLight,
174
228
  anchorSpace2 as anchorSpace,
175
229
  animationEquals2 as animationEquals,
@@ -187,16 +241,22 @@ export {
187
241
  bodyRef2 as bodyRef,
188
242
  borrowed2 as borrowed,
189
243
  box2 as box,
244
+ boxSelect2 as boxSelect,
190
245
  buildMaterial2 as buildMaterial,
191
246
  builtinBehaviours2 as builtinBehaviours,
247
+ cameraAlong2 as cameraAlong,
192
248
  cameraEquals2 as cameraEquals,
193
249
  cameraShake2 as cameraShake,
194
250
  capacityFor2 as capacityFor,
195
251
  capsule2 as capsule,
196
252
  capsuleCollider2 as capsuleCollider,
253
+ catmullRomColors2 as catmullRomColors,
254
+ catmullRomPointAt2 as catmullRomPointAt,
255
+ catmullRomPoints2 as catmullRomPoints,
197
256
  centerOffset2 as centerOffset,
198
257
  changedFields2 as changedFields,
199
258
  circle2 as circle,
259
+ clearTape2 as clearTape,
200
260
  clipCamera2 as clipCamera,
201
261
  clipRunning2 as clipRunning,
202
262
  clipTime2 as clipTime,
@@ -221,18 +281,23 @@ export {
221
281
  createSceneGraph2 as createSceneGraph,
222
282
  createSceneLoop2 as createSceneLoop,
223
283
  createXrTracker2 as createXrTracker,
284
+ cubicBezierPoints2 as cubicBezierPoints,
224
285
  cuboidCollider2 as cuboidCollider,
225
286
  cylinder2 as cylinder,
226
287
  cylinderCollider2 as cylinderCollider,
227
288
  defaultOrbit2 as defaultOrbit,
289
+ describeScene2 as describeScene,
228
290
  describedColliders2 as describedColliders,
229
291
  detailed2 as detailed,
230
292
  diff2 as diff,
231
293
  directionalLight2 as directionalLight,
232
294
  dollyCamera2 as dollyCamera,
233
295
  dollyCameraToward2 as dollyCameraToward,
296
+ dragGizmo2 as dragGizmo,
297
+ dragPivot2 as dragPivot,
234
298
  ease2 as ease,
235
299
  easeProgress2 as easeProgress,
300
+ edges2 as edges,
236
301
  effectsEqual2 as effectsEqual,
237
302
  emptyIndex2 as emptyIndex,
238
303
  environment2 as environment,
@@ -244,7 +309,12 @@ export {
244
309
  fixed2 as fixed,
245
310
  fixedJoint2 as fixedJoint,
246
311
  float2 as float,
312
+ formatChanges2 as formatChanges,
313
+ formatSummary2 as formatSummary,
247
314
  geometryRefEquals2 as geometryRefEquals,
315
+ gizmo2 as gizmo,
316
+ gizmoHandleOf2 as gizmoHandleOf,
317
+ gizmoNodes2 as gizmoNodes,
248
318
  glide2 as glide,
249
319
  glided2 as glided,
250
320
  grid2 as grid,
@@ -252,7 +322,11 @@ export {
252
322
  handJoints2 as handJoints,
253
323
  headSpace2 as headSpace,
254
324
  hemisphereLight2 as hemisphereLight,
325
+ hoverGizmo2 as hoverGizmo,
326
+ hoverPivot2 as hoverPivot,
327
+ hud2 as hud,
255
328
  indexScene2 as indexScene,
329
+ inspectFields2 as inspectFields,
256
330
  instance2 as instance,
257
331
  instanceEquals2 as instanceEquals,
258
332
  instances2 as instances,
@@ -265,10 +339,14 @@ export {
265
339
  label2 as label,
266
340
  lambert2 as lambert,
267
341
  lentGeometry2 as lentGeometry,
342
+ line2 as line,
268
343
  locomote2 as locomote,
269
344
  materialRefEquals2 as materialRefEquals,
270
345
  mesh2 as mesh,
271
346
  meshSpace2 as meshSpace,
347
+ moodStaging2 as moodStaging,
348
+ moods2 as moods,
349
+ movedAlike2 as movedAlike,
272
350
  noModifiers2 as noModifiers,
273
351
  normalMaterial2 as normalMaterial,
274
352
  orbit2 as orbit,
@@ -283,15 +361,26 @@ export {
283
361
  physical2 as physical,
284
362
  physics2 as physics,
285
363
  physicsEquals2 as physicsEquals,
364
+ pivot2 as pivot,
365
+ pivotHandleOf2 as pivotHandleOf,
366
+ pivotNodes2 as pivotNodes,
286
367
  placeOverlays2 as placeOverlays,
368
+ placeTapeEnd2 as placeTapeEnd,
287
369
  plane2 as plane,
288
370
  planeSpace2 as planeSpace,
289
371
  play2 as play,
290
372
  pointLight2 as pointLight,
291
373
  pointOnPlane2 as pointOnPlane,
374
+ pointTape2 as pointTape,
375
+ points2 as points,
292
376
  positionMotor2 as positionMotor,
377
+ pressGizmo2 as pressGizmo,
378
+ pressPivot2 as pressPivot,
293
379
  prismaticJoint2 as prismaticJoint,
380
+ quadraticBezierPoints2 as quadraticBezierPoints,
294
381
  recordingRendererFactory2 as recordingRendererFactory,
382
+ releaseGizmo2 as releaseGizmo,
383
+ releasePivot2 as releasePivot,
295
384
  renderSettings2 as renderSettings,
296
385
  renderSettingsEquals2 as renderSettingsEquals,
297
386
  renderTexture2 as renderTexture,
@@ -304,13 +393,18 @@ export {
304
393
  rotationEquals2 as rotationEquals,
305
394
  roundedBox2 as roundedBox,
306
395
  scene2 as scene,
396
+ sceneChanges2 as sceneChanges,
397
+ setAt2 as setAt,
307
398
  shaderGrid2 as shaderGrid,
308
399
  shadowMaterial2 as shadowMaterial,
309
400
  shapeEquals2 as shapeEquals,
310
401
  sharedGeometry2 as sharedGeometry,
311
402
  sharedMaterial2 as sharedMaterial,
403
+ shotAngles2 as shotAngles,
404
+ shotCamera2 as shotCamera,
312
405
  sky2 as sky,
313
406
  skyEquals2 as skyEquals,
407
+ sparkles2 as sparkles,
314
408
  sphere2 as sphere,
315
409
  sphericalJoint2 as sphericalJoint,
316
410
  spin2 as spin,
@@ -321,16 +415,25 @@ export {
321
415
  stageBounds2 as stageBounds,
322
416
  stagePresets2 as stagePresets,
323
417
  standard2 as standard,
418
+ stars2 as stars,
324
419
  startTween2 as startTween,
325
420
  sunPositionFromAngles2 as sunPositionFromAngles,
421
+ tape2 as tape,
422
+ tapeLength2 as tapeLength,
423
+ tapeMiddle2 as tapeMiddle,
424
+ tapeNodes2 as tapeNodes,
326
425
  teleport2 as teleport,
327
426
  text2 as text,
427
+ thingsBounds2 as thingsBounds,
328
428
  torus2 as torus,
429
+ trail2 as trail,
329
430
  transitionEquals2 as transitionEquals,
330
431
  updateMaterial2 as updateMaterial,
331
432
  vec3Equals2 as vec3Equals,
332
433
  velocityMotor2 as velocityMotor,
333
434
  view2 as view,
435
+ viewportAxisOf2 as viewportAxisOf,
436
+ viewportGizmoNodes2 as viewportGizmoNodes,
334
437
  viewsEqual2 as viewsEqual,
335
438
  vignette2 as vignette,
336
439
  writeRotation2 as writeRotation,
@@ -341,5 +444,5 @@ export {
341
444
  xrMeshGeometryId2 as xrMeshGeometryId
342
445
  };
343
446
 
344
- //# debugId=E275C42D12CF324C64756E2164756E21
447
+ //# debugId=ACCA5BFCFA2D51FE64756E2164756E21
345
448
  //# sourceMappingURL=index.js.map
@@ -4,6 +4,6 @@
4
4
  "sourcesContent": [
5
5
  ],
6
6
  "mappings": "",
7
- "debugId": "E275C42D12CF324C64756E2164756E21",
7
+ "debugId": "ACCA5BFCFA2D51FE64756E2164756E21",
8
8
  "names": []
9
9
  }
@@ -0,0 +1,85 @@
1
+ /**
2
+ * The fields of a value, read from its schema (roadmap, "Beyond parity" 4: an inspector
3
+ * generated from the scene schemas). The runtime's `Inspector` passes a schema's AST in;
4
+ * this walks it beside the value and lists what an inspector shows: numbers, text,
5
+ * switches, choices of literals, colours, vectors, and the rest read-only (a node's
6
+ * kind, an absent part, a list of children). A tagged union shows the member the value
7
+ * is; nested structs show their fields under their name.
8
+ *
9
+ * The AST is read through the few shapes used here, so the kernel needs no schema
10
+ * library; colours and vectors are recognised by being the very AST nodes the caller
11
+ * names, not by field names.
12
+ *
13
+ * @module
14
+ */
15
+ import type { Vec3 } from './description.ts';
16
+ /** Where a field is in the value: property names and list indices from the top. */
17
+ export type FieldPath = ReadonlyArray<string | number>;
18
+ /** What an inspector's controls produce: a number, text, or a switch's state. */
19
+ export type FieldValue = number | string | boolean;
20
+ type Base = {
21
+ readonly path: FieldPath;
22
+ readonly label: string;
23
+ };
24
+ /** A field as an inspector shows it. */
25
+ export type InspectedField = Base & ({
26
+ readonly _tag: 'Number';
27
+ readonly value: number;
28
+ } | {
29
+ readonly _tag: 'Text';
30
+ readonly value: string;
31
+ } | {
32
+ readonly _tag: 'Toggle';
33
+ readonly value: boolean;
34
+ } | {
35
+ readonly _tag: 'Choice';
36
+ readonly value: string;
37
+ readonly options: ReadonlyArray<string>;
38
+ } | {
39
+ readonly _tag: 'Colour';
40
+ readonly value: number;
41
+ } | {
42
+ readonly _tag: 'Vector';
43
+ readonly value: Vec3;
44
+ }
45
+ /** Shown, not edited: a kind, an absent part, a list, or what this cannot edit. */
46
+ | {
47
+ readonly _tag: 'Fixed';
48
+ readonly text: string;
49
+ });
50
+ /** The parts of a schema AST read here (Effect's `SchemaAST`, structurally). */
51
+ export type InspectableAst = {
52
+ readonly _tag: 'Suspend';
53
+ readonly thunk: () => InspectableAst;
54
+ } | {
55
+ readonly _tag: 'Objects';
56
+ readonly propertySignatures: ReadonlyArray<{
57
+ readonly name: PropertyKey;
58
+ readonly type: InspectableAst;
59
+ }>;
60
+ } | {
61
+ readonly _tag: 'Arrays';
62
+ readonly elements: ReadonlyArray<InspectableAst>;
63
+ readonly rest: ReadonlyArray<InspectableAst>;
64
+ } | {
65
+ readonly _tag: 'Union';
66
+ readonly types: ReadonlyArray<InspectableAst>;
67
+ } | {
68
+ readonly _tag: 'Literal';
69
+ readonly literal: unknown;
70
+ } | {
71
+ readonly _tag: 'Number' | 'String' | 'Boolean' | 'Null';
72
+ } | {
73
+ readonly _tag: string;
74
+ };
75
+ /** AST nodes shown as a colour picker or as three numbers, by identity. */
76
+ export type InspectHints = {
77
+ readonly colours: ReadonlyArray<unknown>;
78
+ readonly vectors: ReadonlyArray<unknown>;
79
+ };
80
+ /** The fields of `value` as its schema's AST describes them, in the schema's order. */
81
+ export declare const inspectFields: (ast: InspectableAst, value: unknown, hints?: InspectHints) => ReadonlyArray<InspectedField>;
82
+ /** `value` with `next` at `path`, every object and list on the way copied, not changed. */
83
+ export declare const setAt: (value: unknown, path: FieldPath, next: unknown) => unknown;
84
+ export {};
85
+ //# sourceMappingURL=inspect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../src/kernel/inspect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C,mFAAmF;AACnF,MAAM,MAAM,SAAS,GAAG,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;AAEvD,iFAAiF;AACjF,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEnD,KAAK,IAAI,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjE,wCAAwC;AACxC,MAAM,MAAM,cAAc,GAAG,IAAI,GAC/B,CACI;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACnD;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACjD;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GACpD;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CAAE,GAC5F;IAAE,QAAQ,CAAC,IAAI,EAAE,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AG;IACzB,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;CAC1C,CAAC;AAsIF,uFAAuF;AACvF,eAAO,MAAM,aAAa,QACnB,cAAc,SACZ,OAAO,UACP,YAAY,KAClB,aAAa,CAAC,cAAc,CAAgC,CAAC;AAEhE,2FAA2F;AAC3F,eAAO,MAAM,KAAK,UAAW,OAAO,QAAQ,SAAS,QAAQ,OAAO,KAAG,OAUtE,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * A line's geometry, as Drei's `Line` builds it: three's `LineGeometry` through the points
3
+ * (or `LineSegmentsGeometry`, a segment for each pair), with a colour per point when it
4
+ * has them. Shared by the render kits, whose materials differ; the geometry does not.
5
+ *
6
+ * @module
7
+ */
8
+ import { type BufferGeometry } from 'three';
9
+ import type { LineSegmentsGeometry } from 'three/addons/lines/LineSegmentsGeometry.js';
10
+ import type { Edges, LineNode, Vec3 } from './description.ts';
11
+ /** Whether there is anything to draw: two points for a line, a pair for segments. */
12
+ export declare const drawable: (line: LineNode) => boolean;
13
+ /**
14
+ * Fills a line's geometry: a `LineGeometry` through the points, or a
15
+ * `LineSegmentsGeometry` for segments. Too few points give one empty segment (hidden).
16
+ */
17
+ export declare const fillLineGeometry: <G extends LineSegmentsGeometry>(geometry: G, line: LineNode) => G;
18
+ /**
19
+ * The line segments along a geometry's edges where faces meet at more than `threshold`
20
+ * degrees, as Drei's `Edges` takes them from three's `EdgesGeometry`.
21
+ */
22
+ export declare const edgePoints: (geometry: BufferGeometry, threshold: number) => ReadonlyArray<Vec3>;
23
+ /** The line a mesh's edges are drawn as: segments in the mesh's own space. */
24
+ export declare const edgeLine: (key: string, look: Edges, points: ReadonlyArray<Vec3>) => LineNode;
25
+ //# sourceMappingURL=lineGeometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lineGeometry.d.ts","sourceRoot":"","sources":["../../src/kernel/lineGeometry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,KAAK,cAAc,EAAwB,MAAM,OAAO,CAAC;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAEvF,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE9D,qFAAqF;AACrF,eAAO,MAAM,QAAQ,SAAU,QAAQ,KAAG,OAAkC,CAAC;AAE7E;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,oBAAoB,YACnD,CAAC,QACL,QAAQ,KACb,CAYF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU,aAAc,cAAc,aAAa,MAAM,KAAG,aAAa,CAAC,IAAI,CAS1F,CAAC;AAEF,8EAA8E;AAC9E,eAAO,MAAM,QAAQ,QAAS,MAAM,QAAQ,KAAK,UAAU,aAAa,CAAC,IAAI,CAAC,KAAG,QAsB/E,CAAC"}
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Lockstep, as data (roadmap, "Beyond parity" 2): peers that run the same `update` stay
3
+ * in the same state by applying the same inputs in the same order. Time is cut into
4
+ * turns; every member sends one packet for each turn (empty when it did nothing), and a
5
+ * turn applies only once every member's packet for it has arrived, its inputs in peer
6
+ * order. Any transport that delivers each packet to every peer will do: a
7
+ * `BroadcastChannel` between tabs, a socket relay between machines.
8
+ *
9
+ * Membership changes in step too. The leader (the member whose id sorts first) admits
10
+ * a newcomer with an entry in its own packet; when that turn applies, everywhere at
11
+ * once, the newcomer becomes a member `lead + 1` turns later, and the leader sends it
12
+ * the state as it is then (`welcomeDue`), from which it carries on. A member that leaves
13
+ * says which turn it sent last (`leave`); one that goes quiet is dropped by the leader
14
+ * from the turn everyone is waiting on, which no one can have applied.
15
+ *
16
+ * Pure functions over a value, like the rest of the kernel: an app keeps the `Lockstep`
17
+ * in its Model, sends what `send` gives it, passes what arrives to `receive`, and
18
+ * applies what `advance` returns. Use it as a namespace: `Lockstep.make(self)`.
19
+ *
20
+ * @module
21
+ */
22
+ /** What a turn carries: an app's input, or the leader admitting a newcomer. */
23
+ export type Entry<I> = {
24
+ readonly _tag: 'Input';
25
+ readonly input: I;
26
+ } | {
27
+ readonly _tag: 'Admit';
28
+ readonly peer: string;
29
+ };
30
+ /** One member's packet for one turn. */
31
+ export type Packet<I> = {
32
+ readonly peer: string;
33
+ readonly turn: number;
34
+ readonly entries: ReadonlyArray<Entry<I>>;
35
+ };
36
+ /** A member: the first turn it sends for, and the turn it stopped before, once it has. */
37
+ export type Member = {
38
+ readonly peer: string;
39
+ readonly from: number;
40
+ readonly until: number | null;
41
+ };
42
+ export type Lockstep<I> = {
43
+ readonly self: string;
44
+ readonly members: ReadonlyArray<Member>;
45
+ /** The next turn to apply. */
46
+ readonly turn: number;
47
+ /** The next turn this peer sends for. */
48
+ readonly sent: number;
49
+ /** How many turns ahead of the applied one a peer may send: inputs wait this long. */
50
+ readonly lead: number;
51
+ /** Entries waiting for this peer's next packet. */
52
+ readonly pending: ReadonlyArray<Entry<I>>;
53
+ /** Packets for turns not yet applied, this peer's own among them. */
54
+ readonly received: ReadonlyArray<Packet<I>>;
55
+ };
56
+ /** An input applied: the turn, and the peer it came from. */
57
+ export type Applied<I> = {
58
+ readonly turn: number;
59
+ readonly peer: string;
60
+ readonly input: I;
61
+ };
62
+ /** The members a turn waits for, in the order their inputs apply. */
63
+ export declare const membersAt: <I>(state: Lockstep<I>, turn: number) => ReadonlyArray<string>;
64
+ /** The member who admits and drops others at `turn`: the one whose id sorts first. */
65
+ export declare const leaderAt: <I>(state: Lockstep<I>, turn: number) => string | undefined;
66
+ /** A session of one: this peer alone, from turn 0. */
67
+ export declare const make: <I>(self: string, lead?: number) => Lockstep<I>;
68
+ /**
69
+ * A newcomer's session, from the leader's welcome: the members and the turn it starts
70
+ * at, with whatever packets it heard while it waited.
71
+ */
72
+ export declare const join: <I>(self: string, welcome: {
73
+ readonly turn: number;
74
+ readonly members: ReadonlyArray<Member>;
75
+ readonly lead: number;
76
+ }, heard?: ReadonlyArray<Packet<I>>) => Lockstep<I>;
77
+ /** `input` waits for this peer's next packet. */
78
+ export declare const submit: <I>(state: Lockstep<I>, input: I) => Lockstep<I>;
79
+ /** The leader asks for `peer` to be admitted; anyone else, or a known peer, changes nothing. */
80
+ export declare const admit: <I>(state: Lockstep<I>, peer: string) => Lockstep<I>;
81
+ /**
82
+ * A packet arriving: kept until its turn applies. Ones for turns already applied, from
83
+ * peers not members then, and second copies are dropped.
84
+ */
85
+ export declare const receive: <I>(state: Lockstep<I>, packet: Packet<I>) => Lockstep<I>;
86
+ /**
87
+ * This peer's packet for its next turn, with what is pending, when it is a member then
88
+ * and not more than `lead` turns ahead; it keeps its own copy.
89
+ */
90
+ export declare const send: <I>(state: Lockstep<I>) => {
91
+ readonly state: Lockstep<I>;
92
+ readonly packet: Packet<I> | undefined;
93
+ };
94
+ /** Peers whose packet for the next turn has not arrived: what the session waits on. */
95
+ export declare const waitingOn: <I>(state: Lockstep<I>) => ReadonlyArray<string>;
96
+ /**
97
+ * Every turn whose packets have all arrived, applied in order: the new state, and the
98
+ * inputs to apply to the app, oldest first and in peer order within a turn.
99
+ */
100
+ export declare const advance: <I>(state: Lockstep<I>) => {
101
+ readonly state: Lockstep<I>;
102
+ readonly applied: ReadonlyArray<Applied<I>>;
103
+ };
104
+ /**
105
+ * Newcomers this peer, as leader, should welcome now: those who become members at the
106
+ * turn about to apply, once every turn before it has (the state is then theirs to start
107
+ * from). Each is due once: at the moment `before` (the previous turn) is passed.
108
+ */
109
+ export declare const welcomeDue: <I>(before: number, state: Lockstep<I>) => ReadonlyArray<string>;
110
+ /** This peer leaving: the turn it sent last, for the others to stop waiting after. */
111
+ export declare const leave: <I>(state: Lockstep<I>) => number;
112
+ /** `peer` stops being a member from `until`; its packets from then are dropped. */
113
+ export declare const remove: <I>(state: Lockstep<I>, peer: string, until: number) => L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Q,KACjB,OAkCF,CAAC"}
1
+ {"version":3,"file":"materials.d.ts","sourceRoot":"","sources":["../../src/kernel/materials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAIL,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,IAAI,mBAAmB,EAErC,KAAK,OAAO,EACb,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EASV,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAE1B,4CAA4C;AAC5C,MAAM,MAAM,QAAQ,GAAG,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,GAAG,SAAS,CAAC;AAgB3D,oDAAoD;AACpD,MAAM,MAAM,YAAY,GACpB,iBAAiB,GACjB,mBAAmB,GACnB,iBAAiB,GACjB,oBAAoB,GACpB,oBAAoB,GACpB,kBAAkB,GAClB,mBAAmB,CAAC;AAgHxB,+CAA+C;AAC/C,eAAO,MAAM,aAAa,gBACX,eAAe,aAClB,QAAQ,KACjB,YAsCF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,aACf,YAAY,eACT,eAAe,aAClB,QAAQ,KACjB,OAkCF,CAAC"}
@@ -0,0 +1,54 @@
1
+ import type { SceneNode, Vec3 } from './description.ts';
2
+ import type { Placement } from './gizmo.ts';
3
+ import type { Ray } from './pointer.ts';
4
+ type Axis = 'x' | 'y' | 'z';
5
+ /** A handle: what it does, and the axis it is on (a square's and an arc's normal). */
6
+ export type PivotHandle = `${'arrow' | 'slider' | 'rotator' | 'sphere'}-${Axis}`;
7
+ /** A drag in progress: the handle, the placement it began at and the frame it moves in. */
8
+ export type PivotGrab = {
9
+ readonly handle: PivotHandle;
10
+ readonly start: Placement;
11
+ /** Where the press hit the handle. */
12
+ readonly point: Vec3;
13
+ /** The handle's directions in the world: its axis, or its plane's two and normal. */
14
+ readonly e1: Vec3;
15
+ readonly e2: Vec3;
16
+ readonly normal: Vec3;
17
+ };
18
+ export type Pivot = {
19
+ /** The handles' size in scene units: an arrow's length (Drei's `scale`, 1). */
20
+ readonly scale: number;
21
+ /** Whether the object hides the handles behind it (Drei's `depthTest`, true). */
22
+ readonly depthTest: boolean;
23
+ /** Leave out kinds of handle, as Drei's `disable*`. */
24
+ readonly disableAxes: boolean;
25
+ readonly disableSliders: boolean;
26
+ readonly disableRotations: boolean;
27
+ readonly disableScaling: boolean;
28
+ /** The handle under the pointer, drawn in Drei's hovered yellow. */
29
+ readonly hovered: PivotHandle | null;
30
+ readonly grab: PivotGrab | null;
31
+ };
32
+ /** Pivot controls with Drei's defaults: size 1, depth tested, every handle shown. */
33
+ export declare const pivot: (options?: Partial<Omit<Pivot, 'hovered' | 'grab'>>) => Pivot;
34
+ /** A press on `handle` at `point`, with the object at `placement`: takes hold. */
35
+ export declare const pressPivot: (state: Pivot, placement: Placement, handle: PivotHandle, point: Vec3) => Pivot;
36
+ export declare const releasePivot: (state: Pivot) => Pivot;
37
+ export declare const hoverPivot: (state: Pivot, handle: PivotHandle | null) => Pivot;
38
+ /**
39
+ * The placement a drag ray gives, or `undefined` while nothing is held. `snap` rounds
40
+ * turns to ten degrees and scales to tenths, as Drei's shift does.
41
+ */
42
+ export declare const dragPivot: (state: Pivot, ray: Ray, options?: {
43
+ readonly snap?: boolean;
44
+ }) => Placement | undefined;
45
+ /** The handle a hit names, if it is one of this pivot's. */
46
+ export declare const pivotHandleOf: (key: string, hit: string) => PivotHandle | undefined;
47
+ /**
48
+ * The handles for `placement`: a group at the object, turned with it (and not scaled),
49
+ * its handles keyed `${key}:arrow-x`, `${key}:slider-z`, `${key}:rotator-y`,
50
+ * `${key}:sphere-x` and so on, each pickable.
51
+ */
52
+ export declare const pivotNodes: (key: string, state: Pivot, placement: Placement) => SceneNode;
53
+ export {};
54
+ //# sourceMappingURL=pivot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pivot.d.ts","sourceRoot":"","sources":["../../src/kernel/pivot.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AAM,KAAK,aAAa,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAAC,CAAC,KAAQ,KAS7E,CAAC;AAoCH,kFAAkF;AAClF,eAAO,MAAM,UAAU,UACd,KAAK,aACD,SAAS,UACZ,WAAW,SACZ,IAAI,KACV,KAaF,CAAC;AAEF,eAAO,MAAM,YAAY,UAAW,KAAK,KAAG,KAAmC,CAAC;AAEhF,eAAO,MAAM,UAAU,UAAW,KAAK,UAAU,WAAW,GAAG,IAAI,KAAG,KACJ,CAAC;AAmGnE;;;GAGG;AACH,eAAO,MAAM,SAAS,UACb,KAAK,OACP,GAAG,YACC;IAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,KACnC,SAAS,GAAG,SASd,CAAC;AAUF,4DAA4D;AAC5D,eAAO,MAAM,aAAa,QAAS,MAAM,OAAO,MAAM,KAAG,WAAW,GAAG,SAMtE,CAAC;AA0IF;;;;GAIG;AACH,eAAO,MAAM,UAAU,QAAS,MAAM,SAAS,KAAK,aAAa,SAAS,KAAG,SAWzE,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { PointLook } from './description.ts';
2
+ /** Per-point attributes: three numbers a point for positions, colours and noise. */
3
+ export type PointBuffers = {
4
+ readonly count: number;
5
+ readonly positions: Float32Array;
6
+ readonly colors: Float32Array;
7
+ readonly sizes: Float32Array;
8
+ /** Sparkles only: each mote's drift speed, opacity and noise. */
9
+ readonly speeds: Float32Array;
10
+ readonly opacities: Float32Array;
11
+ readonly noise: Float32Array;
12
+ };
13
+ /** The buffers for a look. */
14
+ export declare const pointBuffers: (look: PointLook) => PointBuffers;
15
+ /** Whether a look moves on its own: sparkles drift and stars twinkle in scene time. */
16
+ export declare const animatedLook: (look: PointLook) => boolean;
17
+ //# sourceMappingURL=pointBuffers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pointBuffers.d.ts","sourceRoot":"","sources":["../../src/kernel/pointBuffers.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGlD,oFAAoF;AACpF,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,iEAAiE;IACjE,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;CAC9B,CAAC;AA+EF,8BAA8B;AAC9B,eAAO,MAAM,YAAY,SAAU,SAAS,KAAG,YAS9C,CAAC;AAEF,uFAAuF;AACvF,eAAO,MAAM,YAAY,SAAU,SAAS,KAAG,OAA+B,CAAC"}
@@ -195,6 +195,18 @@ export type SceneEvent = HitEvent<'PointerEnter'> | {
195
195
  readonly _tag: 'Gesture';
196
196
  readonly gesture: Gesture;
197
197
  }
198
+ /**
199
+ * A gesture that moved has ended: released, or the pointer left. Only after a `Drag`
200
+ * or `Pinch`, with the press's button, modifiers, mesh and view: the moment to finish
201
+ * what the gesture drew, such as a selection box.
202
+ */
203
+ | {
204
+ readonly _tag: 'GestureEnd';
205
+ readonly button: number;
206
+ readonly modifiers: Modifiers;
207
+ readonly key?: string;
208
+ readonly view?: string;
209
+ }
198
210
  /**
199
211
  * A gesture is about to begin on a camera that has turned by itself (`autoRotate`):
200
212
  * where it got to, so the Model can keep it (`autoRotated(camera, detail)`) and the