@origingame/engine 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web/origin-engine.d.ts +38 -2
- package/dist/web/origin-engine.js +250 -10
- package/dist/web/origin-engine_bg.wasm +0 -0
- package/dist/web/origin-engine_bg.wasm.d.ts +14 -2
- package/dist/web-publish/origin-engine-lanes.js +255 -34
- package/dist/web-publish/origin-engine-lanes_bg.wasm +0 -0
- package/dist/web-publish/origin-engine.d.ts +39 -3
- package/dist/web-publish/origin-engine.js +253 -32
- package/dist/web-publish/origin-engine_bg.wasm +0 -0
- package/dist/web-publish/origin-engine_bg.wasm.d.ts +15 -3
- package/dist/web-publish-2d/origin-engine-lanes.js +253 -32
- package/dist/web-publish-2d/origin-engine-lanes_bg.wasm +0 -0
- package/dist/web-publish-2d/origin-engine.d.ts +38 -2
- package/dist/web-publish-2d/origin-engine.js +250 -29
- package/dist/web-publish-2d/origin-engine_bg.wasm +0 -0
- package/dist/web-publish-2d/origin-engine_bg.wasm.d.ts +14 -2
- package/knowledge/README.md +2 -1
- package/knowledge/guides/three-to-og.md +393 -0
- package/knowledge/knowledge.json +2 -1
- package/knowledge/package.json +3 -2
- package/knowledge/scaffold/origin-engine.json +2 -2
- package/knowledge/scaffold/template/package.json +1 -1
- package/knowledge/scaffold/template/project.ogt +1 -1
- package/knowledge/scripts/validate.ts +140 -21
- package/knowledge/skills/og-audio/SKILL.md +2 -2
- package/knowledge/skills/og-build/SKILL.md +22 -3
- package/knowledge/skills/og-core/SKILL.md +20 -5
- package/knowledge/skills/og-feel/SKILL.md +2 -2
- package/knowledge/skills/og-game/SKILL.md +481 -35
- package/knowledge/skills/og-i18n/SKILL.md +7 -7
- package/knowledge/skills/og-model/SKILL.md +374 -0
- package/knowledge/skills/og-platform-sdk/SKILL.md +1 -1
- package/knowledge/skills/og-ui/SKILL.md +15 -8
- package/knowledge/wiki/ai.md +20 -20
- package/knowledge/wiki/anim.md +63 -55
- package/knowledge/wiki/atmosphere.md +13 -13
- package/knowledge/wiki/audio.md +18 -18
- package/knowledge/wiki/camera.md +13 -13
- package/knowledge/wiki/commands.md +11 -11
- package/knowledge/wiki/debug.md +13 -13
- package/knowledge/wiki/game.md +8 -8
- package/knowledge/wiki/i18n.md +7 -7
- package/knowledge/wiki/index.md +57 -3
- package/knowledge/wiki/input.md +47 -47
- package/knowledge/wiki/load.md +57 -57
- package/knowledge/wiki/nav.md +34 -34
- package/knowledge/wiki/net.md +10 -10
- package/knowledge/wiki/path.md +14 -14
- package/knowledge/wiki/physics.md +95 -95
- package/knowledge/wiki/platform.md +44 -44
- package/knowledge/wiki/probe.md +86 -86
- package/knowledge/wiki/reflect.md +16 -4
- package/knowledge/wiki/render.md +1168 -170
- package/knowledge/wiki/rng.md +14 -14
- package/knowledge/wiki/shapes.md +727 -0
- package/knowledge/wiki/stream.md +15 -15
- package/knowledge/wiki/system.md +8 -8
- package/knowledge/wiki/systems.md +2 -2
- package/knowledge/wiki/terrain.md +24 -20
- package/knowledge/wiki/tilemap.md +13 -13
- package/knowledge/wiki/time.md +4 -4
- package/knowledge/wiki/timeline.md +14 -14
- package/knowledge/wiki/transform.md +8 -8
- package/knowledge/wiki/tween.md +17 -17
- package/knowledge/wiki/ui.md +245 -269
- package/knowledge/wiki/video.md +5 -5
- package/knowledge/wiki/world.md +36 -36
- package/package.json +4 -4
- package/schema/api.schema.json +1834 -305
- package/shell/platform.ts +5 -0
- package/shell/player.ts +8 -2
- package/shell/transport.ts +6 -0
- package/src/generated/abi.ts +37 -1
- package/src/geom.ts +260 -0
- package/src/index.ts +8 -1
- package/src/node/playtest-run.ts +1 -0
- package/src/platform-local.ts +2 -0
- package/src/playtest.ts +8 -0
- package/src/runtime.ts +87 -6
- package/src/ui-kit/settings.ts +9 -0
- package/src/web/shell.ts +1 -1
- package/src/web/worker.ts +2 -2
- package/types/bindings.json +697 -402
- package/types/index.d.ts +1045 -127
package/types/index.d.ts
CHANGED
|
@@ -31,12 +31,32 @@ export interface FieldSpec<K extends ColumnKind = ColumnKind> {
|
|
|
31
31
|
readonly capacity?: number;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
/** The column kinds a list holds: one number (`f32`, `f64`, `u32`, `i32`) or a handle. */
|
|
35
|
+
export type ListKind = {
|
|
36
|
+
[K in ColumnKind]: ColumnKinds[K]["value"] extends number ? K : never;
|
|
37
|
+
}[ColumnKind];
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A list field, made by `list(of, capacity)`: at most `list` values of the
|
|
41
|
+
* element's kind, starting empty. Its value is a frozen array: read it as a
|
|
42
|
+
* copy, write it whole (`post.custom = [...post.custom, h]`).
|
|
43
|
+
*/
|
|
44
|
+
export interface ListSpec<K extends ListKind = ListKind> {
|
|
45
|
+
readonly kind: K;
|
|
46
|
+
readonly default: readonly ColumnKinds[K]["value"][];
|
|
47
|
+
readonly options: FieldOptions;
|
|
48
|
+
/** The capacity in elements, 1 to 1024. */
|
|
49
|
+
readonly list: number;
|
|
50
|
+
}
|
|
51
|
+
|
|
34
52
|
/** A reflected layout: field names to field specs. */
|
|
35
|
-
export type Fields = { readonly [field: string]: FieldSpec };
|
|
53
|
+
export type Fields = { readonly [field: string]: FieldSpec | ListSpec };
|
|
36
54
|
|
|
37
|
-
/** The value of a layout: each field as its column's value type. */
|
|
55
|
+
/** The value of a layout: each field as its column's value type, a list as a read-only array of it. */
|
|
38
56
|
export type FieldValues<F extends Fields> = {
|
|
39
|
-
-readonly [K in keyof F]:
|
|
57
|
+
-readonly [K in keyof F]: F[K] extends { readonly list: number }
|
|
58
|
+
? readonly ColumnKinds[F[K]["kind"]]["value"][]
|
|
59
|
+
: ColumnKinds[F[K]["kind"]]["value"];
|
|
40
60
|
};
|
|
41
61
|
|
|
42
62
|
/** The typed views of a layout: each field as its column's typed array. */
|
|
@@ -117,6 +137,8 @@ export interface ColumnKinds {
|
|
|
117
137
|
Material: { readonly array: Uint32Array; readonly stride: 2; readonly value: Material };
|
|
118
138
|
/** A ToneMapping field: the variant's index. */
|
|
119
139
|
ToneMapping: { readonly array: Uint32Array; readonly stride: 1; readonly value: ToneMapping };
|
|
140
|
+
/** A QualityPreset field: the variant's index. */
|
|
141
|
+
QualityPreset: { readonly array: Uint32Array; readonly stride: 1; readonly value: QualityPreset };
|
|
120
142
|
/** A Texture handle field (0 is none). */
|
|
121
143
|
Texture: { readonly array: Uint32Array; readonly stride: 2; readonly value: Texture };
|
|
122
144
|
/** A Lut handle field (0 is none). */
|
|
@@ -901,7 +923,7 @@ export declare const color: ColorMath;
|
|
|
901
923
|
// ── reflect ─────────────────────────────────────────────────────
|
|
902
924
|
// Reflection: components and resources are declared once with their field layout and metadata, and registered by name.
|
|
903
925
|
// The inspector, Tune, the probe, scene text and the wiki read this one schema. Each column factory below makes one field.
|
|
904
|
-
// A field holds one value
|
|
926
|
+
// A field holds one value, or a list of at most a fixed number of one number type or handle: `list(u32(), 8)`, `list(Asset(), 4)` (the list factory below). A list is read as a frozen copy (`push` throws) and written whole (`chain.passes = [...chain.passes, h]`); one over its capacity is refused, never truncated. A few vectors are numbered fields (`p0` to `p7`, as og.CameraRail does); a list of things with fields of their own is an entity each, with its own component, looped over by a query (a ring of skid marks, the laps of a race); a long record (a lap's taped inputs) is text in `str` fields of at most 4,096 bytes each, chunked over entities. Keep none of it in module variables: they are not world state, so a snapshot, a replay and a hot reload lose them.
|
|
905
927
|
// A handle (an og.load answer, a texture, a sound, a geometry, a material, an entity) is a 64-bit number: keep it in a field of its own kind (`Asset()`, `Texture()`, `Sound()`, `Geometry()`, `Material()`, `Entity()`, the factories of the API's handle types), in a component or a resource. A `u32` field refuses one (handles pass 2^32: `4294967298 is not a u32`); an `f64` holds the number but loses its type.
|
|
906
928
|
|
|
907
929
|
/**
|
|
@@ -1055,6 +1077,17 @@ export declare function Color(value?: Color, options?: FieldOptions): FieldSpec<
|
|
|
1055
1077
|
*/
|
|
1056
1078
|
export declare function str(capacity: number, value?: string, options?: FieldOptions): FieldSpec<"str">;
|
|
1057
1079
|
|
|
1080
|
+
/**
|
|
1081
|
+
* A list of at most `capacity` values of one number column (`f32`, `f64`, `u32`, `i32`) or handle column (`Asset`, `Entity`, `Post`, ...), stored inline: a count, then the elements, zeros past the count, so `[]` and `[0]` differ and the list is world state like a number. The capacity is 1 to 1,024 elements; it starts empty and is never tunable.
|
|
1082
|
+
* Reading it answers a frozen array, a copy: `push`, `splice` and index writes throw, so change it by writing a whole array (`v.passes = [...v.passes, h]`, `v.passes = []`). A list over the capacity is refused with the fix named (an error value from world.insert/world.set, a throw from a resource's setter), never truncated. Scene text and looks give it on one line, its elements in order (`passes 3 5`), the key alone for the empty list. Its view is the element's typed array with a stride of (capacity + 1) elements, the count first.
|
|
1083
|
+
*
|
|
1084
|
+
* A list field: stored in the element's typed array, (capacity + 1) of its lanes per entity, the count first.
|
|
1085
|
+
* @param of The element's column factory, called for its kind: `u32()`, `Asset()`, `Post()` (its default and options are not used).
|
|
1086
|
+
* @param capacity The most elements it holds, 1 to 1024.
|
|
1087
|
+
* @param options Label and docs (a list has no range and is not tunable).
|
|
1088
|
+
*/
|
|
1089
|
+
export declare function list<K extends ListKind>(of: FieldSpec<K>, capacity: number, options?: FieldOptions): ListSpec<K>;
|
|
1090
|
+
|
|
1058
1091
|
/**
|
|
1059
1092
|
* Declare a component: plain data stored per entity in engine memory, one column per field.
|
|
1060
1093
|
* Registration is by name, so a hot reload re-registers the same component and migrates its fields by name.
|
|
@@ -4030,7 +4063,33 @@ export type ToneMapping = "aces" | "agx" | "none";
|
|
|
4030
4063
|
export declare function ToneMapping(value?: ToneMapping, options?: FieldOptions): FieldSpec<"ToneMapping">;
|
|
4031
4064
|
|
|
4032
4065
|
/**
|
|
4033
|
-
*
|
|
4066
|
+
* A graphics preset: a row of RenderSettings' quality fields that og.render.applyQuality writes (its doc has the table). The settings screen (og.ui.settingsScreen) offers the three.
|
|
4067
|
+
* - `"medium"`: The full frame: every quality field at its default.
|
|
4068
|
+
* - `"low"`: The cheapest frame: no rect-light shadows, two shadowed lights, half-size shadow maps, plain fog, hard particles, no screen-space reflections or ambient occlusion, FXAA for MSAA.
|
|
4069
|
+
* - `"high"`: The full frame with the shadow maps at twice their side.
|
|
4070
|
+
*/
|
|
4071
|
+
export type GraphicsQuality = "medium" | "low" | "high";
|
|
4072
|
+
|
|
4073
|
+
/**
|
|
4074
|
+
* The preset RenderSettings' quality fields were last written with (RenderSettings.quality).
|
|
4075
|
+
* - `"none"`: No preset applied: the fields are their defaults or the game's own.
|
|
4076
|
+
* - `"low"`: og.render.applyQuality(world, "low").
|
|
4077
|
+
* - `"medium"`: og.render.applyQuality(world, "medium").
|
|
4078
|
+
* - `"high"`: og.render.applyQuality(world, "high").
|
|
4079
|
+
*/
|
|
4080
|
+
export type QualityPreset = "none" | "low" | "medium" | "high";
|
|
4081
|
+
|
|
4082
|
+
/**
|
|
4083
|
+
* A QualityPreset field: the variant's index.
|
|
4084
|
+
*
|
|
4085
|
+
* A `QualityPreset` field: stored in a `Uint32Array` with stride 1.
|
|
4086
|
+
* @param value The field's default; omitted, the column's zero value.
|
|
4087
|
+
* @param options Range, unit, label, docs and the tunable flag.
|
|
4088
|
+
*/
|
|
4089
|
+
export declare function QualityPreset(value?: QualityPreset, options?: FieldOptions): FieldSpec<"QualityPreset">;
|
|
4090
|
+
|
|
4091
|
+
/**
|
|
4092
|
+
* The frame's look after lighting: environment light, sky, bloom, exposure metering and tone mapping, and what the frame may cost: the quality fields (rectShadows to msaaSamples) that og.render.applyQuality sets from a graphics preset. Read after each tick; it never feeds back into the simulation. Camera.exposure is the manual exposure.
|
|
4034
4093
|
*
|
|
4035
4094
|
* The `RenderSettings` resource (token `og.RenderSettings`).
|
|
4036
4095
|
*/
|
|
@@ -4115,7 +4174,7 @@ export interface RenderSettings {
|
|
|
4115
4174
|
*/
|
|
4116
4175
|
decalAtlas: Texture;
|
|
4117
4176
|
/**
|
|
4118
|
-
* A multiplier on every model's projected
|
|
4177
|
+
* A multiplier on every model's projected level-of-detail error when its level is picked (og.Model.lodBias multiplies it again): a level is drawn while its error, measured by the cook against the full mesh, covers less than a pixel on the screen. 1 is the engine's choice, 2 keeps full meshes twice as far, 0.5 simplifies sooner; 0 draws every model at its full mesh.
|
|
4119
4178
|
*
|
|
4120
4179
|
* @default 1
|
|
4121
4180
|
* @range 0..16
|
|
@@ -4128,6 +4187,61 @@ export interface RenderSettings {
|
|
|
4128
4187
|
* @default true
|
|
4129
4188
|
*/
|
|
4130
4189
|
bakedLighting: boolean;
|
|
4190
|
+
/**
|
|
4191
|
+
* The graphics preset og.render.applyQuality last wrote into the quality fields below (rectShadows to msaaSamples), or none. A record for the settings screen and the probe: the renderer reads the fields, never this, so a field the game sets after the preset is drawn as set.
|
|
4192
|
+
*/
|
|
4193
|
+
quality: QualityPreset;
|
|
4194
|
+
/**
|
|
4195
|
+
* Rect lights whose castShadow is on cast their soft shadows; false draws every rect light unshadowed, each keeping its castShadow for when this is on again. The low preset turns it off: a rect light's shadow is the costliest light in the frame.
|
|
4196
|
+
*
|
|
4197
|
+
* @default true
|
|
4198
|
+
*/
|
|
4199
|
+
rectShadows: boolean;
|
|
4200
|
+
/**
|
|
4201
|
+
* At most this many point, spot and rect lights cast shadows in a frame, the brightest at the camera kept (RenderCapabilities.shadowedLights caps it); 0 casts none. The directional light's cascades are not counted.
|
|
4202
|
+
*
|
|
4203
|
+
* @default 8
|
|
4204
|
+
* @range 0..8
|
|
4205
|
+
*/
|
|
4206
|
+
shadowedLights: number;
|
|
4207
|
+
/**
|
|
4208
|
+
* The shadow maps at this fraction of their full side: the directional light's cascades (2048 texels by default) and the local lights' layers (512), each kept within 64 texels and the device's limit (4096 for the cascades). Changing it makes the maps again at the next frame; RenderCapabilities.shadowMapSize is the cascades' side drawn.
|
|
4209
|
+
*
|
|
4210
|
+
* @default 1
|
|
4211
|
+
* @range 0.125..4
|
|
4212
|
+
*/
|
|
4213
|
+
shadowMapScale: number;
|
|
4214
|
+
/**
|
|
4215
|
+
* An og.VolumetricFog is drawn lit, with its light shafts; false draws the same medium as plain distance and height fog.
|
|
4216
|
+
*
|
|
4217
|
+
* @default true
|
|
4218
|
+
*/
|
|
4219
|
+
volumetricFog: boolean;
|
|
4220
|
+
/**
|
|
4221
|
+
* Particles with a softDistance fade against the scene behind them; false draws them hard-edged and asks no depth prepass for them.
|
|
4222
|
+
*
|
|
4223
|
+
* @default true
|
|
4224
|
+
*/
|
|
4225
|
+
softParticles: boolean;
|
|
4226
|
+
/**
|
|
4227
|
+
* PostEffects.ssr draws (on the full tier); false leaves smooth surfaces the reflection probes' and the environment's reflection. PostEffects keeps its settings either way.
|
|
4228
|
+
*
|
|
4229
|
+
* @default true
|
|
4230
|
+
*/
|
|
4231
|
+
screenSpaceReflections: boolean;
|
|
4232
|
+
/**
|
|
4233
|
+
* PostEffects.ao darkens creases; false draws none. PostEffects keeps its settings either way.
|
|
4234
|
+
*
|
|
4235
|
+
* @default true
|
|
4236
|
+
*/
|
|
4237
|
+
ambientOcclusion: boolean;
|
|
4238
|
+
/**
|
|
4239
|
+
* Samples per pixel where the antialiasing multisamples (msaa, the WebGL2 tier's choice; RenderCapabilities.antialias): 4, or 1, which draws FXAA instead. TAA, FXAA and no antialiasing take one sample whatever it says. Changing it makes the multisampled targets and pipelines again at the next frame.
|
|
4240
|
+
*
|
|
4241
|
+
* @default 4
|
|
4242
|
+
* @range 1..4
|
|
4243
|
+
*/
|
|
4244
|
+
msaaSamples: number;
|
|
4131
4245
|
}
|
|
4132
4246
|
|
|
4133
4247
|
/**
|
|
@@ -4617,23 +4731,11 @@ export interface PostEffects {
|
|
|
4617
4731
|
*/
|
|
4618
4732
|
ssrIntensity: number;
|
|
4619
4733
|
/**
|
|
4620
|
-
* The
|
|
4734
|
+
* The custom post passes, in order (og.load.post, `type post` assets): at most RenderCapabilities.maxCustomPosts (8, og-render's MAX_CUSTOM_POSTS). Each runs over the one before it (the lit image for the first), after depth of field and motion blur and before exposure, bloom and the tone curve, and reads the lit image, depth and normals too (any pass turns the prepass on). Write the whole list: `post.custom = [grade, crt]`, `post.custom = []`; a look gives it on one line (`custom "post/tint.ogt" "post/crt.ogt"`). A 0 in it is skipped. Its parameters are set with og.render.setPostParam. A pass the device fails to compile is reported (og.render.postErrors) and skipped.
|
|
4735
|
+
*
|
|
4736
|
+
* @capacity 8 elements (List.Post.8): reading answers a frozen copy (push throws); write a whole array, refused over the capacity, never truncated
|
|
4621
4737
|
*/
|
|
4622
|
-
|
|
4623
|
-
/** The second custom post pass, over the first's output (0 skips the slot). */
|
|
4624
|
-
custom2: Post;
|
|
4625
|
-
/** The third custom post pass. */
|
|
4626
|
-
custom3: Post;
|
|
4627
|
-
/** The fourth custom post pass. */
|
|
4628
|
-
custom4: Post;
|
|
4629
|
-
/** The fifth custom post pass. */
|
|
4630
|
-
custom5: Post;
|
|
4631
|
-
/** The sixth custom post pass. */
|
|
4632
|
-
custom6: Post;
|
|
4633
|
-
/** The seventh custom post pass. */
|
|
4634
|
-
custom7: Post;
|
|
4635
|
-
/** The eighth and last custom post pass, over every one before it. */
|
|
4636
|
-
custom8: Post;
|
|
4738
|
+
custom: readonly Post[];
|
|
4637
4739
|
}
|
|
4638
4740
|
|
|
4639
4741
|
/**
|
|
@@ -6323,7 +6425,7 @@ export interface RenderCapabilities {
|
|
|
6323
6425
|
/** The largest side of a render target (the device's largest 2D texture). */
|
|
6324
6426
|
readonly maxRenderTargetSize: number;
|
|
6325
6427
|
/**
|
|
6326
|
-
* The most custom post passes a frame runs: 8 on every tier, PostEffects.
|
|
6428
|
+
* The most custom post passes a frame runs: 8 on every tier, PostEffects.custom's capacity.
|
|
6327
6429
|
*/
|
|
6328
6430
|
readonly maxCustomPosts: number;
|
|
6329
6431
|
/**
|
|
@@ -6339,9 +6441,17 @@ export interface RenderCapabilities {
|
|
|
6339
6441
|
*/
|
|
6340
6442
|
readonly maxLightCookies: number;
|
|
6341
6443
|
/**
|
|
6342
|
-
* Whether the device times each render pass on the GPU (timestamp queries: Vulkan, Metal and D3D12 adapters that have them, WebGPU with `timestamp-query`; never WebGL2): ProbeTimings.gpuPasses and the trace's gpu thread are filled only where it is true.
|
|
6444
|
+
* Whether the device times each render pass on the GPU (timestamp queries: Vulkan, Metal and D3D12 adapters that have them, WebGPU with `timestamp-query`; never WebGL2, and never in a publish build, which leaves the queries out): ProbeTimings.gpuPasses and the trace's gpu thread are filled only where it is true.
|
|
6343
6445
|
*/
|
|
6344
6446
|
readonly gpuTimestamps: boolean;
|
|
6447
|
+
/**
|
|
6448
|
+
* The anisotropic filtering of sprites and og.ui's images (text is not filtered anisotropically: its distance field would lose its edge): 16 where the device filters anisotropically (WebGPU, Vulkan, Metal, WebGL2 with EXT_texture_filter_anisotropic), 1 where it has none and on a software rasterizer (the vulkan-cpu tier: lavapipe's anisotropic filter softens even an image drawn 1:1), 0 without a renderer. Above 1, an image squeezed along one axis keeps the other axis's detail: a style's nine-slice middle squeezed into a short button keeps its outline as crisp as the corners. At 1 the squeezed piece reads a smaller mip level and blurs; og.ui bounds a middle's squeeze at twice its art, so the outline there is one mip level softer than the corners.
|
|
6449
|
+
*/
|
|
6450
|
+
readonly spriteAnisotropy: number;
|
|
6451
|
+
/**
|
|
6452
|
+
* Whether the renderer draws the 3D world subsystems: terrain, planar water (og.Water), the 3D fluids, scattered copies and volumetric fog. False in the 2D profile's publish and lanes modules, which leave them out (a scene's are not drawn, og.terrain's calls and a SHAPE_HEIGHTFIELD collider answer a refusal naming this field, and `og build --publish` refuses a 2D project whose scenes hold og.Terrain, og.TerrainScatter, og.Water, og.WaterSurface or og.Fluid3D, by scene file and line); true in the 3D modules, the dev module and the native host.
|
|
6453
|
+
*/
|
|
6454
|
+
readonly world3d: boolean;
|
|
6345
6455
|
}
|
|
6346
6456
|
|
|
6347
6457
|
/**
|
|
@@ -6436,6 +6546,7 @@ export type Shader = number & { readonly [handleType]: "Shader" };
|
|
|
6436
6546
|
|
|
6437
6547
|
|
|
6438
6548
|
|
|
6549
|
+
|
|
6439
6550
|
/**
|
|
6440
6551
|
* Geometry from attribute arrays, as three.js BufferGeometry with its attributes set: one item per vertex in each array, triangles three indices each (or, with no indices, every three vertices).
|
|
6441
6552
|
* Missing normals are computed, as three.js computeVertexNormals (each vertex the area-weighted sum of its triangles' normals: shared vertices shade smooth, an unindexed geometry flat); missing tangents are generated when a normal map needs them. An unindexed geometry whose vertex count is not a multiple of three has no triangles: it draws nothing as an og.Mesh and is a vertex set for og.Lines and og.Points.
|
|
@@ -6704,152 +6815,667 @@ export interface TorusGeometryDesc {
|
|
|
6704
6815
|
* @default 48
|
|
6705
6816
|
* @range 3..
|
|
6706
6817
|
*/
|
|
6707
|
-
readonly tubularSegments?: number;
|
|
6818
|
+
readonly tubularSegments?: number;
|
|
6819
|
+
/**
|
|
6820
|
+
* How far around the ring goes.
|
|
6821
|
+
*
|
|
6822
|
+
* @default 6.283185307179586
|
|
6823
|
+
* @unit rad (radians)
|
|
6824
|
+
*/
|
|
6825
|
+
readonly arc?: number;
|
|
6826
|
+
}
|
|
6827
|
+
|
|
6828
|
+
/**
|
|
6829
|
+
* A flat ring in the xy plane facing +Z, as three.js RingGeometry(innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength).
|
|
6830
|
+
*
|
|
6831
|
+
* A desc: every field may be omitted and then takes its documented default; `{}` is valid.
|
|
6832
|
+
*/
|
|
6833
|
+
export interface RingGeometryDesc {
|
|
6834
|
+
/**
|
|
6835
|
+
* The hole's radius.
|
|
6836
|
+
*
|
|
6837
|
+
* @default 0.5
|
|
6838
|
+
* @range 0..
|
|
6839
|
+
* @unit m (metres)
|
|
6840
|
+
*/
|
|
6841
|
+
readonly innerRadius?: number;
|
|
6842
|
+
/**
|
|
6843
|
+
* The ring's radius.
|
|
6844
|
+
*
|
|
6845
|
+
* @default 1
|
|
6846
|
+
* @range 0..
|
|
6847
|
+
* @unit m (metres)
|
|
6848
|
+
*/
|
|
6849
|
+
readonly outerRadius?: number;
|
|
6850
|
+
/**
|
|
6851
|
+
* Segments around.
|
|
6852
|
+
*
|
|
6853
|
+
* @default 32
|
|
6854
|
+
* @range 3..
|
|
6855
|
+
*/
|
|
6856
|
+
readonly thetaSegments?: number;
|
|
6857
|
+
/**
|
|
6858
|
+
* Rings from the inside out.
|
|
6859
|
+
*
|
|
6860
|
+
* @default 1
|
|
6861
|
+
* @range 1..
|
|
6862
|
+
*/
|
|
6863
|
+
readonly phiSegments?: number;
|
|
6864
|
+
/**
|
|
6865
|
+
* Where it starts, from +X towards +Y.
|
|
6866
|
+
*
|
|
6867
|
+
* @default 0
|
|
6868
|
+
* @unit rad (radians)
|
|
6869
|
+
*/
|
|
6870
|
+
readonly thetaStart?: number;
|
|
6871
|
+
/**
|
|
6872
|
+
* How far around it goes.
|
|
6873
|
+
*
|
|
6874
|
+
* @default 6.283185307179586
|
|
6875
|
+
* @unit rad (radians)
|
|
6876
|
+
*/
|
|
6877
|
+
readonly thetaLength?: number;
|
|
6878
|
+
}
|
|
6879
|
+
|
|
6880
|
+
/**
|
|
6881
|
+
* A disc (or a sector) in the xy plane facing +Z, as three.js CircleGeometry(radius, segments, thetaStart, thetaLength): a 2D polygon's simplest shape.
|
|
6882
|
+
*
|
|
6883
|
+
* A desc: every field may be omitted and then takes its documented default; `{}` is valid.
|
|
6884
|
+
*/
|
|
6885
|
+
export interface CircleGeometryDesc {
|
|
6886
|
+
/**
|
|
6887
|
+
* The radius.
|
|
6888
|
+
*
|
|
6889
|
+
* @default 1
|
|
6890
|
+
* @range 0..
|
|
6891
|
+
* @unit m (metres)
|
|
6892
|
+
*/
|
|
6893
|
+
readonly radius?: number;
|
|
6894
|
+
/**
|
|
6895
|
+
* Segments around.
|
|
6896
|
+
*
|
|
6897
|
+
* @default 32
|
|
6898
|
+
* @range 3..
|
|
6899
|
+
*/
|
|
6900
|
+
readonly segments?: number;
|
|
6901
|
+
/**
|
|
6902
|
+
* Where it starts, from +X towards +Y.
|
|
6903
|
+
*
|
|
6904
|
+
* @default 0
|
|
6905
|
+
* @unit rad (radians)
|
|
6906
|
+
*/
|
|
6907
|
+
readonly thetaStart?: number;
|
|
6908
|
+
/**
|
|
6909
|
+
* How far around it goes.
|
|
6910
|
+
*
|
|
6911
|
+
* @default 6.283185307179586
|
|
6912
|
+
* @unit rad (radians)
|
|
6913
|
+
*/
|
|
6914
|
+
readonly thetaLength?: number;
|
|
6915
|
+
}
|
|
6916
|
+
|
|
6917
|
+
/**
|
|
6918
|
+
* A tube along a curve, as three.js TubeGeometry(curve, tubularSegments, radius, radialSegments, closed): its rings are evenly spaced along the curve's length (three.js getPointAt), u runs along it, v around. The curve is `path` when set (an og.path, whatever its kind, followed exactly: a scene's or a timeline's path becomes a tube), otherwise new CatmullRomCurve3(points, closed, 'centripetal') through `points`, which may come from anywhere: a rope's points, a spline a tool made.
|
|
6919
|
+
*
|
|
6920
|
+
* A desc: every field may be omitted and then takes its documented default; `{}` is valid.
|
|
6921
|
+
*/
|
|
6922
|
+
export interface TubeGeometryDesc {
|
|
6923
|
+
/**
|
|
6924
|
+
* The points the curve passes through, in order (at least two), when `path` is 0.
|
|
6925
|
+
*
|
|
6926
|
+
* @default []
|
|
6927
|
+
* @unit m (metres)
|
|
6928
|
+
*/
|
|
6929
|
+
readonly points?: readonly Vector3[];
|
|
6930
|
+
/**
|
|
6931
|
+
* A path (og.path.create, or a scene's `path` by og.path.find) the tube follows instead of the points: its own curve, kind and closed flag (`closed` is the path's then). 0 uses the points.
|
|
6932
|
+
*
|
|
6933
|
+
* @default 0
|
|
6934
|
+
*/
|
|
6935
|
+
readonly path?: Path;
|
|
6936
|
+
/**
|
|
6937
|
+
* Segments along the tube.
|
|
6938
|
+
*
|
|
6939
|
+
* @default 64
|
|
6940
|
+
* @range 1..
|
|
6941
|
+
*/
|
|
6942
|
+
readonly tubularSegments?: number;
|
|
6943
|
+
/**
|
|
6944
|
+
* The tube's radius.
|
|
6945
|
+
*
|
|
6946
|
+
* @default 1
|
|
6947
|
+
* @range 0..
|
|
6948
|
+
* @unit m (metres)
|
|
6949
|
+
*/
|
|
6950
|
+
readonly radius?: number;
|
|
6951
|
+
/**
|
|
6952
|
+
* Segments around it.
|
|
6953
|
+
*
|
|
6954
|
+
* @default 8
|
|
6955
|
+
* @range 3..
|
|
6956
|
+
*/
|
|
6957
|
+
readonly radialSegments?: number;
|
|
6958
|
+
/**
|
|
6959
|
+
* Join the last point back to the first.
|
|
6960
|
+
*
|
|
6961
|
+
* @default false
|
|
6962
|
+
*/
|
|
6963
|
+
readonly closed?: boolean;
|
|
6964
|
+
}
|
|
6965
|
+
|
|
6966
|
+
|
|
6967
|
+
|
|
6968
|
+
|
|
6969
|
+
|
|
6970
|
+
|
|
6971
|
+
|
|
6972
|
+
|
|
6973
|
+
/**
|
|
6974
|
+
* A shape as points, what og.Shape.extractPoints returns and what shapeGeometry, extrudeGeometry and sweepGeometry read: the outline, then each hole. A repeated closing point is dropped, as three.js drops it.
|
|
6975
|
+
*/
|
|
6976
|
+
export interface ShapePoints {
|
|
6977
|
+
/** The outline's points, in order. */
|
|
6978
|
+
readonly shape: readonly Vector2[];
|
|
6979
|
+
/** Each hole's points, in order. */
|
|
6980
|
+
readonly holes: readonly (readonly Vector2[])[];
|
|
6981
|
+
}
|
|
6982
|
+
|
|
6983
|
+
/**
|
|
6984
|
+
* A flat shape with holes in the xy plane facing +Z, as three.js ShapeGeometry(shapes, curveSegments): triangulated by earcut (three.js's own port), the outline made clockwise and the holes counter-clockwise first, so its vertices and triangles are three.js's for the same shape. uvs are world x and y (v flipped to run down the image).
|
|
6985
|
+
*
|
|
6986
|
+
* A desc: every field may be omitted and then takes its documented default; `{}` is valid.
|
|
6987
|
+
*/
|
|
6988
|
+
export interface ShapeGeometryDesc {
|
|
6989
|
+
/**
|
|
6990
|
+
* One og.Shape (an og.Path2 is a shape without holes), a list of them, or the outline's points. Without it, three.js's default triangle (0, 0.5), (-0.5, -0.5), (0.5, -0.5).
|
|
6991
|
+
*
|
|
6992
|
+
* @default null
|
|
6993
|
+
*/
|
|
6994
|
+
readonly shapes?: Path2 | readonly Path2[] | readonly Vector2[] | null;
|
|
6995
|
+
/**
|
|
6996
|
+
* Points per curve when an og.Shape's curves are flattened (three.js extractPoints(curveSegments); an ellipse takes twice as many, a spline as many per point).
|
|
6997
|
+
*
|
|
6998
|
+
* @default 12
|
|
6999
|
+
* @range 1..
|
|
7000
|
+
*/
|
|
7001
|
+
readonly curveSegments?: number;
|
|
7002
|
+
/**
|
|
7003
|
+
* How many times a texture repeats across it, along u and v: its UVs scaled by uvRepeat (three.js texture.repeat, here on the geometry; material textures sample with repeat wrapping).
|
|
7004
|
+
*
|
|
7005
|
+
* @default { x: 1, y: 1 }
|
|
7006
|
+
*/
|
|
7007
|
+
readonly uvRepeat?: Vector2;
|
|
7008
|
+
/**
|
|
7009
|
+
* Register it as a physics mesh too (BufferGeometryDesc.physics).
|
|
7010
|
+
*
|
|
7011
|
+
* @default true
|
|
7012
|
+
*/
|
|
7013
|
+
readonly physics?: boolean;
|
|
7014
|
+
/**
|
|
7015
|
+
* Whether og.render.updateGeometry may rewrite it later (BufferGeometryDesc.dynamic).
|
|
7016
|
+
*
|
|
7017
|
+
* @default false
|
|
7018
|
+
*/
|
|
7019
|
+
readonly dynamic?: boolean;
|
|
7020
|
+
}
|
|
7021
|
+
|
|
7022
|
+
/**
|
|
7023
|
+
* Shapes pushed along +Z, or along a path, as three.js ExtrudeGeometry(shapes, options) with its option names and defaults: a closed solid, its lids from earcut and its walls ring by ring, rounded by a bevel of bevelSegments rings at each face. Unindexed as three.js's (every triangle its own vertices, flat normals), three.js's vertex order and counts; uvs from three.js's WorldUVGenerator (v flipped to run down the image).
|
|
7024
|
+
*
|
|
7025
|
+
* A desc: every field may be omitted and then takes its documented default; `{}` is valid.
|
|
7026
|
+
*/
|
|
7027
|
+
export interface ExtrudeGeometryDesc {
|
|
7028
|
+
/**
|
|
7029
|
+
* One og.Shape, a list of them, or the outline's points. Without it, three.js's default square of side 1.
|
|
7030
|
+
*
|
|
7031
|
+
* @default null
|
|
7032
|
+
*/
|
|
7033
|
+
readonly shapes?: Path2 | readonly Path2[] | readonly Vector2[] | null;
|
|
7034
|
+
/**
|
|
7035
|
+
* How far the shape is pushed along +Z (without extrudePath).
|
|
7036
|
+
*
|
|
7037
|
+
* @default 1
|
|
7038
|
+
* @range 0..
|
|
7039
|
+
* @unit m (metres)
|
|
7040
|
+
*/
|
|
7041
|
+
readonly depth?: number;
|
|
7042
|
+
/**
|
|
7043
|
+
* Rings along the depth or the path.
|
|
7044
|
+
*
|
|
7045
|
+
* @default 1
|
|
7046
|
+
* @range 1..
|
|
7047
|
+
*/
|
|
7048
|
+
readonly steps?: number;
|
|
7049
|
+
/**
|
|
7050
|
+
* Round the edges of both faces.
|
|
7051
|
+
*
|
|
7052
|
+
* @default true
|
|
7053
|
+
*/
|
|
7054
|
+
readonly bevelEnabled?: boolean;
|
|
7055
|
+
/**
|
|
7056
|
+
* How far the bevel reaches beyond each face, along z.
|
|
7057
|
+
*
|
|
7058
|
+
* @default 0.2
|
|
7059
|
+
* @range 0..
|
|
7060
|
+
* @unit m (metres)
|
|
7061
|
+
*/
|
|
7062
|
+
readonly bevelThickness?: number;
|
|
7063
|
+
/**
|
|
7064
|
+
* How far the bevel reaches out from the outline. Null or unset, bevelThickness - 0.1, as three.js derives it (0.1 at the default thickness, 0 at a thickness of 0.1).
|
|
7065
|
+
*
|
|
7066
|
+
* @default null
|
|
7067
|
+
* @unit m (metres)
|
|
7068
|
+
*/
|
|
7069
|
+
readonly bevelSize?: number | null;
|
|
7070
|
+
/**
|
|
7071
|
+
* How far the bevel starts out from the outline.
|
|
7072
|
+
*
|
|
7073
|
+
* @default 0
|
|
7074
|
+
* @unit m (metres)
|
|
7075
|
+
*/
|
|
7076
|
+
readonly bevelOffset?: number;
|
|
7077
|
+
/**
|
|
7078
|
+
* Rings in each bevel.
|
|
7079
|
+
*
|
|
7080
|
+
* @default 3
|
|
7081
|
+
* @range 1..
|
|
7082
|
+
*/
|
|
7083
|
+
readonly bevelSegments?: number;
|
|
7084
|
+
/**
|
|
7085
|
+
* Points per curve when an og.Shape's curves are flattened.
|
|
7086
|
+
*
|
|
7087
|
+
* @default 12
|
|
7088
|
+
* @range 1..
|
|
7089
|
+
*/
|
|
7090
|
+
readonly curveSegments?: number;
|
|
7091
|
+
/**
|
|
7092
|
+
* A path (og.path.create or og.path.find) to extrude along instead of +Z: the shape's x along the path's normal and y along its binormal (three.js's Frenet frames), steps rings evenly spaced along it. A path turns the bevel off, as three.js. 0 extrudes along +Z.
|
|
7093
|
+
*
|
|
7094
|
+
* @default 0
|
|
7095
|
+
*/
|
|
7096
|
+
readonly extrudePath?: Path;
|
|
7097
|
+
/**
|
|
7098
|
+
* How many times a texture repeats across it, along u and v: its UVs scaled by uvRepeat (three.js texture.repeat, here on the geometry; material textures sample with repeat wrapping).
|
|
7099
|
+
*
|
|
7100
|
+
* @default { x: 1, y: 1 }
|
|
7101
|
+
*/
|
|
7102
|
+
readonly uvRepeat?: Vector2;
|
|
7103
|
+
/**
|
|
7104
|
+
* Register it as a physics mesh too.
|
|
7105
|
+
*
|
|
7106
|
+
* @default true
|
|
7107
|
+
*/
|
|
7108
|
+
readonly physics?: boolean;
|
|
7109
|
+
/**
|
|
7110
|
+
* Whether og.render.updateGeometry may rewrite it later.
|
|
7111
|
+
*
|
|
7112
|
+
* @default false
|
|
7113
|
+
*/
|
|
7114
|
+
readonly dynamic?: boolean;
|
|
7115
|
+
}
|
|
7116
|
+
|
|
7117
|
+
/**
|
|
7118
|
+
* A profile turned round +Y, as three.js LatheGeometry(points, segments, phiStart, phiLength): vases, bottles, columns, wheels. three.js's vertices, indices and smooth normals; u round the axis, v along the profile (flipped to run down the image). A whole turn's seam meets exactly.
|
|
7119
|
+
*
|
|
7120
|
+
* A desc: every field may be omitted and then takes its documented default; `{}` is valid.
|
|
7121
|
+
*/
|
|
7122
|
+
export interface LatheGeometryDesc {
|
|
7123
|
+
/**
|
|
7124
|
+
* The profile, x the distance from the axis and y the height, in order (at least two). Without it, three.js's default (0, -0.5), (0.5, 0), (0, 0.5).
|
|
7125
|
+
*
|
|
7126
|
+
* @default []
|
|
7127
|
+
* @unit m (metres)
|
|
7128
|
+
*/
|
|
7129
|
+
readonly points?: readonly Vector2[];
|
|
7130
|
+
/**
|
|
7131
|
+
* Segments round the axis.
|
|
7132
|
+
*
|
|
7133
|
+
* @default 12
|
|
7134
|
+
* @range 1..
|
|
7135
|
+
*/
|
|
7136
|
+
readonly segments?: number;
|
|
7137
|
+
/**
|
|
7138
|
+
* Where the turn starts, from +Z towards +X.
|
|
7139
|
+
*
|
|
7140
|
+
* @default 0
|
|
7141
|
+
* @unit rad (radians)
|
|
7142
|
+
*/
|
|
7143
|
+
readonly phiStart?: number;
|
|
7144
|
+
/**
|
|
7145
|
+
* How far it turns; 2 pi is whole (clamped to it).
|
|
7146
|
+
*
|
|
7147
|
+
* @default 6.283185307179586
|
|
7148
|
+
* @unit rad (radians)
|
|
7149
|
+
*/
|
|
7150
|
+
readonly phiLength?: number;
|
|
7151
|
+
/**
|
|
7152
|
+
* How many times a texture repeats across it, along u and v: its UVs scaled by uvRepeat (three.js texture.repeat, here on the geometry; material textures sample with repeat wrapping).
|
|
7153
|
+
*
|
|
7154
|
+
* @default { x: 1, y: 1 }
|
|
7155
|
+
*/
|
|
7156
|
+
readonly uvRepeat?: Vector2;
|
|
7157
|
+
/**
|
|
7158
|
+
* Register it as a physics mesh too.
|
|
7159
|
+
*
|
|
7160
|
+
* @default true
|
|
7161
|
+
*/
|
|
7162
|
+
readonly physics?: boolean;
|
|
7163
|
+
/**
|
|
7164
|
+
* Whether og.render.updateGeometry may rewrite it later.
|
|
7165
|
+
*
|
|
7166
|
+
* @default false
|
|
7167
|
+
*/
|
|
7168
|
+
readonly dynamic?: boolean;
|
|
7169
|
+
}
|
|
7170
|
+
|
|
7171
|
+
/**
|
|
7172
|
+
* A polyhedron from vertices and faces, every face subdivided `detail` times and every vertex pushed onto the sphere of `radius`, as three.js PolyhedronGeometry(vertices, indices, radius, detail): unindexed, flat normals at detail 0 and the sphere's above, three.js's spherical uvs.
|
|
7173
|
+
*
|
|
7174
|
+
* A desc: every field may be omitted and then takes its documented default; `{}` is valid.
|
|
7175
|
+
*/
|
|
7176
|
+
export interface PolyhedronGeometryDesc {
|
|
7177
|
+
/**
|
|
7178
|
+
* The corners, x y z each (three.js's flat array).
|
|
7179
|
+
*
|
|
7180
|
+
* @default []
|
|
7181
|
+
*/
|
|
7182
|
+
readonly vertices?: readonly number[];
|
|
7183
|
+
/**
|
|
7184
|
+
* The faces, three corner indices each, counter-clockwise seen from outside.
|
|
7185
|
+
*
|
|
7186
|
+
* @default []
|
|
7187
|
+
*/
|
|
7188
|
+
readonly indices?: readonly number[];
|
|
7189
|
+
/**
|
|
7190
|
+
* The sphere the vertices are pushed onto.
|
|
7191
|
+
*
|
|
7192
|
+
* @default 1
|
|
7193
|
+
* @range 0..
|
|
7194
|
+
* @unit m (metres)
|
|
7195
|
+
*/
|
|
7196
|
+
readonly radius?: number;
|
|
7197
|
+
/**
|
|
7198
|
+
* Subdivisions of each face: (detail + 1)² triangles a face.
|
|
7199
|
+
*
|
|
7200
|
+
* @default 0
|
|
7201
|
+
* @range ..64
|
|
7202
|
+
*/
|
|
7203
|
+
readonly detail?: number;
|
|
7204
|
+
/**
|
|
7205
|
+
* How many times a texture repeats across it, along u and v: its UVs scaled by uvRepeat (three.js texture.repeat, here on the geometry; material textures sample with repeat wrapping).
|
|
7206
|
+
*
|
|
7207
|
+
* @default { x: 1, y: 1 }
|
|
7208
|
+
*/
|
|
7209
|
+
readonly uvRepeat?: Vector2;
|
|
7210
|
+
/**
|
|
7211
|
+
* Register it as a physics mesh too.
|
|
7212
|
+
*
|
|
7213
|
+
* @default true
|
|
7214
|
+
*/
|
|
7215
|
+
readonly physics?: boolean;
|
|
7216
|
+
/**
|
|
7217
|
+
* Whether og.render.updateGeometry may rewrite it later.
|
|
7218
|
+
*
|
|
7219
|
+
* @default false
|
|
7220
|
+
*/
|
|
7221
|
+
readonly dynamic?: boolean;
|
|
7222
|
+
}
|
|
7223
|
+
|
|
7224
|
+
/**
|
|
7225
|
+
* A regular solid, as three.js IcosahedronGeometry, DodecahedronGeometry, OctahedronGeometry and TetrahedronGeometry(radius, detail): PolyhedronGeometryDesc with the solid's own vertices and faces. An icosahedron at detail 2 or more is a sphere with even triangles.
|
|
7226
|
+
*
|
|
7227
|
+
* A desc: every field may be omitted and then takes its documented default; `{}` is valid.
|
|
7228
|
+
*/
|
|
7229
|
+
export interface SolidGeometryDesc {
|
|
7230
|
+
/**
|
|
7231
|
+
* The radius.
|
|
7232
|
+
*
|
|
7233
|
+
* @default 1
|
|
7234
|
+
* @range 0..
|
|
7235
|
+
* @unit m (metres)
|
|
7236
|
+
*/
|
|
7237
|
+
readonly radius?: number;
|
|
7238
|
+
/**
|
|
7239
|
+
* Subdivisions of each face.
|
|
7240
|
+
*
|
|
7241
|
+
* @default 0
|
|
7242
|
+
* @range ..64
|
|
7243
|
+
*/
|
|
7244
|
+
readonly detail?: number;
|
|
7245
|
+
/**
|
|
7246
|
+
* How many times a texture repeats across it, along u and v: its UVs scaled by uvRepeat (three.js texture.repeat, here on the geometry; material textures sample with repeat wrapping).
|
|
7247
|
+
*
|
|
7248
|
+
* @default { x: 1, y: 1 }
|
|
7249
|
+
*/
|
|
7250
|
+
readonly uvRepeat?: Vector2;
|
|
7251
|
+
/**
|
|
7252
|
+
* Register it as a physics mesh too.
|
|
7253
|
+
*
|
|
7254
|
+
* @default true
|
|
7255
|
+
*/
|
|
7256
|
+
readonly physics?: boolean;
|
|
7257
|
+
/**
|
|
7258
|
+
* Whether og.render.updateGeometry may rewrite it later.
|
|
7259
|
+
*
|
|
7260
|
+
* @default false
|
|
7261
|
+
*/
|
|
7262
|
+
readonly dynamic?: boolean;
|
|
7263
|
+
}
|
|
7264
|
+
|
|
7265
|
+
/**
|
|
7266
|
+
* A value at a fraction of a sweep's path: linear between keys, held before the first and past the last.
|
|
7267
|
+
*/
|
|
7268
|
+
export interface SweepKey {
|
|
7269
|
+
/**
|
|
7270
|
+
* The fraction of the path's length, 0 to 1.
|
|
7271
|
+
*
|
|
7272
|
+
* @unit ratio (a fraction between 0 and 1)
|
|
7273
|
+
*/
|
|
7274
|
+
readonly t: number;
|
|
7275
|
+
/** The value there. */
|
|
7276
|
+
readonly value: number;
|
|
7277
|
+
}
|
|
7278
|
+
|
|
7279
|
+
/**
|
|
7280
|
+
* A section swept along a path, scaled and twisted over it: horns, tusks, handles, blades, tapered pipes, twisted columns (img2threejs's tapered sweep; three.js has no class for it). The section's x lies along the path's normal and y along its binormal (three.js's Frenet frames), rings evenly spaced along the path's length; u runs along the path, v round the section (flipped to run down the image), the sides smooth. An open path's ends are capped.
|
|
7281
|
+
*
|
|
7282
|
+
* A desc: every field may be omitted and then takes its documented default; `{}` is valid.
|
|
7283
|
+
*/
|
|
7284
|
+
export interface SweepGeometryDesc {
|
|
7285
|
+
/**
|
|
7286
|
+
* The section's outline: an og.Shape or og.Path2 (flattened by curveSegments; holes are not swept) or its points, at least three, either winding.
|
|
7287
|
+
*
|
|
7288
|
+
* @default null
|
|
7289
|
+
*/
|
|
7290
|
+
readonly section?: Path2 | readonly Vector2[] | null;
|
|
7291
|
+
/**
|
|
7292
|
+
* The path (og.path.create or og.path.find).
|
|
7293
|
+
*
|
|
7294
|
+
* @default 0
|
|
7295
|
+
*/
|
|
7296
|
+
readonly path?: Path;
|
|
7297
|
+
/**
|
|
7298
|
+
* Rings along the path, less one.
|
|
7299
|
+
*
|
|
7300
|
+
* @default 64
|
|
7301
|
+
* @range 1..
|
|
7302
|
+
*/
|
|
7303
|
+
readonly steps?: number;
|
|
7304
|
+
/**
|
|
7305
|
+
* The section's scale over the path (none: 1 throughout). A horn: [{ t: 0, value: 1 }, { t: 1, value: 0.05 }].
|
|
7306
|
+
*
|
|
7307
|
+
* @default []
|
|
7308
|
+
*/
|
|
7309
|
+
readonly scale?: readonly SweepKey[];
|
|
7310
|
+
/**
|
|
7311
|
+
* The section's turn round the path over its length, in radians (none: 0).
|
|
7312
|
+
*
|
|
7313
|
+
* @default []
|
|
7314
|
+
*/
|
|
7315
|
+
readonly twist?: readonly SweepKey[];
|
|
7316
|
+
/**
|
|
7317
|
+
* Close the ends of an open path.
|
|
7318
|
+
*
|
|
7319
|
+
* @default true
|
|
7320
|
+
*/
|
|
7321
|
+
readonly caps?: boolean;
|
|
7322
|
+
/**
|
|
7323
|
+
* Points per curve when an og.Shape section is flattened.
|
|
7324
|
+
*
|
|
7325
|
+
* @default 12
|
|
7326
|
+
* @range 1..
|
|
7327
|
+
*/
|
|
7328
|
+
readonly curveSegments?: number;
|
|
7329
|
+
/**
|
|
7330
|
+
* How many times a texture repeats across it, along u and v: its UVs scaled by uvRepeat (three.js texture.repeat, here on the geometry; material textures sample with repeat wrapping).
|
|
7331
|
+
*
|
|
7332
|
+
* @default { x: 1, y: 1 }
|
|
7333
|
+
*/
|
|
7334
|
+
readonly uvRepeat?: Vector2;
|
|
7335
|
+
/**
|
|
7336
|
+
* Register it as a physics mesh too.
|
|
7337
|
+
*
|
|
7338
|
+
* @default true
|
|
7339
|
+
*/
|
|
7340
|
+
readonly physics?: boolean;
|
|
6708
7341
|
/**
|
|
6709
|
-
*
|
|
7342
|
+
* Whether og.render.updateGeometry may rewrite it later.
|
|
6710
7343
|
*
|
|
6711
|
-
* @default
|
|
6712
|
-
* @unit rad (radians)
|
|
7344
|
+
* @default false
|
|
6713
7345
|
*/
|
|
6714
|
-
readonly
|
|
7346
|
+
readonly dynamic?: boolean;
|
|
6715
7347
|
}
|
|
6716
7348
|
|
|
6717
7349
|
/**
|
|
6718
|
-
*
|
|
7350
|
+
* The world axis a part is mirrored along, after its placement.
|
|
7351
|
+
* - `"none"`: Not mirrored.
|
|
7352
|
+
* - `"x"`: x negated: the mirror image across the yz plane.
|
|
7353
|
+
* - `"y"`: y negated: across the xz plane.
|
|
7354
|
+
* - `"z"`: z negated: across the xy plane.
|
|
7355
|
+
*/
|
|
7356
|
+
export type MirrorAxis = "none" | "x" | "y" | "z";
|
|
7357
|
+
|
|
7358
|
+
/**
|
|
7359
|
+
* A geometry placed as an Object3D is (scale, then rotate, then move), then mirrored: one part of og.render.mergeGeometries or an operand of og.render.csgGeometry.
|
|
6719
7360
|
*
|
|
6720
7361
|
* A desc: every field may be omitted and then takes its documented default; `{}` is valid.
|
|
6721
7362
|
*/
|
|
6722
|
-
export interface
|
|
7363
|
+
export interface GeometryPart {
|
|
6723
7364
|
/**
|
|
6724
|
-
*
|
|
7365
|
+
* Any geometry: made, a primitive or a loaded glTF's.
|
|
6725
7366
|
*
|
|
6726
|
-
* @default 0
|
|
6727
|
-
* @range 0..
|
|
6728
|
-
* @unit m (metres)
|
|
7367
|
+
* @default 0
|
|
6729
7368
|
*/
|
|
6730
|
-
readonly
|
|
7369
|
+
readonly geometry?: Geometry;
|
|
6731
7370
|
/**
|
|
6732
|
-
*
|
|
7371
|
+
* Where it goes.
|
|
6733
7372
|
*
|
|
6734
|
-
* @default
|
|
6735
|
-
* @range 0..
|
|
7373
|
+
* @default { x: 0, y: 0, z: 0 }
|
|
6736
7374
|
* @unit m (metres)
|
|
6737
7375
|
*/
|
|
6738
|
-
readonly
|
|
6739
|
-
/**
|
|
6740
|
-
* Segments around.
|
|
6741
|
-
*
|
|
6742
|
-
* @default 32
|
|
6743
|
-
* @range 3..
|
|
6744
|
-
*/
|
|
6745
|
-
readonly thetaSegments?: number;
|
|
7376
|
+
readonly position?: Vector3;
|
|
6746
7377
|
/**
|
|
6747
|
-
*
|
|
7378
|
+
* How it turns.
|
|
6748
7379
|
*
|
|
6749
|
-
* @default 1
|
|
6750
|
-
* @range 1..
|
|
7380
|
+
* @default { x: 0, y: 0, z: 0, w: 1 }
|
|
6751
7381
|
*/
|
|
6752
|
-
readonly
|
|
7382
|
+
readonly quaternion?: Quaternion;
|
|
6753
7383
|
/**
|
|
6754
|
-
*
|
|
7384
|
+
* Its scale (a negative component mirrors it as `mirror` does).
|
|
6755
7385
|
*
|
|
6756
|
-
* @default
|
|
6757
|
-
* @unit rad (radians)
|
|
7386
|
+
* @default { x: 1, y: 1, z: 1 }
|
|
6758
7387
|
*/
|
|
6759
|
-
readonly
|
|
7388
|
+
readonly scale?: Vector3;
|
|
6760
7389
|
/**
|
|
6761
|
-
*
|
|
7390
|
+
* Mirror it along a world axis after placing it: a symmetric prop is one half twice, the second mirrored.
|
|
6762
7391
|
*
|
|
6763
|
-
* @default
|
|
6764
|
-
* @unit rad (radians)
|
|
7392
|
+
* @default "none"
|
|
6765
7393
|
*/
|
|
6766
|
-
readonly
|
|
7394
|
+
readonly mirror?: MirrorAxis;
|
|
6767
7395
|
}
|
|
6768
7396
|
|
|
6769
7397
|
/**
|
|
6770
|
-
* A
|
|
7398
|
+
* A boolean operation on two solids.
|
|
7399
|
+
* - `"union"`: Everything in either: a + b.
|
|
7400
|
+
* - `"subtract"`: What of a is not in b: a - b (holes, notches, a dice's pips).
|
|
7401
|
+
* - `"intersect"`: What is in both.
|
|
7402
|
+
*/
|
|
7403
|
+
export type CsgOp = "union" | "subtract" | "intersect";
|
|
7404
|
+
|
|
7405
|
+
/**
|
|
7406
|
+
* Two closed geometries combined by a boolean operation, each placed first: a box with a hole bored through it, a dice, a window cut in a wall. The result is closed when both are (every edge shared by two triangles, wound opposite), every piece keeps its source's normals, uvs and colours (b's turned inside out where it is subtracted). Where a plane side or an edge crossing is decided, the decision is exact (Shewchuk's predicates), so every host makes the same cuts; faces that coincide keep one copy or none, as the operation says.
|
|
6771
7407
|
*
|
|
6772
7408
|
* A desc: every field may be omitted and then takes its documented default; `{}` is valid.
|
|
6773
7409
|
*/
|
|
6774
|
-
export interface
|
|
7410
|
+
export interface CsgGeometryDesc {
|
|
6775
7411
|
/**
|
|
6776
|
-
* The
|
|
7412
|
+
* The operation.
|
|
6777
7413
|
*
|
|
6778
|
-
* @default
|
|
6779
|
-
* @range 0..
|
|
6780
|
-
* @unit m (metres)
|
|
7414
|
+
* @default "union"
|
|
6781
7415
|
*/
|
|
6782
|
-
readonly
|
|
7416
|
+
readonly op?: CsgOp;
|
|
6783
7417
|
/**
|
|
6784
|
-
*
|
|
7418
|
+
* The first operand.
|
|
6785
7419
|
*
|
|
6786
|
-
* @default
|
|
6787
|
-
* @range 3..
|
|
7420
|
+
* @default {}
|
|
6788
7421
|
*/
|
|
6789
|
-
readonly
|
|
7422
|
+
readonly a?: GeometryPart;
|
|
6790
7423
|
/**
|
|
6791
|
-
*
|
|
7424
|
+
* The second operand.
|
|
6792
7425
|
*
|
|
6793
|
-
* @default
|
|
6794
|
-
* @unit rad (radians)
|
|
7426
|
+
* @default {}
|
|
6795
7427
|
*/
|
|
6796
|
-
readonly
|
|
7428
|
+
readonly b?: GeometryPart;
|
|
6797
7429
|
/**
|
|
6798
|
-
* How
|
|
7430
|
+
* How many times a texture repeats across it, along u and v: its UVs scaled by uvRepeat (three.js texture.repeat, here on the geometry; material textures sample with repeat wrapping).
|
|
6799
7431
|
*
|
|
6800
|
-
* @default
|
|
6801
|
-
* @unit rad (radians)
|
|
7432
|
+
* @default { x: 1, y: 1 }
|
|
6802
7433
|
*/
|
|
6803
|
-
readonly
|
|
7434
|
+
readonly uvRepeat?: Vector2;
|
|
7435
|
+
/**
|
|
7436
|
+
* Register it as a physics mesh too.
|
|
7437
|
+
*
|
|
7438
|
+
* @default true
|
|
7439
|
+
*/
|
|
7440
|
+
readonly physics?: boolean;
|
|
7441
|
+
/**
|
|
7442
|
+
* Whether og.render.updateGeometry may rewrite it later.
|
|
7443
|
+
*
|
|
7444
|
+
* @default false
|
|
7445
|
+
*/
|
|
7446
|
+
readonly dynamic?: boolean;
|
|
6804
7447
|
}
|
|
6805
7448
|
|
|
6806
7449
|
/**
|
|
6807
|
-
*
|
|
7450
|
+
* Geometries placed and merged into one, as three.js BufferGeometryUtils.mergeGeometries after applying each part's matrix: a prop of parts drawn in one draw, a mirrored half, an array (the same part at several placements). Normals follow each placement; a mirrored part turns its triangles so they still face out. Vertex colours are kept when any part has them.
|
|
6808
7451
|
*
|
|
6809
7452
|
* A desc: every field may be omitted and then takes its documented default; `{}` is valid.
|
|
6810
7453
|
*/
|
|
6811
|
-
export interface
|
|
7454
|
+
export interface MergeGeometriesDesc {
|
|
6812
7455
|
/**
|
|
6813
|
-
* The
|
|
7456
|
+
* The parts, in order (at least one).
|
|
6814
7457
|
*
|
|
6815
7458
|
* @default []
|
|
6816
|
-
* @unit m (metres)
|
|
6817
|
-
*/
|
|
6818
|
-
readonly points?: readonly Vector3[];
|
|
6819
|
-
/**
|
|
6820
|
-
* A path (og.path.create, or a scene's `path` by og.path.find) the tube follows instead of the points: its own curve, kind and closed flag (`closed` is the path's then). 0 uses the points.
|
|
6821
|
-
*
|
|
6822
|
-
* @default 0
|
|
6823
7459
|
*/
|
|
6824
|
-
readonly
|
|
6825
|
-
/**
|
|
6826
|
-
* Segments along the tube.
|
|
6827
|
-
*
|
|
6828
|
-
* @default 64
|
|
6829
|
-
* @range 1..
|
|
6830
|
-
*/
|
|
6831
|
-
readonly tubularSegments?: number;
|
|
7460
|
+
readonly parts?: readonly GeometryPart[];
|
|
6832
7461
|
/**
|
|
6833
|
-
*
|
|
7462
|
+
* How many times a texture repeats across it, along u and v: its UVs scaled by uvRepeat (three.js texture.repeat, here on the geometry; material textures sample with repeat wrapping).
|
|
6834
7463
|
*
|
|
6835
|
-
* @default 1
|
|
6836
|
-
* @range 0..
|
|
6837
|
-
* @unit m (metres)
|
|
7464
|
+
* @default { x: 1, y: 1 }
|
|
6838
7465
|
*/
|
|
6839
|
-
readonly
|
|
7466
|
+
readonly uvRepeat?: Vector2;
|
|
6840
7467
|
/**
|
|
6841
|
-
*
|
|
7468
|
+
* Register it as a physics mesh too.
|
|
6842
7469
|
*
|
|
6843
|
-
* @default
|
|
6844
|
-
* @range 3..
|
|
7470
|
+
* @default true
|
|
6845
7471
|
*/
|
|
6846
|
-
readonly
|
|
7472
|
+
readonly physics?: boolean;
|
|
6847
7473
|
/**
|
|
6848
|
-
*
|
|
7474
|
+
* Whether og.render.updateGeometry may rewrite it later.
|
|
6849
7475
|
*
|
|
6850
7476
|
* @default false
|
|
6851
7477
|
*/
|
|
6852
|
-
readonly
|
|
7478
|
+
readonly dynamic?: boolean;
|
|
6853
7479
|
}
|
|
6854
7480
|
|
|
6855
7481
|
|
|
@@ -6859,6 +7485,10 @@ export interface TubeGeometryDesc {
|
|
|
6859
7485
|
|
|
6860
7486
|
|
|
6861
7487
|
|
|
7488
|
+
|
|
7489
|
+
|
|
7490
|
+
|
|
7491
|
+
|
|
6862
7492
|
/**
|
|
6863
7493
|
* How a line set's points join, as three.js's three line objects.
|
|
6864
7494
|
* - `"strip"`: One polyline through every point, as three.js Line.
|
|
@@ -7578,6 +8208,165 @@ export interface BakedScene {
|
|
|
7578
8208
|
}
|
|
7579
8209
|
|
|
7580
8210
|
|
|
8211
|
+
// ── shapes ──────────────────────────────────────────────────────
|
|
8212
|
+
// Two-dimensional outlines in three.js's words: og.Shape and og.Path2 are three.js's Shape and Path, built by the same calls (moveTo, lineTo, quadraticCurveTo, bezierCurveTo, splineThru, arc, absarc, ellipse, absellipse, closePath) and flattened to points by getPoints, so a three.js outline is a paste. og.render.shapeGeometry, extrudeGeometry and sweepGeometry take them; only their points cross to the engine.
|
|
8213
|
+
// They are TypeScript values, not world state: make them in start or a command and let the geometry made from them be what the world keeps. Points come from basic arithmetic (no Math.sin), so they are the same on every host.
|
|
8214
|
+
// A prop of these parts belongs in an asset: an `.ogt` of `type model` names each part's geometry by its og.render call (`extrudeGeometry { shape { absarc 0 0 1 0 6.283185307179586 false } depth 0.2 }`), its shapes as og.Shape's calls one a line with `hole { }` blocks, places parts as mergeGeometries does (`position`, `quaternion`, `scale`, `mirror`, or several `at { }` blocks: one mesh drawn instanced), gives each a `material` and hangs it from a named `pivot` (a node). og cook builds it into the model blob a glTF cooks to (levels of detail, raycast BVH, nodes), refuses it past project.ogt's triangle and vertex budgets, and og dev re-cooks it on an edit; og.load.gltf and a scene's `model` line take it as any model. The og-game skill §18 has a whole example.
|
|
8215
|
+
|
|
8216
|
+
/** A shape's holes, as three.js Shape.holes: an array; push a path to add a hole. */
|
|
8217
|
+
export interface PathList {
|
|
8218
|
+
/** How many holes. */
|
|
8219
|
+
readonly length: number;
|
|
8220
|
+
/**
|
|
8221
|
+
* Add a hole (Array.push).
|
|
8222
|
+
*
|
|
8223
|
+
* @param path The hole's outline, either winding.
|
|
8224
|
+
*/
|
|
8225
|
+
push(path: Path2): number;
|
|
8226
|
+
}
|
|
8227
|
+
|
|
8228
|
+
/**
|
|
8229
|
+
* An outline of curves, as three.js Path: each call adds a curve from the current point (moveTo only moves it). Every method but getPoints returns the path, so calls chain.
|
|
8230
|
+
*/
|
|
8231
|
+
export interface Path2 {
|
|
8232
|
+
/**
|
|
8233
|
+
* Move the current point without drawing, as three.js Path.moveTo.
|
|
8234
|
+
*
|
|
8235
|
+
* @param x x.
|
|
8236
|
+
* @param y y.
|
|
8237
|
+
*/
|
|
8238
|
+
moveTo(x: number, y: number): this;
|
|
8239
|
+
/**
|
|
8240
|
+
* A straight line to (x, y), as three.js Path.lineTo.
|
|
8241
|
+
*
|
|
8242
|
+
* @param x x.
|
|
8243
|
+
* @param y y.
|
|
8244
|
+
*/
|
|
8245
|
+
lineTo(x: number, y: number): this;
|
|
8246
|
+
/**
|
|
8247
|
+
* A quadratic Bézier curve through one control point to (x, y), as three.js Path.quadraticCurveTo.
|
|
8248
|
+
*
|
|
8249
|
+
* @param cpX The control point's x.
|
|
8250
|
+
* @param cpY The control point's y.
|
|
8251
|
+
* @param x The end's x.
|
|
8252
|
+
* @param y The end's y.
|
|
8253
|
+
*/
|
|
8254
|
+
quadraticCurveTo(cpX: number, cpY: number, x: number, y: number): this;
|
|
8255
|
+
/**
|
|
8256
|
+
* A cubic Bézier curve through two control points to (x, y), as three.js Path.bezierCurveTo.
|
|
8257
|
+
*
|
|
8258
|
+
* @param cp1X The first control point's x.
|
|
8259
|
+
* @param cp1Y The first control point's y.
|
|
8260
|
+
* @param cp2X The second control point's x.
|
|
8261
|
+
* @param cp2Y The second control point's y.
|
|
8262
|
+
* @param x The end's x.
|
|
8263
|
+
* @param y The end's y.
|
|
8264
|
+
*/
|
|
8265
|
+
bezierCurveTo(cp1X: number, cp1Y: number, cp2X: number, cp2Y: number, x: number, y: number): this;
|
|
8266
|
+
/**
|
|
8267
|
+
* A Catmull-Rom spline from the current point through the points, as three.js Path.splineThru (a SplineCurve).
|
|
8268
|
+
*
|
|
8269
|
+
* @param points The points it passes through, in order.
|
|
8270
|
+
*/
|
|
8271
|
+
splineThru(points: readonly Vector2[]): this;
|
|
8272
|
+
/**
|
|
8273
|
+
* A circular arc centred at (x, y) from the current point, as three.js Path.arc.
|
|
8274
|
+
*
|
|
8275
|
+
* @param x The centre's x, from the current point.
|
|
8276
|
+
* @param y The centre's y, from the current point.
|
|
8277
|
+
* @param radius The radius.
|
|
8278
|
+
* @param startAngle Where it starts, from +x towards +y.
|
|
8279
|
+
* @param endAngle Where it ends.
|
|
8280
|
+
* @param clockwise Go clockwise. Default `false`.
|
|
8281
|
+
*/
|
|
8282
|
+
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, clockwise?: boolean): this;
|
|
8283
|
+
/**
|
|
8284
|
+
* A circular arc centred at (x, y), as three.js Path.absarc: a line joins it to the current point when they differ.
|
|
8285
|
+
*
|
|
8286
|
+
* @param x The centre's x.
|
|
8287
|
+
* @param y The centre's y.
|
|
8288
|
+
* @param radius The radius.
|
|
8289
|
+
* @param startAngle Where it starts, from +x towards +y.
|
|
8290
|
+
* @param endAngle Where it ends.
|
|
8291
|
+
* @param clockwise Go clockwise. Default `false`.
|
|
8292
|
+
*/
|
|
8293
|
+
absarc(x: number, y: number, radius: number, startAngle: number, endAngle: number, clockwise?: boolean): this;
|
|
8294
|
+
/**
|
|
8295
|
+
* An elliptic arc centred at (x, y) from the current point, as three.js Path.ellipse.
|
|
8296
|
+
*
|
|
8297
|
+
* @param x The centre's x, from the current point.
|
|
8298
|
+
* @param y The centre's y, from the current point.
|
|
8299
|
+
* @param xRadius The radius along x.
|
|
8300
|
+
* @param yRadius The radius along y.
|
|
8301
|
+
* @param startAngle Where it starts.
|
|
8302
|
+
* @param endAngle Where it ends.
|
|
8303
|
+
* @param clockwise Go clockwise. Default `false`.
|
|
8304
|
+
* @param rotation The ellipse's turn round its centre. Default `0`.
|
|
8305
|
+
*/
|
|
8306
|
+
ellipse(x: number, y: number, xRadius: number, yRadius: number, startAngle: number, endAngle: number, clockwise?: boolean, rotation?: number): this;
|
|
8307
|
+
/**
|
|
8308
|
+
* An elliptic arc centred at (x, y), as three.js Path.absellipse.
|
|
8309
|
+
*
|
|
8310
|
+
* @param x The centre's x.
|
|
8311
|
+
* @param y The centre's y.
|
|
8312
|
+
* @param xRadius The radius along x.
|
|
8313
|
+
* @param yRadius The radius along y.
|
|
8314
|
+
* @param startAngle Where it starts.
|
|
8315
|
+
* @param endAngle Where it ends.
|
|
8316
|
+
* @param clockwise Go clockwise. Default `false`.
|
|
8317
|
+
* @param rotation The ellipse's turn round its centre. Default `0`.
|
|
8318
|
+
*/
|
|
8319
|
+
absellipse(x: number, y: number, xRadius: number, yRadius: number, startAngle: number, endAngle: number, clockwise?: boolean, rotation?: number): this;
|
|
8320
|
+
/**
|
|
8321
|
+
* Start at the first point and draw lines through the rest, as three.js Path.setFromPoints.
|
|
8322
|
+
*
|
|
8323
|
+
* @param points The points.
|
|
8324
|
+
*/
|
|
8325
|
+
setFromPoints(points: readonly Vector2[]): this;
|
|
8326
|
+
/**
|
|
8327
|
+
* A line back to the first point when the outline does not end there, as three.js CurvePath.closePath.
|
|
8328
|
+
*/
|
|
8329
|
+
closePath(): this;
|
|
8330
|
+
/**
|
|
8331
|
+
* The outline as points, as three.js CurvePath.getPoints: each curve divided into `divisions` (an ellipse twice as many, a spline as many per point, a line one), repeated points dropped.
|
|
8332
|
+
*
|
|
8333
|
+
* @param divisions Divisions per curve. Default `12`.
|
|
8334
|
+
*/
|
|
8335
|
+
getPoints(divisions?: number): readonly Vector2[];
|
|
8336
|
+
}
|
|
8337
|
+
|
|
8338
|
+
/** An outline with holes, as three.js Shape. */
|
|
8339
|
+
export interface Shape extends Path2 {
|
|
8340
|
+
/** The holes: `shape.holes.push(hole)`. */
|
|
8341
|
+
readonly holes: PathList;
|
|
8342
|
+
/**
|
|
8343
|
+
* The outline's and the holes' points, as three.js Shape.extractPoints.
|
|
8344
|
+
*
|
|
8345
|
+
* @param divisions Divisions per curve. Default `12`.
|
|
8346
|
+
*/
|
|
8347
|
+
extractPoints(divisions?: number): ShapePoints;
|
|
8348
|
+
}
|
|
8349
|
+
|
|
8350
|
+
/** og.Path2: `new og.Path2(points?)`. */
|
|
8351
|
+
export interface Path2Class {
|
|
8352
|
+
/**
|
|
8353
|
+
* A path, through the points when given (setFromPoints).
|
|
8354
|
+
*
|
|
8355
|
+
* @param points Points to start from.
|
|
8356
|
+
*/
|
|
8357
|
+
new(points?: readonly Vector2[] | null): Path2;
|
|
8358
|
+
}
|
|
8359
|
+
|
|
8360
|
+
/** og.Shape: `new og.Shape(points?)`. */
|
|
8361
|
+
export interface ShapeClass {
|
|
8362
|
+
/**
|
|
8363
|
+
* A shape, through the points when given (setFromPoints).
|
|
8364
|
+
*
|
|
8365
|
+
* @param points Points to start from.
|
|
8366
|
+
*/
|
|
8367
|
+
new(points?: readonly Vector2[] | null): Shape;
|
|
8368
|
+
}
|
|
8369
|
+
|
|
7581
8370
|
// ── load ────────────────────────────────────────────────────────
|
|
7582
8371
|
// 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/.
|
|
7583
8372
|
// 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.
|
|
@@ -7818,7 +8607,7 @@ export interface Model {
|
|
|
7818
8607
|
*/
|
|
7819
8608
|
visible: boolean;
|
|
7820
8609
|
/**
|
|
7821
|
-
* 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 the renderer draws the level
|
|
8610
|
+
* 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.
|
|
7822
8611
|
*
|
|
7823
8612
|
* @default 1
|
|
7824
8613
|
* @range 0..16
|
|
@@ -11734,6 +12523,12 @@ export interface Skeleton2D {
|
|
|
11734
12523
|
* The sprite layer it draws in, sorted with the sprites there (after them when they share the layer).
|
|
11735
12524
|
*/
|
|
11736
12525
|
layer: number;
|
|
12526
|
+
/**
|
|
12527
|
+
* The skin it wears: an index into Rig2DInfo.skins (0 is the rig's default; `rig.skins.indexOf("armor")` finds one by name). A skin shows its own attachment wherever the setup pose or a clip shows the default's; a slot the skin leaves alone shows the default's. Change it any tick: the pose is drawn from it.
|
|
12528
|
+
*
|
|
12529
|
+
* @range 0..
|
|
12530
|
+
*/
|
|
12531
|
+
skin: number;
|
|
11737
12532
|
/**
|
|
11738
12533
|
* Written: a clip that does not loop reached its end (or its start, played backwards).
|
|
11739
12534
|
*
|
|
@@ -11743,7 +12538,7 @@ export interface Skeleton2D {
|
|
|
11743
12538
|
}
|
|
11744
12539
|
|
|
11745
12540
|
/**
|
|
11746
|
-
* A 2D skeleton's clip passed one of its events (`event 0.2 "step"` in the rig) in the last tick: footsteps, the frame a swing lands. Read in the tick after, like every event; a clip started at 0 fires its events at 0, a looping clip fires each once per pass.
|
|
12541
|
+
* A 2D skeleton's clip, or the clip a child armature in one of its slots plays, passed one of its events (`event 0.2 "step"` in the rig) in the last tick: footsteps, the frame a swing lands. Read in the tick after, like every event; a clip started at 0 fires its events at 0, a looping clip fires each once per pass.
|
|
11747
12542
|
*
|
|
11748
12543
|
* The payload of the `Skeleton2DEvent` event (token `og.Skeleton2DEvent`).
|
|
11749
12544
|
*/
|
|
@@ -11760,6 +12555,10 @@ export interface Skeleton2DEvent {
|
|
|
11760
12555
|
* @unit s (seconds of simulation time)
|
|
11761
12556
|
*/
|
|
11762
12557
|
readonly time: number;
|
|
12558
|
+
/**
|
|
12559
|
+
* Empty for the skeleton's own clip; for an event of a child armature shown in one of its slots, that armature's name (`clip` and `time` are then the child's clip and its time): a flame's crackle apart from the keeper's footsteps (at most 63 bytes).
|
|
12560
|
+
*/
|
|
12561
|
+
readonly armature: string;
|
|
11763
12562
|
}
|
|
11764
12563
|
|
|
11765
12564
|
/**
|
|
@@ -11847,6 +12646,10 @@ export interface Rig2DInfo {
|
|
|
11847
12646
|
readonly slots: readonly string[];
|
|
11848
12647
|
/** The IK constraints' names: an index here is IkTarget2D.constraint. */
|
|
11849
12648
|
readonly constraints: readonly string[];
|
|
12649
|
+
/**
|
|
12650
|
+
* Its skins' names, `default` (the rig's own attachments) first: an index here is Skeleton2D.skin.
|
|
12651
|
+
*/
|
|
12652
|
+
readonly skins: readonly string[];
|
|
11850
12653
|
/** Its clips, in file order. */
|
|
11851
12654
|
readonly clips: readonly Rig2DClipInfo[];
|
|
11852
12655
|
}
|
|
@@ -16908,14 +17711,6 @@ export interface ScreenTransitionResult {
|
|
|
16908
17711
|
|
|
16909
17712
|
|
|
16910
17713
|
|
|
16911
|
-
/**
|
|
16912
|
-
* A graphics quality preset.
|
|
16913
|
-
* - `"medium"`: Medium.
|
|
16914
|
-
* - `"low"`: Low: the fewest effects.
|
|
16915
|
-
* - `"high"`: High: every effect.
|
|
16916
|
-
*/
|
|
16917
|
-
export type GraphicsQuality = "medium" | "low" | "high";
|
|
16918
|
-
|
|
16919
17714
|
/**
|
|
16920
17715
|
* A template's action, by its id (a menu item, `buy:<item>`, `share`).
|
|
16921
17716
|
*
|
|
@@ -17219,6 +18014,12 @@ export interface SettingsDesc {
|
|
|
17219
18014
|
* @default null
|
|
17220
18015
|
*/
|
|
17221
18016
|
readonly onSave?: SettingsChanged | null;
|
|
18017
|
+
/**
|
|
18018
|
+
* The world the graphics preset is drawn in: when the player picks another preset the screen calls og.render.applyQuality(world, preset) before onChange. Null leaves applying it to the game. Inside a system, the system declares RenderSettings among its writes.
|
|
18019
|
+
*
|
|
18020
|
+
* @default null
|
|
18021
|
+
*/
|
|
18022
|
+
readonly world?: World | null;
|
|
17222
18023
|
/**
|
|
17223
18024
|
* The dialog's title. Every word of the screen is a field with its English default: a localised game passes its string table's (og.i18n.t).
|
|
17224
18025
|
*
|
|
@@ -20012,7 +20813,7 @@ export interface EngineProbe extends RuntimeProbe {
|
|
|
20012
20813
|
|
|
20013
20814
|
// ── terrain ─────────────────────────────────────────────────────
|
|
20014
20815
|
// Terrain (phase 2): a height field over a rectangle, cooked by `og cook` from a `type terrain` .ogt (a 16-bit grey PNG or an EXR heightmap, an optional control map, up to four layered materials with slope and altitude rules, their maps separate textures or layers of two texture arrays: `layers` and `layerNormals` with each layer's `albedoLayer` and `normalLayer`, two sampled textures instead of up to eight) into tiles; drawn as a geometry clipmap around the camera (nested levels by distance, no cracks) that casts and receives shadows under the fog; collided with as a height field; baked into navmeshes by a navmesh file's `terrain` entry.
|
|
20015
|
-
// Load it with og.terrain.load, then place it: an og.Terrain on an entity draws it placed by the entity's world transform (centred on its position, turned and scaled with it), and an og.Collider of shape SHAPE_HEIGHTFIELD naming the TerrainInfo's geometry makes it solid. og.TerrainScatter grows grass, flowers or stones over a layer near the camera. og.terrain.sample answers the surface's height and normal anywhere (pass it the entity's position, quaternion and scale); og.terrain.edit raises, lowers, flattens, smooths or paints it at runtime, and og.terrain.setLayer retunes a layer. Edits are world state: a snapshot keeps them, the world hash covers them, and a restore brings the ground back as it was (rebuilt from the cook with the restored edits replayed, for the renderer, physics and sample alike).
|
|
20816
|
+
// Load it with og.terrain.load, then place it: an og.Terrain on an entity draws it placed by the entity's world transform (centred on its position, turned and scaled with it), and an og.Collider of shape SHAPE_HEIGHTFIELD naming the TerrainInfo's geometry makes it solid. og.TerrainScatter grows grass, flowers or stones over a layer near the camera. og.terrain.sample answers the surface's height and normal anywhere (pass it the entity's position, quaternion and scale); og.terrain.edit raises, lowers, flattens, smooths or paints it at runtime, and og.terrain.setLayer retunes a layer. Terrain is 3D: the 2D profile's publish and lanes modules leave it out (RenderCapabilities.world3d is false), where every call here answers a refusal naming that field. Edits are world state: a snapshot keeps them, the world hash covers them, and a restore brings the ground back as it was (rebuilt from the cook with the restored edits replayed, for the renderer, physics and sample alike).
|
|
20016
20817
|
// Its tiles stream (phase 3): the cook stores the field as a pyramid of tiles, each compressed on its own, and every frame the renderer keeps on the GPU only the tiles the camera's clipmap wants, within each terrain's tile budget (16 MiB by default), decoded off the frame (a worker thread natively, the browser's DecompressionStream on the Web) a few at a time, the most needed first; until a tile arrives its area draws from the coarser level that holds it, then fades in. Nothing a tick reads depends on which tiles are resident (collision and og.terrain.sample read the whole field), so a run's world hash is the same streamed or not. The probe's `terrain_stream:resident` decodes every wanted tile before each frame instead (`terrain_stream:stream[:<MiB>]` streams again, within that budget), and `dump_stream`'s `terrain` gives the tiles resident, waiting, decoding and cached.
|
|
20017
20818
|
|
|
20018
20819
|
/**
|
|
@@ -20183,6 +20984,12 @@ export interface TerrainInfo {
|
|
|
20183
20984
|
readonly collision: boolean;
|
|
20184
20985
|
/** Its terrain file's `castShadows`. */
|
|
20185
20986
|
readonly castShadows: boolean;
|
|
20987
|
+
/**
|
|
20988
|
+
* A generated terrain's sea level (`generate { sea <m> }`) above its entity: place an og.Water there, the terrain's size; null without a sea.
|
|
20989
|
+
*
|
|
20990
|
+
* @unit m (metres)
|
|
20991
|
+
*/
|
|
20992
|
+
readonly seaLevel: number | null;
|
|
20186
20993
|
}
|
|
20187
20994
|
|
|
20188
20995
|
/**
|
|
@@ -21413,9 +22220,9 @@ export declare namespace og {
|
|
|
21413
22220
|
/** A cone of light along the entity's local -Z, as three.js SpotLight. */
|
|
21414
22221
|
const SpotLight: ComponentType<{ readonly color: FieldSpec<"Color">; readonly intensity: FieldSpec<"f32">; readonly distance: FieldSpec<"f32">; readonly angle: FieldSpec<"f32">; readonly penumbra: FieldSpec<"f32">; readonly castShadow: FieldSpec<"bool">; readonly cookie: FieldSpec<"Texture"> }, SpotLight>;
|
|
21415
22222
|
/**
|
|
21416
|
-
* The frame's look after lighting: environment light, sky, bloom, exposure metering and tone mapping. Read after each tick; it never feeds back into the simulation. Camera.exposure is the manual exposure.
|
|
22223
|
+
* The frame's look after lighting: environment light, sky, bloom, exposure metering and tone mapping, and what the frame may cost: the quality fields (rectShadows to msaaSamples) that og.render.applyQuality sets from a graphics preset. Read after each tick; it never feeds back into the simulation. Camera.exposure is the manual exposure.
|
|
21417
22224
|
*/
|
|
21418
|
-
const RenderSettings: ResourceType<{ readonly environmentIntensity: FieldSpec<"f32">; readonly sky: FieldSpec<"bool">; readonly bloom: FieldSpec<"bool">; readonly bloomThreshold: FieldSpec<"f32">; readonly bloomKnee: FieldSpec<"f32">; readonly bloomIntensity: FieldSpec<"f32">; readonly autoExposure: FieldSpec<"bool">; readonly adaptSpeedUp: FieldSpec<"f32">; readonly adaptSpeedDown: FieldSpec<"f32">; readonly toneMapped: FieldSpec<"bool">; readonly toneMapping: FieldSpec<"ToneMapping">; readonly exposure: FieldSpec<"f32">; readonly decalAtlas: FieldSpec<"Texture">; readonly lodBias: FieldSpec<"f32">; readonly bakedLighting: FieldSpec<"bool"> }, RenderSettings>;
|
|
22225
|
+
const RenderSettings: ResourceType<{ readonly environmentIntensity: FieldSpec<"f32">; readonly sky: FieldSpec<"bool">; readonly bloom: FieldSpec<"bool">; readonly bloomThreshold: FieldSpec<"f32">; readonly bloomKnee: FieldSpec<"f32">; readonly bloomIntensity: FieldSpec<"f32">; readonly autoExposure: FieldSpec<"bool">; readonly adaptSpeedUp: FieldSpec<"f32">; readonly adaptSpeedDown: FieldSpec<"f32">; readonly toneMapped: FieldSpec<"bool">; readonly toneMapping: FieldSpec<"ToneMapping">; readonly exposure: FieldSpec<"f32">; readonly decalAtlas: FieldSpec<"Texture">; readonly lodBias: FieldSpec<"f32">; readonly bakedLighting: FieldSpec<"bool">; readonly quality: FieldSpec<"QualityPreset">; readonly rectShadows: FieldSpec<"bool">; readonly shadowedLights: FieldSpec<"u32">; readonly shadowMapScale: FieldSpec<"f32">; readonly volumetricFog: FieldSpec<"bool">; readonly softParticles: FieldSpec<"bool">; readonly screenSpaceReflections: FieldSpec<"bool">; readonly ambientOcclusion: FieldSpec<"bool">; readonly msaaSamples: FieldSpec<"u32"> }, RenderSettings>;
|
|
21419
22226
|
/**
|
|
21420
22227
|
* Image-based light from a cooked HDR environment map instead of the sky, as three.js scene.environment, and the map behind the scene, as scene.background = the environment. Load the map with og.load.environment: the cook has already prefiltered it (GGX levels for reflections from mirror to rough, harmonics for the diffuse light), so setting it costs a few copy passes on any tier, WebGL2 included. Without a map the sky lights the scene as before (og.Sky, a DayNight, or the built-in one). Read after each tick; it never feeds back into the simulation.
|
|
21421
22228
|
*/
|
|
@@ -21424,7 +22231,7 @@ export declare namespace og {
|
|
|
21424
22231
|
* The post stack beyond RenderSettings' bloom, exposure and tone mapping, and camera shake. Every effect is off by default (its switch false or its amount 0) and then costs nothing: no pass is recorded. Read after each tick; it never feeds back into the simulation.
|
|
21425
22232
|
* Screen-space ambient occlusion, outlines, depth of field, motion blur and god rays run a depth-normal prepass, turned on with them. Grading, vignette, aberration, grain and the flash apply to the display colour after tone mapping; the UI and screen-space sprites (the overlay) come after all of it.
|
|
21426
22233
|
*/
|
|
21427
|
-
const PostEffects: ResourceType<{ readonly ao: FieldSpec<"bool">; readonly aoRadius: FieldSpec<"f32">; readonly aoIntensity: FieldSpec<"f32">; readonly aoMethod: FieldSpec<"AoMethod">; readonly outline: FieldSpec<"bool">; readonly outlineColor: FieldSpec<"Color">; readonly outlineWidth: FieldSpec<"f32">; readonly outlineDepthThreshold: FieldSpec<"f32">; readonly outlineNormalThreshold: FieldSpec<"f32">; readonly depthOfField: FieldSpec<"bool">; readonly dofFocusDistance: FieldSpec<"f32">; readonly dofFocusRange: FieldSpec<"f32">; readonly dofMaxBlur: FieldSpec<"f32">; readonly dofFalloff: FieldSpec<"f32">; readonly dofQuality: FieldSpec<"DofQuality">; readonly motionBlur: FieldSpec<"bool">; readonly motionBlurShutter: FieldSpec<"f32">; readonly motionBlurSamples: FieldSpec<"u32">; readonly motionBlurMaxPixels: FieldSpec<"f32">; readonly godRays: FieldSpec<"bool">; readonly godRaysIntensity: FieldSpec<"f32">; readonly godRaysDecay: FieldSpec<"f32">; readonly godRaysDensity: FieldSpec<"f32">; readonly godRaysTint: FieldSpec<"Color">; readonly godRaysSamples: FieldSpec<"u32">; readonly godRaysThreshold: FieldSpec<"f32">; readonly glow: FieldSpec<"bool">; readonly glowIntensity: FieldSpec<"f32">; readonly lut: FieldSpec<"Lut">; readonly lutIntensity: FieldSpec<"f32">; readonly vignette: FieldSpec<"bool">; readonly vignetteIntensity: FieldSpec<"f32">; readonly vignetteRadius: FieldSpec<"f32">; readonly vignetteSmoothness: FieldSpec<"f32">; readonly vignetteColor: FieldSpec<"Color">; readonly chromaticAberration: FieldSpec<"f32">; readonly filmGrain: FieldSpec<"f32">; readonly filmGrainSize: FieldSpec<"f32">; readonly flash: FieldSpec<"f32">; readonly flashColor: FieldSpec<"Color">; readonly shakeTrauma: FieldSpec<"f32">; readonly shakeMaxOffset: FieldSpec<"f32">; readonly shakeMaxRoll: FieldSpec<"f32">; readonly shakeFrequency: FieldSpec<"f32">; readonly shakeSeed: FieldSpec<"u32">; readonly ssr: FieldSpec<"bool">; readonly ssrMaxDistance: FieldSpec<"f32">; readonly ssrThickness: FieldSpec<"f32">; readonly ssrSteps: FieldSpec<"u32">; readonly ssrFade: FieldSpec<"f32">; readonly ssrIntensity: FieldSpec<"f32">; readonly
|
|
22234
|
+
const PostEffects: ResourceType<{ readonly ao: FieldSpec<"bool">; readonly aoRadius: FieldSpec<"f32">; readonly aoIntensity: FieldSpec<"f32">; readonly aoMethod: FieldSpec<"AoMethod">; readonly outline: FieldSpec<"bool">; readonly outlineColor: FieldSpec<"Color">; readonly outlineWidth: FieldSpec<"f32">; readonly outlineDepthThreshold: FieldSpec<"f32">; readonly outlineNormalThreshold: FieldSpec<"f32">; readonly depthOfField: FieldSpec<"bool">; readonly dofFocusDistance: FieldSpec<"f32">; readonly dofFocusRange: FieldSpec<"f32">; readonly dofMaxBlur: FieldSpec<"f32">; readonly dofFalloff: FieldSpec<"f32">; readonly dofQuality: FieldSpec<"DofQuality">; readonly motionBlur: FieldSpec<"bool">; readonly motionBlurShutter: FieldSpec<"f32">; readonly motionBlurSamples: FieldSpec<"u32">; readonly motionBlurMaxPixels: FieldSpec<"f32">; readonly godRays: FieldSpec<"bool">; readonly godRaysIntensity: FieldSpec<"f32">; readonly godRaysDecay: FieldSpec<"f32">; readonly godRaysDensity: FieldSpec<"f32">; readonly godRaysTint: FieldSpec<"Color">; readonly godRaysSamples: FieldSpec<"u32">; readonly godRaysThreshold: FieldSpec<"f32">; readonly glow: FieldSpec<"bool">; readonly glowIntensity: FieldSpec<"f32">; readonly lut: FieldSpec<"Lut">; readonly lutIntensity: FieldSpec<"f32">; readonly vignette: FieldSpec<"bool">; readonly vignetteIntensity: FieldSpec<"f32">; readonly vignetteRadius: FieldSpec<"f32">; readonly vignetteSmoothness: FieldSpec<"f32">; readonly vignetteColor: FieldSpec<"Color">; readonly chromaticAberration: FieldSpec<"f32">; readonly filmGrain: FieldSpec<"f32">; readonly filmGrainSize: FieldSpec<"f32">; readonly flash: FieldSpec<"f32">; readonly flashColor: FieldSpec<"Color">; readonly shakeTrauma: FieldSpec<"f32">; readonly shakeMaxOffset: FieldSpec<"f32">; readonly shakeMaxRoll: FieldSpec<"f32">; readonly shakeFrequency: FieldSpec<"f32">; readonly shakeSeed: FieldSpec<"u32">; readonly ssr: FieldSpec<"bool">; readonly ssrMaxDistance: FieldSpec<"f32">; readonly ssrThickness: FieldSpec<"f32">; readonly ssrSteps: FieldSpec<"u32">; readonly ssrFade: FieldSpec<"f32">; readonly ssrIntensity: FieldSpec<"f32">; readonly custom: ListSpec<"Post"> }, PostEffects>;
|
|
21428
22235
|
/**
|
|
21429
22236
|
* Stylisation primitives that move the frame away from the photographic: a low-resolution pixel grid scaled up by whole numbers, fewer tones or a fixed palette through an ordered or blue-noise dither, halftone dots, cross-hatching, painterly smoothing over a canvas, ink lines on tonal edges, flat colour bands by depth, and the vertex snapping, affine textures and coarse depth of early 3D hardware. They compose: a look (og.load.look) sets this with PostEffects and RenderSettings, and the game's art direction is in that data, not in the engine. Every primitive is off at its zero value (0, false, none) and then costs nothing: no pass is recorded and no pipeline is built. RenderCapabilities.stylise names the primitives this renderer draws; a field it does not name is carried and read back but not drawn. Read after each tick; it never feeds back into the simulation.
|
|
21430
22237
|
* Order in the frame: depth bands colour the lit scene with the fog, before tone mapping; after tone mapping and PostEffects' grading come paint, hatching, halftone and ink, then posterize and palette quantise through the dither, all at the logical resolution, and the pixel grid is scaled up last. The UI and screen-space sprites are drawn over the scaled frame at the output's resolution, unstylised.
|
|
@@ -21611,6 +22418,25 @@ export declare namespace og {
|
|
|
21611
22418
|
* @returns Refused for a look not loaded in this world, one in a streaming group that is not resident (the reason names it), or a resource the system did not declare.
|
|
21612
22419
|
*/
|
|
21613
22420
|
function applyLook(world: World, look: Look): Result<void>;
|
|
22421
|
+
/**
|
|
22422
|
+
* Apply a graphics preset: write its row of RenderSettings' quality fields (the rest of RenderSettings keeps its values) and record it in RenderSettings.quality. The renderer reads those fields and nothing else, so what the probe and dump_world show of RenderSettings is what the next frame draws. The settings screen calls it when the player picks a preset (SettingsDesc.world); a game applies a saved preset itself at start. Inside a system, the system must declare RenderSettings among its writes. The rows:
|
|
22423
|
+
* | Field | low | medium | high |
|
|
22424
|
+
* |---|---|---|---|
|
|
22425
|
+
* | rectShadows | false | true | true |
|
|
22426
|
+
* | shadowedLights | 2 | 8 | 8 |
|
|
22427
|
+
* | shadowMapScale | 0.5 | 1 | 2 |
|
|
22428
|
+
* | volumetricFog | false | true | true |
|
|
22429
|
+
* | softParticles | false | true | true |
|
|
22430
|
+
* | screenSpaceReflections | false | true | true |
|
|
22431
|
+
* | ambientOcclusion | false | true | true |
|
|
22432
|
+
* | msaaSamples | 1 | 4 | 4 |
|
|
22433
|
+
* Medium is every field's default, the frame drawn before any preset.
|
|
22434
|
+
*
|
|
22435
|
+
* @param world The world whose RenderSettings change.
|
|
22436
|
+
* @param preset The preset.
|
|
22437
|
+
* @returns Refused for a world that is not alive, or inside a system that did not declare RenderSettings among its writes.
|
|
22438
|
+
*/
|
|
22439
|
+
function applyQuality(world: World, preset: GraphicsQuality): Result<void>;
|
|
21614
22440
|
/**
|
|
21615
22441
|
* The look last applied (by og.render.applyLook or GameDesc.look), as og.load.lookInfo describes it; null before any.
|
|
21616
22442
|
*
|
|
@@ -21706,6 +22532,90 @@ export declare namespace og {
|
|
|
21706
22532
|
* @returns Refused for fewer than two points or a point that is not finite (without a path), or a path that is not alive.
|
|
21707
22533
|
*/
|
|
21708
22534
|
function tubeGeometry(world: World, desc?: TubeGeometryDesc): Result<Geometry>;
|
|
22535
|
+
/**
|
|
22536
|
+
* Make a flat shape for og.Mesh (one-sided, as circleGeometry): an og.Shape with holes, or a points array. Physics can use it as a triangle-mesh Collider.mesh.
|
|
22537
|
+
*
|
|
22538
|
+
* @param world The world whose renderer owns the geometry.
|
|
22539
|
+
* @param desc The shapes and their tessellation.
|
|
22540
|
+
* @returns Refused for a shape whose points are not finite or that triangulates to nothing.
|
|
22541
|
+
*/
|
|
22542
|
+
function shapeGeometry(world: World, desc?: ShapeGeometryDesc): Result<Geometry>;
|
|
22543
|
+
/**
|
|
22544
|
+
* Make an extruded solid for og.Mesh: a three.js extrusion is a paste (`og.render.extrudeGeometry(world, { shapes: shape, depth: 0.2, bevelEnabled: true })`). Gears, signs, keys, logos, cookie cutters; along a path, a rail or a moulding.
|
|
22545
|
+
*
|
|
22546
|
+
* @param world The world whose renderer owns the geometry.
|
|
22547
|
+
* @param desc The shapes, depth, bevel and path.
|
|
22548
|
+
* @returns Refused for a shape whose points are not finite or that triangulates to nothing, or an extrudePath that is not alive.
|
|
22549
|
+
*/
|
|
22550
|
+
function extrudeGeometry(world: World, desc?: ExtrudeGeometryDesc): Result<Geometry>;
|
|
22551
|
+
/**
|
|
22552
|
+
* Make a solid of revolution for og.Mesh: a profile turned round +Y.
|
|
22553
|
+
*
|
|
22554
|
+
* @param world The world whose renderer owns the geometry.
|
|
22555
|
+
* @param desc The profile and the turn.
|
|
22556
|
+
* @returns Refused for fewer than two points or one that is not finite.
|
|
22557
|
+
*/
|
|
22558
|
+
function latheGeometry(world: World, desc?: LatheGeometryDesc): Result<Geometry>;
|
|
22559
|
+
/**
|
|
22560
|
+
* Make a polyhedron from vertices and faces for og.Mesh, subdivided onto a sphere.
|
|
22561
|
+
*
|
|
22562
|
+
* @param world The world whose renderer owns the geometry.
|
|
22563
|
+
* @param desc The vertices, faces, radius and detail.
|
|
22564
|
+
* @returns Refused for no faces, an index past the vertices, or a count that is not a multiple of three.
|
|
22565
|
+
*/
|
|
22566
|
+
function polyhedronGeometry(world: World, desc?: PolyhedronGeometryDesc): Result<Geometry>;
|
|
22567
|
+
/**
|
|
22568
|
+
* Make an icosahedron (twenty faces) for og.Mesh; with detail, a geodesic sphere.
|
|
22569
|
+
*
|
|
22570
|
+
* @param world The world whose renderer owns the geometry.
|
|
22571
|
+
* @param desc Its radius and detail.
|
|
22572
|
+
*/
|
|
22573
|
+
function icosahedronGeometry(world: World, desc?: SolidGeometryDesc): Result<Geometry>;
|
|
22574
|
+
/**
|
|
22575
|
+
* Make a dodecahedron (twelve pentagons, thirty-six triangles) for og.Mesh.
|
|
22576
|
+
*
|
|
22577
|
+
* @param world The world whose renderer owns the geometry.
|
|
22578
|
+
* @param desc Its radius and detail.
|
|
22579
|
+
*/
|
|
22580
|
+
function dodecahedronGeometry(world: World, desc?: SolidGeometryDesc): Result<Geometry>;
|
|
22581
|
+
/**
|
|
22582
|
+
* Make an octahedron (eight faces) for og.Mesh.
|
|
22583
|
+
*
|
|
22584
|
+
* @param world The world whose renderer owns the geometry.
|
|
22585
|
+
* @param desc Its radius and detail.
|
|
22586
|
+
*/
|
|
22587
|
+
function octahedronGeometry(world: World, desc?: SolidGeometryDesc): Result<Geometry>;
|
|
22588
|
+
/**
|
|
22589
|
+
* Make a tetrahedron (four faces) for og.Mesh.
|
|
22590
|
+
*
|
|
22591
|
+
* @param world The world whose renderer owns the geometry.
|
|
22592
|
+
* @param desc Its radius and detail.
|
|
22593
|
+
*/
|
|
22594
|
+
function tetrahedronGeometry(world: World, desc?: SolidGeometryDesc): Result<Geometry>;
|
|
22595
|
+
/**
|
|
22596
|
+
* Make a section swept along a path for og.Mesh, tapered and twisted by keys.
|
|
22597
|
+
*
|
|
22598
|
+
* @param world The world whose renderer owns the geometry.
|
|
22599
|
+
* @param desc The section, path, keys and caps.
|
|
22600
|
+
* @returns Refused for a path that is not alive, a section of fewer than three points or of no area, or a value that is not finite.
|
|
22601
|
+
*/
|
|
22602
|
+
function sweepGeometry(world: World, desc?: SweepGeometryDesc): Result<Geometry>;
|
|
22603
|
+
/**
|
|
22604
|
+
* Make the union, difference or intersection of two placed geometries for og.Mesh. Chain calls for more operands (a cube minus six spheres is six calls); each result is a geometry like any other.
|
|
22605
|
+
*
|
|
22606
|
+
* @param world The world whose renderer owns the geometry.
|
|
22607
|
+
* @param desc The operation and its operands.
|
|
22608
|
+
* @returns Refused for a dead geometry, a placement with a zero scale, or a position that is not finite.
|
|
22609
|
+
*/
|
|
22610
|
+
function csgGeometry(world: World, desc?: CsgGeometryDesc): Result<Geometry>;
|
|
22611
|
+
/**
|
|
22612
|
+
* Make one geometry of several placed ones for og.Mesh: one draw instead of many, mirrored halves, arrays.
|
|
22613
|
+
*
|
|
22614
|
+
* @param world The world whose renderer owns the geometry.
|
|
22615
|
+
* @param desc The parts and their placements.
|
|
22616
|
+
* @returns Refused for no parts, a dead geometry, or a placement with a zero scale.
|
|
22617
|
+
*/
|
|
22618
|
+
function mergeGeometries(world: World, desc?: MergeGeometriesDesc): Result<Geometry>;
|
|
21709
22619
|
/**
|
|
21710
22620
|
* Draw lines this frame. Systems and commands may call it; the list is cleared at every tick, so submit them every tick they should show (og.Lines keeps a static set).
|
|
21711
22621
|
*
|
|
@@ -21750,7 +22660,7 @@ export declare namespace og {
|
|
|
21750
22660
|
*/
|
|
21751
22661
|
function setPostParam(world: World, post: Post, name: string, value: readonly number[]): Result<void>;
|
|
21752
22662
|
/**
|
|
21753
|
-
* The custom post passes PostEffects.
|
|
22663
|
+
* The custom post passes PostEffects.custom names that failed to compile on this device, each skipped (the frame draws as without it). The cook validates every pass for each back end, so this is a device's own refusal.
|
|
21754
22664
|
*
|
|
21755
22665
|
* @param world The world asked.
|
|
21756
22666
|
*/
|
|
@@ -21762,6 +22672,14 @@ export declare namespace og {
|
|
|
21762
22672
|
*/
|
|
21763
22673
|
function bakedLighting(world: World): readonly BakedScene[];
|
|
21764
22674
|
}
|
|
22675
|
+
/**
|
|
22676
|
+
* three.js's Path (named Path2 beside og.path's 3D paths): `new og.Path2().moveTo(0, 0).lineTo(1, 0)`.
|
|
22677
|
+
*/
|
|
22678
|
+
const Path2: Path2Class;
|
|
22679
|
+
/**
|
|
22680
|
+
* three.js's Shape: `const s = new og.Shape(); s.moveTo(0, 0).lineTo(1, 0).lineTo(0, 1); s.holes.push(hole)`.
|
|
22681
|
+
*/
|
|
22682
|
+
const Shape: ShapeClass;
|
|
21765
22683
|
/**
|
|
21766
22684
|
* 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.
|
|
21767
22685
|
* 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.
|
|
@@ -21802,7 +22720,7 @@ export declare namespace og {
|
|
|
21802
22720
|
function defaultBundle(world: World): Result<Asset>;
|
|
21803
22721
|
/**
|
|
21804
22722
|
* Load a cooked glTF (.gltf or .glb), as three.js GLTFLoader.load: its meshes, materials and textures join the renderer once.
|
|
21805
|
-
* 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).
|
|
22723
|
+
* 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.
|
|
21806
22724
|
*
|
|
21807
22725
|
* @param world The world that owns the asset.
|
|
21808
22726
|
* @param path The asset id, such as `models/ship.glb`.
|
|
@@ -21873,7 +22791,7 @@ export declare namespace og {
|
|
|
21873
22791
|
*/
|
|
21874
22792
|
function shader(world: World, path: string): Result<Shader>;
|
|
21875
22793
|
/**
|
|
21876
|
-
* A custom post pass for PostEffects.
|
|
22794
|
+
* 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.
|
|
21877
22795
|
*
|
|
21878
22796
|
* @param world The world whose renderer owns it.
|
|
21879
22797
|
* @param path The asset id, such as `post/crt.ogt`.
|
|
@@ -22341,9 +23259,9 @@ export declare namespace og {
|
|
|
22341
23259
|
* Plays a clip of a 2D rig at the entity: the og.skeleton2d system advances it by scaled time (Time.scaledDt) after the game's systems and fires its events as og.Skeleton2DEvent; extraction draws its slots, in their order, as textured triangles of the sprite batch at `layer` (region attachments as quads, mesh attachments weighted to bones and deformed by the clip), lit by og.Lighting2D when the layer is in its range, as a sprite there is. The rig's pixels are `unit` to a world unit and +y is up; the entity's og.Transform places, turns (about z) and scales it.
|
|
22342
23260
|
* Changing `clip` restarts at 0 (or at `time`, written in the same tick); writing a different time is a seek and fires no events. The pose is a function of these fields, the Transform and the og.IkTarget2D on it; the playback position is world state (the og.skeleton2d state block).
|
|
22343
23261
|
*/
|
|
22344
|
-
const Skeleton2D: ComponentType<{ readonly rig: FieldSpec<"Rig2D">; readonly clip: FieldSpec<"u32">; readonly time: FieldSpec<"f32">; readonly speed: FieldSpec<"f32">; readonly loop: FieldSpec<"bool">; readonly flipX: FieldSpec<"bool">; readonly layer: FieldSpec<"i32">; readonly finished: FieldSpec<"bool"> }, Skeleton2D>;
|
|
23262
|
+
const Skeleton2D: ComponentType<{ readonly rig: FieldSpec<"Rig2D">; readonly clip: FieldSpec<"u32">; readonly time: FieldSpec<"f32">; readonly speed: FieldSpec<"f32">; readonly loop: FieldSpec<"bool">; readonly flipX: FieldSpec<"bool">; readonly layer: FieldSpec<"i32">; readonly skin: FieldSpec<"u32">; readonly finished: FieldSpec<"bool"> }, Skeleton2D>;
|
|
22345
23263
|
/**
|
|
22346
|
-
* A 2D skeleton's clip passed one of its events (`event 0.2 "step"` in the rig) in the last tick: footsteps, the frame a swing lands. Read in the tick after, like every event; a clip started at 0 fires its events at 0, a looping clip fires each once per pass.
|
|
23264
|
+
* A 2D skeleton's clip, or the clip a child armature in one of its slots plays, passed one of its events (`event 0.2 "step"` in the rig) in the last tick: footsteps, the frame a swing lands. Read in the tick after, like every event; a clip started at 0 fires its events at 0, a looping clip fires each once per pass.
|
|
22347
23265
|
*/
|
|
22348
23266
|
const Skeleton2DEvent: EventType<Skeleton2DEvent>;
|
|
22349
23267
|
/**
|
|
@@ -23800,7 +24718,7 @@ export declare namespace og {
|
|
|
23800
24718
|
const TerrainScatter: ComponentType<{ readonly data: FieldSpec<"TerrainData">; readonly geometry: FieldSpec<"Geometry">; readonly material: FieldSpec<"Material">; readonly layer: FieldSpec<"u32">; readonly density: FieldSpec<"f32">; readonly distance: FieldSpec<"f32">; readonly fade: FieldSpec<"f32">; readonly minScale: FieldSpec<"f32">; readonly maxScale: FieldSpec<"f32">; readonly align: FieldSpec<"f32">; readonly seed: FieldSpec<"u32"> }, TerrainScatter>;
|
|
23801
24719
|
/**
|
|
23802
24720
|
* Terrain (phase 2): a height field over a rectangle, cooked by `og cook` from a `type terrain` .ogt (a 16-bit grey PNG or an EXR heightmap, an optional control map, up to four layered materials with slope and altitude rules, their maps separate textures or layers of two texture arrays: `layers` and `layerNormals` with each layer's `albedoLayer` and `normalLayer`, two sampled textures instead of up to eight) into tiles; drawn as a geometry clipmap around the camera (nested levels by distance, no cracks) that casts and receives shadows under the fog; collided with as a height field; baked into navmeshes by a navmesh file's `terrain` entry.
|
|
23803
|
-
* Load it with og.terrain.load, then place it: an og.Terrain on an entity draws it placed by the entity's world transform (centred on its position, turned and scaled with it), and an og.Collider of shape SHAPE_HEIGHTFIELD naming the TerrainInfo's geometry makes it solid. og.TerrainScatter grows grass, flowers or stones over a layer near the camera. og.terrain.sample answers the surface's height and normal anywhere (pass it the entity's position, quaternion and scale); og.terrain.edit raises, lowers, flattens, smooths or paints it at runtime, and og.terrain.setLayer retunes a layer. Edits are world state: a snapshot keeps them, the world hash covers them, and a restore brings the ground back as it was (rebuilt from the cook with the restored edits replayed, for the renderer, physics and sample alike).
|
|
24721
|
+
* Load it with og.terrain.load, then place it: an og.Terrain on an entity draws it placed by the entity's world transform (centred on its position, turned and scaled with it), and an og.Collider of shape SHAPE_HEIGHTFIELD naming the TerrainInfo's geometry makes it solid. og.TerrainScatter grows grass, flowers or stones over a layer near the camera. og.terrain.sample answers the surface's height and normal anywhere (pass it the entity's position, quaternion and scale); og.terrain.edit raises, lowers, flattens, smooths or paints it at runtime, and og.terrain.setLayer retunes a layer. Terrain is 3D: the 2D profile's publish and lanes modules leave it out (RenderCapabilities.world3d is false), where every call here answers a refusal naming that field. Edits are world state: a snapshot keeps them, the world hash covers them, and a restore brings the ground back as it was (rebuilt from the cook with the restored edits replayed, for the renderer, physics and sample alike).
|
|
23804
24722
|
* Its tiles stream (phase 3): the cook stores the field as a pyramid of tiles, each compressed on its own, and every frame the renderer keeps on the GPU only the tiles the camera's clipmap wants, within each terrain's tile budget (16 MiB by default), decoded off the frame (a worker thread natively, the browser's DecompressionStream on the Web) a few at a time, the most needed first; until a tile arrives its area draws from the coarser level that holds it, then fades in. Nothing a tick reads depends on which tiles are resident (collision and og.terrain.sample read the whole field), so a run's world hash is the same streamed or not. The probe's `terrain_stream:resident` decodes every wanted tile before each frame instead (`terrain_stream:stream[:<MiB>]` streams again, within that budget), and `dump_stream`'s `terrain` gives the tiles resident, waiting, decoding and cached.
|
|
23805
24723
|
*/
|
|
23806
24724
|
namespace terrain {
|