@origingame/engine 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.
- package/dist/web/origin-engine.d.ts +38 -2
- package/dist/web/origin-engine.js +250 -10
- package/dist/web/origin-engine_bg.wasm +0 -0
- package/dist/web/origin-engine_bg.wasm.d.ts +14 -2
- package/dist/web-publish/origin-engine-lanes.js +255 -34
- package/dist/web-publish/origin-engine-lanes_bg.wasm +0 -0
- package/dist/web-publish/origin-engine.d.ts +39 -3
- package/dist/web-publish/origin-engine.js +253 -32
- package/dist/web-publish/origin-engine_bg.wasm +0 -0
- package/dist/web-publish/origin-engine_bg.wasm.d.ts +15 -3
- package/dist/web-publish-2d/origin-engine-lanes.js +253 -32
- package/dist/web-publish-2d/origin-engine-lanes_bg.wasm +0 -0
- package/dist/web-publish-2d/origin-engine.d.ts +38 -2
- package/dist/web-publish-2d/origin-engine.js +250 -29
- package/dist/web-publish-2d/origin-engine_bg.wasm +0 -0
- package/dist/web-publish-2d/origin-engine_bg.wasm.d.ts +14 -2
- package/knowledge/README.md +2 -1
- package/knowledge/guides/three-to-og.md +393 -0
- package/knowledge/knowledge.json +2 -1
- package/knowledge/package.json +3 -2
- package/knowledge/scaffold/origin-engine.json +2 -2
- package/knowledge/scaffold/template/package.json +1 -1
- package/knowledge/scaffold/template/project.ogt +1 -1
- package/knowledge/scripts/validate.ts +140 -21
- package/knowledge/skills/og-audio/SKILL.md +2 -2
- package/knowledge/skills/og-build/SKILL.md +22 -3
- package/knowledge/skills/og-core/SKILL.md +20 -5
- package/knowledge/skills/og-feel/SKILL.md +2 -2
- package/knowledge/skills/og-game/SKILL.md +481 -35
- package/knowledge/skills/og-i18n/SKILL.md +7 -7
- package/knowledge/skills/og-model/SKILL.md +374 -0
- package/knowledge/skills/og-platform-sdk/SKILL.md +1 -1
- package/knowledge/skills/og-ui/SKILL.md +15 -8
- package/knowledge/wiki/ai.md +20 -20
- package/knowledge/wiki/anim.md +63 -55
- package/knowledge/wiki/atmosphere.md +13 -13
- package/knowledge/wiki/audio.md +18 -18
- package/knowledge/wiki/camera.md +13 -13
- package/knowledge/wiki/commands.md +11 -11
- package/knowledge/wiki/debug.md +13 -13
- package/knowledge/wiki/game.md +8 -8
- package/knowledge/wiki/i18n.md +7 -7
- package/knowledge/wiki/index.md +57 -3
- package/knowledge/wiki/input.md +47 -47
- package/knowledge/wiki/load.md +57 -57
- package/knowledge/wiki/nav.md +34 -34
- package/knowledge/wiki/net.md +10 -10
- package/knowledge/wiki/path.md +14 -14
- package/knowledge/wiki/physics.md +95 -95
- package/knowledge/wiki/platform.md +44 -44
- package/knowledge/wiki/probe.md +86 -86
- package/knowledge/wiki/reflect.md +16 -4
- package/knowledge/wiki/render.md +1168 -170
- package/knowledge/wiki/rng.md +14 -14
- package/knowledge/wiki/shapes.md +727 -0
- 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 +24 -20
- package/knowledge/wiki/tilemap.md +13 -13
- package/knowledge/wiki/time.md +4 -4
- package/knowledge/wiki/timeline.md +14 -14
- package/knowledge/wiki/transform.md +8 -8
- package/knowledge/wiki/tween.md +17 -17
- package/knowledge/wiki/ui.md +245 -269
- package/knowledge/wiki/video.md +5 -5
- package/knowledge/wiki/world.md +36 -36
- package/package.json +4 -4
- package/schema/api.schema.json +1834 -305
- package/shell/platform.ts +5 -0
- package/shell/player.ts +8 -2
- package/shell/transport.ts +6 -0
- package/src/generated/abi.ts +37 -1
- package/src/geom.ts +260 -0
- package/src/index.ts +8 -1
- package/src/node/playtest-run.ts +1 -0
- package/src/platform-local.ts +2 -0
- package/src/playtest.ts +8 -0
- package/src/runtime.ts +87 -6
- package/src/ui-kit/settings.ts +9 -0
- package/src/web/shell.ts +1 -1
- package/src/web/worker.ts +2 -2
- package/types/bindings.json +697 -402
- package/types/index.d.ts +1045 -127
|
@@ -0,0 +1,727 @@
|
|
|
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 `shapes` module
|
|
4
|
+
|
|
5
|
+
Two-dimensional outlines in three.js's words: og.Shape and og.Path2 are three.js's Shape and Path, built by the same calls (moveTo, lineTo, quadraticCurveTo, bezierCurveTo, splineThru, arc, absarc, ellipse, absellipse, closePath) and flattened to points by getPoints, so a three.js outline is a paste. og.render.shapeGeometry, extrudeGeometry and sweepGeometry take them; only their points cross to the engine.
|
|
6
|
+
|
|
7
|
+
They are TypeScript values, not world state: make them in start or a command and let the geometry made from them be what the world keeps. Points come from basic arithmetic (no Math.sin), so they are the same on every host.
|
|
8
|
+
|
|
9
|
+
A prop of these parts belongs in an asset: an `.ogt` of `type model` names each part's geometry by its og.render call (`extrudeGeometry { shape { absarc 0 0 1 0 6.283185307179586 false } depth 0.2 }`), its shapes as og.Shape's calls one a line with `hole { }` blocks, places parts as mergeGeometries does (`position`, `quaternion`, `scale`, `mirror`, or several `at { }` blocks: one mesh drawn instanced), gives each a `material` and hangs it from a named `pivot` (a node). og cook builds it into the model blob a glTF cooks to (levels of detail, raycast BVH, nodes), refuses it past project.ogt's triangle and vertex budgets, and og dev re-cooks it on an edit; og.load.gltf and a scene's `model` line take it as any model. The og-game skill §18 has a whole example.
|
|
10
|
+
|
|
11
|
+
- **TypeScript**: functions are none at module level (its members live on the types below); components, resources and events are tokens on `og`.
|
|
12
|
+
- **Publish builds**: kept (members may override).
|
|
13
|
+
- **Skill**: `og-game`, which teaches the module (how much of it to use, and how to prove it).
|
|
14
|
+
- **Index**: [every module and name](index.md).
|
|
15
|
+
|
|
16
|
+
```ogt
|
|
17
|
+
module shapes {
|
|
18
|
+
# declarations follow, each quoted below
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
<sub>`api.ogt` line 5197</sub>
|
|
22
|
+
|
|
23
|
+
## Contents
|
|
24
|
+
|
|
25
|
+
| Name | Kind | Summary |
|
|
26
|
+
|---|---|---|
|
|
27
|
+
| [`PathList`](#type-PathList) | interface | A shape's holes, as three.js Shape.holes: an array; push a path to add a hole. |
|
|
28
|
+
| [`Path2`](#type-Path2) | interface | An outline of curves, as three.js Path: each call adds a curve from the current point (moveTo only moves it). Every method but getPoints returns the path, so calls chain. |
|
|
29
|
+
| [`Shape`](#type-Shape) | interface | An outline with holes, as three.js Shape. |
|
|
30
|
+
| [`Path2Class`](#type-Path2Class) | interface | og.Path2: `new og.Path2(points?)`. |
|
|
31
|
+
| [`ShapeClass`](#type-ShapeClass) | interface | og.Shape: `new og.Shape(points?)`. |
|
|
32
|
+
| [`og.Path2`](#value-Path2) | value | three.js's Path (named Path2 beside og.path's 3D paths): `new og.Path2().moveTo(0, 0).lineTo(1, 0)`. |
|
|
33
|
+
| [`og.Shape`](#value-Shape) | value | three.js's Shape: `const s = new og.Shape(); s.moveTo(0, 0).lineTo(1, 0).lineTo(0, 1); s.holes.push(hole)`. |
|
|
34
|
+
|
|
35
|
+
## Values
|
|
36
|
+
|
|
37
|
+
Provided by the TypeScript runtime: no binding symbol.
|
|
38
|
+
|
|
39
|
+
<a id="value-Path2"></a>
|
|
40
|
+
|
|
41
|
+
### `og.Path2`
|
|
42
|
+
|
|
43
|
+
three.js's Path (named Path2 beside og.path's 3D paths): `new og.Path2().moveTo(0, 0).lineTo(1, 0)`.
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
const Path2: Path2Class
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
```ogt
|
|
50
|
+
value Path2 Path2Class "three.js's Path (named Path2 beside og.path's 3D paths): `new og.Path2().moveTo(0, 0).lineTo(1, 0)`."
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
<sub>`api.ogt` line 5380</sub>
|
|
54
|
+
|
|
55
|
+
<a id="value-Shape"></a>
|
|
56
|
+
|
|
57
|
+
### `og.Shape`
|
|
58
|
+
|
|
59
|
+
three.js's Shape: `const s = new og.Shape(); s.moveTo(0, 0).lineTo(1, 0).lineTo(0, 1); s.holes.push(hole)`.
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
const Shape: ShapeClass
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
```ogt
|
|
66
|
+
value Shape ShapeClass "three.js's Shape: `const s = new og.Shape(); s.moveTo(0, 0).lineTo(1, 0).lineTo(0, 1); s.holes.push(hole)`."
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
<sub>`api.ogt` line 5381</sub>
|
|
70
|
+
|
|
71
|
+
## Interfaces
|
|
72
|
+
|
|
73
|
+
<a id="type-PathList"></a>
|
|
74
|
+
|
|
75
|
+
### `PathList` (interface)
|
|
76
|
+
|
|
77
|
+
A shape's holes, as three.js Shape.holes: an array; push a path to add a hole.
|
|
78
|
+
|
|
79
|
+
```ogt
|
|
80
|
+
interface PathList {
|
|
81
|
+
doc "A shape's holes, as three.js Shape.holes: an array; push a path to add a hole."
|
|
82
|
+
# members follow, each quoted below
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
<sub>`api.ogt` line 5204</sub>
|
|
86
|
+
|
|
87
|
+
<a id="member-PathList-length"></a>
|
|
88
|
+
|
|
89
|
+
#### `PathList.length` (property)
|
|
90
|
+
|
|
91
|
+
How many holes.
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
readonly length: number
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
```ogt
|
|
98
|
+
prop length u32 "How many holes." {
|
|
99
|
+
host false
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
<sub>`api.ogt` line 5206</sub>
|
|
104
|
+
|
|
105
|
+
<a id="member-PathList-push"></a>
|
|
106
|
+
|
|
107
|
+
#### `PathList.push`
|
|
108
|
+
|
|
109
|
+
Add a hole (Array.push).
|
|
110
|
+
|
|
111
|
+
```ts
|
|
112
|
+
PathList.push(path: Path2): number
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
| Parameter | Type | Optional | Doc |
|
|
116
|
+
|---|---|---|---|
|
|
117
|
+
| `path` | `Path2` | no | The hole's outline, either winding. |
|
|
118
|
+
|
|
119
|
+
**Returns** `number`.
|
|
120
|
+
|
|
121
|
+
Implemented by the TypeScript runtime over the members of this module: no binding symbol.
|
|
122
|
+
|
|
123
|
+
```ogt
|
|
124
|
+
fn push {
|
|
125
|
+
doc "Add a hole (Array.push)."
|
|
126
|
+
host false
|
|
127
|
+
param path Path2 "The hole's outline, either winding."
|
|
128
|
+
returns u32
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
<sub>`api.ogt` line 5209</sub>
|
|
133
|
+
|
|
134
|
+
<a id="type-Path2"></a>
|
|
135
|
+
|
|
136
|
+
### `Path2` (interface)
|
|
137
|
+
|
|
138
|
+
An outline of curves, as three.js Path: each call adds a curve from the current point (moveTo only moves it). Every method but getPoints returns the path, so calls chain.
|
|
139
|
+
|
|
140
|
+
```ogt
|
|
141
|
+
interface Path2 {
|
|
142
|
+
doc "An outline of curves, as three.js Path: each call adds a curve from the current point (moveTo only moves it). Every method but getPoints returns the path, so calls chain."
|
|
143
|
+
# members follow, each quoted below
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
<sub>`api.ogt` line 5217</sub>
|
|
147
|
+
|
|
148
|
+
<a id="member-Path2-moveTo"></a>
|
|
149
|
+
|
|
150
|
+
#### `Path2.moveTo`
|
|
151
|
+
|
|
152
|
+
Move the current point without drawing, as three.js Path.moveTo.
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
Path2.moveTo(x: number, y: number): this
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
| Parameter | Type | Optional | Doc |
|
|
159
|
+
|---|---|---|---|
|
|
160
|
+
| `x` | `number` | no | x. |
|
|
161
|
+
| `y` | `number` | no | y. |
|
|
162
|
+
|
|
163
|
+
**Returns** `this`.
|
|
164
|
+
|
|
165
|
+
Implemented by the TypeScript runtime over the members of this module: no binding symbol.
|
|
166
|
+
|
|
167
|
+
```ogt
|
|
168
|
+
fn moveTo {
|
|
169
|
+
doc "Move the current point without drawing, as three.js Path.moveTo."
|
|
170
|
+
host false
|
|
171
|
+
param x f32 "x."
|
|
172
|
+
param y f32 "y."
|
|
173
|
+
returns This
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
<sub>`api.ogt` line 5219</sub>
|
|
178
|
+
|
|
179
|
+
<a id="member-Path2-lineTo"></a>
|
|
180
|
+
|
|
181
|
+
#### `Path2.lineTo`
|
|
182
|
+
|
|
183
|
+
A straight line to (x, y), as three.js Path.lineTo.
|
|
184
|
+
|
|
185
|
+
```ts
|
|
186
|
+
Path2.lineTo(x: number, y: number): this
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
| Parameter | Type | Optional | Doc |
|
|
190
|
+
|---|---|---|---|
|
|
191
|
+
| `x` | `number` | no | x. |
|
|
192
|
+
| `y` | `number` | no | y. |
|
|
193
|
+
|
|
194
|
+
**Returns** `this`.
|
|
195
|
+
|
|
196
|
+
Implemented by the TypeScript runtime over the members of this module: no binding symbol.
|
|
197
|
+
|
|
198
|
+
```ogt
|
|
199
|
+
fn lineTo {
|
|
200
|
+
doc "A straight line to (x, y), as three.js Path.lineTo."
|
|
201
|
+
host false
|
|
202
|
+
param x f32 "x."
|
|
203
|
+
param y f32 "y."
|
|
204
|
+
returns This
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
<sub>`api.ogt` line 5226</sub>
|
|
209
|
+
|
|
210
|
+
<a id="member-Path2-quadraticCurveTo"></a>
|
|
211
|
+
|
|
212
|
+
#### `Path2.quadraticCurveTo`
|
|
213
|
+
|
|
214
|
+
A quadratic Bézier curve through one control point to (x, y), as three.js Path.quadraticCurveTo.
|
|
215
|
+
|
|
216
|
+
```ts
|
|
217
|
+
Path2.quadraticCurveTo(cpX: number, cpY: number, x: number, y: number): this
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
| Parameter | Type | Optional | Doc |
|
|
221
|
+
|---|---|---|---|
|
|
222
|
+
| `cpX` | `number` | no | The control point's x. |
|
|
223
|
+
| `cpY` | `number` | no | The control point's y. |
|
|
224
|
+
| `x` | `number` | no | The end's x. |
|
|
225
|
+
| `y` | `number` | no | The end's y. |
|
|
226
|
+
|
|
227
|
+
**Returns** `this`.
|
|
228
|
+
|
|
229
|
+
Implemented by the TypeScript runtime over the members of this module: no binding symbol.
|
|
230
|
+
|
|
231
|
+
```ogt
|
|
232
|
+
fn quadraticCurveTo {
|
|
233
|
+
doc "A quadratic Bézier curve through one control point to (x, y), as three.js Path.quadraticCurveTo."
|
|
234
|
+
host false
|
|
235
|
+
param cpX f32 "The control point's x."
|
|
236
|
+
param cpY f32 "The control point's y."
|
|
237
|
+
param x f32 "The end's x."
|
|
238
|
+
param y f32 "The end's y."
|
|
239
|
+
returns This
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
<sub>`api.ogt` line 5233</sub>
|
|
244
|
+
|
|
245
|
+
<a id="member-Path2-bezierCurveTo"></a>
|
|
246
|
+
|
|
247
|
+
#### `Path2.bezierCurveTo`
|
|
248
|
+
|
|
249
|
+
A cubic Bézier curve through two control points to (x, y), as three.js Path.bezierCurveTo.
|
|
250
|
+
|
|
251
|
+
```ts
|
|
252
|
+
Path2.bezierCurveTo(cp1X: number, cp1Y: number, cp2X: number, cp2Y: number, x: number, y: number): this
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
| Parameter | Type | Optional | Doc |
|
|
256
|
+
|---|---|---|---|
|
|
257
|
+
| `cp1X` | `number` | no | The first control point's x. |
|
|
258
|
+
| `cp1Y` | `number` | no | The first control point's y. |
|
|
259
|
+
| `cp2X` | `number` | no | The second control point's x. |
|
|
260
|
+
| `cp2Y` | `number` | no | The second control point's y. |
|
|
261
|
+
| `x` | `number` | no | The end's x. |
|
|
262
|
+
| `y` | `number` | no | The end's y. |
|
|
263
|
+
|
|
264
|
+
**Returns** `this`.
|
|
265
|
+
|
|
266
|
+
Implemented by the TypeScript runtime over the members of this module: no binding symbol.
|
|
267
|
+
|
|
268
|
+
```ogt
|
|
269
|
+
fn bezierCurveTo {
|
|
270
|
+
doc "A cubic Bézier curve through two control points to (x, y), as three.js Path.bezierCurveTo."
|
|
271
|
+
host false
|
|
272
|
+
param cp1X f32 "The first control point's x."
|
|
273
|
+
param cp1Y f32 "The first control point's y."
|
|
274
|
+
param cp2X f32 "The second control point's x."
|
|
275
|
+
param cp2Y f32 "The second control point's y."
|
|
276
|
+
param x f32 "The end's x."
|
|
277
|
+
param y f32 "The end's y."
|
|
278
|
+
returns This
|
|
279
|
+
}
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
<sub>`api.ogt` line 5242</sub>
|
|
283
|
+
|
|
284
|
+
<a id="member-Path2-splineThru"></a>
|
|
285
|
+
|
|
286
|
+
#### `Path2.splineThru`
|
|
287
|
+
|
|
288
|
+
A Catmull-Rom spline from the current point through the points, as three.js Path.splineThru (a SplineCurve).
|
|
289
|
+
|
|
290
|
+
```ts
|
|
291
|
+
Path2.splineThru(points: readonly Vector2[]): this
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
| Parameter | Type | Optional | Doc |
|
|
295
|
+
|---|---|---|---|
|
|
296
|
+
| `points` | `readonly Vector2[]` | no | The points it passes through, in order. |
|
|
297
|
+
|
|
298
|
+
**Returns** `this`.
|
|
299
|
+
|
|
300
|
+
Implemented by the TypeScript runtime over the members of this module: no binding symbol.
|
|
301
|
+
|
|
302
|
+
```ogt
|
|
303
|
+
fn splineThru {
|
|
304
|
+
doc "A Catmull-Rom spline from the current point through the points, as three.js Path.splineThru (a SplineCurve)."
|
|
305
|
+
host false
|
|
306
|
+
param points List.Vector2 "The points it passes through, in order."
|
|
307
|
+
returns This
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
<sub>`api.ogt` line 5253</sub>
|
|
312
|
+
|
|
313
|
+
<a id="member-Path2-arc"></a>
|
|
314
|
+
|
|
315
|
+
#### `Path2.arc`
|
|
316
|
+
|
|
317
|
+
A circular arc centred at (x, y) from the current point, as three.js Path.arc.
|
|
318
|
+
|
|
319
|
+
```ts
|
|
320
|
+
Path2.arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, clockwise?: boolean): this
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
| Parameter | Type | Optional | Doc |
|
|
324
|
+
|---|---|---|---|
|
|
325
|
+
| `x` | `number` | no | The centre's x, from the current point. |
|
|
326
|
+
| `y` | `number` | no | The centre's y, from the current point. |
|
|
327
|
+
| `radius` | `number` | no | The radius. |
|
|
328
|
+
| `startAngle` | `number` | no | Where it starts, from +x towards +y. |
|
|
329
|
+
| `endAngle` | `number` | no | Where it ends. |
|
|
330
|
+
| `clockwise` | `boolean` | yes | Go clockwise. Default `false`. |
|
|
331
|
+
|
|
332
|
+
**Returns** `this`.
|
|
333
|
+
|
|
334
|
+
Implemented by the TypeScript runtime over the members of this module: no binding symbol.
|
|
335
|
+
|
|
336
|
+
```ogt
|
|
337
|
+
fn arc {
|
|
338
|
+
doc "A circular arc centred at (x, y) from the current point, as three.js Path.arc."
|
|
339
|
+
host false
|
|
340
|
+
param x f32 "The centre's x, from the current point."
|
|
341
|
+
param y f32 "The centre's y, from the current point."
|
|
342
|
+
param radius f32 "The radius."
|
|
343
|
+
param startAngle f32 "Where it starts, from +x towards +y."
|
|
344
|
+
param endAngle f32 "Where it ends."
|
|
345
|
+
param clockwise bool "Go clockwise." {
|
|
346
|
+
default false
|
|
347
|
+
}
|
|
348
|
+
returns This
|
|
349
|
+
}
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
<sub>`api.ogt` line 5259</sub>
|
|
353
|
+
|
|
354
|
+
<a id="member-Path2-absarc"></a>
|
|
355
|
+
|
|
356
|
+
#### `Path2.absarc`
|
|
357
|
+
|
|
358
|
+
A circular arc centred at (x, y), as three.js Path.absarc: a line joins it to the current point when they differ.
|
|
359
|
+
|
|
360
|
+
```ts
|
|
361
|
+
Path2.absarc(x: number, y: number, radius: number, startAngle: number, endAngle: number, clockwise?: boolean): this
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
| Parameter | Type | Optional | Doc |
|
|
365
|
+
|---|---|---|---|
|
|
366
|
+
| `x` | `number` | no | The centre's x. |
|
|
367
|
+
| `y` | `number` | no | The centre's y. |
|
|
368
|
+
| `radius` | `number` | no | The radius. |
|
|
369
|
+
| `startAngle` | `number` | no | Where it starts, from +x towards +y. |
|
|
370
|
+
| `endAngle` | `number` | no | Where it ends. |
|
|
371
|
+
| `clockwise` | `boolean` | yes | Go clockwise. Default `false`. |
|
|
372
|
+
|
|
373
|
+
**Returns** `this`.
|
|
374
|
+
|
|
375
|
+
Implemented by the TypeScript runtime over the members of this module: no binding symbol.
|
|
376
|
+
|
|
377
|
+
```ogt
|
|
378
|
+
fn absarc {
|
|
379
|
+
doc "A circular arc centred at (x, y), as three.js Path.absarc: a line joins it to the current point when they differ."
|
|
380
|
+
host false
|
|
381
|
+
param x f32 "The centre's x."
|
|
382
|
+
param y f32 "The centre's y."
|
|
383
|
+
param radius f32 "The radius."
|
|
384
|
+
param startAngle f32 "Where it starts, from +x towards +y."
|
|
385
|
+
param endAngle f32 "Where it ends."
|
|
386
|
+
param clockwise bool "Go clockwise." {
|
|
387
|
+
default false
|
|
388
|
+
}
|
|
389
|
+
returns This
|
|
390
|
+
}
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
<sub>`api.ogt` line 5272</sub>
|
|
394
|
+
|
|
395
|
+
<a id="member-Path2-ellipse"></a>
|
|
396
|
+
|
|
397
|
+
#### `Path2.ellipse`
|
|
398
|
+
|
|
399
|
+
An elliptic arc centred at (x, y) from the current point, as three.js Path.ellipse.
|
|
400
|
+
|
|
401
|
+
```ts
|
|
402
|
+
Path2.ellipse(x: number, y: number, xRadius: number, yRadius: number, startAngle: number, endAngle: number, clockwise?: boolean, rotation?: number): this
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
| Parameter | Type | Optional | Doc |
|
|
406
|
+
|---|---|---|---|
|
|
407
|
+
| `x` | `number` | no | The centre's x, from the current point. |
|
|
408
|
+
| `y` | `number` | no | The centre's y, from the current point. |
|
|
409
|
+
| `xRadius` | `number` | no | The radius along x. |
|
|
410
|
+
| `yRadius` | `number` | no | The radius along y. |
|
|
411
|
+
| `startAngle` | `number` | no | Where it starts. |
|
|
412
|
+
| `endAngle` | `number` | no | Where it ends. |
|
|
413
|
+
| `clockwise` | `boolean` | yes | Go clockwise. Default `false`. |
|
|
414
|
+
| `rotation` | `number` | yes | The ellipse's turn round its centre. Default `0`. |
|
|
415
|
+
|
|
416
|
+
**Returns** `this`.
|
|
417
|
+
|
|
418
|
+
Implemented by the TypeScript runtime over the members of this module: no binding symbol.
|
|
419
|
+
|
|
420
|
+
```ogt
|
|
421
|
+
fn ellipse {
|
|
422
|
+
doc "An elliptic arc centred at (x, y) from the current point, as three.js Path.ellipse."
|
|
423
|
+
host false
|
|
424
|
+
param x f32 "The centre's x, from the current point."
|
|
425
|
+
param y f32 "The centre's y, from the current point."
|
|
426
|
+
param xRadius f32 "The radius along x."
|
|
427
|
+
param yRadius f32 "The radius along y."
|
|
428
|
+
param startAngle f32 "Where it starts."
|
|
429
|
+
param endAngle f32 "Where it ends."
|
|
430
|
+
param clockwise bool "Go clockwise." {
|
|
431
|
+
default false
|
|
432
|
+
}
|
|
433
|
+
param rotation f32 "The ellipse's turn round its centre." {
|
|
434
|
+
default 0
|
|
435
|
+
}
|
|
436
|
+
returns This
|
|
437
|
+
}
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
<sub>`api.ogt` line 5285</sub>
|
|
441
|
+
|
|
442
|
+
<a id="member-Path2-absellipse"></a>
|
|
443
|
+
|
|
444
|
+
#### `Path2.absellipse`
|
|
445
|
+
|
|
446
|
+
An elliptic arc centred at (x, y), as three.js Path.absellipse.
|
|
447
|
+
|
|
448
|
+
```ts
|
|
449
|
+
Path2.absellipse(x: number, y: number, xRadius: number, yRadius: number, startAngle: number, endAngle: number, clockwise?: boolean, rotation?: number): this
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
| Parameter | Type | Optional | Doc |
|
|
453
|
+
|---|---|---|---|
|
|
454
|
+
| `x` | `number` | no | The centre's x. |
|
|
455
|
+
| `y` | `number` | no | The centre's y. |
|
|
456
|
+
| `xRadius` | `number` | no | The radius along x. |
|
|
457
|
+
| `yRadius` | `number` | no | The radius along y. |
|
|
458
|
+
| `startAngle` | `number` | no | Where it starts. |
|
|
459
|
+
| `endAngle` | `number` | no | Where it ends. |
|
|
460
|
+
| `clockwise` | `boolean` | yes | Go clockwise. Default `false`. |
|
|
461
|
+
| `rotation` | `number` | yes | The ellipse's turn round its centre. Default `0`. |
|
|
462
|
+
|
|
463
|
+
**Returns** `this`.
|
|
464
|
+
|
|
465
|
+
Implemented by the TypeScript runtime over the members of this module: no binding symbol.
|
|
466
|
+
|
|
467
|
+
```ogt
|
|
468
|
+
fn absellipse {
|
|
469
|
+
doc "An elliptic arc centred at (x, y), as three.js Path.absellipse."
|
|
470
|
+
host false
|
|
471
|
+
param x f32 "The centre's x."
|
|
472
|
+
param y f32 "The centre's y."
|
|
473
|
+
param xRadius f32 "The radius along x."
|
|
474
|
+
param yRadius f32 "The radius along y."
|
|
475
|
+
param startAngle f32 "Where it starts."
|
|
476
|
+
param endAngle f32 "Where it ends."
|
|
477
|
+
param clockwise bool "Go clockwise." {
|
|
478
|
+
default false
|
|
479
|
+
}
|
|
480
|
+
param rotation f32 "The ellipse's turn round its centre." {
|
|
481
|
+
default 0
|
|
482
|
+
}
|
|
483
|
+
returns This
|
|
484
|
+
}
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
<sub>`api.ogt` line 5302</sub>
|
|
488
|
+
|
|
489
|
+
<a id="member-Path2-setFromPoints"></a>
|
|
490
|
+
|
|
491
|
+
#### `Path2.setFromPoints`
|
|
492
|
+
|
|
493
|
+
Start at the first point and draw lines through the rest, as three.js Path.setFromPoints.
|
|
494
|
+
|
|
495
|
+
```ts
|
|
496
|
+
Path2.setFromPoints(points: readonly Vector2[]): this
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
| Parameter | Type | Optional | Doc |
|
|
500
|
+
|---|---|---|---|
|
|
501
|
+
| `points` | `readonly Vector2[]` | no | The points. |
|
|
502
|
+
|
|
503
|
+
**Returns** `this`.
|
|
504
|
+
|
|
505
|
+
Implemented by the TypeScript runtime over the members of this module: no binding symbol.
|
|
506
|
+
|
|
507
|
+
```ogt
|
|
508
|
+
fn setFromPoints {
|
|
509
|
+
doc "Start at the first point and draw lines through the rest, as three.js Path.setFromPoints."
|
|
510
|
+
host false
|
|
511
|
+
param points List.Vector2 "The points."
|
|
512
|
+
returns This
|
|
513
|
+
}
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
<sub>`api.ogt` line 5319</sub>
|
|
517
|
+
|
|
518
|
+
<a id="member-Path2-closePath"></a>
|
|
519
|
+
|
|
520
|
+
#### `Path2.closePath`
|
|
521
|
+
|
|
522
|
+
A line back to the first point when the outline does not end there, as three.js CurvePath.closePath.
|
|
523
|
+
|
|
524
|
+
```ts
|
|
525
|
+
Path2.closePath(): this
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
**Returns** `this`.
|
|
529
|
+
|
|
530
|
+
Implemented by the TypeScript runtime over the members of this module: no binding symbol.
|
|
531
|
+
|
|
532
|
+
```ogt
|
|
533
|
+
fn closePath {
|
|
534
|
+
doc "A line back to the first point when the outline does not end there, as three.js CurvePath.closePath."
|
|
535
|
+
host false
|
|
536
|
+
returns This
|
|
537
|
+
}
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
<sub>`api.ogt` line 5325</sub>
|
|
541
|
+
|
|
542
|
+
<a id="member-Path2-getPoints"></a>
|
|
543
|
+
|
|
544
|
+
#### `Path2.getPoints`
|
|
545
|
+
|
|
546
|
+
The outline as points, as three.js CurvePath.getPoints: each curve divided into `divisions` (an ellipse twice as many, a spline as many per point, a line one), repeated points dropped.
|
|
547
|
+
|
|
548
|
+
```ts
|
|
549
|
+
Path2.getPoints(divisions?: number): readonly Vector2[]
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
| Parameter | Type | Optional | Doc |
|
|
553
|
+
|---|---|---|---|
|
|
554
|
+
| `divisions` | `number` | yes | Divisions per curve. Default `12`. |
|
|
555
|
+
|
|
556
|
+
**Returns** `readonly Vector2[]`.
|
|
557
|
+
|
|
558
|
+
Implemented by the TypeScript runtime over the members of this module: no binding symbol.
|
|
559
|
+
|
|
560
|
+
```ogt
|
|
561
|
+
fn getPoints {
|
|
562
|
+
doc "The outline as points, as three.js CurvePath.getPoints: each curve divided into `divisions` (an ellipse twice as many, a spline as many per point, a line one), repeated points dropped."
|
|
563
|
+
host false
|
|
564
|
+
param divisions u32 "Divisions per curve." {
|
|
565
|
+
default 12
|
|
566
|
+
}
|
|
567
|
+
returns List.Vector2
|
|
568
|
+
}
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
<sub>`api.ogt` line 5330</sub>
|
|
572
|
+
|
|
573
|
+
<a id="type-Shape"></a>
|
|
574
|
+
|
|
575
|
+
### `Shape` (interface)
|
|
576
|
+
|
|
577
|
+
An outline with holes, as three.js Shape.
|
|
578
|
+
|
|
579
|
+
Extends [`Path2`](#type-Path2): every member of it is a member here.
|
|
580
|
+
|
|
581
|
+
```ogt
|
|
582
|
+
interface Shape {
|
|
583
|
+
doc "An outline with holes, as three.js Shape."
|
|
584
|
+
extends Path2
|
|
585
|
+
# members follow, each quoted below
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
<sub>`api.ogt` line 5340</sub>
|
|
589
|
+
|
|
590
|
+
<a id="member-Shape-holes"></a>
|
|
591
|
+
|
|
592
|
+
#### `Shape.holes` (property)
|
|
593
|
+
|
|
594
|
+
The holes: `shape.holes.push(hole)`.
|
|
595
|
+
|
|
596
|
+
```ts
|
|
597
|
+
readonly holes: PathList
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
```ogt
|
|
601
|
+
prop holes PathList "The holes: `shape.holes.push(hole)`." {
|
|
602
|
+
host false
|
|
603
|
+
}
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
<sub>`api.ogt` line 5343</sub>
|
|
607
|
+
|
|
608
|
+
<a id="member-Shape-extractPoints"></a>
|
|
609
|
+
|
|
610
|
+
#### `Shape.extractPoints`
|
|
611
|
+
|
|
612
|
+
The outline's and the holes' points, as three.js Shape.extractPoints.
|
|
613
|
+
|
|
614
|
+
```ts
|
|
615
|
+
Shape.extractPoints(divisions?: number): ShapePoints
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
| Parameter | Type | Optional | Doc |
|
|
619
|
+
|---|---|---|---|
|
|
620
|
+
| `divisions` | `number` | yes | Divisions per curve. Default `12`. |
|
|
621
|
+
|
|
622
|
+
**Returns** `ShapePoints`.
|
|
623
|
+
|
|
624
|
+
Implemented by the TypeScript runtime over the members of this module: no binding symbol.
|
|
625
|
+
|
|
626
|
+
```ogt
|
|
627
|
+
fn extractPoints {
|
|
628
|
+
doc "The outline's and the holes' points, as three.js Shape.extractPoints."
|
|
629
|
+
host false
|
|
630
|
+
param divisions u32 "Divisions per curve." {
|
|
631
|
+
default 12
|
|
632
|
+
}
|
|
633
|
+
returns ShapePoints
|
|
634
|
+
}
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
<sub>`api.ogt` line 5346</sub>
|
|
638
|
+
|
|
639
|
+
<a id="type-Path2Class"></a>
|
|
640
|
+
|
|
641
|
+
### `Path2Class` (interface)
|
|
642
|
+
|
|
643
|
+
og.Path2: `new og.Path2(points?)`.
|
|
644
|
+
|
|
645
|
+
```ogt
|
|
646
|
+
interface Path2Class {
|
|
647
|
+
doc "og.Path2: `new og.Path2(points?)`."
|
|
648
|
+
# members follow, each quoted below
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
<sub>`api.ogt` line 5356</sub>
|
|
652
|
+
|
|
653
|
+
<a id="member-Path2Class-new"></a>
|
|
654
|
+
|
|
655
|
+
#### `Path2Class.new`
|
|
656
|
+
|
|
657
|
+
A path, through the points when given (setFromPoints).
|
|
658
|
+
|
|
659
|
+
```ts
|
|
660
|
+
Path2Class.new(points?: readonly Vector2[] | null): Path2
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
| Parameter | Type | Optional | Doc |
|
|
664
|
+
|---|---|---|---|
|
|
665
|
+
| `points` | `readonly Vector2[] \| null` | yes | Points to start from. |
|
|
666
|
+
|
|
667
|
+
**Returns** `Path2`.
|
|
668
|
+
|
|
669
|
+
Implemented by the TypeScript runtime over the members of this module: no binding symbol.
|
|
670
|
+
|
|
671
|
+
```ogt
|
|
672
|
+
fn new {
|
|
673
|
+
doc "A path, through the points when given (setFromPoints)."
|
|
674
|
+
host false
|
|
675
|
+
param points Option.List.Vector2 "Points to start from." {
|
|
676
|
+
optional true
|
|
677
|
+
}
|
|
678
|
+
returns Path2
|
|
679
|
+
}
|
|
680
|
+
```
|
|
681
|
+
|
|
682
|
+
<sub>`api.ogt` line 5358</sub>
|
|
683
|
+
|
|
684
|
+
<a id="type-ShapeClass"></a>
|
|
685
|
+
|
|
686
|
+
### `ShapeClass` (interface)
|
|
687
|
+
|
|
688
|
+
og.Shape: `new og.Shape(points?)`.
|
|
689
|
+
|
|
690
|
+
```ogt
|
|
691
|
+
interface ShapeClass {
|
|
692
|
+
doc "og.Shape: `new og.Shape(points?)`."
|
|
693
|
+
# members follow, each quoted below
|
|
694
|
+
```
|
|
695
|
+
|
|
696
|
+
<sub>`api.ogt` line 5368</sub>
|
|
697
|
+
|
|
698
|
+
<a id="member-ShapeClass-new"></a>
|
|
699
|
+
|
|
700
|
+
#### `ShapeClass.new`
|
|
701
|
+
|
|
702
|
+
A shape, through the points when given (setFromPoints).
|
|
703
|
+
|
|
704
|
+
```ts
|
|
705
|
+
ShapeClass.new(points?: readonly Vector2[] | null): Shape
|
|
706
|
+
```
|
|
707
|
+
|
|
708
|
+
| Parameter | Type | Optional | Doc |
|
|
709
|
+
|---|---|---|---|
|
|
710
|
+
| `points` | `readonly Vector2[] \| null` | yes | Points to start from. |
|
|
711
|
+
|
|
712
|
+
**Returns** `Shape`.
|
|
713
|
+
|
|
714
|
+
Implemented by the TypeScript runtime over the members of this module: no binding symbol.
|
|
715
|
+
|
|
716
|
+
```ogt
|
|
717
|
+
fn new {
|
|
718
|
+
doc "A shape, through the points when given (setFromPoints)."
|
|
719
|
+
host false
|
|
720
|
+
param points Option.List.Vector2 "Points to start from." {
|
|
721
|
+
optional true
|
|
722
|
+
}
|
|
723
|
+
returns Shape
|
|
724
|
+
}
|
|
725
|
+
```
|
|
726
|
+
|
|
727
|
+
<sub>`api.ogt` line 5370</sub>
|