@holtjs/stage 0.13.0 → 0.14.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/CHANGELOG.md +11 -0
- package/dist/{anims-n8aqhzxu.d.ts → anims-BOvaKn6w.d.ts} +7 -1
- package/dist/anims.d.ts +1 -1
- package/dist/ecs.d.ts +3 -3
- package/dist/ecs.js +2 -2
- package/dist/{game-CziLa7dv.js → game-BF1ZbJRC.js} +22 -8
- package/dist/{game-C8bz7tay.d.ts → game-rKghsNlA.d.ts} +31 -15
- package/dist/headless.d.ts +33 -3
- package/dist/headless.js +201 -9
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/joystick.d.ts +1 -1
- package/dist/kernel.d.ts +1 -1
- package/dist/lighting.d.ts +1 -1
- package/dist/lighting.js +23 -18
- package/dist/projection.d.ts +1 -1
- package/dist/{renderer-webgpu-LDnrpYa0.js → renderer-webgpu-CnIevdNP.js} +459 -168
- package/dist/renderer-webgpu.d.ts +1 -1
- package/dist/renderer-webgpu.js +1 -1
- package/dist/rig2d.d.ts +2 -2
- package/dist/tilemap.d.ts +1 -1
- package/dist/trace.d.ts +1 -1
- package/dist/world.d.ts +1 -1
- package/package.json +1 -1
package/dist/lighting.js
CHANGED
|
@@ -247,34 +247,39 @@ const RADIAL_GLOW_SIZE = 128;
|
|
|
247
247
|
function ensureRadialGlowTexture(textures) {
|
|
248
248
|
if (textures.exists(RADIAL_GLOW_KEY)) return true;
|
|
249
249
|
try {
|
|
250
|
-
const
|
|
251
|
-
if (!ct) return false;
|
|
252
|
-
const ctx = ct.canvas.getContext("2d");
|
|
253
|
-
if (!ctx || typeof ctx.createImageData !== "function" || typeof ctx.putImageData !== "function") {
|
|
254
|
-
textures.remove(RADIAL_GLOW_KEY);
|
|
255
|
-
return false;
|
|
256
|
-
}
|
|
257
|
-
const img = ctx.createImageData(RADIAL_GLOW_SIZE, RADIAL_GLOW_SIZE);
|
|
258
|
-
const data = img.data;
|
|
250
|
+
const raw = /* @__PURE__ */ new Uint8Array(65536);
|
|
259
251
|
const half = 63.5;
|
|
260
252
|
const invR = 1 / half;
|
|
261
253
|
for (let y = 0; y < RADIAL_GLOW_SIZE; y++) for (let x = 0; x < RADIAL_GLOW_SIZE; x++) {
|
|
262
254
|
const r = Math.hypot(x - half, y - half) * invR;
|
|
263
255
|
const idx = (y * RADIAL_GLOW_SIZE + x) * 4;
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
if (r >= 1)
|
|
256
|
+
raw[idx] = 255;
|
|
257
|
+
raw[idx + 1] = 255;
|
|
258
|
+
raw[idx + 2] = 255;
|
|
259
|
+
if (r >= 1) raw[idx + 3] = 0;
|
|
268
260
|
else {
|
|
269
261
|
const u = 1 - r;
|
|
270
262
|
const falloff = u * u * (.78 + .22 * u * u);
|
|
271
|
-
|
|
263
|
+
raw[idx + 3] = Math.round(falloff * 255);
|
|
272
264
|
}
|
|
273
265
|
}
|
|
274
|
-
|
|
275
|
-
ct.
|
|
276
|
-
ct.
|
|
277
|
-
|
|
266
|
+
const ct = textures.createCanvas(RADIAL_GLOW_KEY, RADIAL_GLOW_SIZE, RADIAL_GLOW_SIZE);
|
|
267
|
+
const ctx = ct?.canvas.getContext?.("2d");
|
|
268
|
+
if (ct && ctx && typeof ctx.createImageData === "function" && typeof ctx.putImageData === "function") {
|
|
269
|
+
const img = ctx.createImageData(RADIAL_GLOW_SIZE, RADIAL_GLOW_SIZE);
|
|
270
|
+
img.data.set(raw);
|
|
271
|
+
ctx.putImageData(img, 0, 0);
|
|
272
|
+
ct.refresh();
|
|
273
|
+
ct.source[0]?.setFilter(FilterMode.LINEAR);
|
|
274
|
+
return true;
|
|
275
|
+
}
|
|
276
|
+
if (ct) textures.remove(RADIAL_GLOW_KEY);
|
|
277
|
+
const dataTex = textures.addImage(RADIAL_GLOW_KEY, {
|
|
278
|
+
width: RADIAL_GLOW_SIZE,
|
|
279
|
+
height: RADIAL_GLOW_SIZE,
|
|
280
|
+
data: raw
|
|
281
|
+
}, { filterMode: FilterMode.LINEAR });
|
|
282
|
+
return Boolean(dataTex);
|
|
278
283
|
} catch {
|
|
279
284
|
if (textures.exists(RADIAL_GLOW_KEY)) textures.remove(RADIAL_GLOW_KEY);
|
|
280
285
|
return false;
|
package/dist/projection.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Bn as SceneHostLike, bn as DisplayObject, pn as Container } from "./game-
|
|
1
|
+
import { Bn as SceneHostLike, bn as DisplayObject, pn as Container } from "./game-rKghsNlA.js";
|
|
2
2
|
export interface Camera25DConfig {
|
|
3
3
|
viewportWidth: number;
|
|
4
4
|
viewportHeight: number;
|