@nayan-ui/engine 0.0.0-stage → 1.0.0-beta.4
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/LICENSE +21 -0
- package/NayanEngine.podspec +28 -0
- package/README.md +308 -2
- package/lib/module/assets/AssetBytesCache.js +76 -0
- package/lib/module/assets/AssetCache.js +19 -0
- package/lib/module/assets/AssetLoader.js +52 -0
- package/lib/module/assets/CacheGeneration.js +7 -0
- package/lib/module/assets/IndexedDbCache.web.js +149 -0
- package/lib/module/assets/ProceduralCache.js +249 -0
- package/lib/module/assets/font.js +139 -0
- package/lib/module/assets/loft.js +142 -0
- package/lib/module/assets/model.js +96 -0
- package/lib/module/assets/modelling.js +254 -0
- package/lib/module/assets/shape.js +926 -0
- package/lib/module/assets/source.js +58 -0
- package/lib/module/assets/source.web.js +22 -0
- package/lib/module/assets/storage.js +4 -0
- package/lib/module/assets/storage.shared.js +38 -0
- package/lib/module/assets/storage.web.js +38 -0
- package/lib/module/assets/surface.js +47 -0
- package/lib/module/assets/texture.js +69 -0
- package/lib/module/drawing/DrawingCanvas.js +38 -0
- package/lib/module/drawing/DrawingCanvas.web.js +206 -0
- package/lib/module/drawing/DrawingDocument.js +256 -0
- package/lib/module/drawing/types.js +4 -0
- package/lib/module/globals.d.ts +12 -0
- package/lib/module/index.js +39 -0
- package/lib/module/input/Joystick.js +84 -0
- package/lib/module/input/Joystick.web.js +93 -0
- package/lib/module/input/keyboard.js +250 -0
- package/lib/module/media/audio-worklet.js +34 -0
- package/lib/module/media/audio.js +97 -0
- package/lib/module/media/haptics.js +82 -0
- package/lib/module/media/output.web.js +66 -0
- package/lib/module/native/BrowserEngine.js +568 -0
- package/lib/module/native/EngineBridge.js +4 -0
- package/lib/module/native/NativeNayanEngine.js +7 -0
- package/lib/module/native/NativeNayanEngine.web.js +62 -0
- package/lib/module/native/prepare.js +7 -0
- package/lib/module/native/prepare.web.js +17 -0
- package/lib/module/native/spec/NativeNayanEngine.js +17 -0
- package/lib/module/package.json +1 -0
- package/lib/module/render/GameView.js +317 -0
- package/lib/module/render/camera.js +34 -0
- package/lib/module/render/host.js +39 -0
- package/lib/module/render/host.web.js +104 -0
- package/lib/module/render/light.js +24 -0
- package/lib/module/render/meshes.js +159 -0
- package/lib/module/render/quality.js +119 -0
- package/lib/module/render/responder.js +4 -0
- package/lib/module/render/responder.web.js +97 -0
- package/lib/module/render/touch.js +185 -0
- package/lib/module/render/useWorld.js +72 -0
- package/lib/module/types.js +30 -0
- package/lib/module/world/Scoreboard.js +161 -0
- package/lib/module/world/TransformBatch.js +128 -0
- package/lib/module/world/World.js +704 -0
- package/lib/module/world/color.js +80 -0
- package/lib/module/world/desc.js +187 -0
- package/lib/module/world/effects.js +463 -0
- package/lib/module/world/quat.js +86 -0
- package/lib/module/world/types.js +4 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/assets/AssetBytesCache.d.ts +7 -0
- package/lib/typescript/src/assets/AssetCache.d.ts +9 -0
- package/lib/typescript/src/assets/AssetLoader.d.ts +11 -0
- package/lib/typescript/src/assets/CacheGeneration.d.ts +3 -0
- package/lib/typescript/src/assets/IndexedDbCache.web.d.ts +20 -0
- package/lib/typescript/src/assets/ProceduralCache.d.ts +45 -0
- package/lib/typescript/src/assets/font.d.ts +53 -0
- package/lib/typescript/src/assets/loft.d.ts +31 -0
- package/lib/typescript/src/assets/model.d.ts +58 -0
- package/lib/typescript/src/assets/modelling.d.ts +157 -0
- package/lib/typescript/src/assets/shape.d.ts +203 -0
- package/lib/typescript/src/assets/source.d.ts +10 -0
- package/lib/typescript/src/assets/source.web.d.ts +8 -0
- package/lib/typescript/src/assets/storage.d.ts +2 -0
- package/lib/typescript/src/assets/storage.shared.d.ts +7 -0
- package/lib/typescript/src/assets/storage.web.d.ts +7 -0
- package/lib/typescript/src/assets/surface.d.ts +17 -0
- package/lib/typescript/src/assets/texture.d.ts +30 -0
- package/lib/typescript/src/drawing/DrawingCanvas.d.ts +5 -0
- package/lib/typescript/src/drawing/DrawingCanvas.web.d.ts +4 -0
- package/lib/typescript/src/drawing/DrawingDocument.d.ts +210 -0
- package/lib/typescript/src/drawing/types.d.ts +12 -0
- package/lib/typescript/src/index.d.ts +45 -0
- package/lib/typescript/src/input/Joystick.d.ts +20 -0
- package/lib/typescript/src/input/Joystick.web.d.ts +13 -0
- package/lib/typescript/src/input/keyboard.d.ts +17 -0
- package/lib/typescript/src/media/audio.d.ts +46 -0
- package/lib/typescript/src/media/haptics.d.ts +22 -0
- package/lib/typescript/src/media/output.web.d.ts +4 -0
- package/lib/typescript/src/native/BrowserEngine.d.ts +8 -0
- package/lib/typescript/src/native/EngineBridge.d.ts +26 -0
- package/lib/typescript/src/native/NativeNayanEngine.d.ts +5 -0
- package/lib/typescript/src/native/NativeNayanEngine.web.d.ts +10 -0
- package/lib/typescript/src/native/prepare.d.ts +3 -0
- package/lib/typescript/src/native/prepare.web.d.ts +2 -0
- package/lib/typescript/src/native/spec/NativeNayanEngine.d.ts +211 -0
- package/lib/typescript/src/render/GameView.d.ts +107 -0
- package/lib/typescript/src/render/camera.d.ts +6 -0
- package/lib/typescript/src/render/host.d.ts +29 -0
- package/lib/typescript/src/render/host.web.d.ts +16 -0
- package/lib/typescript/src/render/light.d.ts +12 -0
- package/lib/typescript/src/render/meshes.d.ts +45 -0
- package/lib/typescript/src/render/quality.d.ts +48 -0
- package/lib/typescript/src/render/responder.d.ts +2 -0
- package/lib/typescript/src/render/responder.web.d.ts +40 -0
- package/lib/typescript/src/render/touch.d.ts +26 -0
- package/lib/typescript/src/render/useWorld.d.ts +20 -0
- package/lib/typescript/src/types.d.ts +81 -0
- package/lib/typescript/src/world/Scoreboard.d.ts +75 -0
- package/lib/typescript/src/world/TransformBatch.d.ts +39 -0
- package/lib/typescript/src/world/World.d.ts +207 -0
- package/lib/typescript/src/world/color.d.ts +18 -0
- package/lib/typescript/src/world/desc.d.ts +17 -0
- package/lib/typescript/src/world/effects.d.ts +157 -0
- package/lib/typescript/src/world/quat.d.ts +31 -0
- package/lib/typescript/src/world/types.d.ts +238 -0
- package/lib/web/audio-worklet.js +29 -0
- package/lib/web/engine_core_bg.wasm +0 -0
- package/lib/web/index.js +8240 -0
- package/lib/web/types/src/assets/AssetBytesCache.d.ts +6 -0
- package/lib/web/types/src/assets/AssetCache.d.ts +8 -0
- package/lib/web/types/src/assets/AssetLoader.d.ts +10 -0
- package/lib/web/types/src/assets/CacheGeneration.d.ts +2 -0
- package/lib/web/types/src/assets/IndexedDbCache.d.ts +19 -0
- package/lib/web/types/src/assets/ProceduralCache.d.ts +44 -0
- package/lib/web/types/src/assets/font.d.ts +52 -0
- package/lib/web/types/src/assets/loft.d.ts +30 -0
- package/lib/web/types/src/assets/model.d.ts +57 -0
- package/lib/web/types/src/assets/modelling.d.ts +156 -0
- package/lib/web/types/src/assets/shape.d.ts +202 -0
- package/lib/web/types/src/assets/source.d.ts +7 -0
- package/lib/web/types/src/assets/storage.d.ts +6 -0
- package/lib/web/types/src/assets/storage.shared.d.ts +6 -0
- package/lib/web/types/src/assets/surface.d.ts +16 -0
- package/lib/web/types/src/assets/texture.d.ts +29 -0
- package/lib/web/types/src/drawing/DrawingCanvas.d.ts +3 -0
- package/lib/web/types/src/drawing/DrawingDocument.d.ts +209 -0
- package/lib/web/types/src/drawing/types.d.ts +11 -0
- package/lib/web/types/src/index.d.ts +44 -0
- package/lib/web/types/src/input/Joystick.d.ts +12 -0
- package/lib/web/types/src/input/keyboard.d.ts +16 -0
- package/lib/web/types/src/media/audio.d.ts +45 -0
- package/lib/web/types/src/media/haptics.d.ts +21 -0
- package/lib/web/types/src/media/output.d.ts +3 -0
- package/lib/web/types/src/native/BrowserEngine.d.ts +7 -0
- package/lib/web/types/src/native/EngineBridge.d.ts +25 -0
- package/lib/web/types/src/native/NativeNayanEngine.d.ts +9 -0
- package/lib/web/types/src/native/prepare.d.ts +1 -0
- package/lib/web/types/src/native/spec/NativeNayanEngine.d.ts +210 -0
- package/lib/web/types/src/render/GameView.d.ts +106 -0
- package/lib/web/types/src/render/camera.d.ts +5 -0
- package/lib/web/types/src/render/host.d.ts +15 -0
- package/lib/web/types/src/render/light.d.ts +11 -0
- package/lib/web/types/src/render/meshes.d.ts +44 -0
- package/lib/web/types/src/render/quality.d.ts +47 -0
- package/lib/web/types/src/render/responder.d.ts +39 -0
- package/lib/web/types/src/render/touch.d.ts +25 -0
- package/lib/web/types/src/render/useWorld.d.ts +19 -0
- package/lib/web/types/src/types.d.ts +80 -0
- package/lib/web/types/src/world/Scoreboard.d.ts +74 -0
- package/lib/web/types/src/world/TransformBatch.d.ts +38 -0
- package/lib/web/types/src/world/World.d.ts +206 -0
- package/lib/web/types/src/world/color.d.ts +17 -0
- package/lib/web/types/src/world/desc.d.ts +16 -0
- package/lib/web/types/src/world/effects.d.ts +156 -0
- package/lib/web/types/src/world/quat.d.ts +30 -0
- package/lib/web/types/src/world/types.d.ts +237 -0
- package/native/android/CMakeLists.txt +34 -0
- package/native/android/NayanEngineSpec.h +15 -0
- package/native/android/build.gradle +26 -0
- package/native/android/codegen/CMakeLists.txt +3 -0
- package/native/android/proguard-rules.pro +2 -0
- package/native/android/src/main/java/com/nayanui/engine/EngineSurfaceView.java +295 -0
- package/native/android/src/main/java/com/nayanui/engine/EngineSurfaceViewManager.java +45 -0
- package/native/android/src/main/java/com/nayanui/engine/NayanEnginePackage.java +24 -0
- package/native/core/build/EngineCore.xcframework/Info.plist +43 -0
- package/native/core/build/EngineCore.xcframework/ios-arm64/libengine_core.a +0 -0
- package/native/core/build/EngineCore.xcframework/ios-arm64-simulator/libengine_core.a +0 -0
- package/native/core/build/android/arm64-v8a/libengine_core.a +0 -0
- package/native/core/build/android/armeabi-v7a/libengine_core.a +0 -0
- package/native/core/build/android/x86/libengine_core.a +0 -0
- package/native/core/build/android/x86_64/libengine_core.a +0 -0
- package/native/core/include/drawing-licenses.txt +58 -0
- package/native/core/include/engine_core.h +331 -0
- package/native/cpp/NayanEngineModule.cpp +998 -0
- package/native/cpp/NayanEngineModule.h +174 -0
- package/native/cpp/generated/NayanEngineSpecJSI.cpp +2 -0
- package/native/cpp/generated/NayanEngineSpecJSI.h +1026 -0
- package/native/ios/NayanEngineProvider.h +5 -0
- package/native/ios/NayanEngineProvider.mm +21 -0
- package/native/ios/NayanEngineSurface.mm +252 -0
- package/native/scripts/check-package.mjs +39 -0
- package/package.json +162 -4
- package/react-native.config.js +18 -0
- package/src/native/spec/NativeNayanEngine.ts +265 -0
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Ready-made particle effects and the cleared-piece pop, built from `world.burst` and `world.animate`.
|
|
4
|
+
//
|
|
5
|
+
// A single burst gives every particle 50..100% of one top speed, so on its own it flies out as a
|
|
6
|
+
// hollow shell of same-sized bits that pop out of existence. These effects mix a few bursts instead:
|
|
7
|
+
// slow big pieces that fill the middle and fast small ones at the edge, an additive glow that flashes
|
|
8
|
+
// at the source (visible on dark scenes, harmless on light ones), and soft puffs that linger and fade.
|
|
9
|
+
// Every particle takes a world slot, out of the capacity shared with the game's own entities, so the
|
|
10
|
+
// counts stay close to what was passed in. Effects run entirely in the Rust core after one call each.
|
|
11
|
+
|
|
12
|
+
import { resolveColor, resolveColors } from "./color.js";
|
|
13
|
+
|
|
14
|
+
/** Shared options of the layered effects (confetti, sparkle, shatter, splash, sparks, explosion). */
|
|
15
|
+
|
|
16
|
+
/** A soft cloud of puffs that swell and fade: landing dust, kicked-up sand, sawdust, steam, muzzle smoke. */
|
|
17
|
+
|
|
18
|
+
/** One glow that swells and fades at a point: a hit, a strike, a muzzle flash. */
|
|
19
|
+
|
|
20
|
+
/** The cleared-piece pop: swell, flash white, settle, shrink away. */
|
|
21
|
+
|
|
22
|
+
const rgba = input => {
|
|
23
|
+
const c = resolveColor(input);
|
|
24
|
+
return [c[0], c[1], c[2], c[3] ?? 1];
|
|
25
|
+
};
|
|
26
|
+
const list = colors => resolveColors(colors).map(rgba);
|
|
27
|
+
const part = (count, share) => Math.max(1, Math.round(count * share));
|
|
28
|
+
const fade = input => {
|
|
29
|
+
const c = resolveColor(input);
|
|
30
|
+
return [c[0], c[1], c[2], 0];
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/** The colors' average. */
|
|
34
|
+
function mean(colors) {
|
|
35
|
+
const sum = [0, 0, 0, 0];
|
|
36
|
+
for (const c of colors) for (let i = 0; i < 4; i++) sum[i] += c[i];
|
|
37
|
+
return sum.map(v => v / colors.length);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** The same hue, self-lit: its brightest channel lifted to `peak` (above 1 glows, through light, shadow and fog). */
|
|
41
|
+
function hot(input, peak = 2.2, alpha) {
|
|
42
|
+
const c = resolveColor(input);
|
|
43
|
+
alpha ??= c[3] ?? 1;
|
|
44
|
+
const k = peak / Math.max(c[0], c[1], c[2], 0.25);
|
|
45
|
+
return [c[0] * k, c[1] * k, c[2] * k, alpha];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Part way (`t`, 0..1) to white, with `alpha`. */
|
|
49
|
+
function pale(input, t, alpha) {
|
|
50
|
+
const c = resolveColor(input);
|
|
51
|
+
alpha ??= c[3] ?? 1;
|
|
52
|
+
return [c[0] + (1 - c[0]) * t, c[1] + (1 - c[1]) * t, c[2] + (1 - c[2]) * t, alpha];
|
|
53
|
+
}
|
|
54
|
+
function aim(e) {
|
|
55
|
+
return {
|
|
56
|
+
position: e.position,
|
|
57
|
+
direction: e.direction ?? [0, 1, 0],
|
|
58
|
+
spread: e.spread ?? Math.PI
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function flash(world, o) {
|
|
62
|
+
return world.burst({
|
|
63
|
+
position: o.position,
|
|
64
|
+
count: o.count ?? 1,
|
|
65
|
+
mesh: o.mesh ?? 'flame',
|
|
66
|
+
size: o.size,
|
|
67
|
+
speed: o.speed ?? 0,
|
|
68
|
+
lifetime: o.lifetime ?? 0.22,
|
|
69
|
+
gravity: 0,
|
|
70
|
+
color: o.color,
|
|
71
|
+
endSize: o.endSize ?? 2.2,
|
|
72
|
+
endColor: o.endColor ?? fade(o.color)
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** A glow that swells and fades at the source, in the effect's own hue. */
|
|
77
|
+
function glowFlash(world, e, colors, size) {
|
|
78
|
+
flash(world, {
|
|
79
|
+
position: e.position,
|
|
80
|
+
color: hot(mean(colors), 2, 0.85),
|
|
81
|
+
size
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function dust(world, o) {
|
|
85
|
+
const colors = resolveColors(o.color);
|
|
86
|
+
return world.burst({
|
|
87
|
+
position: o.position,
|
|
88
|
+
count: o.count,
|
|
89
|
+
mesh: o.mesh ?? 'puff',
|
|
90
|
+
size: o.size,
|
|
91
|
+
speed: o.speed,
|
|
92
|
+
lifetime: o.lifetime,
|
|
93
|
+
gravity: o.gravity ?? 0,
|
|
94
|
+
direction: o.direction,
|
|
95
|
+
spread: o.spread,
|
|
96
|
+
color: colors.length === 1 ? colors[0] : colors,
|
|
97
|
+
endSize: o.endSize ?? 2,
|
|
98
|
+
endColor: o.endColor ?? (colors.length === 1 ? fade(colors[0]) : undefined)
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** Celebration confetti: tumbling paper in two layers, a few glinting sparkles, and a pop of light. */
|
|
103
|
+
function confetti(world, e) {
|
|
104
|
+
const colors = list(e.colors);
|
|
105
|
+
const g = (e.gravity ?? 0) * 0.65; // paper drifts down rather than dropping
|
|
106
|
+
const base = {
|
|
107
|
+
...aim(e),
|
|
108
|
+
mesh: 'cube',
|
|
109
|
+
gravity: g,
|
|
110
|
+
color: colors,
|
|
111
|
+
endSize: 0.3
|
|
112
|
+
};
|
|
113
|
+
world.burst({
|
|
114
|
+
...base,
|
|
115
|
+
count: part(e.count, 0.55),
|
|
116
|
+
size: e.size,
|
|
117
|
+
speed: e.speed,
|
|
118
|
+
lifetime: e.lifetime * 1.15
|
|
119
|
+
});
|
|
120
|
+
world.burst({
|
|
121
|
+
...base,
|
|
122
|
+
count: part(e.count, 0.3),
|
|
123
|
+
size: e.size * 0.7,
|
|
124
|
+
speed: e.speed * 0.5,
|
|
125
|
+
lifetime: e.lifetime
|
|
126
|
+
});
|
|
127
|
+
const glint = colors.slice(0, 4).map(c => hot(pale(c, 0.5, 1), 2.4));
|
|
128
|
+
world.burst({
|
|
129
|
+
...aim(e),
|
|
130
|
+
count: part(e.count, 0.15),
|
|
131
|
+
mesh: 'flame',
|
|
132
|
+
size: e.size * 1.1,
|
|
133
|
+
speed: e.speed * 0.8,
|
|
134
|
+
lifetime: e.lifetime * 0.8,
|
|
135
|
+
gravity: g * 0.5,
|
|
136
|
+
color: glint,
|
|
137
|
+
endSize: 0
|
|
138
|
+
});
|
|
139
|
+
if (e.flash !== false) glowFlash(world, e, [[1, 0.95, 0.8, 1]], e.size * 7);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** Glitter for a reward: solid bright beads (seen on any background) with additive glints around them. */
|
|
143
|
+
function sparkle(world, e) {
|
|
144
|
+
const colors = list(e.colors);
|
|
145
|
+
const bright = colors.map(c => hot(c, 1.4));
|
|
146
|
+
const base = {
|
|
147
|
+
...aim(e),
|
|
148
|
+
gravity: e.gravity ?? 0,
|
|
149
|
+
endSize: 0
|
|
150
|
+
};
|
|
151
|
+
world.burst({
|
|
152
|
+
...base,
|
|
153
|
+
count: part(e.count, 0.35),
|
|
154
|
+
mesh: 'sphere',
|
|
155
|
+
size: e.size,
|
|
156
|
+
speed: e.speed,
|
|
157
|
+
lifetime: e.lifetime,
|
|
158
|
+
color: bright
|
|
159
|
+
});
|
|
160
|
+
world.burst({
|
|
161
|
+
...base,
|
|
162
|
+
count: part(e.count, 0.25),
|
|
163
|
+
mesh: 'sphere',
|
|
164
|
+
size: e.size * 1.3,
|
|
165
|
+
speed: e.speed * 0.45,
|
|
166
|
+
lifetime: e.lifetime * 0.85,
|
|
167
|
+
color: bright
|
|
168
|
+
});
|
|
169
|
+
world.burst({
|
|
170
|
+
...base,
|
|
171
|
+
count: part(e.count, 0.4),
|
|
172
|
+
mesh: 'flame',
|
|
173
|
+
size: e.size * 1.6,
|
|
174
|
+
speed: e.speed * 0.8,
|
|
175
|
+
lifetime: e.lifetime * 0.9,
|
|
176
|
+
color: colors.map(c => hot(pale(c, 0.35, 1), 2.4))
|
|
177
|
+
});
|
|
178
|
+
if (e.flash !== false) glowFlash(world, e, colors, e.size * 6);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Something breaking apart: big slow chunks, small fast crumbs, a glow at the break and a puff of
|
|
183
|
+
* its dust. `mesh` is the chunks' shape.
|
|
184
|
+
*/
|
|
185
|
+
function shatter(world, e) {
|
|
186
|
+
const colors = list(e.colors);
|
|
187
|
+
const mesh = e.mesh ?? 'cube';
|
|
188
|
+
const base = {
|
|
189
|
+
...aim(e),
|
|
190
|
+
gravity: e.gravity ?? 0,
|
|
191
|
+
color: colors
|
|
192
|
+
};
|
|
193
|
+
world.burst({
|
|
194
|
+
...base,
|
|
195
|
+
count: part(e.count, 0.55),
|
|
196
|
+
mesh,
|
|
197
|
+
size: e.size * 1.1,
|
|
198
|
+
speed: e.speed * 0.65,
|
|
199
|
+
lifetime: e.lifetime,
|
|
200
|
+
endSize: 0.2
|
|
201
|
+
});
|
|
202
|
+
world.burst({
|
|
203
|
+
...base,
|
|
204
|
+
count: part(e.count, 0.6),
|
|
205
|
+
mesh,
|
|
206
|
+
size: e.size * 0.5,
|
|
207
|
+
speed: e.speed * 1.1,
|
|
208
|
+
lifetime: e.lifetime * 0.85,
|
|
209
|
+
endSize: 0
|
|
210
|
+
});
|
|
211
|
+
if (e.flash !== false) glowFlash(world, e, colors, e.size * 3);
|
|
212
|
+
if (e.dust !== false) {
|
|
213
|
+
const c = pale(mean(colors), 0.45, 0.5);
|
|
214
|
+
world.burst({
|
|
215
|
+
...aim(e),
|
|
216
|
+
count: 2,
|
|
217
|
+
mesh: 'puff',
|
|
218
|
+
size: e.size * 2,
|
|
219
|
+
speed: e.speed * 0.2,
|
|
220
|
+
lifetime: e.lifetime * 0.9,
|
|
221
|
+
gravity: 0,
|
|
222
|
+
color: c,
|
|
223
|
+
endSize: 2.4,
|
|
224
|
+
endColor: fade(c)
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/** Liquid: droplets in two sizes thrown out of a fine mist of the same color. */
|
|
230
|
+
function splash(world, e) {
|
|
231
|
+
const colors = list(e.colors);
|
|
232
|
+
const base = {
|
|
233
|
+
...aim(e),
|
|
234
|
+
mesh: 'sphere',
|
|
235
|
+
gravity: e.gravity ?? 0,
|
|
236
|
+
color: colors
|
|
237
|
+
};
|
|
238
|
+
world.burst({
|
|
239
|
+
...base,
|
|
240
|
+
count: part(e.count, 0.6),
|
|
241
|
+
size: e.size,
|
|
242
|
+
speed: e.speed,
|
|
243
|
+
lifetime: e.lifetime,
|
|
244
|
+
endSize: 0.3
|
|
245
|
+
});
|
|
246
|
+
world.burst({
|
|
247
|
+
...base,
|
|
248
|
+
count: part(e.count, 0.4),
|
|
249
|
+
size: e.size * 1.5,
|
|
250
|
+
speed: e.speed * 0.45,
|
|
251
|
+
lifetime: e.lifetime * 0.8,
|
|
252
|
+
endSize: 0.2
|
|
253
|
+
});
|
|
254
|
+
const mist = pale(mean(colors), 0.2, 0.55);
|
|
255
|
+
world.burst({
|
|
256
|
+
...aim(e),
|
|
257
|
+
count: 3,
|
|
258
|
+
mesh: 'puff',
|
|
259
|
+
size: e.size * 3,
|
|
260
|
+
speed: e.speed * 0.25,
|
|
261
|
+
lifetime: e.lifetime * 0.7,
|
|
262
|
+
gravity: 0,
|
|
263
|
+
color: mist,
|
|
264
|
+
endSize: 2.2,
|
|
265
|
+
endColor: fade(mist)
|
|
266
|
+
});
|
|
267
|
+
if (e.flash !== false) glowFlash(world, e, colors, e.size * 4);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/** Hot metal sparks: additive streaks that burn out, with a few solid beads and a flash where they strike. */
|
|
271
|
+
function sparks(world, e) {
|
|
272
|
+
const colors = list(e.colors).map(c => hot(c, 2.6));
|
|
273
|
+
const base = {
|
|
274
|
+
...aim(e),
|
|
275
|
+
gravity: e.gravity ?? 0,
|
|
276
|
+
color: colors,
|
|
277
|
+
endSize: 0
|
|
278
|
+
};
|
|
279
|
+
world.burst({
|
|
280
|
+
...base,
|
|
281
|
+
count: part(e.count, 0.7),
|
|
282
|
+
mesh: 'flame',
|
|
283
|
+
size: e.size * 1.6,
|
|
284
|
+
speed: e.speed,
|
|
285
|
+
lifetime: e.lifetime
|
|
286
|
+
});
|
|
287
|
+
world.burst({
|
|
288
|
+
...base,
|
|
289
|
+
count: part(e.count, 0.3),
|
|
290
|
+
mesh: 'sphere',
|
|
291
|
+
size: e.size * 0.6,
|
|
292
|
+
speed: e.speed * 1.1,
|
|
293
|
+
lifetime: e.lifetime * 0.8
|
|
294
|
+
});
|
|
295
|
+
if (e.flash !== false) glowFlash(world, e, colors, e.size * 5);
|
|
296
|
+
}
|
|
297
|
+
const FIRE = [[2.6, 2.4, 1.8, 1], [2.4, 1.5, 0.45, 0.95], [2.2, 0.8, 0.2, 0.85]];
|
|
298
|
+
const EMBERS = [[2.8, 2.2, 1, 1], [2.6, 1.3, 0.3, 1]];
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* A fiery blast: a white-hot flash, a fireball that cools into smoke, embers thrown out and, given
|
|
302
|
+
* `debris` colors, chunks of whatever blew up. `size` is the fireball's puff size; `colors` its fire.
|
|
303
|
+
* The fire and smoke swell every way; `direction`, `spread` and `gravity` aim the embers and debris.
|
|
304
|
+
*/
|
|
305
|
+
function explosion(world, e) {
|
|
306
|
+
const fire = list(e.colors ?? FIRE);
|
|
307
|
+
const smoke = rgba(e.smoke ?? [0.28, 0.25, 0.24, 0.6]);
|
|
308
|
+
const g = e.gravity ?? 0;
|
|
309
|
+
const around = {
|
|
310
|
+
position: e.position,
|
|
311
|
+
spread: Math.PI,
|
|
312
|
+
gravity: 0
|
|
313
|
+
};
|
|
314
|
+
if (e.flash !== false) {
|
|
315
|
+
flash(world, {
|
|
316
|
+
position: e.position,
|
|
317
|
+
color: [3, 2.7, 2.1, 1],
|
|
318
|
+
size: e.size * 1.6,
|
|
319
|
+
lifetime: 0.2,
|
|
320
|
+
endSize: 2,
|
|
321
|
+
endColor: [2.4, 0.9, 0.2, 0]
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
world.burst({
|
|
325
|
+
...around,
|
|
326
|
+
count: part(e.count, 0.5),
|
|
327
|
+
mesh: 'puff',
|
|
328
|
+
size: e.size,
|
|
329
|
+
speed: e.speed,
|
|
330
|
+
lifetime: e.lifetime,
|
|
331
|
+
color: fire,
|
|
332
|
+
endSize: 2.2,
|
|
333
|
+
endColor: [smoke[0], smoke[1], smoke[2], 0]
|
|
334
|
+
});
|
|
335
|
+
world.burst({
|
|
336
|
+
...around,
|
|
337
|
+
count: part(e.count, 0.2),
|
|
338
|
+
mesh: 'flame',
|
|
339
|
+
size: e.size * 0.8,
|
|
340
|
+
speed: e.speed * 0.5,
|
|
341
|
+
lifetime: e.lifetime * 0.6,
|
|
342
|
+
color: fire,
|
|
343
|
+
endSize: 1.8,
|
|
344
|
+
endColor: [2, 0.5, 0.1, 0]
|
|
345
|
+
});
|
|
346
|
+
world.burst({
|
|
347
|
+
...around,
|
|
348
|
+
count: part(e.count, 0.25),
|
|
349
|
+
mesh: 'puff',
|
|
350
|
+
size: e.size * 0.9,
|
|
351
|
+
speed: e.speed * 0.6,
|
|
352
|
+
lifetime: e.lifetime * 1.7,
|
|
353
|
+
color: smoke,
|
|
354
|
+
endSize: 2.8,
|
|
355
|
+
endColor: fade(smoke)
|
|
356
|
+
});
|
|
357
|
+
world.burst({
|
|
358
|
+
...aim(e),
|
|
359
|
+
count: part(e.count, 0.4),
|
|
360
|
+
mesh: 'flame',
|
|
361
|
+
size: e.size * 0.12,
|
|
362
|
+
speed: e.speed * 2.4,
|
|
363
|
+
lifetime: e.lifetime * 0.9,
|
|
364
|
+
gravity: g,
|
|
365
|
+
color: EMBERS,
|
|
366
|
+
endSize: 0
|
|
367
|
+
});
|
|
368
|
+
if (e.debris) {
|
|
369
|
+
world.burst({
|
|
370
|
+
...aim(e),
|
|
371
|
+
count: part(e.count, 0.5),
|
|
372
|
+
mesh: 'cube',
|
|
373
|
+
size: e.size * 0.16,
|
|
374
|
+
speed: e.speed * 1.8,
|
|
375
|
+
lifetime: e.lifetime * 1.2,
|
|
376
|
+
gravity: g,
|
|
377
|
+
color: e.debris,
|
|
378
|
+
endSize: 0.3
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
const WHITE_HOT = [2, 2, 2, 1]; // above 1 glows
|
|
383
|
+
const WHITE = [1, 1, 1, 1];
|
|
384
|
+
const POP_TIME = 0.5;
|
|
385
|
+
const times = (scale, k) => typeof scale === 'number' ? scale * k : [scale[0] * k, scale[1] * k, scale[2] * k];
|
|
386
|
+
|
|
387
|
+
/** The piece swells, flashes white, settles and shrinks away. Resolves when it's gone (despawning it is the caller's). */
|
|
388
|
+
function pop(world, entity, o) {
|
|
389
|
+
const delay = o.delay ?? 0;
|
|
390
|
+
const duration = o.duration ?? POP_TIME;
|
|
391
|
+
const flashFor = {
|
|
392
|
+
duration: duration * 0.3,
|
|
393
|
+
delay
|
|
394
|
+
};
|
|
395
|
+
world.stopAnimation(entity); // whatever it was doing (landing, falling, wobbling) gives way
|
|
396
|
+
if (o.color) world.animate(entity, [{
|
|
397
|
+
color: WHITE_HOT,
|
|
398
|
+
at: 0.33
|
|
399
|
+
}, {
|
|
400
|
+
color: o.color
|
|
401
|
+
}], flashFor);
|
|
402
|
+
if (o.flash?.length) world.animate(o.flash, [{
|
|
403
|
+
color: WHITE_HOT,
|
|
404
|
+
at: 0.33
|
|
405
|
+
}, {
|
|
406
|
+
color: WHITE
|
|
407
|
+
}], flashFor);
|
|
408
|
+
const s = o.scale;
|
|
409
|
+
return world.animate(entity, [{
|
|
410
|
+
scale: times(s, 1.35),
|
|
411
|
+
at: 0.15
|
|
412
|
+
}, {
|
|
413
|
+
scale: times(s, 0.9),
|
|
414
|
+
at: 0.25
|
|
415
|
+
}, {
|
|
416
|
+
scale: times(s, 1),
|
|
417
|
+
at: 0.35
|
|
418
|
+
}, {
|
|
419
|
+
scale: times(s, 0)
|
|
420
|
+
}], {
|
|
421
|
+
duration,
|
|
422
|
+
delay
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Ready-made effects. Each is one call; particles then live, fall, shrink and recolor in Rust.
|
|
428
|
+
*
|
|
429
|
+
* ```ts
|
|
430
|
+
* effects.confetti(world, { position, colors: [RED, GOLD], size: 0.12, speed: 6, count: 40, lifetime: 1.2, gravity: -6 });
|
|
431
|
+
* effects.dust(world, { position: feet, color: [0.8, 0.75, 0.65, 0.6], size: 0.3, speed: 1.5, count: 6, lifetime: 0.5 });
|
|
432
|
+
* effects.flash(world, { position: hit, color: effects.hot(ORANGE), size: 0.8 });
|
|
433
|
+
* await effects.pop(world, candy, { scale: 1, color: RED });
|
|
434
|
+
* world.despawn(candy);
|
|
435
|
+
* ```
|
|
436
|
+
*/
|
|
437
|
+
export const effects = {
|
|
438
|
+
/** Celebration: tumbling paper, glints and a pop of light (wins, level-ups). */
|
|
439
|
+
confetti,
|
|
440
|
+
/** Reward glitter: bright beads and glints (pickups, perfect moves). */
|
|
441
|
+
sparkle,
|
|
442
|
+
/** Breaking apart: chunks, crumbs, a glow and dust (bricks, crates, glass). `mesh` shapes the chunks. */
|
|
443
|
+
shatter,
|
|
444
|
+
/** Liquid: droplets and mist (water, juice, paint). */
|
|
445
|
+
splash,
|
|
446
|
+
/** Hot metal: additive streaks and beads (scrapes, strikes, electricity). */
|
|
447
|
+
sparks,
|
|
448
|
+
/** Fiery blast: flash, fireball cooling to smoke, embers and optional debris. */
|
|
449
|
+
explosion,
|
|
450
|
+
/** Soft swelling puffs: dust, sand, sawdust, steam, smoke. */
|
|
451
|
+
dust,
|
|
452
|
+
/** One swelling glow: hits, strikes, muzzle flashes. */
|
|
453
|
+
flash,
|
|
454
|
+
/** The cleared-piece animation: swell, flash white, settle, shrink to nothing. */
|
|
455
|
+
pop,
|
|
456
|
+
/** Default `pop` duration in seconds. */
|
|
457
|
+
POP_TIME,
|
|
458
|
+
/** The same hue made self-lit (brightest channel lifted to `peak`), for glows. */
|
|
459
|
+
hot,
|
|
460
|
+
/** Part way (`t`, 0..1) to white. */
|
|
461
|
+
pale
|
|
462
|
+
};
|
|
463
|
+
//# sourceMappingURL=effects.js.map
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/** A writable quaternion; pass one as `out` to reuse it instead of allocating. */
|
|
4
|
+
|
|
5
|
+
const result = (out, x, y, z, w) => {
|
|
6
|
+
if (!out) return [x, y, z, w];
|
|
7
|
+
out[0] = x;
|
|
8
|
+
out[1] = y;
|
|
9
|
+
out[2] = z;
|
|
10
|
+
out[3] = w;
|
|
11
|
+
return out;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Quaternion helpers for `rotation` options, keyframes and geometry parts ([x, y, z, w]). Every
|
|
16
|
+
* function takes an optional `out` so per-frame code can reuse one array instead of allocating.
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* world.set(car, { rotation: quat.y(heading) });
|
|
20
|
+
* const spin = quat.multiply(quat.y(yaw), quat.x(pitch), scratch); // pitch first, then yaw
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export const quat = {
|
|
24
|
+
/** No rotation. */
|
|
25
|
+
identity: Object.freeze([0, 0, 0, 1]),
|
|
26
|
+
/** Rotation by `angle` radians around the unit axis (x, y, z). */
|
|
27
|
+
axisAngle(x, y, z, angle, out) {
|
|
28
|
+
const s = Math.sin(angle / 2);
|
|
29
|
+
return result(out, x * s, y * s, z * s, Math.cos(angle / 2));
|
|
30
|
+
},
|
|
31
|
+
/** Rotation around the x axis (pitch). */
|
|
32
|
+
x(angle, out) {
|
|
33
|
+
return result(out, Math.sin(angle / 2), 0, 0, Math.cos(angle / 2));
|
|
34
|
+
},
|
|
35
|
+
/** Rotation around the y axis (yaw, heading). */
|
|
36
|
+
y(angle, out) {
|
|
37
|
+
return result(out, 0, Math.sin(angle / 2), 0, Math.cos(angle / 2));
|
|
38
|
+
},
|
|
39
|
+
/** Rotation around the z axis (roll; spin for 2D games looking down -z). */
|
|
40
|
+
z(angle, out) {
|
|
41
|
+
return result(out, 0, 0, Math.sin(angle / 2), Math.cos(angle / 2));
|
|
42
|
+
},
|
|
43
|
+
/** `a` after `b`: `b` turns first. `out` may be `a` or `b`. */
|
|
44
|
+
multiply(a, b, out) {
|
|
45
|
+
const [ax, ay, az, aw] = a;
|
|
46
|
+
const [bx, by, bz, bw] = b;
|
|
47
|
+
return result(out, aw * bx + ax * bw + ay * bz - az * by, aw * by - ax * bz + ay * bw + az * bx, aw * bz + ax * by - ay * bx + az * bw, aw * bw - ax * bx - ay * by - az * bz);
|
|
48
|
+
},
|
|
49
|
+
/** Turns around x, then y, then z (radians): the same as `multiply(z(z), multiply(y(y), x(x)))`. */
|
|
50
|
+
fromEuler(x, y, z, out) {
|
|
51
|
+
const sx = Math.sin(x / 2);
|
|
52
|
+
const cx = Math.cos(x / 2);
|
|
53
|
+
const sy = Math.sin(y / 2);
|
|
54
|
+
const cy = Math.cos(y / 2);
|
|
55
|
+
const sz = Math.sin(z / 2);
|
|
56
|
+
const cz = Math.cos(z / 2);
|
|
57
|
+
return result(out, sx * cy * cz - cx * sy * sz, cx * sy * cz + sx * cy * sz, cx * cy * sz - sx * sy * cz, cx * cy * cz + sx * sy * sz);
|
|
58
|
+
},
|
|
59
|
+
/** Shortest-path interpolation from `a` (t = 0) to `b` (t = 1). */
|
|
60
|
+
slerp(a, b, t, out) {
|
|
61
|
+
let [bx, by, bz, bw] = b;
|
|
62
|
+
let cos = a[0] * bx + a[1] * by + a[2] * bz + a[3] * bw;
|
|
63
|
+
if (cos < 0) {
|
|
64
|
+
cos = -cos;
|
|
65
|
+
bx = -bx;
|
|
66
|
+
by = -by;
|
|
67
|
+
bz = -bz;
|
|
68
|
+
bw = -bw;
|
|
69
|
+
}
|
|
70
|
+
let k0 = 1 - t;
|
|
71
|
+
let k1 = t;
|
|
72
|
+
if (cos < 0.9995) {
|
|
73
|
+
const angle = Math.acos(cos);
|
|
74
|
+
const sin = Math.sin(angle);
|
|
75
|
+
k0 = Math.sin(k0 * angle) / sin;
|
|
76
|
+
k1 = Math.sin(k1 * angle) / sin;
|
|
77
|
+
}
|
|
78
|
+
const x = k0 * a[0] + k1 * bx;
|
|
79
|
+
const y = k0 * a[1] + k1 * by;
|
|
80
|
+
const z = k0 * a[2] + k1 * bz;
|
|
81
|
+
const w = k0 * a[3] + k1 * bw;
|
|
82
|
+
const length = Math.hypot(x, y, z, w) || 1;
|
|
83
|
+
return result(out, x / length, y / length, z / length, w / length);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=quat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Share concurrent requests across loader variants; failed requests can always be retried. */
|
|
2
|
+
export declare function assetBytes(key: string, load: () => Promise<ArrayBuffer>): Promise<ArrayBuffer>;
|
|
3
|
+
/** A decoder rejected the payload: a later load must fetch fresh bytes, not replay bad data. */
|
|
4
|
+
export declare function forgetAssetBytes(key: string | undefined): void;
|
|
5
|
+
/** Clearing disk must also prevent an earlier request from retaining its old bytes. */
|
|
6
|
+
export declare function clearAssetBytes(): void;
|
|
7
|
+
//# sourceMappingURL=AssetBytesCache.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Explicitly removes the engine's saved geometry and original model/texture/font/audio files.
|
|
3
|
+
* Also clears temporary download bytes. Existing worlds and loaded handles remain usable;
|
|
4
|
+
* registrations are session resources and will be rebuilt/reloaded on a future app launch.
|
|
5
|
+
* Custom ProceduralStorage adapters belong to their host and are not cleared by this function.
|
|
6
|
+
* Rejects if storage cannot be cleared, allowing a settings screen to report the failure.
|
|
7
|
+
*/
|
|
8
|
+
export declare function clearAssetCache(): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=AssetCache.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { EngineBridge } from '../native/EngineBridge.js';
|
|
2
|
+
import { type AssetSource } from './source';
|
|
3
|
+
/** Shared session handles; source-byte persistence stays in AssetBytesCache and Rust. */
|
|
4
|
+
export declare class AssetLoader<T> {
|
|
5
|
+
private readonly name;
|
|
6
|
+
private readonly loads;
|
|
7
|
+
constructor(name: string);
|
|
8
|
+
load(source: AssetSource, decode: (native: EngineBridge, bytes: ArrayBuffer) => T | Promise<T>, variant?: readonly (string | number | boolean)[]): Promise<T>;
|
|
9
|
+
private error;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=AssetLoader.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare class IndexedDbCache {
|
|
2
|
+
private readonly database;
|
|
3
|
+
private tail;
|
|
4
|
+
private pending;
|
|
5
|
+
private generation;
|
|
6
|
+
private clearOperation;
|
|
7
|
+
private constructor();
|
|
8
|
+
static open(): Promise<IndexedDbCache>;
|
|
9
|
+
private enqueue;
|
|
10
|
+
/** The Uint8Array is an owned copy made by Rust, never a view into growable WASM memory. */
|
|
11
|
+
write(name: string, bytes: Uint8Array, geometry: boolean): Promise<void>;
|
|
12
|
+
read(name: string): Promise<Uint8Array | undefined>;
|
|
13
|
+
remove(name: string): Promise<void>;
|
|
14
|
+
clear(): Promise<void>;
|
|
15
|
+
flush(): Promise<void>;
|
|
16
|
+
cleared(): Promise<void>;
|
|
17
|
+
/** Read recent geometry only. Large source files remain in IndexedDB until requested by a loader. */
|
|
18
|
+
warm(canFit: (size: number) => boolean, restore: (name: string, bytes: Uint8Array) => boolean): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=IndexedDbCache.web.d.ts.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** Optional storage override. The engine selects a best-effort platform cache by default. */
|
|
2
|
+
export interface ProceduralStorage {
|
|
3
|
+
read(key: string): Uint8Array | null;
|
|
4
|
+
write(key: string, bytes: Uint8Array): void | Promise<void>;
|
|
5
|
+
/**
|
|
6
|
+
* The store itself verifies every record's integrity (the engine's own Rust store checksums each
|
|
7
|
+
* one with SHA-256), so the cache needn't checksum and scan them again in JS. Geometry is still
|
|
8
|
+
* validated by the core when it's registered.
|
|
9
|
+
*/
|
|
10
|
+
readonly verified?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Persists the output of a deterministic model factory, including nested model arrays/objects.
|
|
14
|
+
* Hits register saved vertices directly: no procedural tessellation, painting or optimization.
|
|
15
|
+
* Imported/skinned/textured models are intentionally excluded; their own loaders retain their rigs.
|
|
16
|
+
*/
|
|
17
|
+
export declare class ProceduralCache {
|
|
18
|
+
readonly revision: string;
|
|
19
|
+
private storage;
|
|
20
|
+
private memory;
|
|
21
|
+
private hits;
|
|
22
|
+
private builds;
|
|
23
|
+
private invalid;
|
|
24
|
+
private failures;
|
|
25
|
+
private writes;
|
|
26
|
+
constructor(revision: string, storage?: ProceduralStorage | undefined);
|
|
27
|
+
get stats(): {
|
|
28
|
+
hits: number;
|
|
29
|
+
builds: number;
|
|
30
|
+
invalid: number;
|
|
31
|
+
failures: number;
|
|
32
|
+
pendingWrites: number;
|
|
33
|
+
};
|
|
34
|
+
flush(): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* A value already cached (in memory, or saved by an earlier launch), without building anything:
|
|
37
|
+
* undefined when there is none yet. Lets work that's spread over many frames (a level generated
|
|
38
|
+
* step by step) skip itself entirely when a saved result exists, then save with `get`.
|
|
39
|
+
*/
|
|
40
|
+
peek<T>(key: string): T | undefined;
|
|
41
|
+
get<T>(key: string, build: () => T): T;
|
|
42
|
+
private encode;
|
|
43
|
+
private restore;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=ProceduralCache.d.ts.map
|