@origingame/engine 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/og.mjs +1 -1
- package/dist/web/origin-engine.d.ts +255 -5
- package/dist/web/origin-engine.js +1584 -125
- package/dist/web/origin-engine_bg.wasm +0 -0
- package/dist/web/origin-engine_bg.wasm.d.ts +80 -3
- package/dist/web-publish/origin-engine-lanes.js +1288 -82
- package/dist/web-publish/origin-engine-lanes_bg.wasm +0 -0
- package/dist/web-publish/origin-engine.d.ts +199 -6
- package/dist/web-publish/origin-engine.js +1285 -79
- package/dist/web-publish/origin-engine_bg.wasm +0 -0
- package/dist/web-publish/origin-engine_bg.wasm.d.ts +65 -4
- package/dist/web-publish-2d/origin-engine-lanes.js +1285 -79
- package/dist/web-publish-2d/origin-engine-lanes_bg.wasm +0 -0
- package/dist/web-publish-2d/origin-engine.d.ts +198 -5
- package/dist/web-publish-2d/origin-engine.js +1282 -76
- package/dist/web-publish-2d/origin-engine_bg.wasm +0 -0
- package/dist/web-publish-2d/origin-engine_bg.wasm.d.ts +64 -3
- package/knowledge/README.md +2 -1
- package/knowledge/guides/three-to-og.md +393 -0
- package/knowledge/knowledge.json +2 -1
- package/knowledge/looks/catalogue.json +40 -40
- package/knowledge/package.json +3 -2
- package/knowledge/scaffold/distribution.json +14 -0
- package/knowledge/scaffold/origin-engine.json +2 -2
- package/knowledge/scaffold/template/README.md +2 -1
- package/knowledge/scaffold/template/assets/audio/sting.ogt +10 -0
- package/knowledge/scaffold/template/assets/timelines/intro.ogt +101 -0
- package/knowledge/scaffold/template/assets/timelines/narration.srt +11 -0
- package/knowledge/scaffold/template/host.d.ts +46 -0
- package/knowledge/scaffold/template/package.json +1 -1
- package/knowledge/scaffold/template/project.ogt +1 -1
- package/knowledge/scaffold/template/src/main.ts +1 -1
- package/knowledge/scaffold/template/tests/frames.ts +134 -0
- package/knowledge/scaffold/template/tests/intro.og.ts +65 -0
- package/knowledge/scaffold/template/tests/smoke.og.ts +30 -36
- package/knowledge/scaffold/template/tsconfig.json +1 -1
- package/knowledge/scripts/mount.ts +2 -1
- package/knowledge/scripts/validate.ts +159 -31
- package/knowledge/skills/og-audio/SKILL.md +2 -2
- package/knowledge/skills/og-build/SKILL.md +29 -7
- package/knowledge/skills/og-core/SKILL.md +31 -5
- package/knowledge/skills/og-feel/SKILL.md +2 -2
- package/knowledge/skills/og-game/SKILL.md +1331 -16
- package/knowledge/skills/og-i18n/SKILL.md +7 -7
- package/knowledge/skills/og-model/SKILL.md +374 -0
- package/knowledge/skills/og-platform-sdk/SKILL.md +2 -1
- package/knowledge/skills/og-taste/SKILL.md +82 -73
- package/knowledge/skills/og-ui/SKILL.md +80 -58
- package/knowledge/wiki/ai.md +20 -20
- package/knowledge/wiki/anim.md +392 -41
- package/knowledge/wiki/atmosphere.md +36 -13
- package/knowledge/wiki/audio.md +18 -18
- package/knowledge/wiki/camera.md +19 -13
- package/knowledge/wiki/commands.md +19 -13
- package/knowledge/wiki/debug.md +414 -0
- package/knowledge/wiki/game.md +8 -8
- package/knowledge/wiki/i18n.md +7 -7
- package/knowledge/wiki/index.md +317 -8
- package/knowledge/wiki/input.md +47 -47
- package/knowledge/wiki/load.md +238 -70
- package/knowledge/wiki/math.md +2607 -0
- package/knowledge/wiki/nav.md +34 -34
- package/knowledge/wiki/net.md +340 -0
- package/knowledge/wiki/path.md +402 -0
- package/knowledge/wiki/physics.md +95 -95
- package/knowledge/wiki/platform.md +463 -29
- package/knowledge/wiki/probe.md +681 -67
- package/knowledge/wiki/reflect.md +29 -17
- package/knowledge/wiki/render.md +4993 -1998
- package/knowledge/wiki/rng.md +14 -14
- package/knowledge/wiki/shapes.md +727 -0
- package/knowledge/wiki/stream.md +15 -15
- package/knowledge/wiki/system.md +8 -8
- package/knowledge/wiki/systems.md +2 -2
- package/knowledge/wiki/terrain.md +24 -20
- package/knowledge/wiki/tilemap.md +13 -13
- package/knowledge/wiki/time.md +4 -4
- package/knowledge/wiki/timeline.md +396 -0
- package/knowledge/wiki/transform.md +8 -8
- package/knowledge/wiki/tween.md +17 -17
- package/knowledge/wiki/ui.md +560 -654
- package/knowledge/wiki/video.md +157 -0
- package/knowledge/wiki/world.md +36 -36
- package/package.json +4 -3
- package/schema/api.schema.json +28151 -19640
- package/shell/page.ts +26 -2
- package/shell/platform.ts +51 -0
- package/shell/player.ts +15 -2
- package/shell/transport.ts +6 -0
- package/src/depth.ts +71 -0
- package/src/e6.ts +32 -1
- package/src/env.d.ts +5 -1
- package/src/generated/abi.ts +226 -4
- package/src/geom.ts +260 -0
- package/src/index.ts +32 -4
- package/src/light.ts +18 -0
- package/src/math.ts +622 -0
- package/src/node/index.ts +17 -0
- package/src/node/playtest-run.ts +115 -18
- package/src/node/polish.ts +13 -3
- package/src/node/render.ts +291 -0
- package/src/node/run.ts +86 -5
- package/src/p2.ts +19 -1
- package/src/platform-local.ts +2 -0
- package/src/playtest.ts +65 -4
- package/src/runtime.ts +100 -9
- package/src/targets.ts +28 -0
- package/src/trace.ts +169 -0
- package/src/ui-kit/huds.ts +34 -34
- package/src/ui-kit/menus.ts +12 -12
- package/src/ui-kit/settings.ts +11 -2
- package/src/ui-kit/store.ts +18 -18
- package/src/ui-kit/story.ts +6 -4
- package/src/ui-kit/util.ts +8 -8
- package/src/web/shell.ts +59 -1
- package/src/web/worker.ts +105 -4
- package/types/bindings.json +9368 -6619
- package/types/index.d.ts +16377 -11520
package/knowledge/wiki/load.md
CHANGED
|
@@ -18,7 +18,7 @@ module load {
|
|
|
18
18
|
# declarations follow, each quoted below
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
<sub>`api.ogt` line
|
|
21
|
+
<sub>`api.ogt` line 5386</sub>
|
|
22
22
|
|
|
23
23
|
## Contents
|
|
24
24
|
|
|
@@ -27,7 +27,7 @@ module load {
|
|
|
27
27
|
| [`Asset`](#type-Asset) | handle | A loaded bundle, scene or glTF asset. |
|
|
28
28
|
| [`Font`](#type-Font) | handle | A cooked MSDF font: its glyph table and one or more atlas pages. |
|
|
29
29
|
| [`Sound`](#type-Sound) | handle | A cooked sound: QOA-encoded PCM the audio module plays. |
|
|
30
|
-
| [`
|
|
30
|
+
| [`Style`](#type-Style) | handle | A cooked UI style: its values, atlas, fonts, icons and sounds loaded with it, for og.ui.configure. |
|
|
31
31
|
| [`TextureArray`](#type-TextureArray) | handle | A cooked texture array: same-sized layers uploaded as one 2D-array texture (og.load.textureArray). |
|
|
32
32
|
| [`TextureArray()`](#column-TextureArray) | column kind | A TextureArray handle field (0 is none). |
|
|
33
33
|
| [`Asset()`](#column-Asset) | column kind | An Asset handle field. |
|
|
@@ -51,11 +51,12 @@ module load {
|
|
|
51
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
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
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. |
|
|
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). `mode hooks` (the default) defines hooks of the lit shader; `mode full lit` or `mode full unlit` defines `fn vertex(v: VertexInput, model: mat4x4<f32>, p: Params) -> VertexOutput` and `fn fragment(f: FragmentInput, p: Params) -> SurfaceOutput` over the binding contract (camera(), the model with its skin, Params, tex0 to tex7 for the material's eight texture slots; the og-game skill's Full custom shaders section), lit by the frame's lights or drawn as returned, the prepass and every shadow pass drawn through the same entries. Loaded once per path. |
|
|
55
|
+
| [`og.load.post`](#fn-post) | function | A custom post pass for PostEffects.custom, from a cooked `.ogt` of `type post`: `code` or `source` (a `.wgsl` beside it) defining `fn post(f: PostInput, p: Params) -> vec4<f32>` and `param <name> float\|vec2\|vec3\|vec4\|color <default...>` lines (at most eight). The function reads previous(uv), scene_color(uv), depth(uv), normal(uv) and f.uv, f.pixel, f.size, f.time, and returns linear HDR colour (the og-game skill's Custom post passes section has the contract). The cook compiles it for every back end. Loaded once per path. |
|
|
55
56
|
| [`og.load.texture`](#fn-texture) | function | Load a cooked texture for og.render.sprite and og.ui.image, as three.js TextureLoader.load. |
|
|
56
57
|
| [`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.
|
|
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), `
|
|
58
|
+
| [`og.load.style`](#fn-style) | function | Load a cooked UI style (an `.ogt` of `type style`: every palette role, the radii, type ramp, durations, and its art: the atlas and its nine-slice frames, ornaments, fonts, icons, motion and sounds; the grammar is og-ui's `parse_style`) for UiDesc.style. Its atlas, fonts, icons and sounds are loaded with it. Loaded once per path. A built-in style a look names is in the bundle as `@styles/<name>/style.ogt`. |
|
|
59
|
+
| [`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), `ui` (a UI style: a built-in style's slug, such as `cartoon`, or the game's own style file'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 UI style it names are loaded with it. Loaded once per path. |
|
|
59
60
|
| [`og.load.lookInfo`](#fn-lookInfo) | function | What a loaded look holds and sets. |
|
|
60
61
|
| [`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
62
|
| [`og.load.soundInfo`](#fn-soundInfo) | function | A loaded sound's format and length. |
|
|
@@ -66,6 +67,10 @@ module load {
|
|
|
66
67
|
| [`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
68
|
| [`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
69
|
| [`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. |
|
|
70
|
+
| [`og.load.video`](#fn-video) | function | Load cooked footage (an `.ogt` of `type video`: `source` an .mp4, .webm or .mov beside it or under assets/, `fps`, `maxSeconds`, `size W H`, `kind color\|pixel`, `audio`), which og cook turns with ffmpeg into a texture array of its frames and its sound track. Uploads the frames as one 2D-array texture and makes the video's Texture (VideoInfo.texture), which shows the frame its og.VideoPlayer is at: a material map, an og.Sprite or a UI image draws it like any texture. Load it in GameDesc.start (every process of an og render --jobs run loads it the same way, so its handles agree). Loading the same path again answers the same handles. |
|
|
71
|
+
| [`og.load.videoInfo`](#fn-videoInfo) | function | A loaded video's size, frames, rate, length, texture and sound. |
|
|
72
|
+
| [`og.load.timeline`](#fn-timeline) | function | Load a timeline: an `.ogt` of `type timeline` (the og.timeline module's file: duration, paths and tracks of keys), cooked with its caption files imported. Loaded once per path; play it with an og.Timeline whose asset is the handle, or `timeline:play:<name>` on the command channel. |
|
|
73
|
+
| [`og.load.rig2d`](#fn-rig2d) | function | Load a cooked 2D rig (an `.ogt` of `type rig2d`, written by hand or imported by the cook from DragonBones JSON) and its texture, and register it with og.skeleton2d. Loading the same path again answers the same handles. |
|
|
69
74
|
| [`og.AssetReady`](#record-AssetReady) | event | A load completed. |
|
|
70
75
|
| [`og.AssetFailed`](#record-AssetFailed) | event | A load failed. |
|
|
71
76
|
|
|
@@ -99,7 +104,7 @@ fn bundle {
|
|
|
99
104
|
}
|
|
100
105
|
```
|
|
101
106
|
|
|
102
|
-
<sub>`api.ogt` line
|
|
107
|
+
<sub>`api.ogt` line 5525</sub>
|
|
103
108
|
|
|
104
109
|
<a id="fn-bundleInfo"></a>
|
|
105
110
|
|
|
@@ -129,7 +134,7 @@ fn bundleInfo {
|
|
|
129
134
|
}
|
|
130
135
|
```
|
|
131
136
|
|
|
132
|
-
<sub>`api.ogt` line
|
|
137
|
+
<sub>`api.ogt` line 5532</sub>
|
|
133
138
|
|
|
134
139
|
<a id="fn-defaultBundle"></a>
|
|
135
140
|
|
|
@@ -157,7 +162,7 @@ fn defaultBundle {
|
|
|
157
162
|
}
|
|
158
163
|
```
|
|
159
164
|
|
|
160
|
-
<sub>`api.ogt` line
|
|
165
|
+
<sub>`api.ogt` line 5539</sub>
|
|
161
166
|
|
|
162
167
|
<a id="fn-gltf"></a>
|
|
163
168
|
|
|
@@ -165,7 +170,7 @@ fn defaultBundle {
|
|
|
165
170
|
|
|
166
171
|
Load a cooked glTF (.gltf or .glb), as three.js GLTFLoader.load: its meshes, materials and textures join the renderer once.
|
|
167
172
|
|
|
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).
|
|
173
|
+
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 the file's playback range, else of every frame); a node's `_loop` repeats its keys as the editor plays them.
|
|
169
174
|
|
|
170
175
|
```ts
|
|
171
176
|
og.load.gltf(world: World, path: string, desc?: GltfDesc): Result<Asset>
|
|
@@ -184,7 +189,7 @@ Binding symbol `og_load_gltf` · publish builds: kept
|
|
|
184
189
|
```ogt
|
|
185
190
|
fn gltf {
|
|
186
191
|
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)."
|
|
192
|
+
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 the file's playback range, else of every frame); a node's `_loop` repeats its keys as the editor plays them."
|
|
188
193
|
param world World "The world that owns the asset."
|
|
189
194
|
param path String "The asset id, such as `models/ship.glb`."
|
|
190
195
|
param desc GltfDesc "Scene and shadow options."
|
|
@@ -192,7 +197,7 @@ fn gltf {
|
|
|
192
197
|
}
|
|
193
198
|
```
|
|
194
199
|
|
|
195
|
-
<sub>`api.ogt` line
|
|
200
|
+
<sub>`api.ogt` line 5545</sub>
|
|
196
201
|
|
|
197
202
|
<a id="fn-scene"></a>
|
|
198
203
|
|
|
@@ -222,7 +227,7 @@ fn scene {
|
|
|
222
227
|
}
|
|
223
228
|
```
|
|
224
229
|
|
|
225
|
-
<sub>`api.ogt` line
|
|
230
|
+
<sub>`api.ogt` line 5554</sub>
|
|
226
231
|
|
|
227
232
|
<a id="fn-font"></a>
|
|
228
233
|
|
|
@@ -252,7 +257,7 @@ fn font {
|
|
|
252
257
|
}
|
|
253
258
|
```
|
|
254
259
|
|
|
255
|
-
<sub>`api.ogt` line
|
|
260
|
+
<sub>`api.ogt` line 5561</sub>
|
|
256
261
|
|
|
257
262
|
<a id="fn-fontInfo"></a>
|
|
258
263
|
|
|
@@ -282,7 +287,7 @@ fn fontInfo {
|
|
|
282
287
|
}
|
|
283
288
|
```
|
|
284
289
|
|
|
285
|
-
<sub>`api.ogt` line
|
|
290
|
+
<sub>`api.ogt` line 5568</sub>
|
|
286
291
|
|
|
287
292
|
<a id="fn-sound"></a>
|
|
288
293
|
|
|
@@ -315,7 +320,7 @@ fn sound {
|
|
|
315
320
|
}
|
|
316
321
|
```
|
|
317
322
|
|
|
318
|
-
<sub>`api.ogt` line
|
|
323
|
+
<sub>`api.ogt` line 5575</sub>
|
|
319
324
|
|
|
320
325
|
<a id="fn-lut"></a>
|
|
321
326
|
|
|
@@ -345,7 +350,7 @@ fn lut {
|
|
|
345
350
|
}
|
|
346
351
|
```
|
|
347
352
|
|
|
348
|
-
<sub>`api.ogt` line
|
|
353
|
+
<sub>`api.ogt` line 5583</sub>
|
|
349
354
|
|
|
350
355
|
<a id="fn-environment"></a>
|
|
351
356
|
|
|
@@ -375,7 +380,7 @@ fn environment {
|
|
|
375
380
|
}
|
|
376
381
|
```
|
|
377
382
|
|
|
378
|
-
<sub>`api.ogt` line
|
|
383
|
+
<sub>`api.ogt` line 5590</sub>
|
|
379
384
|
|
|
380
385
|
<a id="fn-emitter"></a>
|
|
381
386
|
|
|
@@ -405,13 +410,13 @@ fn emitter {
|
|
|
405
410
|
}
|
|
406
411
|
```
|
|
407
412
|
|
|
408
|
-
<sub>`api.ogt` line
|
|
413
|
+
<sub>`api.ogt` line 5597</sub>
|
|
409
414
|
|
|
410
415
|
<a id="fn-shader"></a>
|
|
411
416
|
|
|
412
417
|
### `og.load.shader`
|
|
413
418
|
|
|
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.
|
|
419
|
+
A material shader for og.render.shaderMaterial, from a cooked `.ogt` of `type shader` (its WGSL compiled by the cook for every back end). `mode hooks` (the default) defines hooks of the lit shader; `mode full lit` or `mode full unlit` defines `fn vertex(v: VertexInput, model: mat4x4<f32>, p: Params) -> VertexOutput` and `fn fragment(f: FragmentInput, p: Params) -> SurfaceOutput` over the binding contract (camera(), the model with its skin, Params, tex0 to tex7 for the material's eight texture slots; the og-game skill's Full custom shaders section), lit by the frame's lights or drawn as returned, the prepass and every shadow pass drawn through the same entries. Loaded once per path.
|
|
415
420
|
|
|
416
421
|
```ts
|
|
417
422
|
og.load.shader(world: World, path: string): Result<Shader>
|
|
@@ -428,14 +433,44 @@ Binding symbol `og_load_shader` · publish builds: kept
|
|
|
428
433
|
|
|
429
434
|
```ogt
|
|
430
435
|
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."
|
|
436
|
+
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). `mode hooks` (the default) defines hooks of the lit shader; `mode full lit` or `mode full unlit` defines `fn vertex(v: VertexInput, model: mat4x4<f32>, p: Params) -> VertexOutput` and `fn fragment(f: FragmentInput, p: Params) -> SurfaceOutput` over the binding contract (camera(), the model with its skin, Params, tex0 to tex7 for the material's eight texture slots; the og-game skill's Full custom shaders section), lit by the frame's lights or drawn as returned, the prepass and every shadow pass drawn through the same entries. Loaded once per path."
|
|
432
437
|
param world World "The world whose renderer owns it."
|
|
433
438
|
param path String "The asset id, such as `shaders/dissolve.ogt`."
|
|
434
439
|
returns Result.Shader "Refused for a path not in the bundle or not a shader."
|
|
435
440
|
}
|
|
436
441
|
```
|
|
437
442
|
|
|
438
|
-
<sub>`api.ogt` line
|
|
443
|
+
<sub>`api.ogt` line 5604</sub>
|
|
444
|
+
|
|
445
|
+
<a id="fn-post"></a>
|
|
446
|
+
|
|
447
|
+
### `og.load.post`
|
|
448
|
+
|
|
449
|
+
A custom post pass for PostEffects.custom, from a cooked `.ogt` of `type post`: `code` or `source` (a `.wgsl` beside it) defining `fn post(f: PostInput, p: Params) -> vec4<f32>` and `param <name> float|vec2|vec3|vec4|color <default...>` lines (at most eight). The function reads previous(uv), scene_color(uv), depth(uv), normal(uv) and f.uv, f.pixel, f.size, f.time, and returns linear HDR colour (the og-game skill's Custom post passes section has the contract). The cook compiles it for every back end. Loaded once per path.
|
|
450
|
+
|
|
451
|
+
```ts
|
|
452
|
+
og.load.post(world: World, path: string): Result<Post>
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
| Parameter | Type | Optional | Doc |
|
|
456
|
+
|---|---|---|---|
|
|
457
|
+
| `world` | `World` | no | The world whose renderer owns it. |
|
|
458
|
+
| `path` | `string` | no | The asset id, such as `post/crt.ogt`. |
|
|
459
|
+
|
|
460
|
+
**Returns** `Result<Post>`: Refused for a path not in the bundle or not a post pass.
|
|
461
|
+
|
|
462
|
+
Binding symbol `og_load_post` · publish builds: kept
|
|
463
|
+
|
|
464
|
+
```ogt
|
|
465
|
+
fn post {
|
|
466
|
+
doc "A custom post pass for PostEffects.custom, from a cooked `.ogt` of `type post`: `code` or `source` (a `.wgsl` beside it) defining `fn post(f: PostInput, p: Params) -> vec4<f32>` and `param <name> float|vec2|vec3|vec4|color <default...>` lines (at most eight). The function reads previous(uv), scene_color(uv), depth(uv), normal(uv) and f.uv, f.pixel, f.size, f.time, and returns linear HDR colour (the og-game skill's Custom post passes section has the contract). The cook compiles it for every back end. Loaded once per path."
|
|
467
|
+
param world World "The world whose renderer owns it."
|
|
468
|
+
param path String "The asset id, such as `post/crt.ogt`."
|
|
469
|
+
returns Result.Post "Refused for a path not in the bundle or not a post pass."
|
|
470
|
+
}
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
<sub>`api.ogt` line 5611</sub>
|
|
439
474
|
|
|
440
475
|
<a id="fn-texture"></a>
|
|
441
476
|
|
|
@@ -468,7 +503,7 @@ fn texture {
|
|
|
468
503
|
}
|
|
469
504
|
```
|
|
470
505
|
|
|
471
|
-
<sub>`api.ogt` line
|
|
506
|
+
<sub>`api.ogt` line 5618</sub>
|
|
472
507
|
|
|
473
508
|
<a id="fn-textureArray"></a>
|
|
474
509
|
|
|
@@ -501,43 +536,43 @@ fn textureArray {
|
|
|
501
536
|
}
|
|
502
537
|
```
|
|
503
538
|
|
|
504
|
-
<sub>`api.ogt` line
|
|
539
|
+
<sub>`api.ogt` line 5626</sub>
|
|
505
540
|
|
|
506
|
-
<a id="fn-
|
|
541
|
+
<a id="fn-style"></a>
|
|
507
542
|
|
|
508
|
-
### `og.load.
|
|
543
|
+
### `og.load.style`
|
|
509
544
|
|
|
510
|
-
Load a cooked UI
|
|
545
|
+
Load a cooked UI style (an `.ogt` of `type style`: every palette role, the radii, type ramp, durations, and its art: the atlas and its nine-slice frames, ornaments, fonts, icons, motion and sounds; the grammar is og-ui's `parse_style`) for UiDesc.style. Its atlas, fonts, icons and sounds are loaded with it. Loaded once per path. A built-in style a look names is in the bundle as `@styles/<name>/style.ogt`.
|
|
511
546
|
|
|
512
547
|
```ts
|
|
513
|
-
og.load.
|
|
548
|
+
og.load.style(world: World, path: string): Result<Style>
|
|
514
549
|
```
|
|
515
550
|
|
|
516
551
|
| Parameter | Type | Optional | Doc |
|
|
517
552
|
|---|---|---|---|
|
|
518
553
|
| `world` | `World` | no | The world whose UI uses it. |
|
|
519
|
-
| `path` | `string` | no | The asset id, such as `
|
|
554
|
+
| `path` | `string` | no | The asset id, such as `styles/pixel/style.ogt` or `@styles/pixel/style.ogt`. |
|
|
520
555
|
|
|
521
|
-
**Returns** `Result<
|
|
556
|
+
**Returns** `Result<Style>`: Refused for a path not in the bundle, a style that does not parse (the reason names the line) or an asset it names that cannot load.
|
|
522
557
|
|
|
523
|
-
Binding symbol `
|
|
558
|
+
Binding symbol `og_load_style` · publish builds: kept
|
|
524
559
|
|
|
525
560
|
```ogt
|
|
526
|
-
fn
|
|
527
|
-
doc "Load a cooked UI
|
|
561
|
+
fn style {
|
|
562
|
+
doc "Load a cooked UI style (an `.ogt` of `type style`: every palette role, the radii, type ramp, durations, and its art: the atlas and its nine-slice frames, ornaments, fonts, icons, motion and sounds; the grammar is og-ui's `parse_style`) for UiDesc.style. Its atlas, fonts, icons and sounds are loaded with it. Loaded once per path. A built-in style a look names is in the bundle as `@styles/<name>/style.ogt`."
|
|
528
563
|
param world World "The world whose UI uses it."
|
|
529
|
-
param path String "The asset id, such as `
|
|
530
|
-
returns Result.
|
|
564
|
+
param path String "The asset id, such as `styles/pixel/style.ogt` or `@styles/pixel/style.ogt`."
|
|
565
|
+
returns Result.Style "Refused for a path not in the bundle, a style that does not parse (the reason names the line) or an asset it names that cannot load."
|
|
531
566
|
}
|
|
532
567
|
```
|
|
533
568
|
|
|
534
|
-
<sub>`api.ogt` line
|
|
569
|
+
<sub>`api.ogt` line 5634</sub>
|
|
535
570
|
|
|
536
571
|
<a id="fn-look"></a>
|
|
537
572
|
|
|
538
573
|
### `og.load.look`
|
|
539
574
|
|
|
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), `
|
|
575
|
+
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), `ui` (a UI style: a built-in style's slug, such as `cartoon`, or the game's own style file'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 UI style it names are loaded with it. Loaded once per path.
|
|
541
576
|
|
|
542
577
|
```ts
|
|
543
578
|
og.load.look(world: World, path: string): Result<Look>
|
|
@@ -554,14 +589,14 @@ Binding symbol `og_load_look` · publish builds: kept
|
|
|
554
589
|
|
|
555
590
|
```ogt
|
|
556
591
|
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), `
|
|
592
|
+
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), `ui` (a UI style: a built-in style's slug, such as `cartoon`, or the game's own style file'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 UI style it names are loaded with it. Loaded once per path."
|
|
558
593
|
param world World "The world whose renderer owns it."
|
|
559
594
|
param path String "The asset id, such as `looks/main.ogt`."
|
|
560
595
|
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
596
|
}
|
|
562
597
|
```
|
|
563
598
|
|
|
564
|
-
<sub>`api.ogt` line
|
|
599
|
+
<sub>`api.ogt` line 5641</sub>
|
|
565
600
|
|
|
566
601
|
<a id="fn-lookInfo"></a>
|
|
567
602
|
|
|
@@ -591,7 +626,7 @@ fn lookInfo {
|
|
|
591
626
|
}
|
|
592
627
|
```
|
|
593
628
|
|
|
594
|
-
<sub>`api.ogt` line
|
|
629
|
+
<sub>`api.ogt` line 5648</sub>
|
|
595
630
|
|
|
596
631
|
<a id="fn-palette"></a>
|
|
597
632
|
|
|
@@ -621,7 +656,7 @@ fn palette {
|
|
|
621
656
|
}
|
|
622
657
|
```
|
|
623
658
|
|
|
624
|
-
<sub>`api.ogt` line
|
|
659
|
+
<sub>`api.ogt` line 5655</sub>
|
|
625
660
|
|
|
626
661
|
<a id="fn-soundInfo"></a>
|
|
627
662
|
|
|
@@ -651,7 +686,7 @@ fn soundInfo {
|
|
|
651
686
|
}
|
|
652
687
|
```
|
|
653
688
|
|
|
654
|
-
<sub>`api.ogt` line
|
|
689
|
+
<sub>`api.ogt` line 5662</sub>
|
|
655
690
|
|
|
656
691
|
<a id="fn-status"></a>
|
|
657
692
|
|
|
@@ -681,7 +716,7 @@ fn status {
|
|
|
681
716
|
}
|
|
682
717
|
```
|
|
683
718
|
|
|
684
|
-
<sub>`api.ogt` line
|
|
719
|
+
<sub>`api.ogt` line 5669</sub>
|
|
685
720
|
|
|
686
721
|
<a id="fn-error"></a>
|
|
687
722
|
|
|
@@ -711,7 +746,7 @@ fn error {
|
|
|
711
746
|
}
|
|
712
747
|
```
|
|
713
748
|
|
|
714
|
-
<sub>`api.ogt` line
|
|
749
|
+
<sub>`api.ogt` line 5676</sub>
|
|
715
750
|
|
|
716
751
|
<a id="fn-gltfInfo"></a>
|
|
717
752
|
|
|
@@ -741,7 +776,7 @@ fn gltfInfo {
|
|
|
741
776
|
}
|
|
742
777
|
```
|
|
743
778
|
|
|
744
|
-
<sub>`api.ogt` line
|
|
779
|
+
<sub>`api.ogt` line 5683</sub>
|
|
745
780
|
|
|
746
781
|
<a id="fn-animation"></a>
|
|
747
782
|
|
|
@@ -774,7 +809,7 @@ fn animation {
|
|
|
774
809
|
}
|
|
775
810
|
```
|
|
776
811
|
|
|
777
|
-
<sub>`api.ogt` line
|
|
812
|
+
<sub>`api.ogt` line 5690</sub>
|
|
778
813
|
|
|
779
814
|
<a id="fn-rig"></a>
|
|
780
815
|
|
|
@@ -804,7 +839,7 @@ fn rig {
|
|
|
804
839
|
}
|
|
805
840
|
```
|
|
806
841
|
|
|
807
|
-
<sub>`api.ogt` line
|
|
842
|
+
<sub>`api.ogt` line 5698</sub>
|
|
808
843
|
|
|
809
844
|
<a id="fn-flipbook"></a>
|
|
810
845
|
|
|
@@ -834,7 +869,7 @@ fn flipbook {
|
|
|
834
869
|
}
|
|
835
870
|
```
|
|
836
871
|
|
|
837
|
-
<sub>`api.ogt` line
|
|
872
|
+
<sub>`api.ogt` line 5705</sub>
|
|
838
873
|
|
|
839
874
|
<a id="fn-tilemap"></a>
|
|
840
875
|
|
|
@@ -864,7 +899,127 @@ fn tilemap {
|
|
|
864
899
|
}
|
|
865
900
|
```
|
|
866
901
|
|
|
867
|
-
<sub>`api.ogt` line
|
|
902
|
+
<sub>`api.ogt` line 5712</sub>
|
|
903
|
+
|
|
904
|
+
<a id="fn-video"></a>
|
|
905
|
+
|
|
906
|
+
### `og.load.video`
|
|
907
|
+
|
|
908
|
+
Load cooked footage (an `.ogt` of `type video`: `source` an .mp4, .webm or .mov beside it or under assets/, `fps`, `maxSeconds`, `size W H`, `kind color|pixel`, `audio`), which og cook turns with ffmpeg into a texture array of its frames and its sound track. Uploads the frames as one 2D-array texture and makes the video's Texture (VideoInfo.texture), which shows the frame its og.VideoPlayer is at: a material map, an og.Sprite or a UI image draws it like any texture. Load it in GameDesc.start (every process of an og render --jobs run loads it the same way, so its handles agree). Loading the same path again answers the same handles.
|
|
909
|
+
|
|
910
|
+
```ts
|
|
911
|
+
og.load.video(world: World, path: string): Result<VideoInfo>
|
|
912
|
+
```
|
|
913
|
+
|
|
914
|
+
| Parameter | Type | Optional | Doc |
|
|
915
|
+
|---|---|---|---|
|
|
916
|
+
| `world` | `World` | no | The world whose renderer and audio own it. |
|
|
917
|
+
| `path` | `string` | no | The video's asset id: the `.ogt`, such as `clips/intro.ogt`. |
|
|
918
|
+
|
|
919
|
+
**Returns** `Result<VideoInfo>`: Refused for a path not in the bundle (run og cook: a video needs ffmpeg there, og doctor) or not a video.
|
|
920
|
+
|
|
921
|
+
Binding symbol `og_load_video` · publish builds: kept
|
|
922
|
+
|
|
923
|
+
```ogt
|
|
924
|
+
fn video {
|
|
925
|
+
doc "Load cooked footage (an `.ogt` of `type video`: `source` an .mp4, .webm or .mov beside it or under assets/, `fps`, `maxSeconds`, `size W H`, `kind color|pixel`, `audio`), which og cook turns with ffmpeg into a texture array of its frames and its sound track. Uploads the frames as one 2D-array texture and makes the video's Texture (VideoInfo.texture), which shows the frame its og.VideoPlayer is at: a material map, an og.Sprite or a UI image draws it like any texture. Load it in GameDesc.start (every process of an og render --jobs run loads it the same way, so its handles agree). Loading the same path again answers the same handles."
|
|
926
|
+
param world World "The world whose renderer and audio own it."
|
|
927
|
+
param path String "The video's asset id: the `.ogt`, such as `clips/intro.ogt`."
|
|
928
|
+
returns Result.VideoInfo "Refused for a path not in the bundle (run og cook: a video needs ffmpeg there, og doctor) or not a video."
|
|
929
|
+
}
|
|
930
|
+
```
|
|
931
|
+
|
|
932
|
+
<sub>`api.ogt` line 5719</sub>
|
|
933
|
+
|
|
934
|
+
<a id="fn-videoInfo"></a>
|
|
935
|
+
|
|
936
|
+
### `og.load.videoInfo`
|
|
937
|
+
|
|
938
|
+
A loaded video's size, frames, rate, length, texture and sound.
|
|
939
|
+
|
|
940
|
+
```ts
|
|
941
|
+
og.load.videoInfo(world: World, video: Video): Result<VideoInfo>
|
|
942
|
+
```
|
|
943
|
+
|
|
944
|
+
| Parameter | Type | Optional | Doc |
|
|
945
|
+
|---|---|---|---|
|
|
946
|
+
| `world` | `World` | no | The world that loaded it. |
|
|
947
|
+
| `video` | `Video` | no | The video. |
|
|
948
|
+
|
|
949
|
+
**Returns** `Result<VideoInfo>`: Refused for a handle og.load.video did not answer.
|
|
950
|
+
|
|
951
|
+
Binding symbol `og_load_video_info` · publish builds: kept
|
|
952
|
+
|
|
953
|
+
```ogt
|
|
954
|
+
fn videoInfo {
|
|
955
|
+
doc "A loaded video's size, frames, rate, length, texture and sound."
|
|
956
|
+
param world World "The world that loaded it."
|
|
957
|
+
param video Video "The video."
|
|
958
|
+
returns Result.VideoInfo "Refused for a handle og.load.video did not answer."
|
|
959
|
+
}
|
|
960
|
+
```
|
|
961
|
+
|
|
962
|
+
<sub>`api.ogt` line 5726</sub>
|
|
963
|
+
|
|
964
|
+
<a id="fn-timeline"></a>
|
|
965
|
+
|
|
966
|
+
### `og.load.timeline`
|
|
967
|
+
|
|
968
|
+
Load a timeline: an `.ogt` of `type timeline` (the og.timeline module's file: duration, paths and tracks of keys), cooked with its caption files imported. Loaded once per path; play it with an og.Timeline whose asset is the handle, or `timeline:play:<name>` on the command channel.
|
|
969
|
+
|
|
970
|
+
```ts
|
|
971
|
+
og.load.timeline(world: World, path: string): Result<TimelineAsset>
|
|
972
|
+
```
|
|
973
|
+
|
|
974
|
+
| Parameter | Type | Optional | Doc |
|
|
975
|
+
|---|---|---|---|
|
|
976
|
+
| `world` | `World` | no | The world. |
|
|
977
|
+
| `path` | `string` | no | The timeline's asset id, such as `timelines/intro.ogt`. |
|
|
978
|
+
|
|
979
|
+
**Returns** `Result<TimelineAsset>`: Refused for a path not in the bundle (run og cook) or a file that is not a timeline.
|
|
980
|
+
|
|
981
|
+
Binding symbol `og_load_timeline` · publish builds: kept
|
|
982
|
+
|
|
983
|
+
```ogt
|
|
984
|
+
fn timeline {
|
|
985
|
+
doc "Load a timeline: an `.ogt` of `type timeline` (the og.timeline module's file: duration, paths and tracks of keys), cooked with its caption files imported. Loaded once per path; play it with an og.Timeline whose asset is the handle, or `timeline:play:<name>` on the command channel."
|
|
986
|
+
param world World "The world."
|
|
987
|
+
param path String "The timeline's asset id, such as `timelines/intro.ogt`."
|
|
988
|
+
returns Result.TimelineAsset "Refused for a path not in the bundle (run og cook) or a file that is not a timeline."
|
|
989
|
+
}
|
|
990
|
+
```
|
|
991
|
+
|
|
992
|
+
<sub>`api.ogt` line 5733</sub>
|
|
993
|
+
|
|
994
|
+
<a id="fn-rig2d"></a>
|
|
995
|
+
|
|
996
|
+
### `og.load.rig2d`
|
|
997
|
+
|
|
998
|
+
Load a cooked 2D rig (an `.ogt` of `type rig2d`, written by hand or imported by the cook from DragonBones JSON) and its texture, and register it with og.skeleton2d. Loading the same path again answers the same handles.
|
|
999
|
+
|
|
1000
|
+
```ts
|
|
1001
|
+
og.load.rig2d(world: World, path: string): Result<Rig2DInfo>
|
|
1002
|
+
```
|
|
1003
|
+
|
|
1004
|
+
| Parameter | Type | Optional | Doc |
|
|
1005
|
+
|---|---|---|---|
|
|
1006
|
+
| `world` | `World` | no | The world whose animation and renderer own it. |
|
|
1007
|
+
| `path` | `string` | no | The rig's asset id, such as `rigs/hero.ogt`. |
|
|
1008
|
+
|
|
1009
|
+
**Returns** `Result<Rig2DInfo>`: Refused for a path not in the bundle (run og cook) or a texture it cannot load.
|
|
1010
|
+
|
|
1011
|
+
Binding symbol `og_load_rig2d` · publish builds: kept
|
|
1012
|
+
|
|
1013
|
+
```ogt
|
|
1014
|
+
fn rig2d {
|
|
1015
|
+
doc "Load a cooked 2D rig (an `.ogt` of `type rig2d`, written by hand or imported by the cook from DragonBones JSON) and its texture, and register it with og.skeleton2d. Loading the same path again answers the same handles."
|
|
1016
|
+
param world World "The world whose animation and renderer own it."
|
|
1017
|
+
param path String "The rig's asset id, such as `rigs/hero.ogt`."
|
|
1018
|
+
returns Result.Rig2DInfo "Refused for a path not in the bundle (run og cook) or a texture it cannot load."
|
|
1019
|
+
}
|
|
1020
|
+
```
|
|
1021
|
+
|
|
1022
|
+
<sub>`api.ogt` line 5740</sub>
|
|
868
1023
|
|
|
869
1024
|
## Components, resources and events
|
|
870
1025
|
|
|
@@ -887,6 +1042,9 @@ Token `og.Model`, registered under the schema name `og.Model`; its value type is
|
|
|
887
1042
|
| `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
1043
|
| `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
1044
|
| `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. |
|
|
1045
|
+
| `lodBias` | `number` | `1` | 0 … 16 | — | tunable | This instance's level of detail bias, multiplied with RenderSettings.lodBias: the cook simplifies every mesh into levels (a model's import settings, `model { lods 1 0.5 0.25 }` by default, the triangle fraction of each level; a glTF with MSFT_lod keeps its own levels) and measures each level's error against the full mesh, and the renderer draws the coarsest level whose error covers less than a pixel at the model's distance, with hysteresis so it does not flicker at the boundary. Above 1 keeps detail farther (a hero), below 1 drops it sooner (a crowd); 0 always draws the full mesh. dump_entity shows the level drawn. |
|
|
1046
|
+
| `layers` | `number` | `1` | — | — | — | Three.js layers of every mesh of the model, as Mesh.layers. |
|
|
1047
|
+
| `static` | `boolean` | `false` | — | — | — | Part of its scene's baked lighting: og bake lightmaps gives a static model lightmap UVs (xatlas, over its world-space triangles) and traces the light arriving at its surfaces from the scene into the scene's lightmap (`<scene>.lightmap.ogt` and `.ktx2` beside the scene). Once baked, the model draws with it (its ambient light from the lightmap instead of the sky; its lights' direct light, shadows and highlights still drawn every frame) for as long as the bake matches the scene. A scene entity says `static true` beside its `model` line; an unbaked static model draws as any model, and og doctor --project names the scene. |
|
|
890
1048
|
|
|
891
1049
|
```ogt
|
|
892
1050
|
component Model {
|
|
@@ -913,10 +1071,20 @@ component Model {
|
|
|
913
1071
|
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
1072
|
default true
|
|
915
1073
|
}
|
|
1074
|
+
field lodBias f32 "This instance's level of detail bias, multiplied with RenderSettings.lodBias: the cook simplifies every mesh into levels (a model's import settings, `model { lods 1 0.5 0.25 }` by default, the triangle fraction of each level; a glTF with MSFT_lod keeps its own levels) and measures each level's error against the full mesh, and the renderer draws the coarsest level whose error covers less than a pixel at the model's distance, with hysteresis so it does not flicker at the boundary. Above 1 keeps detail farther (a hero), below 1 drops it sooner (a crowd); 0 always draws the full mesh. dump_entity shows the level drawn." {
|
|
1075
|
+
default 1
|
|
1076
|
+
min 0
|
|
1077
|
+
max 16
|
|
1078
|
+
tunable true
|
|
1079
|
+
}
|
|
1080
|
+
field layers u32 "Three.js layers of every mesh of the model, as Mesh.layers." {
|
|
1081
|
+
default 1
|
|
1082
|
+
}
|
|
1083
|
+
field static bool "Part of its scene's baked lighting: og bake lightmaps gives a static model lightmap UVs (xatlas, over its world-space triangles) and traces the light arriving at its surfaces from the scene into the scene's lightmap (`<scene>.lightmap.ogt` and `.ktx2` beside the scene). Once baked, the model draws with it (its ambient light from the lightmap instead of the sky; its lights' direct light, shadows and highlights still drawn every frame) for as long as the bake matches the scene. A scene entity says `static true` beside its `model` line; an unbaked static model draws as any model, and og doctor --project names the scene."
|
|
916
1084
|
}
|
|
917
1085
|
```
|
|
918
1086
|
|
|
919
|
-
<sub>`api.ogt` line
|
|
1087
|
+
<sub>`api.ogt` line 5489</sub>
|
|
920
1088
|
|
|
921
1089
|
<a id="record-AssetReady"></a>
|
|
922
1090
|
|
|
@@ -939,7 +1107,7 @@ event AssetReady {
|
|
|
939
1107
|
}
|
|
940
1108
|
```
|
|
941
1109
|
|
|
942
|
-
<sub>`api.ogt` line
|
|
1110
|
+
<sub>`api.ogt` line 5747</sub>
|
|
943
1111
|
|
|
944
1112
|
<a id="record-AssetFailed"></a>
|
|
945
1113
|
|
|
@@ -964,7 +1132,7 @@ event AssetFailed {
|
|
|
964
1132
|
}
|
|
965
1133
|
```
|
|
966
1134
|
|
|
967
|
-
<sub>`api.ogt` line
|
|
1135
|
+
<sub>`api.ogt` line 5753</sub>
|
|
968
1136
|
|
|
969
1137
|
## Types
|
|
970
1138
|
|
|
@@ -980,7 +1148,7 @@ A generational handle: a number the engine hands out. A dead handle is an error
|
|
|
980
1148
|
handle Asset "A loaded bundle, scene or glTF asset."
|
|
981
1149
|
```
|
|
982
1150
|
|
|
983
|
-
<sub>`api.ogt` line
|
|
1151
|
+
<sub>`api.ogt` line 5392</sub>
|
|
984
1152
|
|
|
985
1153
|
<a id="type-Font"></a>
|
|
986
1154
|
|
|
@@ -994,7 +1162,7 @@ A generational handle: a number the engine hands out. A dead handle is an error
|
|
|
994
1162
|
handle Font "A cooked MSDF font: its glyph table and one or more atlas pages."
|
|
995
1163
|
```
|
|
996
1164
|
|
|
997
|
-
<sub>`api.ogt` line
|
|
1165
|
+
<sub>`api.ogt` line 5393</sub>
|
|
998
1166
|
|
|
999
1167
|
<a id="type-Sound"></a>
|
|
1000
1168
|
|
|
@@ -1008,21 +1176,21 @@ A generational handle: a number the engine hands out. A dead handle is an error
|
|
|
1008
1176
|
handle Sound "A cooked sound: QOA-encoded PCM the audio module plays."
|
|
1009
1177
|
```
|
|
1010
1178
|
|
|
1011
|
-
<sub>`api.ogt` line
|
|
1179
|
+
<sub>`api.ogt` line 5394</sub>
|
|
1012
1180
|
|
|
1013
|
-
<a id="type-
|
|
1181
|
+
<a id="type-Style"></a>
|
|
1014
1182
|
|
|
1015
|
-
### `
|
|
1183
|
+
### `Style` (handle)
|
|
1016
1184
|
|
|
1017
|
-
A cooked UI
|
|
1185
|
+
A cooked UI style: its values, atlas, fonts, icons and sounds loaded with it, for og.ui.configure.
|
|
1018
1186
|
|
|
1019
1187
|
A generational handle: a number the engine hands out. A dead handle is an error value, never a crash.
|
|
1020
1188
|
|
|
1021
1189
|
```ogt
|
|
1022
|
-
handle
|
|
1190
|
+
handle Style "A cooked UI style: its values, atlas, fonts, icons and sounds loaded with it, for og.ui.configure."
|
|
1023
1191
|
```
|
|
1024
1192
|
|
|
1025
|
-
<sub>`api.ogt` line
|
|
1193
|
+
<sub>`api.ogt` line 5395</sub>
|
|
1026
1194
|
|
|
1027
1195
|
<a id="type-TextureArray"></a>
|
|
1028
1196
|
|
|
@@ -1036,7 +1204,7 @@ A generational handle: a number the engine hands out. A dead handle is an error
|
|
|
1036
1204
|
handle TextureArray "A cooked texture array: same-sized layers uploaded as one 2D-array texture (og.load.textureArray)."
|
|
1037
1205
|
```
|
|
1038
1206
|
|
|
1039
|
-
<sub>`api.ogt` line
|
|
1207
|
+
<sub>`api.ogt` line 5396</sub>
|
|
1040
1208
|
|
|
1041
1209
|
<a id="type-LoadStatus"></a>
|
|
1042
1210
|
|
|
@@ -1061,7 +1229,7 @@ enum LoadStatus {
|
|
|
1061
1229
|
}
|
|
1062
1230
|
```
|
|
1063
1231
|
|
|
1064
|
-
<sub>`api.ogt` line
|
|
1232
|
+
<sub>`api.ogt` line 5419</sub>
|
|
1065
1233
|
|
|
1066
1234
|
<a id="type-GltfDesc"></a>
|
|
1067
1235
|
|
|
@@ -1091,7 +1259,7 @@ struct GltfDesc {
|
|
|
1091
1259
|
}
|
|
1092
1260
|
```
|
|
1093
1261
|
|
|
1094
|
-
<sub>`api.ogt` line
|
|
1262
|
+
<sub>`api.ogt` line 5426</sub>
|
|
1095
1263
|
|
|
1096
1264
|
<a id="type-GltfInfo"></a>
|
|
1097
1265
|
|
|
@@ -1116,7 +1284,7 @@ struct GltfInfo {
|
|
|
1116
1284
|
}
|
|
1117
1285
|
```
|
|
1118
1286
|
|
|
1119
|
-
<sub>`api.ogt` line
|
|
1287
|
+
<sub>`api.ogt` line 5438</sub>
|
|
1120
1288
|
|
|
1121
1289
|
<a id="type-BundleInfo"></a>
|
|
1122
1290
|
|
|
@@ -1139,7 +1307,7 @@ struct BundleInfo {
|
|
|
1139
1307
|
}
|
|
1140
1308
|
```
|
|
1141
1309
|
|
|
1142
|
-
<sub>`api.ogt` line
|
|
1310
|
+
<sub>`api.ogt` line 5446</sub>
|
|
1143
1311
|
|
|
1144
1312
|
<a id="type-FontInfo"></a>
|
|
1145
1313
|
|
|
@@ -1172,7 +1340,7 @@ struct FontInfo {
|
|
|
1172
1340
|
}
|
|
1173
1341
|
```
|
|
1174
1342
|
|
|
1175
|
-
<sub>`api.ogt` line
|
|
1343
|
+
<sub>`api.ogt` line 5453</sub>
|
|
1176
1344
|
|
|
1177
1345
|
<a id="type-SoundInfo"></a>
|
|
1178
1346
|
|
|
@@ -1203,7 +1371,7 @@ struct SoundInfo {
|
|
|
1203
1371
|
}
|
|
1204
1372
|
```
|
|
1205
1373
|
|
|
1206
|
-
<sub>`api.ogt` line
|
|
1374
|
+
<sub>`api.ogt` line 5465</sub>
|
|
1207
1375
|
|
|
1208
1376
|
<a id="type-TextureArrayInfo"></a>
|
|
1209
1377
|
|
|
@@ -1234,7 +1402,7 @@ struct TextureArrayInfo {
|
|
|
1234
1402
|
}
|
|
1235
1403
|
```
|
|
1236
1404
|
|
|
1237
|
-
<sub>`api.ogt` line
|
|
1405
|
+
<sub>`api.ogt` line 5478</sub>
|
|
1238
1406
|
|
|
1239
1407
|
## Column kinds
|
|
1240
1408
|
|
|
@@ -1255,7 +1423,7 @@ column TextureArray {
|
|
|
1255
1423
|
}
|
|
1256
1424
|
```
|
|
1257
1425
|
|
|
1258
|
-
<sub>`api.ogt` line
|
|
1426
|
+
<sub>`api.ogt` line 5398</sub>
|
|
1259
1427
|
|
|
1260
1428
|
```ogt
|
|
1261
1429
|
column Asset {
|
|
@@ -1266,7 +1434,7 @@ column Asset {
|
|
|
1266
1434
|
}
|
|
1267
1435
|
```
|
|
1268
1436
|
|
|
1269
|
-
<sub>`api.ogt` line
|
|
1437
|
+
<sub>`api.ogt` line 5405</sub>
|
|
1270
1438
|
|
|
1271
1439
|
```ogt
|
|
1272
1440
|
column Sound {
|
|
@@ -1277,4 +1445,4 @@ column Sound {
|
|
|
1277
1445
|
}
|
|
1278
1446
|
```
|
|
1279
1447
|
|
|
1280
|
-
<sub>`api.ogt` line
|
|
1448
|
+
<sub>`api.ogt` line 5412</sub>
|