@origingame/engine 0.0.0-stage → 0.1.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 +25 -0
- package/dist/web/origin-engine.d.ts +1233 -0
- package/dist/web/origin-engine.js +8628 -0
- package/dist/web/origin-engine_bg.wasm +0 -0
- package/dist/web/origin-engine_bg.wasm.d.ts +366 -0
- package/dist/web-publish/origin-engine-lanes.js +8509 -0
- package/dist/web-publish/origin-engine-lanes_bg.wasm +0 -0
- package/dist/web-publish/origin-engine.d.ts +1176 -0
- package/dist/web-publish/origin-engine.js +8313 -0
- package/dist/web-publish/origin-engine_bg.wasm +0 -0
- package/dist/web-publish/origin-engine_bg.wasm.d.ts +347 -0
- package/dist/web-publish/snippets/wasm-bindgen-rayon-38edf6e439f6d70d/src/workerHelpers.no-bundler.js +77 -0
- package/dist/web-publish-2d/origin-engine-lanes.js +8509 -0
- package/dist/web-publish-2d/origin-engine-lanes_bg.wasm +0 -0
- package/dist/web-publish-2d/origin-engine.d.ts +1176 -0
- package/dist/web-publish-2d/origin-engine.js +8313 -0
- package/dist/web-publish-2d/origin-engine_bg.wasm +0 -0
- package/dist/web-publish-2d/origin-engine_bg.wasm.d.ts +347 -0
- package/dist/web-publish-2d/snippets/wasm-bindgen-rayon-38edf6e439f6d70d/src/workerHelpers.no-bundler.js +77 -0
- package/knowledge/README.md +31 -0
- package/knowledge/knowledge.json +13 -0
- package/knowledge/looks/catalogue.json +1871 -0
- package/knowledge/package.json +33 -0
- package/knowledge/rules/platform.json +329 -0
- package/knowledge/scaffold/README.md +27 -0
- package/knowledge/scaffold/distribution.json +48 -0
- package/knowledge/scaffold/origin-engine.json +19 -0
- package/knowledge/scaffold/template/.origin/setup +14 -0
- package/knowledge/scaffold/template/LICENSES.md +23 -0
- package/knowledge/scaffold/template/README.md +37 -0
- package/knowledge/scaffold/template/assets/ai/guard.ogt +48 -0
- package/knowledge/scaffold/template/assets/audio/click.ogt +9 -0
- package/knowledge/scaffold/template/assets/fonts/NotoSansSC-Regular-subset.ttf.ogt +12 -0
- package/knowledge/scaffold/template/assets/fonts/OFL.txt +93 -0
- package/knowledge/scaffold/template/assets/looks/origin-game.ogt +12 -0
- package/knowledge/scaffold/template/assets/nav/yard.ogt +27 -0
- package/knowledge/scaffold/template/assets/scenes/main.ogt +34 -0
- package/knowledge/scaffold/template/assets/strings/en.ogt +14 -0
- package/knowledge/scaffold/template/assets/textures/stone_n.png.ogt +7 -0
- package/knowledge/scaffold/template/gitattributes +22 -0
- package/knowledge/scaffold/template/package.json +18 -0
- package/knowledge/scaffold/template/project.ogt +25 -0
- package/knowledge/scaffold/template/src/main.ts +246 -0
- package/knowledge/scaffold/template/tests/guard.og.ts +67 -0
- package/knowledge/scaffold/template/tests/smoke.og.ts +43 -0
- package/knowledge/scaffold/template/tsconfig.json +17 -0
- package/knowledge/scripts/lib.ts +203 -0
- package/knowledge/scripts/mount.ts +210 -0
- package/knowledge/scripts/pack.ts +24 -0
- package/knowledge/scripts/scaffold.ts +72 -0
- package/knowledge/scripts/validate.ts +749 -0
- package/knowledge/skills/og-ai/SKILL.md +386 -0
- package/knowledge/skills/og-audio/SKILL.md +191 -0
- package/knowledge/skills/og-build/SKILL.md +330 -0
- package/knowledge/skills/og-core/SKILL.md +285 -0
- package/knowledge/skills/og-feel/SKILL.md +385 -0
- package/knowledge/skills/og-game/SKILL.md +1479 -0
- package/knowledge/skills/og-i18n/SKILL.md +220 -0
- package/knowledge/skills/og-platform-sdk/SKILL.md +199 -0
- package/knowledge/skills/og-taste/SKILL.md +537 -0
- package/knowledge/skills/og-ui/SKILL.md +444 -0
- package/knowledge/wiki/ai.md +627 -0
- package/knowledge/wiki/anim.md +1187 -0
- package/knowledge/wiki/atmosphere.md +636 -0
- package/knowledge/wiki/audio.md +732 -0
- package/knowledge/wiki/camera.md +711 -0
- package/knowledge/wiki/commands.md +357 -0
- package/knowledge/wiki/game.md +220 -0
- package/knowledge/wiki/i18n.md +213 -0
- package/knowledge/wiki/index.md +1027 -0
- package/knowledge/wiki/input.md +1714 -0
- package/knowledge/wiki/load.md +1280 -0
- package/knowledge/wiki/math.md +166 -0
- package/knowledge/wiki/nav.md +1154 -0
- package/knowledge/wiki/physics.md +3142 -0
- package/knowledge/wiki/platform.md +857 -0
- package/knowledge/wiki/probe.md +1692 -0
- package/knowledge/wiki/reflect.md +285 -0
- package/knowledge/wiki/render.md +3511 -0
- package/knowledge/wiki/rng.md +393 -0
- package/knowledge/wiki/stream.md +376 -0
- package/knowledge/wiki/system.md +197 -0
- package/knowledge/wiki/systems.md +43 -0
- package/knowledge/wiki/terrain.md +727 -0
- package/knowledge/wiki/tilemap.md +422 -0
- package/knowledge/wiki/time.md +150 -0
- package/knowledge/wiki/transform.md +230 -0
- package/knowledge/wiki/tween.md +580 -0
- package/knowledge/wiki/ui.md +8000 -0
- package/knowledge/wiki/world.md +909 -0
- package/package.json +68 -4
- package/schema/api.schema.json +29675 -0
- package/shell/README.md +22 -0
- package/shell/brand/README.md +23 -0
- package/shell/brand/icon-192.png +0 -0
- package/shell/brand/icon-512.png +0 -0
- package/shell/brand/mark-on-paper.svg +6 -0
- package/shell/brand/origin-mark.svg +5 -0
- package/shell/brand/origin-motion.css +251 -0
- package/shell/brand/tokens.css +20 -0
- package/shell/brand.ts +132 -0
- package/shell/page.ts +715 -0
- package/shell/platform.ts +203 -0
- package/shell/player.ts +238 -0
- package/shell/shell.css +185 -0
- package/shell/sw.ts +177 -0
- package/shell/transport.ts +515 -0
- package/shell/wire.ts +369 -0
- package/src/e6.ts +69 -0
- package/src/env.d.ts +100 -0
- package/src/generated/abi.ts +980 -0
- package/src/index.ts +193 -0
- package/src/node/audio.ts +86 -0
- package/src/node/build.ts +109 -0
- package/src/node/device.ts +981 -0
- package/src/node/doctor.ts +60 -0
- package/src/node/index.ts +102 -0
- package/src/node/platform.ts +24 -0
- package/src/node/playtest-run.ts +249 -0
- package/src/node/png.ts +130 -0
- package/src/node/polish.ts +976 -0
- package/src/node/run.ts +373 -0
- package/src/node/web-build.ts +808 -0
- package/src/p2.ts +35 -0
- package/src/platform-local.ts +211 -0
- package/src/playtest.ts +131 -0
- package/src/runtime.ts +1509 -0
- package/src/systems/cameras.ts +247 -0
- package/src/ui-kit/bind.ts +141 -0
- package/src/ui-kit/huds.ts +303 -0
- package/src/ui-kit/index.ts +36 -0
- package/src/ui-kit/menus.ts +187 -0
- package/src/ui-kit/settings.ts +131 -0
- package/src/ui-kit/store.ts +222 -0
- package/src/ui-kit/story.ts +89 -0
- package/src/ui-kit/util.ts +106 -0
- package/src/web/a11y.ts +429 -0
- package/src/web/audio-worklet.ts +193 -0
- package/src/web/audio.ts +307 -0
- package/src/web/basis.ts +239 -0
- package/src/web/gamepad.ts +123 -0
- package/src/web/host.ts +166 -0
- package/src/web/input.ts +237 -0
- package/src/web/lanes.ts +21 -0
- package/src/web/play.ts +20 -0
- package/src/web/rpc-ring.ts +110 -0
- package/src/web/settle.ts +122 -0
- package/src/web/shell.ts +643 -0
- package/src/web/text-input.ts +248 -0
- package/src/web/worker.ts +1002 -0
- package/types/bindings.json +13654 -0
- package/types/index.d.ts +20090 -0
- package/vendor/basis/LICENSE +201 -0
- package/vendor/basis/NOTICE +15 -0
- package/vendor/basis/README.md +18 -0
- package/vendor/basis/basis_transcoder.js +19 -0
- package/vendor/basis/basis_transcoder.wasm +0 -0
- package/README.md +0 -3
|
@@ -0,0 +1,285 @@
|
|
|
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 `reflect` module
|
|
4
|
+
|
|
5
|
+
Reflection: components and resources are declared once with their field layout and metadata, and registered by name.
|
|
6
|
+
|
|
7
|
+
The inspector, Tune, the probe, scene text and the wiki read this one schema. Each column factory below makes one field.
|
|
8
|
+
|
|
9
|
+
A field holds one value: there is no array or list column. A few values are numbered fields (`p0` to `p7`, as og.CameraRail does); a list of things is an entity each, with its own component, looped over by a query (a ring of skid marks, the laps of a race); a long record (a lap's taped inputs) is text in `str` fields of at most 4,096 bytes each, chunked over entities. Keep none of it in module variables: they are not world state, so a snapshot, a replay and a hot reload lose them.
|
|
10
|
+
|
|
11
|
+
A handle (an og.load answer, a texture, a sound, a geometry, a material, an entity) is a 64-bit number: keep it in a field of its own kind (`Asset()`, `Texture()`, `Sound()`, `Geometry()`, `Material()`, `Entity()`, the factories of the API's handle types), in a component or a resource. A `u32` field refuses one (handles pass 2^32: `4294967298 is not a u32`); an `f64` holds the number but loses its type.
|
|
12
|
+
|
|
13
|
+
- **TypeScript**: functions are named exports of the package: `import { … } from "@origingame/engine"`; components, resources and events are tokens on `og`.
|
|
14
|
+
- **Publish builds**: kept (members may override).
|
|
15
|
+
- **Skill**: `og-core`, which teaches the module (how much of it to use, and how to prove it).
|
|
16
|
+
- **Index**: [every module and name](index.md).
|
|
17
|
+
|
|
18
|
+
```ogt
|
|
19
|
+
module reflect {
|
|
20
|
+
# declarations follow, each quoted below
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
<sub>`api.ogt` line 86</sub>
|
|
24
|
+
|
|
25
|
+
## Contents
|
|
26
|
+
|
|
27
|
+
| Name | Kind | Summary |
|
|
28
|
+
|---|---|---|
|
|
29
|
+
| [`FieldOptions`](#type-FieldOptions) | desc struct | Metadata of one field. Ranges and units are what Tune and the probe's bounds show. Nothing clamps writes: game code's writes (world.set, a resource field, a column) are stored as given, and writes from outside the game (the probe's `set`, `patch` and sweeps, Tune, a look's fields at cook) are refused outside min..max with the range named. |
|
|
30
|
+
| [`f32()`](#column-f32) | column kind | A 32-bit float, the default numeric field. |
|
|
31
|
+
| [`f64()`](#column-f64) | column kind | A 64-bit float, for accumulated values that must not drift, such as elapsed time. |
|
|
32
|
+
| [`u32()`](#column-u32) | column kind | A 32-bit unsigned integer: counters, flags, indices. |
|
|
33
|
+
| [`i32()`](#column-i32) | column kind | A 32-bit signed integer. |
|
|
34
|
+
| [`bool()`](#column-bool) | column kind | A boolean, stored as one byte: 0 or 1. |
|
|
35
|
+
| [`Vector2()`](#column-Vector2) | column kind | A Vector2 field: x, y interleaved. |
|
|
36
|
+
| [`Vector3()`](#column-Vector3) | column kind | A Vector3 field: x, y, z interleaved. |
|
|
37
|
+
| [`Quaternion()`](#column-Quaternion) | column kind | A Quaternion field: x, y, z, w interleaved. |
|
|
38
|
+
| [`Matrix4()`](#column-Matrix4) | column kind | A Matrix4 field: sixteen column-major elements per entity. |
|
|
39
|
+
| [`Color()`](#column-Color) | column kind | A Color field: r, g, b interleaved. |
|
|
40
|
+
| [`str()`](#column-str) | column kind | Text of at most `capacity` bytes of UTF-8, stored inline and zero-padded, so it is world state like a number: a player's name, a label. `str(48)` holds any 12 characters (four bytes covers every script). The capacity is 1 to 4,096 bytes: a larger one is refused when the game starts (`a string field holds 1 to 4096 bytes`), so longer text goes in chunks, an entity each. |
|
|
41
|
+
| [`defineComponent`](#fn-defineComponent) | function | Declare a component: plain data stored per entity in engine memory, one column per field. |
|
|
42
|
+
| [`defineResource`](#fn-defineResource) | function | Declare a resource: a reflected singleton, such as a tuning table. Its fields start at their defaults. |
|
|
43
|
+
|
|
44
|
+
## Functions
|
|
45
|
+
|
|
46
|
+
<a id="fn-defineComponent"></a>
|
|
47
|
+
|
|
48
|
+
### `defineComponent`
|
|
49
|
+
|
|
50
|
+
Declare a component: plain data stored per entity in engine memory, one column per field.
|
|
51
|
+
|
|
52
|
+
Registration is by name, so a hot reload re-registers the same component and migrates its fields by name.
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
defineComponent<F extends Fields>(name: string, fields: F): ComponentType<F>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
| Parameter | Type | Optional | Doc |
|
|
59
|
+
|---|---|---|---|
|
|
60
|
+
| `name` | `string` | no | The component's unique name, PascalCase, as it appears in scenes and dumps. |
|
|
61
|
+
| `fields` | `F` | no | The layout: field names to column factories, as `{ hp: f32(100) }`. |
|
|
62
|
+
|
|
63
|
+
**Returns** `ComponentType<F>`: The token systems, queries and the world take.
|
|
64
|
+
|
|
65
|
+
Binding symbol `og_reflect_define_component` · publish builds: kept
|
|
66
|
+
|
|
67
|
+
```ogt
|
|
68
|
+
fn defineComponent {
|
|
69
|
+
doc "Declare a component: plain data stored per entity in engine memory, one column per field."
|
|
70
|
+
doc "Registration is by name, so a hot reload re-registers the same component and migrates its fields by name."
|
|
71
|
+
generic F Fields
|
|
72
|
+
param name String "The component's unique name, PascalCase, as it appears in scenes and dumps."
|
|
73
|
+
param fields F "The layout: field names to column factories, as `{ hp: f32(100) }`."
|
|
74
|
+
returns ComponentType.F "The token systems, queries and the world take."
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
<sub>`api.ogt` line 184</sub>
|
|
79
|
+
|
|
80
|
+
<a id="fn-defineResource"></a>
|
|
81
|
+
|
|
82
|
+
### `defineResource`
|
|
83
|
+
|
|
84
|
+
Declare a resource: a reflected singleton, such as a tuning table. Its fields start at their defaults.
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
defineResource<F extends Fields>(name: string, fields: F): ResourceType<F>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
| Parameter | Type | Optional | Doc |
|
|
91
|
+
|---|---|---|---|
|
|
92
|
+
| `name` | `string` | no | The resource's unique name, PascalCase. |
|
|
93
|
+
| `fields` | `F` | no | The layout, as for defineComponent. |
|
|
94
|
+
|
|
95
|
+
**Returns** `ResourceType<F>`: The token `world.resource` and system declarations take.
|
|
96
|
+
|
|
97
|
+
Binding symbol `og_reflect_define_resource` · publish builds: kept
|
|
98
|
+
|
|
99
|
+
```ogt
|
|
100
|
+
fn defineResource {
|
|
101
|
+
doc "Declare a resource: a reflected singleton, such as a tuning table. Its fields start at their defaults."
|
|
102
|
+
generic F Fields
|
|
103
|
+
param name String "The resource's unique name, PascalCase."
|
|
104
|
+
param fields F "The layout, as for defineComponent."
|
|
105
|
+
returns ResourceType.F "The token `world.resource` and system declarations take."
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
<sub>`api.ogt` line 193</sub>
|
|
110
|
+
|
|
111
|
+
## Types
|
|
112
|
+
|
|
113
|
+
<a id="type-FieldOptions"></a>
|
|
114
|
+
|
|
115
|
+
### `FieldOptions` (desc struct)
|
|
116
|
+
|
|
117
|
+
Metadata of one field. Ranges and units are what Tune and the probe's bounds show. Nothing clamps writes: game code's writes (world.set, a resource field, a column) are stored as given, and writes from outside the game (the probe's `set`, `patch` and sweeps, Tune, a look's fields at cook) are refused outside min..max with the range named.
|
|
118
|
+
|
|
119
|
+
A desc: every field may be omitted and takes its default; `{}` is valid.
|
|
120
|
+
|
|
121
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
122
|
+
|---|---|---|---|---|---|---|
|
|
123
|
+
| `min` | `number \| null` | `null` | — | — | — | The smallest meaningful value. |
|
|
124
|
+
| `max` | `number \| null` | `null` | — | — | — | The largest meaningful value. |
|
|
125
|
+
| `step` | `number \| null` | `null` | — | — | — | The increment Tune uses. |
|
|
126
|
+
| `unit` | `string` | `""` | — | — | — | A unit name from the API's unit table, or empty. |
|
|
127
|
+
| `label` | `string` | `""` | — | — | — | The person-facing name; empty uses the field name. |
|
|
128
|
+
| `doc` | `string` | `""` | — | — | — | One sentence on what the field means. |
|
|
129
|
+
| `tunable` | `boolean` | `false` | — | — | — | Publish the field to Tune and to the probe's bounds and patch. |
|
|
130
|
+
|
|
131
|
+
```ogt
|
|
132
|
+
struct FieldOptions {
|
|
133
|
+
doc "Metadata of one field. Ranges and units are what Tune and the probe's bounds show. Nothing clamps writes: game code's writes (world.set, a resource field, a column) are stored as given, and writes from outside the game (the probe's `set`, `patch` and sweeps, Tune, a look's fields at cook) are refused outside min..max with the range named."
|
|
134
|
+
desc true
|
|
135
|
+
field min Option.f32 "The smallest meaningful value."
|
|
136
|
+
field max Option.f32 "The largest meaningful value."
|
|
137
|
+
field step Option.f32 "The increment Tune uses."
|
|
138
|
+
field unit String "A unit name from the API's unit table, or empty."
|
|
139
|
+
field label String "The person-facing name; empty uses the field name."
|
|
140
|
+
field doc String "One sentence on what the field means."
|
|
141
|
+
field tunable bool "Publish the field to Tune and to the probe's bounds and patch."
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
<sub>`api.ogt` line 94</sub>
|
|
146
|
+
|
|
147
|
+
## Column kinds
|
|
148
|
+
|
|
149
|
+
Each is a factory, `f32(value?, options?)`, that makes one field of a component or resource layout; `str(capacity, value?, options?)` takes its capacity in bytes first.
|
|
150
|
+
|
|
151
|
+
| Column | Value | Typed array | Stride | Doc |
|
|
152
|
+
|---|---|---|---|---|
|
|
153
|
+
| <a id="column-f32"></a>`f32` | `number` | `Float32Array` | 1 | A 32-bit float, the default numeric field. |
|
|
154
|
+
| <a id="column-f64"></a>`f64` | `number` | `Float64Array` | 1 | A 64-bit float, for accumulated values that must not drift, such as elapsed time. |
|
|
155
|
+
| <a id="column-u32"></a>`u32` | `number` | `Uint32Array` | 1 | A 32-bit unsigned integer: counters, flags, indices. |
|
|
156
|
+
| <a id="column-i32"></a>`i32` | `number` | `Int32Array` | 1 | A 32-bit signed integer. |
|
|
157
|
+
| <a id="column-bool"></a>`bool` | `boolean` | `Uint8Array` | 1 | A boolean, stored as one byte: 0 or 1. |
|
|
158
|
+
| <a id="column-Vector2"></a>`Vector2` | `Vector2` | `Float32Array` | 2 | A Vector2 field: x, y interleaved. |
|
|
159
|
+
| <a id="column-Vector3"></a>`Vector3` | `Vector3` | `Float32Array` | 3 | A Vector3 field: x, y, z interleaved. |
|
|
160
|
+
| <a id="column-Quaternion"></a>`Quaternion` | `Quaternion` | `Float32Array` | 4 | A Quaternion field: x, y, z, w interleaved. |
|
|
161
|
+
| <a id="column-Matrix4"></a>`Matrix4` | `Matrix4` | `Float32Array` | 16 | A Matrix4 field: sixteen column-major elements per entity. |
|
|
162
|
+
| <a id="column-Color"></a>`Color` | `Color` | `Float32Array` | 3 | A Color field: r, g, b interleaved. |
|
|
163
|
+
| <a id="column-str"></a>`str` | `string` | `Uint8Array` | the capacity | Text of at most `capacity` bytes of UTF-8, stored inline and zero-padded, so it is world state like a number: a player's name, a label. `str(48)` holds any 12 characters (four bytes covers every script). The capacity is 1 to 4,096 bytes: a larger one is refused when the game starts (`a string field holds 1 to 4096 bytes`), so longer text goes in chunks, an entity each. Get and set it as a JavaScript string; text over the capacity is refused with the fix named (an error value from world.insert/world.set, a throw from a resource's setter), never truncated. Its view is the raw bytes. |
|
|
164
|
+
|
|
165
|
+
```ogt
|
|
166
|
+
column f32 {
|
|
167
|
+
doc "A 32-bit float, the default numeric field."
|
|
168
|
+
array Float32Array
|
|
169
|
+
stride 1
|
|
170
|
+
value f32
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
<sub>`api.ogt` line 106</sub>
|
|
175
|
+
|
|
176
|
+
```ogt
|
|
177
|
+
column f64 {
|
|
178
|
+
doc "A 64-bit float, for accumulated values that must not drift, such as elapsed time."
|
|
179
|
+
array Float64Array
|
|
180
|
+
stride 1
|
|
181
|
+
value f64
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
<sub>`api.ogt` line 113</sub>
|
|
186
|
+
|
|
187
|
+
```ogt
|
|
188
|
+
column u32 {
|
|
189
|
+
doc "A 32-bit unsigned integer: counters, flags, indices."
|
|
190
|
+
array Uint32Array
|
|
191
|
+
stride 1
|
|
192
|
+
value u32
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
<sub>`api.ogt` line 120</sub>
|
|
197
|
+
|
|
198
|
+
```ogt
|
|
199
|
+
column i32 {
|
|
200
|
+
doc "A 32-bit signed integer."
|
|
201
|
+
array Int32Array
|
|
202
|
+
stride 1
|
|
203
|
+
value i32
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
<sub>`api.ogt` line 127</sub>
|
|
208
|
+
|
|
209
|
+
```ogt
|
|
210
|
+
column bool {
|
|
211
|
+
doc "A boolean, stored as one byte: 0 or 1."
|
|
212
|
+
array Uint8Array
|
|
213
|
+
stride 1
|
|
214
|
+
value bool
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
<sub>`api.ogt` line 134</sub>
|
|
219
|
+
|
|
220
|
+
```ogt
|
|
221
|
+
column Vector2 {
|
|
222
|
+
doc "A Vector2 field: x, y interleaved."
|
|
223
|
+
array Float32Array
|
|
224
|
+
stride 2
|
|
225
|
+
value Vector2
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
<sub>`api.ogt` line 141</sub>
|
|
230
|
+
|
|
231
|
+
```ogt
|
|
232
|
+
column Vector3 {
|
|
233
|
+
doc "A Vector3 field: x, y, z interleaved."
|
|
234
|
+
array Float32Array
|
|
235
|
+
stride 3
|
|
236
|
+
value Vector3
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
<sub>`api.ogt` line 148</sub>
|
|
241
|
+
|
|
242
|
+
```ogt
|
|
243
|
+
column Quaternion {
|
|
244
|
+
doc "A Quaternion field: x, y, z, w interleaved."
|
|
245
|
+
array Float32Array
|
|
246
|
+
stride 4
|
|
247
|
+
value Quaternion
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
<sub>`api.ogt` line 155</sub>
|
|
252
|
+
|
|
253
|
+
```ogt
|
|
254
|
+
column Matrix4 {
|
|
255
|
+
doc "A Matrix4 field: sixteen column-major elements per entity."
|
|
256
|
+
array Float32Array
|
|
257
|
+
stride 16
|
|
258
|
+
value Matrix4
|
|
259
|
+
}
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
<sub>`api.ogt` line 162</sub>
|
|
263
|
+
|
|
264
|
+
```ogt
|
|
265
|
+
column Color {
|
|
266
|
+
doc "A Color field: r, g, b interleaved."
|
|
267
|
+
array Float32Array
|
|
268
|
+
stride 3
|
|
269
|
+
value Color
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
<sub>`api.ogt` line 169</sub>
|
|
274
|
+
|
|
275
|
+
```ogt
|
|
276
|
+
column str {
|
|
277
|
+
doc "Text of at most `capacity` bytes of UTF-8, stored inline and zero-padded, so it is world state like a number: a player's name, a label. `str(48)` holds any 12 characters (four bytes covers every script). The capacity is 1 to 4,096 bytes: a larger one is refused when the game starts (`a string field holds 1 to 4096 bytes`), so longer text goes in chunks, an entity each."
|
|
278
|
+
doc "Get and set it as a JavaScript string; text over the capacity is refused with the fix named (an error value from world.insert/world.set, a throw from a resource's setter), never truncated. Its view is the raw bytes."
|
|
279
|
+
array Uint8Array
|
|
280
|
+
capacity true
|
|
281
|
+
value String
|
|
282
|
+
}
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
<sub>`api.ogt` line 176</sub>
|