ugly-game 0.15.63 → 0.15.64

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.
@@ -350,8 +350,14 @@ export declare class GpuPropsRenderer {
350
350
  * getting this wrong is the classic washed-out-albedo bug.
351
351
  */
352
352
  private uploadAlbedo;
353
- /** Change scalar PBR properties without rebuilding geometry or texture bindings. */
354
- setMaterial(model: number, surface: Pick<PropMesh, 'roughness' | 'metalness' | 'clearcoat' | 'clearcoatRoughness' | 'reflectionStrength' | 'specularIntensity' | 'metalFlakes' | 'flakeScale' | 'pearlStrength'>): void;
353
+ /**
354
+ * Change scalar PBR properties without rebuilding geometry or texture bindings.
355
+ *
356
+ * `alpha` fades a model in place (a body fading away to show what is inside it). Below 1 the
357
+ * model moves to the blended pipeline and out of shadowPass from the next frame, exactly as if
358
+ * `setModels` had been given that alpha; back at 1 it is opaque and casts again.
359
+ */
360
+ setMaterial(model: number, surface: Pick<PropMesh, 'alpha' | 'roughness' | 'metalness' | 'clearcoat' | 'clearcoatRoughness' | 'reflectionStrength' | 'specularIntensity' | 'metalFlakes' | 'flakeScale' | 'pearlStrength'>): void;
355
361
  setModels(meshes: PropMesh[]): void;
356
362
  /**
357
363
  * Group instances by model and upload the per-model instance buffers.
@@ -981,7 +981,13 @@ export class GpuPropsRenderer {
981
981
  }
982
982
  return tex;
983
983
  }
984
- /** Change scalar PBR properties without rebuilding geometry or texture bindings. */
984
+ /**
985
+ * Change scalar PBR properties without rebuilding geometry or texture bindings.
986
+ *
987
+ * `alpha` fades a model in place (a body fading away to show what is inside it). Below 1 the
988
+ * model moves to the blended pipeline and out of shadowPass from the next frame, exactly as if
989
+ * `setModels` had been given that alpha; back at 1 it is opaque and casts again.
990
+ */
985
991
  setMaterial(model, surface) {
986
992
  const packed = this.models.at(model);
987
993
  if (model < 0 || !packed)
@@ -1010,6 +1016,14 @@ export class GpuPropsRenderer {
1010
1016
  packed.materialValues[index] = bounded;
1011
1017
  changed = true;
1012
1018
  }
1019
+ if (surface.alpha !== undefined && Number.isFinite(surface.alpha)) {
1020
+ const alpha = Math.max(0, Math.min(1, surface.alpha));
1021
+ if (Math.abs(packed.alpha - alpha) >= 1e-7) {
1022
+ packed.alpha = alpha;
1023
+ packed.materialValues[0] = alpha;
1024
+ changed = true;
1025
+ }
1026
+ }
1013
1027
  if (changed)
1014
1028
  this.device.queue.writeBuffer(packed.matBuf, 0, packed.materialValues);
1015
1029
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugly-game",
3
- "version": "0.15.63",
3
+ "version": "0.15.64",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -15,6 +15,22 @@
15
15
  "files": [
16
16
  "dist"
17
17
  ],
18
+ "scripts": {
19
+ "preinstall": "npx only-allow pnpm",
20
+ "build": "tsc -p tsconfig.json && mkdir -p dist/assets/basis && cp src/assets/basis/basis_transcoder.js src/assets/basis/basis_transcoder.bin dist/assets/basis/",
21
+ "lint": "ugly-app lint",
22
+ "lint:fix": "ugly-app lint --fix",
23
+ "test": "node --experimental-strip-types --import ./tools/tsResolve.mjs --test src/*.test.mts && pnpm run test:gpu-skin",
24
+ "test:flight": "node --experimental-strip-types --import ./tools/tsResolve.mjs --test src/flight*.test.mts",
25
+ "test:flight-browser": "playwright test -c playwright.flight.config.ts",
26
+ "test:props-browser": "playwright test -c playwright.props.config.ts",
27
+ "test:flight-perf": "playwright test -c playwright.flight.config.ts --grep 'CPU and retained-memory'",
28
+ "test:types": "tsc -p tsconfig.test.json",
29
+ "test:package-types": "node tools/packageTypesSmoke.mjs",
30
+ "pretty": "prettier --write .",
31
+ "prepublishOnly": "pnpm run pretty && ugly-app lint && tsc -p tsconfig.json && mkdir -p dist/assets/basis && cp src/assets/basis/basis_transcoder.js src/assets/basis/basis_transcoder.bin dist/assets/basis/",
32
+ "test:gpu-skin": "node --experimental-transform-types --import ./tools/tsResolve.mjs --test src/assets/gpuSkin.test.mts"
33
+ },
18
34
  "dependencies": {
19
35
  "@webgpu/types": "^0.1.40",
20
36
  "meshoptimizer": "^1.2.0"
@@ -30,20 +46,5 @@
30
46
  "typescript": "^5.6.0",
31
47
  "ugly-app": "^0.1.841",
32
48
  "wesl": "0.7.28"
33
- },
34
- "scripts": {
35
- "preinstall": "npx only-allow pnpm",
36
- "build": "tsc -p tsconfig.json && mkdir -p dist/assets/basis && cp src/assets/basis/basis_transcoder.js src/assets/basis/basis_transcoder.bin dist/assets/basis/",
37
- "lint": "ugly-app lint",
38
- "lint:fix": "ugly-app lint --fix",
39
- "test": "node --experimental-strip-types --import ./tools/tsResolve.mjs --test src/*.test.mts && pnpm run test:gpu-skin",
40
- "test:flight": "node --experimental-strip-types --import ./tools/tsResolve.mjs --test src/flight*.test.mts",
41
- "test:flight-browser": "playwright test -c playwright.flight.config.ts",
42
- "test:props-browser": "playwright test -c playwright.props.config.ts",
43
- "test:flight-perf": "playwright test -c playwright.flight.config.ts --grep 'CPU and retained-memory'",
44
- "test:types": "tsc -p tsconfig.test.json",
45
- "test:package-types": "node tools/packageTypesSmoke.mjs",
46
- "pretty": "prettier --write .",
47
- "test:gpu-skin": "node --experimental-transform-types --import ./tools/tsResolve.mjs --test src/assets/gpuSkin.test.mts"
48
49
  }
49
- }
50
+ }