ugly-game 0.15.69 → 0.15.70

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.
@@ -104,6 +104,8 @@ export interface PropRendererOptions extends Partial<PropLook> {
104
104
  * that maps near to 1 and far to 0. The sun-shadow occluder keeps its own depth domain.
105
105
  */
106
106
  depth?: DepthConvention;
107
+ /** Format of the caller's sun-shadow depth attachment. Default depth32float. */
108
+ shadowDepthFormat?: 'depth16unorm' | 'depth32float';
107
109
  }
108
110
  export interface PropMesh {
109
111
  /** Offline-cooked deformation bounds. Omit for procedural meshes. */
@@ -776,10 +776,12 @@ export class GpuPropsRenderer {
776
776
  }
777
777
  constructor(device, format, options = {}) {
778
778
  this.device = device;
779
- const { sampleCount = 1, depth = FORWARD_DEPTH, ...look } = options;
779
+ const { sampleCount = 1, depth = FORWARD_DEPTH, shadowDepthFormat = 'depth32float', ...look } = options;
780
780
  // Runtime guard for untyped callers: WebGPU only guarantees 1 and 4.
781
781
  if (![1, 4].includes(sampleCount))
782
782
  throw new RangeError(`Unsupported prop sampleCount ${String(sampleCount)}`);
783
+ if (!['depth16unorm', 'depth32float'].includes(shadowDepthFormat))
784
+ throw new RangeError(`Unsupported prop shadowDepthFormat ${shadowDepthFormat}`);
783
785
  this.sampleCount = sampleCount;
784
786
  this.depth = depth;
785
787
  this.setLook(look);
@@ -956,7 +958,7 @@ export class GpuPropsRenderer {
956
958
  },
957
959
  primitive: { topology: 'triangle-list', cullMode: 'none' },
958
960
  depthStencil: {
959
- format: 'depth32float',
961
+ format: shadowDepthFormat,
960
962
  depthWriteEnabled: true,
961
963
  depthCompare: 'less',
962
964
  // Offset the caster by its rasterized slope: a constant receiver bias
@@ -983,7 +985,7 @@ export class GpuPropsRenderer {
983
985
  });
984
986
  const dummy = device.createTexture({
985
987
  size: [1, 1],
986
- format: 'depth32float',
988
+ format: shadowDepthFormat,
987
989
  usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.RENDER_ATTACHMENT,
988
990
  });
989
991
  this.dummyShadowView = dummy.createView({ dimension: '2d-array' }); // the binding is an array now
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugly-game",
3
- "version": "0.15.69",
3
+ "version": "0.15.70",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {