@origingame/engine 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/og.mjs +25 -0
- package/dist/web/origin-engine.d.ts +1233 -0
- package/dist/web/origin-engine.js +8628 -0
- package/dist/web/origin-engine_bg.wasm +0 -0
- package/dist/web/origin-engine_bg.wasm.d.ts +366 -0
- package/dist/web-publish/origin-engine-lanes.js +8509 -0
- package/dist/web-publish/origin-engine-lanes_bg.wasm +0 -0
- package/dist/web-publish/origin-engine.d.ts +1176 -0
- package/dist/web-publish/origin-engine.js +8313 -0
- package/dist/web-publish/origin-engine_bg.wasm +0 -0
- package/dist/web-publish/origin-engine_bg.wasm.d.ts +347 -0
- package/dist/web-publish/snippets/wasm-bindgen-rayon-38edf6e439f6d70d/src/workerHelpers.no-bundler.js +77 -0
- package/dist/web-publish-2d/origin-engine-lanes.js +8509 -0
- package/dist/web-publish-2d/origin-engine-lanes_bg.wasm +0 -0
- package/dist/web-publish-2d/origin-engine.d.ts +1176 -0
- package/dist/web-publish-2d/origin-engine.js +8313 -0
- package/dist/web-publish-2d/origin-engine_bg.wasm +0 -0
- package/dist/web-publish-2d/origin-engine_bg.wasm.d.ts +347 -0
- package/dist/web-publish-2d/snippets/wasm-bindgen-rayon-38edf6e439f6d70d/src/workerHelpers.no-bundler.js +77 -0
- package/knowledge/README.md +31 -0
- package/knowledge/knowledge.json +13 -0
- package/knowledge/looks/catalogue.json +1871 -0
- package/knowledge/package.json +33 -0
- package/knowledge/rules/platform.json +329 -0
- package/knowledge/scaffold/README.md +27 -0
- package/knowledge/scaffold/distribution.json +48 -0
- package/knowledge/scaffold/origin-engine.json +19 -0
- package/knowledge/scaffold/template/.origin/setup +14 -0
- package/knowledge/scaffold/template/LICENSES.md +23 -0
- package/knowledge/scaffold/template/README.md +37 -0
- package/knowledge/scaffold/template/assets/ai/guard.ogt +48 -0
- package/knowledge/scaffold/template/assets/audio/click.ogt +9 -0
- package/knowledge/scaffold/template/assets/fonts/NotoSansSC-Regular-subset.ttf.ogt +12 -0
- package/knowledge/scaffold/template/assets/fonts/OFL.txt +93 -0
- package/knowledge/scaffold/template/assets/looks/origin-game.ogt +12 -0
- package/knowledge/scaffold/template/assets/nav/yard.ogt +27 -0
- package/knowledge/scaffold/template/assets/scenes/main.ogt +34 -0
- package/knowledge/scaffold/template/assets/strings/en.ogt +14 -0
- package/knowledge/scaffold/template/assets/textures/stone_n.png.ogt +7 -0
- package/knowledge/scaffold/template/gitattributes +22 -0
- package/knowledge/scaffold/template/package.json +18 -0
- package/knowledge/scaffold/template/project.ogt +25 -0
- package/knowledge/scaffold/template/src/main.ts +246 -0
- package/knowledge/scaffold/template/tests/guard.og.ts +67 -0
- package/knowledge/scaffold/template/tests/smoke.og.ts +43 -0
- package/knowledge/scaffold/template/tsconfig.json +17 -0
- package/knowledge/scripts/lib.ts +203 -0
- package/knowledge/scripts/mount.ts +210 -0
- package/knowledge/scripts/pack.ts +24 -0
- package/knowledge/scripts/scaffold.ts +72 -0
- package/knowledge/scripts/validate.ts +749 -0
- package/knowledge/skills/og-ai/SKILL.md +386 -0
- package/knowledge/skills/og-audio/SKILL.md +191 -0
- package/knowledge/skills/og-build/SKILL.md +330 -0
- package/knowledge/skills/og-core/SKILL.md +285 -0
- package/knowledge/skills/og-feel/SKILL.md +385 -0
- package/knowledge/skills/og-game/SKILL.md +1479 -0
- package/knowledge/skills/og-i18n/SKILL.md +220 -0
- package/knowledge/skills/og-platform-sdk/SKILL.md +199 -0
- package/knowledge/skills/og-taste/SKILL.md +537 -0
- package/knowledge/skills/og-ui/SKILL.md +444 -0
- package/knowledge/wiki/ai.md +627 -0
- package/knowledge/wiki/anim.md +1187 -0
- package/knowledge/wiki/atmosphere.md +636 -0
- package/knowledge/wiki/audio.md +732 -0
- package/knowledge/wiki/camera.md +711 -0
- package/knowledge/wiki/commands.md +357 -0
- package/knowledge/wiki/game.md +220 -0
- package/knowledge/wiki/i18n.md +213 -0
- package/knowledge/wiki/index.md +1027 -0
- package/knowledge/wiki/input.md +1714 -0
- package/knowledge/wiki/load.md +1280 -0
- package/knowledge/wiki/math.md +166 -0
- package/knowledge/wiki/nav.md +1154 -0
- package/knowledge/wiki/physics.md +3142 -0
- package/knowledge/wiki/platform.md +857 -0
- package/knowledge/wiki/probe.md +1692 -0
- package/knowledge/wiki/reflect.md +285 -0
- package/knowledge/wiki/render.md +3511 -0
- package/knowledge/wiki/rng.md +393 -0
- package/knowledge/wiki/stream.md +376 -0
- package/knowledge/wiki/system.md +197 -0
- package/knowledge/wiki/systems.md +43 -0
- package/knowledge/wiki/terrain.md +727 -0
- package/knowledge/wiki/tilemap.md +422 -0
- package/knowledge/wiki/time.md +150 -0
- package/knowledge/wiki/transform.md +230 -0
- package/knowledge/wiki/tween.md +580 -0
- package/knowledge/wiki/ui.md +8000 -0
- package/knowledge/wiki/world.md +909 -0
- package/package.json +68 -4
- package/schema/api.schema.json +29675 -0
- package/shell/README.md +22 -0
- package/shell/brand/README.md +23 -0
- package/shell/brand/icon-192.png +0 -0
- package/shell/brand/icon-512.png +0 -0
- package/shell/brand/mark-on-paper.svg +6 -0
- package/shell/brand/origin-mark.svg +5 -0
- package/shell/brand/origin-motion.css +251 -0
- package/shell/brand/tokens.css +20 -0
- package/shell/brand.ts +132 -0
- package/shell/page.ts +715 -0
- package/shell/platform.ts +203 -0
- package/shell/player.ts +238 -0
- package/shell/shell.css +185 -0
- package/shell/sw.ts +177 -0
- package/shell/transport.ts +515 -0
- package/shell/wire.ts +369 -0
- package/src/e6.ts +69 -0
- package/src/env.d.ts +100 -0
- package/src/generated/abi.ts +980 -0
- package/src/index.ts +193 -0
- package/src/node/audio.ts +86 -0
- package/src/node/build.ts +109 -0
- package/src/node/device.ts +981 -0
- package/src/node/doctor.ts +60 -0
- package/src/node/index.ts +102 -0
- package/src/node/platform.ts +24 -0
- package/src/node/playtest-run.ts +249 -0
- package/src/node/png.ts +130 -0
- package/src/node/polish.ts +976 -0
- package/src/node/run.ts +373 -0
- package/src/node/web-build.ts +808 -0
- package/src/p2.ts +35 -0
- package/src/platform-local.ts +211 -0
- package/src/playtest.ts +131 -0
- package/src/runtime.ts +1509 -0
- package/src/systems/cameras.ts +247 -0
- package/src/ui-kit/bind.ts +141 -0
- package/src/ui-kit/huds.ts +303 -0
- package/src/ui-kit/index.ts +36 -0
- package/src/ui-kit/menus.ts +187 -0
- package/src/ui-kit/settings.ts +131 -0
- package/src/ui-kit/store.ts +222 -0
- package/src/ui-kit/story.ts +89 -0
- package/src/ui-kit/util.ts +106 -0
- package/src/web/a11y.ts +429 -0
- package/src/web/audio-worklet.ts +193 -0
- package/src/web/audio.ts +307 -0
- package/src/web/basis.ts +239 -0
- package/src/web/gamepad.ts +123 -0
- package/src/web/host.ts +166 -0
- package/src/web/input.ts +237 -0
- package/src/web/lanes.ts +21 -0
- package/src/web/play.ts +20 -0
- package/src/web/rpc-ring.ts +110 -0
- package/src/web/settle.ts +122 -0
- package/src/web/shell.ts +643 -0
- package/src/web/text-input.ts +248 -0
- package/src/web/worker.ts +1002 -0
- package/types/bindings.json +13654 -0
- package/types/index.d.ts +20090 -0
- package/vendor/basis/LICENSE +201 -0
- package/vendor/basis/NOTICE +15 -0
- package/vendor/basis/README.md +18 -0
- package/vendor/basis/basis_transcoder.js +19 -0
- package/vendor/basis/basis_transcoder.wasm +0 -0
- package/README.md +0 -3
|
@@ -0,0 +1,3511 @@
|
|
|
1
|
+
<!-- Generated from crates/og-api/api.ogt by `og api gen`. Do not edit: `og api check` fails on any difference; change api.ogt and regenerate. -->
|
|
2
|
+
|
|
3
|
+
# The `render` module
|
|
4
|
+
|
|
5
|
+
What is drawn: meshes with materials. Draws are instanced by (geometry, material) automatically; there is no per-object draw call.
|
|
6
|
+
|
|
7
|
+
- **TypeScript**: functions are the namespace `og.render`; components, resources and events are tokens on `og`.
|
|
8
|
+
- **Publish builds**: kept (members may override).
|
|
9
|
+
- **Skill**: `og-game`, which teaches the module (how much of it to use, and how to prove it).
|
|
10
|
+
- **Index**: [every module and name](index.md).
|
|
11
|
+
|
|
12
|
+
```ogt
|
|
13
|
+
module render {
|
|
14
|
+
# declarations follow, each quoted below
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
<sub>`api.ogt` line 1649</sub>
|
|
18
|
+
|
|
19
|
+
## Contents
|
|
20
|
+
|
|
21
|
+
| Name | Kind | Summary |
|
|
22
|
+
|---|---|---|
|
|
23
|
+
| [`Geometry`](#type-Geometry) | handle | Vertex and index data, as three.js BufferGeometry. Comes from a loaded glTF. |
|
|
24
|
+
| [`Material`](#type-Material) | handle | A material instance. |
|
|
25
|
+
| [`Texture`](#type-Texture) | handle | A cooked texture. |
|
|
26
|
+
| [`Geometry()`](#column-Geometry) | column kind | A Geometry handle field. |
|
|
27
|
+
| [`Material()`](#column-Material) | column kind | A Material handle field. |
|
|
28
|
+
| [`Side`](#type-Side) | enum | Which faces are drawn, as three.js FrontSide, BackSide and DoubleSide. |
|
|
29
|
+
| [`RenderTier`](#type-RenderTier) | enum | The backend the renderer runs on; the probe's hello reports it. |
|
|
30
|
+
| [`Antialias`](#type-Antialias) | enum | Antialiasing, as og-render's Antialias. RenderCapabilities.antialias reports what the device resolved. |
|
|
31
|
+
| [`PointShadows`](#type-PointShadows) | enum | How a point light's shadow map is stored, as og-render's PointShadows. RenderCapabilities.pointShadows reports what the device resolved. |
|
|
32
|
+
| [`TaaHistory`](#type-TaaHistory) | enum | How TAA resamples its history each frame, as og-render's TaaHistory. |
|
|
33
|
+
| [`RenderOptions`](#type-RenderOptions) | desc struct | How the renderer is created for a game (GameDesc.render). The host reads it once, when it attaches the renderer. |
|
|
34
|
+
| [`StandardMaterialDesc`](#type-StandardMaterialDesc) | desc struct | A physically based metallic-roughness material with three.js MeshStandardMaterial parameter names. |
|
|
35
|
+
| [`og.Mesh`](#record-Mesh) | component | Draws a geometry with a material at the entity's MatrixWorld, as a three.js Mesh. |
|
|
36
|
+
| [`og.DirectionalLight`](#record-DirectionalLight) | component | The sun, as three.js DirectionalLight: parallel light along the entity's local -Z (aim it with transform.lookAt, as a camera). The first one found is drawn, with three shadow cascades. |
|
|
37
|
+
| [`og.PointLight`](#record-PointLight) | component | A light shining in every direction from the entity's position, as three.js PointLight. Its radiance at distance d is color * intensity / d^2, faded smoothly to zero at distance. |
|
|
38
|
+
| [`og.SpotLight`](#record-SpotLight) | component | A cone of light along the entity's local -Z, as three.js SpotLight. |
|
|
39
|
+
| [`ToneMapping`](#type-ToneMapping) | enum | The curve from the lit HDR image to the display, as three.js toneMapping. RenderSettings.toneMapped false clamps instead, whichever is chosen. |
|
|
40
|
+
| [`ToneMapping()`](#column-ToneMapping) | column kind | A ToneMapping field: the variant's index. |
|
|
41
|
+
| [`og.RenderSettings`](#record-RenderSettings) | resource | 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. |
|
|
42
|
+
| [`Lut`](#type-Lut) | handle | A colour lookup table for PostEffects.lut, from og.load.lut (a `.cube` file). |
|
|
43
|
+
| [`EnvironmentMap`](#type-EnvironmentMap) | handle | A prefiltered HDR environment map for Environment.map, from og.load.environment (an `.ogt` of `type environment` naming an equirectangular `.hdr` or `.exr`, a KTX2 cube map, or six face images). |
|
|
44
|
+
| [`ParticleEmitter`](#type-ParticleEmitter) | handle | A particle emitter asset for ParticleSystem.emitter, from og.load.emitter (an `.ogt` of `type particles`). |
|
|
45
|
+
| [`Texture()`](#column-Texture) | column kind | A Texture handle field (0 is none). |
|
|
46
|
+
| [`Lut()`](#column-Lut) | column kind | A Lut handle field (0 is none). |
|
|
47
|
+
| [`EnvironmentMap()`](#column-EnvironmentMap) | column kind | An EnvironmentMap handle field (0 is none). |
|
|
48
|
+
| [`og.Environment`](#record-Environment) | resource | 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. |
|
|
49
|
+
| [`ParticleEmitter()`](#column-ParticleEmitter) | column kind | A ParticleEmitter handle field (0 is none). |
|
|
50
|
+
| [`AoMethod`](#type-AoMethod) | enum | Which ambient occlusion algorithm runs. |
|
|
51
|
+
| [`AoMethod()`](#column-AoMethod) | column kind | An AoMethod field: the variant's index. |
|
|
52
|
+
| [`DofQuality`](#type-DofQuality) | enum | How many taps depth of field gathers per pixel. |
|
|
53
|
+
| [`DofQuality()`](#column-DofQuality) | column kind | A DofQuality field: the variant's index. |
|
|
54
|
+
| [`SpriteBlend`](#type-SpriteBlend) | enum | How a sprite is blended over what is below it. |
|
|
55
|
+
| [`SpriteBlend()`](#column-SpriteBlend) | column kind | A SpriteBlend field: the variant's index. |
|
|
56
|
+
| [`StripBlend`](#type-StripBlend) | enum | How a trail, ribbon or beam is blended. |
|
|
57
|
+
| [`StripBlend()`](#column-StripBlend) | column kind | A StripBlend field: the variant's index. |
|
|
58
|
+
| [`og.PostEffects`](#record-PostEffects) | resource | 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. |
|
|
59
|
+
| [`Palette`](#type-Palette) | handle | A colour palette for Stylise.palette, from og.load.palette (a `.hex` or GIMP `.gpl` file of up to 256 colours). |
|
|
60
|
+
| [`Look`](#type-Look) | handle | A look from og.load.look (an `.ogt` of `type look`): the frame's whole art direction as data, applied with og.render.applyLook. |
|
|
61
|
+
| [`Palette()`](#column-Palette) | column kind | A Palette handle field (0 is none). |
|
|
62
|
+
| [`DitherPattern`](#type-DitherPattern) | enum | The threshold pattern Stylise.dither spreads the steps of posterize and palette with. |
|
|
63
|
+
| [`DitherPattern()`](#column-DitherPattern) | column kind | A DitherPattern field: the variant's index. |
|
|
64
|
+
| [`StyliseSpace`](#type-StyliseSpace) | enum | Where Stylise lays a pattern (the paint canvas, the hatching, the halftone). |
|
|
65
|
+
| [`StyliseSpace()`](#column-StyliseSpace) | column kind | A StyliseSpace field: the variant's index. |
|
|
66
|
+
| [`og.Stylise`](#record-Stylise) | resource | 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. |
|
|
67
|
+
| [`og.MaterialStyle`](#record-MaterialStyle) | resource | Stylised defaults for every lit material, so a whole scene takes one treatment without editing each material: toon shading and its ramp, a coloured shadow side, rim light, outlines whose width falls off with distance, and flat facets. Each applies to a material (og.render.standardMaterial or a loaded glTF's) that leaves that field at its own default; unlit and shader materials, materials with StandardMaterialDesc.styled false, sprites and the UI are untouched, and toon passes by a material with a MeshPhysicalMaterial lobe (clearcoat, sheen, transmission, iridescence, anisotropy, ior), which keeps its physical shading. All off (false, 0) is no change. A look sets it; RenderCapabilities.stylise names what this renderer draws. Read after each tick; it never feeds back into the simulation. |
|
|
68
|
+
| [`LookInfo`](#type-LookInfo) | struct | A loaded look: where it came from and what applying it sets. |
|
|
69
|
+
| [`og.Lighting2D`](#record-Lighting2D) | resource | 2D lighting of the sprite layers minLayer to maxLayer (sprites, 2D particles and og.Tilemap layers there, a map layer unless its `lit` property is false): their colour is multiplied by ambient plus every Light2D reaching the pixel, shadowed by Occluder2Ds and sprites with castShadow. Other layers (and the overlay) are drawn as authored. Off by default. |
|
|
70
|
+
| [`og.Light2D`](#record-Light2D) | component | A light in the 2D plane at the entity's position (z ignored): color times intensity at its centre, falling to zero at radius with (1 - d/r)^falloff, shadowed by occluders when castShadows. Lighting2D.enabled turns 2D lighting on; at most 64 are drawn. |
|
|
71
|
+
| [`og.Occluder2D`](#record-Occluder2D) | component | A rectangle that blocks 2D light (walls, crates, characters), centred on the entity's position and turned with it about z. Pixels inside it are not shadowed by it. At most 128 are drawn. |
|
|
72
|
+
| [`og.Decal`](#record-Decal) | component | A projected decal (scorch marks, blood, posters, bullet holes): the entity's unit box (-0.5 to 0.5 on each axis, scaled by its Transform) projected along its local -Z onto every lit opaque surface inside it, shaded with the surface. Its image is the uvMin to uvMax region of RenderSettings.decalAtlas (a solid colour without one). At most 32 are drawn. |
|
|
73
|
+
| [`og.ParticleSystem`](#record-ParticleSystem) | component | Emits particles from an og.load.emitter asset at the entity's MatrixWorld. Particles are simulated by the renderer from (seed, startTick, the tick), so they are deterministic and replay, and never feed back into the simulation: compute on the full tier, the CPU on WebGL2, identical either way. |
|
|
74
|
+
| [`og.Trail`](#record-Trail) | component | A streak behind the entity: its world positions over the last `lifetime` seconds as a camera-facing strip, from widthStart and color at the head to widthEnd and colorEnd at the tail. |
|
|
75
|
+
| [`og.Beam`](#record-Beam) | component | A strip from the entity's position to `end` whose texture scrolls with the tick: lasers, tethers, lightning (jitter). |
|
|
76
|
+
| [`RibbonPoint`](#type-RibbonPoint) | desc struct | One point of a ribbon. |
|
|
77
|
+
| [`RibbonDesc`](#type-RibbonDesc) | desc struct | An explicit camera-facing strip through points, drawn this frame only (immediate mode, as og.render.sprite): submit it every tick it should show. |
|
|
78
|
+
| [`og.render.ribbon`](#fn-ribbon) | function | Draw a ribbon this frame. Systems and commands may call it; the list is cleared at every tick. |
|
|
79
|
+
| [`TextDesc`](#type-TextDesc) | desc struct | A line or block of MSDF text in the world's xy plane facing +z, drawn this frame only (immediate mode: submit it every tick it should show). |
|
|
80
|
+
| [`TextMeasureDesc`](#type-TextMeasureDesc) | desc struct | Text to measure with og.render.measureText, laid out as og.render.text lays it out. |
|
|
81
|
+
| [`TextMetrics`](#type-TextMetrics) | struct | The extent of a laid-out text, in world units. |
|
|
82
|
+
| [`SpriteDesc`](#type-SpriteDesc) | desc struct | A textured or solid quad in the world's xy plane facing +z, drawn this frame only (immediate mode, as og.render.text): submit it every tick it should show. Sprites and text are sorted by layer and drawn over the 3D scene. |
|
|
83
|
+
| [`og.render.sprite`](#fn-sprite) | function | Draw a sprite this frame. Systems and commands may call it; the list is cleared at every tick, so submit it every tick the sprite should show. |
|
|
84
|
+
| [`og.Sprite`](#record-Sprite) | component | A sprite drawn every frame at the entity's MatrixWorld (its xy and z, its rotation about z; its scale multiplies width and height, so squash and stretch is a tween of og.Transform.scale). With an og.Flipbook on the entity, the texture (or an `array true` sheet's texture array layer), region and anchor come from the flipbook's current frame. |
|
|
85
|
+
| [`og.Afterimage`](#record-Afterimage) | component | Ghosts of the entity's og.Sprite: every `interval` ticks its pose (position, rotation, scale, frame, flips) is kept, and the last `count` are drawn behind it, fading from `opacity` to 0, tinted by color. A dash, a speed-up, a teleport. The history is world state (the og.sprite state block). |
|
|
86
|
+
| [`FloatingTextDesc`](#type-FloatingTextDesc) | desc struct | A damage number or pickup text that pops at a point, rises, spreads and fades by itself (no per-tick submission). Deterministic: its drift comes from the tick and its order, and it is world state (the og.sprite state block). |
|
|
87
|
+
| [`og.render.floatingText`](#fn-floatingText) | function | Spawn a floating text (damage numbers, +coins, `blocked`). It lives `lifetime` seconds of scaled time on its own; systems and commands may call it. |
|
|
88
|
+
| [`og.render.measureText`](#fn-measureText) | function | The size text takes when og.render.text draws it, for centring, wrapping and layout. |
|
|
89
|
+
| [`BoxGeometryDesc`](#type-BoxGeometryDesc) | desc struct | A box centred at the origin, as three.js BoxGeometry(width, height, depth). |
|
|
90
|
+
| [`PlaneGeometryDesc`](#type-PlaneGeometryDesc) | desc struct | A rectangle in the xy plane facing +z, centred at the origin, as three.js PlaneGeometry(width, height); turn it -pi/2 about x for a floor. |
|
|
91
|
+
| [`SphereGeometryDesc`](#type-SphereGeometryDesc) | desc struct | A UV sphere centred at the origin, as three.js SphereGeometry(radius, widthSegments, heightSegments). |
|
|
92
|
+
| [`og.render.boxGeometry`](#fn-boxGeometry) | function | Make a box geometry for og.Mesh. Physics can use it as a convex or triangle-mesh Collider.mesh too. |
|
|
93
|
+
| [`og.render.planeGeometry`](#fn-planeGeometry) | function | Make a plane geometry for og.Mesh. Physics can use it as a triangle-mesh Collider.mesh too. |
|
|
94
|
+
| [`og.render.sphereGeometry`](#fn-sphereGeometry) | function | Make a sphere geometry for og.Mesh (give its body a sphere Collider, not this mesh). |
|
|
95
|
+
| [`MAX_LIGHTS`](#const-MAX_LIGHTS) | constant | The most point and spot lights one frame draws, among those in view; past it the ones brightest at the camera are kept. |
|
|
96
|
+
| [`MAX_CLUSTER_LIGHTS`](#const-MAX_CLUSTER_LIGHTS) | constant | The most point and spot lights that shade one screen cluster (a 1/16 by 1/9 tile of the view and one of 24 depth slices); past it the ones brightest at the camera are kept there. |
|
|
97
|
+
| [`UI_LAYER`](#const-UI_LAYER) | constant | The UI's layer among screen sprites and screen text (SpriteDesc and TextDesc with screen): those at or below it draw under every og.ui element, those above it over every one, modals, toasts and the screen transition included (a HUD element made of sprites sitting on a UI panel: draw it only while its screen shows), in their layers' order either way. |
|
|
98
|
+
| [`RenderCapabilities`](#type-RenderCapabilities) | struct | What the renderer can do on this device. Backend limits are reported here, never by missing members. |
|
|
99
|
+
| [`og.render.standardMaterial`](#fn-standardMaterial) | function | Create a standard material. |
|
|
100
|
+
| [`og.render.updateMaterial`](#fn-updateMaterial) | function | Change some parameters of a standard material. |
|
|
101
|
+
| [`Shader`](#type-Shader) | handle | A material shader from og.load.shader (an `.ogt` of `type shader`): WGSL hooks of the lit shader and the parameters they read. |
|
|
102
|
+
| [`og.render.shaderMaterial`](#fn-shaderMaterial) | function | Create a standard material that draws with a material shader's hooks (vertex_offset, surface_color, surface_normal, surface_emissive; the og-game skill's Material shaders section has their WGSL contract), its parameters at their defaults. The hooks apply to skinned meshes too, and shadows and the depth prepass (ambient occlusion, outlines, depth of field) see the mesh where vertex_offset moved it and cut where surface_color's alpha falls below alphaTest. |
|
|
103
|
+
| [`og.render.setMaterialShader`](#fn-setMaterialShader) | function | Give an existing material a material shader, or take it away with null: a loaded model's material (GltfInfo.materials) draws its skinned or static meshes through the hooks, with the shader's parameters at their defaults. Every mesh drawn with that material changes. |
|
|
104
|
+
| [`og.render.setShaderParam`](#fn-setShaderParam) | function | Set a parameter of a shader material, by the name its shader declares: a number for float, two to four for vec2, vec3, vec4 and color. |
|
|
105
|
+
| [`og.render.applyLook`](#fn-applyLook) | function | Apply a look, in GameDesc.start (or name it in GameDesc.look) or at any tick for a level's mood, a flashback or a photo mode: every resource the look names is replaced whole (the fields it sets take its values, the rest their defaults; PostEffects.flash and PostEffects.shakeTrauma, which game code animates, keep theirs), and the UI is configured with its skin, keeping the rest of the last UiDesc. Resources it does not name are left as they are. Inside a system, the system must declare those resources among its writes. A look that switches the stylisation (a Stylise pass on or off, the pixel grid, retro 3D, the material style) starts TAA's history over, as a camera cut does, so its first frame holds no ghost of the old look. |
|
|
106
|
+
| [`og.render.look`](#fn-look) | function | The look last applied (by og.render.applyLook or GameDesc.look), as og.load.lookInfo describes it; null before any. |
|
|
107
|
+
| [`og.render.capabilities`](#fn-capabilities) | function | The renderer's tier and limits on this device. |
|
|
108
|
+
| [`og.render.text`](#fn-text) | function | Draw text this frame. Systems and commands may call it; the list is cleared at every tick, so submit it every tick the text should show. Multi-page fonts are drawn page by page with one layout. |
|
|
109
|
+
|
|
110
|
+
## Functions
|
|
111
|
+
|
|
112
|
+
<a id="fn-ribbon"></a>
|
|
113
|
+
|
|
114
|
+
### `og.render.ribbon`
|
|
115
|
+
|
|
116
|
+
Draw a ribbon this frame. Systems and commands may call it; the list is cleared at every tick.
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
og.render.ribbon(world: World, desc?: RibbonDesc): Result<void>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
| Parameter | Type | Optional | Doc |
|
|
123
|
+
|---|---|---|---|
|
|
124
|
+
| `world` | `World` | no | The world whose renderer draws it. |
|
|
125
|
+
| `desc` | `RibbonDesc` | yes | The points and the look. |
|
|
126
|
+
|
|
127
|
+
**Returns** `Result<void>`: Refused for a dead texture or fewer than two points.
|
|
128
|
+
|
|
129
|
+
Binding symbol `og_render_ribbon` · publish builds: kept
|
|
130
|
+
|
|
131
|
+
```ogt
|
|
132
|
+
fn ribbon {
|
|
133
|
+
doc "Draw a ribbon this frame. Systems and commands may call it; the list is cleared at every tick."
|
|
134
|
+
param world World "The world whose renderer draws it."
|
|
135
|
+
param desc RibbonDesc "The points and the look."
|
|
136
|
+
returns Result.Void "Refused for a dead texture or fewer than two points."
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
<sub>`api.ogt` line 2874</sub>
|
|
141
|
+
|
|
142
|
+
<a id="fn-sprite"></a>
|
|
143
|
+
|
|
144
|
+
### `og.render.sprite`
|
|
145
|
+
|
|
146
|
+
Draw a sprite this frame. Systems and commands may call it; the list is cleared at every tick, so submit it every tick the sprite should show.
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
og.render.sprite(world: World, desc?: SpriteDesc): Result<void>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
| Parameter | Type | Optional | Doc |
|
|
153
|
+
|---|---|---|---|
|
|
154
|
+
| `world` | `World` | no | The world whose renderer draws it. |
|
|
155
|
+
| `desc` | `SpriteDesc` | yes | The texture, placement, region and colour. |
|
|
156
|
+
|
|
157
|
+
**Returns** `Result<void>`: Refused for a dead texture.
|
|
158
|
+
|
|
159
|
+
Binding symbol `og_render_sprite` · publish builds: kept
|
|
160
|
+
|
|
161
|
+
```ogt
|
|
162
|
+
fn sprite {
|
|
163
|
+
doc "Draw a sprite this frame. Systems and commands may call it; the list is cleared at every tick, so submit it every tick the sprite should show."
|
|
164
|
+
param world World "The world whose renderer draws it."
|
|
165
|
+
param desc SpriteDesc "The texture, placement, region and colour."
|
|
166
|
+
returns Result.Void "Refused for a dead texture."
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
<sub>`api.ogt` line 3002</sub>
|
|
171
|
+
|
|
172
|
+
<a id="fn-floatingText"></a>
|
|
173
|
+
|
|
174
|
+
### `og.render.floatingText`
|
|
175
|
+
|
|
176
|
+
Spawn a floating text (damage numbers, +coins, `blocked`). It lives `lifetime` seconds of scaled time on its own; systems and commands may call it.
|
|
177
|
+
|
|
178
|
+
```ts
|
|
179
|
+
og.render.floatingText(world: World, desc?: FloatingTextDesc): Result<void>
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
| Parameter | Type | Optional | Doc |
|
|
183
|
+
|---|---|---|---|
|
|
184
|
+
| `world` | `World` | no | The world whose renderer draws it. |
|
|
185
|
+
| `desc` | `FloatingTextDesc` | yes | The text, the point and the style. |
|
|
186
|
+
|
|
187
|
+
**Returns** `Result<void>`: Refused for a dead font, or no font when the UI has none.
|
|
188
|
+
|
|
189
|
+
Binding symbol `og_render_floating_text` · publish builds: kept
|
|
190
|
+
|
|
191
|
+
```ogt
|
|
192
|
+
fn floatingText {
|
|
193
|
+
doc "Spawn a floating text (damage numbers, +coins, `blocked`). It lives `lifetime` seconds of scaled time on its own; systems and commands may call it."
|
|
194
|
+
param world World "The world whose renderer draws it."
|
|
195
|
+
param desc FloatingTextDesc "The text, the point and the style."
|
|
196
|
+
returns Result.Void "Refused for a dead font, or no font when the UI has none."
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
<sub>`api.ogt` line 3179</sub>
|
|
201
|
+
|
|
202
|
+
<a id="fn-measureText"></a>
|
|
203
|
+
|
|
204
|
+
### `og.render.measureText`
|
|
205
|
+
|
|
206
|
+
The size text takes when og.render.text draws it, for centring, wrapping and layout.
|
|
207
|
+
|
|
208
|
+
```ts
|
|
209
|
+
og.render.measureText(world: World, desc?: TextMeasureDesc): Result<TextMetrics>
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
| Parameter | Type | Optional | Doc |
|
|
213
|
+
|---|---|---|---|
|
|
214
|
+
| `world` | `World` | no | The world whose renderer owns the font. |
|
|
215
|
+
| `desc` | `TextMeasureDesc` | yes | The font, text and size. |
|
|
216
|
+
|
|
217
|
+
**Returns** `Result<TextMetrics>`: Refused for a dead font.
|
|
218
|
+
|
|
219
|
+
Binding symbol `og_render_measure_text` · publish builds: kept
|
|
220
|
+
|
|
221
|
+
```ogt
|
|
222
|
+
fn measureText {
|
|
223
|
+
doc "The size text takes when og.render.text draws it, for centring, wrapping and layout."
|
|
224
|
+
param world World "The world whose renderer owns the font."
|
|
225
|
+
param desc TextMeasureDesc "The font, text and size."
|
|
226
|
+
returns Result.TextMetrics "Refused for a dead font."
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
<sub>`api.ogt` line 3186</sub>
|
|
231
|
+
|
|
232
|
+
<a id="fn-boxGeometry"></a>
|
|
233
|
+
|
|
234
|
+
### `og.render.boxGeometry`
|
|
235
|
+
|
|
236
|
+
Make a box geometry for og.Mesh. Physics can use it as a convex or triangle-mesh Collider.mesh too.
|
|
237
|
+
|
|
238
|
+
```ts
|
|
239
|
+
og.render.boxGeometry(world: World, desc?: BoxGeometryDesc): Result<Geometry>
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
| Parameter | Type | Optional | Doc |
|
|
243
|
+
|---|---|---|---|
|
|
244
|
+
| `world` | `World` | no | The world whose renderer owns the geometry. |
|
|
245
|
+
| `desc` | `BoxGeometryDesc` | yes | Its extents and texture repeat. |
|
|
246
|
+
|
|
247
|
+
**Returns** `Result<Geometry>`.
|
|
248
|
+
|
|
249
|
+
Binding symbol `og_render_box_geometry` · publish builds: kept
|
|
250
|
+
|
|
251
|
+
```ogt
|
|
252
|
+
fn boxGeometry {
|
|
253
|
+
doc "Make a box geometry for og.Mesh. Physics can use it as a convex or triangle-mesh Collider.mesh too."
|
|
254
|
+
param world World "The world whose renderer owns the geometry."
|
|
255
|
+
param desc BoxGeometryDesc "Its extents and texture repeat."
|
|
256
|
+
returns Result.Geometry
|
|
257
|
+
}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
<sub>`api.ogt` line 3255</sub>
|
|
261
|
+
|
|
262
|
+
<a id="fn-planeGeometry"></a>
|
|
263
|
+
|
|
264
|
+
### `og.render.planeGeometry`
|
|
265
|
+
|
|
266
|
+
Make a plane geometry for og.Mesh. Physics can use it as a triangle-mesh Collider.mesh too.
|
|
267
|
+
|
|
268
|
+
```ts
|
|
269
|
+
og.render.planeGeometry(world: World, desc?: PlaneGeometryDesc): Result<Geometry>
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
| Parameter | Type | Optional | Doc |
|
|
273
|
+
|---|---|---|---|
|
|
274
|
+
| `world` | `World` | no | The world whose renderer owns the geometry. |
|
|
275
|
+
| `desc` | `PlaneGeometryDesc` | yes | Its extents and texture repeat. |
|
|
276
|
+
|
|
277
|
+
**Returns** `Result<Geometry>`.
|
|
278
|
+
|
|
279
|
+
Binding symbol `og_render_plane_geometry` · publish builds: kept
|
|
280
|
+
|
|
281
|
+
```ogt
|
|
282
|
+
fn planeGeometry {
|
|
283
|
+
doc "Make a plane geometry for og.Mesh. Physics can use it as a triangle-mesh Collider.mesh too."
|
|
284
|
+
param world World "The world whose renderer owns the geometry."
|
|
285
|
+
param desc PlaneGeometryDesc "Its extents and texture repeat."
|
|
286
|
+
returns Result.Geometry
|
|
287
|
+
}
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
<sub>`api.ogt` line 3262</sub>
|
|
291
|
+
|
|
292
|
+
<a id="fn-sphereGeometry"></a>
|
|
293
|
+
|
|
294
|
+
### `og.render.sphereGeometry`
|
|
295
|
+
|
|
296
|
+
Make a sphere geometry for og.Mesh (give its body a sphere Collider, not this mesh).
|
|
297
|
+
|
|
298
|
+
```ts
|
|
299
|
+
og.render.sphereGeometry(world: World, desc?: SphereGeometryDesc): Result<Geometry>
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
| Parameter | Type | Optional | Doc |
|
|
303
|
+
|---|---|---|---|
|
|
304
|
+
| `world` | `World` | no | The world whose renderer owns the geometry. |
|
|
305
|
+
| `desc` | `SphereGeometryDesc` | yes | Its radius, tessellation and texture repeat. |
|
|
306
|
+
|
|
307
|
+
**Returns** `Result<Geometry>`.
|
|
308
|
+
|
|
309
|
+
Binding symbol `og_render_sphere_geometry` · publish builds: kept
|
|
310
|
+
|
|
311
|
+
```ogt
|
|
312
|
+
fn sphereGeometry {
|
|
313
|
+
doc "Make a sphere geometry for og.Mesh (give its body a sphere Collider, not this mesh)."
|
|
314
|
+
param world World "The world whose renderer owns the geometry."
|
|
315
|
+
param desc SphereGeometryDesc "Its radius, tessellation and texture repeat."
|
|
316
|
+
returns Result.Geometry
|
|
317
|
+
}
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
<sub>`api.ogt` line 3269</sub>
|
|
321
|
+
|
|
322
|
+
<a id="fn-standardMaterial"></a>
|
|
323
|
+
|
|
324
|
+
### `og.render.standardMaterial`
|
|
325
|
+
|
|
326
|
+
Create a standard material.
|
|
327
|
+
|
|
328
|
+
```ts
|
|
329
|
+
og.render.standardMaterial(world: World, desc?: StandardMaterialDesc): Result<Material>
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
| Parameter | Type | Optional | Doc |
|
|
333
|
+
|---|---|---|---|
|
|
334
|
+
| `world` | `World` | no | The world whose renderer owns the material. |
|
|
335
|
+
| `desc` | `StandardMaterialDesc` | yes | The parameters; omitted ones take three.js defaults. |
|
|
336
|
+
|
|
337
|
+
**Returns** `Result<Material>`.
|
|
338
|
+
|
|
339
|
+
Binding symbol `og_render_standard_material` · publish builds: kept
|
|
340
|
+
|
|
341
|
+
```ogt
|
|
342
|
+
fn standardMaterial {
|
|
343
|
+
doc "Create a standard material."
|
|
344
|
+
param world World "The world whose renderer owns the material."
|
|
345
|
+
param desc StandardMaterialDesc "The parameters; omitted ones take three.js defaults."
|
|
346
|
+
returns Result.Material
|
|
347
|
+
}
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
<sub>`api.ogt` line 3293</sub>
|
|
351
|
+
|
|
352
|
+
<a id="fn-updateMaterial"></a>
|
|
353
|
+
|
|
354
|
+
### `og.render.updateMaterial`
|
|
355
|
+
|
|
356
|
+
Change some parameters of a standard material.
|
|
357
|
+
|
|
358
|
+
```ts
|
|
359
|
+
og.render.updateMaterial(world: World, material: Material, desc?: StandardMaterialDesc): Result<void>
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
| Parameter | Type | Optional | Doc |
|
|
363
|
+
|---|---|---|---|
|
|
364
|
+
| `world` | `World` | no | The world whose renderer owns the material. |
|
|
365
|
+
| `material` | `Material` | no | The material. |
|
|
366
|
+
| `desc` | `StandardMaterialDesc` | yes | The parameters to change; omitted ones keep their values. |
|
|
367
|
+
|
|
368
|
+
**Returns** `Result<void>`: Refused for a dead material.
|
|
369
|
+
|
|
370
|
+
Binding symbol `og_render_update_material` · publish builds: kept
|
|
371
|
+
|
|
372
|
+
```ogt
|
|
373
|
+
fn updateMaterial {
|
|
374
|
+
doc "Change some parameters of a standard material."
|
|
375
|
+
param world World "The world whose renderer owns the material."
|
|
376
|
+
param material Material "The material."
|
|
377
|
+
param desc StandardMaterialDesc "The parameters to change; omitted ones keep their values."
|
|
378
|
+
returns Result.Void "Refused for a dead material."
|
|
379
|
+
}
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
<sub>`api.ogt` line 3300</sub>
|
|
383
|
+
|
|
384
|
+
<a id="fn-shaderMaterial"></a>
|
|
385
|
+
|
|
386
|
+
### `og.render.shaderMaterial`
|
|
387
|
+
|
|
388
|
+
Create a standard material that draws with a material shader's hooks (vertex_offset, surface_color, surface_normal, surface_emissive; the og-game skill's Material shaders section has their WGSL contract), its parameters at their defaults. The hooks apply to skinned meshes too, and shadows and the depth prepass (ambient occlusion, outlines, depth of field) see the mesh where vertex_offset moved it and cut where surface_color's alpha falls below alphaTest.
|
|
389
|
+
|
|
390
|
+
```ts
|
|
391
|
+
og.render.shaderMaterial(world: World, shader: Shader, desc?: StandardMaterialDesc): Result<Material>
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
| Parameter | Type | Optional | Doc |
|
|
395
|
+
|---|---|---|---|
|
|
396
|
+
| `world` | `World` | no | The world whose renderer owns the material. |
|
|
397
|
+
| `shader` | `Shader` | no | The shader. |
|
|
398
|
+
| `desc` | `StandardMaterialDesc` | yes | The base material; omitted parameters take three.js defaults. A dissolve sets alphaTest so that alpha below it is cut. |
|
|
399
|
+
|
|
400
|
+
**Returns** `Result<Material>`: Refused for a shader not loaded in this world.
|
|
401
|
+
|
|
402
|
+
Binding symbol `og_render_shader_material` · publish builds: kept
|
|
403
|
+
|
|
404
|
+
```ogt
|
|
405
|
+
fn shaderMaterial {
|
|
406
|
+
doc "Create a standard material that draws with a material shader's hooks (vertex_offset, surface_color, surface_normal, surface_emissive; the og-game skill's Material shaders section has their WGSL contract), its parameters at their defaults. The hooks apply to skinned meshes too, and shadows and the depth prepass (ambient occlusion, outlines, depth of field) see the mesh where vertex_offset moved it and cut where surface_color's alpha falls below alphaTest."
|
|
407
|
+
param world World "The world whose renderer owns the material."
|
|
408
|
+
param shader Shader "The shader."
|
|
409
|
+
param desc StandardMaterialDesc "The base material; omitted parameters take three.js defaults. A dissolve sets alphaTest so that alpha below it is cut."
|
|
410
|
+
returns Result.Material "Refused for a shader not loaded in this world."
|
|
411
|
+
}
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
<sub>`api.ogt` line 3310</sub>
|
|
415
|
+
|
|
416
|
+
<a id="fn-setMaterialShader"></a>
|
|
417
|
+
|
|
418
|
+
### `og.render.setMaterialShader`
|
|
419
|
+
|
|
420
|
+
Give an existing material a material shader, or take it away with null: a loaded model's material (GltfInfo.materials) draws its skinned or static meshes through the hooks, with the shader's parameters at their defaults. Every mesh drawn with that material changes.
|
|
421
|
+
|
|
422
|
+
```ts
|
|
423
|
+
og.render.setMaterialShader(world: World, material: Material, shader: Shader | null): Result<void>
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
| Parameter | Type | Optional | Doc |
|
|
427
|
+
|---|---|---|---|
|
|
428
|
+
| `world` | `World` | no | The world whose renderer owns the material. |
|
|
429
|
+
| `material` | `Material` | no | The material, from og.render.standardMaterial, og.render.shaderMaterial or a loaded glTF. |
|
|
430
|
+
| `shader` | `Shader \| null` | no | The shader, or null to draw the material plain again. |
|
|
431
|
+
|
|
432
|
+
**Returns** `Result<void>`: Refused for a dead material or a shader not loaded in this world.
|
|
433
|
+
|
|
434
|
+
Binding symbol `og_render_set_material_shader` · publish builds: kept
|
|
435
|
+
|
|
436
|
+
```ogt
|
|
437
|
+
fn setMaterialShader {
|
|
438
|
+
doc "Give an existing material a material shader, or take it away with null: a loaded model's material (GltfInfo.materials) draws its skinned or static meshes through the hooks, with the shader's parameters at their defaults. Every mesh drawn with that material changes."
|
|
439
|
+
param world World "The world whose renderer owns the material."
|
|
440
|
+
param material Material "The material, from og.render.standardMaterial, og.render.shaderMaterial or a loaded glTF."
|
|
441
|
+
param shader Option.Shader "The shader, or null to draw the material plain again."
|
|
442
|
+
returns Result.Void "Refused for a dead material or a shader not loaded in this world."
|
|
443
|
+
}
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
<sub>`api.ogt` line 3318</sub>
|
|
447
|
+
|
|
448
|
+
<a id="fn-setShaderParam"></a>
|
|
449
|
+
|
|
450
|
+
### `og.render.setShaderParam`
|
|
451
|
+
|
|
452
|
+
Set a parameter of a shader material, by the name its shader declares: a number for float, two to four for vec2, vec3, vec4 and color.
|
|
453
|
+
|
|
454
|
+
```ts
|
|
455
|
+
og.render.setShaderParam(world: World, material: Material, name: string, value: readonly number[]): Result<void>
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
| Parameter | Type | Optional | Doc |
|
|
459
|
+
|---|---|---|---|
|
|
460
|
+
| `world` | `World` | no | The world whose renderer owns the material. |
|
|
461
|
+
| `material` | `Material` | no | A material made by og.render.shaderMaterial or given a shader by og.render.setMaterialShader. |
|
|
462
|
+
| `name` | `string` | no | The parameter's name. |
|
|
463
|
+
| `value` | `readonly number[]` | no | Its value; missing components are 0. |
|
|
464
|
+
|
|
465
|
+
**Returns** `Result<void>`: Refused for a material without a shader or a parameter its shader does not declare.
|
|
466
|
+
|
|
467
|
+
Binding symbol `og_render_set_shader_param` · publish builds: kept
|
|
468
|
+
|
|
469
|
+
```ogt
|
|
470
|
+
fn setShaderParam {
|
|
471
|
+
doc "Set a parameter of a shader material, by the name its shader declares: a number for float, two to four for vec2, vec3, vec4 and color."
|
|
472
|
+
param world World "The world whose renderer owns the material."
|
|
473
|
+
param material Material "A material made by og.render.shaderMaterial or given a shader by og.render.setMaterialShader."
|
|
474
|
+
param name String "The parameter's name."
|
|
475
|
+
param value List.f32 "Its value; missing components are 0."
|
|
476
|
+
returns Result.Void "Refused for a material without a shader or a parameter its shader does not declare."
|
|
477
|
+
}
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
<sub>`api.ogt` line 3326</sub>
|
|
481
|
+
|
|
482
|
+
<a id="fn-applyLook"></a>
|
|
483
|
+
|
|
484
|
+
### `og.render.applyLook`
|
|
485
|
+
|
|
486
|
+
Apply a look, in GameDesc.start (or name it in GameDesc.look) or at any tick for a level's mood, a flashback or a photo mode: every resource the look names is replaced whole (the fields it sets take its values, the rest their defaults; PostEffects.flash and PostEffects.shakeTrauma, which game code animates, keep theirs), and the UI is configured with its skin, keeping the rest of the last UiDesc. Resources it does not name are left as they are. Inside a system, the system must declare those resources among its writes. A look that switches the stylisation (a Stylise pass on or off, the pixel grid, retro 3D, the material style) starts TAA's history over, as a camera cut does, so its first frame holds no ghost of the old look.
|
|
487
|
+
|
|
488
|
+
```ts
|
|
489
|
+
og.render.applyLook(world: World, look: Look): Result<void>
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
| Parameter | Type | Optional | Doc |
|
|
493
|
+
|---|---|---|---|
|
|
494
|
+
| `world` | `World` | no | The world whose look changes. |
|
|
495
|
+
| `look` | `Look` | no | The look, from og.load.look. |
|
|
496
|
+
|
|
497
|
+
**Returns** `Result<void>`: 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.
|
|
498
|
+
|
|
499
|
+
Binding symbol `og_render_apply_look` · publish builds: kept
|
|
500
|
+
|
|
501
|
+
```ogt
|
|
502
|
+
fn applyLook {
|
|
503
|
+
doc "Apply a look, in GameDesc.start (or name it in GameDesc.look) or at any tick for a level's mood, a flashback or a photo mode: every resource the look names is replaced whole (the fields it sets take its values, the rest their defaults; PostEffects.flash and PostEffects.shakeTrauma, which game code animates, keep theirs), and the UI is configured with its skin, keeping the rest of the last UiDesc. Resources it does not name are left as they are. Inside a system, the system must declare those resources among its writes. A look that switches the stylisation (a Stylise pass on or off, the pixel grid, retro 3D, the material style) starts TAA's history over, as a camera cut does, so its first frame holds no ghost of the old look."
|
|
504
|
+
param world World "The world whose look changes."
|
|
505
|
+
param look Look "The look, from og.load.look."
|
|
506
|
+
returns Result.Void "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."
|
|
507
|
+
}
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
<sub>`api.ogt` line 3335</sub>
|
|
511
|
+
|
|
512
|
+
<a id="fn-look"></a>
|
|
513
|
+
|
|
514
|
+
### `og.render.look`
|
|
515
|
+
|
|
516
|
+
The look last applied (by og.render.applyLook or GameDesc.look), as og.load.lookInfo describes it; null before any.
|
|
517
|
+
|
|
518
|
+
```ts
|
|
519
|
+
og.render.look(world: World): LookInfo | null
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
| Parameter | Type | Optional | Doc |
|
|
523
|
+
|---|---|---|---|
|
|
524
|
+
| `world` | `World` | no | The world asked. |
|
|
525
|
+
|
|
526
|
+
**Returns** `LookInfo | null`.
|
|
527
|
+
|
|
528
|
+
Binding symbol `og_render_look` · publish builds: kept
|
|
529
|
+
|
|
530
|
+
```ogt
|
|
531
|
+
fn look {
|
|
532
|
+
doc "The look last applied (by og.render.applyLook or GameDesc.look), as og.load.lookInfo describes it; null before any."
|
|
533
|
+
param world World "The world asked."
|
|
534
|
+
returns Option.LookInfo
|
|
535
|
+
}
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
<sub>`api.ogt` line 3342</sub>
|
|
539
|
+
|
|
540
|
+
<a id="fn-capabilities"></a>
|
|
541
|
+
|
|
542
|
+
### `og.render.capabilities`
|
|
543
|
+
|
|
544
|
+
The renderer's tier and limits on this device.
|
|
545
|
+
|
|
546
|
+
```ts
|
|
547
|
+
og.render.capabilities(world: World): RenderCapabilities
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
| Parameter | Type | Optional | Doc |
|
|
551
|
+
|---|---|---|---|
|
|
552
|
+
| `world` | `World` | no | The world whose renderer is asked. |
|
|
553
|
+
|
|
554
|
+
**Returns** `RenderCapabilities`.
|
|
555
|
+
|
|
556
|
+
Binding symbol `og_render_capabilities` · publish builds: kept
|
|
557
|
+
|
|
558
|
+
```ogt
|
|
559
|
+
fn capabilities {
|
|
560
|
+
doc "The renderer's tier and limits on this device."
|
|
561
|
+
param world World "The world whose renderer is asked."
|
|
562
|
+
returns RenderCapabilities
|
|
563
|
+
}
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
<sub>`api.ogt` line 3348</sub>
|
|
567
|
+
|
|
568
|
+
<a id="fn-text"></a>
|
|
569
|
+
|
|
570
|
+
### `og.render.text`
|
|
571
|
+
|
|
572
|
+
Draw text this frame. Systems and commands may call it; the list is cleared at every tick, so submit it every tick the text should show. Multi-page fonts are drawn page by page with one layout.
|
|
573
|
+
|
|
574
|
+
```ts
|
|
575
|
+
og.render.text(world: World, desc?: TextDesc): Result<void>
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
| Parameter | Type | Optional | Doc |
|
|
579
|
+
|---|---|---|---|
|
|
580
|
+
| `world` | `World` | no | The world whose renderer draws it. |
|
|
581
|
+
| `desc` | `TextDesc` | yes | The font, text, placement and colour. |
|
|
582
|
+
|
|
583
|
+
**Returns** `Result<void>`: Refused for a dead font.
|
|
584
|
+
|
|
585
|
+
Binding symbol `og_render_text` · publish builds: kept
|
|
586
|
+
|
|
587
|
+
```ogt
|
|
588
|
+
fn text {
|
|
589
|
+
doc "Draw text this frame. Systems and commands may call it; the list is cleared at every tick, so submit it every tick the text should show. Multi-page fonts are drawn page by page with one layout."
|
|
590
|
+
param world World "The world whose renderer draws it."
|
|
591
|
+
param desc TextDesc "The font, text, placement and colour."
|
|
592
|
+
returns Result.Void "Refused for a dead font."
|
|
593
|
+
}
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
<sub>`api.ogt` line 3354</sub>
|
|
597
|
+
|
|
598
|
+
## Components, resources and events
|
|
599
|
+
|
|
600
|
+
<a id="record-Mesh"></a>
|
|
601
|
+
|
|
602
|
+
### `og.Mesh` (component)
|
|
603
|
+
|
|
604
|
+
Draws a geometry with a material at the entity's MatrixWorld, as a three.js Mesh.
|
|
605
|
+
|
|
606
|
+
The material is a handle from og.render.standardMaterial or from a loaded glTF (GltfInfo.materials); its StandardMaterialDesc maps to the renderer as that struct's docs say.
|
|
607
|
+
|
|
608
|
+
Token `og.Mesh`, registered under the schema name `og.Mesh`; its value type is `Mesh`.
|
|
609
|
+
|
|
610
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
611
|
+
|---|---|---|---|---|---|---|
|
|
612
|
+
| `geometry` | `Geometry` | `0` | — | — | — | The geometry. |
|
|
613
|
+
| `material` | `Material` | `0` | — | — | — | The material. |
|
|
614
|
+
| `castShadow` | `boolean` | `false` | — | — | — | Cast shadows, as three.js Object3D.castShadow: drawn into the sun's cascades and the shadowed lights' maps. Off by default: a lamp's own glass around its light, a glow card or a decal-like slab casts none. |
|
|
615
|
+
| `receiveShadow` | `boolean` | `true` | — | — | — | Receive shadows, as three.js Object3D.receiveShadow: darkened where the sun's cascades and the shadowed lights' maps say something stands between it and the light. On by default (three.js's is off): every mesh received shadows before the flag was applied. false lights it as if unshadowed by every light, while it still casts as castShadow says: a glowing sign, a hero kept readable in a dark alley. |
|
|
616
|
+
| `visible` | `boolean` | `true` | — | — | — | Whether it is drawn. |
|
|
617
|
+
| `flash` | `number` | `0` | 0 … 1 | — | tunable | A hit flash on this mesh only: the lit colour mixed towards flashColor by this much (og.tween.flash fades it out). Carried with its transform to the lit shaders, as og.Model's, so a flashing mesh is one draw with the other meshes of its geometry and material, and the amount is continuous. |
|
|
618
|
+
| `flashColor` | `Color` | `{ r: 1, g: 1, b: 1 }` | — | — | — | The flash's linear colour, 0 to 1 a channel (8 bits a channel). |
|
|
619
|
+
| `materialLayer` | `number` | `-1` | ≥ -1 | — | tunable | The texture-array layer this mesh's material reads (StandardMaterialDesc.mapArray and normalMapArray), in place of the material's mapLayer and normalMapLayer: one material, one draw, a layer per mesh (a tile set, a crowd's skins). -1 keeps the material's layers; a material without arrays ignores it. |
|
|
620
|
+
|
|
621
|
+
```ogt
|
|
622
|
+
component Mesh {
|
|
623
|
+
doc "Draws a geometry with a material at the entity's MatrixWorld, as a three.js Mesh."
|
|
624
|
+
doc "The material is a handle from og.render.standardMaterial or from a loaded glTF (GltfInfo.materials); its StandardMaterialDesc maps to the renderer as that struct's docs say."
|
|
625
|
+
field geometry Geometry "The geometry."
|
|
626
|
+
field material Material "The material."
|
|
627
|
+
field castShadow bool "Cast shadows, as three.js Object3D.castShadow: drawn into the sun's cascades and the shadowed lights' maps. Off by default: a lamp's own glass around its light, a glow card or a decal-like slab casts none."
|
|
628
|
+
field receiveShadow bool "Receive shadows, as three.js Object3D.receiveShadow: darkened where the sun's cascades and the shadowed lights' maps say something stands between it and the light. On by default (three.js's is off): every mesh received shadows before the flag was applied. false lights it as if unshadowed by every light, while it still casts as castShadow says: a glowing sign, a hero kept readable in a dark alley." {
|
|
629
|
+
default true
|
|
630
|
+
}
|
|
631
|
+
field visible bool "Whether it is drawn." {
|
|
632
|
+
default true
|
|
633
|
+
}
|
|
634
|
+
field flash f32 "A hit flash on this mesh only: the lit colour mixed towards flashColor by this much (og.tween.flash fades it out). Carried with its transform to the lit shaders, as og.Model's, so a flashing mesh is one draw with the other meshes of its geometry and material, and the amount is continuous." {
|
|
635
|
+
min 0
|
|
636
|
+
max 1
|
|
637
|
+
tunable true
|
|
638
|
+
}
|
|
639
|
+
field flashColor Color "The flash's linear colour, 0 to 1 a channel (8 bits a channel)." {
|
|
640
|
+
default 1 1 1
|
|
641
|
+
}
|
|
642
|
+
field materialLayer i32 "The texture-array layer this mesh's material reads (StandardMaterialDesc.mapArray and normalMapArray), in place of the material's mapLayer and normalMapLayer: one material, one draw, a layer per mesh (a tile set, a crowd's skins). -1 keeps the material's layers; a material without arrays ignores it." {
|
|
643
|
+
default -1
|
|
644
|
+
min -1
|
|
645
|
+
tunable true
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
```
|
|
649
|
+
|
|
650
|
+
<sub>`api.ogt` line 1906</sub>
|
|
651
|
+
|
|
652
|
+
<a id="record-DirectionalLight"></a>
|
|
653
|
+
|
|
654
|
+
### `og.DirectionalLight` (component)
|
|
655
|
+
|
|
656
|
+
The sun, as three.js DirectionalLight: parallel light along the entity's local -Z (aim it with transform.lookAt, as a camera). The first one found is drawn, with three shadow cascades.
|
|
657
|
+
|
|
658
|
+
Without one, the renderer's default sun (from above and to the side, intensity 3) lights the scene.
|
|
659
|
+
|
|
660
|
+
Token `og.DirectionalLight`, registered under the schema name `og.DirectionalLight`; its value type is `DirectionalLight`.
|
|
661
|
+
|
|
662
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
663
|
+
|---|---|---|---|---|---|---|
|
|
664
|
+
| `color` | `Color` | `{ r: 1, g: 1, b: 1 }` | — | — | — | The light's linear colour. |
|
|
665
|
+
| `intensity` | `number` | `3` | ≥ 0 | — | tunable | The radiance multiplier, as three.js DirectionalLight.intensity. |
|
|
666
|
+
| `castShadow` | `boolean` | `true` | — | — | — | Cast shadows through three cascades, as three.js Light.castShadow. |
|
|
667
|
+
| `shadowDistance` | `number` | `200` | ≥ 1 | `m` | — | How far from the camera shadows reach; they fade over the last tenth. Smaller is sharper. |
|
|
668
|
+
| `shadowSoftness` | `number` | `0` | 0 … 0.2 | — | tunable | Soft shadows (PCSS): the penumbra's width per metre between caster and receiver, the tangent of the sun's apparent radius (the real sun's is 0.005). 0 keeps the hard one-texel edge; 0.01 to 0.05 is a soft sun, sharp at contact and blurring with distance. Costs a blocker search and a 16-tap filter per shadowed pixel. |
|
|
669
|
+
| `cascadeBlend` | `number` | `0` | 0 … 0.5 | `ratio` | tunable | The fraction of each shadow cascade's depth over which it fades into the next, hiding the seam where the shadow's resolution changes. 0 is none; 0.1 to 0.2 is typical (those pixels read two cascades). |
|
|
670
|
+
|
|
671
|
+
```ogt
|
|
672
|
+
component DirectionalLight {
|
|
673
|
+
doc "The sun, as three.js DirectionalLight: parallel light along the entity's local -Z (aim it with transform.lookAt, as a camera). The first one found is drawn, with three shadow cascades."
|
|
674
|
+
doc "Without one, the renderer's default sun (from above and to the side, intensity 3) lights the scene."
|
|
675
|
+
field color Color "The light's linear colour." {
|
|
676
|
+
default 1 1 1
|
|
677
|
+
}
|
|
678
|
+
field intensity f32 "The radiance multiplier, as three.js DirectionalLight.intensity." {
|
|
679
|
+
default 3
|
|
680
|
+
min 0
|
|
681
|
+
tunable true
|
|
682
|
+
}
|
|
683
|
+
field castShadow bool "Cast shadows through three cascades, as three.js Light.castShadow." {
|
|
684
|
+
default true
|
|
685
|
+
}
|
|
686
|
+
field shadowDistance f32 "How far from the camera shadows reach; they fade over the last tenth. Smaller is sharper." {
|
|
687
|
+
default 200
|
|
688
|
+
min 1
|
|
689
|
+
unit m
|
|
690
|
+
}
|
|
691
|
+
field shadowSoftness f32 "Soft shadows (PCSS): the penumbra's width per metre between caster and receiver, the tangent of the sun's apparent radius (the real sun's is 0.005). 0 keeps the hard one-texel edge; 0.01 to 0.05 is a soft sun, sharp at contact and blurring with distance. Costs a blocker search and a 16-tap filter per shadowed pixel." {
|
|
692
|
+
min 0
|
|
693
|
+
max 0.2
|
|
694
|
+
tunable true
|
|
695
|
+
}
|
|
696
|
+
field cascadeBlend f32 "The fraction of each shadow cascade's depth over which it fades into the next, hiding the seam where the shadow's resolution changes. 0 is none; 0.1 to 0.2 is typical (those pixels read two cascades)." {
|
|
697
|
+
min 0
|
|
698
|
+
max 0.5
|
|
699
|
+
unit ratio
|
|
700
|
+
tunable true
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
```
|
|
704
|
+
|
|
705
|
+
<sub>`api.ogt` line 1933</sub>
|
|
706
|
+
|
|
707
|
+
<a id="record-PointLight"></a>
|
|
708
|
+
|
|
709
|
+
### `og.PointLight` (component)
|
|
710
|
+
|
|
711
|
+
A light shining in every direction from the entity's position, as three.js PointLight. Its radiance at distance d is color * intensity / d^2, faded smoothly to zero at distance.
|
|
712
|
+
|
|
713
|
+
Lights are clustered (Forward+): each pixel shades only the lights whose distance reaches it, so hundreds are cheap. Lights out of view are skipped; up to MAX_LIGHTS in view are drawn, and past that (or past what one screen cluster holds, MAX_CLUSTER_LIGHTS) the ones brightest at the camera are kept. Of those in view with castShadow, RenderCapabilities.maxShadowedLights (8 on the full tier, 4 on WebGL2) get shadows, the brightest at the camera first.
|
|
714
|
+
|
|
715
|
+
Token `og.PointLight`, registered under the schema name `og.PointLight`; its value type is `PointLight`.
|
|
716
|
+
|
|
717
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
718
|
+
|---|---|---|---|---|---|---|
|
|
719
|
+
| `color` | `Color` | `{ r: 1, g: 1, b: 1 }` | — | — | — | The light's linear colour. |
|
|
720
|
+
| `intensity` | `number` | `10` | ≥ 0 | — | tunable | The radiance at one metre. |
|
|
721
|
+
| `distance` | `number` | `10` | ≥ 0.01 | `m` | tunable | Where the light reaches zero, as three.js PointLight.distance (never infinite here). |
|
|
722
|
+
| `castShadow` | `boolean` | `false` | — | — | — | Cast shadows: six cube faces or two paraboloid hemispheres (RenderOptions.pointShadows). |
|
|
723
|
+
|
|
724
|
+
```ogt
|
|
725
|
+
component PointLight {
|
|
726
|
+
doc "A light shining in every direction from the entity's position, as three.js PointLight. Its radiance at distance d is color * intensity / d^2, faded smoothly to zero at distance."
|
|
727
|
+
doc "Lights are clustered (Forward+): each pixel shades only the lights whose distance reaches it, so hundreds are cheap. Lights out of view are skipped; up to MAX_LIGHTS in view are drawn, and past that (or past what one screen cluster holds, MAX_CLUSTER_LIGHTS) the ones brightest at the camera are kept. Of those in view with castShadow, RenderCapabilities.maxShadowedLights (8 on the full tier, 4 on WebGL2) get shadows, the brightest at the camera first."
|
|
728
|
+
field color Color "The light's linear colour." {
|
|
729
|
+
default 1 1 1
|
|
730
|
+
}
|
|
731
|
+
field intensity f32 "The radiance at one metre." {
|
|
732
|
+
default 10
|
|
733
|
+
min 0
|
|
734
|
+
tunable true
|
|
735
|
+
}
|
|
736
|
+
field distance f32 "Where the light reaches zero, as three.js PointLight.distance (never infinite here)." {
|
|
737
|
+
default 10
|
|
738
|
+
min 0.01
|
|
739
|
+
unit m
|
|
740
|
+
tunable true
|
|
741
|
+
}
|
|
742
|
+
field castShadow bool "Cast shadows: six cube faces or two paraboloid hemispheres (RenderOptions.pointShadows)."
|
|
743
|
+
}
|
|
744
|
+
```
|
|
745
|
+
|
|
746
|
+
<sub>`api.ogt` line 1965</sub>
|
|
747
|
+
|
|
748
|
+
<a id="record-SpotLight"></a>
|
|
749
|
+
|
|
750
|
+
### `og.SpotLight` (component)
|
|
751
|
+
|
|
752
|
+
A cone of light along the entity's local -Z, as three.js SpotLight.
|
|
753
|
+
|
|
754
|
+
Token `og.SpotLight`, registered under the schema name `og.SpotLight`; its value type is `SpotLight`.
|
|
755
|
+
|
|
756
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
757
|
+
|---|---|---|---|---|---|---|
|
|
758
|
+
| `color` | `Color` | `{ r: 1, g: 1, b: 1 }` | — | — | — | The light's linear colour. |
|
|
759
|
+
| `intensity` | `number` | `10` | ≥ 0 | — | tunable | The radiance at one metre on the axis. |
|
|
760
|
+
| `distance` | `number` | `10` | ≥ 0.01 | `m` | tunable | Where the light reaches zero. |
|
|
761
|
+
| `angle` | `number` | `0.5236` | 0 … 1.5708 | `rad` | tunable | The half-angle of the outer cone, as three.js SpotLight.angle. |
|
|
762
|
+
| `penumbra` | `number` | `0` | 0 … 1 | `ratio` | — | The fraction of the cone over which the light fades out, as three.js SpotLight.penumbra. |
|
|
763
|
+
| `castShadow` | `boolean` | `false` | — | — | — | Cast a shadow map. |
|
|
764
|
+
|
|
765
|
+
```ogt
|
|
766
|
+
component SpotLight {
|
|
767
|
+
doc "A cone of light along the entity's local -Z, as three.js SpotLight."
|
|
768
|
+
field color Color "The light's linear colour." {
|
|
769
|
+
default 1 1 1
|
|
770
|
+
}
|
|
771
|
+
field intensity f32 "The radiance at one metre on the axis." {
|
|
772
|
+
default 10
|
|
773
|
+
min 0
|
|
774
|
+
tunable true
|
|
775
|
+
}
|
|
776
|
+
field distance f32 "Where the light reaches zero." {
|
|
777
|
+
default 10
|
|
778
|
+
min 0.01
|
|
779
|
+
unit m
|
|
780
|
+
tunable true
|
|
781
|
+
}
|
|
782
|
+
field angle f32 "The half-angle of the outer cone, as three.js SpotLight.angle." {
|
|
783
|
+
default 0.5236
|
|
784
|
+
min 0
|
|
785
|
+
max 1.5708
|
|
786
|
+
unit rad
|
|
787
|
+
tunable true
|
|
788
|
+
}
|
|
789
|
+
field penumbra f32 "The fraction of the cone over which the light fades out, as three.js SpotLight.penumbra." {
|
|
790
|
+
min 0
|
|
791
|
+
max 1
|
|
792
|
+
unit ratio
|
|
793
|
+
}
|
|
794
|
+
field castShadow bool "Cast a shadow map."
|
|
795
|
+
}
|
|
796
|
+
```
|
|
797
|
+
|
|
798
|
+
<sub>`api.ogt` line 1985</sub>
|
|
799
|
+
|
|
800
|
+
<a id="record-RenderSettings"></a>
|
|
801
|
+
|
|
802
|
+
### `og.RenderSettings` (resource)
|
|
803
|
+
|
|
804
|
+
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.
|
|
805
|
+
|
|
806
|
+
Token `og.RenderSettings`, registered under the schema name `og.RenderSettings`; its value type is `RenderSettings`.
|
|
807
|
+
|
|
808
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
809
|
+
|---|---|---|---|---|---|---|
|
|
810
|
+
| `environmentIntensity` | `number` | `0.55` | ≥ 0 | — | tunable | The strength of the image-based ambient light from the sky; og.Environment.intensity takes its place while an environment map is set. |
|
|
811
|
+
| `sky` | `boolean` | `false` | — | — | — | Draw the procedural sky behind the scene instead of Camera.background (with an og.Environment map set, the map). |
|
|
812
|
+
| `bloom` | `boolean` | `false` | — | — | — | Light above the threshold bleeds into its surroundings. |
|
|
813
|
+
| `bloomThreshold` | `number` | `1` | ≥ 0 | — | tunable | Brightness after exposure where bloom starts; 1 is display white. |
|
|
814
|
+
| `bloomKnee` | `number` | `0.5` | ≥ 0 | — | — | Softens the threshold over threshold plus or minus knee; 0 is a hard cut. |
|
|
815
|
+
| `bloomIntensity` | `number` | `0.6` | ≥ 0 | — | tunable | How much of the blurred light is added back. |
|
|
816
|
+
| `autoExposure` | `boolean` | `false` | — | — | — | Meter every frame to middle grey, then apply Camera.exposure as compensation. With both adapt speeds 0 the exposure is the current frame's alone; otherwise it adapts over time like an eye, starting at the metered exposure of the first frame drawn after the first tick (a frame drawn before it, such as the web shell's first frame behind the play gate, meters at once and is never adapted from), so every host draws the same exposures for the same ticks. |
|
|
817
|
+
| `adaptSpeedUp` | `number` | `0` | 0 … 100 | `evPerSecond` | tunable | How fast auto exposure rises when the view gets darker, in EV per second of game time: each drawn frame moves it by at most the speed times the ticks since the last drawn frame (never the wall clock, so a replay and every host adapt the same, however many frames each drew); 0 is instant. Snapshots and probe sweeps carry the adapted exposure. |
|
|
818
|
+
| `adaptSpeedDown` | `number` | `0` | 0 … 100 | `evPerSecond` | tunable | How fast auto exposure falls when the view gets brighter, in EV per second of game time; 0 is instant. Eyes adapt to brightness faster than to the dark: 3 down and 1 up is a natural pair. |
|
|
819
|
+
| `toneMapped` | `boolean` | `true` | — | — | — | Tone mapping by toneMapping; false clamps, so 2D colours come out exactly as authored at exposure 1. |
|
|
820
|
+
| `toneMapping` | `ToneMapping` | `"aces"` | — | — | — | Which curve tone maps the frame while toneMapped is true: aces (the default), agx or none. |
|
|
821
|
+
| `exposure` | `number` | `1` | 0 … 16 | — | tunable | A multiplier on every camera's Camera.exposure, as three.js renderer.toneMappingExposure is one for the whole frame: a look's brightness without touching the cameras; 1 leaves them as they are. |
|
|
822
|
+
| `decalAtlas` | `Texture` | `0` | — | — | — | The texture Decal components take their uvMin to uvMax region from; 0 draws decals as solid colour. |
|
|
823
|
+
|
|
824
|
+
```ogt
|
|
825
|
+
resource RenderSettings {
|
|
826
|
+
doc "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."
|
|
827
|
+
field environmentIntensity f32 "The strength of the image-based ambient light from the sky; og.Environment.intensity takes its place while an environment map is set." {
|
|
828
|
+
default 0.55
|
|
829
|
+
min 0
|
|
830
|
+
tunable true
|
|
831
|
+
}
|
|
832
|
+
field sky bool "Draw the procedural sky behind the scene instead of Camera.background (with an og.Environment map set, the map)."
|
|
833
|
+
field bloom bool "Light above the threshold bleeds into its surroundings."
|
|
834
|
+
field bloomThreshold f32 "Brightness after exposure where bloom starts; 1 is display white." {
|
|
835
|
+
default 1
|
|
836
|
+
min 0
|
|
837
|
+
tunable true
|
|
838
|
+
}
|
|
839
|
+
field bloomKnee f32 "Softens the threshold over threshold plus or minus knee; 0 is a hard cut." {
|
|
840
|
+
default 0.5
|
|
841
|
+
min 0
|
|
842
|
+
}
|
|
843
|
+
field bloomIntensity f32 "How much of the blurred light is added back." {
|
|
844
|
+
default 0.6
|
|
845
|
+
min 0
|
|
846
|
+
tunable true
|
|
847
|
+
}
|
|
848
|
+
field autoExposure bool "Meter every frame to middle grey, then apply Camera.exposure as compensation. With both adapt speeds 0 the exposure is the current frame's alone; otherwise it adapts over time like an eye, starting at the metered exposure of the first frame drawn after the first tick (a frame drawn before it, such as the web shell's first frame behind the play gate, meters at once and is never adapted from), so every host draws the same exposures for the same ticks."
|
|
849
|
+
field adaptSpeedUp f32 "How fast auto exposure rises when the view gets darker, in EV per second of game time: each drawn frame moves it by at most the speed times the ticks since the last drawn frame (never the wall clock, so a replay and every host adapt the same, however many frames each drew); 0 is instant. Snapshots and probe sweeps carry the adapted exposure." {
|
|
850
|
+
min 0
|
|
851
|
+
max 100
|
|
852
|
+
unit evPerSecond
|
|
853
|
+
tunable true
|
|
854
|
+
}
|
|
855
|
+
field adaptSpeedDown f32 "How fast auto exposure falls when the view gets brighter, in EV per second of game time; 0 is instant. Eyes adapt to brightness faster than to the dark: 3 down and 1 up is a natural pair." {
|
|
856
|
+
min 0
|
|
857
|
+
max 100
|
|
858
|
+
unit evPerSecond
|
|
859
|
+
tunable true
|
|
860
|
+
}
|
|
861
|
+
field toneMapped bool "Tone mapping by toneMapping; false clamps, so 2D colours come out exactly as authored at exposure 1." {
|
|
862
|
+
default true
|
|
863
|
+
}
|
|
864
|
+
field toneMapping ToneMapping "Which curve tone maps the frame while toneMapped is true: aces (the default), agx or none."
|
|
865
|
+
field exposure f32 "A multiplier on every camera's Camera.exposure, as three.js renderer.toneMappingExposure is one for the whole frame: a look's brightness without touching the cameras; 1 leaves them as they are." {
|
|
866
|
+
default 1
|
|
867
|
+
min 0
|
|
868
|
+
max 16
|
|
869
|
+
tunable true
|
|
870
|
+
}
|
|
871
|
+
field decalAtlas Texture "The texture Decal components take their uvMin to uvMax region from; 0 draws decals as solid colour."
|
|
872
|
+
}
|
|
873
|
+
```
|
|
874
|
+
|
|
875
|
+
<sub>`api.ogt` line 2030</sub>
|
|
876
|
+
|
|
877
|
+
<a id="record-Environment"></a>
|
|
878
|
+
|
|
879
|
+
### `og.Environment` (resource)
|
|
880
|
+
|
|
881
|
+
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.
|
|
882
|
+
|
|
883
|
+
Token `og.Environment`, registered under the schema name `og.Environment`; its value type is `Environment`.
|
|
884
|
+
|
|
885
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
886
|
+
|---|---|---|---|---|---|---|
|
|
887
|
+
| `map` | `EnvironmentMap` | `0` | — | — | — | The map from og.load.environment; 0 lights by the sky. |
|
|
888
|
+
| `intensity` | `number` | `1` | ≥ 0 | — | tunable | The strength of the map's light on every surface, as three.js scene.environmentIntensity; while a map is set it replaces RenderSettings.environmentIntensity. |
|
|
889
|
+
| `rotation` | `number` | `0` | — | `deg` | tunable | Turns the map about +Y, as three.js scene.environmentRotation.y: positive turns what was at +X towards -Z. The light and the background turn together. |
|
|
890
|
+
| `background` | `boolean` | `false` | — | — | — | Draw the map behind the scene, as three.js scene.background = the environment (Camera.background, og.Sky and RenderSettings.sky give way); false leaves the background as they set it. |
|
|
891
|
+
| `backgroundIntensity` | `number` | `1` | ≥ 0 | — | tunable | Multiplies the map where it is drawn behind the scene, as three.js scene.backgroundIntensity; the light is not changed. |
|
|
892
|
+
|
|
893
|
+
```ogt
|
|
894
|
+
resource Environment {
|
|
895
|
+
doc "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."
|
|
896
|
+
field map EnvironmentMap "The map from og.load.environment; 0 lights by the sky."
|
|
897
|
+
field intensity f32 "The strength of the map's light on every surface, as three.js scene.environmentIntensity; while a map is set it replaces RenderSettings.environmentIntensity." {
|
|
898
|
+
default 1
|
|
899
|
+
min 0
|
|
900
|
+
tunable true
|
|
901
|
+
}
|
|
902
|
+
field rotation f32 "Turns the map about +Y, as three.js scene.environmentRotation.y: positive turns what was at +X towards -Z. The light and the background turn together." {
|
|
903
|
+
unit deg
|
|
904
|
+
tunable true
|
|
905
|
+
}
|
|
906
|
+
field background bool "Draw the map behind the scene, as three.js scene.background = the environment (Camera.background, og.Sky and RenderSettings.sky give way); false leaves the background as they set it."
|
|
907
|
+
field backgroundIntensity f32 "Multiplies the map where it is drawn behind the scene, as three.js scene.backgroundIntensity; the light is not changed." {
|
|
908
|
+
default 1
|
|
909
|
+
min 0
|
|
910
|
+
tunable true
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
```
|
|
914
|
+
|
|
915
|
+
<sub>`api.ogt` line 2106</sub>
|
|
916
|
+
|
|
917
|
+
<a id="record-PostEffects"></a>
|
|
918
|
+
|
|
919
|
+
### `og.PostEffects` (resource)
|
|
920
|
+
|
|
921
|
+
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.
|
|
922
|
+
|
|
923
|
+
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.
|
|
924
|
+
|
|
925
|
+
Token `og.PostEffects`, registered under the schema name `og.PostEffects`; its value type is `PostEffects`.
|
|
926
|
+
|
|
927
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
928
|
+
|---|---|---|---|---|---|---|
|
|
929
|
+
| `ao` | `boolean` | `false` | — | — | — | Screen-space ambient occlusion: darkens the ambient light in creases and contact areas. |
|
|
930
|
+
| `aoRadius` | `number` | `0.6` | ≥ 0 | `m` | tunable | The world-space radius searched for occluders. |
|
|
931
|
+
| `aoIntensity` | `number` | `1` | ≥ 0 | — | tunable | 0 none, 1 full; above 1 exaggerates. |
|
|
932
|
+
| `aoMethod` | `AoMethod` | `"auto"` | — | — | — | The algorithm. |
|
|
933
|
+
| `outline` | `boolean` | `false` | — | — | — | Outlines every opaque surface from depth and normal edges, creases between the faces of one object included (materials with outlineWidth get their own hull outline instead). |
|
|
934
|
+
| `outlineColor` | `Color` | `{ r: 0.02, g: 0.02, b: 0.03 }` | — | — | — | The line colour, linear. |
|
|
935
|
+
| `outlineWidth` | `number` | `2` | 0 … 31 | — | tunable | Line width in pixels, drawn inside the silhouette. |
|
|
936
|
+
| `outlineDepthThreshold` | `number` | `0.04` | ≥ 0 | — | — | The relative depth step that counts as a silhouette (0.04 is 4 %). |
|
|
937
|
+
| `outlineNormalThreshold` | `number` | `0.4` | ≥ 0 | — | — | The normal change that counts as a crease (1 - cos of the angle; 0.4 is about 53 degrees). |
|
|
938
|
+
| `depthOfField` | `boolean` | `false` | — | — | — | Bokeh depth of field: pixels away from the focus distance blur into discs. |
|
|
939
|
+
| `dofFocusDistance` | `number` | `10` | ≥ 0 | `m` | tunable | The distance from the camera that is sharp. |
|
|
940
|
+
| `dofFocusRange` | `number` | `2` | ≥ 0 | `m` | tunable | The half-width of the sharp band around it. |
|
|
941
|
+
| `dofMaxBlur` | `number` | `0.012` | 0 … 0.1 | — | — | The largest blur radius, as a fraction of the image height (0.012 is about 9 px at 720p). |
|
|
942
|
+
| `dofFalloff` | `number` | `4` | ≥ 0 | — | — | How quickly blur grows outside the band: full blur focusRange times (1 + falloff) away. |
|
|
943
|
+
| `dofQuality` | `DofQuality` | `"low"` | — | — | — | Taps per pixel. |
|
|
944
|
+
| `motionBlur` | `boolean` | `false` | — | — | — | Per-object and camera motion blur along the screen-space velocity. |
|
|
945
|
+
| `motionBlurShutter` | `number` | `0.5` | 0 … 2 | — | tunable | The shutter as a fraction of the frame (0.5 is a 180 degree shutter). |
|
|
946
|
+
| `motionBlurSamples` | `number` | `12` | 4 … 32 | — | — | Taps along the velocity. |
|
|
947
|
+
| `motionBlurMaxPixels` | `number` | `40` | ≥ 1 | — | — | The longest blur in pixels. |
|
|
948
|
+
| `godRays` | `boolean` | `false` | — | — | — | Screen-space light shafts from the DirectionalLight (the sun must be in front of the camera). |
|
|
949
|
+
| `godRaysIntensity` | `number` | `0.5` | ≥ 0 | — | tunable | How bright the shafts are. |
|
|
950
|
+
| `godRaysDecay` | `number` | `0.965` | 0.5 … 1 | — | — | How fast the rays fade along their length. |
|
|
951
|
+
| `godRaysDensity` | `number` | `1` | ≥ 0 | — | — | How far towards the sun each ray samples (a fraction of the distance). |
|
|
952
|
+
| `godRaysTint` | `Color` | `{ r: 1, g: 1, b: 1 }` | — | — | — | A linear tint on the light the rays carry. |
|
|
953
|
+
| `godRaysSamples` | `number` | `48` | 8 … 128 | — | — | Taps per ray. |
|
|
954
|
+
| `godRaysThreshold` | `number` | `2` | ≥ 0 | — | — | Sky brightness (linear, before exposure) below which the sky carries no rays. |
|
|
955
|
+
| `glow` | `boolean` | `false` | — | — | — | Order-independent 2D glow: sprites with SpriteDesc.glow (and 2D particles with a glow) are blurred and added back, with or without bloom. |
|
|
956
|
+
| `glowIntensity` | `number` | `1` | ≥ 0 | — | tunable | How much of the blurred glow is added back. |
|
|
957
|
+
| `lut` | `Lut` | `0` | — | — | — | Colour grading by a lookup table from og.load.lut; 0 is none (and so is a LUT whose streaming group is not resident). |
|
|
958
|
+
| `lutIntensity` | `number` | `1` | 0 … 1 | — | tunable | 0 leaves the image as tone mapped, 1 applies the table fully. |
|
|
959
|
+
| `vignette` | `boolean` | `false` | — | — | — | Darkened (or tinted) edges of the frame. |
|
|
960
|
+
| `vignetteIntensity` | `number` | `0.35` | 0 … 1 | — | tunable | 0 none, 1 black corners. |
|
|
961
|
+
| `vignetteRadius` | `number` | `0.55` | 0 … 1 | — | — | Where darkening starts, as a fraction of the half-diagonal. |
|
|
962
|
+
| `vignetteSmoothness` | `number` | `0.45` | 0 … 1 | — | — | The width of the fade. |
|
|
963
|
+
| `vignetteColor` | `Color` | `{ r: 0, g: 0, b: 0 }` | — | — | — | The linear colour the edges move towards. |
|
|
964
|
+
| `chromaticAberration` | `number` | `0` | 0 … 20 | — | tunable | Red and blue split towards the edges, in pixels at the corners at 720p; 0 is off. |
|
|
965
|
+
| `filmGrain` | `number` | `0` | 0 … 1 | — | tunable | Luminance-weighted noise amplitude in display units, a new pattern every tick (0.04 is subtle); 0 is off. |
|
|
966
|
+
| `filmGrainSize` | `number` | `1.5` | ≥ 0.5 | — | — | The grain size in pixels. |
|
|
967
|
+
| `flash` | `number` | `0` | 0 … 1 | — | tunable | A full-screen flash: the display colour mixed towards flashColor by this much (animate it per tick); 0 is off. |
|
|
968
|
+
| `flashColor` | `Color` | `{ r: 1, g: 1, b: 1 }` | — | — | — | The flash's linear display colour. |
|
|
969
|
+
| `shakeTrauma` | `number` | `0` | 0 … 1 | — | tunable | Camera shake held at a fixed level (decay it yourself): 0 none, 1 the most (the amplitude is trauma squared). Prefer og.camera.shake, which decays by itself; the frame shakes by the larger of the two. Smooth value noise by the tick, so a replay shakes the same. Visual only. |
|
|
970
|
+
| `shakeMaxOffset` | `number` | `0.05` | ≥ 0 | — | — | The largest offset at trauma 1, as a fraction of the view height. |
|
|
971
|
+
| `shakeMaxRoll` | `number` | `3` | ≥ 0 | `deg` | — | The largest roll at trauma 1. |
|
|
972
|
+
| `shakeFrequency` | `number` | `12` | ≥ 0 | `hz` | — | How fast the shake moves. |
|
|
973
|
+
| `shakeSeed` | `number` | `0` | — | — | — | The shake's noise seed. |
|
|
974
|
+
|
|
975
|
+
```ogt
|
|
976
|
+
resource PostEffects {
|
|
977
|
+
doc "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."
|
|
978
|
+
doc "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."
|
|
979
|
+
field ao bool "Screen-space ambient occlusion: darkens the ambient light in creases and contact areas."
|
|
980
|
+
field aoRadius f32 "The world-space radius searched for occluders." {
|
|
981
|
+
default 0.6
|
|
982
|
+
min 0
|
|
983
|
+
unit m
|
|
984
|
+
tunable true
|
|
985
|
+
}
|
|
986
|
+
field aoIntensity f32 "0 none, 1 full; above 1 exaggerates." {
|
|
987
|
+
default 1
|
|
988
|
+
min 0
|
|
989
|
+
tunable true
|
|
990
|
+
}
|
|
991
|
+
field aoMethod AoMethod "The algorithm."
|
|
992
|
+
field outline bool "Outlines every opaque surface from depth and normal edges, creases between the faces of one object included (materials with outlineWidth get their own hull outline instead)."
|
|
993
|
+
field outlineColor Color "The line colour, linear." {
|
|
994
|
+
default 0.02 0.02 0.03
|
|
995
|
+
}
|
|
996
|
+
field outlineWidth f32 "Line width in pixels, drawn inside the silhouette." {
|
|
997
|
+
default 2
|
|
998
|
+
min 0
|
|
999
|
+
max 31
|
|
1000
|
+
tunable true
|
|
1001
|
+
}
|
|
1002
|
+
field outlineDepthThreshold f32 "The relative depth step that counts as a silhouette (0.04 is 4 %)." {
|
|
1003
|
+
default 0.04
|
|
1004
|
+
min 0
|
|
1005
|
+
}
|
|
1006
|
+
field outlineNormalThreshold f32 "The normal change that counts as a crease (1 - cos of the angle; 0.4 is about 53 degrees)." {
|
|
1007
|
+
default 0.4
|
|
1008
|
+
min 0
|
|
1009
|
+
}
|
|
1010
|
+
field depthOfField bool "Bokeh depth of field: pixels away from the focus distance blur into discs."
|
|
1011
|
+
field dofFocusDistance f32 "The distance from the camera that is sharp." {
|
|
1012
|
+
default 10
|
|
1013
|
+
min 0
|
|
1014
|
+
unit m
|
|
1015
|
+
tunable true
|
|
1016
|
+
}
|
|
1017
|
+
field dofFocusRange f32 "The half-width of the sharp band around it." {
|
|
1018
|
+
default 2
|
|
1019
|
+
min 0
|
|
1020
|
+
unit m
|
|
1021
|
+
tunable true
|
|
1022
|
+
}
|
|
1023
|
+
field dofMaxBlur f32 "The largest blur radius, as a fraction of the image height (0.012 is about 9 px at 720p)." {
|
|
1024
|
+
default 0.012
|
|
1025
|
+
min 0
|
|
1026
|
+
max 0.1
|
|
1027
|
+
}
|
|
1028
|
+
field dofFalloff f32 "How quickly blur grows outside the band: full blur focusRange times (1 + falloff) away." {
|
|
1029
|
+
default 4
|
|
1030
|
+
min 0
|
|
1031
|
+
}
|
|
1032
|
+
field dofQuality DofQuality "Taps per pixel."
|
|
1033
|
+
field motionBlur bool "Per-object and camera motion blur along the screen-space velocity."
|
|
1034
|
+
field motionBlurShutter f32 "The shutter as a fraction of the frame (0.5 is a 180 degree shutter)." {
|
|
1035
|
+
default 0.5
|
|
1036
|
+
min 0
|
|
1037
|
+
max 2
|
|
1038
|
+
tunable true
|
|
1039
|
+
}
|
|
1040
|
+
field motionBlurSamples u32 "Taps along the velocity." {
|
|
1041
|
+
default 12
|
|
1042
|
+
min 4
|
|
1043
|
+
max 32
|
|
1044
|
+
}
|
|
1045
|
+
field motionBlurMaxPixels f32 "The longest blur in pixels." {
|
|
1046
|
+
default 40
|
|
1047
|
+
min 1
|
|
1048
|
+
}
|
|
1049
|
+
field godRays bool "Screen-space light shafts from the DirectionalLight (the sun must be in front of the camera)."
|
|
1050
|
+
field godRaysIntensity f32 "How bright the shafts are." {
|
|
1051
|
+
default 0.5
|
|
1052
|
+
min 0
|
|
1053
|
+
tunable true
|
|
1054
|
+
}
|
|
1055
|
+
field godRaysDecay f32 "How fast the rays fade along their length." {
|
|
1056
|
+
default 0.965
|
|
1057
|
+
min 0.5
|
|
1058
|
+
max 1
|
|
1059
|
+
}
|
|
1060
|
+
field godRaysDensity f32 "How far towards the sun each ray samples (a fraction of the distance)." {
|
|
1061
|
+
default 1
|
|
1062
|
+
min 0
|
|
1063
|
+
}
|
|
1064
|
+
field godRaysTint Color "A linear tint on the light the rays carry." {
|
|
1065
|
+
default 1 1 1
|
|
1066
|
+
}
|
|
1067
|
+
field godRaysSamples u32 "Taps per ray." {
|
|
1068
|
+
default 48
|
|
1069
|
+
min 8
|
|
1070
|
+
max 128
|
|
1071
|
+
}
|
|
1072
|
+
field godRaysThreshold f32 "Sky brightness (linear, before exposure) below which the sky carries no rays." {
|
|
1073
|
+
default 2
|
|
1074
|
+
min 0
|
|
1075
|
+
}
|
|
1076
|
+
field glow bool "Order-independent 2D glow: sprites with SpriteDesc.glow (and 2D particles with a glow) are blurred and added back, with or without bloom."
|
|
1077
|
+
field glowIntensity f32 "How much of the blurred glow is added back." {
|
|
1078
|
+
default 1
|
|
1079
|
+
min 0
|
|
1080
|
+
tunable true
|
|
1081
|
+
}
|
|
1082
|
+
field lut Lut "Colour grading by a lookup table from og.load.lut; 0 is none (and so is a LUT whose streaming group is not resident)."
|
|
1083
|
+
field lutIntensity f32 "0 leaves the image as tone mapped, 1 applies the table fully." {
|
|
1084
|
+
default 1
|
|
1085
|
+
min 0
|
|
1086
|
+
max 1
|
|
1087
|
+
tunable true
|
|
1088
|
+
}
|
|
1089
|
+
field vignette bool "Darkened (or tinted) edges of the frame."
|
|
1090
|
+
field vignetteIntensity f32 "0 none, 1 black corners." {
|
|
1091
|
+
default 0.35
|
|
1092
|
+
min 0
|
|
1093
|
+
max 1
|
|
1094
|
+
tunable true
|
|
1095
|
+
}
|
|
1096
|
+
field vignetteRadius f32 "Where darkening starts, as a fraction of the half-diagonal." {
|
|
1097
|
+
default 0.55
|
|
1098
|
+
min 0
|
|
1099
|
+
max 1
|
|
1100
|
+
}
|
|
1101
|
+
field vignetteSmoothness f32 "The width of the fade." {
|
|
1102
|
+
default 0.45
|
|
1103
|
+
min 0
|
|
1104
|
+
max 1
|
|
1105
|
+
}
|
|
1106
|
+
field vignetteColor Color "The linear colour the edges move towards."
|
|
1107
|
+
field chromaticAberration f32 "Red and blue split towards the edges, in pixels at the corners at 720p; 0 is off." {
|
|
1108
|
+
min 0
|
|
1109
|
+
max 20
|
|
1110
|
+
tunable true
|
|
1111
|
+
}
|
|
1112
|
+
field filmGrain f32 "Luminance-weighted noise amplitude in display units, a new pattern every tick (0.04 is subtle); 0 is off." {
|
|
1113
|
+
min 0
|
|
1114
|
+
max 1
|
|
1115
|
+
tunable true
|
|
1116
|
+
}
|
|
1117
|
+
field filmGrainSize f32 "The grain size in pixels." {
|
|
1118
|
+
default 1.5
|
|
1119
|
+
min 0.5
|
|
1120
|
+
}
|
|
1121
|
+
field flash f32 "A full-screen flash: the display colour mixed towards flashColor by this much (animate it per tick); 0 is off." {
|
|
1122
|
+
min 0
|
|
1123
|
+
max 1
|
|
1124
|
+
tunable true
|
|
1125
|
+
}
|
|
1126
|
+
field flashColor Color "The flash's linear display colour." {
|
|
1127
|
+
default 1 1 1
|
|
1128
|
+
}
|
|
1129
|
+
field shakeTrauma f32 "Camera shake held at a fixed level (decay it yourself): 0 none, 1 the most (the amplitude is trauma squared). Prefer og.camera.shake, which decays by itself; the frame shakes by the larger of the two. Smooth value noise by the tick, so a replay shakes the same. Visual only." {
|
|
1130
|
+
min 0
|
|
1131
|
+
max 1
|
|
1132
|
+
tunable true
|
|
1133
|
+
}
|
|
1134
|
+
field shakeMaxOffset f32 "The largest offset at trauma 1, as a fraction of the view height." {
|
|
1135
|
+
default 0.05
|
|
1136
|
+
min 0
|
|
1137
|
+
}
|
|
1138
|
+
field shakeMaxRoll f32 "The largest roll at trauma 1." {
|
|
1139
|
+
default 3
|
|
1140
|
+
min 0
|
|
1141
|
+
unit deg
|
|
1142
|
+
}
|
|
1143
|
+
field shakeFrequency f32 "How fast the shake moves." {
|
|
1144
|
+
default 12
|
|
1145
|
+
min 0
|
|
1146
|
+
unit hz
|
|
1147
|
+
}
|
|
1148
|
+
field shakeSeed u32 "The shake's noise seed."
|
|
1149
|
+
}
|
|
1150
|
+
```
|
|
1151
|
+
|
|
1152
|
+
<sub>`api.ogt` line 2186</sub>
|
|
1153
|
+
|
|
1154
|
+
<a id="record-Stylise"></a>
|
|
1155
|
+
|
|
1156
|
+
### `og.Stylise` (resource)
|
|
1157
|
+
|
|
1158
|
+
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.
|
|
1159
|
+
|
|
1160
|
+
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.
|
|
1161
|
+
|
|
1162
|
+
Token `og.Stylise`, registered under the schema name `og.Stylise`; its value type is `Stylise`.
|
|
1163
|
+
|
|
1164
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
1165
|
+
|---|---|---|---|---|---|---|
|
|
1166
|
+
| `pixelHeight` | `number` | `0` | 0 … 2160 | — | — | The logical resolution: the scene is rendered this many pixels tall and scaled up to the output by a whole number with nearest filtering, as a low-resolution three.js render target drawn with NearestFilter; 0 renders at the output's resolution. The height sets the scale (pixelUpscale); the width is the output's aspect times the height, rounded, but at most the output's width over the scale, so the last column gives way rather than the scale: 240 rows at 1280x720 are 426.67 columns, rounded to 427, and 427 x 3 = 1281 does not fit, so the grid is 426 x 240 at 3x (1278 x 720, a 1-pixel border each side). Heights that divide the output's evenly fill it: 180 (4x), 240 (3x) and 360 (2x) at 720p, 270 (4x) and 360 (3x) at 1080p. |
|
|
1167
|
+
| `pixelUpscale` | `number` | `0` | 0 … 16 | — | — | The whole-number scale from the logical to the output resolution, a hard request: honoured whenever pixelHeight times it fits the output's height (a smaller scale than the largest leaves the border it implies: 240 lines at 2x in 1280x720 draw 854 x 480 in a 213 x 120 border), else the largest that fits; 0 takes the largest that fits (720 / 240 = 3, 1080 / 240 = 4, rounded down). A frame that does not fill the output is centred with Camera.background round it. |
|
|
1168
|
+
| `pixelSnap` | `boolean` | `true` | — | — | — | Snap the camera and world sprites to the logical pixel grid, so a moving orthographic camera scrolls by whole pixels and sprites in a 3D world keep their edges (pixel sprites in 3D sets). |
|
|
1169
|
+
| `posterize` | `number` | `0` | 0 … 64 | — | — | Tones per colour channel after tone mapping (2 to 64): smooth gradients become flat steps; 0 is off. |
|
|
1170
|
+
| `palette` | `Palette` | `0` | — | — | — | Quantise every pixel to the nearest colour of this palette (og.load.palette), measured in a perceptual space after posterize; 0 is none. |
|
|
1171
|
+
| `dither` | `DitherPattern` | `"none"` | — | — | — | How the steps of posterize and palette are mixed: none rounds every pixel, an ordered or blue-noise pattern alternates the two nearest steps in proportion. |
|
|
1172
|
+
| `ditherStrength` | `number` | `1` | 0 … 2 | — | tunable | The dither's amplitude in steps: 1 spreads exactly one step, less keeps flatter bands. |
|
|
1173
|
+
| `ditherScale` | `number` | `1` | 1 … 8 | — | — | The size of one dither cell in logical pixels. |
|
|
1174
|
+
| `halftone` | `number` | `0` | 0 … 1 | `ratio` | tunable | Halftone print: tones become dots on a rotated grid, larger where the image is darker; 0 is off, 1 dots only. |
|
|
1175
|
+
| `halftoneSize` | `number` | `6` | 2 … 64 | — | — | The dot grid's pitch in logical pixels. |
|
|
1176
|
+
| `halftoneAngle` | `number` | `45` | — | `deg` | — | The dot grid's angle. |
|
|
1177
|
+
| `halftoneColor` | `Color` | `{ r: 0.02, g: 0.02, b: 0.03 }` | — | — | — | The ink of the dots (linear). |
|
|
1178
|
+
| `halftoneSpace` | `StyliseSpace` | `"screen"` | — | — | — | Where the dots lie: screen, a grid over the frame; surface, grids on the surfaces that stay on them as the camera moves and wrap round forms (halftoneSize is then about the pitch in pixels where they lie); object, the same grids in each instance's own space, so a moving object carries its dots. |
|
|
1179
|
+
| `hatching` | `number` | `0` | 0 … 1 | `ratio` | tunable | Pencil or ink cross-hatching from a tonal art map: darker tones add strokes in more directions over a paper-light ground; 0 is off, 1 strokes only. |
|
|
1180
|
+
| `hatchingScale` | `number` | `6` | 2 … 64 | — | — | The spacing of hatch lines in logical pixels. |
|
|
1181
|
+
| `hatchingLevels` | `number` | `4` | 1 … 6 | — | — | How many tones the hatching distinguishes, each adding one stroke direction or density (1 to 6). |
|
|
1182
|
+
| `hatchingAngle` | `number` | `45` | — | `deg` | — | The direction of the first stroke set. |
|
|
1183
|
+
| `hatchingColor` | `Color` | `{ r: 0.04, g: 0.035, b: 0.03 }` | — | — | — | The stroke colour (linear): graphite, sepia or ink. |
|
|
1184
|
+
| `hatchingSpace` | `StyliseSpace` | `"screen"` | — | — | — | Where the strokes lie: screen, stripes over the frame that follow the tone alone; surface, strokes laid on the surfaces that follow the tone and the form, wrapping round curved objects and staying on them as the camera moves (hatchingScale is then about the spacing in pixels where they lie); object, the same strokes in each instance's own space, so a moving or turning object carries its strokes. |
|
|
1185
|
+
| `hatchingDepth` | `number` | `0` | 0 … 1 | `ratio` | tunable | Hatching from luminance and depth: the depth-normal prepass's silhouettes and creases darken the tone the strokes follow, at this strength, so strokes gather along contours and folds as inkDepth inks them (the edges are inkDepthThreshold's and inkNormalThreshold's, found within one stroke spacing). 0 is the tone alone; above 0 the frame runs the prepass PostEffects.outline uses. |
|
|
1186
|
+
| `paintRadius` | `number` | `0` | 0 … 8 | — | tunable | Painterly smoothing (a Kuwahara filter): flat regions become strokes of one colour this many logical pixels across while edges stay sharp; 0 is off. |
|
|
1187
|
+
| `paintAnisotropy` | `number` | `0` | 0 … 1 | `ratio` | — | How far the strokes follow the image's edges: 0 square brush cells, 1 strokes stretched along every contour (an anisotropic Kuwahara). |
|
|
1188
|
+
| `paintEdgeDarkening` | `number` | `0` | 0 … 1 | `ratio` | tunable | Pigment pooling at the edges of colour regions, as wet watercolour dries darker at its rim; 0 is none. |
|
|
1189
|
+
| `paintBleed` | `number` | `0` | 0 … 1 | `ratio` | tunable | Colour bleeding across edges into its neighbours, wet in wet; 0 is none. |
|
|
1190
|
+
| `paintCanvas` | `Texture` | `0` | — | — | — | A tileable paper or canvas texture (og.load.texture) laid over the frame by paintCanvasStrength; 0 is none. |
|
|
1191
|
+
| `paintCanvasStrength` | `number` | `0` | 0 … 1 | `ratio` | tunable | How much the canvas texture modulates the frame: 0 none, 1 its full grain. |
|
|
1192
|
+
| `paintCanvasScale` | `number` | `1` | 0.125 … 8 | — | — | Canvas texels per logical pixel, with paintCanvasSpace screen (and on the sky). |
|
|
1193
|
+
| `paintCanvasSpace` | `StyliseSpace` | `"screen"` | — | — | — | Where the canvas lies: screen, over the frame (the scene slides under the paper as the camera moves); surface, on the surfaces, so the grain sticks to the scene, foreshortened with the floor and walls; object, in each instance's own space, so a moving object carries its grain. |
|
|
1194
|
+
| `paintCanvasWorldScale` | `number` | `128` | 1 … 4096 | — | — | Canvas texels per metre with paintCanvasSpace surface: 128 repeats a 256-texel canvas every two metres. |
|
|
1195
|
+
| `ink` | `boolean` | `false` | — | — | — | Ink lines where the tone changes sharply (luminance edges), over every surface, sprite and texture alike: comic and storybook contours without PostEffects.outline's depth prepass. inkDepth adds the prepass's silhouettes and creases. |
|
|
1196
|
+
| `inkThreshold` | `number` | `0.1` | 0 … 1 | — | tunable | The luminance step that counts as an edge (0 to 1 in display units): lower draws more lines. |
|
|
1197
|
+
| `inkWidth` | `number` | `1` | 0.5 … 8 | — | tunable | The line width in logical pixels. |
|
|
1198
|
+
| `inkColor` | `Color` | `{ r: 0.02, g: 0.02, b: 0.03 }` | — | — | — | The line colour (linear). |
|
|
1199
|
+
| `inkDepth` | `number` | `0` | 0 … 1 | `ratio` | tunable | With ink: lines also where the depth-normal prepass breaks (silhouettes against what is behind, creases between faces), at this strength: comic contours round flat colours that luminance alone misses. 0 is luminance only; above 0 the frame runs the prepass PostEffects.outline uses. |
|
|
1200
|
+
| `inkDepthThreshold` | `number` | `0.04` | ≥ 0 | — | — | With inkDepth: the relative depth step to a farther neighbour that counts as a silhouette (0.04 is 4 %), as PostEffects.outlineDepthThreshold: lower inks smaller steps. |
|
|
1201
|
+
| `inkNormalThreshold` | `number` | `0.4` | 0 … 2 | — | — | With inkDepth: the normal change between neighbours of about the same depth that counts as a crease (1 - cos of the angle; 0.4 is about 53 degrees), as PostEffects.outlineNormalThreshold: lower inks gentler folds. |
|
|
1202
|
+
| `depthBands` | `number` | `0` | 0 … 8 | — | — | Colour bands by depth (2 to 8): the scene from depthBandsNear to depthBandsFar is cut into this many equal layers, the first in depthBandsNearColor, the last in depthBandsFarColor, those between stepping evenly from one to the other in lightness, chroma and hue (never through grey), for layered-silhouette and stage looks; 0 is off. For side and three-quarter views, where the depth runs across the frame: seen from above the play area lies at one depth and falls in one band. |
|
|
1203
|
+
| `depthBandsNear` | `number` | `5` | ≥ 0 | `m` | — | Where the first band starts. |
|
|
1204
|
+
| `depthBandsFar` | `number` | `60` | ≥ 0 | `m` | — | Where the last band ends; the last band (the far colour) starts one band's depth before it, and everything beyond it is the far colour too. |
|
|
1205
|
+
| `depthBandsNearColor` | `Color` | `{ r: 0.02, g: 0.02, b: 0.03 }` | — | — | — | The nearest band's colour (linear, before exposure). |
|
|
1206
|
+
| `depthBandsFarColor` | `Color` | `{ r: 0.55, g: 0.6, b: 0.7 }` | — | — | — | The farthest band's colour (linear, before exposure). |
|
|
1207
|
+
| `depthBandsFlatten` | `number` | `1` | 0 … 1 | `ratio` | tunable | How far a band replaces the surfaces' own shading: 1 flat silhouettes in the band's colour; 0 a tint over the lit scene, its colours times the band's at unit luminance (a coloured filter: the shading, the value and the surfaces' own hues show through); between, a mix of the two. |
|
|
1208
|
+
| `vertexSnap` | `number` | `0` | 0 … 16 | — | — | Snap every vertex of the 3D scene to a screen grid this many logical pixels wide, as fixed-point hardware did: geometry jitters by whole steps as it moves; 0 is off. |
|
|
1209
|
+
| `affineTexturing` | `number` | `0` | 0 … 1 | `ratio` | — | How far texture coordinates are interpolated without perspective correction: 1 fully affine, so textures warp and swim across large polygons as on early consoles; 0 is off. |
|
|
1210
|
+
| `depthBits` | `number` | `0` | 0 … 24 | — | — | Quantise depth to this many bits, for the coarse depth buffers of early 3D (12 to 16 are period-like: distant surfaces fight); 0 keeps full precision. |
|
|
1211
|
+
|
|
1212
|
+
```ogt
|
|
1213
|
+
resource Stylise {
|
|
1214
|
+
doc "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."
|
|
1215
|
+
doc "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."
|
|
1216
|
+
field pixelHeight u32 "The logical resolution: the scene is rendered this many pixels tall and scaled up to the output by a whole number with nearest filtering, as a low-resolution three.js render target drawn with NearestFilter; 0 renders at the output's resolution. The height sets the scale (pixelUpscale); the width is the output's aspect times the height, rounded, but at most the output's width over the scale, so the last column gives way rather than the scale: 240 rows at 1280x720 are 426.67 columns, rounded to 427, and 427 x 3 = 1281 does not fit, so the grid is 426 x 240 at 3x (1278 x 720, a 1-pixel border each side). Heights that divide the output's evenly fill it: 180 (4x), 240 (3x) and 360 (2x) at 720p, 270 (4x) and 360 (3x) at 1080p." {
|
|
1217
|
+
min 0
|
|
1218
|
+
max 2160
|
|
1219
|
+
}
|
|
1220
|
+
field pixelUpscale u32 "The whole-number scale from the logical to the output resolution, a hard request: honoured whenever pixelHeight times it fits the output's height (a smaller scale than the largest leaves the border it implies: 240 lines at 2x in 1280x720 draw 854 x 480 in a 213 x 120 border), else the largest that fits; 0 takes the largest that fits (720 / 240 = 3, 1080 / 240 = 4, rounded down). A frame that does not fill the output is centred with Camera.background round it." {
|
|
1221
|
+
min 0
|
|
1222
|
+
max 16
|
|
1223
|
+
}
|
|
1224
|
+
field pixelSnap bool "Snap the camera and world sprites to the logical pixel grid, so a moving orthographic camera scrolls by whole pixels and sprites in a 3D world keep their edges (pixel sprites in 3D sets)." {
|
|
1225
|
+
default true
|
|
1226
|
+
}
|
|
1227
|
+
field posterize u32 "Tones per colour channel after tone mapping (2 to 64): smooth gradients become flat steps; 0 is off." {
|
|
1228
|
+
min 0
|
|
1229
|
+
max 64
|
|
1230
|
+
}
|
|
1231
|
+
field palette Palette "Quantise every pixel to the nearest colour of this palette (og.load.palette), measured in a perceptual space after posterize; 0 is none."
|
|
1232
|
+
field dither DitherPattern "How the steps of posterize and palette are mixed: none rounds every pixel, an ordered or blue-noise pattern alternates the two nearest steps in proportion."
|
|
1233
|
+
field ditherStrength f32 "The dither's amplitude in steps: 1 spreads exactly one step, less keeps flatter bands." {
|
|
1234
|
+
default 1
|
|
1235
|
+
min 0
|
|
1236
|
+
max 2
|
|
1237
|
+
tunable true
|
|
1238
|
+
}
|
|
1239
|
+
field ditherScale u32 "The size of one dither cell in logical pixels." {
|
|
1240
|
+
default 1
|
|
1241
|
+
min 1
|
|
1242
|
+
max 8
|
|
1243
|
+
}
|
|
1244
|
+
field halftone f32 "Halftone print: tones become dots on a rotated grid, larger where the image is darker; 0 is off, 1 dots only." {
|
|
1245
|
+
min 0
|
|
1246
|
+
max 1
|
|
1247
|
+
unit ratio
|
|
1248
|
+
tunable true
|
|
1249
|
+
}
|
|
1250
|
+
field halftoneSize f32 "The dot grid's pitch in logical pixels." {
|
|
1251
|
+
default 6
|
|
1252
|
+
min 2
|
|
1253
|
+
max 64
|
|
1254
|
+
}
|
|
1255
|
+
field halftoneAngle f32 "The dot grid's angle." {
|
|
1256
|
+
default 45
|
|
1257
|
+
unit deg
|
|
1258
|
+
}
|
|
1259
|
+
field halftoneColor Color "The ink of the dots (linear)." {
|
|
1260
|
+
default 0.02 0.02 0.03
|
|
1261
|
+
}
|
|
1262
|
+
field halftoneSpace StyliseSpace "Where the dots lie: screen, a grid over the frame; surface, grids on the surfaces that stay on them as the camera moves and wrap round forms (halftoneSize is then about the pitch in pixels where they lie); object, the same grids in each instance's own space, so a moving object carries its dots."
|
|
1263
|
+
field hatching f32 "Pencil or ink cross-hatching from a tonal art map: darker tones add strokes in more directions over a paper-light ground; 0 is off, 1 strokes only." {
|
|
1264
|
+
min 0
|
|
1265
|
+
max 1
|
|
1266
|
+
unit ratio
|
|
1267
|
+
tunable true
|
|
1268
|
+
}
|
|
1269
|
+
field hatchingScale f32 "The spacing of hatch lines in logical pixels." {
|
|
1270
|
+
default 6
|
|
1271
|
+
min 2
|
|
1272
|
+
max 64
|
|
1273
|
+
}
|
|
1274
|
+
field hatchingLevels u32 "How many tones the hatching distinguishes, each adding one stroke direction or density (1 to 6)." {
|
|
1275
|
+
default 4
|
|
1276
|
+
min 1
|
|
1277
|
+
max 6
|
|
1278
|
+
}
|
|
1279
|
+
field hatchingAngle f32 "The direction of the first stroke set." {
|
|
1280
|
+
default 45
|
|
1281
|
+
unit deg
|
|
1282
|
+
}
|
|
1283
|
+
field hatchingColor Color "The stroke colour (linear): graphite, sepia or ink." {
|
|
1284
|
+
default 0.04 0.035 0.03
|
|
1285
|
+
}
|
|
1286
|
+
field hatchingSpace StyliseSpace "Where the strokes lie: screen, stripes over the frame that follow the tone alone; surface, strokes laid on the surfaces that follow the tone and the form, wrapping round curved objects and staying on them as the camera moves (hatchingScale is then about the spacing in pixels where they lie); object, the same strokes in each instance's own space, so a moving or turning object carries its strokes."
|
|
1287
|
+
field hatchingDepth f32 "Hatching from luminance and depth: the depth-normal prepass's silhouettes and creases darken the tone the strokes follow, at this strength, so strokes gather along contours and folds as inkDepth inks them (the edges are inkDepthThreshold's and inkNormalThreshold's, found within one stroke spacing). 0 is the tone alone; above 0 the frame runs the prepass PostEffects.outline uses." {
|
|
1288
|
+
min 0
|
|
1289
|
+
max 1
|
|
1290
|
+
unit ratio
|
|
1291
|
+
tunable true
|
|
1292
|
+
}
|
|
1293
|
+
field paintRadius f32 "Painterly smoothing (a Kuwahara filter): flat regions become strokes of one colour this many logical pixels across while edges stay sharp; 0 is off." {
|
|
1294
|
+
min 0
|
|
1295
|
+
max 8
|
|
1296
|
+
tunable true
|
|
1297
|
+
}
|
|
1298
|
+
field paintAnisotropy f32 "How far the strokes follow the image's edges: 0 square brush cells, 1 strokes stretched along every contour (an anisotropic Kuwahara)." {
|
|
1299
|
+
min 0
|
|
1300
|
+
max 1
|
|
1301
|
+
unit ratio
|
|
1302
|
+
}
|
|
1303
|
+
field paintEdgeDarkening f32 "Pigment pooling at the edges of colour regions, as wet watercolour dries darker at its rim; 0 is none." {
|
|
1304
|
+
min 0
|
|
1305
|
+
max 1
|
|
1306
|
+
unit ratio
|
|
1307
|
+
tunable true
|
|
1308
|
+
}
|
|
1309
|
+
field paintBleed f32 "Colour bleeding across edges into its neighbours, wet in wet; 0 is none." {
|
|
1310
|
+
min 0
|
|
1311
|
+
max 1
|
|
1312
|
+
unit ratio
|
|
1313
|
+
tunable true
|
|
1314
|
+
}
|
|
1315
|
+
field paintCanvas Texture "A tileable paper or canvas texture (og.load.texture) laid over the frame by paintCanvasStrength; 0 is none."
|
|
1316
|
+
field paintCanvasStrength f32 "How much the canvas texture modulates the frame: 0 none, 1 its full grain." {
|
|
1317
|
+
min 0
|
|
1318
|
+
max 1
|
|
1319
|
+
unit ratio
|
|
1320
|
+
tunable true
|
|
1321
|
+
}
|
|
1322
|
+
field paintCanvasScale f32 "Canvas texels per logical pixel, with paintCanvasSpace screen (and on the sky)." {
|
|
1323
|
+
default 1
|
|
1324
|
+
min 0.125
|
|
1325
|
+
max 8
|
|
1326
|
+
}
|
|
1327
|
+
field paintCanvasSpace StyliseSpace "Where the canvas lies: screen, over the frame (the scene slides under the paper as the camera moves); surface, on the surfaces, so the grain sticks to the scene, foreshortened with the floor and walls; object, in each instance's own space, so a moving object carries its grain."
|
|
1328
|
+
field paintCanvasWorldScale f32 "Canvas texels per metre with paintCanvasSpace surface: 128 repeats a 256-texel canvas every two metres." {
|
|
1329
|
+
default 128
|
|
1330
|
+
min 1
|
|
1331
|
+
max 4096
|
|
1332
|
+
}
|
|
1333
|
+
field ink bool "Ink lines where the tone changes sharply (luminance edges), over every surface, sprite and texture alike: comic and storybook contours without PostEffects.outline's depth prepass. inkDepth adds the prepass's silhouettes and creases."
|
|
1334
|
+
field inkThreshold f32 "The luminance step that counts as an edge (0 to 1 in display units): lower draws more lines." {
|
|
1335
|
+
default 0.1
|
|
1336
|
+
min 0
|
|
1337
|
+
max 1
|
|
1338
|
+
tunable true
|
|
1339
|
+
}
|
|
1340
|
+
field inkWidth f32 "The line width in logical pixels." {
|
|
1341
|
+
default 1
|
|
1342
|
+
min 0.5
|
|
1343
|
+
max 8
|
|
1344
|
+
tunable true
|
|
1345
|
+
}
|
|
1346
|
+
field inkColor Color "The line colour (linear)." {
|
|
1347
|
+
default 0.02 0.02 0.03
|
|
1348
|
+
}
|
|
1349
|
+
field inkDepth f32 "With ink: lines also where the depth-normal prepass breaks (silhouettes against what is behind, creases between faces), at this strength: comic contours round flat colours that luminance alone misses. 0 is luminance only; above 0 the frame runs the prepass PostEffects.outline uses." {
|
|
1350
|
+
min 0
|
|
1351
|
+
max 1
|
|
1352
|
+
unit ratio
|
|
1353
|
+
tunable true
|
|
1354
|
+
}
|
|
1355
|
+
field inkDepthThreshold f32 "With inkDepth: the relative depth step to a farther neighbour that counts as a silhouette (0.04 is 4 %), as PostEffects.outlineDepthThreshold: lower inks smaller steps." {
|
|
1356
|
+
default 0.04
|
|
1357
|
+
min 0
|
|
1358
|
+
}
|
|
1359
|
+
field inkNormalThreshold f32 "With inkDepth: the normal change between neighbours of about the same depth that counts as a crease (1 - cos of the angle; 0.4 is about 53 degrees), as PostEffects.outlineNormalThreshold: lower inks gentler folds." {
|
|
1360
|
+
default 0.4
|
|
1361
|
+
min 0
|
|
1362
|
+
max 2
|
|
1363
|
+
}
|
|
1364
|
+
field depthBands u32 "Colour bands by depth (2 to 8): the scene from depthBandsNear to depthBandsFar is cut into this many equal layers, the first in depthBandsNearColor, the last in depthBandsFarColor, those between stepping evenly from one to the other in lightness, chroma and hue (never through grey), for layered-silhouette and stage looks; 0 is off. For side and three-quarter views, where the depth runs across the frame: seen from above the play area lies at one depth and falls in one band." {
|
|
1365
|
+
min 0
|
|
1366
|
+
max 8
|
|
1367
|
+
}
|
|
1368
|
+
field depthBandsNear f32 "Where the first band starts." {
|
|
1369
|
+
default 5
|
|
1370
|
+
min 0
|
|
1371
|
+
unit m
|
|
1372
|
+
}
|
|
1373
|
+
field depthBandsFar f32 "Where the last band ends; the last band (the far colour) starts one band's depth before it, and everything beyond it is the far colour too." {
|
|
1374
|
+
default 60
|
|
1375
|
+
min 0
|
|
1376
|
+
unit m
|
|
1377
|
+
}
|
|
1378
|
+
field depthBandsNearColor Color "The nearest band's colour (linear, before exposure)." {
|
|
1379
|
+
default 0.02 0.02 0.03
|
|
1380
|
+
}
|
|
1381
|
+
field depthBandsFarColor Color "The farthest band's colour (linear, before exposure)." {
|
|
1382
|
+
default 0.55 0.6 0.7
|
|
1383
|
+
}
|
|
1384
|
+
field depthBandsFlatten f32 "How far a band replaces the surfaces' own shading: 1 flat silhouettes in the band's colour; 0 a tint over the lit scene, its colours times the band's at unit luminance (a coloured filter: the shading, the value and the surfaces' own hues show through); between, a mix of the two." {
|
|
1385
|
+
default 1
|
|
1386
|
+
min 0
|
|
1387
|
+
max 1
|
|
1388
|
+
unit ratio
|
|
1389
|
+
tunable true
|
|
1390
|
+
}
|
|
1391
|
+
field vertexSnap f32 "Snap every vertex of the 3D scene to a screen grid this many logical pixels wide, as fixed-point hardware did: geometry jitters by whole steps as it moves; 0 is off." {
|
|
1392
|
+
min 0
|
|
1393
|
+
max 16
|
|
1394
|
+
}
|
|
1395
|
+
field affineTexturing f32 "How far texture coordinates are interpolated without perspective correction: 1 fully affine, so textures warp and swim across large polygons as on early consoles; 0 is off." {
|
|
1396
|
+
min 0
|
|
1397
|
+
max 1
|
|
1398
|
+
unit ratio
|
|
1399
|
+
}
|
|
1400
|
+
field depthBits u32 "Quantise depth to this many bits, for the coarse depth buffers of early 3D (12 to 16 are period-like: distant surfaces fight); 0 keeps full precision." {
|
|
1401
|
+
min 0
|
|
1402
|
+
max 24
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
```
|
|
1406
|
+
|
|
1407
|
+
<sub>`api.ogt` line 2404</sub>
|
|
1408
|
+
|
|
1409
|
+
<a id="record-MaterialStyle"></a>
|
|
1410
|
+
|
|
1411
|
+
### `og.MaterialStyle` (resource)
|
|
1412
|
+
|
|
1413
|
+
Stylised defaults for every lit material, so a whole scene takes one treatment without editing each material: toon shading and its ramp, a coloured shadow side, rim light, outlines whose width falls off with distance, and flat facets. Each applies to a material (og.render.standardMaterial or a loaded glTF's) that leaves that field at its own default; unlit and shader materials, materials with StandardMaterialDesc.styled false, sprites and the UI are untouched, and toon passes by a material with a MeshPhysicalMaterial lobe (clearcoat, sheen, transmission, iridescence, anisotropy, ior), which keeps its physical shading. All off (false, 0) is no change. A look sets it; RenderCapabilities.stylise names what this renderer draws. Read after each tick; it never feeds back into the simulation.
|
|
1414
|
+
|
|
1415
|
+
Token `og.MaterialStyle`, registered under the schema name `og.MaterialStyle`; its value type is `MaterialStyle`.
|
|
1416
|
+
|
|
1417
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
1418
|
+
|---|---|---|---|---|---|---|
|
|
1419
|
+
| `toon` | `boolean` | `false` | — | — | — | Cel shading for every lit material, as StandardMaterialDesc.toon: light quantised by the ramp, hard highlights. A material with a physical lobe (clearcoat, transmission and the rest) keeps its physical shading; set its own toon to make it toon anyway. |
|
|
1420
|
+
| `gradientMap` | `Texture` | `0` | — | — | — | The toon ramp for materials without their own (StandardMaterialDesc.gradientMap, og.load.texture): its first row maps the light's angle to the light received, read without filtering; 0 is three built-in bands. |
|
|
1421
|
+
| `shadowTint` | `Color` | `{ r: 0.18, g: 0.16, b: 0.32 }` | — | — | — | The colour the shadowed side of a toon or lit surface moves towards instead of black (linear): the cool or warm shadow of illustration. |
|
|
1422
|
+
| `shadowTintAmount` | `number` | `0` | 0 … 1 | `ratio` | tunable | How far shadowed light moves towards shadowTint; 0 is off. |
|
|
1423
|
+
| `rimColor` | `Color` | `{ r: 1, g: 1, b: 1 }` | — | — | — | Rim (fresnel) light for materials without their own (linear). |
|
|
1424
|
+
| `rimIntensity` | `number` | `0` | ≥ 0 | — | tunable | The rim light's strength; 0 is none. |
|
|
1425
|
+
| `rimPower` | `number` | `3` | ≥ 0.1 | — | — | How tight the rim is (higher: thinner). |
|
|
1426
|
+
| `outlineColor` | `Color` | `{ r: 0.02, g: 0.02, b: 0.03 }` | — | — | — | The outline colour for materials without their own (linear). |
|
|
1427
|
+
| `outlineWidth` | `number` | `0` | 0 … 31 | — | tunable | The outline width in pixels at outlineDistance for materials without their own; 0 is none. A hull outline (StandardMaterialDesc.outlineWidth): silhouettes and creases against other objects, never the faces of one, so voxel and flat-shaded models stay clean. A surface seen at a grazing angle is lined only where it ends: a 1,600 m ground under a chase camera keeps its far edge and nothing else (no band along the horizon). |
|
|
1428
|
+
| `outlineDistance` | `number` | `0` | ≥ 0 | `m` | — | The distance at which outlines are outlineWidth wide: nearer they grow, up to four times outlineWidth, farther they thin in proportion (an inked look keeps line weight by depth); 0 keeps every outline outlineWidth wide. |
|
|
1429
|
+
| `flatShading` | `boolean` | `false` | — | — | — | Shade every lit material with face normals, as StandardMaterialDesc.flatShading: visible facets for low-poly, paper-craft and voxel looks. |
|
|
1430
|
+
|
|
1431
|
+
```ogt
|
|
1432
|
+
resource MaterialStyle {
|
|
1433
|
+
doc "Stylised defaults for every lit material, so a whole scene takes one treatment without editing each material: toon shading and its ramp, a coloured shadow side, rim light, outlines whose width falls off with distance, and flat facets. Each applies to a material (og.render.standardMaterial or a loaded glTF's) that leaves that field at its own default; unlit and shader materials, materials with StandardMaterialDesc.styled false, sprites and the UI are untouched, and toon passes by a material with a MeshPhysicalMaterial lobe (clearcoat, sheen, transmission, iridescence, anisotropy, ior), which keeps its physical shading. All off (false, 0) is no change. A look sets it; RenderCapabilities.stylise names what this renderer draws. Read after each tick; it never feeds back into the simulation."
|
|
1434
|
+
field toon bool "Cel shading for every lit material, as StandardMaterialDesc.toon: light quantised by the ramp, hard highlights. A material with a physical lobe (clearcoat, transmission and the rest) keeps its physical shading; set its own toon to make it toon anyway."
|
|
1435
|
+
field gradientMap Texture "The toon ramp for materials without their own (StandardMaterialDesc.gradientMap, og.load.texture): its first row maps the light's angle to the light received, read without filtering; 0 is three built-in bands."
|
|
1436
|
+
field shadowTint Color "The colour the shadowed side of a toon or lit surface moves towards instead of black (linear): the cool or warm shadow of illustration." {
|
|
1437
|
+
default 0.18 0.16 0.32
|
|
1438
|
+
}
|
|
1439
|
+
field shadowTintAmount f32 "How far shadowed light moves towards shadowTint; 0 is off." {
|
|
1440
|
+
min 0
|
|
1441
|
+
max 1
|
|
1442
|
+
unit ratio
|
|
1443
|
+
tunable true
|
|
1444
|
+
}
|
|
1445
|
+
field rimColor Color "Rim (fresnel) light for materials without their own (linear)." {
|
|
1446
|
+
default 1 1 1
|
|
1447
|
+
}
|
|
1448
|
+
field rimIntensity f32 "The rim light's strength; 0 is none." {
|
|
1449
|
+
min 0
|
|
1450
|
+
tunable true
|
|
1451
|
+
}
|
|
1452
|
+
field rimPower f32 "How tight the rim is (higher: thinner)." {
|
|
1453
|
+
default 3
|
|
1454
|
+
min 0.1
|
|
1455
|
+
}
|
|
1456
|
+
field outlineColor Color "The outline colour for materials without their own (linear)." {
|
|
1457
|
+
default 0.02 0.02 0.03
|
|
1458
|
+
}
|
|
1459
|
+
field outlineWidth f32 "The outline width in pixels at outlineDistance for materials without their own; 0 is none. A hull outline (StandardMaterialDesc.outlineWidth): silhouettes and creases against other objects, never the faces of one, so voxel and flat-shaded models stay clean. A surface seen at a grazing angle is lined only where it ends: a 1,600 m ground under a chase camera keeps its far edge and nothing else (no band along the horizon)." {
|
|
1460
|
+
min 0
|
|
1461
|
+
max 31
|
|
1462
|
+
tunable true
|
|
1463
|
+
}
|
|
1464
|
+
field outlineDistance f32 "The distance at which outlines are outlineWidth wide: nearer they grow, up to four times outlineWidth, farther they thin in proportion (an inked look keeps line weight by depth); 0 keeps every outline outlineWidth wide." {
|
|
1465
|
+
min 0
|
|
1466
|
+
unit m
|
|
1467
|
+
}
|
|
1468
|
+
field flatShading bool "Shade every lit material with face normals, as StandardMaterialDesc.flatShading: visible facets for low-poly, paper-craft and voxel looks."
|
|
1469
|
+
}
|
|
1470
|
+
```
|
|
1471
|
+
|
|
1472
|
+
<sub>`api.ogt` line 2597</sub>
|
|
1473
|
+
|
|
1474
|
+
<a id="record-Lighting2D"></a>
|
|
1475
|
+
|
|
1476
|
+
### `og.Lighting2D` (resource)
|
|
1477
|
+
|
|
1478
|
+
2D lighting of the sprite layers minLayer to maxLayer (sprites, 2D particles and og.Tilemap layers there, a map layer unless its `lit` property is false): their colour is multiplied by ambient plus every Light2D reaching the pixel, shadowed by Occluder2Ds and sprites with castShadow. Other layers (and the overlay) are drawn as authored. Off by default.
|
|
1479
|
+
|
|
1480
|
+
Token `og.Lighting2D`, registered under the schema name `og.Lighting2D`; its value type is `Lighting2D`.
|
|
1481
|
+
|
|
1482
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
1483
|
+
|---|---|---|---|---|---|---|
|
|
1484
|
+
| `enabled` | `boolean` | `false` | — | — | — | Light the layers. |
|
|
1485
|
+
| `ambient` | `Color` | `{ r: 0.15, g: 0.15, b: 0.15 }` | — | — | — | Light everywhere (0 is darkness outside the lights). |
|
|
1486
|
+
| `minLayer` | `number` | `-1000000` | — | — | — | The lowest lit sprite layer. |
|
|
1487
|
+
| `maxLayer` | `number` | `99` | — | — | — | The highest lit sprite layer (above it: UI and HUD layers stay unlit). |
|
|
1488
|
+
| `resolution` | `number` | `0.5` | 0.25 … 1 | — | — | The light map's resolution as a fraction of the target. |
|
|
1489
|
+
|
|
1490
|
+
```ogt
|
|
1491
|
+
resource Lighting2D {
|
|
1492
|
+
doc "2D lighting of the sprite layers minLayer to maxLayer (sprites, 2D particles and og.Tilemap layers there, a map layer unless its `lit` property is false): their colour is multiplied by ambient plus every Light2D reaching the pixel, shadowed by Occluder2Ds and sprites with castShadow. Other layers (and the overlay) are drawn as authored. Off by default."
|
|
1493
|
+
field enabled bool "Light the layers."
|
|
1494
|
+
field ambient Color "Light everywhere (0 is darkness outside the lights)." {
|
|
1495
|
+
default 0.15 0.15 0.15
|
|
1496
|
+
}
|
|
1497
|
+
field minLayer i32 "The lowest lit sprite layer." {
|
|
1498
|
+
default -1000000
|
|
1499
|
+
}
|
|
1500
|
+
field maxLayer i32 "The highest lit sprite layer (above it: UI and HUD layers stay unlit)." {
|
|
1501
|
+
default 99
|
|
1502
|
+
}
|
|
1503
|
+
field resolution f32 "The light map's resolution as a fraction of the target." {
|
|
1504
|
+
default 0.5
|
|
1505
|
+
min 0.25
|
|
1506
|
+
max 1
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
```
|
|
1510
|
+
|
|
1511
|
+
<sub>`api.ogt` line 2647</sub>
|
|
1512
|
+
|
|
1513
|
+
<a id="record-Light2D"></a>
|
|
1514
|
+
|
|
1515
|
+
### `og.Light2D` (component)
|
|
1516
|
+
|
|
1517
|
+
A light in the 2D plane at the entity's position (z ignored): color times intensity at its centre, falling to zero at radius with (1 - d/r)^falloff, shadowed by occluders when castShadows. Lighting2D.enabled turns 2D lighting on; at most 64 are drawn.
|
|
1518
|
+
|
|
1519
|
+
Token `og.Light2D`, registered under the schema name `og.Light2D`; its value type is `Light2D`.
|
|
1520
|
+
|
|
1521
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
1522
|
+
|---|---|---|---|---|---|---|
|
|
1523
|
+
| `color` | `Color` | `{ r: 1, g: 1, b: 1 }` | — | — | — | The light's linear colour. |
|
|
1524
|
+
| `intensity` | `number` | `1` | ≥ 0 | — | tunable | The brightness at the centre. |
|
|
1525
|
+
| `radius` | `number` | `5` | ≥ 0 | `m` | tunable | Where the light reaches zero, in world units. |
|
|
1526
|
+
| `falloff` | `number` | `2` | ≥ 0.1 | — | — | The exponent of the fade. |
|
|
1527
|
+
| `sourceRadius` | `number` | `0.25` | ≥ 0 | `m` | — | The light's own size: larger gives softer shadows. |
|
|
1528
|
+
| `castShadows` | `boolean` | `true` | — | — | — | Occluders between the light and a pixel shade it. |
|
|
1529
|
+
|
|
1530
|
+
```ogt
|
|
1531
|
+
component Light2D {
|
|
1532
|
+
doc "A light in the 2D plane at the entity's position (z ignored): color times intensity at its centre, falling to zero at radius with (1 - d/r)^falloff, shadowed by occluders when castShadows. Lighting2D.enabled turns 2D lighting on; at most 64 are drawn."
|
|
1533
|
+
field color Color "The light's linear colour." {
|
|
1534
|
+
default 1 1 1
|
|
1535
|
+
}
|
|
1536
|
+
field intensity f32 "The brightness at the centre." {
|
|
1537
|
+
default 1
|
|
1538
|
+
min 0
|
|
1539
|
+
tunable true
|
|
1540
|
+
}
|
|
1541
|
+
field radius f32 "Where the light reaches zero, in world units." {
|
|
1542
|
+
default 5
|
|
1543
|
+
min 0
|
|
1544
|
+
unit m
|
|
1545
|
+
tunable true
|
|
1546
|
+
}
|
|
1547
|
+
field falloff f32 "The exponent of the fade." {
|
|
1548
|
+
default 2
|
|
1549
|
+
min 0.1
|
|
1550
|
+
}
|
|
1551
|
+
field sourceRadius f32 "The light's own size: larger gives softer shadows." {
|
|
1552
|
+
default 0.25
|
|
1553
|
+
min 0
|
|
1554
|
+
unit m
|
|
1555
|
+
}
|
|
1556
|
+
field castShadows bool "Occluders between the light and a pixel shade it." {
|
|
1557
|
+
default true
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
```
|
|
1561
|
+
|
|
1562
|
+
<sub>`api.ogt` line 2666</sub>
|
|
1563
|
+
|
|
1564
|
+
<a id="record-Occluder2D"></a>
|
|
1565
|
+
|
|
1566
|
+
### `og.Occluder2D` (component)
|
|
1567
|
+
|
|
1568
|
+
A rectangle that blocks 2D light (walls, crates, characters), centred on the entity's position and turned with it about z. Pixels inside it are not shadowed by it. At most 128 are drawn.
|
|
1569
|
+
|
|
1570
|
+
Token `og.Occluder2D`, registered under the schema name `og.Occluder2D`; its value type is `Occluder2D`.
|
|
1571
|
+
|
|
1572
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
1573
|
+
|---|---|---|---|---|---|---|
|
|
1574
|
+
| `width` | `number` | `1` | ≥ 0 | `m` | — | Its width in world units. |
|
|
1575
|
+
| `height` | `number` | `1` | ≥ 0 | `m` | — | Its height in world units. |
|
|
1576
|
+
|
|
1577
|
+
```ogt
|
|
1578
|
+
component Occluder2D {
|
|
1579
|
+
doc "A rectangle that blocks 2D light (walls, crates, characters), centred on the entity's position and turned with it about z. Pixels inside it are not shadowed by it. At most 128 are drawn."
|
|
1580
|
+
field width f32 "Its width in world units." {
|
|
1581
|
+
default 1
|
|
1582
|
+
min 0
|
|
1583
|
+
unit m
|
|
1584
|
+
}
|
|
1585
|
+
field height f32 "Its height in world units." {
|
|
1586
|
+
default 1
|
|
1587
|
+
min 0
|
|
1588
|
+
unit m
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
```
|
|
1592
|
+
|
|
1593
|
+
<sub>`api.ogt` line 2696</sub>
|
|
1594
|
+
|
|
1595
|
+
<a id="record-Decal"></a>
|
|
1596
|
+
|
|
1597
|
+
### `og.Decal` (component)
|
|
1598
|
+
|
|
1599
|
+
A projected decal (scorch marks, blood, posters, bullet holes): the entity's unit box (-0.5 to 0.5 on each axis, scaled by its Transform) projected along its local -Z onto every lit opaque surface inside it, shaded with the surface. Its image is the uvMin to uvMax region of RenderSettings.decalAtlas (a solid colour without one). At most 32 are drawn.
|
|
1600
|
+
|
|
1601
|
+
Token `og.Decal`, registered under the schema name `og.Decal`; its value type is `Decal`.
|
|
1602
|
+
|
|
1603
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
1604
|
+
|---|---|---|---|---|---|---|
|
|
1605
|
+
| `color` | `Color` | `{ r: 1, g: 1, b: 1 }` | — | — | — | A linear colour multiplied with the atlas. |
|
|
1606
|
+
| `opacity` | `number` | `1` | 0 … 1 | — | tunable | The decal's opacity. |
|
|
1607
|
+
| `uvMin` | `Vector2` | `{ x: 0, y: 0 }` | — | — | — | The atlas region's top-left corner, v down. |
|
|
1608
|
+
| `uvMax` | `Vector2` | `{ x: 1, y: 1 }` | — | — | — | The atlas region's bottom-right corner, v down. |
|
|
1609
|
+
| `emissive` | `Color` | `{ r: 0, g: 0, b: 0 }` | — | — | — | Linear light added where the decal covers (glowing runes, lava). |
|
|
1610
|
+
| `roughness` | `number` | `-1` | -1 … 1 | — | — | The surface roughness under the decal; -1 keeps the surface's. |
|
|
1611
|
+
| `angleFade` | `number` | `75` | 0 … 90 | `deg` | — | Surfaces turned further than this from the projection direction are not covered (the last 15 degrees fade). |
|
|
1612
|
+
| `visible` | `boolean` | `true` | — | — | — | Whether it is drawn. |
|
|
1613
|
+
|
|
1614
|
+
```ogt
|
|
1615
|
+
component Decal {
|
|
1616
|
+
doc "A projected decal (scorch marks, blood, posters, bullet holes): the entity's unit box (-0.5 to 0.5 on each axis, scaled by its Transform) projected along its local -Z onto every lit opaque surface inside it, shaded with the surface. Its image is the uvMin to uvMax region of RenderSettings.decalAtlas (a solid colour without one). At most 32 are drawn."
|
|
1617
|
+
field color Color "A linear colour multiplied with the atlas." {
|
|
1618
|
+
default 1 1 1
|
|
1619
|
+
}
|
|
1620
|
+
field opacity f32 "The decal's opacity." {
|
|
1621
|
+
default 1
|
|
1622
|
+
min 0
|
|
1623
|
+
max 1
|
|
1624
|
+
tunable true
|
|
1625
|
+
}
|
|
1626
|
+
field uvMin Vector2 "The atlas region's top-left corner, v down."
|
|
1627
|
+
field uvMax Vector2 "The atlas region's bottom-right corner, v down." {
|
|
1628
|
+
default 1 1
|
|
1629
|
+
}
|
|
1630
|
+
field emissive Color "Linear light added where the decal covers (glowing runes, lava)."
|
|
1631
|
+
field roughness f32 "The surface roughness under the decal; -1 keeps the surface's." {
|
|
1632
|
+
default -1
|
|
1633
|
+
min -1
|
|
1634
|
+
max 1
|
|
1635
|
+
}
|
|
1636
|
+
field angleFade f32 "Surfaces turned further than this from the projection direction are not covered (the last 15 degrees fade)." {
|
|
1637
|
+
default 75
|
|
1638
|
+
min 0
|
|
1639
|
+
max 90
|
|
1640
|
+
unit deg
|
|
1641
|
+
}
|
|
1642
|
+
field visible bool "Whether it is drawn." {
|
|
1643
|
+
default true
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
```
|
|
1647
|
+
|
|
1648
|
+
<sub>`api.ogt` line 2710</sub>
|
|
1649
|
+
|
|
1650
|
+
<a id="record-ParticleSystem"></a>
|
|
1651
|
+
|
|
1652
|
+
### `og.ParticleSystem` (component)
|
|
1653
|
+
|
|
1654
|
+
Emits particles from an og.load.emitter asset at the entity's MatrixWorld. Particles are simulated by the renderer from (seed, startTick, the tick), so they are deterministic and replay, and never feed back into the simulation: compute on the full tier, the CPU on WebGL2, identical either way.
|
|
1655
|
+
|
|
1656
|
+
Token `og.ParticleSystem`, registered under the schema name `og.ParticleSystem`; its value type is `ParticleSystem`.
|
|
1657
|
+
|
|
1658
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
1659
|
+
|---|---|---|---|---|---|---|
|
|
1660
|
+
| `emitter` | `ParticleEmitter` | `0` | — | — | — | The emitter asset; 0 draws nothing. |
|
|
1661
|
+
| `seed` | `number` | `0` | — | — | — | The random seed: systems with different seeds differ. |
|
|
1662
|
+
| `startTick` | `number` | `0` | — | — | — | The tick emission started: write og.world tick when spawning a one-shot burst. |
|
|
1663
|
+
| `stopTick` | `number` | `0` | — | — | — | The tick emission stops (the particles live out); 0 keeps emitting while the emitter loops. |
|
|
1664
|
+
| `visible` | `boolean` | `true` | — | — | — | Whether it is drawn (a hidden system loses its particles). |
|
|
1665
|
+
|
|
1666
|
+
```ogt
|
|
1667
|
+
component ParticleSystem {
|
|
1668
|
+
doc "Emits particles from an og.load.emitter asset at the entity's MatrixWorld. Particles are simulated by the renderer from (seed, startTick, the tick), so they are deterministic and replay, and never feed back into the simulation: compute on the full tier, the CPU on WebGL2, identical either way."
|
|
1669
|
+
field emitter ParticleEmitter "The emitter asset; 0 draws nothing."
|
|
1670
|
+
field seed u32 "The random seed: systems with different seeds differ."
|
|
1671
|
+
field startTick u32 "The tick emission started: write og.world tick when spawning a one-shot burst."
|
|
1672
|
+
field stopTick u32 "The tick emission stops (the particles live out); 0 keeps emitting while the emitter loops."
|
|
1673
|
+
field visible bool "Whether it is drawn (a hidden system loses its particles)." {
|
|
1674
|
+
default true
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
```
|
|
1678
|
+
|
|
1679
|
+
<sub>`api.ogt` line 2742</sub>
|
|
1680
|
+
|
|
1681
|
+
<a id="record-Trail"></a>
|
|
1682
|
+
|
|
1683
|
+
### `og.Trail` (component)
|
|
1684
|
+
|
|
1685
|
+
A streak behind the entity: its world positions over the last `lifetime` seconds as a camera-facing strip, from widthStart and color at the head to widthEnd and colorEnd at the tail.
|
|
1686
|
+
|
|
1687
|
+
Token `og.Trail`, registered under the schema name `og.Trail`; its value type is `Trail`.
|
|
1688
|
+
|
|
1689
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
1690
|
+
|---|---|---|---|---|---|---|
|
|
1691
|
+
| `lifetime` | `number` | `0.4` | ≥ 0 | `s` | tunable | How long a position stays in the trail. |
|
|
1692
|
+
| `minDistance` | `number` | `0.05` | ≥ 0 | `m` | — | A new point is kept when the head has moved this far. |
|
|
1693
|
+
| `widthStart` | `number` | `0.15` | ≥ 0 | `m` | tunable | The width at the head. |
|
|
1694
|
+
| `widthEnd` | `number` | `0` | ≥ 0 | `m` | — | The width at the tail. |
|
|
1695
|
+
| `color` | `Color` | `{ r: 1, g: 1, b: 1 }` | — | — | — | The linear colour at the head; above 1 blooms. |
|
|
1696
|
+
| `opacity` | `number` | `1` | 0 … 1 | — | — | The alpha at the head. |
|
|
1697
|
+
| `colorEnd` | `Color` | `{ r: 1, g: 1, b: 1 }` | — | — | — | The linear colour at the tail. |
|
|
1698
|
+
| `opacityEnd` | `number` | `0` | 0 … 1 | — | — | The alpha at the tail. |
|
|
1699
|
+
| `texture` | `Texture` | `0` | — | — | — | A texture along the strip; 0 is solid. |
|
|
1700
|
+
| `uvTile` | `number` | `0` | ≥ 0 | `m` | — | The texture repeats every this many world units; 0 stretches it once over the length. |
|
|
1701
|
+
| `blend` | `StripBlend` | `"additive"` | — | — | — | Additive or alpha blended. |
|
|
1702
|
+
| `layered` | `boolean` | `false` | — | — | — | Draw it in the 2D sprite order at `layer` (a sprite's trail over a tile background) instead of with the 3D scene. |
|
|
1703
|
+
| `layer` | `number` | `0` | — | — | — | With layered: the sprite layer it is drawn in, before that layer's sprites. |
|
|
1704
|
+
|
|
1705
|
+
```ogt
|
|
1706
|
+
component Trail {
|
|
1707
|
+
doc "A streak behind the entity: its world positions over the last `lifetime` seconds as a camera-facing strip, from widthStart and color at the head to widthEnd and colorEnd at the tail."
|
|
1708
|
+
field lifetime f32 "How long a position stays in the trail." {
|
|
1709
|
+
default 0.4
|
|
1710
|
+
min 0
|
|
1711
|
+
unit s
|
|
1712
|
+
tunable true
|
|
1713
|
+
}
|
|
1714
|
+
field minDistance f32 "A new point is kept when the head has moved this far." {
|
|
1715
|
+
default 0.05
|
|
1716
|
+
min 0
|
|
1717
|
+
unit m
|
|
1718
|
+
}
|
|
1719
|
+
field widthStart f32 "The width at the head." {
|
|
1720
|
+
default 0.15
|
|
1721
|
+
min 0
|
|
1722
|
+
unit m
|
|
1723
|
+
tunable true
|
|
1724
|
+
}
|
|
1725
|
+
field widthEnd f32 "The width at the tail." {
|
|
1726
|
+
min 0
|
|
1727
|
+
unit m
|
|
1728
|
+
}
|
|
1729
|
+
field color Color "The linear colour at the head; above 1 blooms." {
|
|
1730
|
+
default 1 1 1
|
|
1731
|
+
}
|
|
1732
|
+
field opacity f32 "The alpha at the head." {
|
|
1733
|
+
default 1
|
|
1734
|
+
min 0
|
|
1735
|
+
max 1
|
|
1736
|
+
}
|
|
1737
|
+
field colorEnd Color "The linear colour at the tail." {
|
|
1738
|
+
default 1 1 1
|
|
1739
|
+
}
|
|
1740
|
+
field opacityEnd f32 "The alpha at the tail." {
|
|
1741
|
+
min 0
|
|
1742
|
+
max 1
|
|
1743
|
+
}
|
|
1744
|
+
field texture Texture "A texture along the strip; 0 is solid."
|
|
1745
|
+
field uvTile f32 "The texture repeats every this many world units; 0 stretches it once over the length." {
|
|
1746
|
+
min 0
|
|
1747
|
+
unit m
|
|
1748
|
+
}
|
|
1749
|
+
field blend StripBlend "Additive or alpha blended."
|
|
1750
|
+
field layered bool "Draw it in the 2D sprite order at `layer` (a sprite's trail over a tile background) instead of with the 3D scene."
|
|
1751
|
+
field layer i32 "With layered: the sprite layer it is drawn in, before that layer's sprites."
|
|
1752
|
+
}
|
|
1753
|
+
```
|
|
1754
|
+
|
|
1755
|
+
<sub>`api.ogt` line 2753</sub>
|
|
1756
|
+
|
|
1757
|
+
<a id="record-Beam"></a>
|
|
1758
|
+
|
|
1759
|
+
### `og.Beam` (component)
|
|
1760
|
+
|
|
1761
|
+
A strip from the entity's position to `end` whose texture scrolls with the tick: lasers, tethers, lightning (jitter).
|
|
1762
|
+
|
|
1763
|
+
Token `og.Beam`, registered under the schema name `og.Beam`; its value type is `Beam`.
|
|
1764
|
+
|
|
1765
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
1766
|
+
|---|---|---|---|---|---|---|
|
|
1767
|
+
| `end` | `Vector3` | `{ x: 0, y: 0, z: 0 }` | — | `m` | — | The far end, in world space. |
|
|
1768
|
+
| `width` | `number` | `0.1` | ≥ 0 | `m` | tunable | The beam's width. |
|
|
1769
|
+
| `color` | `Color` | `{ r: 1, g: 1, b: 1 }` | — | — | — | The linear colour; above 1 blooms. |
|
|
1770
|
+
| `opacity` | `number` | `1` | 0 … 1 | — | — | The alpha. |
|
|
1771
|
+
| `texture` | `Texture` | `0` | — | — | — | A texture along the beam; 0 is solid. |
|
|
1772
|
+
| `tile` | `number` | `1` | ≥ 0 | — | — | Texture repeats per world unit along the beam. |
|
|
1773
|
+
| `scroll` | `number` | `0` | — | — | tunable | Texture scroll in repeats per second. |
|
|
1774
|
+
| `segments` | `number` | `1` | 1 … 64 | — | — | Segments: 1 is straight, more let jitter bend it. |
|
|
1775
|
+
| `jitter` | `number` | `0` | ≥ 0 | `m` | — | Sideways jitter in world units, new every tick (lightning). |
|
|
1776
|
+
| `seed` | `number` | `0` | — | — | — | The jitter's seed. |
|
|
1777
|
+
| `blend` | `StripBlend` | `"additive"` | — | — | — | Additive or alpha blended. |
|
|
1778
|
+
|
|
1779
|
+
```ogt
|
|
1780
|
+
component Beam {
|
|
1781
|
+
doc "A strip from the entity's position to `end` whose texture scrolls with the tick: lasers, tethers, lightning (jitter)."
|
|
1782
|
+
field end Vector3 "The far end, in world space." {
|
|
1783
|
+
unit m
|
|
1784
|
+
}
|
|
1785
|
+
field width f32 "The beam's width." {
|
|
1786
|
+
default 0.1
|
|
1787
|
+
min 0
|
|
1788
|
+
unit m
|
|
1789
|
+
tunable true
|
|
1790
|
+
}
|
|
1791
|
+
field color Color "The linear colour; above 1 blooms." {
|
|
1792
|
+
default 1 1 1
|
|
1793
|
+
}
|
|
1794
|
+
field opacity f32 "The alpha." {
|
|
1795
|
+
default 1
|
|
1796
|
+
min 0
|
|
1797
|
+
max 1
|
|
1798
|
+
}
|
|
1799
|
+
field texture Texture "A texture along the beam; 0 is solid."
|
|
1800
|
+
field tile f32 "Texture repeats per world unit along the beam." {
|
|
1801
|
+
default 1
|
|
1802
|
+
min 0
|
|
1803
|
+
}
|
|
1804
|
+
field scroll f32 "Texture scroll in repeats per second." {
|
|
1805
|
+
tunable true
|
|
1806
|
+
}
|
|
1807
|
+
field segments u32 "Segments: 1 is straight, more let jitter bend it." {
|
|
1808
|
+
default 1
|
|
1809
|
+
min 1
|
|
1810
|
+
max 64
|
|
1811
|
+
}
|
|
1812
|
+
field jitter f32 "Sideways jitter in world units, new every tick (lightning)." {
|
|
1813
|
+
min 0
|
|
1814
|
+
unit m
|
|
1815
|
+
}
|
|
1816
|
+
field seed u32 "The jitter's seed."
|
|
1817
|
+
field blend StripBlend "Additive or alpha blended."
|
|
1818
|
+
}
|
|
1819
|
+
```
|
|
1820
|
+
|
|
1821
|
+
<sub>`api.ogt` line 2801</sub>
|
|
1822
|
+
|
|
1823
|
+
<a id="record-Sprite"></a>
|
|
1824
|
+
|
|
1825
|
+
### `og.Sprite` (component)
|
|
1826
|
+
|
|
1827
|
+
A sprite drawn every frame at the entity's MatrixWorld (its xy and z, its rotation about z; its scale multiplies width and height, so squash and stretch is a tween of og.Transform.scale). With an og.Flipbook on the entity, the texture (or an `array true` sheet's texture array layer), region and anchor come from the flipbook's current frame.
|
|
1828
|
+
|
|
1829
|
+
Sorted with the immediate sprites and text by layer, then (sortY) by y, then texture: one draw per run of one texture. Tile layers draw before the sprites of their layer.
|
|
1830
|
+
|
|
1831
|
+
Token `og.Sprite`, registered under the schema name `og.Sprite`; its value type is `Sprite`.
|
|
1832
|
+
|
|
1833
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
1834
|
+
|---|---|---|---|---|---|---|
|
|
1835
|
+
| `texture` | `Texture` | `0` | — | — | — | The texture (og.load.texture); 0 draws a solid quad of the colour. |
|
|
1836
|
+
| `array` | `TextureArray` | `0` | — | — | — | Draw from a layer of this texture array (og.load.textureArray) instead of `texture`; 0 uses `texture`. Every sprite of one array is one draw whichever layer each shows. While the array's streaming group is not resident the sprite draws nothing. |
|
|
1837
|
+
| `arrayLayer` | `number` | `0` | — | — | — | With `array`: the layer drawn (past the last layer, the last). uvMin and uvMax are the region within the layer; a nine-slice measures the layer. |
|
|
1838
|
+
| `width` | `number` | `1` | ≥ 0 | `m` | tunable | Its width in world units (times Transform.scale.x). |
|
|
1839
|
+
| `height` | `number` | `1` | ≥ 0 | `m` | tunable | Its height in world units (times Transform.scale.y). |
|
|
1840
|
+
| `anchor` | `Vector2` | `{ x: 0.5, y: 0.5 }` | — | — | — | The point of the quad at the entity's position, as a fraction from the bottom-left corner: (0.5, 0) stands it on its feet. A flipbook frame's pivot replaces it. |
|
|
1841
|
+
| `color` | `Color` | `{ r: 1, g: 1, b: 1 }` | — | — | — | A linear colour multiplied with the texture. |
|
|
1842
|
+
| `opacity` | `number` | `1` | 0 … 1 | — | tunable | The alpha. |
|
|
1843
|
+
| `uvMin` | `Vector2` | `{ x: 0, y: 0 }` | — | — | — | The texture region's top-left corner, v down. |
|
|
1844
|
+
| `uvMax` | `Vector2` | `{ x: 1, y: 1 }` | — | — | — | The texture region's bottom-right corner, v down. |
|
|
1845
|
+
| `layer` | `number` | `0` | — | — | — | Draw order among sprites, tiles and text; higher draws on top. |
|
|
1846
|
+
| `sortY` | `boolean` | `false` | — | — | — | Within its layer, lower y draws in front: top-down characters, props and trees overlap by their feet. |
|
|
1847
|
+
| `flipX` | `boolean` | `false` | — | — | — | Mirror left to right (a character facing left). |
|
|
1848
|
+
| `flipY` | `boolean` | `false` | — | — | — | Mirror top to bottom. |
|
|
1849
|
+
| `flash` | `number` | `0` | 0 … 1 | — | tunable | A hit flash: the colour mixed towards flashColor by this much (og.tween.flash fades it out). |
|
|
1850
|
+
| `flashColor` | `Color` | `{ r: 1, g: 1, b: 1 }` | — | — | — | The flash's linear colour. |
|
|
1851
|
+
| `glow` | `number` | `0` | ≥ 0 | — | — | Strength in the 2D glow buffer (PostEffects.glow); 0 none. |
|
|
1852
|
+
| `blend` | `SpriteBlend` | `"alpha"` | — | — | — | Alpha or additive. |
|
|
1853
|
+
| `castShadow` | `boolean` | `false` | — | — | — | Block 2D light (Lighting2D) with the sprite's rectangle. |
|
|
1854
|
+
| `sliceX` | `Vector2` | `{ x: 0, y: 0 }` | — | — | — | Nine-slice: the left and right insets in texture pixels of the region (0 0 with sliceY 0 0 draws it whole). World panels, health bars, speech bubbles. |
|
|
1855
|
+
| `sliceY` | `Vector2` | `{ x: 0, y: 0 }` | — | — | — | Nine-slice: the top and bottom insets in texture pixels. |
|
|
1856
|
+
| `sliceScale` | `number` | `0.0625` | ≥ 0 | — | — | Nine-slice: world units per texture pixel of the insets. |
|
|
1857
|
+
| `shadow` | `number` | `0` | 0 … 1 | — | tunable | A soft blob shadow on the ground under the sprite's anchor, this dark (0 none, 0.4 typical), drawn under every sprite of its layer. |
|
|
1858
|
+
| `shadowSize` | `Vector2` | `{ x: 0, y: 0 }` | ≥ 0 | `m` | — | The blob's width and height; 0 0 is 0.8 by 0.3 of the sprite's width. |
|
|
1859
|
+
| `shadowOffset` | `Vector2` | `{ x: 0, y: 0 }` | — | `m` | — | The blob's centre relative to the anchor. |
|
|
1860
|
+
| `dropShadow` | `number` | `0` | 0 … 1 | — | tunable | A drop shadow this dark (0 none, 0.5 typical): the sprite's shape flattened along the sun onto the ground under it (dropShadowHeight, or the og.Terrain there), faded where that ground already lies in the sun's shadow, drawn before every sprite of its layer (SpriteDesc.dropShadow): pixel sprites standing in a 3D set. |
|
|
1861
|
+
| `dropShadowHeight` | `number` | `0` | — | `m` | — | The height of the level ground the drop shadow lies on; where an og.Terrain under the anchor is higher, the terrain (SpriteDesc.dropShadowHeight). |
|
|
1862
|
+
| `toneMapped` | `boolean` | `true` | — | — | — | As three.js Material.toneMapped: false keeps the sprite's colours as given, outside exposure, bloom, fog and the tone curve, still placed and depth tested in the world (SpriteDesc.toneMapped): speech bubbles and markers that must not blow out at dusk. Alpha blending only. |
|
|
1863
|
+
| `visible` | `boolean` | `true` | — | — | — | Whether it is drawn. |
|
|
1864
|
+
|
|
1865
|
+
```ogt
|
|
1866
|
+
component Sprite {
|
|
1867
|
+
doc "A sprite drawn every frame at the entity's MatrixWorld (its xy and z, its rotation about z; its scale multiplies width and height, so squash and stretch is a tween of og.Transform.scale). With an og.Flipbook on the entity, the texture (or an `array true` sheet's texture array layer), region and anchor come from the flipbook's current frame."
|
|
1868
|
+
doc "Sorted with the immediate sprites and text by layer, then (sortY) by y, then texture: one draw per run of one texture. Tile layers draw before the sprites of their layer."
|
|
1869
|
+
field texture Texture "The texture (og.load.texture); 0 draws a solid quad of the colour."
|
|
1870
|
+
field array TextureArray "Draw from a layer of this texture array (og.load.textureArray) instead of `texture`; 0 uses `texture`. Every sprite of one array is one draw whichever layer each shows. While the array's streaming group is not resident the sprite draws nothing."
|
|
1871
|
+
field arrayLayer u32 "With `array`: the layer drawn (past the last layer, the last). uvMin and uvMax are the region within the layer; a nine-slice measures the layer."
|
|
1872
|
+
field width f32 "Its width in world units (times Transform.scale.x)." {
|
|
1873
|
+
default 1
|
|
1874
|
+
min 0
|
|
1875
|
+
unit m
|
|
1876
|
+
tunable true
|
|
1877
|
+
}
|
|
1878
|
+
field height f32 "Its height in world units (times Transform.scale.y)." {
|
|
1879
|
+
default 1
|
|
1880
|
+
min 0
|
|
1881
|
+
unit m
|
|
1882
|
+
tunable true
|
|
1883
|
+
}
|
|
1884
|
+
field anchor Vector2 "The point of the quad at the entity's position, as a fraction from the bottom-left corner: (0.5, 0) stands it on its feet. A flipbook frame's pivot replaces it." {
|
|
1885
|
+
default 0.5 0.5
|
|
1886
|
+
}
|
|
1887
|
+
field color Color "A linear colour multiplied with the texture." {
|
|
1888
|
+
default 1 1 1
|
|
1889
|
+
}
|
|
1890
|
+
field opacity f32 "The alpha." {
|
|
1891
|
+
default 1
|
|
1892
|
+
min 0
|
|
1893
|
+
max 1
|
|
1894
|
+
tunable true
|
|
1895
|
+
}
|
|
1896
|
+
field uvMin Vector2 "The texture region's top-left corner, v down."
|
|
1897
|
+
field uvMax Vector2 "The texture region's bottom-right corner, v down." {
|
|
1898
|
+
default 1 1
|
|
1899
|
+
}
|
|
1900
|
+
field layer i32 "Draw order among sprites, tiles and text; higher draws on top."
|
|
1901
|
+
field sortY bool "Within its layer, lower y draws in front: top-down characters, props and trees overlap by their feet."
|
|
1902
|
+
field flipX bool "Mirror left to right (a character facing left)."
|
|
1903
|
+
field flipY bool "Mirror top to bottom."
|
|
1904
|
+
field flash f32 "A hit flash: the colour mixed towards flashColor by this much (og.tween.flash fades it out)." {
|
|
1905
|
+
min 0
|
|
1906
|
+
max 1
|
|
1907
|
+
tunable true
|
|
1908
|
+
}
|
|
1909
|
+
field flashColor Color "The flash's linear colour." {
|
|
1910
|
+
default 1 1 1
|
|
1911
|
+
}
|
|
1912
|
+
field glow f32 "Strength in the 2D glow buffer (PostEffects.glow); 0 none." {
|
|
1913
|
+
min 0
|
|
1914
|
+
}
|
|
1915
|
+
field blend SpriteBlend "Alpha or additive."
|
|
1916
|
+
field castShadow bool "Block 2D light (Lighting2D) with the sprite's rectangle."
|
|
1917
|
+
field sliceX Vector2 "Nine-slice: the left and right insets in texture pixels of the region (0 0 with sliceY 0 0 draws it whole). World panels, health bars, speech bubbles."
|
|
1918
|
+
field sliceY Vector2 "Nine-slice: the top and bottom insets in texture pixels."
|
|
1919
|
+
field sliceScale f32 "Nine-slice: world units per texture pixel of the insets." {
|
|
1920
|
+
default 0.0625
|
|
1921
|
+
min 0
|
|
1922
|
+
}
|
|
1923
|
+
field shadow f32 "A soft blob shadow on the ground under the sprite's anchor, this dark (0 none, 0.4 typical), drawn under every sprite of its layer." {
|
|
1924
|
+
min 0
|
|
1925
|
+
max 1
|
|
1926
|
+
tunable true
|
|
1927
|
+
}
|
|
1928
|
+
field shadowSize Vector2 "The blob's width and height; 0 0 is 0.8 by 0.3 of the sprite's width." {
|
|
1929
|
+
min 0
|
|
1930
|
+
unit m
|
|
1931
|
+
}
|
|
1932
|
+
field shadowOffset Vector2 "The blob's centre relative to the anchor." {
|
|
1933
|
+
unit m
|
|
1934
|
+
}
|
|
1935
|
+
field dropShadow f32 "A drop shadow this dark (0 none, 0.5 typical): the sprite's shape flattened along the sun onto the ground under it (dropShadowHeight, or the og.Terrain there), faded where that ground already lies in the sun's shadow, drawn before every sprite of its layer (SpriteDesc.dropShadow): pixel sprites standing in a 3D set." {
|
|
1936
|
+
min 0
|
|
1937
|
+
max 1
|
|
1938
|
+
tunable true
|
|
1939
|
+
}
|
|
1940
|
+
field dropShadowHeight f32 "The height of the level ground the drop shadow lies on; where an og.Terrain under the anchor is higher, the terrain (SpriteDesc.dropShadowHeight)." {
|
|
1941
|
+
unit m
|
|
1942
|
+
}
|
|
1943
|
+
field toneMapped bool "As three.js Material.toneMapped: false keeps the sprite's colours as given, outside exposure, bloom, fog and the tone curve, still placed and depth tested in the world (SpriteDesc.toneMapped): speech bubbles and markers that must not blow out at dusk. Alpha blending only." {
|
|
1944
|
+
default true
|
|
1945
|
+
}
|
|
1946
|
+
field visible bool "Whether it is drawn." {
|
|
1947
|
+
default true
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
```
|
|
1951
|
+
|
|
1952
|
+
<sub>`api.ogt` line 3009</sub>
|
|
1953
|
+
|
|
1954
|
+
<a id="record-Afterimage"></a>
|
|
1955
|
+
|
|
1956
|
+
### `og.Afterimage` (component)
|
|
1957
|
+
|
|
1958
|
+
Ghosts of the entity's og.Sprite: every `interval` ticks its pose (position, rotation, scale, frame, flips) is kept, and the last `count` are drawn behind it, fading from `opacity` to 0, tinted by color. A dash, a speed-up, a teleport. The history is world state (the og.sprite state block).
|
|
1959
|
+
|
|
1960
|
+
Token `og.Afterimage`, registered under the schema name `og.Afterimage`; its value type is `Afterimage`.
|
|
1961
|
+
|
|
1962
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
1963
|
+
|---|---|---|---|---|---|---|
|
|
1964
|
+
| `count` | `number` | `4` | 0 … 16 | — | — | How many ghosts. |
|
|
1965
|
+
| `interval` | `number` | `3` | ≥ 1 | `ticks` | — | Ticks between ghosts. |
|
|
1966
|
+
| `opacity` | `number` | `0.5` | 0 … 1 | — | tunable | The newest ghost's alpha. |
|
|
1967
|
+
| `color` | `Color` | `{ r: 1, g: 1, b: 1 }` | — | — | — | A linear tint (above 1 with additive, a glow). |
|
|
1968
|
+
| `additive` | `boolean` | `false` | — | — | — | Add the ghosts instead of blending them. |
|
|
1969
|
+
| `active` | `boolean` | `true` | — | — | — | Record new ghosts; false lets the existing ones fade out. |
|
|
1970
|
+
|
|
1971
|
+
```ogt
|
|
1972
|
+
component Afterimage {
|
|
1973
|
+
doc "Ghosts of the entity's og.Sprite: every `interval` ticks its pose (position, rotation, scale, frame, flips) is kept, and the last `count` are drawn behind it, fading from `opacity` to 0, tinted by color. A dash, a speed-up, a teleport. The history is world state (the og.sprite state block)."
|
|
1974
|
+
field count u32 "How many ghosts." {
|
|
1975
|
+
default 4
|
|
1976
|
+
min 0
|
|
1977
|
+
max 16
|
|
1978
|
+
}
|
|
1979
|
+
field interval u32 "Ticks between ghosts." {
|
|
1980
|
+
default 3
|
|
1981
|
+
min 1
|
|
1982
|
+
unit ticks
|
|
1983
|
+
}
|
|
1984
|
+
field opacity f32 "The newest ghost's alpha." {
|
|
1985
|
+
default 0.5
|
|
1986
|
+
min 0
|
|
1987
|
+
max 1
|
|
1988
|
+
tunable true
|
|
1989
|
+
}
|
|
1990
|
+
field color Color "A linear tint (above 1 with additive, a glow)." {
|
|
1991
|
+
default 1 1 1
|
|
1992
|
+
}
|
|
1993
|
+
field additive bool "Add the ghosts instead of blending them."
|
|
1994
|
+
field active bool "Record new ghosts; false lets the existing ones fade out." {
|
|
1995
|
+
default true
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
```
|
|
1999
|
+
|
|
2000
|
+
<sub>`api.ogt` line 3094</sub>
|
|
2001
|
+
|
|
2002
|
+
## Types
|
|
2003
|
+
|
|
2004
|
+
<a id="type-Geometry"></a>
|
|
2005
|
+
|
|
2006
|
+
### `Geometry` (handle)
|
|
2007
|
+
|
|
2008
|
+
Vertex and index data, as three.js BufferGeometry. Comes from a loaded glTF.
|
|
2009
|
+
|
|
2010
|
+
A generational handle: a number the engine hands out. A dead handle is an error value, never a crash.
|
|
2011
|
+
|
|
2012
|
+
```ogt
|
|
2013
|
+
handle Geometry "Vertex and index data, as three.js BufferGeometry. Comes from a loaded glTF."
|
|
2014
|
+
```
|
|
2015
|
+
|
|
2016
|
+
<sub>`api.ogt` line 1653</sub>
|
|
2017
|
+
|
|
2018
|
+
<a id="type-Material"></a>
|
|
2019
|
+
|
|
2020
|
+
### `Material` (handle)
|
|
2021
|
+
|
|
2022
|
+
A material instance.
|
|
2023
|
+
|
|
2024
|
+
A generational handle: a number the engine hands out. A dead handle is an error value, never a crash.
|
|
2025
|
+
|
|
2026
|
+
```ogt
|
|
2027
|
+
handle Material "A material instance."
|
|
2028
|
+
```
|
|
2029
|
+
|
|
2030
|
+
<sub>`api.ogt` line 1654</sub>
|
|
2031
|
+
|
|
2032
|
+
<a id="type-Texture"></a>
|
|
2033
|
+
|
|
2034
|
+
### `Texture` (handle)
|
|
2035
|
+
|
|
2036
|
+
A cooked texture.
|
|
2037
|
+
|
|
2038
|
+
A generational handle: a number the engine hands out. A dead handle is an error value, never a crash.
|
|
2039
|
+
|
|
2040
|
+
```ogt
|
|
2041
|
+
handle Texture "A cooked texture."
|
|
2042
|
+
```
|
|
2043
|
+
|
|
2044
|
+
<sub>`api.ogt` line 1655</sub>
|
|
2045
|
+
|
|
2046
|
+
<a id="type-Side"></a>
|
|
2047
|
+
|
|
2048
|
+
### `Side` (enum)
|
|
2049
|
+
|
|
2050
|
+
Which faces are drawn, as three.js FrontSide, BackSide and DoubleSide.
|
|
2051
|
+
|
|
2052
|
+
A string: one of the variants below. The zero value is `"front"`.
|
|
2053
|
+
|
|
2054
|
+
| Variant | Doc |
|
|
2055
|
+
|---|---|
|
|
2056
|
+
| `"front"` | Front faces only. |
|
|
2057
|
+
| `"back"` | Back faces only. |
|
|
2058
|
+
| `"double"` | Both. |
|
|
2059
|
+
|
|
2060
|
+
```ogt
|
|
2061
|
+
enum Side {
|
|
2062
|
+
doc "Which faces are drawn, as three.js FrontSide, BackSide and DoubleSide."
|
|
2063
|
+
variant front "Front faces only."
|
|
2064
|
+
variant back "Back faces only."
|
|
2065
|
+
variant double "Both."
|
|
2066
|
+
}
|
|
2067
|
+
```
|
|
2068
|
+
|
|
2069
|
+
<sub>`api.ogt` line 1671</sub>
|
|
2070
|
+
|
|
2071
|
+
<a id="type-RenderTier"></a>
|
|
2072
|
+
|
|
2073
|
+
### `RenderTier` (enum)
|
|
2074
|
+
|
|
2075
|
+
The backend the renderer runs on; the probe's hello reports it.
|
|
2076
|
+
|
|
2077
|
+
A string: one of the variants below. The zero value is `"webgpu"`.
|
|
2078
|
+
|
|
2079
|
+
| Variant | Doc |
|
|
2080
|
+
|---|---|
|
|
2081
|
+
| `"webgpu"` | WebGPU in a browser: the full feature set. |
|
|
2082
|
+
| `"webgl2"` | The WebGL2 fallback: no compute, CPU culling and particles, tiled lights. |
|
|
2083
|
+
| `"vulkan"` | Native Vulkan on a GPU. |
|
|
2084
|
+
| `"vulkan-cpu"` | Native Vulkan on a CPU rasterizer (Mesa lavapipe or llvmpipe, SwiftShader): the executors' sandboxes. Frame times there say nothing about a player's GPU. |
|
|
2085
|
+
| `"metal"` | Native Metal. |
|
|
2086
|
+
| `"none"` | No renderer (a sandbox without a GPU; natively also OG_RENDERER=none): the simulation, the dumps and the world hash are the same as with one, a screenshot step writes no PNG and reports its frame unchecked, and capture answers null. |
|
|
2087
|
+
|
|
2088
|
+
```ogt
|
|
2089
|
+
enum RenderTier {
|
|
2090
|
+
doc "The backend the renderer runs on; the probe's hello reports it."
|
|
2091
|
+
variant webgpu "WebGPU in a browser: the full feature set."
|
|
2092
|
+
variant webgl2 "The WebGL2 fallback: no compute, CPU culling and particles, tiled lights."
|
|
2093
|
+
variant vulkan "Native Vulkan on a GPU."
|
|
2094
|
+
variant vulkan-cpu "Native Vulkan on a CPU rasterizer (Mesa lavapipe or llvmpipe, SwiftShader): the executors' sandboxes. Frame times there say nothing about a player's GPU."
|
|
2095
|
+
variant metal "Native Metal."
|
|
2096
|
+
variant none "No renderer (a sandbox without a GPU; natively also OG_RENDERER=none): the simulation, the dumps and the world hash are the same as with one, a screenshot step writes no PNG and reports its frame unchecked, and capture answers null."
|
|
2097
|
+
}
|
|
2098
|
+
```
|
|
2099
|
+
|
|
2100
|
+
<sub>`api.ogt` line 1678</sub>
|
|
2101
|
+
|
|
2102
|
+
<a id="type-Antialias"></a>
|
|
2103
|
+
|
|
2104
|
+
### `Antialias` (enum)
|
|
2105
|
+
|
|
2106
|
+
Antialiasing, as og-render's Antialias. RenderCapabilities.antialias reports what the device resolved.
|
|
2107
|
+
|
|
2108
|
+
A string: one of the variants below. The zero value is `"tier"`.
|
|
2109
|
+
|
|
2110
|
+
| Variant | Doc |
|
|
2111
|
+
|---|---|
|
|
2112
|
+
| `"tier"` | The tier's method: TAA on the full tier (WebGPU, Metal, Vulkan), 4x MSAA on WebGL2, FXAA where the HDR format cannot be multisampled. |
|
|
2113
|
+
| `"off"` | One sample per pixel. |
|
|
2114
|
+
| `"msaa4"` | 4x MSAA on any tier: sharp sprites and text, no temporal blur; FXAA where the HDR format cannot be multisampled. |
|
|
2115
|
+
| `"taa"` | Temporal antialiasing on any tier: a sub-pixel jitter per frame and a reprojected history; converges over about eight frames. RenderOptions.taaHistory and taaSharpen refine it. |
|
|
2116
|
+
| `"fxaa"` | FXAA on any tier: one full-screen pass over the tonemapped image (the overlay stays sharp), no extra samples and nothing to converge; softer than MSAA on fine texture. |
|
|
2117
|
+
|
|
2118
|
+
```ogt
|
|
2119
|
+
enum Antialias {
|
|
2120
|
+
doc "Antialiasing, as og-render's Antialias. RenderCapabilities.antialias reports what the device resolved."
|
|
2121
|
+
variant tier "The tier's method: TAA on the full tier (WebGPU, Metal, Vulkan), 4x MSAA on WebGL2, FXAA where the HDR format cannot be multisampled."
|
|
2122
|
+
variant off "One sample per pixel."
|
|
2123
|
+
variant msaa4 "4x MSAA on any tier: sharp sprites and text, no temporal blur; FXAA where the HDR format cannot be multisampled."
|
|
2124
|
+
variant taa "Temporal antialiasing on any tier: a sub-pixel jitter per frame and a reprojected history; converges over about eight frames. RenderOptions.taaHistory and taaSharpen refine it."
|
|
2125
|
+
variant fxaa "FXAA on any tier: one full-screen pass over the tonemapped image (the overlay stays sharp), no extra samples and nothing to converge; softer than MSAA on fine texture."
|
|
2126
|
+
}
|
|
2127
|
+
```
|
|
2128
|
+
|
|
2129
|
+
<sub>`api.ogt` line 1688</sub>
|
|
2130
|
+
|
|
2131
|
+
<a id="type-PointShadows"></a>
|
|
2132
|
+
|
|
2133
|
+
### `PointShadows` (enum)
|
|
2134
|
+
|
|
2135
|
+
How a point light's shadow map is stored, as og-render's PointShadows. RenderCapabilities.pointShadows reports what the device resolved.
|
|
2136
|
+
|
|
2137
|
+
A string: one of the variants below. The zero value is `"auto"`.
|
|
2138
|
+
|
|
2139
|
+
| Variant | Doc |
|
|
2140
|
+
|---|---|
|
|
2141
|
+
| `"auto"` | Cube faces on the full tier, paraboloids on WebGL2. |
|
|
2142
|
+
| `"cube"` | Six 90 degree faces: six shadow passes per light. |
|
|
2143
|
+
| `"paraboloid"` | Two paraboloid hemispheres (below and above the light): two passes per light instead of six, coarser, and large casters' silhouettes approximate (their edges stay straight in the curved projection). |
|
|
2144
|
+
|
|
2145
|
+
```ogt
|
|
2146
|
+
enum PointShadows {
|
|
2147
|
+
doc "How a point light's shadow map is stored, as og-render's PointShadows. RenderCapabilities.pointShadows reports what the device resolved."
|
|
2148
|
+
variant auto "Cube faces on the full tier, paraboloids on WebGL2."
|
|
2149
|
+
variant cube "Six 90 degree faces: six shadow passes per light."
|
|
2150
|
+
variant paraboloid "Two paraboloid hemispheres (below and above the light): two passes per light instead of six, coarser, and large casters' silhouettes approximate (their edges stay straight in the curved projection)."
|
|
2151
|
+
}
|
|
2152
|
+
```
|
|
2153
|
+
|
|
2154
|
+
<sub>`api.ogt` line 1697</sub>
|
|
2155
|
+
|
|
2156
|
+
<a id="type-TaaHistory"></a>
|
|
2157
|
+
|
|
2158
|
+
### `TaaHistory` (enum)
|
|
2159
|
+
|
|
2160
|
+
How TAA resamples its history each frame, as og-render's TaaHistory.
|
|
2161
|
+
|
|
2162
|
+
A string: one of the variants below. The zero value is `"bilinear"`.
|
|
2163
|
+
|
|
2164
|
+
| Variant | Doc |
|
|
2165
|
+
|---|---|
|
|
2166
|
+
| `"bilinear"` | One bilinear tap: cheap, slightly soft while the camera moves. |
|
|
2167
|
+
| `"catmullRom"` | A Catmull-Rom filter over 4x4 texels (9 taps): the history stays sharp under camera motion. |
|
|
2168
|
+
|
|
2169
|
+
```ogt
|
|
2170
|
+
enum TaaHistory {
|
|
2171
|
+
doc "How TAA resamples its history each frame, as og-render's TaaHistory."
|
|
2172
|
+
variant bilinear "One bilinear tap: cheap, slightly soft while the camera moves."
|
|
2173
|
+
variant catmullRom "A Catmull-Rom filter over 4x4 texels (9 taps): the history stays sharp under camera motion."
|
|
2174
|
+
}
|
|
2175
|
+
```
|
|
2176
|
+
|
|
2177
|
+
<sub>`api.ogt` line 1704</sub>
|
|
2178
|
+
|
|
2179
|
+
<a id="type-RenderOptions"></a>
|
|
2180
|
+
|
|
2181
|
+
### `RenderOptions` (desc struct)
|
|
2182
|
+
|
|
2183
|
+
How the renderer is created for a game (GameDesc.render). The host reads it once, when it attaches the renderer.
|
|
2184
|
+
|
|
2185
|
+
A desc: every field may be omitted and takes its default; `{}` is valid.
|
|
2186
|
+
|
|
2187
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
2188
|
+
|---|---|---|---|---|---|---|
|
|
2189
|
+
| `antialias` | `Antialias` | `"tier"` | — | — | — | The antialiasing method. |
|
|
2190
|
+
| `shadowMapSize` | `number` | `2048` | 256 … 4096 | — | — | The side of each of the directional light's three cascade maps, in texels; smaller saves memory on phones (three 2048 maps are 64 MB). |
|
|
2191
|
+
| `pointShadows` | `PointShadows` | `"auto"` | — | — | — | How point lights' shadows are stored: cube faces, or two paraboloid hemispheres (fewer passes, coarser). |
|
|
2192
|
+
| `taaHistory` | `TaaHistory` | `"bilinear"` | — | — | — | With TAA: how the history is resampled. |
|
|
2193
|
+
| `taaSharpen` | `number` | `0` | 0 … 1 | `ratio` | — | With TAA: a sharpening pass after it, 0 (none) to 1; it never pushes a pixel past its neighbours' range. |
|
|
2194
|
+
|
|
2195
|
+
```ogt
|
|
2196
|
+
struct RenderOptions {
|
|
2197
|
+
doc "How the renderer is created for a game (GameDesc.render). The host reads it once, when it attaches the renderer."
|
|
2198
|
+
desc true
|
|
2199
|
+
field antialias Antialias "The antialiasing method."
|
|
2200
|
+
field shadowMapSize u32 "The side of each of the directional light's three cascade maps, in texels; smaller saves memory on phones (three 2048 maps are 64 MB)." {
|
|
2201
|
+
default 2048
|
|
2202
|
+
min 256
|
|
2203
|
+
max 4096
|
|
2204
|
+
}
|
|
2205
|
+
field pointShadows PointShadows "How point lights' shadows are stored: cube faces, or two paraboloid hemispheres (fewer passes, coarser)."
|
|
2206
|
+
field taaHistory TaaHistory "With TAA: how the history is resampled."
|
|
2207
|
+
field taaSharpen f32 "With TAA: a sharpening pass after it, 0 (none) to 1; it never pushes a pixel past its neighbours' range." {
|
|
2208
|
+
min 0
|
|
2209
|
+
max 1
|
|
2210
|
+
unit ratio
|
|
2211
|
+
}
|
|
2212
|
+
}
|
|
2213
|
+
```
|
|
2214
|
+
|
|
2215
|
+
<sub>`api.ogt` line 1710</sub>
|
|
2216
|
+
|
|
2217
|
+
<a id="type-StandardMaterialDesc"></a>
|
|
2218
|
+
|
|
2219
|
+
### `StandardMaterialDesc` (desc struct)
|
|
2220
|
+
|
|
2221
|
+
A physically based metallic-roughness material with three.js MeshStandardMaterial parameter names.
|
|
2222
|
+
|
|
2223
|
+
It is og-render's reflected StandardMaterial field for field: metalnessMap and roughnessMap read a glTF metallic-roughness texture (blue metal, green rough), so give both the same texture; alphaTest above 0 discards below that alpha; transparent blends, sorted back to front.
|
|
2224
|
+
|
|
2225
|
+
The stylised fields: unlit (three.js MeshBasicMaterial), toon with its gradientMap ramp, a rim (fresnel) light, a hit flash, dissolve with a glowing edge, and a per-material outline. All are off at their defaults. og.MaterialStyle fills the ones a material leaves at their defaults unless the material sets styled false.
|
|
2226
|
+
|
|
2227
|
+
The MeshPhysicalMaterial fields, under three.js's names and glTF's KHR_materials_* meanings, all off at their defaults: clearcoat with clearcoatMap, clearcoatRoughnessMap and clearcoatNormalMap; sheen (velvet, cloth) with sheenColor, sheenRoughness and their maps; transmission (glass, water) refracting the opaque scene behind through thickness, attenuationColor and ior; iridescence (soap film, oil) with its film's iridescenceIOR and iridescenceThicknessRange; anisotropy (brushed metal) along anisotropyRotation or anisotropyMap. They draw on every tier, WebGL2 included; unlit and toon materials ignore them.
|
|
2228
|
+
|
|
2229
|
+
A transmissive material is drawn after the opaque scene, back to front with the transparent ones, and refracts what was drawn before it (not other transmissive or transparent objects); thickness is in the mesh's own units, scaled with it.
|
|
2230
|
+
|
|
2231
|
+
normalMap is read in glTF's tangent frame: red tilts towards +u, green up the image. The tangents come from the model (the cook generates MikkTSpace ones where a glTF has none) or are generated when the geometry is made; normals follow a non-uniform scale correctly.
|
|
2232
|
+
|
|
2233
|
+
A desc: every field may be omitted and takes its default; `{}` is valid.
|
|
2234
|
+
|
|
2235
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
2236
|
+
|---|---|---|---|---|---|---|
|
|
2237
|
+
| `color` | `Color` | `{ r: 1, g: 1, b: 1 }` | — | — | — | The base colour. |
|
|
2238
|
+
| `map` | `Texture \| null` | `null` | — | — | — | The base colour texture. |
|
|
2239
|
+
| `metalness` | `number` | `0` | 0 … 1 | — | — | How metallic the surface is. |
|
|
2240
|
+
| `metalnessMap` | `Texture \| null` | `null` | — | — | — | Metalness from the texture's blue channel. |
|
|
2241
|
+
| `roughness` | `number` | `1` | 0 … 1 | — | — | How rough the surface is. |
|
|
2242
|
+
| `roughnessMap` | `Texture \| null` | `null` | — | — | — | Roughness from the texture's green channel. |
|
|
2243
|
+
| `normalMap` | `Texture \| null` | `null` | — | — | — | A tangent-space normal map. |
|
|
2244
|
+
| `aoMap` | `Texture \| null` | `null` | — | — | — | Ambient occlusion from the texture's red channel. |
|
|
2245
|
+
| `emissive` | `Color` | `{ r: 0, g: 0, b: 0 }` | — | — | — | The emitted colour. |
|
|
2246
|
+
| `emissiveIntensity` | `number` | `1` | ≥ 0 | — | — | A multiplier on the emitted colour. |
|
|
2247
|
+
| `emissiveMap` | `Texture \| null` | `null` | — | — | — | The emitted colour texture. |
|
|
2248
|
+
| `opacity` | `number` | `1` | 0 … 1 | — | — | The opacity; below 1 only with transparent. |
|
|
2249
|
+
| `transparent` | `boolean` | `false` | — | — | — | Blend instead of writing opaque pixels. |
|
|
2250
|
+
| `alphaTest` | `number` | `0` | 0 … 1 | — | — | Discard pixels whose alpha is below this. |
|
|
2251
|
+
| `side` | `Side` | `"front"` | — | — | — | Which faces are drawn. |
|
|
2252
|
+
| `flatShading` | `boolean` | `false` | — | — | — | Shade with face normals. |
|
|
2253
|
+
| `envMapIntensity` | `number` | `1` | ≥ 0 | — | — | A multiplier on image-based lighting. |
|
|
2254
|
+
| `normalScale` | `Vector2` | `{ x: 1, y: 1 }` | — | — | — | How strongly the normal map bends the normal, per tangent axis. |
|
|
2255
|
+
| `aoMapIntensity` | `number` | `1` | ≥ 0 | — | — | How strongly aoMap darkens the ambient light. |
|
|
2256
|
+
| `unlit` | `boolean` | `false` | — | — | — | No lighting at all, as three.js MeshBasicMaterial: the colour (times map) plus emissive. |
|
|
2257
|
+
| `toon` | `boolean` | `false` | — | — | — | Cel shading, as three.js MeshToonMaterial: light is quantized by gradientMap (three built-in bands without one), highlights are hard. |
|
|
2258
|
+
| `gradientMap` | `Texture \| null` | `null` | — | — | — | The toon ramp: a texture whose first row maps the light's angle (left dark, right lit) to the light received, read without filtering. |
|
|
2259
|
+
| `rimColor` | `Color` | `{ r: 1, g: 1, b: 1 }` | — | — | — | Rim (fresnel) light added at grazing angles, unshadowed (linear). |
|
|
2260
|
+
| `rimIntensity` | `number` | `0` | ≥ 0 | — | — | The rim light's strength; 0 is none. |
|
|
2261
|
+
| `rimPower` | `number` | `3` | ≥ 0.1 | — | — | How tight the rim is (higher: thinner). |
|
|
2262
|
+
| `flashColor` | `Color` | `{ r: 1, g: 1, b: 1 }` | — | — | — | The colour a hit flash mixes towards (linear, may exceed 1). |
|
|
2263
|
+
| `flash` | `number` | `0` | 0 … 1 | — | — | How far the final colour is mixed towards flashColor (0 none, 1 flat): animate it per tick for a hit flash. |
|
|
2264
|
+
| `dissolve` | `number` | `0` | 0 … 1 | — | — | The dissolved fraction: 0 whole, 1 gone. Pixels whose noise is below it are discarded (shadows too); the band just above glows with dissolveEdgeColor. |
|
|
2265
|
+
| `dissolveMap` | `Texture \| null` | `null` | — | — | — | The dissolve noise from the texture's red channel; without one, value noise over the object-space position. |
|
|
2266
|
+
| `dissolveEdgeColor` | `Color` | `{ r: 4, g: 1.5, b: 0.375 }` | — | — | — | The glowing edge (linear, usually above 1 so it blooms). |
|
|
2267
|
+
| `dissolveEdgeWidth` | `number` | `0.0625` | 0 … 1 | — | — | The width of the glowing band in noise units. |
|
|
2268
|
+
| `dissolveScale` | `number` | `4` | ≥ 0 | — | — | The frequency of the built-in noise (cells per object-space unit). |
|
|
2269
|
+
| `outlineColor` | `Color` | `{ r: 0, g: 0, b: 0 }` | — | — | — | This material's outline colour (linear). |
|
|
2270
|
+
| `outlineWidth` | `number` | `0` | 0 … 31 | — | — | This material's outline width in pixels; 0 is none (PostEffects.outline outlines everything). A hull outline, as toon shading draws one: the object's silhouette, where one part of it passes in front of another, and its creases against other objects (where it meets the ground or a wall), never the edges between its own faces, so a .vox model or any flat-shaded, hard-edged mesh keeps clean faces inside its silhouette; a face seen at a grazing angle (a box's side nearly edge-on, a large ground plane) is not lined across, only where it ends. Creases inside an object are Stylise.inkDepth's. |
|
|
2271
|
+
| `styled` | `boolean` | `true` | — | — | — | Whether og.MaterialStyle (a look's scene-wide toon, rim, outline, flat facets, shadow tint and outline distance) reaches this material. false keeps it exactly as declared under any look: a lantern's lacquer, a UI-like prop, a hero kept photographic in a toon scene. A material with a MeshPhysicalMaterial lobe (clearcoat, sheen, transmission, iridescence, anisotropy, an ior other than 1.5) keeps its physical shading under the style's toon even when styled (toon would drop those lobes) and takes the rest of the style; its own toon true still makes it toon. |
|
|
2272
|
+
| `clearcoat` | `number` | `0` | 0 … 1 | `ratio` | — | A clear lacquer over the surface, as three.js MeshPhysicalMaterial.clearcoat: a second, 4 % reflective specular layer on the surface's normal before normalMap (car paint, varnished wood, wet plastic); 0 is none. |
|
|
2273
|
+
| `clearcoatRoughness` | `number` | `0` | 0 … 1 | `ratio` | — | How rough the clear coat is, as three.js MeshPhysicalMaterial.clearcoatRoughness. |
|
|
2274
|
+
| `clearcoatMap` | `Texture \| null` | `null` | — | — | — | The coat's strength from the texture's red channel, times clearcoat (MeshPhysicalMaterial.clearcoatMap). |
|
|
2275
|
+
| `clearcoatRoughnessMap` | `Texture \| null` | `null` | — | — | — | The coat's roughness from the texture's green channel, times clearcoatRoughness. |
|
|
2276
|
+
| `clearcoatNormalMap` | `Texture \| null` | `null` | — | — | — | A tangent-space normal map of the coat alone; the base keeps normalMap (MeshPhysicalMaterial.clearcoatNormalMap). |
|
|
2277
|
+
| `clearcoatNormalScale` | `Vector2` | `{ x: 1, y: 1 }` | — | — | — | How strongly clearcoatNormalMap bends the coat's normal, per tangent axis. |
|
|
2278
|
+
| `sheen` | `number` | `0` | 0 … 1 | `ratio` | — | A velvet-like layer that brightens grazing angles (cloth, fuzz, peach skin), as MeshPhysicalMaterial.sheen: its strength, times sheenColor; 0 is none. |
|
|
2279
|
+
| `sheenColor` | `Color` | `{ r: 0, g: 0, b: 0 }` | — | — | — | The sheen's colour (linear), times sheenColorMap; black is none. |
|
|
2280
|
+
| `sheenRoughness` | `number` | `1` | 0 … 1 | `ratio` | — | How rough the sheen is: low keeps it to a thin rim, high spreads it over the surface. |
|
|
2281
|
+
| `sheenColorMap` | `Texture \| null` | `null` | — | — | — | The sheen's colour from the texture's RGB (sRGB). |
|
|
2282
|
+
| `sheenRoughnessMap` | `Texture \| null` | `null` | — | — | — | The sheen's roughness from the texture's alpha channel. |
|
|
2283
|
+
| `transmission` | `number` | `0` | 0 … 1 | `ratio` | — | How much light passes through, as MeshPhysicalMaterial.transmission (glass, water, thin plastic): the opaque scene behind is refracted and blurred by roughness; 0 is none. Unlike opacity, the surface keeps its reflections. |
|
|
2284
|
+
| `transmissionMap` | `Texture \| null` | `null` | — | — | — | Transmission from the texture's red channel. |
|
|
2285
|
+
| `thickness` | `number` | `0` | ≥ 0 | — | — | The volume's thickness under the surface in the mesh's own units (glTF KHR_materials_volume): how far refraction bends the view and how much attenuationColor absorbs; 0 is a thin wall. |
|
|
2286
|
+
| `thicknessMap` | `Texture \| null` | `null` | — | — | — | Thickness from the texture's green channel. |
|
|
2287
|
+
| `attenuationDistance` | `number` | `0` | ≥ 0 | — | — | The distance light travels in the volume before it is tinted to attenuationColor (world units); 0 is no absorption, three.js's Infinity. |
|
|
2288
|
+
| `attenuationColor` | `Color` | `{ r: 1, g: 1, b: 1 }` | — | — | — | The colour white light becomes after attenuationDistance in the volume (linear). |
|
|
2289
|
+
| `ior` | `number` | `1.5` | 1 … 2.333 | — | — | The index of refraction (glTF KHR_materials_ior): the reflectance of a dielectric, ((ior - 1) / (ior + 1))^2 (4 % at 1.5), and how far transmission refracts. |
|
|
2290
|
+
| `iridescence` | `number` | `0` | 0 … 1 | `ratio` | — | A thin-film interference layer, as MeshPhysicalMaterial.iridescence (soap bubbles, oil, beetle shells); 0 is none. |
|
|
2291
|
+
| `iridescenceIOR` | `number` | `1.3` | 1 … 2.333 | — | — | The film's index of refraction. |
|
|
2292
|
+
| `iridescenceThicknessRange` | `Vector2` | `{ x: 100, y: 400 }` | — | — | — | The film's thickness in nanometres: x where iridescenceThicknessMap is black, y where it is white and everywhere without the map (three.js's [100, 400]). |
|
|
2293
|
+
| `iridescenceMap` | `Texture \| null` | `null` | — | — | — | Iridescence from the texture's red channel. |
|
|
2294
|
+
| `iridescenceThicknessMap` | `Texture \| null` | `null` | — | — | — | The film's thickness between iridescenceThicknessRange's ends from the texture's green channel. |
|
|
2295
|
+
| `anisotropy` | `number` | `0` | 0 … 1 | `ratio` | — | Stretches the specular highlight along a direction of the surface, as MeshPhysicalMaterial.anisotropy (brushed metal, hair, satin); 0 is none, 1 fully stretched. Needs the geometry's tangents (generated when it has none). |
|
|
2296
|
+
| `anisotropyRotation` | `number` | `0` | — | — | — | The stretch's direction in radians from the tangent (+u) towards the bitangent. |
|
|
2297
|
+
| `anisotropyMap` | `Texture \| null` | `null` | — | — | — | The stretch's direction in red and green (-1 to 1 in the tangent frame, turned by anisotropyRotation) and its strength in blue, times anisotropy. |
|
|
2298
|
+
| `mapArray` | `TextureArray \| null` | `null` | — | — | — | The base colour from layer mapLayer of a texture array (og.load.textureArray) instead of map: variants of one look (tiles, skins, damage states) are one material, each Mesh picking its layer with Mesh.materialLayer, and every mesh of the material is one draw whichever layer it shows. A material with mapArray or normalMapArray reads its base colour and normal map from arrays only (map and normalMap are not read); it draws on every tier, WebGL2 included. Physical materials (the MeshPhysicalMaterial fields) and shader materials do not take arrays. |
|
|
2299
|
+
| `mapLayer` | `number` | `0` | — | — | — | The layer of mapArray drawn where the Mesh does not pick one (past the array's last layer: the last). |
|
|
2300
|
+
| `normalMapArray` | `TextureArray \| null` | `null` | — | — | — | A tangent-space normal map from layer normalMapLayer of a texture array (linear: cook it with `kind normal`), the counterpart of mapArray. |
|
|
2301
|
+
| `normalMapLayer` | `number` | `0` | — | — | — | The layer of normalMapArray read where the Mesh does not pick one. |
|
|
2302
|
+
|
|
2303
|
+
```ogt
|
|
2304
|
+
struct StandardMaterialDesc {
|
|
2305
|
+
doc "A physically based metallic-roughness material with three.js MeshStandardMaterial parameter names."
|
|
2306
|
+
doc "It is og-render's reflected StandardMaterial field for field: metalnessMap and roughnessMap read a glTF metallic-roughness texture (blue metal, green rough), so give both the same texture; alphaTest above 0 discards below that alpha; transparent blends, sorted back to front."
|
|
2307
|
+
doc "The stylised fields: unlit (three.js MeshBasicMaterial), toon with its gradientMap ramp, a rim (fresnel) light, a hit flash, dissolve with a glowing edge, and a per-material outline. All are off at their defaults. og.MaterialStyle fills the ones a material leaves at their defaults unless the material sets styled false."
|
|
2308
|
+
doc "The MeshPhysicalMaterial fields, under three.js's names and glTF's KHR_materials_* meanings, all off at their defaults: clearcoat with clearcoatMap, clearcoatRoughnessMap and clearcoatNormalMap; sheen (velvet, cloth) with sheenColor, sheenRoughness and their maps; transmission (glass, water) refracting the opaque scene behind through thickness, attenuationColor and ior; iridescence (soap film, oil) with its film's iridescenceIOR and iridescenceThicknessRange; anisotropy (brushed metal) along anisotropyRotation or anisotropyMap. They draw on every tier, WebGL2 included; unlit and toon materials ignore them."
|
|
2309
|
+
doc "A transmissive material is drawn after the opaque scene, back to front with the transparent ones, and refracts what was drawn before it (not other transmissive or transparent objects); thickness is in the mesh's own units, scaled with it."
|
|
2310
|
+
doc "normalMap is read in glTF's tangent frame: red tilts towards +u, green up the image. The tangents come from the model (the cook generates MikkTSpace ones where a glTF has none) or are generated when the geometry is made; normals follow a non-uniform scale correctly."
|
|
2311
|
+
desc true
|
|
2312
|
+
field color Color "The base colour." {
|
|
2313
|
+
default 1 1 1
|
|
2314
|
+
}
|
|
2315
|
+
field map Option.Texture "The base colour texture."
|
|
2316
|
+
field metalness f32 "How metallic the surface is." {
|
|
2317
|
+
min 0
|
|
2318
|
+
max 1
|
|
2319
|
+
}
|
|
2320
|
+
field metalnessMap Option.Texture "Metalness from the texture's blue channel."
|
|
2321
|
+
field roughness f32 "How rough the surface is." {
|
|
2322
|
+
default 1
|
|
2323
|
+
min 0
|
|
2324
|
+
max 1
|
|
2325
|
+
}
|
|
2326
|
+
field roughnessMap Option.Texture "Roughness from the texture's green channel."
|
|
2327
|
+
field normalMap Option.Texture "A tangent-space normal map."
|
|
2328
|
+
field aoMap Option.Texture "Ambient occlusion from the texture's red channel."
|
|
2329
|
+
field emissive Color "The emitted colour."
|
|
2330
|
+
field emissiveIntensity f32 "A multiplier on the emitted colour." {
|
|
2331
|
+
default 1
|
|
2332
|
+
min 0
|
|
2333
|
+
}
|
|
2334
|
+
field emissiveMap Option.Texture "The emitted colour texture."
|
|
2335
|
+
field opacity f32 "The opacity; below 1 only with transparent." {
|
|
2336
|
+
default 1
|
|
2337
|
+
min 0
|
|
2338
|
+
max 1
|
|
2339
|
+
}
|
|
2340
|
+
field transparent bool "Blend instead of writing opaque pixels."
|
|
2341
|
+
field alphaTest f32 "Discard pixels whose alpha is below this." {
|
|
2342
|
+
min 0
|
|
2343
|
+
max 1
|
|
2344
|
+
}
|
|
2345
|
+
field side Side "Which faces are drawn."
|
|
2346
|
+
field flatShading bool "Shade with face normals."
|
|
2347
|
+
field envMapIntensity f32 "A multiplier on image-based lighting." {
|
|
2348
|
+
default 1
|
|
2349
|
+
min 0
|
|
2350
|
+
}
|
|
2351
|
+
field normalScale Vector2 "How strongly the normal map bends the normal, per tangent axis." {
|
|
2352
|
+
default 1 1
|
|
2353
|
+
}
|
|
2354
|
+
field aoMapIntensity f32 "How strongly aoMap darkens the ambient light." {
|
|
2355
|
+
default 1
|
|
2356
|
+
min 0
|
|
2357
|
+
}
|
|
2358
|
+
field unlit bool "No lighting at all, as three.js MeshBasicMaterial: the colour (times map) plus emissive."
|
|
2359
|
+
field toon bool "Cel shading, as three.js MeshToonMaterial: light is quantized by gradientMap (three built-in bands without one), highlights are hard."
|
|
2360
|
+
field gradientMap Option.Texture "The toon ramp: a texture whose first row maps the light's angle (left dark, right lit) to the light received, read without filtering."
|
|
2361
|
+
field rimColor Color "Rim (fresnel) light added at grazing angles, unshadowed (linear)." {
|
|
2362
|
+
default 1 1 1
|
|
2363
|
+
}
|
|
2364
|
+
field rimIntensity f32 "The rim light's strength; 0 is none." {
|
|
2365
|
+
min 0
|
|
2366
|
+
}
|
|
2367
|
+
field rimPower f32 "How tight the rim is (higher: thinner)." {
|
|
2368
|
+
default 3
|
|
2369
|
+
min 0.1
|
|
2370
|
+
}
|
|
2371
|
+
field flashColor Color "The colour a hit flash mixes towards (linear, may exceed 1)." {
|
|
2372
|
+
default 1 1 1
|
|
2373
|
+
}
|
|
2374
|
+
field flash f32 "How far the final colour is mixed towards flashColor (0 none, 1 flat): animate it per tick for a hit flash." {
|
|
2375
|
+
min 0
|
|
2376
|
+
max 1
|
|
2377
|
+
}
|
|
2378
|
+
field dissolve f32 "The dissolved fraction: 0 whole, 1 gone. Pixels whose noise is below it are discarded (shadows too); the band just above glows with dissolveEdgeColor." {
|
|
2379
|
+
min 0
|
|
2380
|
+
max 1
|
|
2381
|
+
}
|
|
2382
|
+
field dissolveMap Option.Texture "The dissolve noise from the texture's red channel; without one, value noise over the object-space position."
|
|
2383
|
+
field dissolveEdgeColor Color "The glowing edge (linear, usually above 1 so it blooms)." {
|
|
2384
|
+
default 4 1.5 0.375
|
|
2385
|
+
}
|
|
2386
|
+
field dissolveEdgeWidth f32 "The width of the glowing band in noise units." {
|
|
2387
|
+
default 0.0625
|
|
2388
|
+
min 0
|
|
2389
|
+
max 1
|
|
2390
|
+
}
|
|
2391
|
+
field dissolveScale f32 "The frequency of the built-in noise (cells per object-space unit)." {
|
|
2392
|
+
default 4
|
|
2393
|
+
min 0
|
|
2394
|
+
}
|
|
2395
|
+
field outlineColor Color "This material's outline colour (linear)."
|
|
2396
|
+
field outlineWidth f32 "This material's outline width in pixels; 0 is none (PostEffects.outline outlines everything). A hull outline, as toon shading draws one: the object's silhouette, where one part of it passes in front of another, and its creases against other objects (where it meets the ground or a wall), never the edges between its own faces, so a .vox model or any flat-shaded, hard-edged mesh keeps clean faces inside its silhouette; a face seen at a grazing angle (a box's side nearly edge-on, a large ground plane) is not lined across, only where it ends. Creases inside an object are Stylise.inkDepth's." {
|
|
2397
|
+
min 0
|
|
2398
|
+
max 31
|
|
2399
|
+
}
|
|
2400
|
+
field styled bool "Whether og.MaterialStyle (a look's scene-wide toon, rim, outline, flat facets, shadow tint and outline distance) reaches this material. false keeps it exactly as declared under any look: a lantern's lacquer, a UI-like prop, a hero kept photographic in a toon scene. A material with a MeshPhysicalMaterial lobe (clearcoat, sheen, transmission, iridescence, anisotropy, an ior other than 1.5) keeps its physical shading under the style's toon even when styled (toon would drop those lobes) and takes the rest of the style; its own toon true still makes it toon." {
|
|
2401
|
+
default true
|
|
2402
|
+
}
|
|
2403
|
+
field clearcoat f32 "A clear lacquer over the surface, as three.js MeshPhysicalMaterial.clearcoat: a second, 4 % reflective specular layer on the surface's normal before normalMap (car paint, varnished wood, wet plastic); 0 is none." {
|
|
2404
|
+
min 0
|
|
2405
|
+
max 1
|
|
2406
|
+
unit ratio
|
|
2407
|
+
}
|
|
2408
|
+
field clearcoatRoughness f32 "How rough the clear coat is, as three.js MeshPhysicalMaterial.clearcoatRoughness." {
|
|
2409
|
+
min 0
|
|
2410
|
+
max 1
|
|
2411
|
+
unit ratio
|
|
2412
|
+
}
|
|
2413
|
+
field clearcoatMap Option.Texture "The coat's strength from the texture's red channel, times clearcoat (MeshPhysicalMaterial.clearcoatMap)."
|
|
2414
|
+
field clearcoatRoughnessMap Option.Texture "The coat's roughness from the texture's green channel, times clearcoatRoughness."
|
|
2415
|
+
field clearcoatNormalMap Option.Texture "A tangent-space normal map of the coat alone; the base keeps normalMap (MeshPhysicalMaterial.clearcoatNormalMap)."
|
|
2416
|
+
field clearcoatNormalScale Vector2 "How strongly clearcoatNormalMap bends the coat's normal, per tangent axis." {
|
|
2417
|
+
default 1 1
|
|
2418
|
+
}
|
|
2419
|
+
field sheen f32 "A velvet-like layer that brightens grazing angles (cloth, fuzz, peach skin), as MeshPhysicalMaterial.sheen: its strength, times sheenColor; 0 is none." {
|
|
2420
|
+
min 0
|
|
2421
|
+
max 1
|
|
2422
|
+
unit ratio
|
|
2423
|
+
}
|
|
2424
|
+
field sheenColor Color "The sheen's colour (linear), times sheenColorMap; black is none."
|
|
2425
|
+
field sheenRoughness f32 "How rough the sheen is: low keeps it to a thin rim, high spreads it over the surface." {
|
|
2426
|
+
default 1
|
|
2427
|
+
min 0
|
|
2428
|
+
max 1
|
|
2429
|
+
unit ratio
|
|
2430
|
+
}
|
|
2431
|
+
field sheenColorMap Option.Texture "The sheen's colour from the texture's RGB (sRGB)."
|
|
2432
|
+
field sheenRoughnessMap Option.Texture "The sheen's roughness from the texture's alpha channel."
|
|
2433
|
+
field transmission f32 "How much light passes through, as MeshPhysicalMaterial.transmission (glass, water, thin plastic): the opaque scene behind is refracted and blurred by roughness; 0 is none. Unlike opacity, the surface keeps its reflections." {
|
|
2434
|
+
min 0
|
|
2435
|
+
max 1
|
|
2436
|
+
unit ratio
|
|
2437
|
+
}
|
|
2438
|
+
field transmissionMap Option.Texture "Transmission from the texture's red channel."
|
|
2439
|
+
field thickness f32 "The volume's thickness under the surface in the mesh's own units (glTF KHR_materials_volume): how far refraction bends the view and how much attenuationColor absorbs; 0 is a thin wall." {
|
|
2440
|
+
min 0
|
|
2441
|
+
}
|
|
2442
|
+
field thicknessMap Option.Texture "Thickness from the texture's green channel."
|
|
2443
|
+
field attenuationDistance f32 "The distance light travels in the volume before it is tinted to attenuationColor (world units); 0 is no absorption, three.js's Infinity." {
|
|
2444
|
+
min 0
|
|
2445
|
+
}
|
|
2446
|
+
field attenuationColor Color "The colour white light becomes after attenuationDistance in the volume (linear)." {
|
|
2447
|
+
default 1 1 1
|
|
2448
|
+
}
|
|
2449
|
+
field ior f32 "The index of refraction (glTF KHR_materials_ior): the reflectance of a dielectric, ((ior - 1) / (ior + 1))^2 (4 % at 1.5), and how far transmission refracts." {
|
|
2450
|
+
default 1.5
|
|
2451
|
+
min 1
|
|
2452
|
+
max 2.333
|
|
2453
|
+
}
|
|
2454
|
+
field iridescence f32 "A thin-film interference layer, as MeshPhysicalMaterial.iridescence (soap bubbles, oil, beetle shells); 0 is none." {
|
|
2455
|
+
min 0
|
|
2456
|
+
max 1
|
|
2457
|
+
unit ratio
|
|
2458
|
+
}
|
|
2459
|
+
field iridescenceIOR f32 "The film's index of refraction." {
|
|
2460
|
+
default 1.3
|
|
2461
|
+
min 1
|
|
2462
|
+
max 2.333
|
|
2463
|
+
}
|
|
2464
|
+
field iridescenceThicknessRange Vector2 "The film's thickness in nanometres: x where iridescenceThicknessMap is black, y where it is white and everywhere without the map (three.js's [100, 400])." {
|
|
2465
|
+
default 100 400
|
|
2466
|
+
}
|
|
2467
|
+
field iridescenceMap Option.Texture "Iridescence from the texture's red channel."
|
|
2468
|
+
field iridescenceThicknessMap Option.Texture "The film's thickness between iridescenceThicknessRange's ends from the texture's green channel."
|
|
2469
|
+
field anisotropy f32 "Stretches the specular highlight along a direction of the surface, as MeshPhysicalMaterial.anisotropy (brushed metal, hair, satin); 0 is none, 1 fully stretched. Needs the geometry's tangents (generated when it has none)." {
|
|
2470
|
+
min 0
|
|
2471
|
+
max 1
|
|
2472
|
+
unit ratio
|
|
2473
|
+
}
|
|
2474
|
+
field anisotropyRotation f32 "The stretch's direction in radians from the tangent (+u) towards the bitangent."
|
|
2475
|
+
field anisotropyMap Option.Texture "The stretch's direction in red and green (-1 to 1 in the tangent frame, turned by anisotropyRotation) and its strength in blue, times anisotropy."
|
|
2476
|
+
field mapArray Option.TextureArray "The base colour from layer mapLayer of a texture array (og.load.textureArray) instead of map: variants of one look (tiles, skins, damage states) are one material, each Mesh picking its layer with Mesh.materialLayer, and every mesh of the material is one draw whichever layer it shows. A material with mapArray or normalMapArray reads its base colour and normal map from arrays only (map and normalMap are not read); it draws on every tier, WebGL2 included. Physical materials (the MeshPhysicalMaterial fields) and shader materials do not take arrays."
|
|
2477
|
+
field mapLayer u32 "The layer of mapArray drawn where the Mesh does not pick one (past the array's last layer: the last)."
|
|
2478
|
+
field normalMapArray Option.TextureArray "A tangent-space normal map from layer normalMapLayer of a texture array (linear: cook it with `kind normal`), the counterpart of mapArray."
|
|
2479
|
+
field normalMapLayer u32 "The layer of normalMapArray read where the Mesh does not pick one."
|
|
2480
|
+
}
|
|
2481
|
+
```
|
|
2482
|
+
|
|
2483
|
+
<sub>`api.ogt` line 1728</sub>
|
|
2484
|
+
|
|
2485
|
+
<a id="type-ToneMapping"></a>
|
|
2486
|
+
|
|
2487
|
+
### `ToneMapping` (enum)
|
|
2488
|
+
|
|
2489
|
+
The curve from the lit HDR image to the display, as three.js toneMapping. RenderSettings.toneMapped false clamps instead, whichever is chosen.
|
|
2490
|
+
|
|
2491
|
+
A string: one of the variants below. The zero value is `"aces"`.
|
|
2492
|
+
|
|
2493
|
+
| Variant | Doc |
|
|
2494
|
+
|---|---|
|
|
2495
|
+
| `"aces"` | ACES (the fitted filmic curve), as three.js ACESFilmicToneMapping: the default. |
|
|
2496
|
+
| `"agx"` | AgX (Blender 4's and three.js AgXToneMapping's fit, base look): bright saturated lights go to white instead of skewing hue, and keep their hue further up than under ACES. |
|
|
2497
|
+
| `"none"` | No curve: the exposed linear colour is clamped to 0..1, so 2D colours come out exactly as authored at exposure 1 (the same as toneMapped false). |
|
|
2498
|
+
|
|
2499
|
+
```ogt
|
|
2500
|
+
enum ToneMapping {
|
|
2501
|
+
doc "The curve from the lit HDR image to the display, as three.js toneMapping. RenderSettings.toneMapped false clamps instead, whichever is chosen."
|
|
2502
|
+
variant aces "ACES (the fitted filmic curve), as three.js ACESFilmicToneMapping: the default."
|
|
2503
|
+
variant agx "AgX (Blender 4's and three.js AgXToneMapping's fit, base look): bright saturated lights go to white instead of skewing hue, and keep their hue further up than under ACES."
|
|
2504
|
+
variant none "No curve: the exposed linear colour is clamped to 0..1, so 2D colours come out exactly as authored at exposure 1 (the same as toneMapped false)."
|
|
2505
|
+
}
|
|
2506
|
+
```
|
|
2507
|
+
|
|
2508
|
+
<sub>`api.ogt` line 2016</sub>
|
|
2509
|
+
|
|
2510
|
+
<a id="type-Lut"></a>
|
|
2511
|
+
|
|
2512
|
+
### `Lut` (handle)
|
|
2513
|
+
|
|
2514
|
+
A colour lookup table for PostEffects.lut, from og.load.lut (a `.cube` file).
|
|
2515
|
+
|
|
2516
|
+
A generational handle: a number the engine hands out. A dead handle is an error value, never a crash.
|
|
2517
|
+
|
|
2518
|
+
```ogt
|
|
2519
|
+
handle Lut "A colour lookup table for PostEffects.lut, from og.load.lut (a `.cube` file)."
|
|
2520
|
+
```
|
|
2521
|
+
|
|
2522
|
+
<sub>`api.ogt` line 2081</sub>
|
|
2523
|
+
|
|
2524
|
+
<a id="type-EnvironmentMap"></a>
|
|
2525
|
+
|
|
2526
|
+
### `EnvironmentMap` (handle)
|
|
2527
|
+
|
|
2528
|
+
A prefiltered HDR environment map for Environment.map, from og.load.environment (an `.ogt` of `type environment` naming an equirectangular `.hdr` or `.exr`, a KTX2 cube map, or six face images).
|
|
2529
|
+
|
|
2530
|
+
A generational handle: a number the engine hands out. A dead handle is an error value, never a crash.
|
|
2531
|
+
|
|
2532
|
+
```ogt
|
|
2533
|
+
handle EnvironmentMap "A prefiltered HDR environment map for Environment.map, from og.load.environment (an `.ogt` of `type environment` naming an equirectangular `.hdr` or `.exr`, a KTX2 cube map, or six face images)."
|
|
2534
|
+
```
|
|
2535
|
+
|
|
2536
|
+
<sub>`api.ogt` line 2082</sub>
|
|
2537
|
+
|
|
2538
|
+
<a id="type-ParticleEmitter"></a>
|
|
2539
|
+
|
|
2540
|
+
### `ParticleEmitter` (handle)
|
|
2541
|
+
|
|
2542
|
+
A particle emitter asset for ParticleSystem.emitter, from og.load.emitter (an `.ogt` of `type particles`).
|
|
2543
|
+
|
|
2544
|
+
A generational handle: a number the engine hands out. A dead handle is an error value, never a crash.
|
|
2545
|
+
|
|
2546
|
+
```ogt
|
|
2547
|
+
handle ParticleEmitter "A particle emitter asset for ParticleSystem.emitter, from og.load.emitter (an `.ogt` of `type particles`)."
|
|
2548
|
+
```
|
|
2549
|
+
|
|
2550
|
+
<sub>`api.ogt` line 2083</sub>
|
|
2551
|
+
|
|
2552
|
+
<a id="type-AoMethod"></a>
|
|
2553
|
+
|
|
2554
|
+
### `AoMethod` (enum)
|
|
2555
|
+
|
|
2556
|
+
Which ambient occlusion algorithm runs.
|
|
2557
|
+
|
|
2558
|
+
A string: one of the variants below. The zero value is `"auto"`.
|
|
2559
|
+
|
|
2560
|
+
| Variant | Doc |
|
|
2561
|
+
|---|---|
|
|
2562
|
+
| `"auto"` | GTAO on the full tier, SSAO on WebGL2. |
|
|
2563
|
+
| `"gtao"` | Ground-truth ambient occlusion (3 slices): the better looking one. |
|
|
2564
|
+
| `"ssao"` | Hemisphere SSAO with 8 samples: the cheaper one. |
|
|
2565
|
+
|
|
2566
|
+
```ogt
|
|
2567
|
+
enum AoMethod {
|
|
2568
|
+
doc "Which ambient occlusion algorithm runs."
|
|
2569
|
+
variant auto "GTAO on the full tier, SSAO on WebGL2."
|
|
2570
|
+
variant gtao "Ground-truth ambient occlusion (3 slices): the better looking one."
|
|
2571
|
+
variant ssao "Hemisphere SSAO with 8 samples: the cheaper one."
|
|
2572
|
+
}
|
|
2573
|
+
```
|
|
2574
|
+
|
|
2575
|
+
<sub>`api.ogt` line 2133</sub>
|
|
2576
|
+
|
|
2577
|
+
<a id="type-DofQuality"></a>
|
|
2578
|
+
|
|
2579
|
+
### `DofQuality` (enum)
|
|
2580
|
+
|
|
2581
|
+
How many taps depth of field gathers per pixel.
|
|
2582
|
+
|
|
2583
|
+
A string: one of the variants below. The zero value is `"low"`.
|
|
2584
|
+
|
|
2585
|
+
| Variant | Doc |
|
|
2586
|
+
|---|---|
|
|
2587
|
+
| `"low"` | 16 taps at half resolution. |
|
|
2588
|
+
| `"high"` | 48 taps at half resolution: rounder, smoother bokeh. |
|
|
2589
|
+
|
|
2590
|
+
```ogt
|
|
2591
|
+
enum DofQuality {
|
|
2592
|
+
doc "How many taps depth of field gathers per pixel."
|
|
2593
|
+
variant low "16 taps at half resolution."
|
|
2594
|
+
variant high "48 taps at half resolution: rounder, smoother bokeh."
|
|
2595
|
+
}
|
|
2596
|
+
```
|
|
2597
|
+
|
|
2598
|
+
<sub>`api.ogt` line 2147</sub>
|
|
2599
|
+
|
|
2600
|
+
<a id="type-SpriteBlend"></a>
|
|
2601
|
+
|
|
2602
|
+
### `SpriteBlend` (enum)
|
|
2603
|
+
|
|
2604
|
+
How a sprite is blended over what is below it.
|
|
2605
|
+
|
|
2606
|
+
A string: one of the variants below. The zero value is `"alpha"`.
|
|
2607
|
+
|
|
2608
|
+
| Variant | Doc |
|
|
2609
|
+
|---|---|
|
|
2610
|
+
| `"alpha"` | Ordinary alpha blending. |
|
|
2611
|
+
| `"additive"` | Added (light, fire, magic): order-independent within a layer. |
|
|
2612
|
+
|
|
2613
|
+
```ogt
|
|
2614
|
+
enum SpriteBlend {
|
|
2615
|
+
doc "How a sprite is blended over what is below it."
|
|
2616
|
+
variant alpha "Ordinary alpha blending."
|
|
2617
|
+
variant additive "Added (light, fire, magic): order-independent within a layer."
|
|
2618
|
+
}
|
|
2619
|
+
```
|
|
2620
|
+
|
|
2621
|
+
<sub>`api.ogt` line 2160</sub>
|
|
2622
|
+
|
|
2623
|
+
<a id="type-StripBlend"></a>
|
|
2624
|
+
|
|
2625
|
+
### `StripBlend` (enum)
|
|
2626
|
+
|
|
2627
|
+
How a trail, ribbon or beam is blended.
|
|
2628
|
+
|
|
2629
|
+
A string: one of the variants below. The zero value is `"additive"`.
|
|
2630
|
+
|
|
2631
|
+
| Variant | Doc |
|
|
2632
|
+
|---|---|
|
|
2633
|
+
| `"additive"` | Added: glowing streaks, lasers, magic. |
|
|
2634
|
+
| `"alpha"` | Alpha blended: smoke trails, tyre marks. |
|
|
2635
|
+
|
|
2636
|
+
```ogt
|
|
2637
|
+
enum StripBlend {
|
|
2638
|
+
doc "How a trail, ribbon or beam is blended."
|
|
2639
|
+
variant additive "Added: glowing streaks, lasers, magic."
|
|
2640
|
+
variant alpha "Alpha blended: smoke trails, tyre marks."
|
|
2641
|
+
}
|
|
2642
|
+
```
|
|
2643
|
+
|
|
2644
|
+
<sub>`api.ogt` line 2173</sub>
|
|
2645
|
+
|
|
2646
|
+
<a id="type-Palette"></a>
|
|
2647
|
+
|
|
2648
|
+
### `Palette` (handle)
|
|
2649
|
+
|
|
2650
|
+
A colour palette for Stylise.palette, from og.load.palette (a `.hex` or GIMP `.gpl` file of up to 256 colours).
|
|
2651
|
+
|
|
2652
|
+
A generational handle: a number the engine hands out. A dead handle is an error value, never a crash.
|
|
2653
|
+
|
|
2654
|
+
```ogt
|
|
2655
|
+
handle Palette "A colour palette for Stylise.palette, from og.load.palette (a `.hex` or GIMP `.gpl` file of up to 256 colours)."
|
|
2656
|
+
```
|
|
2657
|
+
|
|
2658
|
+
<sub>`api.ogt` line 2363</sub>
|
|
2659
|
+
|
|
2660
|
+
<a id="type-Look"></a>
|
|
2661
|
+
|
|
2662
|
+
### `Look` (handle)
|
|
2663
|
+
|
|
2664
|
+
A look from og.load.look (an `.ogt` of `type look`): the frame's whole art direction as data, applied with og.render.applyLook.
|
|
2665
|
+
|
|
2666
|
+
A generational handle: a number the engine hands out. A dead handle is an error value, never a crash.
|
|
2667
|
+
|
|
2668
|
+
```ogt
|
|
2669
|
+
handle Look "A look from og.load.look (an `.ogt` of `type look`): the frame's whole art direction as data, applied with og.render.applyLook."
|
|
2670
|
+
```
|
|
2671
|
+
|
|
2672
|
+
<sub>`api.ogt` line 2364</sub>
|
|
2673
|
+
|
|
2674
|
+
<a id="type-DitherPattern"></a>
|
|
2675
|
+
|
|
2676
|
+
### `DitherPattern` (enum)
|
|
2677
|
+
|
|
2678
|
+
The threshold pattern Stylise.dither spreads the steps of posterize and palette with.
|
|
2679
|
+
|
|
2680
|
+
A string: one of the variants below. The zero value is `"none"`.
|
|
2681
|
+
|
|
2682
|
+
| Variant | Doc |
|
|
2683
|
+
|---|---|
|
|
2684
|
+
| `"none"` | No dither: every pixel rounds to its nearest step or colour, in flat bands. |
|
|
2685
|
+
| `"bayer2"` | Ordered dither by a 2 by 2 Bayer matrix: the coarsest checker, as on early handhelds. |
|
|
2686
|
+
| `"bayer4"` | Ordered dither by a 4 by 4 Bayer matrix: the cross-hatched ramps of 8- and 16-bit art. |
|
|
2687
|
+
| `"bayer8"` | Ordered dither by an 8 by 8 Bayer matrix: finer ramps with 64 levels between two colours. |
|
|
2688
|
+
| `"blueNoise"` | Blue noise: an even grain without a visible grid (a 64 by 64 void-and-cluster tile the engine ships, repeated), fixed per pixel so a still frame does not crawl. |
|
|
2689
|
+
| `"interleavedGradient"` | Interleaved gradient noise: computed per pixel without a texture; a finer diagonal structure than blueNoise up close. |
|
|
2690
|
+
|
|
2691
|
+
```ogt
|
|
2692
|
+
enum DitherPattern {
|
|
2693
|
+
doc "The threshold pattern Stylise.dither spreads the steps of posterize and palette with."
|
|
2694
|
+
variant none "No dither: every pixel rounds to its nearest step or colour, in flat bands."
|
|
2695
|
+
variant bayer2 "Ordered dither by a 2 by 2 Bayer matrix: the coarsest checker, as on early handhelds."
|
|
2696
|
+
variant bayer4 "Ordered dither by a 4 by 4 Bayer matrix: the cross-hatched ramps of 8- and 16-bit art."
|
|
2697
|
+
variant bayer8 "Ordered dither by an 8 by 8 Bayer matrix: finer ramps with 64 levels between two colours."
|
|
2698
|
+
variant blueNoise "Blue noise: an even grain without a visible grid (a 64 by 64 void-and-cluster tile the engine ships, repeated), fixed per pixel so a still frame does not crawl."
|
|
2699
|
+
variant interleavedGradient "Interleaved gradient noise: computed per pixel without a texture; a finer diagonal structure than blueNoise up close."
|
|
2700
|
+
}
|
|
2701
|
+
```
|
|
2702
|
+
|
|
2703
|
+
<sub>`api.ogt` line 2373</sub>
|
|
2704
|
+
|
|
2705
|
+
<a id="type-StyliseSpace"></a>
|
|
2706
|
+
|
|
2707
|
+
### `StyliseSpace` (enum)
|
|
2708
|
+
|
|
2709
|
+
Where Stylise lays a pattern (the paint canvas, the hatching, the halftone).
|
|
2710
|
+
|
|
2711
|
+
A string: one of the variants below. The zero value is `"screen"`.
|
|
2712
|
+
|
|
2713
|
+
| Variant | Doc |
|
|
2714
|
+
|---|---|
|
|
2715
|
+
| `"screen"` | Over the frame in logical pixels, as a print or a sheet of paper over the screen: the pattern stays put while the camera moves and the scene slides under it. |
|
|
2716
|
+
| `"surface"` | On the surfaces, through the depth-normal prepass's position and normal (three world planes blended by the normal): the pattern sticks to the scene as the camera moves and wraps round forms, a tonal art map's strokes on the objects. Hatching and halftone keep about their pixel spacing by fading between whole octaves of world spacing; the sky keeps the screen pattern. The frame runs the prepass PostEffects.outline uses. |
|
|
2717
|
+
| `"object"` | On the surfaces as surface, but in each mesh instance's own space (three planes of the instance blended by its normal, in metres along its axes): a moving, turning or skinned object carries its strokes, dots and grain instead of sliding through them, and keeps them however it is scaled. Terrain, scattered copies and the vertices a material shader moves keep the world pattern, the sky the screen pattern. The frame runs the prepass and an object pass that draws the opaque instances again. |
|
|
2718
|
+
|
|
2719
|
+
```ogt
|
|
2720
|
+
enum StyliseSpace {
|
|
2721
|
+
doc "Where Stylise lays a pattern (the paint canvas, the hatching, the halftone)."
|
|
2722
|
+
variant screen "Over the frame in logical pixels, as a print or a sheet of paper over the screen: the pattern stays put while the camera moves and the scene slides under it."
|
|
2723
|
+
variant surface "On the surfaces, through the depth-normal prepass's position and normal (three world planes blended by the normal): the pattern sticks to the scene as the camera moves and wraps round forms, a tonal art map's strokes on the objects. Hatching and halftone keep about their pixel spacing by fading between whole octaves of world spacing; the sky keeps the screen pattern. The frame runs the prepass PostEffects.outline uses."
|
|
2724
|
+
variant object "On the surfaces as surface, but in each mesh instance's own space (three planes of the instance blended by its normal, in metres along its axes): a moving, turning or skinned object carries its strokes, dots and grain instead of sliding through them, and keeps them however it is scaled. Terrain, scattered copies and the vertices a material shader moves keep the world pattern, the sky the screen pattern. The frame runs the prepass and an object pass that draws the opaque instances again."
|
|
2725
|
+
}
|
|
2726
|
+
```
|
|
2727
|
+
|
|
2728
|
+
<sub>`api.ogt` line 2390</sub>
|
|
2729
|
+
|
|
2730
|
+
<a id="type-LookInfo"></a>
|
|
2731
|
+
|
|
2732
|
+
### `LookInfo` (struct)
|
|
2733
|
+
|
|
2734
|
+
A loaded look: where it came from and what applying it sets.
|
|
2735
|
+
|
|
2736
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
2737
|
+
|---|---|---|---|---|---|---|
|
|
2738
|
+
| `look` | `Look` | `0` | — | — | — | Its handle. |
|
|
2739
|
+
| `path` | `string` | `""` | — | — | — | Its asset id. |
|
|
2740
|
+
| `name` | `string` | `""` | — | — | — | Its name (the file's `name`, else its file name without `.ogt`). |
|
|
2741
|
+
| `extends` | `readonly string[]` | `[]` | — | — | — | The looks it builds on, nearest first: asset ids under assets/ and built-in preset slugs. |
|
|
2742
|
+
| `resources` | `readonly string[]` | `[]` | — | — | — | The resources it sets, by IDL name (RenderSettings, PostEffects, Stylise, MaterialStyle, Fog, Sky, Environment). Applying it replaces each of them whole: the fields the look names take its values, the rest their defaults. |
|
|
2743
|
+
| `skin` | `Skin \| null` | `null` | — | — | — | The UI skin it names, loaded with it; applying the look configures the UI with it. |
|
|
2744
|
+
| `antialias` | `Antialias \| null` | `null` | — | — | — | The antialiasing it asks for. GameDesc.look's is the renderer's when GameDesc.render leaves antialias out; a running renderer keeps its method. |
|
|
2745
|
+
|
|
2746
|
+
```ogt
|
|
2747
|
+
struct LookInfo {
|
|
2748
|
+
doc "A loaded look: where it came from and what applying it sets."
|
|
2749
|
+
field look Look "Its handle."
|
|
2750
|
+
field path String "Its asset id."
|
|
2751
|
+
field name String "Its name (the file's `name`, else its file name without `.ogt`)."
|
|
2752
|
+
field extends List.String "The looks it builds on, nearest first: asset ids under assets/ and built-in preset slugs."
|
|
2753
|
+
field resources List.String "The resources it sets, by IDL name (RenderSettings, PostEffects, Stylise, MaterialStyle, Fog, Sky, Environment). Applying it replaces each of them whole: the fields the look names take its values, the rest their defaults."
|
|
2754
|
+
field skin Option.Skin "The UI skin it names, loaded with it; applying the look configures the UI with it."
|
|
2755
|
+
field antialias Option.Antialias "The antialiasing it asks for. GameDesc.look's is the renderer's when GameDesc.render leaves antialias out; a running renderer keeps its method."
|
|
2756
|
+
}
|
|
2757
|
+
```
|
|
2758
|
+
|
|
2759
|
+
<sub>`api.ogt` line 2636</sub>
|
|
2760
|
+
|
|
2761
|
+
<a id="type-RibbonPoint"></a>
|
|
2762
|
+
|
|
2763
|
+
### `RibbonPoint` (desc struct)
|
|
2764
|
+
|
|
2765
|
+
One point of a ribbon.
|
|
2766
|
+
|
|
2767
|
+
A desc: every field may be omitted and takes its default; `{}` is valid.
|
|
2768
|
+
|
|
2769
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
2770
|
+
|---|---|---|---|---|---|---|
|
|
2771
|
+
| `position` | `Vector3` | `{ x: 0, y: 0, z: 0 }` | — | `m` | — | Where it is. |
|
|
2772
|
+
| `width` | `number` | `0.1` | ≥ 0 | `m` | — | The width there. |
|
|
2773
|
+
| `color` | `Color` | `{ r: 1, g: 1, b: 1 }` | — | — | — | The linear colour there. |
|
|
2774
|
+
| `opacity` | `number` | `1` | 0 … 1 | — | — | The alpha there. |
|
|
2775
|
+
|
|
2776
|
+
```ogt
|
|
2777
|
+
struct RibbonPoint {
|
|
2778
|
+
doc "One point of a ribbon."
|
|
2779
|
+
desc true
|
|
2780
|
+
field position Vector3 "Where it is." {
|
|
2781
|
+
unit m
|
|
2782
|
+
}
|
|
2783
|
+
field width f32 "The width there." {
|
|
2784
|
+
default 0.1
|
|
2785
|
+
min 0
|
|
2786
|
+
unit m
|
|
2787
|
+
}
|
|
2788
|
+
field color Color "The linear colour there." {
|
|
2789
|
+
default 1 1 1
|
|
2790
|
+
}
|
|
2791
|
+
field opacity f32 "The alpha there." {
|
|
2792
|
+
default 1
|
|
2793
|
+
min 0
|
|
2794
|
+
max 1
|
|
2795
|
+
}
|
|
2796
|
+
}
|
|
2797
|
+
```
|
|
2798
|
+
|
|
2799
|
+
<sub>`api.ogt` line 2841</sub>
|
|
2800
|
+
|
|
2801
|
+
<a id="type-RibbonDesc"></a>
|
|
2802
|
+
|
|
2803
|
+
### `RibbonDesc` (desc struct)
|
|
2804
|
+
|
|
2805
|
+
An explicit camera-facing strip through points, drawn this frame only (immediate mode, as og.render.sprite): submit it every tick it should show.
|
|
2806
|
+
|
|
2807
|
+
A desc: every field may be omitted and takes its default; `{}` is valid.
|
|
2808
|
+
|
|
2809
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
2810
|
+
|---|---|---|---|---|---|---|
|
|
2811
|
+
| `points` | `readonly RibbonPoint[]` | `[]` | — | — | — | The points, in order (at least two). |
|
|
2812
|
+
| `texture` | `Texture \| null` | `null` | — | — | — | A texture along the strip; null is solid. |
|
|
2813
|
+
| `uvTile` | `number` | `0` | ≥ 0 | `m` | — | The texture repeats every this many world units; 0 stretches it once. |
|
|
2814
|
+
| `blend` | `StripBlend` | `"additive"` | — | — | — | Additive or alpha blended. |
|
|
2815
|
+
|
|
2816
|
+
```ogt
|
|
2817
|
+
struct RibbonDesc {
|
|
2818
|
+
doc "An explicit camera-facing strip through points, drawn this frame only (immediate mode, as og.render.sprite): submit it every tick it should show."
|
|
2819
|
+
desc true
|
|
2820
|
+
field points List.RibbonPoint "The points, in order (at least two)."
|
|
2821
|
+
field texture Option.Texture "A texture along the strip; null is solid."
|
|
2822
|
+
field uvTile f32 "The texture repeats every this many world units; 0 stretches it once." {
|
|
2823
|
+
min 0
|
|
2824
|
+
unit m
|
|
2825
|
+
}
|
|
2826
|
+
field blend StripBlend "Additive or alpha blended."
|
|
2827
|
+
}
|
|
2828
|
+
```
|
|
2829
|
+
|
|
2830
|
+
<sub>`api.ogt` line 2862</sub>
|
|
2831
|
+
|
|
2832
|
+
<a id="type-TextDesc"></a>
|
|
2833
|
+
|
|
2834
|
+
### `TextDesc` (desc struct)
|
|
2835
|
+
|
|
2836
|
+
A line or block of MSDF text in the world's xy plane facing +z, drawn this frame only (immediate mode: submit it every tick it should show).
|
|
2837
|
+
|
|
2838
|
+
A desc: every field may be omitted and takes its default; `{}` is valid.
|
|
2839
|
+
|
|
2840
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
2841
|
+
|---|---|---|---|---|---|---|
|
|
2842
|
+
| `font` | `Font \| null` | `null` | — | — | — | The font from og.load.font; null draws nothing. |
|
|
2843
|
+
| `text` | `string` | `""` | — | — | — | The text; `\n` starts a new line. |
|
|
2844
|
+
| `position` | `Vector3` | `{ x: 0, y: 0, z: 0 }` | — | `m` | — | The baseline origin of the first line. |
|
|
2845
|
+
| `size` | `number` | `1` | ≥ 0 | — | — | The em size in world units. |
|
|
2846
|
+
| `rotation` | `number` | `0` | — | `rad` | — | Rotation about +z. |
|
|
2847
|
+
| `color` | `Color` | `{ r: 1, g: 1, b: 1 }` | — | — | — | The linear colour. |
|
|
2848
|
+
| `opacity` | `number` | `1` | 0 … 1 | — | — | The alpha. |
|
|
2849
|
+
| `layer` | `number` | `0` | — | — | — | Draw order among sprites and text; higher draws on top. |
|
|
2850
|
+
| `align` | `TextAlign` | `"start"` | — | — | — | How each line sits on `position`: start puts its left end there, center its middle, end its right end. |
|
|
2851
|
+
| `outline` | `number` | `0` | 0 … 1 | — | — | World text: an outline around the glyphs, as a fraction (0 to 1) of the widest the font's distance range allows (a font cooked with a larger px_range takes thicker outlines). |
|
|
2852
|
+
| `outlineColor` | `Color` | `{ r: 0, g: 0, b: 0 }` | — | — | — | The outline's linear colour. |
|
|
2853
|
+
| `screen` | `boolean` | `false` | — | — | — | Draw in screen space over the finished frame: position is the first baseline's origin in CSS pixels from the top left, y down, size in CSS pixels, rotation clockwise. With og.ui: under every UI element at a layer up to UI_LAYER (1000), over every one above it. |
|
|
2854
|
+
| `clip` | `[number, number, number, number] \| null` | `null` | — | — | — | Screen text: cut to [x, y, width, height] in CSS pixels, per pixel; null draws it whole. |
|
|
2855
|
+
|
|
2856
|
+
```ogt
|
|
2857
|
+
struct TextDesc {
|
|
2858
|
+
doc "A line or block of MSDF text in the world's xy plane facing +z, drawn this frame only (immediate mode: submit it every tick it should show)."
|
|
2859
|
+
desc true
|
|
2860
|
+
field font Option.Font "The font from og.load.font; null draws nothing."
|
|
2861
|
+
field text String "The text; `\\n` starts a new line."
|
|
2862
|
+
field position Vector3 "The baseline origin of the first line." {
|
|
2863
|
+
unit m
|
|
2864
|
+
}
|
|
2865
|
+
field size f32 "The em size in world units." {
|
|
2866
|
+
default 1
|
|
2867
|
+
min 0
|
|
2868
|
+
}
|
|
2869
|
+
field rotation f32 "Rotation about +z." {
|
|
2870
|
+
unit rad
|
|
2871
|
+
}
|
|
2872
|
+
field color Color "The linear colour." {
|
|
2873
|
+
default 1 1 1
|
|
2874
|
+
}
|
|
2875
|
+
field opacity f32 "The alpha." {
|
|
2876
|
+
default 1
|
|
2877
|
+
min 0
|
|
2878
|
+
max 1
|
|
2879
|
+
}
|
|
2880
|
+
field layer i32 "Draw order among sprites and text; higher draws on top."
|
|
2881
|
+
field align TextAlign "How each line sits on `position`: start puts its left end there, center its middle, end its right end."
|
|
2882
|
+
field outline f32 "World text: an outline around the glyphs, as a fraction (0 to 1) of the widest the font's distance range allows (a font cooked with a larger px_range takes thicker outlines)." {
|
|
2883
|
+
min 0
|
|
2884
|
+
max 1
|
|
2885
|
+
}
|
|
2886
|
+
field outlineColor Color "The outline's linear colour."
|
|
2887
|
+
field screen bool "Draw in screen space over the finished frame: position is the first baseline's origin in CSS pixels from the top left, y down, size in CSS pixels, rotation clockwise. With og.ui: under every UI element at a layer up to UI_LAYER (1000), over every one above it."
|
|
2888
|
+
field clip Option.Array.f32.4 "Screen text: cut to [x, y, width, height] in CSS pixels, per pixel; null draws it whole."
|
|
2889
|
+
}
|
|
2890
|
+
```
|
|
2891
|
+
|
|
2892
|
+
<sub>`api.ogt` line 2881</sub>
|
|
2893
|
+
|
|
2894
|
+
<a id="type-TextMeasureDesc"></a>
|
|
2895
|
+
|
|
2896
|
+
### `TextMeasureDesc` (desc struct)
|
|
2897
|
+
|
|
2898
|
+
Text to measure with og.render.measureText, laid out as og.render.text lays it out.
|
|
2899
|
+
|
|
2900
|
+
A desc: every field may be omitted and takes its default; `{}` is valid.
|
|
2901
|
+
|
|
2902
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
2903
|
+
|---|---|---|---|---|---|---|
|
|
2904
|
+
| `font` | `Font \| null` | `null` | — | — | — | The font from og.load.font. |
|
|
2905
|
+
| `text` | `string` | `""` | — | — | — | The text; `\n` starts a new line. |
|
|
2906
|
+
| `size` | `number` | `1` | ≥ 0 | — | — | The em size in world units. |
|
|
2907
|
+
|
|
2908
|
+
```ogt
|
|
2909
|
+
struct TextMeasureDesc {
|
|
2910
|
+
doc "Text to measure with og.render.measureText, laid out as og.render.text lays it out."
|
|
2911
|
+
desc true
|
|
2912
|
+
field font Option.Font "The font from og.load.font."
|
|
2913
|
+
field text String "The text; `\\n` starts a new line."
|
|
2914
|
+
field size f32 "The em size in world units." {
|
|
2915
|
+
default 1
|
|
2916
|
+
min 0
|
|
2917
|
+
}
|
|
2918
|
+
}
|
|
2919
|
+
```
|
|
2920
|
+
|
|
2921
|
+
<sub>`api.ogt` line 2915</sub>
|
|
2922
|
+
|
|
2923
|
+
<a id="type-TextMetrics"></a>
|
|
2924
|
+
|
|
2925
|
+
### `TextMetrics` (struct)
|
|
2926
|
+
|
|
2927
|
+
The extent of a laid-out text, in world units.
|
|
2928
|
+
|
|
2929
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
2930
|
+
|---|---|---|---|---|---|---|
|
|
2931
|
+
| `width` | `number` | `0` | — | — | — | The widest line's advance. |
|
|
2932
|
+
| `height` | `number` | `0` | — | — | — | Lines times the font's line height. |
|
|
2933
|
+
| `lines` | `number` | `0` | — | — | — | How many lines. |
|
|
2934
|
+
|
|
2935
|
+
```ogt
|
|
2936
|
+
struct TextMetrics {
|
|
2937
|
+
doc "The extent of a laid-out text, in world units."
|
|
2938
|
+
field width f32 "The widest line's advance."
|
|
2939
|
+
field height f32 "Lines times the font's line height."
|
|
2940
|
+
field lines u32 "How many lines."
|
|
2941
|
+
}
|
|
2942
|
+
```
|
|
2943
|
+
|
|
2944
|
+
<sub>`api.ogt` line 2926</sub>
|
|
2945
|
+
|
|
2946
|
+
<a id="type-SpriteDesc"></a>
|
|
2947
|
+
|
|
2948
|
+
### `SpriteDesc` (desc struct)
|
|
2949
|
+
|
|
2950
|
+
A textured or solid quad in the world's xy plane facing +z, drawn this frame only (immediate mode, as og.render.text): submit it every tick it should show. Sprites and text are sorted by layer and drawn over the 3D scene.
|
|
2951
|
+
|
|
2952
|
+
A desc: every field may be omitted and takes its default; `{}` is valid.
|
|
2953
|
+
|
|
2954
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
2955
|
+
|---|---|---|---|---|---|---|
|
|
2956
|
+
| `texture` | `Texture \| null` | `null` | — | — | — | The texture from og.load.texture; null draws a solid quad of the colour. |
|
|
2957
|
+
| `array` | `TextureArray \| null` | `null` | — | — | — | Draw from a layer of this texture array (og.load.textureArray) instead of `texture`: every sprite of one array is one draw whichever layer each shows, so a flipbook's frames packed as layers batch across frames. World and screen sprites alike, with flash, glow, blend and 2D lighting as a textured sprite. null uses `texture`. |
|
|
2958
|
+
| `arrayLayer` | `number` | `0` | — | — | — | With `array`: the layer drawn, 0 to the array's layers minus 1 (refused past it). `uv` is the region within the layer. |
|
|
2959
|
+
| `position` | `Vector3` | `{ x: 0, y: 0, z: 0 }` | — | `m` | — | Where the anchor point is. |
|
|
2960
|
+
| `width` | `number` | `1` | ≥ 0 | `m` | — | Its width in world units. |
|
|
2961
|
+
| `height` | `number` | `1` | ≥ 0 | `m` | — | Its height in world units. |
|
|
2962
|
+
| `anchor` | `Vector2` | `{ x: 0.5, y: 0.5 }` | — | — | — | The point of the quad at `position`, as a fraction of its size from the bottom-left corner: (0.5, 0.5) is the centre. |
|
|
2963
|
+
| `rotation` | `number` | `0` | — | `rad` | — | Counter-clockwise rotation about the anchor. |
|
|
2964
|
+
| `color` | `Color` | `{ r: 1, g: 1, b: 1 }` | — | — | — | A linear colour multiplied with the texture. |
|
|
2965
|
+
| `opacity` | `number` | `1` | 0 … 1 | — | — | The alpha. |
|
|
2966
|
+
| `uv` | `[number, number, number, number] \| null` | `null` | — | — | — | The texture region drawn, [u0, v0, u1, v1] with v down; null is the whole texture (a sheet's frame for animation). |
|
|
2967
|
+
| `layer` | `number` | `0` | — | — | — | Draw order among sprites and text; higher draws on top. |
|
|
2968
|
+
| `flash` | `number` | `0` | 0 … 1 | — | — | A hit flash: the colour mixed towards flashColor by this much, keeping the alpha. |
|
|
2969
|
+
| `flashColor` | `Color` | `{ r: 1, g: 1, b: 1 }` | — | — | — | The flash's linear colour. |
|
|
2970
|
+
| `glow` | `number` | `0` | ≥ 0 | — | — | Strength in the 2D glow buffer (PostEffects.glow); 0 none. |
|
|
2971
|
+
| `blend` | `SpriteBlend` | `"alpha"` | — | — | — | Alpha or additive. |
|
|
2972
|
+
| `castShadow` | `boolean` | `false` | — | — | — | Block 2D light (Lighting2D) with the sprite's rectangle. |
|
|
2973
|
+
| `dropShadow` | `number` | `0` | 0 … 1 | — | — | A drop shadow this dark (0 none, 0.5 typical): the sprite's shape in black, flattened along the sun (the first og.DirectionalLight) onto the ground under it (dropShadowHeight, or the og.Terrain there), drawn before every sprite of its layer: pixel sprites standing in a 3D set cast shadows that agree with it. Where the ground already lies in the sun's cascaded shadow the drop shadow fades, so a shadow inside a shadow is no darker. None with the sun below the horizon; at most five times the sprite's height long under a low one. World sprites with a perspective camera over the xz ground; a 2D camera sees the ground edge on. |
|
|
2974
|
+
| `dropShadowHeight` | `number` | `0` | — | `m` | — | The height of the level ground the drop shadow lies on (a floor, a deck, a step). Where an og.Terrain under the sprite's anchor is higher, the shadow lies on the terrain instead, on the plane fitted to its slope under the shadow, or bent over a hollow or a ridge narrower than the shadow (the terrain's heights under a 4 x 2 grid of the shadow's cells). 0 with no terrain is the ground plane y = 0. |
|
|
2975
|
+
| `toneMapped` | `boolean` | `true` | — | — | — | As three.js Material.toneMapped: true draws the sprite into the lit scene, carried by exposure (auto exposure included), bloom and the tone curve like any surface. false keeps its colours as given: still placed in the world, depth tested and sorted with the other sprites, but shown unexposed and uncurved (clamped to 0 to 1), outside bloom and fog; the grade, vignette, grain and screen flash still apply. For world UI that must read the same at noon and at dusk: speech bubbles, name tags, markers. Alpha blending only: an additive sprite adds light and is always tone mapped. |
|
|
2976
|
+
| `flipX` | `boolean` | `false` | — | — | — | Mirror the region left to right. |
|
|
2977
|
+
| `flipY` | `boolean` | `false` | — | — | — | Mirror the region top to bottom. |
|
|
2978
|
+
| `sortY` | `boolean` | `false` | — | — | — | Within its layer, draw by y: lower on the screen draws in front (top-down games). |
|
|
2979
|
+
| `slice` | `[number, number, number, number] \| null` | `null` | — | — | — | Nine-slice: [left, top, right, bottom] insets in texture pixels of the region; the corners keep their size (sliceScale world units per pixel), edges and centre stretch. null draws it whole. |
|
|
2980
|
+
| `sliceScale` | `number` | `0.0625` | ≥ 0 | — | — | Nine-slice: world units (CSS pixels on screen) per texture pixel of the insets. |
|
|
2981
|
+
| `screen` | `boolean` | `false` | — | — | — | Draw in screen space over the finished frame instead of the world: position x, y in CSS pixels from the top left with y down, width and height in CSS pixels, anchor from the top left, rotation clockwise; never tone mapped, blurred or depth tested (a HUD). flash, glow, blend and castShadow apply to world sprites only. With og.ui: under every UI element at a layer up to UI_LAYER (1000), over every one above it. |
|
|
2982
|
+
| `clip` | `[number, number, number, number] \| null` | `null` | — | — | — | Screen sprites: cut to [x, y, width, height] in CSS pixels; null draws it whole. |
|
|
2983
|
+
|
|
2984
|
+
```ogt
|
|
2985
|
+
struct SpriteDesc {
|
|
2986
|
+
doc "A textured or solid quad in the world's xy plane facing +z, drawn this frame only (immediate mode, as og.render.text): submit it every tick it should show. Sprites and text are sorted by layer and drawn over the 3D scene."
|
|
2987
|
+
desc true
|
|
2988
|
+
field texture Option.Texture "The texture from og.load.texture; null draws a solid quad of the colour."
|
|
2989
|
+
field array Option.TextureArray "Draw from a layer of this texture array (og.load.textureArray) instead of `texture`: every sprite of one array is one draw whichever layer each shows, so a flipbook's frames packed as layers batch across frames. World and screen sprites alike, with flash, glow, blend and 2D lighting as a textured sprite. null uses `texture`."
|
|
2990
|
+
field arrayLayer u32 "With `array`: the layer drawn, 0 to the array's layers minus 1 (refused past it). `uv` is the region within the layer."
|
|
2991
|
+
field position Vector3 "Where the anchor point is." {
|
|
2992
|
+
unit m
|
|
2993
|
+
}
|
|
2994
|
+
field width f32 "Its width in world units." {
|
|
2995
|
+
default 1
|
|
2996
|
+
min 0
|
|
2997
|
+
unit m
|
|
2998
|
+
}
|
|
2999
|
+
field height f32 "Its height in world units." {
|
|
3000
|
+
default 1
|
|
3001
|
+
min 0
|
|
3002
|
+
unit m
|
|
3003
|
+
}
|
|
3004
|
+
field anchor Vector2 "The point of the quad at `position`, as a fraction of its size from the bottom-left corner: (0.5, 0.5) is the centre." {
|
|
3005
|
+
default 0.5 0.5
|
|
3006
|
+
}
|
|
3007
|
+
field rotation f32 "Counter-clockwise rotation about the anchor." {
|
|
3008
|
+
unit rad
|
|
3009
|
+
}
|
|
3010
|
+
field color Color "A linear colour multiplied with the texture." {
|
|
3011
|
+
default 1 1 1
|
|
3012
|
+
}
|
|
3013
|
+
field opacity f32 "The alpha." {
|
|
3014
|
+
default 1
|
|
3015
|
+
min 0
|
|
3016
|
+
max 1
|
|
3017
|
+
}
|
|
3018
|
+
field uv Option.Array.f32.4 "The texture region drawn, [u0, v0, u1, v1] with v down; null is the whole texture (a sheet's frame for animation)."
|
|
3019
|
+
field layer i32 "Draw order among sprites and text; higher draws on top."
|
|
3020
|
+
field flash f32 "A hit flash: the colour mixed towards flashColor by this much, keeping the alpha." {
|
|
3021
|
+
min 0
|
|
3022
|
+
max 1
|
|
3023
|
+
}
|
|
3024
|
+
field flashColor Color "The flash's linear colour." {
|
|
3025
|
+
default 1 1 1
|
|
3026
|
+
}
|
|
3027
|
+
field glow f32 "Strength in the 2D glow buffer (PostEffects.glow); 0 none." {
|
|
3028
|
+
min 0
|
|
3029
|
+
}
|
|
3030
|
+
field blend SpriteBlend "Alpha or additive."
|
|
3031
|
+
field castShadow bool "Block 2D light (Lighting2D) with the sprite's rectangle."
|
|
3032
|
+
field dropShadow f32 "A drop shadow this dark (0 none, 0.5 typical): the sprite's shape in black, flattened along the sun (the first og.DirectionalLight) onto the ground under it (dropShadowHeight, or the og.Terrain there), drawn before every sprite of its layer: pixel sprites standing in a 3D set cast shadows that agree with it. Where the ground already lies in the sun's cascaded shadow the drop shadow fades, so a shadow inside a shadow is no darker. None with the sun below the horizon; at most five times the sprite's height long under a low one. World sprites with a perspective camera over the xz ground; a 2D camera sees the ground edge on." {
|
|
3033
|
+
min 0
|
|
3034
|
+
max 1
|
|
3035
|
+
}
|
|
3036
|
+
field dropShadowHeight f32 "The height of the level ground the drop shadow lies on (a floor, a deck, a step). Where an og.Terrain under the sprite's anchor is higher, the shadow lies on the terrain instead, on the plane fitted to its slope under the shadow, or bent over a hollow or a ridge narrower than the shadow (the terrain's heights under a 4 x 2 grid of the shadow's cells). 0 with no terrain is the ground plane y = 0." {
|
|
3037
|
+
unit m
|
|
3038
|
+
}
|
|
3039
|
+
field toneMapped bool "As three.js Material.toneMapped: true draws the sprite into the lit scene, carried by exposure (auto exposure included), bloom and the tone curve like any surface. false keeps its colours as given: still placed in the world, depth tested and sorted with the other sprites, but shown unexposed and uncurved (clamped to 0 to 1), outside bloom and fog; the grade, vignette, grain and screen flash still apply. For world UI that must read the same at noon and at dusk: speech bubbles, name tags, markers. Alpha blending only: an additive sprite adds light and is always tone mapped." {
|
|
3040
|
+
default true
|
|
3041
|
+
}
|
|
3042
|
+
field flipX bool "Mirror the region left to right."
|
|
3043
|
+
field flipY bool "Mirror the region top to bottom."
|
|
3044
|
+
field sortY bool "Within its layer, draw by y: lower on the screen draws in front (top-down games)."
|
|
3045
|
+
field slice Option.Array.f32.4 "Nine-slice: [left, top, right, bottom] insets in texture pixels of the region; the corners keep their size (sliceScale world units per pixel), edges and centre stretch. null draws it whole."
|
|
3046
|
+
field sliceScale f32 "Nine-slice: world units (CSS pixels on screen) per texture pixel of the insets." {
|
|
3047
|
+
default 0.0625
|
|
3048
|
+
min 0
|
|
3049
|
+
}
|
|
3050
|
+
field screen bool "Draw in screen space over the finished frame instead of the world: position x, y in CSS pixels from the top left with y down, width and height in CSS pixels, anchor from the top left, rotation clockwise; never tone mapped, blurred or depth tested (a HUD). flash, glow, blend and castShadow apply to world sprites only. With og.ui: under every UI element at a layer up to UI_LAYER (1000), over every one above it."
|
|
3051
|
+
field clip Option.Array.f32.4 "Screen sprites: cut to [x, y, width, height] in CSS pixels; null draws it whole."
|
|
3052
|
+
}
|
|
3053
|
+
```
|
|
3054
|
+
|
|
3055
|
+
<sub>`api.ogt` line 2933</sub>
|
|
3056
|
+
|
|
3057
|
+
<a id="type-FloatingTextDesc"></a>
|
|
3058
|
+
|
|
3059
|
+
### `FloatingTextDesc` (desc struct)
|
|
3060
|
+
|
|
3061
|
+
A damage number or pickup text that pops at a point, rises, spreads and fades by itself (no per-tick submission). Deterministic: its drift comes from the tick and its order, and it is world state (the og.sprite state block).
|
|
3062
|
+
|
|
3063
|
+
A desc: every field may be omitted and takes its default; `{}` is valid.
|
|
3064
|
+
|
|
3065
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
3066
|
+
|---|---|---|---|---|---|---|
|
|
3067
|
+
| `text` | `string` | `""` | — | — | — | The text, such as `-12` or `+1 key`. |
|
|
3068
|
+
| `position` | `Vector3` | `{ x: 0, y: 0, z: 0 }` | — | `m` | — | Where it appears (above a hit, usually). |
|
|
3069
|
+
| `font` | `Font \| null` | `null` | — | — | — | The font; null uses the UI's body font. |
|
|
3070
|
+
| `size` | `number` | `0.5` | ≥ 0 | `m` | — | The em size in world units. |
|
|
3071
|
+
| `color` | `Color` | `{ r: 1, g: 1, b: 1 }` | — | — | — | The linear fill colour. |
|
|
3072
|
+
| `outline` | `number` | `0.6` | 0 … 1 | — | — | The outline's width as a fraction of the font's distance range (0 none). |
|
|
3073
|
+
| `outlineColor` | `Color` | `{ r: 0.02, g: 0.02, b: 0.03 }` | — | — | — | The outline's linear colour. |
|
|
3074
|
+
| `rise` | `number` | `1` | — | `m` | — | How far it climbs over its life. |
|
|
3075
|
+
| `spread` | `number` | `0.3` | ≥ 0 | `m` | — | The largest sideways drift, left or right. |
|
|
3076
|
+
| `lifetime` | `number` | `0.8` | ≥ 0.05 | `s` | — | How long it shows. |
|
|
3077
|
+
| `fade` | `number` | `0.4` | 0 … 1 | `ratio` | — | The last part of its life it fades over. |
|
|
3078
|
+
| `pop` | `number` | `0.4` | ≥ 0 | — | — | How much bigger it starts, settling to its size in the first fifth of its life. |
|
|
3079
|
+
| `crit` | `boolean` | `false` | — | — | — | A critical hit: critScale times bigger, a stronger pop. |
|
|
3080
|
+
| `critScale` | `number` | `1.6` | ≥ 1 | — | — | The size of a crit. |
|
|
3081
|
+
| `layer` | `number` | `100` | — | — | — | The sprite layer (above the action). |
|
|
3082
|
+
|
|
3083
|
+
```ogt
|
|
3084
|
+
struct FloatingTextDesc {
|
|
3085
|
+
doc "A damage number or pickup text that pops at a point, rises, spreads and fades by itself (no per-tick submission). Deterministic: its drift comes from the tick and its order, and it is world state (the og.sprite state block)."
|
|
3086
|
+
desc true
|
|
3087
|
+
field text String "The text, such as `-12` or `+1 key`."
|
|
3088
|
+
field position Vector3 "Where it appears (above a hit, usually)." {
|
|
3089
|
+
unit m
|
|
3090
|
+
}
|
|
3091
|
+
field font Option.Font "The font; null uses the UI's body font."
|
|
3092
|
+
field size f32 "The em size in world units." {
|
|
3093
|
+
default 0.5
|
|
3094
|
+
min 0
|
|
3095
|
+
unit m
|
|
3096
|
+
}
|
|
3097
|
+
field color Color "The linear fill colour." {
|
|
3098
|
+
default 1 1 1
|
|
3099
|
+
}
|
|
3100
|
+
field outline f32 "The outline's width as a fraction of the font's distance range (0 none)." {
|
|
3101
|
+
default 0.6
|
|
3102
|
+
min 0
|
|
3103
|
+
max 1
|
|
3104
|
+
}
|
|
3105
|
+
field outlineColor Color "The outline's linear colour." {
|
|
3106
|
+
default 0.02 0.02 0.03
|
|
3107
|
+
}
|
|
3108
|
+
field rise f32 "How far it climbs over its life." {
|
|
3109
|
+
default 1
|
|
3110
|
+
unit m
|
|
3111
|
+
}
|
|
3112
|
+
field spread f32 "The largest sideways drift, left or right." {
|
|
3113
|
+
default 0.3
|
|
3114
|
+
min 0
|
|
3115
|
+
unit m
|
|
3116
|
+
}
|
|
3117
|
+
field lifetime f32 "How long it shows." {
|
|
3118
|
+
default 0.8
|
|
3119
|
+
min 0.05
|
|
3120
|
+
unit s
|
|
3121
|
+
}
|
|
3122
|
+
field fade f32 "The last part of its life it fades over." {
|
|
3123
|
+
default 0.4
|
|
3124
|
+
min 0
|
|
3125
|
+
max 1
|
|
3126
|
+
unit ratio
|
|
3127
|
+
}
|
|
3128
|
+
field pop f32 "How much bigger it starts, settling to its size in the first fifth of its life." {
|
|
3129
|
+
default 0.4
|
|
3130
|
+
min 0
|
|
3131
|
+
}
|
|
3132
|
+
field crit bool "A critical hit: critScale times bigger, a stronger pop."
|
|
3133
|
+
field critScale f32 "The size of a crit." {
|
|
3134
|
+
default 1.6
|
|
3135
|
+
min 1
|
|
3136
|
+
}
|
|
3137
|
+
field layer i32 "The sprite layer (above the action)." {
|
|
3138
|
+
default 100
|
|
3139
|
+
}
|
|
3140
|
+
}
|
|
3141
|
+
```
|
|
3142
|
+
|
|
3143
|
+
<sub>`api.ogt` line 3121</sub>
|
|
3144
|
+
|
|
3145
|
+
<a id="type-BoxGeometryDesc"></a>
|
|
3146
|
+
|
|
3147
|
+
### `BoxGeometryDesc` (desc struct)
|
|
3148
|
+
|
|
3149
|
+
A box centred at the origin, as three.js BoxGeometry(width, height, depth).
|
|
3150
|
+
|
|
3151
|
+
A desc: every field may be omitted and takes its default; `{}` is valid.
|
|
3152
|
+
|
|
3153
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
3154
|
+
|---|---|---|---|---|---|---|
|
|
3155
|
+
| `width` | `number` | `1` | ≥ 0 | `m` | — | Its extent along x. |
|
|
3156
|
+
| `height` | `number` | `1` | ≥ 0 | `m` | — | Its extent along y. |
|
|
3157
|
+
| `depth` | `number` | `1` | ≥ 0 | `m` | — | Its extent along z. |
|
|
3158
|
+
| `uvRepeat` | `Vector2` | `{ x: 1, y: 1 }` | — | — | — | How many times a texture repeats across it, along u and v: its UVs run 0 to uvRepeat instead of 0 to 1 (three.js texture.repeat, here on the geometry; material textures sample with repeat wrapping). A ground grid every 10 m on a 1,600 m plane is uvRepeat 160 160. |
|
|
3159
|
+
|
|
3160
|
+
```ogt
|
|
3161
|
+
struct BoxGeometryDesc {
|
|
3162
|
+
doc "A box centred at the origin, as three.js BoxGeometry(width, height, depth)."
|
|
3163
|
+
desc true
|
|
3164
|
+
field width f32 "Its extent along x." {
|
|
3165
|
+
default 1
|
|
3166
|
+
min 0
|
|
3167
|
+
unit m
|
|
3168
|
+
}
|
|
3169
|
+
field height f32 "Its extent along y." {
|
|
3170
|
+
default 1
|
|
3171
|
+
min 0
|
|
3172
|
+
unit m
|
|
3173
|
+
}
|
|
3174
|
+
field depth f32 "Its extent along z." {
|
|
3175
|
+
default 1
|
|
3176
|
+
min 0
|
|
3177
|
+
unit m
|
|
3178
|
+
}
|
|
3179
|
+
field uvRepeat Vector2 "How many times a texture repeats across it, along u and v: its UVs run 0 to uvRepeat instead of 0 to 1 (three.js texture.repeat, here on the geometry; material textures sample with repeat wrapping). A ground grid every 10 m on a 1,600 m plane is uvRepeat 160 160." {
|
|
3180
|
+
default 1 1
|
|
3181
|
+
}
|
|
3182
|
+
}
|
|
3183
|
+
```
|
|
3184
|
+
|
|
3185
|
+
<sub>`api.ogt` line 3193</sub>
|
|
3186
|
+
|
|
3187
|
+
<a id="type-PlaneGeometryDesc"></a>
|
|
3188
|
+
|
|
3189
|
+
### `PlaneGeometryDesc` (desc struct)
|
|
3190
|
+
|
|
3191
|
+
A rectangle in the xy plane facing +z, centred at the origin, as three.js PlaneGeometry(width, height); turn it -pi/2 about x for a floor.
|
|
3192
|
+
|
|
3193
|
+
A desc: every field may be omitted and takes its default; `{}` is valid.
|
|
3194
|
+
|
|
3195
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
3196
|
+
|---|---|---|---|---|---|---|
|
|
3197
|
+
| `width` | `number` | `1` | ≥ 0 | `m` | — | Its extent along x. |
|
|
3198
|
+
| `height` | `number` | `1` | ≥ 0 | `m` | — | Its extent along y. |
|
|
3199
|
+
| `uvRepeat` | `Vector2` | `{ x: 1, y: 1 }` | — | — | — | How many times a texture repeats across it, along u and v: its UVs run 0 to uvRepeat instead of 0 to 1 (three.js texture.repeat, here on the geometry; material textures sample with repeat wrapping). A ground grid every 10 m on a 1,600 m plane is uvRepeat 160 160. |
|
|
3200
|
+
|
|
3201
|
+
```ogt
|
|
3202
|
+
struct PlaneGeometryDesc {
|
|
3203
|
+
doc "A rectangle in the xy plane facing +z, centred at the origin, as three.js PlaneGeometry(width, height); turn it -pi/2 about x for a floor."
|
|
3204
|
+
desc true
|
|
3205
|
+
field width f32 "Its extent along x." {
|
|
3206
|
+
default 1
|
|
3207
|
+
min 0
|
|
3208
|
+
unit m
|
|
3209
|
+
}
|
|
3210
|
+
field height f32 "Its extent along y." {
|
|
3211
|
+
default 1
|
|
3212
|
+
min 0
|
|
3213
|
+
unit m
|
|
3214
|
+
}
|
|
3215
|
+
field uvRepeat Vector2 "How many times a texture repeats across it, along u and v: its UVs run 0 to uvRepeat instead of 0 to 1 (three.js texture.repeat, here on the geometry; material textures sample with repeat wrapping). A ground grid every 10 m on a 1,600 m plane is uvRepeat 160 160." {
|
|
3216
|
+
default 1 1
|
|
3217
|
+
}
|
|
3218
|
+
}
|
|
3219
|
+
```
|
|
3220
|
+
|
|
3221
|
+
<sub>`api.ogt` line 3216</sub>
|
|
3222
|
+
|
|
3223
|
+
<a id="type-SphereGeometryDesc"></a>
|
|
3224
|
+
|
|
3225
|
+
### `SphereGeometryDesc` (desc struct)
|
|
3226
|
+
|
|
3227
|
+
A UV sphere centred at the origin, as three.js SphereGeometry(radius, widthSegments, heightSegments).
|
|
3228
|
+
|
|
3229
|
+
A desc: every field may be omitted and takes its default; `{}` is valid.
|
|
3230
|
+
|
|
3231
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
3232
|
+
|---|---|---|---|---|---|---|
|
|
3233
|
+
| `radius` | `number` | `1` | ≥ 0 | `m` | — | Its radius. |
|
|
3234
|
+
| `widthSegments` | `number` | `32` | ≥ 3 | — | — | Segments around the equator. |
|
|
3235
|
+
| `heightSegments` | `number` | `16` | ≥ 2 | — | — | Rings from pole to pole. |
|
|
3236
|
+
| `uvRepeat` | `Vector2` | `{ x: 1, y: 1 }` | — | — | — | How many times a texture repeats across it, along u and v: its UVs run 0 to uvRepeat instead of 0 to 1 (three.js texture.repeat, here on the geometry; material textures sample with repeat wrapping). A ground grid every 10 m on a 1,600 m plane is uvRepeat 160 160. |
|
|
3237
|
+
|
|
3238
|
+
```ogt
|
|
3239
|
+
struct SphereGeometryDesc {
|
|
3240
|
+
doc "A UV sphere centred at the origin, as three.js SphereGeometry(radius, widthSegments, heightSegments)."
|
|
3241
|
+
desc true
|
|
3242
|
+
field radius f32 "Its radius." {
|
|
3243
|
+
default 1
|
|
3244
|
+
min 0
|
|
3245
|
+
unit m
|
|
3246
|
+
}
|
|
3247
|
+
field widthSegments u32 "Segments around the equator." {
|
|
3248
|
+
default 32
|
|
3249
|
+
min 3
|
|
3250
|
+
}
|
|
3251
|
+
field heightSegments u32 "Rings from pole to pole." {
|
|
3252
|
+
default 16
|
|
3253
|
+
min 2
|
|
3254
|
+
}
|
|
3255
|
+
field uvRepeat Vector2 "How many times a texture repeats across it, along u and v: its UVs run 0 to uvRepeat instead of 0 to 1 (three.js texture.repeat, here on the geometry; material textures sample with repeat wrapping). A ground grid every 10 m on a 1,600 m plane is uvRepeat 160 160." {
|
|
3256
|
+
default 1 1
|
|
3257
|
+
}
|
|
3258
|
+
}
|
|
3259
|
+
```
|
|
3260
|
+
|
|
3261
|
+
<sub>`api.ogt` line 3234</sub>
|
|
3262
|
+
|
|
3263
|
+
<a id="type-RenderCapabilities"></a>
|
|
3264
|
+
|
|
3265
|
+
### `RenderCapabilities` (struct)
|
|
3266
|
+
|
|
3267
|
+
What the renderer can do on this device. Backend limits are reported here, never by missing members.
|
|
3268
|
+
|
|
3269
|
+
| Field | Type | Default | Range | Unit | Notes | Doc |
|
|
3270
|
+
|---|---|---|---|---|---|---|
|
|
3271
|
+
| `tier` | `RenderTier` | `"webgpu"` | — | — | — | The backend. |
|
|
3272
|
+
| `compute` | `boolean` | `false` | — | — | — | Whether compute passes run (GPU culling, GPU particles). |
|
|
3273
|
+
| `antialias` | `Antialias` | `"tier"` | — | — | — | The antialiasing the device resolved RenderOptions.antialias to. |
|
|
3274
|
+
| `maxLights` | `number` | `0` | — | — | — | How many point and spot lights one frame draws (MAX_LIGHTS on every tier). |
|
|
3275
|
+
| `maxShadowedLights` | `number` | `0` | — | — | — | How many point and spot lights cast shadows in one frame (8 on the full tier, 4 on WebGL2); past it, the shadowed lights brightest at the camera keep theirs. |
|
|
3276
|
+
| `pointShadows` | `PointShadows` | `"auto"` | — | — | — | How point lights' shadows are stored on this device: cube or paraboloid (what RenderOptions.pointShadows resolved to). |
|
|
3277
|
+
| `width` | `number` | `0` | — | — | — | The render target width in device pixels. |
|
|
3278
|
+
| `height` | `number` | `0` | — | — | — | The render target height in device pixels. |
|
|
3279
|
+
| `stylise` | `readonly string[]` | `[]` | — | — | — | The Stylise and MaterialStyle primitives this renderer draws, by group: pixel, posterize, palette, dither, halftone, hatching, paint, ink, inkDepth, depthBands, retro3d, surfaceSpace (paintCanvasSpace, hatchingSpace and halftoneSpace surface) and objectSpace (the same object) of Stylise; toon, shadowTint, rim, outline, outlineDistance and flatShading of MaterialStyle. A look that uses one this list lacks still applies; that primitive is not drawn. |
|
|
3280
|
+
|
|
3281
|
+
```ogt
|
|
3282
|
+
struct RenderCapabilities {
|
|
3283
|
+
doc "What the renderer can do on this device. Backend limits are reported here, never by missing members."
|
|
3284
|
+
field tier RenderTier "The backend."
|
|
3285
|
+
field compute bool "Whether compute passes run (GPU culling, GPU particles)."
|
|
3286
|
+
field antialias Antialias "The antialiasing the device resolved RenderOptions.antialias to."
|
|
3287
|
+
field maxLights u32 "How many point and spot lights one frame draws (MAX_LIGHTS on every tier)."
|
|
3288
|
+
field maxShadowedLights u32 "How many point and spot lights cast shadows in one frame (8 on the full tier, 4 on WebGL2); past it, the shadowed lights brightest at the camera keep theirs."
|
|
3289
|
+
field pointShadows PointShadows "How point lights' shadows are stored on this device: cube or paraboloid (what RenderOptions.pointShadows resolved to)."
|
|
3290
|
+
field width u32 "The render target width in device pixels."
|
|
3291
|
+
field height u32 "The render target height in device pixels."
|
|
3292
|
+
field stylise List.String "The Stylise and MaterialStyle primitives this renderer draws, by group: pixel, posterize, palette, dither, halftone, hatching, paint, ink, inkDepth, depthBands, retro3d, surfaceSpace (paintCanvasSpace, hatchingSpace and halftoneSpace surface) and objectSpace (the same object) of Stylise; toon, shadowTint, rim, outline, outlineDistance and flatShading of MaterialStyle. A look that uses one this list lacks still applies; that primitive is not drawn."
|
|
3293
|
+
}
|
|
3294
|
+
```
|
|
3295
|
+
|
|
3296
|
+
<sub>`api.ogt` line 3280</sub>
|
|
3297
|
+
|
|
3298
|
+
<a id="type-Shader"></a>
|
|
3299
|
+
|
|
3300
|
+
### `Shader` (handle)
|
|
3301
|
+
|
|
3302
|
+
A material shader from og.load.shader (an `.ogt` of `type shader`): WGSL hooks of the lit shader and the parameters they read.
|
|
3303
|
+
|
|
3304
|
+
A generational handle: a number the engine hands out. A dead handle is an error value, never a crash.
|
|
3305
|
+
|
|
3306
|
+
```ogt
|
|
3307
|
+
handle Shader "A material shader from og.load.shader (an `.ogt` of `type shader`): WGSL hooks of the lit shader and the parameters they read."
|
|
3308
|
+
```
|
|
3309
|
+
|
|
3310
|
+
<sub>`api.ogt` line 3308</sub>
|
|
3311
|
+
|
|
3312
|
+
## Column kinds
|
|
3313
|
+
|
|
3314
|
+
Each is a factory, `Geometry(value?, options?)`, that makes one field of a component or resource layout.
|
|
3315
|
+
|
|
3316
|
+
| Column | Value | Typed array | Stride | Doc |
|
|
3317
|
+
|---|---|---|---|---|
|
|
3318
|
+
| <a id="column-Geometry"></a>`Geometry` | `Geometry` | `Uint32Array` | 2 | A Geometry handle field. |
|
|
3319
|
+
| <a id="column-Material"></a>`Material` | `Material` | `Uint32Array` | 2 | A Material handle field. |
|
|
3320
|
+
| <a id="column-ToneMapping"></a>`ToneMapping` | `ToneMapping` | `Uint32Array` | 1 | A ToneMapping field: the variant's index. |
|
|
3321
|
+
| <a id="column-Texture"></a>`Texture` | `Texture` | `Uint32Array` | 2 | A Texture handle field (0 is none). |
|
|
3322
|
+
| <a id="column-Lut"></a>`Lut` | `Lut` | `Uint32Array` | 2 | A Lut handle field (0 is none). |
|
|
3323
|
+
| <a id="column-EnvironmentMap"></a>`EnvironmentMap` | `EnvironmentMap` | `Uint32Array` | 2 | An EnvironmentMap handle field (0 is none). |
|
|
3324
|
+
| <a id="column-ParticleEmitter"></a>`ParticleEmitter` | `ParticleEmitter` | `Uint32Array` | 2 | A ParticleEmitter handle field (0 is none). |
|
|
3325
|
+
| <a id="column-AoMethod"></a>`AoMethod` | `AoMethod` | `Uint32Array` | 1 | An AoMethod field: the variant's index. |
|
|
3326
|
+
| <a id="column-DofQuality"></a>`DofQuality` | `DofQuality` | `Uint32Array` | 1 | A DofQuality field: the variant's index. |
|
|
3327
|
+
| <a id="column-SpriteBlend"></a>`SpriteBlend` | `SpriteBlend` | `Uint32Array` | 1 | A SpriteBlend field: the variant's index. |
|
|
3328
|
+
| <a id="column-StripBlend"></a>`StripBlend` | `StripBlend` | `Uint32Array` | 1 | A StripBlend field: the variant's index. |
|
|
3329
|
+
| <a id="column-Palette"></a>`Palette` | `Palette` | `Uint32Array` | 2 | A Palette handle field (0 is none). |
|
|
3330
|
+
| <a id="column-DitherPattern"></a>`DitherPattern` | `DitherPattern` | `Uint32Array` | 1 | A DitherPattern field: the variant's index. |
|
|
3331
|
+
| <a id="column-StyliseSpace"></a>`StyliseSpace` | `StyliseSpace` | `Uint32Array` | 1 | A StyliseSpace field: the variant's index. |
|
|
3332
|
+
|
|
3333
|
+
```ogt
|
|
3334
|
+
column Geometry {
|
|
3335
|
+
doc "A Geometry handle field."
|
|
3336
|
+
array Uint32Array
|
|
3337
|
+
stride 2
|
|
3338
|
+
value Geometry
|
|
3339
|
+
}
|
|
3340
|
+
```
|
|
3341
|
+
|
|
3342
|
+
<sub>`api.ogt` line 1657</sub>
|
|
3343
|
+
|
|
3344
|
+
```ogt
|
|
3345
|
+
column Material {
|
|
3346
|
+
doc "A Material handle field."
|
|
3347
|
+
array Uint32Array
|
|
3348
|
+
stride 2
|
|
3349
|
+
value Material
|
|
3350
|
+
}
|
|
3351
|
+
```
|
|
3352
|
+
|
|
3353
|
+
<sub>`api.ogt` line 1664</sub>
|
|
3354
|
+
|
|
3355
|
+
```ogt
|
|
3356
|
+
column ToneMapping {
|
|
3357
|
+
doc "A ToneMapping field: the variant's index."
|
|
3358
|
+
array Uint32Array
|
|
3359
|
+
stride 1
|
|
3360
|
+
value ToneMapping
|
|
3361
|
+
}
|
|
3362
|
+
```
|
|
3363
|
+
|
|
3364
|
+
<sub>`api.ogt` line 2023</sub>
|
|
3365
|
+
|
|
3366
|
+
```ogt
|
|
3367
|
+
column Texture {
|
|
3368
|
+
doc "A Texture handle field (0 is none)."
|
|
3369
|
+
array Uint32Array
|
|
3370
|
+
stride 2
|
|
3371
|
+
value Texture
|
|
3372
|
+
}
|
|
3373
|
+
```
|
|
3374
|
+
|
|
3375
|
+
<sub>`api.ogt` line 2085</sub>
|
|
3376
|
+
|
|
3377
|
+
```ogt
|
|
3378
|
+
column Lut {
|
|
3379
|
+
doc "A Lut handle field (0 is none)."
|
|
3380
|
+
array Uint32Array
|
|
3381
|
+
stride 2
|
|
3382
|
+
value Lut
|
|
3383
|
+
}
|
|
3384
|
+
```
|
|
3385
|
+
|
|
3386
|
+
<sub>`api.ogt` line 2092</sub>
|
|
3387
|
+
|
|
3388
|
+
```ogt
|
|
3389
|
+
column EnvironmentMap {
|
|
3390
|
+
doc "An EnvironmentMap handle field (0 is none)."
|
|
3391
|
+
array Uint32Array
|
|
3392
|
+
stride 2
|
|
3393
|
+
value EnvironmentMap
|
|
3394
|
+
}
|
|
3395
|
+
```
|
|
3396
|
+
|
|
3397
|
+
<sub>`api.ogt` line 2099</sub>
|
|
3398
|
+
|
|
3399
|
+
```ogt
|
|
3400
|
+
column ParticleEmitter {
|
|
3401
|
+
doc "A ParticleEmitter handle field (0 is none)."
|
|
3402
|
+
array Uint32Array
|
|
3403
|
+
stride 2
|
|
3404
|
+
value ParticleEmitter
|
|
3405
|
+
}
|
|
3406
|
+
```
|
|
3407
|
+
|
|
3408
|
+
<sub>`api.ogt` line 2126</sub>
|
|
3409
|
+
|
|
3410
|
+
```ogt
|
|
3411
|
+
column AoMethod {
|
|
3412
|
+
doc "An AoMethod field: the variant's index."
|
|
3413
|
+
array Uint32Array
|
|
3414
|
+
stride 1
|
|
3415
|
+
value AoMethod
|
|
3416
|
+
}
|
|
3417
|
+
```
|
|
3418
|
+
|
|
3419
|
+
<sub>`api.ogt` line 2140</sub>
|
|
3420
|
+
|
|
3421
|
+
```ogt
|
|
3422
|
+
column DofQuality {
|
|
3423
|
+
doc "A DofQuality field: the variant's index."
|
|
3424
|
+
array Uint32Array
|
|
3425
|
+
stride 1
|
|
3426
|
+
value DofQuality
|
|
3427
|
+
}
|
|
3428
|
+
```
|
|
3429
|
+
|
|
3430
|
+
<sub>`api.ogt` line 2153</sub>
|
|
3431
|
+
|
|
3432
|
+
```ogt
|
|
3433
|
+
column SpriteBlend {
|
|
3434
|
+
doc "A SpriteBlend field: the variant's index."
|
|
3435
|
+
array Uint32Array
|
|
3436
|
+
stride 1
|
|
3437
|
+
value SpriteBlend
|
|
3438
|
+
}
|
|
3439
|
+
```
|
|
3440
|
+
|
|
3441
|
+
<sub>`api.ogt` line 2166</sub>
|
|
3442
|
+
|
|
3443
|
+
```ogt
|
|
3444
|
+
column StripBlend {
|
|
3445
|
+
doc "A StripBlend field: the variant's index."
|
|
3446
|
+
array Uint32Array
|
|
3447
|
+
stride 1
|
|
3448
|
+
value StripBlend
|
|
3449
|
+
}
|
|
3450
|
+
```
|
|
3451
|
+
|
|
3452
|
+
<sub>`api.ogt` line 2179</sub>
|
|
3453
|
+
|
|
3454
|
+
```ogt
|
|
3455
|
+
column Palette {
|
|
3456
|
+
doc "A Palette handle field (0 is none)."
|
|
3457
|
+
array Uint32Array
|
|
3458
|
+
stride 2
|
|
3459
|
+
value Palette
|
|
3460
|
+
}
|
|
3461
|
+
```
|
|
3462
|
+
|
|
3463
|
+
<sub>`api.ogt` line 2366</sub>
|
|
3464
|
+
|
|
3465
|
+
```ogt
|
|
3466
|
+
column DitherPattern {
|
|
3467
|
+
doc "A DitherPattern field: the variant's index."
|
|
3468
|
+
array Uint32Array
|
|
3469
|
+
stride 1
|
|
3470
|
+
value DitherPattern
|
|
3471
|
+
}
|
|
3472
|
+
```
|
|
3473
|
+
|
|
3474
|
+
<sub>`api.ogt` line 2383</sub>
|
|
3475
|
+
|
|
3476
|
+
```ogt
|
|
3477
|
+
column StyliseSpace {
|
|
3478
|
+
doc "A StyliseSpace field: the variant's index."
|
|
3479
|
+
array Uint32Array
|
|
3480
|
+
stride 1
|
|
3481
|
+
value StyliseSpace
|
|
3482
|
+
}
|
|
3483
|
+
```
|
|
3484
|
+
|
|
3485
|
+
<sub>`api.ogt` line 2397</sub>
|
|
3486
|
+
|
|
3487
|
+
## Constants
|
|
3488
|
+
|
|
3489
|
+
| Constant | Type | Value | Doc |
|
|
3490
|
+
|---|---|---|---|
|
|
3491
|
+
| <a id="const-MAX_LIGHTS"></a>`MAX_LIGHTS` | `number` | `256` | The most point and spot lights one frame draws, among those in view; past it the ones brightest at the camera are kept. |
|
|
3492
|
+
| <a id="const-MAX_CLUSTER_LIGHTS"></a>`MAX_CLUSTER_LIGHTS` | `number` | `64` | The most point and spot lights that shade one screen cluster (a 1/16 by 1/9 tile of the view and one of 24 depth slices); past it the ones brightest at the camera are kept there. |
|
|
3493
|
+
| <a id="const-UI_LAYER"></a>`UI_LAYER` | `number` | `1000` | The UI's layer among screen sprites and screen text (SpriteDesc and TextDesc with screen): those at or below it draw under every og.ui element, those above it over every one, modals, toasts and the screen transition included (a HUD element made of sprites sitting on a UI panel: draw it only while its screen shows), in their layers' order either way. |
|
|
3494
|
+
|
|
3495
|
+
```ogt
|
|
3496
|
+
const MAX_LIGHTS u32 256 "The most point and spot lights one frame draws, among those in view; past it the ones brightest at the camera are kept."
|
|
3497
|
+
```
|
|
3498
|
+
|
|
3499
|
+
<sub>`api.ogt` line 3276</sub>
|
|
3500
|
+
|
|
3501
|
+
```ogt
|
|
3502
|
+
const MAX_CLUSTER_LIGHTS u32 64 "The most point and spot lights that shade one screen cluster (a 1/16 by 1/9 tile of the view and one of 24 depth slices); past it the ones brightest at the camera are kept there."
|
|
3503
|
+
```
|
|
3504
|
+
|
|
3505
|
+
<sub>`api.ogt` line 3277</sub>
|
|
3506
|
+
|
|
3507
|
+
```ogt
|
|
3508
|
+
const UI_LAYER i32 1000 "The UI's layer among screen sprites and screen text (SpriteDesc and TextDesc with screen): those at or below it draw under every og.ui element, those above it over every one, modals, toasts and the screen transition included (a HUD element made of sprites sitting on a UI panel: draw it only while its screen shows), in their layers' order either way."
|
|
3509
|
+
```
|
|
3510
|
+
|
|
3511
|
+
<sub>`api.ogt` line 3278</sub>
|