@origingame/engine 0.3.0 → 0.5.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 (92) hide show
  1. package/dist/web/origin-engine.d.ts +44 -5
  2. package/dist/web/origin-engine.js +279 -19
  3. package/dist/web/origin-engine_bg.wasm +0 -0
  4. package/dist/web/origin-engine_bg.wasm.d.ts +18 -5
  5. package/dist/web-publish/origin-engine-lanes.js +289 -48
  6. package/dist/web-publish/origin-engine-lanes_bg.wasm +0 -0
  7. package/dist/web-publish/origin-engine.d.ts +44 -5
  8. package/dist/web-publish/origin-engine.js +279 -38
  9. package/dist/web-publish/origin-engine_bg.wasm +0 -0
  10. package/dist/web-publish/origin-engine_bg.wasm.d.ts +18 -5
  11. package/dist/web-publish-2d/origin-engine-lanes.js +289 -48
  12. package/dist/web-publish-2d/origin-engine-lanes_bg.wasm +0 -0
  13. package/dist/web-publish-2d/origin-engine.d.ts +44 -5
  14. package/dist/web-publish-2d/origin-engine.js +279 -38
  15. package/dist/web-publish-2d/origin-engine_bg.wasm +0 -0
  16. package/dist/web-publish-2d/origin-engine_bg.wasm.d.ts +18 -5
  17. package/knowledge/README.md +2 -1
  18. package/knowledge/guides/three-to-og.md +393 -0
  19. package/knowledge/knowledge.json +2 -1
  20. package/knowledge/looks/catalogue.json +123 -2
  21. package/knowledge/package.json +3 -2
  22. package/knowledge/scaffold/origin-engine.json +2 -2
  23. package/knowledge/scaffold/template/package.json +1 -1
  24. package/knowledge/scaffold/template/project.ogt +1 -1
  25. package/knowledge/scripts/validate.ts +209 -27
  26. package/knowledge/skills/og-audio/SKILL.md +33 -7
  27. package/knowledge/skills/og-build/SKILL.md +66 -7
  28. package/knowledge/skills/og-core/SKILL.md +24 -8
  29. package/knowledge/skills/og-feel/SKILL.md +11 -3
  30. package/knowledge/skills/og-game/SKILL.md +680 -51
  31. package/knowledge/skills/og-i18n/SKILL.md +7 -7
  32. package/knowledge/skills/og-model/SKILL.md +374 -0
  33. package/knowledge/skills/og-platform-sdk/SKILL.md +7 -1
  34. package/knowledge/skills/og-taste/SKILL.md +7 -0
  35. package/knowledge/skills/og-ui/SKILL.md +39 -8
  36. package/knowledge/wiki/ai.md +20 -20
  37. package/knowledge/wiki/anim.md +537 -63
  38. package/knowledge/wiki/atmosphere.md +13 -13
  39. package/knowledge/wiki/audio.md +160 -20
  40. package/knowledge/wiki/camera.md +13 -13
  41. package/knowledge/wiki/commands.md +11 -11
  42. package/knowledge/wiki/debug.md +13 -13
  43. package/knowledge/wiki/game.md +8 -8
  44. package/knowledge/wiki/i18n.md +7 -7
  45. package/knowledge/wiki/index.md +81 -3
  46. package/knowledge/wiki/input.md +47 -47
  47. package/knowledge/wiki/load.md +83 -57
  48. package/knowledge/wiki/math.md +102 -102
  49. package/knowledge/wiki/nav.md +34 -34
  50. package/knowledge/wiki/net.md +10 -10
  51. package/knowledge/wiki/path.md +14 -14
  52. package/knowledge/wiki/physics.md +111 -100
  53. package/knowledge/wiki/platform.md +44 -44
  54. package/knowledge/wiki/probe.md +86 -86
  55. package/knowledge/wiki/reflect.md +30 -18
  56. package/knowledge/wiki/render.md +1243 -176
  57. package/knowledge/wiki/rng.md +14 -14
  58. package/knowledge/wiki/shapes.md +727 -0
  59. package/knowledge/wiki/stream.md +15 -15
  60. package/knowledge/wiki/system.md +8 -8
  61. package/knowledge/wiki/systems.md +2 -2
  62. package/knowledge/wiki/terrain.md +24 -20
  63. package/knowledge/wiki/tilemap.md +13 -13
  64. package/knowledge/wiki/time.md +4 -4
  65. package/knowledge/wiki/timeline.md +14 -14
  66. package/knowledge/wiki/transform.md +8 -8
  67. package/knowledge/wiki/tween.md +17 -17
  68. package/knowledge/wiki/ui.md +245 -269
  69. package/knowledge/wiki/video.md +5 -5
  70. package/knowledge/wiki/world.md +36 -36
  71. package/package.json +4 -4
  72. package/schema/api.schema.json +2238 -81
  73. package/shell/page.ts +4 -0
  74. package/shell/platform.ts +5 -0
  75. package/shell/player.ts +8 -2
  76. package/shell/transport.ts +6 -0
  77. package/src/generated/abi.ts +40 -1
  78. package/src/geom.ts +260 -0
  79. package/src/index.ts +19 -1
  80. package/src/node/device.ts +5 -2
  81. package/src/node/playtest-run.ts +1 -0
  82. package/src/node/polish.ts +34 -15
  83. package/src/node/run.ts +23 -6
  84. package/src/platform-local.ts +2 -0
  85. package/src/playtest.ts +8 -0
  86. package/src/runtime.ts +88 -6
  87. package/src/ui-kit/settings.ts +9 -0
  88. package/src/web/gl-state.ts +907 -0
  89. package/src/web/shell.ts +1 -1
  90. package/src/web/worker.ts +8 -2
  91. package/types/bindings.json +1222 -453
  92. package/types/index.d.ts +1868 -315
@@ -16,7 +16,7 @@ module atmosphere {
16
16
  # declarations follow, each quoted below
17
17
  ```
18
18
 
19
- <sub>`api.ogt` line 6734</sub>
19
+ <sub>`api.ogt` line 7356</sub>
20
20
 
21
21
  ## Contents
22
22
 
@@ -63,7 +63,7 @@ fn timeOfDay {
63
63
  }
64
64
  ```
65
65
 
66
- <sub>`api.ogt` line 7130</sub>
66
+ <sub>`api.ogt` line 7752</sub>
67
67
 
68
68
  ## Components, resources and events
69
69
 
@@ -177,7 +177,7 @@ resource Fog {
177
177
  }
178
178
  ```
179
179
 
180
- <sub>`api.ogt` line 6745</sub>
180
+ <sub>`api.ogt` line 7367</sub>
181
181
 
182
182
  <a id="record-Sky"></a>
183
183
 
@@ -284,7 +284,7 @@ resource Sky {
284
284
  }
285
285
  ```
286
286
 
287
- <sub>`api.ogt` line 6826</sub>
287
+ <sub>`api.ogt` line 7448</sub>
288
288
 
289
289
  <a id="record-DayNight"></a>
290
290
 
@@ -366,7 +366,7 @@ resource DayNight {
366
366
  }
367
367
  ```
368
368
 
369
- <sub>`api.ogt` line 6901</sub>
369
+ <sub>`api.ogt` line 7523</sub>
370
370
 
371
371
  <a id="record-Weather"></a>
372
372
 
@@ -428,7 +428,7 @@ resource Weather {
428
428
  }
429
429
  ```
430
430
 
431
- <sub>`api.ogt` line 6958</sub>
431
+ <sub>`api.ogt` line 7580</sub>
432
432
 
433
433
  <a id="record-Water"></a>
434
434
 
@@ -562,7 +562,7 @@ component Water {
562
562
  }
563
563
  ```
564
564
 
565
- <sub>`api.ogt` line 6998</sub>
565
+ <sub>`api.ogt` line 7620</sub>
566
566
 
567
567
  <a id="record-Water2D"></a>
568
568
 
@@ -616,7 +616,7 @@ component Water2D {
616
616
  }
617
617
  ```
618
618
 
619
- <sub>`api.ogt` line 7098</sub>
619
+ <sub>`api.ogt` line 7720</sub>
620
620
 
621
621
  ## Constants
622
622
 
@@ -632,28 +632,28 @@ component Water2D {
632
632
  const WEATHER_NONE u32 0 "Weather.kind: clear."
633
633
  ```
634
634
 
635
- <sub>`api.ogt` line 6739</sub>
635
+ <sub>`api.ogt` line 7361</sub>
636
636
 
637
637
  ```ogt
638
638
  const WEATHER_RAIN u32 1 "Weather.kind: rain streaks falling with the wind, the light dimmed and a grey distance fog."
639
639
  ```
640
640
 
641
- <sub>`api.ogt` line 6740</sub>
641
+ <sub>`api.ogt` line 7362</sub>
642
642
 
643
643
  ```ogt
644
644
  const WEATHER_SNOW u32 2 "Weather.kind: flakes drifting down on gusts, a pale fog."
645
645
  ```
646
646
 
647
- <sub>`api.ogt` line 6741</sub>
647
+ <sub>`api.ogt` line 7363</sub>
648
648
 
649
649
  ```ogt
650
650
  const WEATHER_DUST u32 3 "Weather.kind: dust blowing along the wind near the ground, a warm thick fog."
651
651
  ```
652
652
 
653
- <sub>`api.ogt` line 6742</sub>
653
+ <sub>`api.ogt` line 7364</sub>
654
654
 
655
655
  ```ogt
656
656
  const WEATHER_MIST u32 4 "Weather.kind: no particles, a dense low height fog."
657
657
  ```
658
658
 
659
- <sub>`api.ogt` line 6743</sub>
659
+ <sub>`api.ogt` line 7365</sub>
@@ -8,6 +8,8 @@ The stream, not the PCM, is world state: snapshots, restore and the world hash c
8
8
 
9
9
  Spatial gain and pan are computed in the tick from the source's world transform relative to the first AudioListener's (three.js convention: the listener looks down -Z, +X is right; with none, the origin looking down -Z). A source, listener or zone on a child entity is placed at its og.Transform composed down og.Parent, as og.MatrixWorld is: a sound on a child is heard where its parent carries it, a listener under a camera rig hears from the rig.
10
10
 
11
+ Propagation, all in the tick and so in the stream: a spatial source or listener that moves shifts the pitch (Doppler, from their tick velocities: AudioSource.dopplerFactor, AudioListener.dopplerFactor, Audio.speedOfSound), a source with a cone is turned down away from its +Z (coneInnerAngle, coneOuterAngle, coneOuterGain, as three.js's setDirectionalCone), and a listener whose panningModel is hrtf places sources for headphones (interaural delay and head shadow) instead of the stereo panner.
12
+
11
13
  - **TypeScript**: functions are the namespace `og.audio`; components, resources and events are tokens on `og`.
12
14
  - **Publish builds**: kept (members may override).
13
15
  - **Skill**: `og-audio`, which teaches the module (how much of it to use, and how to prove it).
@@ -18,7 +20,7 @@ module audio {
18
20
  # declarations follow, each quoted below
19
21
  ```
20
22
 
21
- <sub>`api.ogt` line 8069</sub>
23
+ <sub>`api.ogt` line 8941</sub>
22
24
 
23
25
  ## Contents
24
26
 
@@ -29,8 +31,13 @@ module audio {
29
31
  | [`SOUND_REMOVED`](#const-SOUND_REMOVED) | constant | SoundEnded.reason: the AudioSource was removed from a living entity. |
30
32
  | [`SOUND_REPLACED`](#const-SOUND_REPLACED) | constant | SoundEnded.reason: `sound` changed while it played. |
31
33
  | [`SOUND_CULLED`](#const-SOUND_CULLED) | constant | SoundEnded.reason: more sources played than Audio.maxVoices and this one stood lowest (priority, then volume, then age). |
34
+ | [`SOUND_RETRIGGERED`](#const-SOUND_RETRIGGERED) | constant | SoundEnded.reason: AudioSource.retrigger started the sound again from the top; a new voice plays it. |
32
35
  | [`AudioBus`](#type-AudioBus) | enum | The bus a source plays on; every bus passes through master. |
33
36
  | [`AudioBus()`](#column-AudioBus) | column kind | An AudioBus field: the variant's index. |
37
+ | [`PanningModel`](#type-PanningModel) | enum | How an AudioListener places spatial sources between the ears, as Web Audio's PannerNode.panningModel. |
38
+ | [`AudioResampler`](#type-AudioResampler) | enum | How the mixer resamples a voice whose pitch or sound rate differs from the output's. |
39
+ | [`AudioResampler()`](#column-AudioResampler) | column kind | An AudioResampler field: the variant's index. |
40
+ | [`PanningModel()`](#column-PanningModel) | column kind | A PanningModel field: the variant's index. |
34
41
  | [`og.AudioSource`](#record-AudioSource) | component | A sound an entity plays. Level-triggered: while `playing` is true it plays (inserting a source plays it), setting it false stops it, and a one-shot that reaches its end sets it back to false and sends og.SoundEnded. |
35
42
  | [`og.AudioListener`](#record-AudioListener) | component | Where spatial sources are heard from: the entity's world transform (its og.Transform down og.Parent, so a listener under a camera rig hears from the rig), looking down its -Z with +X to the right. The first listener in query order is used. |
36
43
  | [`og.Audio`](#record-Audio) | resource | Bus volumes; master scales every bus. A change ramps over 256 frames in the mixer. |
@@ -73,7 +80,7 @@ fn outputLatency {
73
80
  }
74
81
  ```
75
82
 
76
- <sub>`api.ogt` line 8449</sub>
83
+ <sub>`api.ogt` line 9395</sub>
77
84
 
78
85
  ## Components, resources and events
79
86
 
@@ -109,6 +116,12 @@ Token `og.AudioSource`, registered under the schema name `og.AudioSource`; its v
109
116
  | `startAt` | `number` | `0` | ≥ 0 | `s` | — | Starts at this world time (seconds since tick 0), to the sample, even inside a tick; 0 or a time past starts at once. Music.nextBar and Music.nextBeat give musical times. |
110
117
  | `startOffset` | `number` | `0` | ≥ 0 | `s` | — | Where in the sound it starts, in seconds of the sound: started at startAt (or at once) from this far in, to the sample and at full gain, so a resumed phrase continues instead of restarting. Past a one-shot's end it plays nothing; a loop wraps into its region. |
111
118
  | `fade` | `number` | `0` | 0 … 30 | `s` | tunable | Starts, stops and volume changes ramp over this long: a crossfade is one source stopped and another started with the same fade; 0 is 5 ms. |
119
+ | `dopplerFactor` | `number` | `1` | 0 … 10 | — | tunable | Doppler: how much a spatial source's and the listener's motion along the line between them shifts its pitch, from their tick velocities (world positions down og.Parent): pitch times (c - DF * vListener) / (c - DF * vSource), c being Audio.speedOfSound and DF this times AudioListener.dopplerFactor (OpenAL's model). 1 is physical, 0 is off. A jump at or past the speed of sound in a tick is a teleport and shifts nothing; DF * v is held within c/2, so the shift stays within a factor of 3. |
120
+ | `coneInnerAngle` | `number` | `360` | 0 … 360 | `deg` | tunable | Directivity, as three.js PositionalAudio.setDirectionalCone and Web Audio's PannerNode: a spatial source plays at full volume while the listener is within this full angle about the source's +Z (its world transform's, three.js's PositionalAudio orientation); 360 with coneOuterAngle 360 is omnidirectional. |
121
+ | `coneOuterAngle` | `number` | `360` | 0 … 360 | `deg` | tunable | Past this full angle about the source's +Z it plays at coneOuterGain; between coneInnerAngle and this the gain falls linearly with the angle. |
122
+ | `coneOuterGain` | `number` | `0` | 0 … 1 | — | tunable | The gain outside coneOuterAngle. |
123
+ | `virtualize` | `boolean` | `false` | — | — | — | Past Audio.maxVoices it goes virtual instead of being culled: silent, its playhead running on (a one-shot still ends on its tick), and heard again from where it would be, fading in, once it stands within the cap. Without it the source is culled (SOUND_CULLED, playing false). |
124
+ | `retrigger` | `boolean` | `false` | — | — | — | Set true to start the sound again from the top (its startOffset, its startAt) this tick, playing or not, without a level change on `playing`: the voice playing ends (SOUND_RETRIGGERED) and a new one starts in the same tick. The engine sets it back to false and `playing` true. |
112
125
 
113
126
  ```ogt
114
127
  component AudioSource {
@@ -197,10 +210,37 @@ component AudioSource {
197
210
  unit s
198
211
  tunable true
199
212
  }
213
+ field dopplerFactor f32 "Doppler: how much a spatial source's and the listener's motion along the line between them shifts its pitch, from their tick velocities (world positions down og.Parent): pitch times (c - DF * vListener) / (c - DF * vSource), c being Audio.speedOfSound and DF this times AudioListener.dopplerFactor (OpenAL's model). 1 is physical, 0 is off. A jump at or past the speed of sound in a tick is a teleport and shifts nothing; DF * v is held within c/2, so the shift stays within a factor of 3." {
214
+ default 1
215
+ min 0
216
+ max 10
217
+ tunable true
218
+ }
219
+ field coneInnerAngle f32 "Directivity, as three.js PositionalAudio.setDirectionalCone and Web Audio's PannerNode: a spatial source plays at full volume while the listener is within this full angle about the source's +Z (its world transform's, three.js's PositionalAudio orientation); 360 with coneOuterAngle 360 is omnidirectional." {
220
+ default 360
221
+ min 0
222
+ max 360
223
+ unit deg
224
+ tunable true
225
+ }
226
+ field coneOuterAngle f32 "Past this full angle about the source's +Z it plays at coneOuterGain; between coneInnerAngle and this the gain falls linearly with the angle." {
227
+ default 360
228
+ min 0
229
+ max 360
230
+ unit deg
231
+ tunable true
232
+ }
233
+ field coneOuterGain f32 "The gain outside coneOuterAngle." {
234
+ min 0
235
+ max 1
236
+ tunable true
237
+ }
238
+ field virtualize bool "Past Audio.maxVoices it goes virtual instead of being culled: silent, its playhead running on (a one-shot still ends on its tick), and heard again from where it would be, fading in, once it stands within the cap. Without it the source is culled (SOUND_CULLED, playing false)."
239
+ field retrigger bool "Set true to start the sound again from the top (its startOffset, its startAt) this tick, playing or not, without a level change on `playing`: the voice playing ends (SOUND_RETRIGGERED) and a new one starts in the same tick. The engine sets it back to false and `playing` true."
200
240
  }
201
241
  ```
202
242
 
203
- <sub>`api.ogt` line 8096</sub>
243
+ <sub>`api.ogt` line 8996</sub>
204
244
 
205
245
  <a id="record-AudioListener"></a>
206
246
 
@@ -213,6 +253,8 @@ Token `og.AudioListener`, registered under the schema name `og.AudioListener`; i
213
253
  | Field | Type | Default | Range | Unit | Notes | Doc |
214
254
  |---|---|---|---|---|---|---|
215
255
  | `volume` | `number` | `1` | 0 … 4 | — | tunable | A gain on every spatial source this listener hears. |
256
+ | `dopplerFactor` | `number` | `1` | 0 … 10 | — | tunable | Scales every spatial source's Doppler shift (AudioSource.dopplerFactor); 0 turns Doppler off for this listener. |
257
+ | `panningModel` | `PanningModel` | `"equalpower"` | — | — | — | How spatial sources are placed between the ears: equalpower (speakers) or hrtf (headphones). Non-spatial sources keep their pan either way; the stereo path is unchanged while it is equalpower. |
216
258
 
217
259
  ```ogt
218
260
  component AudioListener {
@@ -223,10 +265,19 @@ component AudioListener {
223
265
  max 4
224
266
  tunable true
225
267
  }
268
+ field dopplerFactor f32 "Scales every spatial source's Doppler shift (AudioSource.dopplerFactor); 0 turns Doppler off for this listener." {
269
+ default 1
270
+ min 0
271
+ max 10
272
+ tunable true
273
+ }
274
+ field panningModel PanningModel "How spatial sources are placed between the ears: equalpower (speakers) or hrtf (headphones). Non-spatial sources keep their pan either way; the stereo path is unchanged while it is equalpower." {
275
+ default equalpower
276
+ }
226
277
  }
227
278
  ```
228
279
 
229
- <sub>`api.ogt` line 8184</sub>
280
+ <sub>`api.ogt` line 9111</sub>
230
281
 
231
282
  <a id="record-Audio"></a>
232
283
 
@@ -248,6 +299,8 @@ Token `og.Audio`, registered under the schema name `og.Audio`; its value type is
248
299
  | `reverbRoom` | `number` | `0.6` | 0 … 1 | — | tunable | The shared reverb's room size (the AudioBusFx.reverb sends feed it). |
249
300
  | `reverbDamping` | `number` | `0.4` | 0 … 1 | — | tunable | The shared reverb's damping of high frequencies. |
250
301
  | `outputLatency` | `number` | `0` | ≥ 0 | `s` | read only | Seconds from a sample's world time to the speaker, as the host reports it (og.audio.outputLatency). |
302
+ | `speedOfSound` | `number` | `343.3` | 1 … 10000 | `mps` | tunable | The speed of sound Doppler shifts are computed against (AudioSource.dopplerFactor). |
303
+ | `resampler` | `AudioResampler` | `"sinc"` | — | — | — | How voices are resampled: sinc (the default) or linear, the mix before round 4, for a game that relies on its exact output. A sound at the output's rate played at pitch 1 is its own samples either way. |
251
304
 
252
305
  ```ogt
253
306
  resource Audio {
@@ -311,10 +364,20 @@ resource Audio {
311
364
  unit s
312
365
  readonly true
313
366
  }
367
+ field speedOfSound f32 "The speed of sound Doppler shifts are computed against (AudioSource.dopplerFactor)." {
368
+ default 343.3
369
+ min 1
370
+ max 10000
371
+ unit mps
372
+ tunable true
373
+ }
374
+ field resampler AudioResampler "How voices are resampled: sinc (the default) or linear, the mix before round 4, for a game that relies on its exact output. A sound at the output's rate played at pitch 1 is its own samples either way." {
375
+ default sinc
376
+ }
314
377
  }
315
378
  ```
316
379
 
317
- <sub>`api.ogt` line 8194</sub>
380
+ <sub>`api.ogt` line 9130</sub>
318
381
 
319
382
  <a id="record-AudioBusFx"></a>
320
383
 
@@ -435,7 +498,7 @@ component AudioBusFx {
435
498
  }
436
499
  ```
437
500
 
438
- <sub>`api.ogt` line 8257</sub>
501
+ <sub>`api.ogt` line 9203</sub>
439
502
 
440
503
  <a id="record-ReverbZone"></a>
441
504
 
@@ -506,7 +569,7 @@ component ReverbZone {
506
569
  }
507
570
  ```
508
571
 
509
- <sub>`api.ogt` line 8346</sub>
572
+ <sub>`api.ogt` line 9292</sub>
510
573
 
511
574
  <a id="record-Music"></a>
512
575
 
@@ -562,7 +625,7 @@ component Music {
562
625
  }
563
626
  ```
564
627
 
565
- <sub>`api.ogt` line 8392</sub>
628
+ <sub>`api.ogt` line 9338</sub>
566
629
 
567
630
  <a id="record-MusicBeat"></a>
568
631
 
@@ -589,7 +652,7 @@ event MusicBeat {
589
652
  }
590
653
  ```
591
654
 
592
- <sub>`api.ogt` line 8426</sub>
655
+ <sub>`api.ogt` line 9372</sub>
593
656
 
594
657
  <a id="record-SoundStarted"></a>
595
658
 
@@ -614,7 +677,7 @@ event SoundStarted {
614
677
  }
615
678
  ```
616
679
 
617
- <sub>`api.ogt` line 8434</sub>
680
+ <sub>`api.ogt` line 9380</sub>
618
681
 
619
682
  <a id="record-SoundEnded"></a>
620
683
 
@@ -629,7 +692,7 @@ Token `og.SoundEnded`, registered under the schema name `og.SoundEnded`; its val
629
692
  | `entity` | `Entity` | `0` | — | — | — | The entity whose AudioSource ended. |
630
693
  | `sound` | `Sound` | `0` | — | — | — | The sound. |
631
694
  | `voice` | `number` | `0` | — | — | — | The voice id in the command stream. |
632
- | `reason` | `number` | `0` | — | — | — | Why: SOUND_FINISHED (0), SOUND_STOPPED (1), SOUND_REMOVED (2), SOUND_REPLACED (3) or SOUND_CULLED (4). |
695
+ | `reason` | `number` | `0` | — | — | — | Why: SOUND_FINISHED (0), SOUND_STOPPED (1), SOUND_REMOVED (2), SOUND_REPLACED (3), SOUND_CULLED (4) or SOUND_RETRIGGERED (5). |
633
696
 
634
697
  ```ogt
635
698
  event SoundEnded {
@@ -637,11 +700,11 @@ event SoundEnded {
637
700
  field entity Entity "The entity whose AudioSource ended."
638
701
  field sound Sound "The sound."
639
702
  field voice u32 "The voice id in the command stream."
640
- field reason u32 "Why: SOUND_FINISHED (0), SOUND_STOPPED (1), SOUND_REMOVED (2), SOUND_REPLACED (3) or SOUND_CULLED (4)."
703
+ field reason u32 "Why: SOUND_FINISHED (0), SOUND_STOPPED (1), SOUND_REMOVED (2), SOUND_REPLACED (3), SOUND_CULLED (4) or SOUND_RETRIGGERED (5)."
641
704
  }
642
705
  ```
643
706
 
644
- <sub>`api.ogt` line 8441</sub>
707
+ <sub>`api.ogt` line 9387</sub>
645
708
 
646
709
  ## Types
647
710
 
@@ -670,7 +733,53 @@ enum AudioBus {
670
733
  }
671
734
  ```
672
735
 
673
- <sub>`api.ogt` line 8081</sub>
736
+ <sub>`api.ogt` line 8955</sub>
737
+
738
+ <a id="type-PanningModel"></a>
739
+
740
+ ### `PanningModel` (enum)
741
+
742
+ How an AudioListener places spatial sources between the ears, as Web Audio's PannerNode.panningModel.
743
+
744
+ A string: one of the variants below. The zero value is `"equalpower"`.
745
+
746
+ | Variant | Doc |
747
+ |---|---|
748
+ | `"equalpower"` | The stereo panner (Web Audio's equal-power law): for speakers. |
749
+ | `"hrtf"` | For headphones: a spherical-head model (Brown and Duda, 1998) that delays the far ear by the interaural time difference (up to 0.66 ms) and shadows its highs (up to -20 dB), so a source moves between the ears; front and back, up and down are not told apart (no pinna). |
750
+
751
+ ```ogt
752
+ enum PanningModel {
753
+ doc "How an AudioListener places spatial sources between the ears, as Web Audio's PannerNode.panningModel."
754
+ variant equalpower "The stereo panner (Web Audio's equal-power law): for speakers."
755
+ variant hrtf "For headphones: a spherical-head model (Brown and Duda, 1998) that delays the far ear by the interaural time difference (up to 0.66 ms) and shadows its highs (up to -20 dB), so a source moves between the ears; front and back, up and down are not told apart (no pinna)."
756
+ }
757
+ ```
758
+
759
+ <sub>`api.ogt` line 8970</sub>
760
+
761
+ <a id="type-AudioResampler"></a>
762
+
763
+ ### `AudioResampler` (enum)
764
+
765
+ How the mixer resamples a voice whose pitch or sound rate differs from the output's.
766
+
767
+ A string: one of the variants below. The zero value is `"linear"`.
768
+
769
+ | Variant | Doc |
770
+ |---|---|
771
+ | `"linear"` | Linear interpolation: the engine's mix before round 4, cheaper, with duller highs (-3.4 dB at 15 kHz from 44.1 kHz) and images (-11.5 dB there). |
772
+ | `"sinc"` | A Kaiser-windowed sinc (beta 7, 16 taps, 2048 phases; widened up to 64 taps for a voice pitched up to 4x): flat to the highs, images below -70 dB. |
773
+
774
+ ```ogt
775
+ enum AudioResampler {
776
+ doc "How the mixer resamples a voice whose pitch or sound rate differs from the output's."
777
+ variant linear "Linear interpolation: the engine's mix before round 4, cheaper, with duller highs (-3.4 dB at 15 kHz from 44.1 kHz) and images (-11.5 dB there)."
778
+ variant sinc "A Kaiser-windowed sinc (beta 7, 16 taps, 2048 phases; widened up to 64 taps for a voice pitched up to 4x): flat to the highs, images below -70 dB."
779
+ }
780
+ ```
781
+
782
+ <sub>`api.ogt` line 8976</sub>
674
783
 
675
784
  ## Column kinds
676
785
 
@@ -679,6 +788,8 @@ Each is a factory, `AudioBus(value?, options?)`, that makes one field of a compo
679
788
  | Column | Value | Typed array | Stride | Doc |
680
789
  |---|---|---|---|---|
681
790
  | <a id="column-AudioBus"></a>`AudioBus` | `AudioBus` | `Uint32Array` | 1 | An AudioBus field: the variant's index. |
791
+ | <a id="column-AudioResampler"></a>`AudioResampler` | `AudioResampler` | `Uint32Array` | 1 | An AudioResampler field: the variant's index. |
792
+ | <a id="column-PanningModel"></a>`PanningModel` | `PanningModel` | `Uint32Array` | 1 | A PanningModel field: the variant's index. |
682
793
 
683
794
  ```ogt
684
795
  column AudioBus {
@@ -689,7 +800,29 @@ column AudioBus {
689
800
  }
690
801
  ```
691
802
 
692
- <sub>`api.ogt` line 8089</sub>
803
+ <sub>`api.ogt` line 8963</sub>
804
+
805
+ ```ogt
806
+ column AudioResampler {
807
+ doc "An AudioResampler field: the variant's index."
808
+ array Uint32Array
809
+ stride 1
810
+ value AudioResampler
811
+ }
812
+ ```
813
+
814
+ <sub>`api.ogt` line 8982</sub>
815
+
816
+ ```ogt
817
+ column PanningModel {
818
+ doc "A PanningModel field: the variant's index."
819
+ array Uint32Array
820
+ stride 1
821
+ value PanningModel
822
+ }
823
+ ```
824
+
825
+ <sub>`api.ogt` line 8989</sub>
693
826
 
694
827
  ## Constants
695
828
 
@@ -700,33 +833,40 @@ column AudioBus {
700
833
  | <a id="const-SOUND_REMOVED"></a>`SOUND_REMOVED` | `number` | `2` | SoundEnded.reason: the AudioSource was removed from a living entity. |
701
834
  | <a id="const-SOUND_REPLACED"></a>`SOUND_REPLACED` | `number` | `3` | SoundEnded.reason: `sound` changed while it played. |
702
835
  | <a id="const-SOUND_CULLED"></a>`SOUND_CULLED` | `number` | `4` | SoundEnded.reason: more sources played than Audio.maxVoices and this one stood lowest (priority, then volume, then age). |
836
+ | <a id="const-SOUND_RETRIGGERED"></a>`SOUND_RETRIGGERED` | `number` | `5` | SoundEnded.reason: AudioSource.retrigger started the sound again from the top; a new voice plays it. |
703
837
 
704
838
  ```ogt
705
839
  const SOUND_FINISHED u32 0 "SoundEnded.reason: a one-shot played to its end."
706
840
  ```
707
841
 
708
- <sub>`api.ogt` line 8075</sub>
842
+ <sub>`api.ogt` line 8948</sub>
709
843
 
710
844
  ```ogt
711
845
  const SOUND_STOPPED u32 1 "SoundEnded.reason: `playing` was set to false."
712
846
  ```
713
847
 
714
- <sub>`api.ogt` line 8076</sub>
848
+ <sub>`api.ogt` line 8949</sub>
715
849
 
716
850
  ```ogt
717
851
  const SOUND_REMOVED u32 2 "SoundEnded.reason: the AudioSource was removed from a living entity."
718
852
  ```
719
853
 
720
- <sub>`api.ogt` line 8077</sub>
854
+ <sub>`api.ogt` line 8950</sub>
721
855
 
722
856
  ```ogt
723
857
  const SOUND_REPLACED u32 3 "SoundEnded.reason: `sound` changed while it played."
724
858
  ```
725
859
 
726
- <sub>`api.ogt` line 8078</sub>
860
+ <sub>`api.ogt` line 8951</sub>
727
861
 
728
862
  ```ogt
729
863
  const SOUND_CULLED u32 4 "SoundEnded.reason: more sources played than Audio.maxVoices and this one stood lowest (priority, then volume, then age)."
730
864
  ```
731
865
 
732
- <sub>`api.ogt` line 8079</sub>
866
+ <sub>`api.ogt` line 8952</sub>
867
+
868
+ ```ogt
869
+ const SOUND_RETRIGGERED u32 5 "SoundEnded.reason: AudioSource.retrigger started the sound again from the top; a new voice plays it."
870
+ ```
871
+
872
+ <sub>`api.ogt` line 8953</sub>
@@ -16,7 +16,7 @@ module camera {
16
16
  # declarations follow, each quoted below
17
17
  ```
18
18
 
19
- <sub>`api.ogt` line 1872</sub>
19
+ <sub>`api.ogt` line 1879</sub>
20
20
 
21
21
  ## Contents
22
22
 
@@ -62,7 +62,7 @@ fn shake {
62
62
  }
63
63
  ```
64
64
 
65
- <sub>`api.ogt` line 2212</sub>
65
+ <sub>`api.ogt` line 2219</sub>
66
66
 
67
67
  <a id="fn-punch"></a>
68
68
 
@@ -92,7 +92,7 @@ fn punch {
92
92
  }
93
93
  ```
94
94
 
95
- <sub>`api.ogt` line 2219</sub>
95
+ <sub>`api.ogt` line 2226</sub>
96
96
 
97
97
  <a id="fn-kick"></a>
98
98
 
@@ -124,7 +124,7 @@ fn kick {
124
124
  }
125
125
  ```
126
126
 
127
- <sub>`api.ogt` line 2226</sub>
127
+ <sub>`api.ogt` line 2233</sub>
128
128
 
129
129
  ## Components, resources and events
130
130
 
@@ -302,7 +302,7 @@ resource Camera {
302
302
  }
303
303
  ```
304
304
 
305
- <sub>`api.ogt` line 1877</sub>
305
+ <sub>`api.ogt` line 1884</sub>
306
306
 
307
307
  <a id="member-Camera-lookAt"></a>
308
308
 
@@ -329,7 +329,7 @@ fn lookAt {
329
329
  }
330
330
  ```
331
331
 
332
- <sub>`api.ogt` line 1990</sub>
332
+ <sub>`api.ogt` line 1997</sub>
333
333
 
334
334
  <a id="member-Camera-worldToScreen"></a>
335
335
 
@@ -357,7 +357,7 @@ fn worldToScreen {
357
357
  }
358
358
  ```
359
359
 
360
- <sub>`api.ogt` line 1994</sub>
360
+ <sub>`api.ogt` line 2001</sub>
361
361
 
362
362
  <a id="member-Camera-screenToRay"></a>
363
363
 
@@ -387,7 +387,7 @@ fn screenToRay {
387
387
  }
388
388
  ```
389
389
 
390
- <sub>`api.ogt` line 1999</sub>
390
+ <sub>`api.ogt` line 2006</sub>
391
391
 
392
392
  <a id="record-OrbitCamera"></a>
393
393
 
@@ -495,7 +495,7 @@ component OrbitCamera {
495
495
  }
496
496
  ```
497
497
 
498
- <sub>`api.ogt` line 2010</sub>
498
+ <sub>`api.ogt` line 2017</sub>
499
499
 
500
500
  <a id="record-FollowCamera"></a>
501
501
 
@@ -533,7 +533,7 @@ component FollowCamera {
533
533
  }
534
534
  ```
535
535
 
536
- <sub>`api.ogt` line 2084</sub>
536
+ <sub>`api.ogt` line 2091</sub>
537
537
 
538
538
  <a id="record-Follow2D"></a>
539
539
 
@@ -612,7 +612,7 @@ component Follow2D {
612
612
  }
613
613
  ```
614
614
 
615
- <sub>`api.ogt` line 2103</sub>
615
+ <sub>`api.ogt` line 2110</sub>
616
616
 
617
617
  <a id="record-CameraZone"></a>
618
618
 
@@ -647,7 +647,7 @@ component CameraZone {
647
647
  }
648
648
  ```
649
649
 
650
- <sub>`api.ogt` line 2155</sub>
650
+ <sub>`api.ogt` line 2162</sub>
651
651
 
652
652
  <a id="record-CameraRail"></a>
653
653
 
@@ -714,4 +714,4 @@ component CameraRail {
714
714
  }
715
715
  ```
716
716
 
717
- <sub>`api.ogt` line 2171</sub>
717
+ <sub>`api.ogt` line 2178</sub>
@@ -18,7 +18,7 @@ module commands {
18
18
  # declarations follow, each quoted below
19
19
  ```
20
20
 
21
- <sub>`api.ogt` line 12139</sub>
21
+ <sub>`api.ogt` line 13079</sub>
22
22
 
23
23
  ## Contents
24
24
 
@@ -67,7 +67,7 @@ fn register {
67
67
  }
68
68
  ```
69
69
 
70
- <sub>`api.ogt` line 12218</sub>
70
+ <sub>`api.ogt` line 13158</sub>
71
71
 
72
72
  <a id="fn-parse"></a>
73
73
 
@@ -95,7 +95,7 @@ fn parse {
95
95
  }
96
96
  ```
97
97
 
98
- <sub>`api.ogt` line 12226</sub>
98
+ <sub>`api.ogt` line 13166</sub>
99
99
 
100
100
  <a id="fn-help"></a>
101
101
 
@@ -123,7 +123,7 @@ fn help {
123
123
  }
124
124
  ```
125
125
 
126
- <sub>`api.ogt` line 12232</sub>
126
+ <sub>`api.ogt` line 13172</sub>
127
127
 
128
128
  <a id="fn-schedule"></a>
129
129
 
@@ -153,7 +153,7 @@ fn schedule {
153
153
  }
154
154
  ```
155
155
 
156
- <sub>`api.ogt` line 12238</sub>
156
+ <sub>`api.ogt` line 13178</sub>
157
157
 
158
158
  ## Types
159
159
 
@@ -236,7 +236,7 @@ enum CoreAction {
236
236
  }
237
237
  ```
238
238
 
239
- <sub>`api.ogt` line 12146</sub>
239
+ <sub>`api.ogt` line 13086</sub>
240
240
 
241
241
  <a id="type-CommandHandler"></a>
242
242
 
@@ -263,7 +263,7 @@ callback CommandHandler {
263
263
  }
264
264
  ```
265
265
 
266
- <sub>`api.ogt` line 12181</sub>
266
+ <sub>`api.ogt` line 13121</sub>
267
267
 
268
268
  <a id="type-CommandDesc"></a>
269
269
 
@@ -287,7 +287,7 @@ struct CommandDesc {
287
287
  }
288
288
  ```
289
289
 
290
- <sub>`api.ogt` line 12187</sub>
290
+ <sub>`api.ogt` line 13127</sub>
291
291
 
292
292
  <a id="type-CommandStep"></a>
293
293
 
@@ -312,7 +312,7 @@ struct CommandStep {
312
312
  }
313
313
  ```
314
314
 
315
- <sub>`api.ogt` line 12194</sub>
315
+ <sub>`api.ogt` line 13134</sub>
316
316
 
317
317
  <a id="type-CommandInfo"></a>
318
318
 
@@ -337,7 +337,7 @@ struct CommandInfo {
337
337
  }
338
338
  ```
339
339
 
340
- <sub>`api.ogt` line 12203</sub>
340
+ <sub>`api.ogt` line 13143</sub>
341
341
 
342
342
  <a id="type-CommandsReport"></a>
343
343
 
@@ -360,4 +360,4 @@ struct CommandsReport {
360
360
  }
361
361
  ```
362
362
 
363
- <sub>`api.ogt` line 12211</sub>
363
+ <sub>`api.ogt` line 13151</sub>