@origingame/engine 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/og.mjs +1 -1
- package/dist/web/origin-engine.d.ts +219 -5
- package/dist/web/origin-engine.js +1344 -125
- package/dist/web/origin-engine_bg.wasm +0 -0
- package/dist/web/origin-engine_bg.wasm.d.ts +68 -3
- package/dist/web-publish/origin-engine-lanes.js +1007 -22
- package/dist/web-publish/origin-engine-lanes_bg.wasm +0 -0
- package/dist/web-publish/origin-engine.d.ts +162 -5
- package/dist/web-publish/origin-engine.js +1004 -19
- package/dist/web-publish/origin-engine_bg.wasm +0 -0
- package/dist/web-publish/origin-engine_bg.wasm.d.ts +52 -3
- package/dist/web-publish-2d/origin-engine-lanes.js +1007 -22
- package/dist/web-publish-2d/origin-engine-lanes_bg.wasm +0 -0
- package/dist/web-publish-2d/origin-engine.d.ts +162 -5
- package/dist/web-publish-2d/origin-engine.js +1004 -19
- package/dist/web-publish-2d/origin-engine_bg.wasm +0 -0
- package/dist/web-publish-2d/origin-engine_bg.wasm.d.ts +52 -3
- package/knowledge/looks/catalogue.json +40 -40
- package/knowledge/package.json +1 -1
- package/knowledge/scaffold/distribution.json +14 -0
- package/knowledge/scaffold/origin-engine.json +2 -2
- package/knowledge/scaffold/template/README.md +2 -1
- package/knowledge/scaffold/template/assets/audio/sting.ogt +10 -0
- package/knowledge/scaffold/template/assets/timelines/intro.ogt +101 -0
- package/knowledge/scaffold/template/assets/timelines/narration.srt +11 -0
- package/knowledge/scaffold/template/host.d.ts +46 -0
- package/knowledge/scaffold/template/package.json +1 -1
- package/knowledge/scaffold/template/project.ogt +1 -1
- package/knowledge/scaffold/template/src/main.ts +1 -1
- package/knowledge/scaffold/template/tests/frames.ts +134 -0
- package/knowledge/scaffold/template/tests/intro.og.ts +65 -0
- package/knowledge/scaffold/template/tests/smoke.og.ts +30 -36
- package/knowledge/scaffold/template/tsconfig.json +1 -1
- package/knowledge/scripts/mount.ts +2 -1
- package/knowledge/scripts/validate.ts +19 -10
- package/knowledge/skills/og-build/SKILL.md +8 -5
- package/knowledge/skills/og-core/SKILL.md +11 -0
- package/knowledge/skills/og-game/SKILL.md +877 -8
- package/knowledge/skills/og-platform-sdk/SKILL.md +1 -0
- package/knowledge/skills/og-taste/SKILL.md +82 -73
- package/knowledge/skills/og-ui/SKILL.md +65 -50
- package/knowledge/wiki/ai.md +20 -20
- package/knowledge/wiki/anim.md +384 -41
- package/knowledge/wiki/atmosphere.md +36 -13
- package/knowledge/wiki/audio.md +18 -18
- package/knowledge/wiki/camera.md +19 -13
- package/knowledge/wiki/commands.md +19 -13
- package/knowledge/wiki/debug.md +414 -0
- package/knowledge/wiki/game.md +8 -8
- package/knowledge/wiki/i18n.md +7 -7
- package/knowledge/wiki/index.md +262 -7
- package/knowledge/wiki/input.md +47 -47
- package/knowledge/wiki/load.md +236 -68
- package/knowledge/wiki/math.md +2607 -0
- package/knowledge/wiki/nav.md +34 -34
- package/knowledge/wiki/net.md +340 -0
- package/knowledge/wiki/path.md +402 -0
- package/knowledge/wiki/physics.md +95 -95
- package/knowledge/wiki/platform.md +463 -29
- package/knowledge/wiki/probe.md +681 -67
- package/knowledge/wiki/reflect.md +15 -15
- package/knowledge/wiki/render.md +3893 -1896
- package/knowledge/wiki/rng.md +14 -14
- package/knowledge/wiki/stream.md +15 -15
- package/knowledge/wiki/system.md +8 -8
- package/knowledge/wiki/systems.md +2 -2
- package/knowledge/wiki/terrain.md +19 -19
- package/knowledge/wiki/tilemap.md +13 -13
- package/knowledge/wiki/time.md +4 -4
- package/knowledge/wiki/timeline.md +396 -0
- package/knowledge/wiki/transform.md +8 -8
- package/knowledge/wiki/tween.md +17 -17
- package/knowledge/wiki/ui.md +559 -629
- package/knowledge/wiki/video.md +157 -0
- package/knowledge/wiki/world.md +36 -36
- package/package.json +4 -3
- package/schema/api.schema.json +21707 -14725
- package/shell/page.ts +26 -2
- package/shell/platform.ts +46 -0
- package/shell/player.ts +7 -0
- package/src/depth.ts +71 -0
- package/src/e6.ts +32 -1
- package/src/env.d.ts +5 -1
- package/src/generated/abi.ts +189 -3
- package/src/index.ts +25 -4
- package/src/light.ts +18 -0
- package/src/math.ts +622 -0
- package/src/node/index.ts +17 -0
- package/src/node/playtest-run.ts +114 -18
- package/src/node/polish.ts +13 -3
- package/src/node/render.ts +291 -0
- package/src/node/run.ts +86 -5
- package/src/p2.ts +19 -1
- package/src/playtest.ts +57 -4
- package/src/runtime.ts +13 -3
- package/src/targets.ts +28 -0
- package/src/trace.ts +169 -0
- package/src/ui-kit/huds.ts +34 -34
- package/src/ui-kit/menus.ts +12 -12
- package/src/ui-kit/settings.ts +2 -2
- package/src/ui-kit/store.ts +18 -18
- package/src/ui-kit/story.ts +6 -4
- package/src/ui-kit/util.ts +8 -8
- package/src/web/shell.ts +58 -0
- package/src/web/worker.ts +103 -2
- package/types/bindings.json +9101 -6647
- package/types/index.d.ts +15503 -11564
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
<!-- Generated from crates/og-api/api.ogt by `og api gen`. Do not edit: `og api check` fails on any difference; change api.ogt and regenerate. -->
|
|
2
|
+
|
|
3
|
+
# The `path` module
|
|
4
|
+
|
|
5
|
+
Paths: a curve through or controlled by points, measured by arc length so a parameter t from 0 to 1 moves along it at an even speed however its points are spaced. catmullRom passes through every point (three.js CatmullRomCurve3, tension 0.5), bezier chains cubic segments `p0 c0 c1 p1 c2 c3 p2 ...` (three.js CubicBezierCurve3 in a CurvePath), linear joins the points with straight segments. A closed path joins its last point to its first and wraps t.
|
|
6
|
+
|
|
7
|
+
Make one with og.path.create, or declare it in a scene (`path "<name>" { kind catmullRom; closed false; point x y z ... }`) and find it by name with og.path.find; a timeline's camera rides one with `rail "<name>"`. og.PathFollower moves an entity along one, og.CameraRail.path moves the camera along one, og.render.tubeGeometry makes a tube along one (TubeGeometryDesc.path). Paths are assets: they are not world state, and a hot reload registers them again.
|
|
8
|
+
|
|
9
|
+
- **TypeScript**: functions are the namespace `og.path`; components, resources and events are tokens on `og`.
|
|
10
|
+
- **Publish builds**: kept (members may override).
|
|
11
|
+
- **Skill**: `og-game`, which teaches the module (how much of it to use, and how to prove it).
|
|
12
|
+
- **Index**: [every module and name](index.md).
|
|
13
|
+
|
|
14
|
+
```ogt
|
|
15
|
+
module path {
|
|
16
|
+
# declarations follow, each quoted below
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
<sub>`api.ogt` line 13526</sub>
|
|
20
|
+
|
|
21
|
+
## Contents
|
|
22
|
+
|
|
23
|
+
| Name | Kind | Summary |
|
|
24
|
+
|---|---|---|
|
|
25
|
+
| [`Path`](#type-Path) | handle | A path: its points, kind and arc-length table. |
|
|
26
|
+
| [`Path()`](#column-Path) | column kind | A Path handle field (0 is none). |
|
|
27
|
+
| [`PathKind`](#type-PathKind) | enum | How the points make the curve. |
|
|
28
|
+
| [`PathKind()`](#column-PathKind) | column kind | A PathKind field: the variant's index. |
|
|
29
|
+
| [`CurveDesc`](#type-CurveDesc) | desc struct | What makes a path (three.js's Curve; PathDesc is og.nav's path query). |
|
|
30
|
+
| [`PathSample`](#type-PathSample) | struct | A point of a path. |
|
|
31
|
+
| [`PathNearest`](#type-PathNearest) | struct | The point of a path nearest another point. |
|
|
32
|
+
| [`og.PathFollower`](#record-PathFollower) | component | Moves the entity along a path at `speed`, by the engine's og.path system after the game's systems and before physics: og.Transform.position is the path's point at `distance` plus `offset` (in the path's frame with align, else in world axes). Advanced by scaled time (slow motion, hit stop). The distance is the component's own field, so a snapshot, a restore and the world hash carry it, and writing it moves the entity there. |
|
|
33
|
+
| [`og.path.create`](#fn-create) | function | Make a path from points. |
|
|
34
|
+
| [`og.path.find`](#fn-find) | function | A path a loaded scene declares (`path "<name>" { ... }`), by name. |
|
|
35
|
+
| [`og.path.sample`](#fn-sample) | function | The point at arc-length parameter t: 0 the start, 1 the end (a closed path wraps, an open one clamps). Equal steps of t are equal lengths along the curve. |
|
|
36
|
+
| [`og.path.length`](#fn-length) | function | Its length along the curve. |
|
|
37
|
+
| [`og.path.nearest`](#fn-nearest) | function | The point of the path nearest a point, with its parameter: snapping to a track, projecting a pointer onto a rail. |
|
|
38
|
+
|
|
39
|
+
## Functions
|
|
40
|
+
|
|
41
|
+
<a id="fn-create"></a>
|
|
42
|
+
|
|
43
|
+
### `og.path.create`
|
|
44
|
+
|
|
45
|
+
Make a path from points.
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
og.path.create(world: World, desc?: CurveDesc): Result<Path>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
| Parameter | Type | Optional | Doc |
|
|
52
|
+
|---|---|---|---|
|
|
53
|
+
| `world` | `World` | no | The world. |
|
|
54
|
+
| `desc` | `CurveDesc` | yes | The points, kind, closed and tension. |
|
|
55
|
+
|
|
56
|
+
**Returns** `Result<Path>`: Refused for too few points for the kind (bezier needs 3n + 1 open, 3n closed) or a point that is not finite.
|
|
57
|
+
|
|
58
|
+
Binding symbol `og_path_create` · publish builds: kept
|
|
59
|
+
|
|
60
|
+
```ogt
|
|
61
|
+
fn create {
|
|
62
|
+
doc "Make a path from points."
|
|
63
|
+
param world World "The world."
|
|
64
|
+
param desc CurveDesc "The points, kind, closed and tension."
|
|
65
|
+
returns Result.Path "Refused for too few points for the kind (bezier needs 3n + 1 open, 3n closed) or a point that is not finite."
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
<sub>`api.ogt` line 13615</sub>
|
|
70
|
+
|
|
71
|
+
<a id="fn-find"></a>
|
|
72
|
+
|
|
73
|
+
### `og.path.find`
|
|
74
|
+
|
|
75
|
+
A path a loaded scene declares (`path "<name>" { ... }`), by name.
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
og.path.find(world: World, name: string): Result<Path>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
| Parameter | Type | Optional | Doc |
|
|
82
|
+
|---|---|---|---|
|
|
83
|
+
| `world` | `World` | no | The world. |
|
|
84
|
+
| `name` | `string` | no | The path's name in its scene. |
|
|
85
|
+
|
|
86
|
+
**Returns** `Result<Path>`: Refused for a name no spawned scene declares; the reason lists the names.
|
|
87
|
+
|
|
88
|
+
Binding symbol `og_path_find` · publish builds: kept
|
|
89
|
+
|
|
90
|
+
```ogt
|
|
91
|
+
fn find {
|
|
92
|
+
doc "A path a loaded scene declares (`path \"<name>\" { ... }`), by name."
|
|
93
|
+
param world World "The world."
|
|
94
|
+
param name String "The path's name in its scene."
|
|
95
|
+
returns Result.Path "Refused for a name no spawned scene declares; the reason lists the names."
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
<sub>`api.ogt` line 13622</sub>
|
|
100
|
+
|
|
101
|
+
<a id="fn-sample"></a>
|
|
102
|
+
|
|
103
|
+
### `og.path.sample`
|
|
104
|
+
|
|
105
|
+
The point at arc-length parameter t: 0 the start, 1 the end (a closed path wraps, an open one clamps). Equal steps of t are equal lengths along the curve.
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
og.path.sample(world: World, path: Path, t: number): Result<PathSample>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
| Parameter | Type | Optional | Doc |
|
|
112
|
+
|---|---|---|---|
|
|
113
|
+
| `world` | `World` | no | The world. |
|
|
114
|
+
| `path` | `Path` | no | The path. |
|
|
115
|
+
| `t` | `number` | no | The parameter, 0 to 1. |
|
|
116
|
+
|
|
117
|
+
**Returns** `Result<PathSample>`: Refused for a dead path.
|
|
118
|
+
|
|
119
|
+
Binding symbol `og_path_sample` · publish builds: kept
|
|
120
|
+
|
|
121
|
+
```ogt
|
|
122
|
+
fn sample {
|
|
123
|
+
doc "The point at arc-length parameter t: 0 the start, 1 the end (a closed path wraps, an open one clamps). Equal steps of t are equal lengths along the curve."
|
|
124
|
+
param world World "The world."
|
|
125
|
+
param path Path "The path."
|
|
126
|
+
param t f32 "The parameter, 0 to 1."
|
|
127
|
+
returns Result.PathSample "Refused for a dead path."
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
<sub>`api.ogt` line 13629</sub>
|
|
132
|
+
|
|
133
|
+
<a id="fn-length"></a>
|
|
134
|
+
|
|
135
|
+
### `og.path.length`
|
|
136
|
+
|
|
137
|
+
Its length along the curve.
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
og.path.length(world: World, path: Path): Result<number>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
| Parameter | Type | Optional | Doc |
|
|
144
|
+
|---|---|---|---|
|
|
145
|
+
| `world` | `World` | no | The world. |
|
|
146
|
+
| `path` | `Path` | no | The path. |
|
|
147
|
+
|
|
148
|
+
**Returns** `Result<number>`: Metres; refused for a dead path.
|
|
149
|
+
|
|
150
|
+
Binding symbol `og_path_length` · publish builds: kept
|
|
151
|
+
|
|
152
|
+
```ogt
|
|
153
|
+
fn length {
|
|
154
|
+
doc "Its length along the curve."
|
|
155
|
+
param world World "The world."
|
|
156
|
+
param path Path "The path."
|
|
157
|
+
returns Result.f32 "Metres; refused for a dead path."
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
<sub>`api.ogt` line 13637</sub>
|
|
162
|
+
|
|
163
|
+
<a id="fn-nearest"></a>
|
|
164
|
+
|
|
165
|
+
### `og.path.nearest`
|
|
166
|
+
|
|
167
|
+
The point of the path nearest a point, with its parameter: snapping to a track, projecting a pointer onto a rail.
|
|
168
|
+
|
|
169
|
+
```ts
|
|
170
|
+
og.path.nearest(world: World, path: Path, point: Vector3): Result<PathNearest>
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
| Parameter | Type | Optional | Doc |
|
|
174
|
+
|---|---|---|---|
|
|
175
|
+
| `world` | `World` | no | The world. |
|
|
176
|
+
| `path` | `Path` | no | The path. |
|
|
177
|
+
| `point` | `Vector3` | no | The point. |
|
|
178
|
+
|
|
179
|
+
**Returns** `Result<PathNearest>`: Refused for a dead path.
|
|
180
|
+
|
|
181
|
+
Binding symbol `og_path_nearest` · publish builds: kept
|
|
182
|
+
|
|
183
|
+
```ogt
|
|
184
|
+
fn nearest {
|
|
185
|
+
doc "The point of the path nearest a point, with its parameter: snapping to a track, projecting a pointer onto a rail."
|
|
186
|
+
param world World "The world."
|
|
187
|
+
param path Path "The path."
|
|
188
|
+
param point Vector3 "The point."
|
|
189
|
+
returns Result.PathNearest "Refused for a dead path."
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
<sub>`api.ogt` line 13644</sub>
|
|
194
|
+
|
|
195
|
+
## Components, resources and events
|
|
196
|
+
|
|
197
|
+
<a id="record-PathFollower"></a>
|
|
198
|
+
|
|
199
|
+
### `og.PathFollower` (component)
|
|
200
|
+
|
|
201
|
+
Moves the entity along a path at `speed`, by the engine's og.path system after the game's systems and before physics: og.Transform.position is the path's point at `distance` plus `offset` (in the path's frame with align, else in world axes). Advanced by scaled time (slow motion, hit stop). The distance is the component's own field, so a snapshot, a restore and the world hash carry it, and writing it moves the entity there.
|
|
202
|
+
|
|
203
|
+
Token `og.PathFollower`, registered under the schema name `og.PathFollower`; its value type is `PathFollower`.
|
|
204
|
+
|
|
205
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
206
|
+
|---|---|---|---|---|---|---|
|
|
207
|
+
| `path` | `Path` | `0` | — | — | — | The path (og.path.create or og.path.find); 0 does nothing. |
|
|
208
|
+
| `speed` | `number` | `1` | — | `mps` | tunable | Metres per second along the path; negative goes backwards. |
|
|
209
|
+
| `distance` | `number` | `0` | — | `m` | — | How far along the path it is, from its start; written every tick, set it to place the entity. |
|
|
210
|
+
| `loop` | `boolean` | `true` | — | — | — | Wrap at the end (and the start, going backwards); otherwise stop there and set `finished`. |
|
|
211
|
+
| `align` | `boolean` | `false` | — | — | — | Turn og.Transform.quaternion to face along the tangent (local -Z forward, +Y the path's up). |
|
|
212
|
+
| `offset` | `Vector3` | `{ x: 0, y: 0, z: 0 }` | — | `m` | — | Added to the path's point: along the path's right, up and backward axes with align, else world x, y and z. |
|
|
213
|
+
| `playing` | `boolean` | `true` | — | — | — | Moves while true. |
|
|
214
|
+
| `finished` | `boolean` | `false` | — | — | read only | Written: a path without loop reached its end. |
|
|
215
|
+
|
|
216
|
+
```ogt
|
|
217
|
+
component PathFollower {
|
|
218
|
+
doc "Moves the entity along a path at `speed`, by the engine's og.path system after the game's systems and before physics: og.Transform.position is the path's point at `distance` plus `offset` (in the path's frame with align, else in world axes). Advanced by scaled time (slow motion, hit stop). The distance is the component's own field, so a snapshot, a restore and the world hash carry it, and writing it moves the entity there."
|
|
219
|
+
field path Path "The path (og.path.create or og.path.find); 0 does nothing."
|
|
220
|
+
field speed f32 "Metres per second along the path; negative goes backwards." {
|
|
221
|
+
default 1
|
|
222
|
+
unit mps
|
|
223
|
+
tunable true
|
|
224
|
+
}
|
|
225
|
+
field distance f32 "How far along the path it is, from its start; written every tick, set it to place the entity." {
|
|
226
|
+
unit m
|
|
227
|
+
}
|
|
228
|
+
field loop bool "Wrap at the end (and the start, going backwards); otherwise stop there and set `finished`." {
|
|
229
|
+
default true
|
|
230
|
+
}
|
|
231
|
+
field align bool "Turn og.Transform.quaternion to face along the tangent (local -Z forward, +Y the path's up)."
|
|
232
|
+
field offset Vector3 "Added to the path's point: along the path's right, up and backward axes with align, else world x, y and z." {
|
|
233
|
+
unit m
|
|
234
|
+
}
|
|
235
|
+
field playing bool "Moves while true." {
|
|
236
|
+
default true
|
|
237
|
+
}
|
|
238
|
+
field finished bool "Written: a path without loop reached its end." {
|
|
239
|
+
readonly true
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
<sub>`api.ogt` line 13589</sub>
|
|
245
|
+
|
|
246
|
+
## Types
|
|
247
|
+
|
|
248
|
+
<a id="type-Path"></a>
|
|
249
|
+
|
|
250
|
+
### `Path` (handle)
|
|
251
|
+
|
|
252
|
+
A path: its points, kind and arc-length table.
|
|
253
|
+
|
|
254
|
+
A generational handle: a number the engine hands out. A dead handle is an error value, never a crash.
|
|
255
|
+
|
|
256
|
+
```ogt
|
|
257
|
+
handle Path "A path: its points, kind and arc-length table."
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
<sub>`api.ogt` line 13531</sub>
|
|
261
|
+
|
|
262
|
+
<a id="type-PathKind"></a>
|
|
263
|
+
|
|
264
|
+
### `PathKind` (enum)
|
|
265
|
+
|
|
266
|
+
How the points make the curve.
|
|
267
|
+
|
|
268
|
+
A string: one of the variants below. The zero value is `"catmullRom"`.
|
|
269
|
+
|
|
270
|
+
| Variant | Doc |
|
|
271
|
+
|---|---|
|
|
272
|
+
| `"catmullRom"` | Through every point, as three.js CatmullRomCurve3: tension scales the tangents (0.5 is Catmull-Rom). |
|
|
273
|
+
| `"bezier"` | Cubic Bezier segments: anchor, two controls, anchor, ... (3n + 1 points open, 3n closed). |
|
|
274
|
+
| `"linear"` | Straight segments between the points. |
|
|
275
|
+
|
|
276
|
+
```ogt
|
|
277
|
+
enum PathKind {
|
|
278
|
+
doc "How the points make the curve."
|
|
279
|
+
variant catmullRom "Through every point, as three.js CatmullRomCurve3: tension scales the tangents (0.5 is Catmull-Rom)."
|
|
280
|
+
variant bezier "Cubic Bezier segments: anchor, two controls, anchor, ... (3n + 1 points open, 3n closed)."
|
|
281
|
+
variant linear "Straight segments between the points."
|
|
282
|
+
}
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
<sub>`api.ogt` line 13540</sub>
|
|
286
|
+
|
|
287
|
+
<a id="type-CurveDesc"></a>
|
|
288
|
+
|
|
289
|
+
### `CurveDesc` (desc struct)
|
|
290
|
+
|
|
291
|
+
What makes a path (three.js's Curve; PathDesc is og.nav's path query).
|
|
292
|
+
|
|
293
|
+
A desc: every field may be omitted and takes its default; `{}` is valid.
|
|
294
|
+
|
|
295
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
296
|
+
|---|---|---|---|---|---|---|
|
|
297
|
+
| `points` | `readonly Vector3[]` | `[]` | — | — | — | The points, in order: at least 2 (catmullRom, linear), 3n + 1 open or 3n closed (bezier). |
|
|
298
|
+
| `closed` | `boolean` | `false` | — | — | — | Join the last point to the first; t wraps. |
|
|
299
|
+
| `kind` | `PathKind` | `"catmullRom"` | — | — | — | How the points make the curve. |
|
|
300
|
+
| `tension` | `number` | `0.5` | 0 … 1 | — | — | catmullRom's tangent scale, as three.js's tension. |
|
|
301
|
+
|
|
302
|
+
```ogt
|
|
303
|
+
struct CurveDesc {
|
|
304
|
+
doc "What makes a path (three.js's Curve; PathDesc is og.nav's path query)."
|
|
305
|
+
desc true
|
|
306
|
+
field points List.Vector3 "The points, in order: at least 2 (catmullRom, linear), 3n + 1 open or 3n closed (bezier)."
|
|
307
|
+
field closed bool "Join the last point to the first; t wraps."
|
|
308
|
+
field kind PathKind "How the points make the curve."
|
|
309
|
+
field tension f32 "catmullRom's tangent scale, as three.js's tension." {
|
|
310
|
+
default 0.5
|
|
311
|
+
min 0
|
|
312
|
+
max 1
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
<sub>`api.ogt` line 13554</sub>
|
|
318
|
+
|
|
319
|
+
<a id="type-PathSample"></a>
|
|
320
|
+
|
|
321
|
+
### `PathSample` (struct)
|
|
322
|
+
|
|
323
|
+
A point of a path.
|
|
324
|
+
|
|
325
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
326
|
+
|---|---|---|---|---|---|---|
|
|
327
|
+
| `position` | `Vector3` | `{ x: 0, y: 0, z: 0 }` | — | `m` | — | Where it is. |
|
|
328
|
+
| `tangent` | `Vector3` | `{ x: 0, y: 0, z: 0 }` | — | — | — | The unit direction of travel. |
|
|
329
|
+
| `up` | `Vector3` | `{ x: 0, y: 0, z: 0 }` | — | — | — | A unit up perpendicular to the tangent: world +Y made perpendicular (world +Z where the path runs straight up or down). |
|
|
330
|
+
|
|
331
|
+
```ogt
|
|
332
|
+
struct PathSample {
|
|
333
|
+
doc "A point of a path."
|
|
334
|
+
field position Vector3 "Where it is." {
|
|
335
|
+
unit m
|
|
336
|
+
}
|
|
337
|
+
field tangent Vector3 "The unit direction of travel."
|
|
338
|
+
field up Vector3 "A unit up perpendicular to the tangent: world +Y made perpendicular (world +Z where the path runs straight up or down)."
|
|
339
|
+
}
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
<sub>`api.ogt` line 13567</sub>
|
|
343
|
+
|
|
344
|
+
<a id="type-PathNearest"></a>
|
|
345
|
+
|
|
346
|
+
### `PathNearest` (struct)
|
|
347
|
+
|
|
348
|
+
The point of a path nearest another point.
|
|
349
|
+
|
|
350
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
351
|
+
|---|---|---|---|---|---|---|
|
|
352
|
+
| `t` | `number` | `0` | — | `ratio` | — | Its arc-length parameter, 0 to 1. |
|
|
353
|
+
| `position` | `Vector3` | `{ x: 0, y: 0, z: 0 }` | — | `m` | — | Where it is. |
|
|
354
|
+
| `distance` | `number` | `0` | — | `m` | — | How far it is from the point asked about. |
|
|
355
|
+
|
|
356
|
+
```ogt
|
|
357
|
+
struct PathNearest {
|
|
358
|
+
doc "The point of a path nearest another point."
|
|
359
|
+
field t f32 "Its arc-length parameter, 0 to 1." {
|
|
360
|
+
unit ratio
|
|
361
|
+
}
|
|
362
|
+
field position Vector3 "Where it is." {
|
|
363
|
+
unit m
|
|
364
|
+
}
|
|
365
|
+
field distance f32 "How far it is from the point asked about." {
|
|
366
|
+
unit m
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
<sub>`api.ogt` line 13576</sub>
|
|
372
|
+
|
|
373
|
+
## Column kinds
|
|
374
|
+
|
|
375
|
+
Each is a factory, `Path(value?, options?)`, that makes one field of a component or resource layout.
|
|
376
|
+
|
|
377
|
+
| Column | Value | Typed array | Stride | Doc |
|
|
378
|
+
|---|---|---|---|---|
|
|
379
|
+
| <a id="column-Path"></a>`Path` | `Path` | `Uint32Array` | 2 | A Path handle field (0 is none). |
|
|
380
|
+
| <a id="column-PathKind"></a>`PathKind` | `PathKind` | `Uint32Array` | 1 | A PathKind field: the variant's index. |
|
|
381
|
+
|
|
382
|
+
```ogt
|
|
383
|
+
column Path {
|
|
384
|
+
doc "A Path handle field (0 is none)."
|
|
385
|
+
array Uint32Array
|
|
386
|
+
stride 2
|
|
387
|
+
value Path
|
|
388
|
+
}
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
<sub>`api.ogt` line 13533</sub>
|
|
392
|
+
|
|
393
|
+
```ogt
|
|
394
|
+
column PathKind {
|
|
395
|
+
doc "A PathKind field: the variant's index."
|
|
396
|
+
array Uint32Array
|
|
397
|
+
stride 1
|
|
398
|
+
value PathKind
|
|
399
|
+
}
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
<sub>`api.ogt` line 13547</sub>
|