@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.
Files changed (158) hide show
  1. package/bin/og.mjs +25 -0
  2. package/dist/web/origin-engine.d.ts +1233 -0
  3. package/dist/web/origin-engine.js +8628 -0
  4. package/dist/web/origin-engine_bg.wasm +0 -0
  5. package/dist/web/origin-engine_bg.wasm.d.ts +366 -0
  6. package/dist/web-publish/origin-engine-lanes.js +8509 -0
  7. package/dist/web-publish/origin-engine-lanes_bg.wasm +0 -0
  8. package/dist/web-publish/origin-engine.d.ts +1176 -0
  9. package/dist/web-publish/origin-engine.js +8313 -0
  10. package/dist/web-publish/origin-engine_bg.wasm +0 -0
  11. package/dist/web-publish/origin-engine_bg.wasm.d.ts +347 -0
  12. package/dist/web-publish/snippets/wasm-bindgen-rayon-38edf6e439f6d70d/src/workerHelpers.no-bundler.js +77 -0
  13. package/dist/web-publish-2d/origin-engine-lanes.js +8509 -0
  14. package/dist/web-publish-2d/origin-engine-lanes_bg.wasm +0 -0
  15. package/dist/web-publish-2d/origin-engine.d.ts +1176 -0
  16. package/dist/web-publish-2d/origin-engine.js +8313 -0
  17. package/dist/web-publish-2d/origin-engine_bg.wasm +0 -0
  18. package/dist/web-publish-2d/origin-engine_bg.wasm.d.ts +347 -0
  19. package/dist/web-publish-2d/snippets/wasm-bindgen-rayon-38edf6e439f6d70d/src/workerHelpers.no-bundler.js +77 -0
  20. package/knowledge/README.md +31 -0
  21. package/knowledge/knowledge.json +13 -0
  22. package/knowledge/looks/catalogue.json +1871 -0
  23. package/knowledge/package.json +33 -0
  24. package/knowledge/rules/platform.json +329 -0
  25. package/knowledge/scaffold/README.md +27 -0
  26. package/knowledge/scaffold/distribution.json +48 -0
  27. package/knowledge/scaffold/origin-engine.json +19 -0
  28. package/knowledge/scaffold/template/.origin/setup +14 -0
  29. package/knowledge/scaffold/template/LICENSES.md +23 -0
  30. package/knowledge/scaffold/template/README.md +37 -0
  31. package/knowledge/scaffold/template/assets/ai/guard.ogt +48 -0
  32. package/knowledge/scaffold/template/assets/audio/click.ogt +9 -0
  33. package/knowledge/scaffold/template/assets/fonts/NotoSansSC-Regular-subset.ttf.ogt +12 -0
  34. package/knowledge/scaffold/template/assets/fonts/OFL.txt +93 -0
  35. package/knowledge/scaffold/template/assets/looks/origin-game.ogt +12 -0
  36. package/knowledge/scaffold/template/assets/nav/yard.ogt +27 -0
  37. package/knowledge/scaffold/template/assets/scenes/main.ogt +34 -0
  38. package/knowledge/scaffold/template/assets/strings/en.ogt +14 -0
  39. package/knowledge/scaffold/template/assets/textures/stone_n.png.ogt +7 -0
  40. package/knowledge/scaffold/template/gitattributes +22 -0
  41. package/knowledge/scaffold/template/package.json +18 -0
  42. package/knowledge/scaffold/template/project.ogt +25 -0
  43. package/knowledge/scaffold/template/src/main.ts +246 -0
  44. package/knowledge/scaffold/template/tests/guard.og.ts +67 -0
  45. package/knowledge/scaffold/template/tests/smoke.og.ts +43 -0
  46. package/knowledge/scaffold/template/tsconfig.json +17 -0
  47. package/knowledge/scripts/lib.ts +203 -0
  48. package/knowledge/scripts/mount.ts +210 -0
  49. package/knowledge/scripts/pack.ts +24 -0
  50. package/knowledge/scripts/scaffold.ts +72 -0
  51. package/knowledge/scripts/validate.ts +749 -0
  52. package/knowledge/skills/og-ai/SKILL.md +386 -0
  53. package/knowledge/skills/og-audio/SKILL.md +191 -0
  54. package/knowledge/skills/og-build/SKILL.md +330 -0
  55. package/knowledge/skills/og-core/SKILL.md +285 -0
  56. package/knowledge/skills/og-feel/SKILL.md +385 -0
  57. package/knowledge/skills/og-game/SKILL.md +1479 -0
  58. package/knowledge/skills/og-i18n/SKILL.md +220 -0
  59. package/knowledge/skills/og-platform-sdk/SKILL.md +199 -0
  60. package/knowledge/skills/og-taste/SKILL.md +537 -0
  61. package/knowledge/skills/og-ui/SKILL.md +444 -0
  62. package/knowledge/wiki/ai.md +627 -0
  63. package/knowledge/wiki/anim.md +1187 -0
  64. package/knowledge/wiki/atmosphere.md +636 -0
  65. package/knowledge/wiki/audio.md +732 -0
  66. package/knowledge/wiki/camera.md +711 -0
  67. package/knowledge/wiki/commands.md +357 -0
  68. package/knowledge/wiki/game.md +220 -0
  69. package/knowledge/wiki/i18n.md +213 -0
  70. package/knowledge/wiki/index.md +1027 -0
  71. package/knowledge/wiki/input.md +1714 -0
  72. package/knowledge/wiki/load.md +1280 -0
  73. package/knowledge/wiki/math.md +166 -0
  74. package/knowledge/wiki/nav.md +1154 -0
  75. package/knowledge/wiki/physics.md +3142 -0
  76. package/knowledge/wiki/platform.md +857 -0
  77. package/knowledge/wiki/probe.md +1692 -0
  78. package/knowledge/wiki/reflect.md +285 -0
  79. package/knowledge/wiki/render.md +3511 -0
  80. package/knowledge/wiki/rng.md +393 -0
  81. package/knowledge/wiki/stream.md +376 -0
  82. package/knowledge/wiki/system.md +197 -0
  83. package/knowledge/wiki/systems.md +43 -0
  84. package/knowledge/wiki/terrain.md +727 -0
  85. package/knowledge/wiki/tilemap.md +422 -0
  86. package/knowledge/wiki/time.md +150 -0
  87. package/knowledge/wiki/transform.md +230 -0
  88. package/knowledge/wiki/tween.md +580 -0
  89. package/knowledge/wiki/ui.md +8000 -0
  90. package/knowledge/wiki/world.md +909 -0
  91. package/package.json +68 -4
  92. package/schema/api.schema.json +29675 -0
  93. package/shell/README.md +22 -0
  94. package/shell/brand/README.md +23 -0
  95. package/shell/brand/icon-192.png +0 -0
  96. package/shell/brand/icon-512.png +0 -0
  97. package/shell/brand/mark-on-paper.svg +6 -0
  98. package/shell/brand/origin-mark.svg +5 -0
  99. package/shell/brand/origin-motion.css +251 -0
  100. package/shell/brand/tokens.css +20 -0
  101. package/shell/brand.ts +132 -0
  102. package/shell/page.ts +715 -0
  103. package/shell/platform.ts +203 -0
  104. package/shell/player.ts +238 -0
  105. package/shell/shell.css +185 -0
  106. package/shell/sw.ts +177 -0
  107. package/shell/transport.ts +515 -0
  108. package/shell/wire.ts +369 -0
  109. package/src/e6.ts +69 -0
  110. package/src/env.d.ts +100 -0
  111. package/src/generated/abi.ts +980 -0
  112. package/src/index.ts +193 -0
  113. package/src/node/audio.ts +86 -0
  114. package/src/node/build.ts +109 -0
  115. package/src/node/device.ts +981 -0
  116. package/src/node/doctor.ts +60 -0
  117. package/src/node/index.ts +102 -0
  118. package/src/node/platform.ts +24 -0
  119. package/src/node/playtest-run.ts +249 -0
  120. package/src/node/png.ts +130 -0
  121. package/src/node/polish.ts +976 -0
  122. package/src/node/run.ts +373 -0
  123. package/src/node/web-build.ts +808 -0
  124. package/src/p2.ts +35 -0
  125. package/src/platform-local.ts +211 -0
  126. package/src/playtest.ts +131 -0
  127. package/src/runtime.ts +1509 -0
  128. package/src/systems/cameras.ts +247 -0
  129. package/src/ui-kit/bind.ts +141 -0
  130. package/src/ui-kit/huds.ts +303 -0
  131. package/src/ui-kit/index.ts +36 -0
  132. package/src/ui-kit/menus.ts +187 -0
  133. package/src/ui-kit/settings.ts +131 -0
  134. package/src/ui-kit/store.ts +222 -0
  135. package/src/ui-kit/story.ts +89 -0
  136. package/src/ui-kit/util.ts +106 -0
  137. package/src/web/a11y.ts +429 -0
  138. package/src/web/audio-worklet.ts +193 -0
  139. package/src/web/audio.ts +307 -0
  140. package/src/web/basis.ts +239 -0
  141. package/src/web/gamepad.ts +123 -0
  142. package/src/web/host.ts +166 -0
  143. package/src/web/input.ts +237 -0
  144. package/src/web/lanes.ts +21 -0
  145. package/src/web/play.ts +20 -0
  146. package/src/web/rpc-ring.ts +110 -0
  147. package/src/web/settle.ts +122 -0
  148. package/src/web/shell.ts +643 -0
  149. package/src/web/text-input.ts +248 -0
  150. package/src/web/worker.ts +1002 -0
  151. package/types/bindings.json +13654 -0
  152. package/types/index.d.ts +20090 -0
  153. package/vendor/basis/LICENSE +201 -0
  154. package/vendor/basis/NOTICE +15 -0
  155. package/vendor/basis/README.md +18 -0
  156. package/vendor/basis/basis_transcoder.js +19 -0
  157. package/vendor/basis/basis_transcoder.wasm +0 -0
  158. package/README.md +0 -3
@@ -0,0 +1,1280 @@
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 `load` module
4
+
5
+ Asset loading from cooked output: `og cook` turns assets/ into cooked/ (.ogb blobs and the manifest cooked/.cook.ogt), and the runtime reads only cooked/.
6
+
7
+ Paths are asset ids: the path under assets/ (`models/ship.glb`, `scenes/main.ogt`); an `assets/` prefix is accepted. Every blob is checked against the manifest's type, schema version and cook stamp.
8
+
9
+ The game's bundle (`cooked`) is opened before the first tick and GameDesc.scene is spawned then. Loads from an open bundle complete at once on both hosts (the web host fetches the bundle's files before the engine starts); only og.load.bundle of another bundle can be pending, and it completes at a tick boundary.
10
+
11
+ - **TypeScript**: functions are the namespace `og.load`; 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 load {
18
+ # declarations follow, each quoted below
19
+ ```
20
+
21
+ <sub>`api.ogt` line 3364</sub>
22
+
23
+ ## Contents
24
+
25
+ | Name | Kind | Summary |
26
+ |---|---|---|
27
+ | [`Asset`](#type-Asset) | handle | A loaded bundle, scene or glTF asset. |
28
+ | [`Font`](#type-Font) | handle | A cooked MSDF font: its glyph table and one or more atlas pages. |
29
+ | [`Sound`](#type-Sound) | handle | A cooked sound: QOA-encoded PCM the audio module plays. |
30
+ | [`Skin`](#type-Skin) | handle | A cooked UI skin: its atlas, fonts, icons and sounds loaded with it, for og.ui.configure. |
31
+ | [`TextureArray`](#type-TextureArray) | handle | A cooked texture array: same-sized layers uploaded as one 2D-array texture (og.load.textureArray). |
32
+ | [`TextureArray()`](#column-TextureArray) | column kind | A TextureArray handle field (0 is none). |
33
+ | [`Asset()`](#column-Asset) | column kind | An Asset handle field. |
34
+ | [`Sound()`](#column-Sound) | column kind | A Sound handle field. |
35
+ | [`LoadStatus`](#type-LoadStatus) | enum | Where a load is. |
36
+ | [`GltfDesc`](#type-GltfDesc) | desc struct | How to load a glTF, as three.js GLTFLoader options where they apply. |
37
+ | [`GltfInfo`](#type-GltfInfo) | struct | What a loaded glTF holds. |
38
+ | [`BundleInfo`](#type-BundleInfo) | struct | An open cooked bundle. |
39
+ | [`FontInfo`](#type-FontInfo) | struct | A loaded font's metrics, in em units unless stated. |
40
+ | [`SoundInfo`](#type-SoundInfo) | struct | A loaded sound. |
41
+ | [`TextureArrayInfo`](#type-TextureArrayInfo) | struct | What og.load.textureArray uploaded. |
42
+ | [`og.Model`](#record-Model) | component | Draws a loaded glTF's default scene at the entity's world transform: every mesh node with its glTF material. Scene entities with a `model` line get one; world.instantiate of a glTF asset spawns one. |
43
+ | [`og.load.bundle`](#fn-bundle) | function | Open another cooked bundle (the game's own `cooked` is open before the first tick). Its loads read through it once it is ready. |
44
+ | [`og.load.bundleInfo`](#fn-bundleInfo) | function | What an open bundle holds. |
45
+ | [`og.load.defaultBundle`](#fn-defaultBundle) | function | The game's own bundle, opened before the first tick from `cooked/`. |
46
+ | [`og.load.gltf`](#fn-gltf) | function | Load a cooked glTF (.gltf or .glb), as three.js GLTFLoader.load: its meshes, materials and textures join the renderer once. |
47
+ | [`og.load.scene`](#fn-scene) | function | Load a cooked scene (.ogt). world.instantiate spawns its entities: depth first, parents before children, each component table matched to a registered component by its reflected name (`Transform` is og.Transform) and migrated field by field; a field the scene lacks keeps its default, one the component lacks is dropped with a warning. |
48
+ | [`og.load.font`](#fn-font) | function | Load a cooked MSDF font for og.render.text, or an icon set (an `.ogt` of `type icons`: SVG icons cooked into a distance-field atlas like a font) for UiDesc.icons.font. |
49
+ | [`og.load.fontInfo`](#fn-fontInfo) | function | A loaded font's metrics. |
50
+ | [`og.load.sound`](#fn-sound) | function | Load a cooked sound for the audio module. |
51
+ | [`og.load.lut`](#fn-lut) | function | A colour lookup table for PostEffects.lut, from a cooked `.cube` file (Adobe/Resolve 3D LUT; other sizes are resampled to 32). Loaded once per path. One in a streaming group's pack loads once its group is resident (refused before, naming the group); while the group is unloaded PostEffects.lut grades nothing with it, and it comes back under the same handle. |
52
+ | [`og.load.environment`](#fn-environment) | function | A prefiltered environment map for Environment.map, from a cooked `.ogt` of `type environment`: `source` an equirectangular Radiance `.hdr` or OpenEXR `.exr` (the centre column faces +X, as three.js maps it) or a KTX2 cube map (six square faces +X -X +Y -Y +Z -Z with rows from the top; RGBA16F, RGB9E5, BC6H and the other HDR formats, decoded at cook time), or `faces` with six `.hdr`/`.exr` images in that order; `size` level 0's face size (a power of two, 16 to 2048, default 128), `intensity`, `rotation` (degrees about +Y) and `samples`. The cook prefilters it into a cube of five GGX levels (roughness 0 to 1) in RGB9E5 and the diffuse irradiance as nine harmonics, so loading only uploads it; `prefiltered true` takes a KTX2 cube's own mip chain as those levels instead (one already GGX-prefiltered by cmgen, IBLBaker or the glTF IBL sampler: level k of L at roughness k / (L - 1)), at the file's own size, without filtering it again. On the web it is fetched with the bundle like any blob; one in a streaming group's pack loads when its group is resident, and the sky lights the scene until then. Loaded once per path. |
53
+ | [`og.load.emitter`](#fn-emitter) | function | A particle emitter asset for ParticleSystem.emitter, from a cooked `.ogt` of `type particles` (the og-game skill's Effects section gives every line with its default and an example; og-cook's fx module parses it): shape, rate and bursts, lifetime, speed, size and colour over life, gravity, drag, noise, a texture and sprite sheet, blending, collision, billboard or 2D sprite rendering. A sprite-mode emitter may draw from a texture array instead (`array "<id>" [<layers>] [off \| life <cycles> \| fps <n> \| random]`: each particle shows a layer by its age, at a rate, or one at random for its life; one draw per array whatever the layers; `round true` fades each particle to the soft dot's round edge). The textures and the array it names are loaded with it; while the array's streaming group is not resident its systems draw nothing. Loaded once per path. |
54
+ | [`og.load.shader`](#fn-shader) | function | A material shader for og.render.shaderMaterial, from a cooked `.ogt` of `type shader` (its WGSL compiled by the cook for every back end). Loaded once per path. |
55
+ | [`og.load.texture`](#fn-texture) | function | Load a cooked texture for og.render.sprite and og.ui.image, as three.js TextureLoader.load. |
56
+ | [`og.load.textureArray`](#fn-textureArray) | function | Load a cooked texture array (an `.ogt` of `type texture-array`: `kind color\|normal\|linear\|pixel` and one `layer "<file>"` per layer, 1 to 256 images of one size, each path beside the file or under assets/) and upload it as one 2D-array texture, its layers in file order, each in the encoding the device takes for its kind. Each layer is also a texture of its own, `<path>#layer<n>`, for og.load.texture. Loading the same path again answers the same array. |
57
+ | [`og.load.skin`](#fn-skin) | function | Load a cooked UI skin (an `.ogt` of `type skin`: the atlas and its nine-slice frames, ornaments, palette, radii, type ramp, fonts, icons, motion and sounds; the grammar is og-ui's `skin` module) for UiDesc.skin. Its atlas, fonts, icons and sounds are loaded with it. Loaded once per path. |
58
+ | [`og.load.look`](#fn-look) | function | Load a look: an `.ogt` of `type look` binding a frame's art direction as data. Its top-level `name`, `extends` (a built-in preset's slug, such as `anime-cel-3d`, or another look's asset id: the game's own `assets/looks/<slug>.ogt` wins over the built-in preset of that slug), `skin` (a UI skin's asset id) and `antialias`, then one block per resource it sets (RenderSettings, PostEffects, Stylise, MaterialStyle, Fog, Sky, Environment) with that resource's fields by name, an asset id where a field is a handle (`lut "luts/warm.cube"`, `palette "palettes/dusk.hex"`). The cook validates every field against the resources' reflected schema and flattens `extends`, so the blob is the whole look. The textures, LUTs, palettes, environment map and skin it names are loaded with it. Loaded once per path. |
59
+ | [`og.load.lookInfo`](#fn-lookInfo) | function | What a loaded look holds and sets. |
60
+ | [`og.load.palette`](#fn-palette) | function | A colour palette for Stylise.palette, from a cooked `.hex` (one RRGGBB per line, as palette sites publish them) or GIMP `.gpl` file: up to 256 sRGB colours, in file order. Loaded once per path. One in a streaming group's pack loads once its group is resident; while the group is unloaded Stylise.palette quantises to no palette, and the palette comes back under the same handle. |
61
+ | [`og.load.soundInfo`](#fn-soundInfo) | function | A loaded sound's format and length. |
62
+ | [`og.load.status`](#fn-status) | function | Where a load is. |
63
+ | [`og.load.error`](#fn-error) | function | Why a load failed. |
64
+ | [`og.load.gltfInfo`](#fn-gltfInfo) | function | What a ready glTF holds. |
65
+ | [`og.load.animation`](#fn-animation) | function | Load a cooked glTF's animation (its `<model>#anim` blob: the rig, the clips, the skin and morph streams) and register its skeleton and clips with og.anim. Loading the same model again answers the same handles. |
66
+ | [`og.load.rig`](#fn-rig) | function | Load a cooked humanoid map (an `.ogt` of `type rig`: a naming scheme and bones named outright) for og.anim.retarget and og.anim.humanoid. Loading the same path again answers the same handle. |
67
+ | [`og.load.flipbook`](#fn-flipbook) | function | Load a cooked flipbook sheet (an `.ogt` of `type flipbook`, with its Aseprite or TexturePacker atlas resolved by the cook) and its texture, and register it with og.flipbook. A sheet with `array true` is cooked into a texture array instead (its frames, one size, cut out of the texture as layers): its sprites draw frame n as layer n, every sprite of the sheet one draw whichever frame each shows, and FlipbookInfo.array names the array. A sheet in a streaming group (its array and layers with it) loads once its group is resident (refused naming the group before), and its sprites draw nothing while the group is away. Loading the same path again answers the same handles. |
68
+ | [`og.load.tilemap`](#fn-tilemap) | function | Load a cooked map (a tilemap `.ogt`, a Tiled `.tmj` or an LDtk `.ldtk`), its tilesets and their textures. Loading the same path again answers the same handles. |
69
+ | [`og.AssetReady`](#record-AssetReady) | event | A load completed. |
70
+ | [`og.AssetFailed`](#record-AssetFailed) | event | A load failed. |
71
+
72
+ ## Functions
73
+
74
+ <a id="fn-bundle"></a>
75
+
76
+ ### `og.load.bundle`
77
+
78
+ Open another cooked bundle (the game's own `cooked` is open before the first tick). Its loads read through it once it is ready.
79
+
80
+ ```ts
81
+ og.load.bundle(world: World, path: string): Result<Asset>
82
+ ```
83
+
84
+ | Parameter | Type | Optional | Doc |
85
+ |---|---|---|---|
86
+ | `world` | `World` | no | The world that owns the asset. |
87
+ | `path` | `string` | no | The cooked directory, relative to the project (or the page), such as `dlc/cooked`. |
88
+
89
+ **Returns** `Result<Asset>`: The bundle's handle: pending until its manifest is read, then ready or failed.
90
+
91
+ Binding symbol `og_load_bundle` · publish builds: kept
92
+
93
+ ```ogt
94
+ fn bundle {
95
+ doc "Open another cooked bundle (the game's own `cooked` is open before the first tick). Its loads read through it once it is ready."
96
+ param world World "The world that owns the asset."
97
+ param path String "The cooked directory, relative to the project (or the page), such as `dlc/cooked`."
98
+ returns Result.Asset "The bundle's handle: pending until its manifest is read, then ready or failed."
99
+ }
100
+ ```
101
+
102
+ <sub>`api.ogt` line 3493</sub>
103
+
104
+ <a id="fn-bundleInfo"></a>
105
+
106
+ ### `og.load.bundleInfo`
107
+
108
+ What an open bundle holds.
109
+
110
+ ```ts
111
+ og.load.bundleInfo(world: World, asset: Asset): Result<BundleInfo>
112
+ ```
113
+
114
+ | Parameter | Type | Optional | Doc |
115
+ |---|---|---|---|
116
+ | `world` | `World` | no | The world that owns the asset. |
117
+ | `asset` | `Asset` | no | A bundle handle; the game's own bundle is og.load.bundle's first answer, also given by `defaultBundle`. |
118
+
119
+ **Returns** `Result<BundleInfo>`: Refused for a pending, failed or non-bundle asset.
120
+
121
+ Binding symbol `og_load_bundle_info` · publish builds: kept
122
+
123
+ ```ogt
124
+ fn bundleInfo {
125
+ doc "What an open bundle holds."
126
+ param world World "The world that owns the asset."
127
+ param asset Asset "A bundle handle; the game's own bundle is og.load.bundle's first answer, also given by `defaultBundle`."
128
+ returns Result.BundleInfo "Refused for a pending, failed or non-bundle asset."
129
+ }
130
+ ```
131
+
132
+ <sub>`api.ogt` line 3500</sub>
133
+
134
+ <a id="fn-defaultBundle"></a>
135
+
136
+ ### `og.load.defaultBundle`
137
+
138
+ The game's own bundle, opened before the first tick from `cooked/`.
139
+
140
+ ```ts
141
+ og.load.defaultBundle(world: World): Result<Asset>
142
+ ```
143
+
144
+ | Parameter | Type | Optional | Doc |
145
+ |---|---|---|---|
146
+ | `world` | `World` | no | The world that owns the asset. |
147
+
148
+ **Returns** `Result<Asset>`: Refused when cooked/ was missing or unreadable (run og cook); the reason names the path.
149
+
150
+ Binding symbol `og_load_default_bundle` · publish builds: kept
151
+
152
+ ```ogt
153
+ fn defaultBundle {
154
+ doc "The game's own bundle, opened before the first tick from `cooked/`."
155
+ param world World "The world that owns the asset."
156
+ returns Result.Asset "Refused when cooked/ was missing or unreadable (run og cook); the reason names the path."
157
+ }
158
+ ```
159
+
160
+ <sub>`api.ogt` line 3507</sub>
161
+
162
+ <a id="fn-gltf"></a>
163
+
164
+ ### `og.load.gltf`
165
+
166
+ Load a cooked glTF (.gltf or .glb), as three.js GLTFLoader.load: its meshes, materials and textures join the renderer once.
167
+
168
+ A MagicaVoxel `.vox` cooks to a glTF and loads here too: greedy-meshed, flat-shaded, its palette as vertex colours, z-up turned y-up, each model about its centre (MagicaVoxel's pivot, with a scene graph or without). Its import settings (`models/hut.vox.ogt`, `type import`) size and place it: `model { voxScale 0.1 voxOrigin bottom }` is 0.1 m a voxel (default 1) and the lowest voxel on y = 0 (default `center`, the editor's origin). A `.vox` with frames (MagicaVoxel's animation) cooks to clips that swap the frames' models, played by og.AnimationPlayer as any skinned clip: `voxFps 8` (default 10) and `voxClip walk 0 3` (frames 0 to 3; default one clip `frames` of every frame).
169
+
170
+ ```ts
171
+ og.load.gltf(world: World, path: string, desc?: GltfDesc): Result<Asset>
172
+ ```
173
+
174
+ | Parameter | Type | Optional | Doc |
175
+ |---|---|---|---|
176
+ | `world` | `World` | no | The world that owns the asset. |
177
+ | `path` | `string` | no | The asset id, such as `models/ship.glb`. |
178
+ | `desc` | `GltfDesc` | yes | Scene and shadow options. |
179
+
180
+ **Returns** `Result<Asset>`: The handle, or why it was refused (an uncooked path, a cook stamp mismatch, no open bundle).
181
+
182
+ Binding symbol `og_load_gltf` · publish builds: kept
183
+
184
+ ```ogt
185
+ fn gltf {
186
+ doc "Load a cooked glTF (.gltf or .glb), as three.js GLTFLoader.load: its meshes, materials and textures join the renderer once."
187
+ doc "A MagicaVoxel `.vox` cooks to a glTF and loads here too: greedy-meshed, flat-shaded, its palette as vertex colours, z-up turned y-up, each model about its centre (MagicaVoxel's pivot, with a scene graph or without). Its import settings (`models/hut.vox.ogt`, `type import`) size and place it: `model { voxScale 0.1 voxOrigin bottom }` is 0.1 m a voxel (default 1) and the lowest voxel on y = 0 (default `center`, the editor's origin). A `.vox` with frames (MagicaVoxel's animation) cooks to clips that swap the frames' models, played by og.AnimationPlayer as any skinned clip: `voxFps 8` (default 10) and `voxClip walk 0 3` (frames 0 to 3; default one clip `frames` of every frame)."
188
+ param world World "The world that owns the asset."
189
+ param path String "The asset id, such as `models/ship.glb`."
190
+ param desc GltfDesc "Scene and shadow options."
191
+ returns Result.Asset "The handle, or why it was refused (an uncooked path, a cook stamp mismatch, no open bundle)."
192
+ }
193
+ ```
194
+
195
+ <sub>`api.ogt` line 3513</sub>
196
+
197
+ <a id="fn-scene"></a>
198
+
199
+ ### `og.load.scene`
200
+
201
+ Load a cooked scene (.ogt). world.instantiate spawns its entities: depth first, parents before children, each component table matched to a registered component by its reflected name (`Transform` is og.Transform) and migrated field by field; a field the scene lacks keeps its default, one the component lacks is dropped with a warning.
202
+
203
+ ```ts
204
+ og.load.scene(world: World, path: string): Result<Asset>
205
+ ```
206
+
207
+ | Parameter | Type | Optional | Doc |
208
+ |---|---|---|---|
209
+ | `world` | `World` | no | The world that owns the asset. |
210
+ | `path` | `string` | no | The scene's asset id, such as `scenes/main.ogt`. |
211
+
212
+ **Returns** `Result<Asset>`.
213
+
214
+ Binding symbol `og_load_scene` · publish builds: kept
215
+
216
+ ```ogt
217
+ fn scene {
218
+ doc "Load a cooked scene (.ogt). world.instantiate spawns its entities: depth first, parents before children, each component table matched to a registered component by its reflected name (`Transform` is og.Transform) and migrated field by field; a field the scene lacks keeps its default, one the component lacks is dropped with a warning."
219
+ param world World "The world that owns the asset."
220
+ param path String "The scene's asset id, such as `scenes/main.ogt`."
221
+ returns Result.Asset
222
+ }
223
+ ```
224
+
225
+ <sub>`api.ogt` line 3522</sub>
226
+
227
+ <a id="fn-font"></a>
228
+
229
+ ### `og.load.font`
230
+
231
+ Load a cooked MSDF font for og.render.text, or an icon set (an `.ogt` of `type icons`: SVG icons cooked into a distance-field atlas like a font) for UiDesc.icons.font.
232
+
233
+ ```ts
234
+ og.load.font(world: World, path: string): Result<Font>
235
+ ```
236
+
237
+ | Parameter | Type | Optional | Doc |
238
+ |---|---|---|---|
239
+ | `world` | `World` | no | The world that owns the font. |
240
+ | `path` | `string` | no | The font's asset id, such as `fonts/NotoSansSC-Regular-subset.ttf`. |
241
+
242
+ **Returns** `Result<Font>`.
243
+
244
+ Binding symbol `og_load_font` · publish builds: kept
245
+
246
+ ```ogt
247
+ fn font {
248
+ doc "Load a cooked MSDF font for og.render.text, or an icon set (an `.ogt` of `type icons`: SVG icons cooked into a distance-field atlas like a font) for UiDesc.icons.font."
249
+ param world World "The world that owns the font."
250
+ param path String "The font's asset id, such as `fonts/NotoSansSC-Regular-subset.ttf`."
251
+ returns Result.Font
252
+ }
253
+ ```
254
+
255
+ <sub>`api.ogt` line 3529</sub>
256
+
257
+ <a id="fn-fontInfo"></a>
258
+
259
+ ### `og.load.fontInfo`
260
+
261
+ A loaded font's metrics.
262
+
263
+ ```ts
264
+ og.load.fontInfo(world: World, font: Font): Result<FontInfo>
265
+ ```
266
+
267
+ | Parameter | Type | Optional | Doc |
268
+ |---|---|---|---|
269
+ | `world` | `World` | no | The world that owns the font. |
270
+ | `font` | `Font` | no | The font. |
271
+
272
+ **Returns** `Result<FontInfo>`: Refused for a dead font.
273
+
274
+ Binding symbol `og_load_font_info` · publish builds: kept
275
+
276
+ ```ogt
277
+ fn fontInfo {
278
+ doc "A loaded font's metrics."
279
+ param world World "The world that owns the font."
280
+ param font Font "The font."
281
+ returns Result.FontInfo "Refused for a dead font."
282
+ }
283
+ ```
284
+
285
+ <sub>`api.ogt` line 3536</sub>
286
+
287
+ <a id="fn-sound"></a>
288
+
289
+ ### `og.load.sound`
290
+
291
+ Load a cooked sound for the audio module.
292
+
293
+ A long sound (music, ambience) can be cooked in chunks of whole QOA frames: `sound { stream true chunk 4 }` in its `.wav.ogt` import settings (chunk in seconds, 1 to 60, default 4), and every sound whose QOA file would pass 1 MiB unless `stream false`. Its first chunk loads with it and the others follow the playheads (SoundInfo.chunks), so music is never resident whole; it plays sample for sample as the whole file would, loops and crossfades included. A sound cooked in chunks cannot join a streaming group.
294
+
295
+ ```ts
296
+ og.load.sound(world: World, path: string): Result<Sound>
297
+ ```
298
+
299
+ | Parameter | Type | Optional | Doc |
300
+ |---|---|---|---|
301
+ | `world` | `World` | no | The world that owns the sound. |
302
+ | `path` | `string` | no | The sound's asset id, such as `audio/blip.wav`. |
303
+
304
+ **Returns** `Result<Sound>`.
305
+
306
+ Binding symbol `og_load_sound` · publish builds: kept
307
+
308
+ ```ogt
309
+ fn sound {
310
+ doc "Load a cooked sound for the audio module."
311
+ doc "A long sound (music, ambience) can be cooked in chunks of whole QOA frames: `sound { stream true chunk 4 }` in its `.wav.ogt` import settings (chunk in seconds, 1 to 60, default 4), and every sound whose QOA file would pass 1 MiB unless `stream false`. Its first chunk loads with it and the others follow the playheads (SoundInfo.chunks), so music is never resident whole; it plays sample for sample as the whole file would, loops and crossfades included. A sound cooked in chunks cannot join a streaming group."
312
+ param world World "The world that owns the sound."
313
+ param path String "The sound's asset id, such as `audio/blip.wav`."
314
+ returns Result.Sound
315
+ }
316
+ ```
317
+
318
+ <sub>`api.ogt` line 3543</sub>
319
+
320
+ <a id="fn-lut"></a>
321
+
322
+ ### `og.load.lut`
323
+
324
+ A colour lookup table for PostEffects.lut, from a cooked `.cube` file (Adobe/Resolve 3D LUT; other sizes are resampled to 32). Loaded once per path. One in a streaming group's pack loads once its group is resident (refused before, naming the group); while the group is unloaded PostEffects.lut grades nothing with it, and it comes back under the same handle.
325
+
326
+ ```ts
327
+ og.load.lut(world: World, path: string): Result<Lut>
328
+ ```
329
+
330
+ | Parameter | Type | Optional | Doc |
331
+ |---|---|---|---|
332
+ | `world` | `World` | no | The world whose renderer owns it. |
333
+ | `path` | `string` | no | The asset id, such as `luts/warm.cube`. |
334
+
335
+ **Returns** `Result<Lut>`: Refused for a path not in the bundle (the reason says to run og cook).
336
+
337
+ Binding symbol `og_load_lut` · publish builds: kept
338
+
339
+ ```ogt
340
+ fn lut {
341
+ doc "A colour lookup table for PostEffects.lut, from a cooked `.cube` file (Adobe/Resolve 3D LUT; other sizes are resampled to 32). Loaded once per path. One in a streaming group's pack loads once its group is resident (refused before, naming the group); while the group is unloaded PostEffects.lut grades nothing with it, and it comes back under the same handle."
342
+ param world World "The world whose renderer owns it."
343
+ param path String "The asset id, such as `luts/warm.cube`."
344
+ returns Result.Lut "Refused for a path not in the bundle (the reason says to run og cook)."
345
+ }
346
+ ```
347
+
348
+ <sub>`api.ogt` line 3551</sub>
349
+
350
+ <a id="fn-environment"></a>
351
+
352
+ ### `og.load.environment`
353
+
354
+ A prefiltered environment map for Environment.map, from a cooked `.ogt` of `type environment`: `source` an equirectangular Radiance `.hdr` or OpenEXR `.exr` (the centre column faces +X, as three.js maps it) or a KTX2 cube map (six square faces +X -X +Y -Y +Z -Z with rows from the top; RGBA16F, RGB9E5, BC6H and the other HDR formats, decoded at cook time), or `faces` with six `.hdr`/`.exr` images in that order; `size` level 0's face size (a power of two, 16 to 2048, default 128), `intensity`, `rotation` (degrees about +Y) and `samples`. The cook prefilters it into a cube of five GGX levels (roughness 0 to 1) in RGB9E5 and the diffuse irradiance as nine harmonics, so loading only uploads it; `prefiltered true` takes a KTX2 cube's own mip chain as those levels instead (one already GGX-prefiltered by cmgen, IBLBaker or the glTF IBL sampler: level k of L at roughness k / (L - 1)), at the file's own size, without filtering it again. On the web it is fetched with the bundle like any blob; one in a streaming group's pack loads when its group is resident, and the sky lights the scene until then. Loaded once per path.
355
+
356
+ ```ts
357
+ og.load.environment(world: World, path: string): Result<EnvironmentMap>
358
+ ```
359
+
360
+ | Parameter | Type | Optional | Doc |
361
+ |---|---|---|---|
362
+ | `world` | `World` | no | The world whose renderer owns it. |
363
+ | `path` | `string` | no | The asset id, such as `env/studio.ogt`. |
364
+
365
+ **Returns** `Result<EnvironmentMap>`: Refused for a path not in the bundle (the reason says to run og cook) or not an environment map.
366
+
367
+ Binding symbol `og_load_environment` · publish builds: kept
368
+
369
+ ```ogt
370
+ fn environment {
371
+ doc "A prefiltered environment map for Environment.map, from a cooked `.ogt` of `type environment`: `source` an equirectangular Radiance `.hdr` or OpenEXR `.exr` (the centre column faces +X, as three.js maps it) or a KTX2 cube map (six square faces +X -X +Y -Y +Z -Z with rows from the top; RGBA16F, RGB9E5, BC6H and the other HDR formats, decoded at cook time), or `faces` with six `.hdr`/`.exr` images in that order; `size` level 0's face size (a power of two, 16 to 2048, default 128), `intensity`, `rotation` (degrees about +Y) and `samples`. The cook prefilters it into a cube of five GGX levels (roughness 0 to 1) in RGB9E5 and the diffuse irradiance as nine harmonics, so loading only uploads it; `prefiltered true` takes a KTX2 cube's own mip chain as those levels instead (one already GGX-prefiltered by cmgen, IBLBaker or the glTF IBL sampler: level k of L at roughness k / (L - 1)), at the file's own size, without filtering it again. On the web it is fetched with the bundle like any blob; one in a streaming group's pack loads when its group is resident, and the sky lights the scene until then. Loaded once per path."
372
+ param world World "The world whose renderer owns it."
373
+ param path String "The asset id, such as `env/studio.ogt`."
374
+ returns Result.EnvironmentMap "Refused for a path not in the bundle (the reason says to run og cook) or not an environment map."
375
+ }
376
+ ```
377
+
378
+ <sub>`api.ogt` line 3558</sub>
379
+
380
+ <a id="fn-emitter"></a>
381
+
382
+ ### `og.load.emitter`
383
+
384
+ A particle emitter asset for ParticleSystem.emitter, from a cooked `.ogt` of `type particles` (the og-game skill's Effects section gives every line with its default and an example; og-cook's fx module parses it): shape, rate and bursts, lifetime, speed, size and colour over life, gravity, drag, noise, a texture and sprite sheet, blending, collision, billboard or 2D sprite rendering. A sprite-mode emitter may draw from a texture array instead (`array "<id>" [<layers>] [off | life <cycles> | fps <n> | random]`: each particle shows a layer by its age, at a rate, or one at random for its life; one draw per array whatever the layers; `round true` fades each particle to the soft dot's round edge). The textures and the array it names are loaded with it; while the array's streaming group is not resident its systems draw nothing. Loaded once per path.
385
+
386
+ ```ts
387
+ og.load.emitter(world: World, path: string): Result<ParticleEmitter>
388
+ ```
389
+
390
+ | Parameter | Type | Optional | Doc |
391
+ |---|---|---|---|
392
+ | `world` | `World` | no | The world whose renderer owns it. |
393
+ | `path` | `string` | no | The asset id, such as `fx/sparks.ogt`. |
394
+
395
+ **Returns** `Result<ParticleEmitter>`: Refused for a path not in the bundle, or a texture or texture array it cannot load.
396
+
397
+ Binding symbol `og_load_emitter` · publish builds: kept
398
+
399
+ ```ogt
400
+ fn emitter {
401
+ doc "A particle emitter asset for ParticleSystem.emitter, from a cooked `.ogt` of `type particles` (the og-game skill's Effects section gives every line with its default and an example; og-cook's fx module parses it): shape, rate and bursts, lifetime, speed, size and colour over life, gravity, drag, noise, a texture and sprite sheet, blending, collision, billboard or 2D sprite rendering. A sprite-mode emitter may draw from a texture array instead (`array \"<id>\" [<layers>] [off | life <cycles> | fps <n> | random]`: each particle shows a layer by its age, at a rate, or one at random for its life; one draw per array whatever the layers; `round true` fades each particle to the soft dot's round edge). The textures and the array it names are loaded with it; while the array's streaming group is not resident its systems draw nothing. Loaded once per path."
402
+ param world World "The world whose renderer owns it."
403
+ param path String "The asset id, such as `fx/sparks.ogt`."
404
+ returns Result.ParticleEmitter "Refused for a path not in the bundle, or a texture or texture array it cannot load."
405
+ }
406
+ ```
407
+
408
+ <sub>`api.ogt` line 3565</sub>
409
+
410
+ <a id="fn-shader"></a>
411
+
412
+ ### `og.load.shader`
413
+
414
+ A material shader for og.render.shaderMaterial, from a cooked `.ogt` of `type shader` (its WGSL compiled by the cook for every back end). Loaded once per path.
415
+
416
+ ```ts
417
+ og.load.shader(world: World, path: string): Result<Shader>
418
+ ```
419
+
420
+ | Parameter | Type | Optional | Doc |
421
+ |---|---|---|---|
422
+ | `world` | `World` | no | The world whose renderer owns it. |
423
+ | `path` | `string` | no | The asset id, such as `shaders/dissolve.ogt`. |
424
+
425
+ **Returns** `Result<Shader>`: Refused for a path not in the bundle or not a shader.
426
+
427
+ Binding symbol `og_load_shader` · publish builds: kept
428
+
429
+ ```ogt
430
+ fn shader {
431
+ doc "A material shader for og.render.shaderMaterial, from a cooked `.ogt` of `type shader` (its WGSL compiled by the cook for every back end). Loaded once per path."
432
+ param world World "The world whose renderer owns it."
433
+ param path String "The asset id, such as `shaders/dissolve.ogt`."
434
+ returns Result.Shader "Refused for a path not in the bundle or not a shader."
435
+ }
436
+ ```
437
+
438
+ <sub>`api.ogt` line 3572</sub>
439
+
440
+ <a id="fn-texture"></a>
441
+
442
+ ### `og.load.texture`
443
+
444
+ Load a cooked texture for og.render.sprite and og.ui.image, as three.js TextureLoader.load.
445
+
446
+ Sources are PNG, JPEG or KTX2 files under assets/ (`texture { kind color|normal|linear|pixel }` in `<file>.ogt`). A KTX2's `KTXorientation` and `KTXswizzle` are honoured: one that is not `rd` and `rgba` is decoded, flipped to rows top to bottom and swizzled, and cooked again; one that is (Basis ETC1S or UASTC, or RGBA8, of a colour or linear kind) is taken as it is.
447
+
448
+ ```ts
449
+ og.load.texture(world: World, path: string): Result<Texture>
450
+ ```
451
+
452
+ | Parameter | Type | Optional | Doc |
453
+ |---|---|---|---|
454
+ | `world` | `World` | no | The world whose renderer owns the texture. |
455
+ | `path` | `string` | no | The texture's asset id, such as `textures/stone.png`. |
456
+
457
+ **Returns** `Result<Texture>`.
458
+
459
+ Binding symbol `og_load_texture` · publish builds: kept
460
+
461
+ ```ogt
462
+ fn texture {
463
+ doc "Load a cooked texture for og.render.sprite and og.ui.image, as three.js TextureLoader.load."
464
+ doc "Sources are PNG, JPEG or KTX2 files under assets/ (`texture { kind color|normal|linear|pixel }` in `<file>.ogt`). A KTX2's `KTXorientation` and `KTXswizzle` are honoured: one that is not `rd` and `rgba` is decoded, flipped to rows top to bottom and swizzled, and cooked again; one that is (Basis ETC1S or UASTC, or RGBA8, of a colour or linear kind) is taken as it is."
465
+ param world World "The world whose renderer owns the texture."
466
+ param path String "The texture's asset id, such as `textures/stone.png`."
467
+ returns Result.Texture
468
+ }
469
+ ```
470
+
471
+ <sub>`api.ogt` line 3579</sub>
472
+
473
+ <a id="fn-textureArray"></a>
474
+
475
+ ### `og.load.textureArray`
476
+
477
+ Load a cooked texture array (an `.ogt` of `type texture-array`: `kind color|normal|linear|pixel` and one `layer "<file>"` per layer, 1 to 256 images of one size, each path beside the file or under assets/) and upload it as one 2D-array texture, its layers in file order, each in the encoding the device takes for its kind. Each layer is also a texture of its own, `<path>#layer<n>`, for og.load.texture. Loading the same path again answers the same array.
478
+
479
+ SpriteDesc.array (world and screen sprites), og.Sprite.array and 2D particle emitters (an emitter's `array` line) draw from its layers, one draw per array whatever layer each shows, with glow and the additive blend; an `array true` flipbook sheet cooks its frames into one (materials and terrain layers do not sample arrays yet). TextureArrayInfo and the frame's texture bytes report it. One in a streaming group's pack loads once its group is resident (refused before, naming the group); when the group unloads the renderer lets it go, og.render.sprite of it is refused and og.Sprite and particles of it draw nothing until the group is resident again, when it comes back under the same handle.
480
+
481
+ ```ts
482
+ og.load.textureArray(world: World, path: string): Result<TextureArrayInfo>
483
+ ```
484
+
485
+ | Parameter | Type | Optional | Doc |
486
+ |---|---|---|---|
487
+ | `world` | `World` | no | The world whose renderer owns the array. |
488
+ | `path` | `string` | no | The array's asset id, such as `tiles/ground.ogt`. |
489
+
490
+ **Returns** `Result<TextureArrayInfo>`: Refused for a path not in the bundle (run og cook), not a texture array, or layers that do not agree.
491
+
492
+ Binding symbol `og_load_texture_array` · publish builds: kept
493
+
494
+ ```ogt
495
+ fn textureArray {
496
+ doc "Load a cooked texture array (an `.ogt` of `type texture-array`: `kind color|normal|linear|pixel` and one `layer \"<file>\"` per layer, 1 to 256 images of one size, each path beside the file or under assets/) and upload it as one 2D-array texture, its layers in file order, each in the encoding the device takes for its kind. Each layer is also a texture of its own, `<path>#layer<n>`, for og.load.texture. Loading the same path again answers the same array."
497
+ doc "SpriteDesc.array (world and screen sprites), og.Sprite.array and 2D particle emitters (an emitter's `array` line) draw from its layers, one draw per array whatever layer each shows, with glow and the additive blend; an `array true` flipbook sheet cooks its frames into one (materials and terrain layers do not sample arrays yet). TextureArrayInfo and the frame's texture bytes report it. One in a streaming group's pack loads once its group is resident (refused before, naming the group); when the group unloads the renderer lets it go, og.render.sprite of it is refused and og.Sprite and particles of it draw nothing until the group is resident again, when it comes back under the same handle."
498
+ param world World "The world whose renderer owns the array."
499
+ param path String "The array's asset id, such as `tiles/ground.ogt`."
500
+ returns Result.TextureArrayInfo "Refused for a path not in the bundle (run og cook), not a texture array, or layers that do not agree."
501
+ }
502
+ ```
503
+
504
+ <sub>`api.ogt` line 3587</sub>
505
+
506
+ <a id="fn-skin"></a>
507
+
508
+ ### `og.load.skin`
509
+
510
+ Load a cooked UI skin (an `.ogt` of `type skin`: the atlas and its nine-slice frames, ornaments, palette, radii, type ramp, fonts, icons, motion and sounds; the grammar is og-ui's `skin` module) for UiDesc.skin. Its atlas, fonts, icons and sounds are loaded with it. Loaded once per path.
511
+
512
+ ```ts
513
+ og.load.skin(world: World, path: string): Result<Skin>
514
+ ```
515
+
516
+ | Parameter | Type | Optional | Doc |
517
+ |---|---|---|---|
518
+ | `world` | `World` | no | The world whose UI uses it. |
519
+ | `path` | `string` | no | The asset id, such as `skins/pixel/skin.ogt`. |
520
+
521
+ **Returns** `Result<Skin>`: Refused for a path not in the bundle, a skin that does not parse (the reason names the line) or an asset it names that cannot load.
522
+
523
+ Binding symbol `og_load_skin` · publish builds: kept
524
+
525
+ ```ogt
526
+ fn skin {
527
+ doc "Load a cooked UI skin (an `.ogt` of `type skin`: the atlas and its nine-slice frames, ornaments, palette, radii, type ramp, fonts, icons, motion and sounds; the grammar is og-ui's `skin` module) for UiDesc.skin. Its atlas, fonts, icons and sounds are loaded with it. Loaded once per path."
528
+ param world World "The world whose UI uses it."
529
+ param path String "The asset id, such as `skins/pixel/skin.ogt`."
530
+ returns Result.Skin "Refused for a path not in the bundle, a skin that does not parse (the reason names the line) or an asset it names that cannot load."
531
+ }
532
+ ```
533
+
534
+ <sub>`api.ogt` line 3595</sub>
535
+
536
+ <a id="fn-look"></a>
537
+
538
+ ### `og.load.look`
539
+
540
+ Load a look: an `.ogt` of `type look` binding a frame's art direction as data. Its top-level `name`, `extends` (a built-in preset's slug, such as `anime-cel-3d`, or another look's asset id: the game's own `assets/looks/<slug>.ogt` wins over the built-in preset of that slug), `skin` (a UI skin's asset id) and `antialias`, then one block per resource it sets (RenderSettings, PostEffects, Stylise, MaterialStyle, Fog, Sky, Environment) with that resource's fields by name, an asset id where a field is a handle (`lut "luts/warm.cube"`, `palette "palettes/dusk.hex"`). The cook validates every field against the resources' reflected schema and flattens `extends`, so the blob is the whole look. The textures, LUTs, palettes, environment map and skin it names are loaded with it. Loaded once per path.
541
+
542
+ ```ts
543
+ og.load.look(world: World, path: string): Result<Look>
544
+ ```
545
+
546
+ | Parameter | Type | Optional | Doc |
547
+ |---|---|---|---|
548
+ | `world` | `World` | no | The world whose renderer owns it. |
549
+ | `path` | `string` | no | The asset id, such as `looks/main.ogt`. |
550
+
551
+ **Returns** `Result<Look>`: Refused for a path not in the bundle (the reason says to run og cook) or an asset it names that cannot load.
552
+
553
+ Binding symbol `og_load_look` · publish builds: kept
554
+
555
+ ```ogt
556
+ fn look {
557
+ doc "Load a look: an `.ogt` of `type look` binding a frame's art direction as data. Its top-level `name`, `extends` (a built-in preset's slug, such as `anime-cel-3d`, or another look's asset id: the game's own `assets/looks/<slug>.ogt` wins over the built-in preset of that slug), `skin` (a UI skin's asset id) and `antialias`, then one block per resource it sets (RenderSettings, PostEffects, Stylise, MaterialStyle, Fog, Sky, Environment) with that resource's fields by name, an asset id where a field is a handle (`lut \"luts/warm.cube\"`, `palette \"palettes/dusk.hex\"`). The cook validates every field against the resources' reflected schema and flattens `extends`, so the blob is the whole look. The textures, LUTs, palettes, environment map and skin it names are loaded with it. Loaded once per path."
558
+ param world World "The world whose renderer owns it."
559
+ param path String "The asset id, such as `looks/main.ogt`."
560
+ returns Result.Look "Refused for a path not in the bundle (the reason says to run og cook) or an asset it names that cannot load."
561
+ }
562
+ ```
563
+
564
+ <sub>`api.ogt` line 3602</sub>
565
+
566
+ <a id="fn-lookInfo"></a>
567
+
568
+ ### `og.load.lookInfo`
569
+
570
+ What a loaded look holds and sets.
571
+
572
+ ```ts
573
+ og.load.lookInfo(world: World, look: Look): Result<LookInfo>
574
+ ```
575
+
576
+ | Parameter | Type | Optional | Doc |
577
+ |---|---|---|---|
578
+ | `world` | `World` | no | The world that owns the look. |
579
+ | `look` | `Look` | no | The look. |
580
+
581
+ **Returns** `Result<LookInfo>`: Refused for a look not loaded in this world.
582
+
583
+ Binding symbol `og_load_look_info` · publish builds: kept
584
+
585
+ ```ogt
586
+ fn lookInfo {
587
+ doc "What a loaded look holds and sets."
588
+ param world World "The world that owns the look."
589
+ param look Look "The look."
590
+ returns Result.LookInfo "Refused for a look not loaded in this world."
591
+ }
592
+ ```
593
+
594
+ <sub>`api.ogt` line 3609</sub>
595
+
596
+ <a id="fn-palette"></a>
597
+
598
+ ### `og.load.palette`
599
+
600
+ A colour palette for Stylise.palette, from a cooked `.hex` (one RRGGBB per line, as palette sites publish them) or GIMP `.gpl` file: up to 256 sRGB colours, in file order. Loaded once per path. One in a streaming group's pack loads once its group is resident; while the group is unloaded Stylise.palette quantises to no palette, and the palette comes back under the same handle.
601
+
602
+ ```ts
603
+ og.load.palette(world: World, path: string): Result<Palette>
604
+ ```
605
+
606
+ | Parameter | Type | Optional | Doc |
607
+ |---|---|---|---|
608
+ | `world` | `World` | no | The world whose renderer owns it. |
609
+ | `path` | `string` | no | The asset id, such as `palettes/dusk.hex`. |
610
+
611
+ **Returns** `Result<Palette>`: Refused for a path not in the bundle (the reason says to run og cook).
612
+
613
+ Binding symbol `og_load_palette` · publish builds: kept
614
+
615
+ ```ogt
616
+ fn palette {
617
+ doc "A colour palette for Stylise.palette, from a cooked `.hex` (one RRGGBB per line, as palette sites publish them) or GIMP `.gpl` file: up to 256 sRGB colours, in file order. Loaded once per path. One in a streaming group's pack loads once its group is resident; while the group is unloaded Stylise.palette quantises to no palette, and the palette comes back under the same handle."
618
+ param world World "The world whose renderer owns it."
619
+ param path String "The asset id, such as `palettes/dusk.hex`."
620
+ returns Result.Palette "Refused for a path not in the bundle (the reason says to run og cook)."
621
+ }
622
+ ```
623
+
624
+ <sub>`api.ogt` line 3616</sub>
625
+
626
+ <a id="fn-soundInfo"></a>
627
+
628
+ ### `og.load.soundInfo`
629
+
630
+ A loaded sound's format and length.
631
+
632
+ ```ts
633
+ og.load.soundInfo(world: World, sound: Sound): Result<SoundInfo>
634
+ ```
635
+
636
+ | Parameter | Type | Optional | Doc |
637
+ |---|---|---|---|
638
+ | `world` | `World` | no | The world that owns the sound. |
639
+ | `sound` | `Sound` | no | The sound. |
640
+
641
+ **Returns** `Result<SoundInfo>`: Refused for a dead sound.
642
+
643
+ Binding symbol `og_load_sound_info` · publish builds: kept
644
+
645
+ ```ogt
646
+ fn soundInfo {
647
+ doc "A loaded sound's format and length."
648
+ param world World "The world that owns the sound."
649
+ param sound Sound "The sound."
650
+ returns Result.SoundInfo "Refused for a dead sound."
651
+ }
652
+ ```
653
+
654
+ <sub>`api.ogt` line 3623</sub>
655
+
656
+ <a id="fn-status"></a>
657
+
658
+ ### `og.load.status`
659
+
660
+ Where a load is.
661
+
662
+ ```ts
663
+ og.load.status(world: World, asset: Asset): LoadStatus
664
+ ```
665
+
666
+ | Parameter | Type | Optional | Doc |
667
+ |---|---|---|---|
668
+ | `world` | `World` | no | The world that owns the asset. |
669
+ | `asset` | `Asset` | no | The handle. |
670
+
671
+ **Returns** `LoadStatus`.
672
+
673
+ Binding symbol `og_load_status` · publish builds: kept
674
+
675
+ ```ogt
676
+ fn status {
677
+ doc "Where a load is."
678
+ param world World "The world that owns the asset."
679
+ param asset Asset "The handle."
680
+ returns LoadStatus
681
+ }
682
+ ```
683
+
684
+ <sub>`api.ogt` line 3630</sub>
685
+
686
+ <a id="fn-error"></a>
687
+
688
+ ### `og.load.error`
689
+
690
+ Why a load failed.
691
+
692
+ ```ts
693
+ og.load.error(world: World, asset: Asset): string | null
694
+ ```
695
+
696
+ | Parameter | Type | Optional | Doc |
697
+ |---|---|---|---|
698
+ | `world` | `World` | no | The world that owns the asset. |
699
+ | `asset` | `Asset` | no | The handle. |
700
+
701
+ **Returns** `string | null`: The reason, naming the fix; null unless the load failed.
702
+
703
+ Binding symbol `og_load_error` · publish builds: kept
704
+
705
+ ```ogt
706
+ fn error {
707
+ doc "Why a load failed."
708
+ param world World "The world that owns the asset."
709
+ param asset Asset "The handle."
710
+ returns Option.String "The reason, naming the fix; null unless the load failed."
711
+ }
712
+ ```
713
+
714
+ <sub>`api.ogt` line 3637</sub>
715
+
716
+ <a id="fn-gltfInfo"></a>
717
+
718
+ ### `og.load.gltfInfo`
719
+
720
+ What a ready glTF holds.
721
+
722
+ ```ts
723
+ og.load.gltfInfo(world: World, asset: Asset): Result<GltfInfo>
724
+ ```
725
+
726
+ | Parameter | Type | Optional | Doc |
727
+ |---|---|---|---|
728
+ | `world` | `World` | no | The world that owns the asset. |
729
+ | `asset` | `Asset` | no | A ready glTF handle. |
730
+
731
+ **Returns** `Result<GltfInfo>`: Refused for a pending, failed or non-glTF asset.
732
+
733
+ Binding symbol `og_load_gltf_info` · publish builds: kept
734
+
735
+ ```ogt
736
+ fn gltfInfo {
737
+ doc "What a ready glTF holds."
738
+ param world World "The world that owns the asset."
739
+ param asset Asset "A ready glTF handle."
740
+ returns Result.GltfInfo "Refused for a pending, failed or non-glTF asset."
741
+ }
742
+ ```
743
+
744
+ <sub>`api.ogt` line 3644</sub>
745
+
746
+ <a id="fn-animation"></a>
747
+
748
+ ### `og.load.animation`
749
+
750
+ Load a cooked glTF's animation (its `<model>#anim` blob: the rig, the clips, the skin and morph streams) and register its skeleton and clips with og.anim. Loading the same model again answers the same handles.
751
+
752
+ Clips are cooked as f32 samples, or with `animation { compress true tolerance 0.0001 }` in the model's import settings as quantised keys (rotations as 48-bit smallest-three, translations, scales and weights as 16 bits over each channel's range) with every frame dropped that interpolation rebuilds within the tolerance; either way every frame is rebuilt here and the clip plays as f32. Morph targets are cooked sparse (the vertices each moves).
753
+
754
+ ```ts
755
+ og.load.animation(world: World, path: string): Result<Animation>
756
+ ```
757
+
758
+ | Parameter | Type | Optional | Doc |
759
+ |---|---|---|---|
760
+ | `world` | `World` | no | The world whose animation owns the assets. |
761
+ | `path` | `string` | no | The model's asset id, such as `models/walker.glb` (a `#anim` suffix is accepted). |
762
+
763
+ **Returns** `Result<Animation>`: Refused for an uncooked path, a model the cook wrote no `#anim` blob for (no skins, clips or morph targets), a cook stamp mismatch or an invalid rig.
764
+
765
+ Binding symbol `og_load_animation` · publish builds: kept
766
+
767
+ ```ogt
768
+ fn animation {
769
+ doc "Load a cooked glTF's animation (its `<model>#anim` blob: the rig, the clips, the skin and morph streams) and register its skeleton and clips with og.anim. Loading the same model again answers the same handles."
770
+ doc "Clips are cooked as f32 samples, or with `animation { compress true tolerance 0.0001 }` in the model's import settings as quantised keys (rotations as 48-bit smallest-three, translations, scales and weights as 16 bits over each channel's range) with every frame dropped that interpolation rebuilds within the tolerance; either way every frame is rebuilt here and the clip plays as f32. Morph targets are cooked sparse (the vertices each moves)."
771
+ param world World "The world whose animation owns the assets."
772
+ param path String "The model's asset id, such as `models/walker.glb` (a `#anim` suffix is accepted)."
773
+ returns Result.Animation "Refused for an uncooked path, a model the cook wrote no `#anim` blob for (no skins, clips or morph targets), a cook stamp mismatch or an invalid rig."
774
+ }
775
+ ```
776
+
777
+ <sub>`api.ogt` line 3651</sub>
778
+
779
+ <a id="fn-rig"></a>
780
+
781
+ ### `og.load.rig`
782
+
783
+ Load a cooked humanoid map (an `.ogt` of `type rig`: a naming scheme and bones named outright) for og.anim.retarget and og.anim.humanoid. Loading the same path again answers the same handle.
784
+
785
+ ```ts
786
+ og.load.rig(world: World, path: string): Result<Rig>
787
+ ```
788
+
789
+ | Parameter | Type | Optional | Doc |
790
+ |---|---|---|---|
791
+ | `world` | `World` | no | The world whose animation uses it. |
792
+ | `path` | `string` | no | The rig's asset id, such as `rigs/strider.ogt`. |
793
+
794
+ **Returns** `Result<Rig>`: Refused for a path not in the bundle (run og cook) or a cook stamp mismatch.
795
+
796
+ Binding symbol `og_load_rig` · publish builds: kept
797
+
798
+ ```ogt
799
+ fn rig {
800
+ doc "Load a cooked humanoid map (an `.ogt` of `type rig`: a naming scheme and bones named outright) for og.anim.retarget and og.anim.humanoid. Loading the same path again answers the same handle."
801
+ param world World "The world whose animation uses it."
802
+ param path String "The rig's asset id, such as `rigs/strider.ogt`."
803
+ returns Result.Rig "Refused for a path not in the bundle (run og cook) or a cook stamp mismatch."
804
+ }
805
+ ```
806
+
807
+ <sub>`api.ogt` line 3659</sub>
808
+
809
+ <a id="fn-flipbook"></a>
810
+
811
+ ### `og.load.flipbook`
812
+
813
+ Load a cooked flipbook sheet (an `.ogt` of `type flipbook`, with its Aseprite or TexturePacker atlas resolved by the cook) and its texture, and register it with og.flipbook. A sheet with `array true` is cooked into a texture array instead (its frames, one size, cut out of the texture as layers): its sprites draw frame n as layer n, every sprite of the sheet one draw whichever frame each shows, and FlipbookInfo.array names the array. A sheet in a streaming group (its array and layers with it) loads once its group is resident (refused naming the group before), and its sprites draw nothing while the group is away. Loading the same path again answers the same handles.
814
+
815
+ ```ts
816
+ og.load.flipbook(world: World, path: string): Result<FlipbookInfo>
817
+ ```
818
+
819
+ | Parameter | Type | Optional | Doc |
820
+ |---|---|---|---|
821
+ | `world` | `World` | no | The world whose animation and renderer own it. |
822
+ | `path` | `string` | no | The sheet's asset id, such as `sprites/hero.ogt`. |
823
+
824
+ **Returns** `Result<FlipbookInfo>`: Refused for a path not in the bundle (run og cook) or a texture it cannot load.
825
+
826
+ Binding symbol `og_load_flipbook` · publish builds: kept
827
+
828
+ ```ogt
829
+ fn flipbook {
830
+ doc "Load a cooked flipbook sheet (an `.ogt` of `type flipbook`, with its Aseprite or TexturePacker atlas resolved by the cook) and its texture, and register it with og.flipbook. A sheet with `array true` is cooked into a texture array instead (its frames, one size, cut out of the texture as layers): its sprites draw frame n as layer n, every sprite of the sheet one draw whichever frame each shows, and FlipbookInfo.array names the array. A sheet in a streaming group (its array and layers with it) loads once its group is resident (refused naming the group before), and its sprites draw nothing while the group is away. Loading the same path again answers the same handles."
831
+ param world World "The world whose animation and renderer own it."
832
+ param path String "The sheet's asset id, such as `sprites/hero.ogt`."
833
+ returns Result.FlipbookInfo "Refused for a path not in the bundle (run og cook) or a texture it cannot load."
834
+ }
835
+ ```
836
+
837
+ <sub>`api.ogt` line 3666</sub>
838
+
839
+ <a id="fn-tilemap"></a>
840
+
841
+ ### `og.load.tilemap`
842
+
843
+ Load a cooked map (a tilemap `.ogt`, a Tiled `.tmj` or an LDtk `.ldtk`), its tilesets and their textures. Loading the same path again answers the same handles.
844
+
845
+ ```ts
846
+ og.load.tilemap(world: World, path: string): Result<TilemapInfo>
847
+ ```
848
+
849
+ | Parameter | Type | Optional | Doc |
850
+ |---|---|---|---|
851
+ | `world` | `World` | no | The world whose renderer and tilemaps own it. |
852
+ | `path` | `string` | no | The map's asset id, such as `maps/room.tmj`. |
853
+
854
+ **Returns** `Result<TilemapInfo>`: Refused for a path not in the bundle, a missing tileset or texture, or a terrain its tileset lacks.
855
+
856
+ Binding symbol `og_load_tilemap` · publish builds: kept
857
+
858
+ ```ogt
859
+ fn tilemap {
860
+ doc "Load a cooked map (a tilemap `.ogt`, a Tiled `.tmj` or an LDtk `.ldtk`), its tilesets and their textures. Loading the same path again answers the same handles."
861
+ param world World "The world whose renderer and tilemaps own it."
862
+ param path String "The map's asset id, such as `maps/room.tmj`."
863
+ returns Result.TilemapInfo "Refused for a path not in the bundle, a missing tileset or texture, or a terrain its tileset lacks."
864
+ }
865
+ ```
866
+
867
+ <sub>`api.ogt` line 3673</sub>
868
+
869
+ ## Components, resources and events
870
+
871
+ <a id="record-Model"></a>
872
+
873
+ ### `og.Model` (component)
874
+
875
+ Draws a loaded glTF's default scene at the entity's world transform: every mesh node with its glTF material. Scene entities with a `model` line get one; world.instantiate of a glTF asset spawns one.
876
+
877
+ The glTF's materials are shared by every instance of it; `tint` and `flash` are this instance's own, carried with its transform to the lit shaders (one draw for every instance, whatever each shows), so one of a crowd can flash when struck.
878
+
879
+ Token `og.Model`, registered under the schema name `og.Model`; its value type is `Model`.
880
+
881
+ | Field | Type | Default | Range | Unit | Notes | Doc |
882
+ |---|---|---|---|---|---|---|
883
+ | `asset` | `Asset` | `0` | — | — | — | The glTF asset. |
884
+ | `tint` | `Color` | `{ r: 1, g: 1, b: 1 }` | — | — | — | A linear colour, 0 to 1 a channel, multiplied with every material's base colour on this instance only (white: as the glTF). |
885
+ | `flash` | `number` | `0` | 0 … 1 | — | tunable | A hit flash on this instance only: the lit colour mixed towards flashColor by this much (og.tween.flash fades it out). |
886
+ | `flashColor` | `Color` | `{ r: 1, g: 1, b: 1 }` | — | — | — | The flash's linear colour. |
887
+ | `castShadow` | `boolean` | `true` | — | — | — | Every mesh of the model casts shadows, as Mesh.castShadow: drawn into the sun's cascades and the shadowed lights' maps. On by default, unlike Mesh's (a loaded model casts, as it always has); false takes this instance out of every shadow pass. world.instantiate of a glTF and a scene's `model` line set it from the load's GltfDesc.castShadow, unless the scene gives the entity a `Model` table (whose castShadow is on unless it says false). |
888
+ | `receiveShadow` | `boolean` | `true` | — | — | — | Every mesh of the model receives shadows, as Mesh.receiveShadow; false lights this instance as if unshadowed by every light. On by default. Set as castShadow is, from GltfDesc.receiveShadow or the scene's `Model` table. |
889
+ | `visible` | `boolean` | `true` | — | — | — | Whether it is drawn, as Mesh.visible: false skips every draw of this instance (its meshes, its shadows) while it keeps its transform, its animation and its physics, so a ghost car or a pickup waiting to respawn is hidden without moving it away. |
890
+
891
+ ```ogt
892
+ component Model {
893
+ doc "Draws a loaded glTF's default scene at the entity's world transform: every mesh node with its glTF material. Scene entities with a `model` line get one; world.instantiate of a glTF asset spawns one."
894
+ doc "The glTF's materials are shared by every instance of it; `tint` and `flash` are this instance's own, carried with its transform to the lit shaders (one draw for every instance, whatever each shows), so one of a crowd can flash when struck."
895
+ field asset Asset "The glTF asset."
896
+ field tint Color "A linear colour, 0 to 1 a channel, multiplied with every material's base colour on this instance only (white: as the glTF)." {
897
+ default 1 1 1
898
+ }
899
+ field flash f32 "A hit flash on this instance only: the lit colour mixed towards flashColor by this much (og.tween.flash fades it out)." {
900
+ min 0
901
+ max 1
902
+ tunable true
903
+ }
904
+ field flashColor Color "The flash's linear colour." {
905
+ default 1 1 1
906
+ }
907
+ field castShadow bool "Every mesh of the model casts shadows, as Mesh.castShadow: drawn into the sun's cascades and the shadowed lights' maps. On by default, unlike Mesh's (a loaded model casts, as it always has); false takes this instance out of every shadow pass. world.instantiate of a glTF and a scene's `model` line set it from the load's GltfDesc.castShadow, unless the scene gives the entity a `Model` table (whose castShadow is on unless it says false)." {
908
+ default true
909
+ }
910
+ field receiveShadow bool "Every mesh of the model receives shadows, as Mesh.receiveShadow; false lights this instance as if unshadowed by every light. On by default. Set as castShadow is, from GltfDesc.receiveShadow or the scene's `Model` table." {
911
+ default true
912
+ }
913
+ field visible bool "Whether it is drawn, as Mesh.visible: false skips every draw of this instance (its meshes, its shadows) while it keeps its transform, its animation and its physics, so a ghost car or a pickup waiting to respawn is hidden without moving it away." {
914
+ default true
915
+ }
916
+ }
917
+ ```
918
+
919
+ <sub>`api.ogt` line 3467</sub>
920
+
921
+ <a id="record-AssetReady"></a>
922
+
923
+ ### `og.AssetReady` (event)
924
+
925
+ A load completed.
926
+
927
+ Token `og.AssetReady`, registered under the schema name `og.AssetReady`; its value type is `AssetReady`.
928
+
929
+ | Field | Type | Default | Range | Unit | Notes | Doc |
930
+ |---|---|---|---|---|---|---|
931
+ | `asset` | `Asset` | `0` | — | — | — | The handle. |
932
+ | `path` | `string` | `""` | — | — | — | The path it was loaded from. |
933
+
934
+ ```ogt
935
+ event AssetReady {
936
+ doc "A load completed."
937
+ field asset Asset "The handle."
938
+ field path String "The path it was loaded from."
939
+ }
940
+ ```
941
+
942
+ <sub>`api.ogt` line 3680</sub>
943
+
944
+ <a id="record-AssetFailed"></a>
945
+
946
+ ### `og.AssetFailed` (event)
947
+
948
+ A load failed.
949
+
950
+ Token `og.AssetFailed`, registered under the schema name `og.AssetFailed`; its value type is `AssetFailed`.
951
+
952
+ | Field | Type | Default | Range | Unit | Notes | Doc |
953
+ |---|---|---|---|---|---|---|
954
+ | `asset` | `Asset` | `0` | — | — | — | The handle. |
955
+ | `path` | `string` | `""` | — | — | — | The path it was loaded from. |
956
+ | `reason` | `string` | `""` | — | — | — | Why, naming the fix. |
957
+
958
+ ```ogt
959
+ event AssetFailed {
960
+ doc "A load failed."
961
+ field asset Asset "The handle."
962
+ field path String "The path it was loaded from."
963
+ field reason String "Why, naming the fix."
964
+ }
965
+ ```
966
+
967
+ <sub>`api.ogt` line 3686</sub>
968
+
969
+ ## Types
970
+
971
+ <a id="type-Asset"></a>
972
+
973
+ ### `Asset` (handle)
974
+
975
+ A loaded bundle, scene or glTF asset.
976
+
977
+ A generational handle: a number the engine hands out. A dead handle is an error value, never a crash.
978
+
979
+ ```ogt
980
+ handle Asset "A loaded bundle, scene or glTF asset."
981
+ ```
982
+
983
+ <sub>`api.ogt` line 3370</sub>
984
+
985
+ <a id="type-Font"></a>
986
+
987
+ ### `Font` (handle)
988
+
989
+ A cooked MSDF font: its glyph table and one or more atlas pages.
990
+
991
+ A generational handle: a number the engine hands out. A dead handle is an error value, never a crash.
992
+
993
+ ```ogt
994
+ handle Font "A cooked MSDF font: its glyph table and one or more atlas pages."
995
+ ```
996
+
997
+ <sub>`api.ogt` line 3371</sub>
998
+
999
+ <a id="type-Sound"></a>
1000
+
1001
+ ### `Sound` (handle)
1002
+
1003
+ A cooked sound: QOA-encoded PCM the audio module plays.
1004
+
1005
+ A generational handle: a number the engine hands out. A dead handle is an error value, never a crash.
1006
+
1007
+ ```ogt
1008
+ handle Sound "A cooked sound: QOA-encoded PCM the audio module plays."
1009
+ ```
1010
+
1011
+ <sub>`api.ogt` line 3372</sub>
1012
+
1013
+ <a id="type-Skin"></a>
1014
+
1015
+ ### `Skin` (handle)
1016
+
1017
+ A cooked UI skin: its atlas, fonts, icons and sounds loaded with it, for og.ui.configure.
1018
+
1019
+ A generational handle: a number the engine hands out. A dead handle is an error value, never a crash.
1020
+
1021
+ ```ogt
1022
+ handle Skin "A cooked UI skin: its atlas, fonts, icons and sounds loaded with it, for og.ui.configure."
1023
+ ```
1024
+
1025
+ <sub>`api.ogt` line 3373</sub>
1026
+
1027
+ <a id="type-TextureArray"></a>
1028
+
1029
+ ### `TextureArray` (handle)
1030
+
1031
+ A cooked texture array: same-sized layers uploaded as one 2D-array texture (og.load.textureArray).
1032
+
1033
+ A generational handle: a number the engine hands out. A dead handle is an error value, never a crash.
1034
+
1035
+ ```ogt
1036
+ handle TextureArray "A cooked texture array: same-sized layers uploaded as one 2D-array texture (og.load.textureArray)."
1037
+ ```
1038
+
1039
+ <sub>`api.ogt` line 3374</sub>
1040
+
1041
+ <a id="type-LoadStatus"></a>
1042
+
1043
+ ### `LoadStatus` (enum)
1044
+
1045
+ Where a load is.
1046
+
1047
+ A string: one of the variants below. The zero value is `"pending"`.
1048
+
1049
+ | Variant | Doc |
1050
+ |---|---|
1051
+ | `"pending"` | Still loading. |
1052
+ | `"ready"` | Loaded; it can be instantiated. |
1053
+ | `"failed"` | Failed; og.load.error gives the reason. |
1054
+
1055
+ ```ogt
1056
+ enum LoadStatus {
1057
+ doc "Where a load is."
1058
+ variant pending "Still loading."
1059
+ variant ready "Loaded; it can be instantiated."
1060
+ variant failed "Failed; og.load.error gives the reason."
1061
+ }
1062
+ ```
1063
+
1064
+ <sub>`api.ogt` line 3397</sub>
1065
+
1066
+ <a id="type-GltfDesc"></a>
1067
+
1068
+ ### `GltfDesc` (desc struct)
1069
+
1070
+ How to load a glTF, as three.js GLTFLoader options where they apply.
1071
+
1072
+ A desc: every field may be omitted and takes its default; `{}` is valid.
1073
+
1074
+ | Field | Type | Default | Range | Unit | Notes | Doc |
1075
+ |---|---|---|---|---|---|---|
1076
+ | `scene` | `number` | `0` | — | — | — | Which glTF scene to instantiate. |
1077
+ | `castShadow` | `boolean` | `true` | — | — | — | Whether the models instantiated from it cast shadows: world.instantiate of the handle and a scene's `model` line give their og.Model this castShadow. On when omitted, so a model loaded without a desc casts as it always has; false turns it off for the model (og.Model.castShadow turns it off for one instance). The flags belong to the asset: another og.load.gltf of the same path answers the same handle and sets them again, for the models instantiated after it. |
1078
+ | `receiveShadow` | `boolean` | `true` | — | — | — | Whether the models instantiated from it receive shadows (og.Model.receiveShadow, as castShadow): on when omitted; false lights them as if unshadowed by every light. |
1079
+
1080
+ ```ogt
1081
+ struct GltfDesc {
1082
+ doc "How to load a glTF, as three.js GLTFLoader options where they apply."
1083
+ desc true
1084
+ field scene u32 "Which glTF scene to instantiate."
1085
+ field castShadow bool "Whether the models instantiated from it cast shadows: world.instantiate of the handle and a scene's `model` line give their og.Model this castShadow. On when omitted, so a model loaded without a desc casts as it always has; false turns it off for the model (og.Model.castShadow turns it off for one instance). The flags belong to the asset: another og.load.gltf of the same path answers the same handle and sets them again, for the models instantiated after it." {
1086
+ default true
1087
+ }
1088
+ field receiveShadow bool "Whether the models instantiated from it receive shadows (og.Model.receiveShadow, as castShadow): on when omitted; false lights them as if unshadowed by every light." {
1089
+ default true
1090
+ }
1091
+ }
1092
+ ```
1093
+
1094
+ <sub>`api.ogt` line 3404</sub>
1095
+
1096
+ <a id="type-GltfInfo"></a>
1097
+
1098
+ ### `GltfInfo` (struct)
1099
+
1100
+ What a loaded glTF holds.
1101
+
1102
+ | Field | Type | Default | Range | Unit | Notes | Doc |
1103
+ |---|---|---|---|---|---|---|
1104
+ | `scenes` | `number` | `0` | — | — | — | How many scenes it has. |
1105
+ | `geometries` | `readonly Geometry[]` | `[]` | — | — | — | Its geometries, in glTF mesh-primitive order. |
1106
+ | `materials` | `readonly Material[]` | `[]` | — | — | — | Its materials, in glTF order, then the default material. |
1107
+ | `animations` | `readonly string[]` | `[]` | — | — | — | Its clip names, in glTF order, from the model's `#anim` blob (empty for a model without clips): a skinned glTF's animations, an animated `.vox`'s `frames` or `voxClip` names. og.load.animation answers the same clips with their ClipAsset handles and durations, and og.anim.clip finds one by name. |
1108
+
1109
+ ```ogt
1110
+ struct GltfInfo {
1111
+ doc "What a loaded glTF holds."
1112
+ field scenes u32 "How many scenes it has."
1113
+ field geometries List.Geometry "Its geometries, in glTF mesh-primitive order."
1114
+ field materials List.Material "Its materials, in glTF order, then the default material."
1115
+ field animations List.String "Its clip names, in glTF order, from the model's `#anim` blob (empty for a model without clips): a skinned glTF's animations, an animated `.vox`'s `frames` or `voxClip` names. og.load.animation answers the same clips with their ClipAsset handles and durations, and og.anim.clip finds one by name."
1116
+ }
1117
+ ```
1118
+
1119
+ <sub>`api.ogt` line 3416</sub>
1120
+
1121
+ <a id="type-BundleInfo"></a>
1122
+
1123
+ ### `BundleInfo` (struct)
1124
+
1125
+ An open cooked bundle.
1126
+
1127
+ | Field | Type | Default | Range | Unit | Notes | Doc |
1128
+ |---|---|---|---|---|---|---|
1129
+ | `path` | `string` | `""` | — | — | — | The cooked directory it was opened from. |
1130
+ | `assets` | `number` | `0` | — | — | — | Source assets it holds. |
1131
+ | `outputs` | `number` | `0` | — | — | — | Cooked outputs (blobs) it holds. |
1132
+
1133
+ ```ogt
1134
+ struct BundleInfo {
1135
+ doc "An open cooked bundle."
1136
+ field path String "The cooked directory it was opened from."
1137
+ field assets u32 "Source assets it holds."
1138
+ field outputs u32 "Cooked outputs (blobs) it holds."
1139
+ }
1140
+ ```
1141
+
1142
+ <sub>`api.ogt` line 3424</sub>
1143
+
1144
+ <a id="type-FontInfo"></a>
1145
+
1146
+ ### `FontInfo` (struct)
1147
+
1148
+ A loaded font's metrics, in em units unless stated.
1149
+
1150
+ | Field | Type | Default | Range | Unit | Notes | Doc |
1151
+ |---|---|---|---|---|---|---|
1152
+ | `glyphs` | `number` | `0` | — | — | — | Glyphs cooked into it. |
1153
+ | `pages` | `number` | `0` | — | — | — | Atlas pages; the renderer draws one page per pass with one shared layout. |
1154
+ | `emPx` | `number` | `0` | — | — | — | Atlas pixels per em. |
1155
+ | `pxRange` | `number` | `0` | — | — | — | The distance range in atlas pixels. |
1156
+ | `ascender` | `number` | `0` | — | — | — | Ascender above the baseline. |
1157
+ | `descender` | `number` | `0` | — | — | — | Descender below the baseline (negative). |
1158
+ | `lineHeight` | `number` | `0` | — | — | — | Ascender minus descender plus the line gap. |
1159
+ | `icons` | `number` | `0` | — | — | — | The icons of an icon set (an `.ogt` of `type icons`, SVGs cooked like a font for UiDesc.icons.font); 0 for a text font. |
1160
+
1161
+ ```ogt
1162
+ struct FontInfo {
1163
+ doc "A loaded font's metrics, in em units unless stated."
1164
+ field glyphs u32 "Glyphs cooked into it."
1165
+ field pages u32 "Atlas pages; the renderer draws one page per pass with one shared layout."
1166
+ field emPx u32 "Atlas pixels per em."
1167
+ field pxRange f32 "The distance range in atlas pixels."
1168
+ field ascender f32 "Ascender above the baseline."
1169
+ field descender f32 "Descender below the baseline (negative)."
1170
+ field lineHeight f32 "Ascender minus descender plus the line gap."
1171
+ field icons u32 "The icons of an icon set (an `.ogt` of `type icons`, SVGs cooked like a font for UiDesc.icons.font); 0 for a text font."
1172
+ }
1173
+ ```
1174
+
1175
+ <sub>`api.ogt` line 3431</sub>
1176
+
1177
+ <a id="type-SoundInfo"></a>
1178
+
1179
+ ### `SoundInfo` (struct)
1180
+
1181
+ A loaded sound.
1182
+
1183
+ | Field | Type | Default | Range | Unit | Notes | Doc |
1184
+ |---|---|---|---|---|---|---|
1185
+ | `rate` | `number` | `0` | — | `hz` | — | Samples per second. |
1186
+ | `channels` | `number` | `0` | — | — | — | Interleaved channels. |
1187
+ | `frames` | `number` | `0` | — | — | — | Samples per channel. |
1188
+ | `seconds` | `number` | `0` | — | `s` | — | Its length. |
1189
+ | `chunks` | `number` | `0` | — | — | — | The chunks it was cooked in (`sound { stream true }` in its import settings, or a QOA file above 1 MiB), the first included; 0 when it was cooked whole. A chunked sound is never resident whole: the engine reads its chunks from about half a second behind each playhead to four seconds ahead (on the web, fetched like a streaming group's pack) and drops the rest. |
1190
+
1191
+ ```ogt
1192
+ struct SoundInfo {
1193
+ doc "A loaded sound."
1194
+ field rate u32 "Samples per second." {
1195
+ unit hz
1196
+ }
1197
+ field channels u32 "Interleaved channels."
1198
+ field frames u32 "Samples per channel."
1199
+ field seconds f32 "Its length." {
1200
+ unit s
1201
+ }
1202
+ field chunks u32 "The chunks it was cooked in (`sound { stream true }` in its import settings, or a QOA file above 1 MiB), the first included; 0 when it was cooked whole. A chunked sound is never resident whole: the engine reads its chunks from about half a second behind each playhead to four seconds ahead (on the web, fetched like a streaming group's pack) and drops the rest."
1203
+ }
1204
+ ```
1205
+
1206
+ <sub>`api.ogt` line 3443</sub>
1207
+
1208
+ <a id="type-TextureArrayInfo"></a>
1209
+
1210
+ ### `TextureArrayInfo` (struct)
1211
+
1212
+ What og.load.textureArray uploaded.
1213
+
1214
+ | Field | Type | Default | Range | Unit | Notes | Doc |
1215
+ |---|---|---|---|---|---|---|
1216
+ | `array` | `TextureArray` | `0` | — | — | — | The array. |
1217
+ | `width` | `number` | `0` | — | — | — | Each layer's width in texels. |
1218
+ | `height` | `number` | `0` | — | — | — | Each layer's height in texels. |
1219
+ | `layers` | `number` | `0` | — | — | — | Its layers, in the order the file lists them. |
1220
+ | `levels` | `number` | `0` | — | — | — | Mip levels of each layer. |
1221
+ | `format` | `string` | `""` | — | — | — | The encoding on the GPU: `rgba8`, or the block format the device takes for its kind (`bc7`, `bc5`, `astc4x4`, `etc2`, `eacrg11`). |
1222
+ | `bytes` | `number` | `0` | — | — | — | Bytes it takes on the GPU, every level of every layer (counted in the frame's texture bytes). |
1223
+
1224
+ ```ogt
1225
+ struct TextureArrayInfo {
1226
+ doc "What og.load.textureArray uploaded."
1227
+ field array TextureArray "The array."
1228
+ field width u32 "Each layer's width in texels."
1229
+ field height u32 "Each layer's height in texels."
1230
+ field layers u32 "Its layers, in the order the file lists them."
1231
+ field levels u32 "Mip levels of each layer."
1232
+ field format String "The encoding on the GPU: `rgba8`, or the block format the device takes for its kind (`bc7`, `bc5`, `astc4x4`, `etc2`, `eacrg11`)."
1233
+ field bytes f64 "Bytes it takes on the GPU, every level of every layer (counted in the frame's texture bytes)."
1234
+ }
1235
+ ```
1236
+
1237
+ <sub>`api.ogt` line 3456</sub>
1238
+
1239
+ ## Column kinds
1240
+
1241
+ Each is a factory, `TextureArray(value?, options?)`, that makes one field of a component or resource layout.
1242
+
1243
+ | Column | Value | Typed array | Stride | Doc |
1244
+ |---|---|---|---|---|
1245
+ | <a id="column-TextureArray"></a>`TextureArray` | `TextureArray` | `Uint32Array` | 2 | A TextureArray handle field (0 is none). |
1246
+ | <a id="column-Asset"></a>`Asset` | `Asset` | `Uint32Array` | 2 | An Asset handle field. |
1247
+ | <a id="column-Sound"></a>`Sound` | `Sound` | `Uint32Array` | 2 | A Sound handle field. |
1248
+
1249
+ ```ogt
1250
+ column TextureArray {
1251
+ doc "A TextureArray handle field (0 is none)."
1252
+ array Uint32Array
1253
+ stride 2
1254
+ value TextureArray
1255
+ }
1256
+ ```
1257
+
1258
+ <sub>`api.ogt` line 3376</sub>
1259
+
1260
+ ```ogt
1261
+ column Asset {
1262
+ doc "An Asset handle field."
1263
+ array Uint32Array
1264
+ stride 2
1265
+ value Asset
1266
+ }
1267
+ ```
1268
+
1269
+ <sub>`api.ogt` line 3383</sub>
1270
+
1271
+ ```ogt
1272
+ column Sound {
1273
+ doc "A Sound handle field."
1274
+ array Uint32Array
1275
+ stride 2
1276
+ value Sound
1277
+ }
1278
+ ```
1279
+
1280
+ <sub>`api.ogt` line 3390</sub>