lecodes-sdk 1.1.0 → 2.0.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/README.md +5 -2
- package/dist/editor.d.ts +12 -0
- package/dist/global.d.ts +4 -8
- package/dist/host.d.ts +2 -3
- package/dist/types/animate/tween/Animation.d.ts +0 -3
- package/dist/types/animate/tween/animateValue.d.ts +4 -2
- package/dist/types/animate/tween/easing.d.ts +8 -0
- package/dist/types/animate/tween/spec.d.ts +15 -7
- package/dist/types/audio/audio.d.ts +2 -1
- package/dist/types/canvas/Canvas.d.ts +40 -108
- package/dist/types/canvas/gen/cssColor.d.ts +17 -0
- package/dist/types/canvas/gen/recorder.d.ts +118 -0
- package/dist/types/canvas/gen/spec.d.ts +144 -0
- package/dist/types/core/color.d.ts +3 -1
- package/dist/types/core/pins.d.ts +18 -0
- package/dist/types/g2/Node2D.d.ts +5 -8
- package/dist/types/g2/Scene2D.d.ts +6 -2
- package/dist/types/gl/Foliage.d.ts +30 -7
- package/dist/types/gl/Light.d.ts +11 -0
- package/dist/types/gl/Lightmap.d.ts +13 -2
- package/dist/types/gl/Material.d.ts +17 -3
- package/dist/types/gl/Model.d.ts +6 -2
- package/dist/types/gl/Node.d.ts +3 -6
- package/dist/types/gl/Particles.d.ts +15 -0
- package/dist/types/gl/Scene.d.ts +41 -13
- package/dist/types/gl/Texture.d.ts +1 -1
- package/dist/types/gl/animation/Locomotion.d.ts +59 -3
- package/dist/types/gl/terrain/Terrain.d.ts +8 -0
- package/dist/types/inject.d.ts +11 -11
- package/dist/types/inject.editor.d.ts +1 -0
- package/dist/types/net/core.d.ts +7 -0
- package/dist/types/plugin.d.ts +76 -0
- package/dist/types/plugins/gen/camera/sdk/camera.d.ts +24 -0
- package/dist/types/plugins/gen/camera/sdk/camera.gen.d.ts +25 -0
- package/dist/types/plugins/{geolocation.d.ts → gen/geolocation/sdk/geolocation.d.ts} +2 -20
- package/dist/types/plugins/gen/geolocation/sdk/geolocation.gen.d.ts +31 -0
- package/dist/types/plugins/{map.d.ts → gen/map/sdk/map.d.ts} +9 -50
- package/dist/types/plugins/gen/map/sdk/map.gen.d.ts +53 -0
- package/dist/types/plugins/gen/push/sdk/push.d.ts +23 -0
- package/dist/types/plugins/gen/push/sdk/push.gen.d.ts +35 -0
- package/dist/types/plugins/{qr.d.ts → gen/qr-scanner/sdk/qr-scanner.d.ts} +2 -3
- package/dist/types/plugins/gen/qr-scanner/sdk/qr-scanner.gen.d.ts +15 -0
- package/dist/types/runtime/app.d.ts +9 -2
- package/dist/types/runtime/fetch.d.ts +2 -0
- package/dist/types/runtime/input.d.ts +8 -1
- package/dist/types/runtime/media.d.ts +6 -10
- package/dist/types/runtime/misc.d.ts +4 -1
- package/dist/types/runtime/net.d.ts +3 -2
- package/dist/types/runtime/touch.d.ts +32 -0
- package/dist/types/scene/defineScene.d.ts +43 -2
- package/dist/types/scene/editor.d.ts +52 -0
- package/dist/types/scene/gizmos.d.ts +7 -4
- package/dist/types/ui/NativeView.d.ts +6 -4
- package/dist/types/ui/UI.d.ts +1 -1
- package/dist/types/ui/UIBottomSheet.d.ts +6 -12
- package/dist/types/ui/UIButton.d.ts +12 -14
- package/dist/types/ui/UIContainer.d.ts +0 -6
- package/dist/types/ui/UIImage.d.ts +1 -4
- package/dist/types/ui/UIInput.d.ts +8 -24
- package/dist/types/ui/UIModal.d.ts +0 -2
- package/dist/types/ui/UINode.d.ts +70 -56
- package/dist/types/ui/UIPager.d.ts +28 -27
- package/dist/types/ui/UIPopover.d.ts +0 -2
- package/dist/types/ui/UIScreen.d.ts +12 -17
- package/dist/types/ui/UIScrollable.d.ts +1 -4
- package/dist/types/ui/UIText.d.ts +0 -2
- package/dist/types/ui/UIVideo.d.ts +3 -5
- package/dist/types/ui/UIVirtualizedList.d.ts +14 -16
- package/dist/types/ui/UIWidget.d.ts +10 -9
- package/dist/types/ui/colorKeys.gen.d.ts +9 -0
- package/dist/types/ui/presentable.d.ts +46 -32
- package/dist/types/ui/router.d.ts +18 -7
- package/dist/types/ui/styleColor.d.ts +1 -0
- package/dist/types/ui/transitions.d.ts +18 -0
- package/dist/types/ui/tree.d.ts +75 -0
- package/dist/types/version.d.ts +10 -0
- package/dist/types.json +1 -1
- package/package.json +12 -3
- package/prompts/2d.md +2 -6
- package/prompts/3d.md +1 -5
- package/prompts/README.md +142 -142
- package/prompts/canvas.md +9 -8
- package/prompts/compose.ts +1 -1
- package/prompts/core.md +3 -3
- package/prompts/design.md +1 -1
- package/prompts/dist/2d-game.md +77 -54
- package/prompts/dist/3d-app.md +75 -52
- package/prompts/dist/ar-app.md +74 -51
- package/prompts/dist/design.md +30 -8
- package/prompts/dist/ui-app.md +73 -46
- package/prompts/ui-design.md +2 -3
- package/prompts/ui.md +45 -37
- package/src/animate/tween/Animation.ts +262 -378
- package/src/animate/tween/animateValue.ts +103 -100
- package/src/animate/tween/easing.ts +10 -3
- package/src/animate/tween/spec.ts +505 -479
- package/src/audio/Sound.ts +3 -3
- package/src/audio/audio.ts +162 -161
- package/src/bridges/2d.d.ts +317 -0
- package/src/bridges/app.d.ts +91 -0
- package/src/bridges/audio.d.ts +97 -0
- package/src/bridges/canvas.d.ts +79 -0
- package/src/bridges/device.d.ts +72 -0
- package/src/bridges/fetch.d.ts +80 -0
- package/src/bridges/files.d.ts +70 -0
- package/src/bridges/gl.d.ts +1133 -0
- package/src/bridges/input.d.ts +72 -0
- package/src/bridges/media.d.ts +55 -0
- package/src/bridges/nav.d.ts +71 -0
- package/src/bridges/net.d.ts +52 -0
- package/src/bridges/service.d.ts +52 -0
- package/src/bridges/socket.d.ts +31 -0
- package/src/bridges/storage.d.ts +33 -0
- package/src/bridges/tree.d.ts +301 -0
- package/src/bridges/types.d.ts +49 -0
- package/src/canvas/Canvas.ts +114 -159
- package/src/canvas/gen/cssColor.ts +224 -0
- package/src/canvas/gen/recorder.ts +212 -0
- package/src/canvas/gen/spec.ts +201 -0
- package/src/chisel.ts +193 -0
- package/src/compile/assetMacro.ts +1 -1
- package/src/compile/bundler.ts +11 -2
- package/src/compile/compileProject.ts +43 -4
- package/src/compile/fontMacro.ts +3 -4
- package/src/compile/header.ts +26 -5
- package/src/compile/index.ts +3 -1
- package/src/compile/liteMaterial.ts +1 -1
- package/src/compile/sceneEditor.ts +11 -26
- package/src/core/color.ts +73 -30
- package/src/core/pins.ts +51 -0
- package/src/core/signals.ts +8 -1
- package/src/g2/CharacterController2D.ts +3 -3
- package/src/g2/Node2D.ts +57 -39
- package/src/g2/Physics2D.ts +2 -2
- package/src/g2/Scene2D.ts +35 -23
- package/src/g2/Texture2D.ts +1 -1
- package/src/g2/loop.ts +4 -4
- package/src/gl/Foliage.ts +72 -17
- package/src/gl/Geometry.ts +1 -2
- package/src/gl/Light.ts +13 -0
- package/src/gl/Lightmap.ts +45 -29
- package/src/gl/Material.ts +95 -51
- package/src/gl/Model.ts +172 -167
- package/src/gl/Node.ts +91 -24
- package/src/gl/Particles.ts +20 -1
- package/src/gl/Scene.ts +100 -44
- package/src/gl/Texture.ts +8 -7
- package/src/gl/animation/AnimationClip.ts +1 -1
- package/src/gl/animation/Locomotion.ts +77 -8
- package/src/gl/nav/NavMesh.ts +3 -4
- package/src/gl/physics/Physics.ts +2 -2
- package/src/gl/physics/physicsEvents.ts +3 -3
- package/src/gl/terrain/Terrain.ts +33 -5
- package/src/gl/touch.ts +14 -15
- package/src/host.d.ts +2 -3
- package/src/inject.editor.ts +7 -0
- package/src/inject.ts +233 -236
- package/src/net/core.ts +6 -5
- package/src/net/index.ts +1 -1
- package/src/net/replication.ts +1 -1
- package/src/plugin.ts +191 -0
- package/src/plugins/gen/camera/contract.d.ts +27 -0
- package/src/plugins/gen/camera/sdk/camera.gen.ts +46 -0
- package/src/plugins/gen/camera/sdk/camera.ts +57 -0
- package/src/plugins/gen/geolocation/contract.d.ts +50 -0
- package/src/plugins/gen/geolocation/sdk/geolocation.gen.ts +54 -0
- package/src/plugins/{geolocation.ts → gen/geolocation/sdk/geolocation.ts} +22 -43
- package/src/plugins/gen/map/contract.d.ts +144 -0
- package/src/plugins/gen/map/sdk/map.gen.ts +88 -0
- package/src/plugins/{map.ts → gen/map/sdk/map.ts} +68 -102
- package/src/plugins/gen/push/contract.d.ts +61 -0
- package/src/plugins/gen/push/sdk/push.gen.ts +60 -0
- package/src/plugins/gen/push/sdk/push.ts +105 -0
- package/src/plugins/gen/qr-scanner/contract.d.ts +16 -0
- package/src/plugins/gen/qr-scanner/sdk/qr-scanner.gen.ts +29 -0
- package/src/plugins/gen/qr-scanner/sdk/qr-scanner.ts +52 -0
- package/src/plugins/permission.ts +5 -4
- package/src/runtime/app.ts +20 -9
- package/src/runtime/appEvents.ts +5 -4
- package/src/runtime/channel.ts +18 -15
- package/src/runtime/clipboard.ts +4 -3
- package/src/runtime/datetime.ts +2 -1
- package/src/runtime/device.ts +17 -15
- package/src/runtime/fetch.ts +30 -20
- package/src/runtime/files.ts +16 -15
- package/src/runtime/input.ts +21 -8
- package/src/runtime/media.ts +50 -46
- package/src/runtime/misc.ts +7 -3
- package/src/runtime/net.ts +8 -7
- package/src/runtime/rpc.ts +1 -3
- package/src/runtime/service.ts +19 -14
- package/src/runtime/share.ts +4 -3
- package/src/runtime/storage.ts +6 -4
- package/src/runtime/touch.ts +32 -0
- package/src/scene/defineScene.ts +61 -365
- package/src/scene/editor.ts +408 -0
- package/src/scene/editorPlugins.ts +3 -3
- package/src/scene/gizmos.ts +154 -148
- package/src/server/db/marci/query.ts +1 -1
- package/src/server/host.ts +1 -1
- package/src/server/runtime.ts +1 -1
- package/src/ui/NativeView.ts +72 -25
- package/src/ui/UI.ts +3 -3
- package/src/ui/UIBottomSheet.ts +16 -17
- package/src/ui/UIButton.ts +54 -16
- package/src/ui/UIContainer.ts +0 -6
- package/src/ui/UIImage.ts +34 -30
- package/src/ui/UIInput.ts +29 -37
- package/src/ui/UIModal.ts +1 -3
- package/src/ui/UINode.ts +347 -297
- package/src/ui/UIPager.ts +93 -78
- package/src/ui/UIPopover.ts +0 -2
- package/src/ui/UIScreen.ts +41 -36
- package/src/ui/UIScrollable.ts +19 -13
- package/src/ui/UISpacer.ts +1 -1
- package/src/ui/UITabs.ts +8 -6
- package/src/ui/UIText.ts +7 -17
- package/src/ui/UIVideo.ts +30 -27
- package/src/ui/UIVirtualizedList.ts +58 -59
- package/src/ui/UIWidget.ts +38 -18
- package/src/ui/colorKeys.gen.ts +37 -0
- package/src/ui/fonts.ts +2 -2
- package/src/ui/presentable.ts +59 -42
- package/src/ui/router.ts +52 -35
- package/src/ui/styleColor.ts +56 -0
- package/src/ui/theme.ts +7 -6
- package/src/ui/transitions.ts +249 -0
- package/src/ui/tree.ts +346 -0
- package/src/version.ts +24 -0
- package/tests/helpers/engineWorld.ts +11 -0
- package/tests/helpers/fakeTree.ts +353 -0
- package/tests/helpers/hostStubs.ts +31 -0
- package/tests/helpers/index.ts +14 -0
- package/tests/helpers/memoryMarci.ts +124 -0
- package/tests/helpers/phases.ts +23 -0
- package/tests/helpers/preload.ts +18 -0
- package/tests/helpers/stubApp.ts +2 -0
- package/tests/helpers/stubDevice.ts +2 -0
- package/tests/helpers/stubFetch.ts +2 -0
- package/tests/helpers/stubInput.ts +2 -0
- package/dist/inject.js +0 -4730
- package/dist/types/core/registry.d.ts +0 -7
- package/dist/types/plugins/camera.d.ts +0 -25
- package/dist/types/plugins/push.d.ts +0 -46
- package/src/bridges.d.ts +0 -1760
- package/src/compile/__tests__/assetIconMacro.test.ts +0 -219
- package/src/compile/__tests__/assetMacro.test.ts +0 -100
- package/src/compile/__tests__/assetName.test.ts +0 -55
- package/src/compile/__tests__/compile.test.ts +0 -310
- package/src/compile/__tests__/detectEntry.test.ts +0 -151
- package/src/compile/__tests__/fontMacro.test.ts +0 -199
- package/src/compile/__tests__/serverSplit.test.ts +0 -27
- package/src/core/__tests__/stateMachine.test.ts +0 -132
- package/src/core/registry.ts +0 -23
- package/src/plugins/camera.ts +0 -81
- package/src/plugins/push.ts +0 -132
- package/src/plugins/qr.ts +0 -73
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
export declare const SPEC_VERSION = 1;
|
|
2
|
+
export declare const LineJoin: {
|
|
3
|
+
readonly MITER: 0;
|
|
4
|
+
readonly ROUND: 1;
|
|
5
|
+
readonly BEVEL: 2;
|
|
6
|
+
};
|
|
7
|
+
export type LineJoin = (typeof LineJoin)[keyof typeof LineJoin];
|
|
8
|
+
export declare const LineJoinName: readonly string[];
|
|
9
|
+
export declare const LineCap: {
|
|
10
|
+
readonly BUTT: 0;
|
|
11
|
+
readonly ROUND: 1;
|
|
12
|
+
readonly SQUARE: 2;
|
|
13
|
+
};
|
|
14
|
+
export type LineCap = (typeof LineCap)[keyof typeof LineCap];
|
|
15
|
+
export declare const LineCapName: readonly string[];
|
|
16
|
+
export declare const TextAlign: {
|
|
17
|
+
readonly LEFT: 0;
|
|
18
|
+
readonly CENTER: 1;
|
|
19
|
+
readonly RIGHT: 2;
|
|
20
|
+
readonly START: 3;
|
|
21
|
+
readonly END: 4;
|
|
22
|
+
};
|
|
23
|
+
export type TextAlign = (typeof TextAlign)[keyof typeof TextAlign];
|
|
24
|
+
export declare const TextAlignName: readonly string[];
|
|
25
|
+
export declare const TextBaseline: {
|
|
26
|
+
readonly ALPHABETIC: 0;
|
|
27
|
+
readonly TOP: 1;
|
|
28
|
+
readonly MIDDLE: 2;
|
|
29
|
+
readonly BOTTOM: 3;
|
|
30
|
+
readonly HANGING: 4;
|
|
31
|
+
readonly IDEOGRAPHIC: 5;
|
|
32
|
+
};
|
|
33
|
+
export type TextBaseline = (typeof TextBaseline)[keyof typeof TextBaseline];
|
|
34
|
+
export declare const TextBaselineName: readonly string[];
|
|
35
|
+
export declare const FillRule: {
|
|
36
|
+
readonly NONZERO: 0;
|
|
37
|
+
readonly EVENODD: 1;
|
|
38
|
+
};
|
|
39
|
+
export type FillRule = (typeof FillRule)[keyof typeof FillRule];
|
|
40
|
+
export declare const FillRuleName: readonly string[];
|
|
41
|
+
export declare const Spread: {
|
|
42
|
+
readonly PAD: 0;
|
|
43
|
+
readonly REFLECT: 1;
|
|
44
|
+
readonly REPEAT: 2;
|
|
45
|
+
};
|
|
46
|
+
export type Spread = (typeof Spread)[keyof typeof Spread];
|
|
47
|
+
export declare const SpreadName: readonly string[];
|
|
48
|
+
export declare const Gradient: {
|
|
49
|
+
readonly LINEAR: 0;
|
|
50
|
+
readonly RADIAL: 1;
|
|
51
|
+
};
|
|
52
|
+
export type Gradient = (typeof Gradient)[keyof typeof Gradient];
|
|
53
|
+
export declare const GradientName: readonly string[];
|
|
54
|
+
export declare const Paint: {
|
|
55
|
+
readonly COLOR: 0;
|
|
56
|
+
readonly LINEAR: 1;
|
|
57
|
+
readonly RADIAL: 2;
|
|
58
|
+
};
|
|
59
|
+
export type Paint = (typeof Paint)[keyof typeof Paint];
|
|
60
|
+
export declare const PaintName: readonly string[];
|
|
61
|
+
export declare const PathVerb: {
|
|
62
|
+
readonly MOVE: 0;
|
|
63
|
+
readonly LINE: 1;
|
|
64
|
+
readonly QUAD: 2;
|
|
65
|
+
readonly CUBIC: 3;
|
|
66
|
+
readonly CLOSE: 4;
|
|
67
|
+
};
|
|
68
|
+
export type PathVerb = (typeof PathVerb)[keyof typeof PathVerb];
|
|
69
|
+
export declare const PathVerbName: readonly string[];
|
|
70
|
+
export declare const ImageFormat: {
|
|
71
|
+
readonly PNG: 0;
|
|
72
|
+
readonly JPEG: 1;
|
|
73
|
+
};
|
|
74
|
+
export type ImageFormat = (typeof ImageFormat)[keyof typeof ImageFormat];
|
|
75
|
+
export declare const ImageFormatName: readonly string[];
|
|
76
|
+
/** The opcode stream: op id → the word after it. */
|
|
77
|
+
export declare const OP: {
|
|
78
|
+
readonly SAVE: 0;
|
|
79
|
+
readonly RESTORE: 1;
|
|
80
|
+
readonly TRANSLATE: 2;
|
|
81
|
+
readonly SCALE: 3;
|
|
82
|
+
readonly ROTATE: 4;
|
|
83
|
+
readonly TRANSFORM: 5;
|
|
84
|
+
readonly SET_TRANSFORM: 6;
|
|
85
|
+
readonly RESET_TRANSFORM: 7;
|
|
86
|
+
readonly GLOBAL_ALPHA: 8;
|
|
87
|
+
readonly FILL_STYLE: 9;
|
|
88
|
+
readonly STROKE_STYLE: 10;
|
|
89
|
+
readonly FILL_GRADIENT: 11;
|
|
90
|
+
readonly STROKE_GRADIENT: 12;
|
|
91
|
+
readonly LINE_WIDTH: 13;
|
|
92
|
+
readonly LINE_JOIN: 14;
|
|
93
|
+
readonly LINE_CAP: 15;
|
|
94
|
+
readonly MITER_LIMIT: 16;
|
|
95
|
+
readonly LINE_DASH: 17;
|
|
96
|
+
readonly LINE_DASH_OFFSET: 18;
|
|
97
|
+
readonly FONT: 19;
|
|
98
|
+
readonly TEXT_ALIGN: 20;
|
|
99
|
+
readonly TEXT_BASELINE: 21;
|
|
100
|
+
readonly LETTER_SPACING: 22;
|
|
101
|
+
readonly PATH_BEGIN: 23;
|
|
102
|
+
readonly PATH_CLOSE: 24;
|
|
103
|
+
readonly MOVE_TO: 25;
|
|
104
|
+
readonly LINE_TO: 26;
|
|
105
|
+
readonly QUADRATIC_TO: 27;
|
|
106
|
+
readonly BEZIER_TO: 28;
|
|
107
|
+
readonly ARC: 29;
|
|
108
|
+
readonly ARC_TO: 30;
|
|
109
|
+
readonly ELLIPSE: 31;
|
|
110
|
+
readonly RECT: 32;
|
|
111
|
+
readonly ROUND_RECT: 33;
|
|
112
|
+
readonly FILL: 34;
|
|
113
|
+
readonly STROKE: 35;
|
|
114
|
+
readonly CLIP: 36;
|
|
115
|
+
readonly FILL_RECT: 37;
|
|
116
|
+
readonly STROKE_RECT: 38;
|
|
117
|
+
readonly CLEAR_RECT: 39;
|
|
118
|
+
readonly FILL_TEXT: 40;
|
|
119
|
+
readonly STROKE_TEXT: 41;
|
|
120
|
+
readonly DRAW_IMAGE: 42;
|
|
121
|
+
};
|
|
122
|
+
export type OP = (typeof OP)[keyof typeof OP];
|
|
123
|
+
/** Operand layout per op: `args` is one letter per fixed word (f float, i int, r string ref);
|
|
124
|
+
* `repeat` is the group that follows the trailing count. */
|
|
125
|
+
export declare const OP_ARGS: Record<number, {
|
|
126
|
+
args: string;
|
|
127
|
+
repeat: string;
|
|
128
|
+
}>;
|
|
129
|
+
export declare const OP_NAME: readonly string[];
|
|
130
|
+
/** The draw list: command id → the word after it. */
|
|
131
|
+
export declare const DRAW: {
|
|
132
|
+
readonly SET_TRANSFORM: 0;
|
|
133
|
+
readonly SAVE: 1;
|
|
134
|
+
readonly RESTORE: 2;
|
|
135
|
+
readonly CLIP: 3;
|
|
136
|
+
readonly FILL_PATH: 4;
|
|
137
|
+
readonly STROKE_PATH: 5;
|
|
138
|
+
readonly FILL_TEXT: 6;
|
|
139
|
+
readonly STROKE_TEXT: 7;
|
|
140
|
+
readonly DRAW_IMAGE: 8;
|
|
141
|
+
readonly CLEAR_RECT: 9;
|
|
142
|
+
};
|
|
143
|
+
export type DRAW = (typeof DRAW)[keyof typeof DRAW];
|
|
144
|
+
export declare const DRAW_NAME: readonly string[];
|
|
@@ -8,6 +8,8 @@ export declare const Color: {
|
|
|
8
8
|
toPackedRgb(c: ColorInput): number;
|
|
9
9
|
/** 0xRRGGBBAA packed int (unsigned). */
|
|
10
10
|
toPackedRgba(c: ColorInput): number;
|
|
11
|
-
/** '#
|
|
11
|
+
/** '#rrggbbaa' (lower-case, always eight digits) — the UI wire form and the 3D material color. */
|
|
12
12
|
toHexString(c: ColorInput): string;
|
|
13
|
+
/** [r,g,b,a] in 0..1, or `null` when `c` is not a color — the non-throwing probe. */
|
|
14
|
+
tryParse(c: unknown): [number, number, number, number] | null;
|
|
13
15
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** The handle of a wrapper whose resource is gone: `id` 0, nothing to finalize. Replacing `_h`
|
|
2
|
+
* with it drops the real handle, so the runtime's record can go. */
|
|
3
|
+
export declare const DEAD_HANDLE: Handle;
|
|
4
|
+
export interface Pinned {
|
|
5
|
+
readonly _h: Handle;
|
|
6
|
+
/** The runtime freed the resource underneath (an ancestor's free): mark the wrapper dead. */
|
|
7
|
+
_freed?(): void;
|
|
8
|
+
}
|
|
9
|
+
export declare class Pins<T extends Pinned> {
|
|
10
|
+
private readonly map;
|
|
11
|
+
/** Keep `obj` alive and findable while native owns its resource. */
|
|
12
|
+
pin(obj: T | null | undefined): void;
|
|
13
|
+
unpin(id: number): void;
|
|
14
|
+
get(id: number): T | undefined;
|
|
15
|
+
has(id: number): boolean;
|
|
16
|
+
/** The runtime freed these resources: drop the pins, tell the wrappers. */
|
|
17
|
+
freed(ids: number[]): void;
|
|
18
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AspectHost } from "../core/Aspect";
|
|
2
2
|
import type { CompAxis, CompWriter } from "../core/compWrite";
|
|
3
|
-
import { Registry } from "../core/registry";
|
|
4
3
|
import { Vec2, type Vec2Like } from "../math/vec";
|
|
5
4
|
import type { ClickEvent, TouchStartEvent } from "../runtime/touch";
|
|
6
5
|
import type { Animation } from "../animate/tween/Animation";
|
|
@@ -38,11 +37,9 @@ export type Contact2D = {
|
|
|
38
37
|
normal: Vec2;
|
|
39
38
|
speed: number;
|
|
40
39
|
};
|
|
41
|
-
/** id → Node2D, so host callbacks (animation events) route back to the owning JS object. */
|
|
42
|
-
export declare const node2dRegistry: Registry<Node2D>;
|
|
43
40
|
export declare class Node2D extends AspectHost<Node2DEvents> implements CompWriter {
|
|
44
|
-
/** Native entity
|
|
45
|
-
|
|
41
|
+
/** Native entity id. */
|
|
42
|
+
get id(): number;
|
|
46
43
|
/** Optional debug/editor name (plain JS data — scene2d files stamp their node names here). */
|
|
47
44
|
name?: string;
|
|
48
45
|
protected _x: number;
|
|
@@ -54,9 +51,7 @@ export declare class Node2D extends AspectHost<Node2DEvents> implements CompWrit
|
|
|
54
51
|
protected _z: number;
|
|
55
52
|
protected _visible: boolean;
|
|
56
53
|
private _pushXf;
|
|
57
|
-
|
|
58
|
-
private _children;
|
|
59
|
-
constructor(internalId?: number);
|
|
54
|
+
constructor(internalId?: number | Handle);
|
|
60
55
|
private _pull;
|
|
61
56
|
get x(): number;
|
|
62
57
|
set x(v: number);
|
|
@@ -103,5 +98,7 @@ export declare class Node2D extends AspectHost<Node2DEvents> implements CompWrit
|
|
|
103
98
|
localToWorld(p: Vec2Like): Vec2;
|
|
104
99
|
private _syncLocalFromNative;
|
|
105
100
|
addEventListener<K extends keyof Node2DEvents>(channel: K, callback: Node2DEvents[K]): void;
|
|
101
|
+
/** Destroy this node and its whole subtree (children go with it — the 3D / UI contract). Every
|
|
102
|
+
* aspect in the subtree detaches first (physics bodies released, updaters unregistered). */
|
|
106
103
|
destroy(): void;
|
|
107
104
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ColorInput } from "../core/color";
|
|
2
2
|
import { type Aspect, type AspectCtor, type FieldOf, type TargetOf } from "../core/Aspect";
|
|
3
|
-
import { Presentable, type PresentOptions } from "../ui/presentable";
|
|
3
|
+
import { Presentable, type DismissOptions, type PresentOptions } from "../ui/presentable";
|
|
4
4
|
import { type Vec2Like } from "../math/vec";
|
|
5
5
|
import type { ClickEvent, TouchStartEvent } from "../runtime/touch";
|
|
6
6
|
import { Camera2D } from "./Camera2D";
|
|
@@ -62,11 +62,15 @@ export declare class Scene2D implements Presentable {
|
|
|
62
62
|
onOpen(callback: () => void): this;
|
|
63
63
|
/** Fires when the scene stops being visible (closed, replaced, or covered by a push). */
|
|
64
64
|
onClose(callback: () => void): this;
|
|
65
|
+
/** Hardware/system back while the scene is current. */
|
|
66
|
+
onBack(callback: () => void): this;
|
|
67
|
+
/** @deprecated Renamed `onBack` (2026-09-26). An alias for the projects compiled before the
|
|
68
|
+
* rename; removed with the release that recompiles them. */
|
|
65
69
|
onBackPressed(callback: () => void): this;
|
|
66
70
|
/** Make this the active scene — shows it as the current destination (replaces a screen /
|
|
67
71
|
* another scene; only the active scene renders). */
|
|
68
72
|
open(options?: PresentOptions): this;
|
|
69
|
-
close(): this;
|
|
73
|
+
close(options?: DismissOptions): this;
|
|
70
74
|
destroy(): void;
|
|
71
75
|
}
|
|
72
76
|
export {};
|
|
@@ -3,19 +3,20 @@ import { Node } from "./Node";
|
|
|
3
3
|
export type FoliageWind = {
|
|
4
4
|
/** Direction on the ground (x, z); normalised by the engine. Default [1, 0.3]. */
|
|
5
5
|
direction?: [number, number];
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
/** Radians per second of the main sway. Default 1.2. */
|
|
6
|
+
/** The wind speed in m/s — the plants' permanent bend and how fast the field drifts past them. Default 8.3
|
|
7
|
+
* (30 km/h, the pack's demo). 0 = still. */
|
|
9
8
|
speed?: number;
|
|
10
|
-
/** 0..
|
|
9
|
+
/** 0..2: the random share of the speed — how far the bend wanders off the mean wind and how much the leaves move.
|
|
10
|
+
* Default 0.4. */
|
|
11
|
+
turbulence?: number;
|
|
12
|
+
/** 0..1: the gusts' strength — waves of extra wind that travel over the level, calm between. Default 0.35. */
|
|
11
13
|
gust?: number;
|
|
14
|
+
/** m/s the gust pattern travels at. Default 5.6 (20 km/h). */
|
|
15
|
+
gustSpeed?: number;
|
|
12
16
|
};
|
|
13
17
|
export type FoliageOptions = {
|
|
14
18
|
/** The wind, or `false` for none. */
|
|
15
19
|
wind?: FoliageWind | false;
|
|
16
|
-
/** Height above the instance origin (m) where the full sway / touch applies; the base never moves.
|
|
17
|
-
* Default 1.5. */
|
|
18
|
-
bendHeight?: number;
|
|
19
20
|
/** Metres the TOP of a small plant leans away from a bender standing at its centre; the whole plant leans
|
|
20
21
|
* as one, rooted at its base. Plants over ~2 m react less, trees over ~5 m not at all (the engine
|
|
21
22
|
* measures each asset). Default 0.6. 0 = no touch reaction. */
|
|
@@ -25,6 +26,28 @@ export type FoliageOptions = {
|
|
|
25
26
|
variation?: number;
|
|
26
27
|
/** 0..1: wrapped sun lighting — thin leaves let light through. Default 0.5. */
|
|
27
28
|
sunWrap?: number;
|
|
29
|
+
/** A multiplier on every material's shiver drag (the leaves' own motion on top of the bend): 1 = as the
|
|
30
|
+
* model's materials say, 0 = the leaves ride the bend alone. Default 1. */
|
|
31
|
+
shiver?: number;
|
|
32
|
+
/** 0..1: the sun through a thin leaf lit from behind (a back-lit crown glows). Default 0.35. */
|
|
33
|
+
translucency?: number;
|
|
34
|
+
/** 0..1: how much of a light's shadow a leaf card takes. A crown scatters light through itself, so its cards take the
|
|
35
|
+
* shadow map partly — at 1 a distant crown is a dark silhouette lit only on its top layer. Bark always takes the
|
|
36
|
+
* shadow in full. Default 0.6. */
|
|
37
|
+
leafShadow?: number;
|
|
38
|
+
/** 0..1: how far the baked per-vertex sky visibility (the crown's interior, the trunk under it) darkens the ambient.
|
|
39
|
+
* Default 0.7. */
|
|
40
|
+
skyAo?: number;
|
|
41
|
+
/** 0..1: a leaf card's shading normal, from the card's own plane (0) to the crown's hull normal (1) — what hides that a
|
|
42
|
+
* crown is flat quads: each card is lit as the part of the volume it sits in. Default 0.7. */
|
|
43
|
+
canopy?: number;
|
|
44
|
+
/** The cards' normal-map strength (a strong map brings the planes back). Default 0.5. */
|
|
45
|
+
normalMap?: number;
|
|
46
|
+
/** A card seen edge-on dissolves over this much of |N·V| — no paper edges on the silhouette. Default 0.15, 0 = none. */
|
|
47
|
+
edgeFade?: number;
|
|
48
|
+
/** Coverage held over distance: the cards' alpha × (1 + coverage × mip level), so a far crown does not thin out as its
|
|
49
|
+
* atlas mips away. Default 0.25, 0 = none; past ~0.5 a crown turns into a solid mass. */
|
|
50
|
+
coverage?: number;
|
|
28
51
|
};
|
|
29
52
|
export declare const Foliage: {
|
|
30
53
|
/** Level-wide options; each field given replaces the current value (a scene file's `env.foliage`
|
package/dist/types/gl/Light.d.ts
CHANGED
|
@@ -22,6 +22,9 @@ export type SunOptions = {
|
|
|
22
22
|
* 3 - 2048 map, contact-hardening soft edges (PCSS: sharp where the caster touches, softer
|
|
23
23
|
* away; discrete-GPU territory, ~+60 % of a frame on an iGPU)
|
|
24
24
|
* A lightmapped level already carries every static shadow, so 0 is a legitimate choice there.
|
|
25
|
+
* On a level with a baked light grid the variance / PCSS filters cannot be used (they need every
|
|
26
|
+
* receiver in the shadow map, and the baked statics are kept out of it): 3 renders as PCSS on the
|
|
27
|
+
* depth map - the same contact-hardening look - and 2 renders as 1.
|
|
25
28
|
*/
|
|
26
29
|
shadowsQuality?: 0 | 1 | 2 | 3;
|
|
27
30
|
/**
|
|
@@ -30,6 +33,13 @@ export type SunOptions = {
|
|
|
30
33
|
* the same quality and puts fewer casters in the shadow pass. 30-40 is plenty in first person.
|
|
31
34
|
*/
|
|
32
35
|
shadowDistance?: number;
|
|
36
|
+
/**
|
|
37
|
+
* How many shadow-map cascades split `shadowDistance` (default 1). One map over the whole range gives a tall
|
|
38
|
+
* tree 5-10 cm shadow texels on its own trunk; 3 cascades put a tight map on the first metres and coarser
|
|
39
|
+
* ones behind, fit to their texel grids so the shadow does not swim as the camera moves. Each cascade is
|
|
40
|
+
* another caster pass, so it costs in proportion to what casts: forests, not a lightmapped level.
|
|
41
|
+
*/
|
|
42
|
+
shadowCascades?: 1 | 2 | 3 | 4;
|
|
33
43
|
};
|
|
34
44
|
export type PointOptions = {
|
|
35
45
|
/**
|
|
@@ -71,6 +81,7 @@ export declare class Light extends Node {
|
|
|
71
81
|
/** The most recently created sun. */
|
|
72
82
|
static lastSun: Light | null;
|
|
73
83
|
_shadowDistance: number;
|
|
84
|
+
_shadowCascades: number;
|
|
74
85
|
/** A directional sun light. */
|
|
75
86
|
static sun(options?: SunOptions): Light;
|
|
76
87
|
/**
|
|
@@ -93,6 +93,17 @@ export declare class Lightmap {
|
|
|
93
93
|
private static loadVolume;
|
|
94
94
|
/** Forget every registration (a scene rebuild). */
|
|
95
95
|
static clear(): void;
|
|
96
|
+
/** THE MOVERS' SUN SHADOWS ON THE BAKED STATICS (a bot, a barrel, the player's rifle darkening the ground under
|
|
97
|
+
* it): the lightmap shader reads the real-time shadow map and the bake's sun map for it, per pixel. Off, a baked
|
|
98
|
+
* surface takes no real-time shadow at all — the cheapest lighting tier (some 4 ms of a 16 ms 720p frame on an
|
|
99
|
+
* integrated GPU, the yard 2026-09-26); a mover still shades ITSELF and the other movers. Live: it rebinds the
|
|
100
|
+
* level's material instances at once. */
|
|
101
|
+
static get moverShadows(): boolean;
|
|
102
|
+
static set moverShadows(on: boolean);
|
|
103
|
+
private static _moverShadows;
|
|
104
|
+
/** The loaded bake's sun (TO the sun ×3, its illuminance rgb, the sun map's levels), null without a sun map. */
|
|
105
|
+
private static sunArgs;
|
|
106
|
+
private static applySun;
|
|
96
107
|
/** Apply a bake — or, under `lecodes lightmap bake`, run it. Resolves to null when nothing was
|
|
97
108
|
* applied (no bake yet, a host without the feature, bake mode). */
|
|
98
109
|
private static scene;
|
|
@@ -116,8 +127,8 @@ export declare class Lightmap {
|
|
|
116
127
|
* so the value can be looked up in the bake's debug layers (`lecodes lightmap inspect`). null when
|
|
117
128
|
* nothing baked is under the point or the host has no triangle pick. */
|
|
118
129
|
static probe(screenX: number, screenY: number): LightmapProbe | null;
|
|
119
|
-
/** A
|
|
120
|
-
private static
|
|
130
|
+
/** A material's colour uniform as "#rrggbbaa" (the float4 uniform path sets its alpha); white without one. */
|
|
131
|
+
private static colorUniform;
|
|
121
132
|
/** The lightmap material for a static Mesh, from whatever lit material it carried (colour, map, roughness, metallic). */
|
|
122
133
|
private static meshMaterial;
|
|
123
134
|
private static bake;
|
|
@@ -123,7 +123,7 @@ export declare class Material {
|
|
|
123
123
|
readonly shader: FetchResponse | "unknown";
|
|
124
124
|
readonly uniforms: Record<string, UniformValue>;
|
|
125
125
|
private _colorKey;
|
|
126
|
-
constructor(shader: FetchResponse | number);
|
|
126
|
+
constructor(shader: FetchResponse | Handle | number);
|
|
127
127
|
/** Set a uniform (chainable). */
|
|
128
128
|
set(key: string, value: UniformValue): this;
|
|
129
129
|
set color(c: ColorInput);
|
|
@@ -137,6 +137,8 @@ export declare class Material {
|
|
|
137
137
|
/** The stencil test / write (write-only; `null` = back to none). See `MaterialStencil`. */
|
|
138
138
|
set stencil(s: MaterialStencil | null);
|
|
139
139
|
set map(value: Texture | Canvas | null);
|
|
140
|
+
/** The material an instance handle is of; a host that carries none under `name` is an error naming it. */
|
|
141
|
+
private static _builtin;
|
|
140
142
|
/** PBR lit material. */
|
|
141
143
|
static lit(options?: LitMaterialOptions): Material;
|
|
142
144
|
/** Unlit (flat) material — opaque unless `transparent` asks for alpha blending. */
|
|
@@ -151,7 +153,7 @@ export declare class Material {
|
|
|
151
153
|
static decal(options?: DecalMaterialOptions): Material;
|
|
152
154
|
/** Material that samples a VideoPlayer's texture. */
|
|
153
155
|
static video(map?: Texture): Material;
|
|
154
|
-
/** The lightmap material (
|
|
156
|
+
/** The lightmap material (engines/bake): a lit PBR material whose whole DIFFUSE light is the
|
|
155
157
|
* baked irradiance atlas on UV1 (`lightmapLight`, lux) — the real-time sun, lamps and diffuse IBL do not
|
|
156
158
|
* touch it; the specular IBL stays, occluded by the baked sky visibility. Models take it through
|
|
157
159
|
* `Model.load(…, { lightmap: true })`; a static Mesh gets one from here. Parameters use gltfio's names
|
|
@@ -161,6 +163,17 @@ export declare class Material {
|
|
|
161
163
|
/** `Material.lightmap()`'s masked twin (`blending: masked`, same shader and parameters): what the engine
|
|
162
164
|
* gives a lightmapped model's alpha-MASK materials. The cutoff comes from the glTF material. */
|
|
163
165
|
static lightmapMasked(): Material;
|
|
166
|
+
/** THE LIGHTMAP SHADER TIER, engine-wide: `"full"` = the target's own blob (desktop: the bicubic atlas fetch, eight
|
|
167
|
+
* probe corners, the sun's highlight on metal), `"lite"` = the blob the phones ship (bilinear fetch, one probe
|
|
168
|
+
* corner, no sun highlight; the movers' shadows on the statics stay) — on an integrated GPU some 30 % less per
|
|
169
|
+
* pixel on a baked level, the picture a phone shows. Read when a lightmap material is FIRST made, which
|
|
170
|
+
* `Model.load({ lightmap })` does once per world: set it BEFORE the level loads (a graphics preset applied at
|
|
171
|
+
* boot, like `Texture.maxSize`); a change afterwards takes the next level. A host without the lite material
|
|
172
|
+
* (a phone: its own blob is that shader already) takes the full one. */
|
|
173
|
+
static lightmapShading: "full" | "lite";
|
|
174
|
+
/** The lite tier's instance, or — said once — that this host has none and the full shader is used. */
|
|
175
|
+
private static _liteTier;
|
|
176
|
+
private static _liteWarned;
|
|
164
177
|
/** The terrain splat material (docs/terrain-plan.md §1.5): four albedo (+ normal-map) layers blended by
|
|
165
178
|
* a control map on the terrain's own grid, per-layer `tiling` (metres per repeat) / `roughness` /
|
|
166
179
|
* `normalScale` / `triplanar`. `Terrain` builds and owns one per terrain; the uniforms are primed here so an
|
|
@@ -186,8 +199,9 @@ export declare class Material {
|
|
|
186
199
|
private static _glbDefaults;
|
|
187
200
|
private static _lightmapDefaults;
|
|
188
201
|
private static _folTemplate;
|
|
189
|
-
static _foliageMaskedTemplate(): Material;
|
|
202
|
+
static _foliageMaskedTemplate(): Material | null;
|
|
190
203
|
private static _folMaskedTemplate;
|
|
204
|
+
private static _glbTemplate;
|
|
191
205
|
/** Shadow-catcher material (transparent except where shadows fall). */
|
|
192
206
|
static shadow(color?: ColorInput): Material;
|
|
193
207
|
/** Load a custom compiled shader (.mat URL) as a material. */
|
package/dist/types/gl/Model.d.ts
CHANGED
|
@@ -12,12 +12,16 @@ export interface TrianglePick {
|
|
|
12
12
|
mesh: string;
|
|
13
13
|
primitive: number;
|
|
14
14
|
material: string;
|
|
15
|
+
/** the node's lightmap group (scene-file extras), when it has one */
|
|
16
|
+
lightmapGroup?: number;
|
|
15
17
|
/** triangle index within the primitive (index-buffer order), and whether the ray came from behind */
|
|
16
18
|
triangle: number;
|
|
17
19
|
backface: boolean;
|
|
18
20
|
distance: number;
|
|
19
21
|
point: [number, number, number];
|
|
20
22
|
bary: [number, number, number];
|
|
23
|
+
/** the lightmap uv (TEXCOORD_1) at the hit, when the primitive carries one */
|
|
24
|
+
uv1?: [number, number];
|
|
21
25
|
skin: string;
|
|
22
26
|
vertices: {
|
|
23
27
|
index: number;
|
|
@@ -33,7 +37,7 @@ export declare class Model extends Node {
|
|
|
33
37
|
/** The model's Animator — always present, its clip table = the GLB's embedded clips. Configure
|
|
34
38
|
* more (external clips, blend spaces, layers) with `model.aspect(Animator, {...})`. */
|
|
35
39
|
readonly anim: Animator;
|
|
36
|
-
constructor(internalId: number);
|
|
40
|
+
constructor(internalId: number | Handle);
|
|
37
41
|
/** Does this model cast a real-time shadow? Unlike Mesh (one renderable) a GLB is a whole
|
|
38
42
|
* hierarchy, so the flag goes to EVERY renderable of the instance. A first-person viewmodel —
|
|
39
43
|
* arms, weapon, attachments — sets it false: it lives in front of the camera and its shadow
|
|
@@ -77,7 +81,7 @@ export declare class Model extends Node {
|
|
|
77
81
|
loaded: number;
|
|
78
82
|
total?: number;
|
|
79
83
|
}) => void;
|
|
80
|
-
/** Baked lighting (
|
|
84
|
+
/** Baked lighting (engines/bake). `true` = a STATIC: loads through the lightmap material so
|
|
81
85
|
* `Lightmap.load` can bind its atlas rect (the GLB needs TEXCOORD_1 — `lecodes assets doctor
|
|
82
86
|
* --lightmap-uv`) and takes nothing from the real-time lights once the bake applies. Omitted / `false` =
|
|
83
87
|
* the standard shader, lit real-time (movers). Hosts without lightmap support ignore it. */
|
package/dist/types/gl/Node.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AspectHost } from "../core/Aspect";
|
|
2
|
-
import { Registry } from "../core/registry";
|
|
3
2
|
import { Vec3, type Vec3Like } from "../math/vec";
|
|
4
3
|
import { Quat, type QuatLike } from "../math/quat";
|
|
5
4
|
import { Mat4, type Mat4Like } from "../math/mat4";
|
|
@@ -18,8 +17,6 @@ export type NodeTweenProps = {
|
|
|
18
17
|
/** Degrees, YXZ; interpolated per axis without shortest-arc, so `[0, 720, 0]` spins twice. */
|
|
19
18
|
eulerAngles?: Vec3Like | Vec3Like[];
|
|
20
19
|
};
|
|
21
|
-
/** id → Node, so host callbacks (touch hits, animation events) route back to the owning object. */
|
|
22
|
-
export declare const nodeRegistry: Registry<Node>;
|
|
23
20
|
export type NodeEvents = {
|
|
24
21
|
click: (ev: ClickEvent<Node | null>) => void;
|
|
25
22
|
touchstart: (ev: TouchStartEvent<Node | null>) => void;
|
|
@@ -33,8 +30,8 @@ export type NodeEvents = {
|
|
|
33
30
|
exit: (other: Node) => void;
|
|
34
31
|
};
|
|
35
32
|
export declare class Node extends AspectHost<NodeEvents> implements CompWriter {
|
|
36
|
-
/** Native entity
|
|
37
|
-
|
|
33
|
+
/** Native entity id. */
|
|
34
|
+
get id(): number;
|
|
38
35
|
/** AR anchors only — whether the anchor is currently being tracked. Kept in step with the
|
|
39
36
|
* 'track' / 'untrack' events; `false` for any non-anchor node. */
|
|
40
37
|
isTracked: boolean;
|
|
@@ -43,7 +40,7 @@ export declare class Node extends AspectHost<NodeEvents> implements CompWriter {
|
|
|
43
40
|
private _boneCache?;
|
|
44
41
|
/** Materials assigned through setMaterial, by primitive slot (a Mesh fills slot 0 itself). */
|
|
45
42
|
protected _materials?: Material[];
|
|
46
|
-
constructor(internalId?: number);
|
|
43
|
+
constructor(internalId?: number | Handle);
|
|
47
44
|
/** Geometry, if this node is a Mesh (used by physics auto-shape). Overridden by Mesh. */
|
|
48
45
|
get geometry(): Geometry | undefined;
|
|
49
46
|
get name(): string;
|
|
@@ -184,6 +184,15 @@ export type ParticlesOptions = ParticlesMaterialOptions & {
|
|
|
184
184
|
* without this the engine picks who covers whom per frame (smoke popping over a fireball).
|
|
185
185
|
* Default 0; a fireball wants 2, its smoke 1, a smoke trail -1. */
|
|
186
186
|
order?: number;
|
|
187
|
+
/** Sprites take the light of the PLACE each one is in — the level's baked light grid (`env.lightmap.volume`).
|
|
188
|
+
* A sprite is unlit: its colour is the picture, which is right for fire and wrong for dust — a puff kicked up
|
|
189
|
+
* under an awning glows as if it stood in the sun. With `lit` every particle's colour is multiplied by the light
|
|
190
|
+
* where it is, relative to the level's OPEN ground: exactly the authored colour out in the sun, the ambient's
|
|
191
|
+
* share of it (tinted the way the shade is) under a roof — per particle, so a trail of puffs laid from the sun
|
|
192
|
+
* into the shade is lit along its length. Author the colour for the open; nothing else to tune. Without a grid
|
|
193
|
+
* — a level with no bake, a host that has none — the colours are drawn as authored. Points, quads, stretch and
|
|
194
|
+
* `Trail`; mesh particles are lit by their material. Default false. */
|
|
195
|
+
lit?: boolean;
|
|
187
196
|
/** Coarse draw order among ALL blended draws, 0 (first) … 7 (last) — see `Mesh.renderPriority`.
|
|
188
197
|
* Default 5: meshes sit at 4 and decals at 3, so smoke covers a car's glass and its skid marks
|
|
189
198
|
* whatever the camera does (the engine's depth sort compares object centres, and an emitter's
|
|
@@ -234,6 +243,8 @@ export declare class Particles extends Node {
|
|
|
234
243
|
/** Lay a frame's spawns along a curve through the emitter's path, not the straight chord. */
|
|
235
244
|
set smooth(val: boolean);
|
|
236
245
|
set order(val: number);
|
|
246
|
+
/** Colours × the baked light where each particle is — see `ParticlesOptions.lit`. */
|
|
247
|
+
set lit(val: boolean);
|
|
237
248
|
/** Coarse draw order, 0 … 7 — see `Mesh.renderPriority`. Write-only. */
|
|
238
249
|
set renderPriority(v: number);
|
|
239
250
|
set velocityOverLife(v: VelocityOverLife);
|
|
@@ -279,6 +290,9 @@ export type TrailOptions = Omit<ParticlesMaterialOptions, "render" | "stretch">
|
|
|
279
290
|
* frame rate, since a longer frame bows further off its own chord. Default false; see
|
|
280
291
|
* `ParticlesOptions.smooth`. */
|
|
281
292
|
smooth?: boolean;
|
|
293
|
+
/** The strip takes the baked light of the place each of its points is at — `ParticlesOptions.lit`. Smoke and
|
|
294
|
+
* dust trails; leave it off for a glowing one. Default false. */
|
|
295
|
+
lit?: boolean;
|
|
282
296
|
/** Which way the strip's WIDTH points.
|
|
283
297
|
*
|
|
284
298
|
* `'camera'` (default) rolls the strip about its own length to stay flat to the viewer — it can
|
|
@@ -317,6 +331,7 @@ export declare class Trail extends Node {
|
|
|
317
331
|
set minDistance(val: number);
|
|
318
332
|
/** Follow a curve through the emitter's path instead of the straight chord between frames. */
|
|
319
333
|
set smooth(val: boolean);
|
|
334
|
+
set lit(val: boolean);
|
|
320
335
|
/** Which way the strip's width points — see `TrailOptions.orient`. Keeps the current `faceCamera`. */
|
|
321
336
|
set orient(val: "camera" | "x" | "y" | "z");
|
|
322
337
|
/** The hybrid's floor — see `TrailOptions.faceCamera`. */
|
package/dist/types/gl/Scene.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ColorInput } from "../core/color";
|
|
2
2
|
import { type Aspect, type AspectCtor, type FieldOf, type TargetOf } from "../core/Aspect";
|
|
3
|
-
import { Presentable, type PresentOptions } from "../ui/presentable";
|
|
3
|
+
import { Presentable, type DismissOptions, type PresentOptions } from "../ui/presentable";
|
|
4
4
|
import type { ClickEvent, TouchStartEvent } from "../runtime/touch";
|
|
5
5
|
import type { FetchResponse } from "../runtime/fetch";
|
|
6
6
|
import { Camera } from "./Camera";
|
|
@@ -18,6 +18,20 @@ export type AmbientOcclusionOptions = {
|
|
|
18
18
|
/** Sample count + filtering (default 'medium'). Not the buffer resolution — that stays half. */
|
|
19
19
|
quality?: "low" | "medium" | "high" | "ultra";
|
|
20
20
|
};
|
|
21
|
+
/** `SceneOptions.taa` / `scene.setAntialias("taa", 4, taa)`: the temporal anti-aliasing knobs. */
|
|
22
|
+
export type TaaOptions = {
|
|
23
|
+
/** Render the 3D at this fraction (0.5–1) and TAA-upscale it to the viewport; 1 = none. */
|
|
24
|
+
upscale?: number;
|
|
25
|
+
/** The history's share, 0 (max smoothing) … 1 (none); 0.12 default. */
|
|
26
|
+
feedback?: number;
|
|
27
|
+
/** Post-TAA sharpen 0–1; defaults to 0.5 with `upscale` below 1, else 0. */
|
|
28
|
+
sharpness?: number;
|
|
29
|
+
/** A first-person viewmodel: everything closer than this many metres to the camera is treated as
|
|
30
|
+
* fixed on screen — its history is read at the same pixel, not reprojected by the camera's motion,
|
|
31
|
+
* which would trail the weapon on every turn (TAA has no per-object motion vectors). 1 covers arms
|
|
32
|
+
* and weapon at eye height; 0 (the default) = off. A wall walked into within the band smears a little. */
|
|
33
|
+
viewmodel?: number;
|
|
34
|
+
};
|
|
21
35
|
export type FogOptions = {
|
|
22
36
|
/** A TINT on the in-scattered ambient, not an absolute colour: the engine multiplies it by the
|
|
23
37
|
* environment luminance, so white (the default) means "fog as bright as the ambient" and the fog
|
|
@@ -92,10 +106,18 @@ export type SceneOptions = {
|
|
|
92
106
|
* at every distance — the skybox included — so the sky itself takes the fog colour and the horizon
|
|
93
107
|
* blends on its own; `cutoff` opts geometry beyond a distance back out. */
|
|
94
108
|
fog?: FogOptions;
|
|
95
|
-
/**
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
|
|
109
|
+
/** Anti-aliasing: `true` = 4× MSAA, `2`/`4` = that many samples, `false` = off (FXAA takes over),
|
|
110
|
+
* `"taa"` = temporal anti-aliasing (Filament's TAA: one full-screen history blend instead of the
|
|
111
|
+
* multisampled buffers — cheaper than MSAA on an integrated GPU and it also calms specular and
|
|
112
|
+
* foliage shimmer; see `taa` for its knobs). Unset keeps the host default (desktop 4×, mobile/web
|
|
113
|
+
* off). The biggest single fill-rate cost after resolution — turn it down on big screens first. */
|
|
114
|
+
antialias?: boolean | 2 | 4 | "taa";
|
|
115
|
+
/** The TAA's knobs (`antialias: "taa"`): `upscale` = render the 3D at this fraction (0.5–1) and let
|
|
116
|
+
* TAA reconstruct the full resolution — the cheap way to a lower render cost with most of the
|
|
117
|
+
* detail kept (`renderScale` shrinks the buffer and stretches it instead); `feedback` = the
|
|
118
|
+
* history's share, 0.12 by default (raise it toward 0.3 if fast motion ghosts); `sharpness` =
|
|
119
|
+
* a post-TAA sharpen 0–1, useful with `upscale`. */
|
|
120
|
+
taa?: TaaOptions;
|
|
99
121
|
/** Keep a stencil buffer for this scene (off by default: it costs memory and a clear per frame).
|
|
100
122
|
* Needed before any material's `stencil` test or write does anything. */
|
|
101
123
|
stencil?: boolean;
|
|
@@ -152,7 +174,8 @@ export declare class Scene implements Presentable {
|
|
|
152
174
|
setRenderOptions(renderScale: number, dynamicResolution?: boolean | {
|
|
153
175
|
min?: number;
|
|
154
176
|
}): void;
|
|
155
|
-
/** Scene occlusion material
|
|
177
|
+
/** Scene occlusion material: an unlit instance in the occluder blue (the built-in `unlit`, which
|
|
178
|
+
* every runtime carries) — one per scene, made on first use. */
|
|
156
179
|
get occlusionMaterial(): Material;
|
|
157
180
|
set skybox(sky: ColorInput | "environment" | {
|
|
158
181
|
texture: string;
|
|
@@ -162,7 +185,7 @@ export declare class Scene implements Presentable {
|
|
|
162
185
|
/** Runtime form of `fog` (weather, entering a building). `false` turns it off. */
|
|
163
186
|
setFog(options: FogOptions | false): void;
|
|
164
187
|
setMaterialGlobalParameter(i: number, x: number, y: number, z: number, w: number): void;
|
|
165
|
-
setAntialias(
|
|
188
|
+
setAntialias(mode: boolean | 2 | 4 | "taa", scale?: number, taa?: TaaOptions): void;
|
|
166
189
|
/** Depth-reading effects on / off (a graphics-settings menu): soft particles and projected decals
|
|
167
190
|
* read the scene depth, which costs a depth pre-pass of every opaque draw (~12 % of a fill-bound
|
|
168
191
|
* frame). Off = hard-edged particles, no decals, no pre-pass. Engine-wide, live. */
|
|
@@ -189,8 +212,8 @@ export declare class Scene implements Presentable {
|
|
|
189
212
|
private static _warnedEnvIntensity;
|
|
190
213
|
/** The scene's stencil buffer on / off (see `SceneOptions.stencil`). */
|
|
191
214
|
setStencil(enabled: boolean): void;
|
|
192
|
-
add(...
|
|
193
|
-
remove(...
|
|
215
|
+
add(...list: Node[]): this;
|
|
216
|
+
remove(...list: Node[]): this;
|
|
194
217
|
/** Attach (and configure) a system, or reconfigure it if already present. Returns the scene typed
|
|
195
218
|
* as now-having it (`scene.system(Hud).hud`). A `System<'x', Scene2D>` is rejected here. */
|
|
196
219
|
system<Self extends TargetOf<A>, A extends Aspect<any, any, any>>(this: Self, ctor: AspectCtor<A>, opts?: Partial<A>): Self & FieldOf<A>;
|
|
@@ -219,11 +242,16 @@ export declare class Scene implements Presentable {
|
|
|
219
242
|
onOpen(callback: () => void): this;
|
|
220
243
|
/** Fires when the scene stops being visible (closed, replaced, or covered by a push). */
|
|
221
244
|
onClose(callback: () => void): this;
|
|
245
|
+
/** Hardware/system back while the scene is current. */
|
|
246
|
+
onBack(callback: () => void): this;
|
|
247
|
+
/** @deprecated Renamed `onBack` (2026-09-26). An alias for the projects compiled before the
|
|
248
|
+
* rename; removed with the release that recompiles them. */
|
|
222
249
|
onBackPressed(callback: () => void): this;
|
|
223
250
|
/** Make this the active scene — shows it as the current destination (replaces a screen /
|
|
224
|
-
* another scene; only the active scene renders).
|
|
251
|
+
* another scene; only the active scene renders). The runtime activates the engine as part of
|
|
252
|
+
* presenting the destination. */
|
|
225
253
|
open(options?: PresentOptions): void | Promise<void>;
|
|
226
|
-
close(): void;
|
|
254
|
+
close(options?: DismissOptions): void;
|
|
227
255
|
addEventListener(channel: "click", callback: (ev: ClickEvent<Node | null>) => void): void;
|
|
228
256
|
addEventListener(channel: "touchstart", callback: (ev: TouchStartEvent<Node | null>) => void): void;
|
|
229
257
|
removeEventListener(channel: "click" | "touchstart", callback: (ev: any) => void): void;
|
|
@@ -248,7 +276,7 @@ export declare class ARScene<T extends ARMode = "default"> extends Scene {
|
|
|
248
276
|
*/
|
|
249
277
|
addControls(target: Node, options?: ControlsOptions): ControlsHandle;
|
|
250
278
|
open(options?: PresentOptions): Promise<void>;
|
|
251
|
-
close(): void;
|
|
279
|
+
close(options?: DismissOptions): void;
|
|
252
280
|
}
|
|
253
281
|
/**
|
|
254
282
|
* A 3D scene rendered in a VR headset (OpenXR — e.g. Meta Quest). The headset drives the camera:
|
|
@@ -260,5 +288,5 @@ export declare class ARScene<T extends ARMode = "default"> extends Scene {
|
|
|
260
288
|
*/
|
|
261
289
|
export declare class VRScene extends Scene {
|
|
262
290
|
open(options?: PresentOptions): Promise<void>;
|
|
263
|
-
close(): void;
|
|
291
|
+
close(options?: DismissOptions): void;
|
|
264
292
|
}
|
|
@@ -29,7 +29,7 @@ export declare class Texture {
|
|
|
29
29
|
wrapS: number;
|
|
30
30
|
/** Vertical wrap mode (V). */
|
|
31
31
|
wrapT: number;
|
|
32
|
-
constructor(width: number, height: number, id: number);
|
|
32
|
+
constructor(width: number, height: number, id: Handle | number);
|
|
33
33
|
static fromCanvas(canvas: {
|
|
34
34
|
_bakeSurface(): number;
|
|
35
35
|
width: number;
|