@forgeax/engine-render 0.1.25 → 0.1.27

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.
Files changed (87) hide show
  1. package/README.md +18 -0
  2. package/dist/assembly/factory.d.ts +1 -1
  3. package/dist/assembly/factory.d.ts.map +1 -1
  4. package/dist/assembly/material/assembly.d.ts +4 -17
  5. package/dist/assembly/material/assembly.d.ts.map +1 -1
  6. package/dist/assembly/material/standard-layer-projection.d.ts.map +1 -1
  7. package/dist/assembly/material/surface-projection.d.ts.map +1 -1
  8. package/dist/assembly/webgpu-renderer.d.ts +0 -1
  9. package/dist/assembly/webgpu-renderer.d.ts.map +1 -1
  10. package/dist/authoring.mjs +1 -1
  11. package/dist/{chunk-JSEDTZYS.mjs → chunk-GF523LHF.mjs} +6 -6
  12. package/dist/chunk-GF523LHF.mjs.map +1 -0
  13. package/dist/{chunk-TCLDX7SZ.mjs → chunk-TMIASV2N.mjs} +403 -457
  14. package/dist/chunk-TMIASV2N.mjs.map +1 -0
  15. package/dist/{chunk-N3RT2EUR.mjs → chunk-XDP6XE5V.mjs} +104 -56
  16. package/dist/chunk-XDP6XE5V.mjs.map +1 -0
  17. package/dist/construct-renderer.mjs +153 -13
  18. package/dist/construct-renderer.mjs.map +1 -1
  19. package/dist/extract/contracts.d.ts +6 -6
  20. package/dist/extract/contracts.d.ts.map +1 -1
  21. package/dist/index.mjs +1 -1
  22. package/dist/internal.mjs +1 -1
  23. package/dist/pipeline-spec-types.d.ts +2 -0
  24. package/dist/pipeline-spec-types.d.ts.map +1 -1
  25. package/dist/pipeline-spec.d.ts.map +1 -1
  26. package/dist/record/frame.d.ts.map +1 -1
  27. package/dist/record/main-pass-geometry.d.ts +2 -2
  28. package/dist/record/main-pass-geometry.d.ts.map +1 -1
  29. package/dist/record/main-pass-material.d.ts +20 -2
  30. package/dist/record/main-pass-material.d.ts.map +1 -1
  31. package/dist/record/main-pass-sprite-draws.d.ts +3 -3
  32. package/dist/record/main-pass-sprite-draws.d.ts.map +1 -1
  33. package/dist/record/main-pass.d.ts.map +1 -1
  34. package/dist/record/material-uniforms.d.ts +4 -0
  35. package/dist/record/material-uniforms.d.ts.map +1 -0
  36. package/dist/record/render-context.d.ts +2 -2
  37. package/dist/record/render-context.d.ts.map +1 -1
  38. package/dist/record/shadow-pass.d.ts +2 -3
  39. package/dist/record/shadow-pass.d.ts.map +1 -1
  40. package/dist/recovery/render-system-candidate.d.ts.map +1 -1
  41. package/dist/render-system-extract-tail.d.ts +2 -0
  42. package/dist/render-system-extract-tail.d.ts.map +1 -1
  43. package/dist/render-system-extract.d.ts +27 -10
  44. package/dist/render-system-extract.d.ts.map +1 -1
  45. package/dist/render-system.d.ts.map +1 -1
  46. package/dist/temporal/index.mjs +2 -2
  47. package/package.json +20 -20
  48. package/src/__tests__/fixtures/ai-weapon-spirit/README.md +20 -0
  49. package/src/__tests__/fixtures/ai-weapon-spirit/low-poly-toon.wgsl +178 -0
  50. package/src/__tests__/fixtures/ai-weapon-spirit/material.json +97 -0
  51. package/src/__tests__/fixtures/ai-weapon-spirit/painterly-surface.wgsl +55 -0
  52. package/src/__tests__/gpu-driven-view-gpu-evidence.ts +3 -3
  53. package/src/__tests__/gpu-driven-view.browser.test.ts +11 -3
  54. package/src/__tests__/material-contract-inventory.unit.test.ts +43 -0
  55. package/src/__tests__/{material-static-dynamic-route.unit.test.ts → material-layer-projection.unit.test.ts} +30 -47
  56. package/src/__tests__/material-program-dispatch.unit.test.ts +48 -0
  57. package/src/__tests__/renderer-factory-material-contract.unit.test.ts +2 -2
  58. package/src/__tests__/skinned-shadow-caster.test.ts +14 -14
  59. package/src/__tests__/surface-variant-provenance.integration.test.ts +1 -1
  60. package/src/assembly/factory.ts +0 -3
  61. package/src/assembly/material/assembly.ts +8 -40
  62. package/src/assembly/material/standard-layer-projection.ts +3 -1
  63. package/src/assembly/material/surface-projection.ts +2 -1
  64. package/src/assembly/webgpu-renderer.ts +17 -9
  65. package/src/extract/contracts.ts +6 -6
  66. package/src/materials.ts +3 -3
  67. package/src/pipeline-spec-types.ts +2 -0
  68. package/src/pipeline-spec.ts +7 -3
  69. package/src/record/__tests__/standard-pbr-ubo-layout.unit.test.ts +68 -1
  70. package/src/record/frame.ts +7 -1
  71. package/src/record/main-pass-geometry.ts +340 -279
  72. package/src/record/main-pass-material.ts +87 -2
  73. package/src/record/main-pass-sprite-draws.ts +65 -168
  74. package/src/record/main-pass.ts +24 -246
  75. package/src/record/material-uniforms.ts +186 -0
  76. package/src/record/render-context.ts +4 -0
  77. package/src/record/shadow-pass.ts +86 -28
  78. package/src/recovery/render-system-candidate.ts +5 -1
  79. package/src/render-system-extract-tail.ts +54 -13
  80. package/src/render-system-extract.ts +103 -64
  81. package/src/render-system.ts +19 -0
  82. package/dist/assembly/material/pipeline-projection.d.ts +0 -30
  83. package/dist/assembly/material/pipeline-projection.d.ts.map +0 -1
  84. package/dist/chunk-JSEDTZYS.mjs.map +0 -1
  85. package/dist/chunk-N3RT2EUR.mjs.map +0 -1
  86. package/dist/chunk-TCLDX7SZ.mjs.map +0 -1
  87. package/src/assembly/material/pipeline-projection.ts +0 -63
package/README.md CHANGED
@@ -530,6 +530,18 @@ contains the four-lane smoke and falsifier evidence.
530
530
 
531
531
  ## MaterialAsset render contract
532
532
 
533
+ `MaterialAsset` render input is an effective `passes` + `values` snapshot:
534
+ `parent` inheritance and texture `coordinates` resolve before `cook`; render
535
+ consumes validated cook output and returns structured `recovery` to its owner.
536
+
537
+ Material parameter slots are uploaded before graph execution so depth and color
538
+ passes consume the same frame's root storage. Each shadow submesh selects its
539
+ program entries, pipeline, material bind group, and slot offset together;
540
+ interleaving a canonical caster restores its canonical binding. Pending authored
541
+ pipelines do not fall back to a different caster, and an incomplete directional
542
+ shadow render is not admitted to the persistent shadow cache. Pipeline cache
543
+ identity includes authored entry selection while shader modules remain reusable.
544
+
533
545
  Render owns this consumption route:
534
546
 
535
547
  | Input | Render responsibility |
@@ -848,6 +860,12 @@ const material = Materials.standard({
848
860
  });
849
861
  ```
850
862
 
863
+ The helper publishes the complete Standard base declarations together with
864
+ the custom parameters on the returned root MaterialAsset. Compiler and loader
865
+ project that published contract without adding fields based on a Pass module.
866
+ Physical layer declarations remain sparse. A custom full-shader material does
867
+ not acquire Standard semantics by adding a shadow Pass or a `surface` slot.
868
+
851
869
  The custom WGSL implements only `evaluate_surface`; it does not declare
852
870
  stages, bindings, lighting, or output code. The Engine composes the result
853
871
  with its Standard shader and derives the pass family: opaque base-only
@@ -4,7 +4,7 @@ import type { BundlerOptions } from './bundler-contract';
4
4
  import type { RendererAssemblyImplementation } from './host-contract';
5
5
  export type { BundlerOptions } from './bundler-contract';
6
6
  export type { LayoutKind, MaterialShaderBindingContract, MaterialShaderManifestEntry, MaterialShaderVertexInputContract, MeshSsboBufferWrapper, MeshSsboGrowController, MeshSsboGrowControllerInit, MeshSsboGrowDevice, MeshSsboGrowErrorRegistry, MeshSsboGrowResult, MeshSsboState, } from './webgpu-renderer';
7
- export { allowsUnlitPreparedFallback, assembleMaterialProjection, createMeshSsboGrowController, deriveStorageBufferCeiling, exposeRenderer, isSharedMaterialUserRegionCompatible, normalizeMaterialShaderVariantSet, projectMaterialPipeline, resolveMaterialShaderBackendArtifactKey, resolveMaterialShaderBindingContract, resolveMaterialShaderUvSetCount, resolveMaterialShaderVariantSet, resolveMaterialShaderVertexInputContract, routeMaterialPipeline, selectHdrpPbrPrewarmVariants, selectNoColorPbrVariant, selectPipelineLayoutForVariant, selectProbePrewarmVariants, selectSkinPrewarmVariants, selectStandardPbrTransmissionPrewarmVariants, shouldDeferMissingPreparedMaterialShader, updateMaterialRuntimeValues, } from './webgpu-renderer';
7
+ export { allowsUnlitPreparedFallback, assembleMaterialProjection, createMeshSsboGrowController, deriveStorageBufferCeiling, exposeRenderer, isSharedMaterialUserRegionCompatible, normalizeMaterialShaderVariantSet, resolveMaterialShaderBackendArtifactKey, resolveMaterialShaderBindingContract, resolveMaterialShaderUvSetCount, resolveMaterialShaderVariantSet, resolveMaterialShaderVertexInputContract, selectHdrpPbrPrewarmVariants, selectNoColorPbrVariant, selectPipelineLayoutForVariant, selectProbePrewarmVariants, selectSkinPrewarmVariants, selectStandardPbrTransmissionPrewarmVariants, shouldDeferMissingPreparedMaterialShader, } from './webgpu-renderer';
8
8
  /** Build a renderer after selecting the host-supplied backend pack. */
9
9
  export declare function createRenderer(canvas: unknown, options?: RendererOptions, bundler?: BundlerOptions, backend?: RhiBackendPack): Promise<RendererAssemblyImplementation>;
10
10
  //# sourceMappingURL=factory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/assembly/factory.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAA0B,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,iBAAiB,CAAC;AAqCtE,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,YAAY,EACV,UAAU,EACV,6BAA6B,EAC7B,2BAA2B,EAC3B,iCAAiC,EACjC,qBAAqB,EACrB,sBAAsB,EACtB,0BAA0B,EAC1B,kBAAkB,EAClB,yBAAyB,EACzB,kBAAkB,EAClB,aAAa,GACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,2BAA2B,EAC3B,0BAA0B,EAC1B,4BAA4B,EAC5B,0BAA0B,EAC1B,cAAc,EACd,oCAAoC,EACpC,iCAAiC,EACjC,uBAAuB,EACvB,uCAAuC,EACvC,oCAAoC,EACpC,+BAA+B,EAC/B,+BAA+B,EAC/B,wCAAwC,EACxC,qBAAqB,EACrB,4BAA4B,EAC5B,uBAAuB,EACvB,8BAA8B,EAC9B,0BAA0B,EAC1B,yBAAyB,EACzB,4CAA4C,EAC5C,w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c,EACxB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,8BAA8B,CAAC,CAqBzC"}
@@ -1,21 +1,8 @@
1
+ import { type MaterialRenderProjection as AssetMaterialRenderProjection } from '@forgeax/engine-assets-runtime';
1
2
  import { type CookedMaterialRecord } from '@forgeax/engine-pack/material-cook';
2
- import type { MaterialValue, StandardLayerPlan } from '@forgeax/engine-types';
3
- export interface MaterialRenderPassProjection {
4
- readonly name: string;
5
- readonly module: string;
6
- readonly vertexEntry?: string;
7
- readonly fragmentEntry?: string;
8
- readonly moduleSlots?: Readonly<Record<string, string>>;
9
- readonly renderState?: Readonly<Record<string, unknown>>;
10
- readonly artifactHash: string;
11
- }
12
- export interface MaterialRenderProjection {
13
- readonly materialGuid: string;
14
- readonly specializationKey: string;
15
- readonly artifactHash: string;
16
- readonly passes: readonly MaterialRenderPassProjection[];
17
- readonly runtimeValues: Readonly<Record<string, MaterialValue | null>>;
18
- readonly staticSelection: readonly string[];
3
+ import type { StandardLayerPlan } from '@forgeax/engine-types';
4
+ export type { MaterialRenderPassProjection } from '@forgeax/engine-assets-runtime';
5
+ export interface MaterialRenderProjection extends AssetMaterialRenderProjection {
19
6
  readonly layerPlan: StandardLayerPlan;
20
7
  }
21
8
  export declare function assembleMaterialProjection(record: CookedMaterialRecord): MaterialRenderProjection;
@@ -1 +1 @@
1
- {"version":3,"file":"assembly.d.ts","sourceRoot":"","sources":["../../../src/assembly/material/assembly.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG9E,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC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C,MAAM,EAAE,oBAAoB,GAAG,wBAAwB,CAejG"}
@@ -1 +1 @@
1
- {"version":3,"file":"standard-layer-projection.d.ts","sourceRoot":"","sources":["../../../src/assembly/material/standard-layer-projection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAGhG;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,SAAS,iBAAiB,EAAE,EACxC,MAAM,EAAE,SAAS,YAAY,EAAE,GAC9B,iBAAiB,CAEnB"}
1
+ {"version":3,"file":"standard-layer-projection.d.ts","sourceRoot":"","sources":["../../../src/assembly/material/standard-layer-projection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAGhG;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,SAAS,iBAAiB,EAAE,EACxC,MAAM,EAAE,SAAS,YAAY,EAAE,GAC9B,iBAAiB,CAGnB"}
@@ -1 +1 @@
1
- {"version":3,"file":"surface-projection.d.ts","sourceRoot":"","sources":["../../../src/assembly/material/surface-projection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,aAAa,EACb,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAE/B,eAAO,MAAM,wBAAwB,+BAA+B,CAAC;AACrE,OAAO,EAAE,+BAA+B,EAAE,CAAC;AAE3C,MAAM,MAAM,uBAAuB,GAAG,SAAS,GAAG,UAAU,GAAG,eAAe,CAAC;AAC/E,MAAM,MAAM,8BAA8B,GAAG,OAAO,GAAG,SAAS,GAAG,WAAW,CAAC;AAC/E,MAAM,MAAM,2BAA2B,GAAG,QAAQ,GAAG,WAAW,CAAC;AACjE,MAAM,MA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BAA8B,GAAG,OAAO,GAAG,SAAS,GAAG,WAAW,CAAC;AAC/E,MAAM,MAAM,2BAA2B,GAAG,QAAQ,GAAG,WAAW,CAAC;AACjE,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,aAAa,CAAC;AAE7D,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAAC,CAAC,CAAC;IAChE,QAAQ,CAAC,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAC3C,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,eAAe,CAAC,EAAE,8BAA8B,CAAC;IAC1D,QAAQ,CAAC,YAAY,CAAC,EAAE,2BAA2B,CAAC;IACpD,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAC3C,QAAQ,CAAC,cAAc,CAAC,EAAE,SAAS,uBAAuB,EAAE,CAAC;IAC7D,QAAQ,CAAC,SAAS,CAAC,EAAE,iBAAiB,CAAC;CACxC;AAuCD,oFAAoF;AACpF,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,gCAAgC,GACxC,CAAC,YAAY,EAAE,GAAG,YAAY,EAAE,CAAC,CAoBnC"}
@@ -14,7 +14,6 @@ import type { MeshSsboGrowResult, MeshSsboState } from './mesh-ssbo-grow';
14
14
  import { type RecoveryGuidance, type RecoveryPhase } from './renderer-lifecycle';
15
15
  export type { BundlerOptions } from './bundler-contract';
16
16
  export { assembleMaterialProjection } from './material/assembly';
17
- export { projectMaterialPipeline, routeMaterialPipeline, updateMaterialRuntimeValues, } from './material/pipeline-projection';
18
17
  export type { LayoutKind, MaterialShaderBindingContract, MaterialShaderVertexInputContract, } from './material-shader-policy';
19
18
  export { allowsUnlitPreparedFallback, isSharedMaterialUserRegionCompatible, normalizeMaterialShaderVariantSet, resolveMaterialShaderBackendArtifactKey, resolveMaterialShaderBindingContract, resolveMaterialShaderUvSetCount, resolveMaterialShaderVariantSet, resolveMaterialShaderVertexInputContract, selectNoColorPbrVariant, selectPipelineLayoutForVariant, shouldDeferMissingPreparedMaterialShader, } from './material-shader-policy';
20
19
  export type { MeshSsboBufferWrapper, MeshSsboGrowController, MeshSsboGrowControllerInit, MeshSsboGrowDevice, MeshSsboGrowErrorRegistry, MeshSsboGrowResult, MeshSsboState, } from './mesh-ssbo-grow';
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-renderer.d.ts","sourceRoot":"","sources":["../../src/assembly/webgpu-renderer.ts"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAKV,gBAAgB,EAChB,SAAS,EACV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAW,QAAQ,EAAoB,MAAM,qBAAqB,CAAC;AAS1E,OAAO,KAAK,EACV,eAAe,EAMhB,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAG1E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAYnE,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAUnF,OAAO,EAEL,sBAAsB,EACtB,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,cAAc,CAAC;AA0CtB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,KAAK,EAMV,kBAAkB,EAGlB,eAAe,EAMf,0BAA0B,EAC3B,MAAM,oBAAoB,CAAC;AAe5B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,KA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BAA0B,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;IACvD,YAAY,EAAE;QAAE,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;KAAE,CAAC;IACrD,eAAe,EAAE;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;KAC1B,CAAC;IACF,qBAAqB,CAAC,EAAE,qBAAqB,GAAG,SAAS,CAAC;IAC1D,2BAA2B,CAAC,EAAE,CAAC,gBAAgB,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;CAChF;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,YAAY,EAAE,kBAAkB,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB"}
@@ -1,7 +1,7 @@
1
1
  export { GlyphText, SpritePlayback, setActiveCamera, spritePlaybackModeFromU32 } from './chunk-FJ6P52EE.mjs';
2
2
  export { SpriteAnimation, SpriteInstances, SpriteRegionOverride, TileLayer, Tilemap, TilemapSort } from './chunk-JDWARUOI.mjs';
3
3
  export { TransparentSort } from './chunk-RXZ3RGOU.mjs';
4
- export { SPRITE_PREMULTIPLIED_ALPHA_BLEND } from './chunk-JSEDTZYS.mjs';
4
+ export { SPRITE_PREMULTIPLIED_ALPHA_BLEND } from './chunk-GF523LHF.mjs';
5
5
  import { ok } from '@forgeax/engine-types';
6
6
 
7
7
  function createFullscreenRenderFeature(options) {
@@ -1,6 +1,6 @@
1
1
  import { color } from '@forgeax/engine-math';
2
2
  import { DEFAULT_STANDARD_PBR_PARAM_SCHEMA, DEFAULT_STANDARD_SURFACE_MODULE } from '@forgeax/engine-shader';
3
- import { deriveStandardLayerPlan } from '@forgeax/engine-types';
3
+ import { standardSurfaceParameters, deriveStandardLayerPlan } from '@forgeax/engine-types';
4
4
 
5
5
  // src/materials.ts
6
6
  var STANDARD_MATERIAL_MODULE = "forgeax_material::standard";
@@ -12,7 +12,7 @@ function pass(name, options, fragmentEntry) {
12
12
  return {
13
13
  name,
14
14
  program: {
15
- module: STANDARD_MATERIAL_MODULE,
15
+ module: name === "shadow-caster" ? "forgeax::default-shadow-caster" : STANDARD_MATERIAL_MODULE,
16
16
  fragmentEntry,
17
17
  moduleSlots: { surface: options.surfaceModule }
18
18
  },
@@ -362,7 +362,7 @@ function standardDefault(opts) {
362
362
  if (opts.thicknessTexture !== void 0) values.thicknessTexture = opts.thicknessTexture;
363
363
  if (opts.attenuationDistance !== void 0) values.attenuationDistance = opts.attenuationDistance;
364
364
  const forwardRenderState = transmission > 0 ? { ...opts.renderState ?? {}, depthWriteEnabled: false } : opts.renderState;
365
- const parameters = standardParameters("linear", opts);
365
+ const parameters = standardSurfaceParameters(standardParameters("linear", opts));
366
366
  const declaredNames = new Set(parameters.map((parameter) => parameter.name));
367
367
  for (const name of Object.keys(values)) {
368
368
  if (!declaredNames.has(name)) delete values[name];
@@ -399,7 +399,7 @@ function standardCustom(opts) {
399
399
  ...opts.queue === void 0 ? {} : { queue: opts.queue },
400
400
  layerPlan
401
401
  }),
402
- parameters: opts.parameters,
402
+ parameters: standardSurfaceParameters(opts.parameters),
403
403
  values: opts.values
404
404
  };
405
405
  }
@@ -409,5 +409,5 @@ function standard(options) {
409
409
  var Materials = { unlit, standard, srgb };
410
410
 
411
411
  export { MaterialTransmissionContractError, Materials, SPRITE_PREMULTIPLIED_ALPHA_BLEND, srgb };
412
- //# sourceMappingURL=chunk-JSEDTZYS.mjs.map
413
- //# sourceMappingURL=chunk-JSEDTZYS.mjs.map
412
+ //# sourceMappingURL=chunk-GF523LHF.mjs.map
413
+ //# sourceMappingURL=chunk-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4BAAA,CAA6B;AAAA,MACnC,eAAe,IAAA,CAAK,aAAA;AAAA,MACpB,QAAQ,IAAA,CAAK,MAAA;AAAA,MACb,GAAI,KAAK,WAAA,KAAgB,MAAA,GAAY,EAAC,GAAI,EAAE,WAAA,EAAa,IAAA,CAAK,WAAA,EAAY;AAAA,MAC1E,GAAI,KAAK,UAAA,KAAe,MAAA,GAAY,EAAC,GAAI,EAAE,UAAA,EAAY,IAAA,CAAK,UAAA,EAAW;AAAA,MACvE,GAAI,KAAK,KAAA,KAAU,MAAA,GAAY,EAAC,GAAI,EAAE,KAAA,EAAO,IAAA,CAAK,KAAA,EAAM;AAAA,MACxD;AAAA,KACD,CAAA;AAAA,IACD,UAAA,EAAY,yBAAA,CAA0B,IAAA,CAAK,UAAU,CAAA;AAAA,IACrD,QAAQ,IAAA,CAAK;AAAA,GACf;AACF;AAEO,SAAS,SAAS,OAAA,EAAyC;AAChE,EAAA,OAAO,QAAQ,aAAA,KAAkB,MAAA,GAAY,gBAAgB,OAAO,CAAA,GAAI,eAAe,OAAO,CAAA;AAChG;AAEO,IAAM,SAAA,GAAY,EAAE,KAAA,EAAO,QAAA,EAAU,IAAA","file":"chunk-GF523LHF.mjs","sourcesContent":["import { DEFAULT_STANDARD_SURFACE_MODULE } from '@forgeax/engine-shader';\nimport type {\n MaterialPass,\n MaterialRenderState,\n MaterialValue,\n StandardLayerPlan,\n} from '@forgeax/engine-types';\n\nexport const STANDARD_MATERIAL_MODULE = 'forgeax_material::standard';\nexport { DEFAULT_STANDARD_SURFACE_MODULE };\n\nexport type StandardSurfacePassName = 'forward' | 'deferred' | 'shadow-caster';\nexport type StandardSurfaceGeometryVariant = 'rigid' | 'skinned' | 'instanced';\nexport type StandardSurfaceLightingLane = 'direct' | 'clustered';\nexport type StandardSurfaceKind = 'standard' | 'full-custom';\n\nexport interface StandardSurfaceProjectionOptions {\n readonly surfaceModule: string;\n readonly values: Readonly<Record<string, MaterialValue | null>>;\n readonly renderState?: MaterialRenderState;\n readonly castShadow?: boolean;\n readonly queue?: number;\n readonly geometryVariant?: StandardSurfaceGeometryVariant;\n readonly lightingLane?: StandardSurfaceLightingLane;\n readonly alphaClip?: boolean;\n readonly surfaceKind?: StandardSurfaceKind;\n readonly declaredPasses?: readonly StandardSurfacePassName[];\n readonly layerPlan?: StandardLayerPlan;\n}\n\nfunction pass(\n name: StandardSurfacePassName,\n options: StandardSurfaceProjectionOptions,\n fragmentEntry: string,\n): MaterialPass {\n const authoredState = options.renderState ?? {};\n const authoredRecord = authoredState as Readonly<Record<string, unknown>>;\n const tags = (authoredRecord.tags ?? {}) as Readonly<Record<string, string>>;\n const lightMode =\n name === 'shadow-caster' ? 'ShadowCaster' : name === 'forward' ? 'Forward' : 'Deferred';\n return {\n name,\n program: {\n module:\n name === 'shadow-caster' ? 'forgeax::default-shadow-caster' : STANDARD_MATERIAL_MODULE,\n fragmentEntry,\n moduleSlots: { surface: options.surfaceModule },\n },\n renderState: {\n ...authoredState,\n tags:\n options.surfaceModule === DEFAULT_STANDARD_SURFACE_MODULE\n ? { LightMode: lightMode, ...tags }\n : {\n ...tags,\n LightMode: lightMode,\n SurfaceModule: options.surfaceModule,\n SurfaceKind: options.surfaceKind ?? 'standard',\n GeometryVariant: options.geometryVariant ?? 'rigid',\n LightingLane: options.lightingLane ?? 'direct',\n AlphaClip: options.alphaClip === true ? 'enabled' : 'disabled',\n },\n ...(options.queue === undefined ? {} : { queue: options.queue }),\n },\n };\n}\n\n/** Project one custom or default Surface into the existing Standard pass family. */\nexport function projectStandardSurfacePasses(\n options: StandardSurfaceProjectionOptions,\n): [MaterialPass, ...MaterialPass[]] {\n const authoredPasses = options.declaredPasses;\n const passNames: StandardSurfacePassName[] =\n options.surfaceKind === 'full-custom' && authoredPasses !== undefined\n ? [...authoredPasses]\n : (['forward'] as StandardSurfacePassName[]);\n if (authoredPasses === undefined || options.surfaceKind !== 'full-custom') {\n const blended = options.renderState?.blend !== undefined;\n if (!blended && options.layerPlan?.mode !== 'physical') passNames.push('deferred');\n if (options.castShadow !== false) passNames.push('shadow-caster');\n }\n const entries = passNames.map((name) =>\n pass(\n name,\n options,\n name === 'forward' ? 'fs_main' : name === 'deferred' ? 'fs_gbuffer' : 'fs_shadow',\n ),\n );\n const passes = entries as [MaterialPass, ...MaterialPass[]];\n return passes;\n}\n","import { color } from '@forgeax/engine-math';\nimport { DEFAULT_STANDARD_PBR_PARAM_SCHEMA } from '@forgeax/engine-shader';\nimport type {\n MaterialAsset,\n MaterialColorSpace,\n MaterialParameter,\n MaterialPass,\n MaterialRenderState,\n MaterialValue,\n} from '@forgeax/engine-types';\nimport { deriveStandardLayerPlan, standardSurfaceParameters } from '@forgeax/engine-types';\nimport {\n DEFAULT_STANDARD_SURFACE_MODULE,\n projectStandardSurfacePasses,\n} from './assembly/material/surface-projection';\n\nexport type MaterialTransmissionValidationReason =\n | 'non-finite'\n | 'range'\n | 'shape'\n | 'blend'\n | 'depth-write';\n\n/** Structured authoring failure for the Standard transmission contract. */\nexport class MaterialTransmissionContractError extends Error {\n readonly code = 'material-transmission-contract-invalid' as const;\n readonly expected = 'transmission material values satisfy finite ranges and Forward depth rules';\n readonly hint =\n 'repair the named transmission value or pass state before publishing the material';\n readonly detail: {\n readonly code: 'material-transmission-contract-invalid';\n readonly material: 'Standard';\n readonly parameter:\n | 'transmission'\n | 'ior'\n | 'thickness'\n | 'attenuationColor'\n | 'attenuationDistance';\n readonly reason: MaterialTransmissionValidationReason;\n readonly actual?: unknown;\n };\n\n constructor(\n parameter: (typeof MaterialTransmissionContractError.prototype.detail)['parameter'],\n reason: MaterialTransmissionValidationReason,\n actual?: unknown,\n ) {\n super(`Materials.standard: ${parameter} violates the transmission contract (${reason})`);\n this.name = 'MaterialTransmissionContractError';\n this.detail = {\n code: 'material-transmission-contract-invalid',\n material: 'Standard',\n parameter,\n reason,\n ...(actual === undefined ? {} : { actual }),\n };\n }\n}\n\nexport const SPRITE_PREMULTIPLIED_ALPHA_BLEND: GPUBlendState = {\n color: { srcFactor: 'one', dstFactor: 'one-minus-src-alpha', operation: 'add' },\n alpha: { srcFactor: 'one', dstFactor: 'one-minus-src-alpha', operation: 'add' },\n};\n\nconst UNLIT_MODULE = 'forgeax_material::unlit';\nconst SPRITE_MODULE = 'forgeax_material::sprite';\n\nexport type MaterialColorTuple3 = readonly [number, number, number];\nexport type MaterialColorTuple4 = readonly [number, number, number, number];\nexport type MaterialColorInput3 = MaterialColorTuple3 | string | number;\nexport type MaterialColorInput4 = MaterialColorTuple4 | string | number;\n\nfunction colorHexFromNumber(value: number): string {\n if (!Number.isInteger(value) || value < 0 || value > 0xffffff) {\n throw new Error(`material color number must be an integer in [0, 0xffffff], got ${value}`);\n }\n return `#${value.toString(16).padStart(6, '0')}`;\n}\n\nfunction linearColorFromInput(\n input: MaterialColorInput3 | MaterialColorInput4,\n channels: 3 | 4,\n): readonly number[] {\n if (typeof input === 'number' || typeof input === 'string') {\n const parsed = color.create();\n color.fromCss(parsed, typeof input === 'number' ? colorHexFromNumber(input) : input);\n return channels === 3\n ? [parsed[0] as number, parsed[1] as number, parsed[2] as number]\n : Array.from(parsed);\n }\n if (input.length !== channels) {\n throw new Error(`material color tuple must contain ${channels} channels, got ${input.length}`);\n }\n return [...input];\n}\n\n/** Convert an explicit sRGB numeric tuple into the linear tuple factories store. */\nexport function srgb(input: MaterialColorTuple3): MaterialColorTuple3;\nexport function srgb(input: MaterialColorTuple4): MaterialColorTuple4;\nexport function srgb(input: readonly number[]): readonly number[] {\n if (input.length !== 3 && input.length !== 4) {\n throw new Error(`sRGB material color tuple must contain 3 or 4 channels, got ${input.length}`);\n }\n const parsed = color.create(input[0] ?? 0, input[1] ?? 0, input[2] ?? 0, input[3] ?? 1);\n color.srgbToLinear(parsed, parsed);\n return input.length === 3\n ? [parsed[0] as number, parsed[1] as number, parsed[2] as number]\n : [parsed[0] as number, parsed[1] as number, parsed[2] as number, parsed[3] as number];\n}\n\nfunction authoredColorParameter(\n name: string,\n type: 'color' | 'vec3',\n colorSpace: MaterialColorSpace,\n optional = false,\n): MaterialParameter {\n return {\n name,\n type,\n ...(type === 'color' && colorSpace === 'srgb' ? {} : { colorSpace }),\n ...(optional ? { optional: true } : {}),\n };\n}\n\nfunction standardParameters(\n colorSpace: MaterialColorSpace,\n opts: StandardOpts,\n): readonly MaterialParameter[] {\n const physicalNames = new Set<string>();\n const addPhysical = (...names: readonly string[]) => {\n for (const name of names) physicalNames.add(name);\n };\n if (\n opts.clearcoat !== undefined ||\n opts.clearcoatRoughness !== undefined ||\n opts.clearcoatNormalScale !== undefined ||\n opts.clearcoatTexture !== undefined ||\n opts.clearcoatRoughnessTexture !== undefined ||\n opts.clearcoatNormalTexture !== undefined\n ) {\n addPhysical(\n 'clearcoat',\n 'clearcoatRoughness',\n 'clearcoatNormalScale',\n ...(opts.clearcoatTexture === undefined ? [] : ['clearcoatTexture']),\n ...(opts.clearcoatRoughnessTexture === undefined ? [] : ['clearcoatRoughnessTexture']),\n ...(opts.clearcoatNormalTexture === undefined ? [] : ['clearcoatNormalTexture']),\n );\n }\n if (\n opts.anisotropyStrength !== undefined ||\n opts.anisotropyRotation !== undefined ||\n opts.anisotropyTexture !== undefined\n ) {\n addPhysical('anisotropyStrength', 'anisotropyRotation');\n if (opts.anisotropyTexture !== undefined) addPhysical('anisotropyTexture');\n }\n if (\n opts.sheenColor !== undefined ||\n opts.sheenRoughness !== undefined ||\n opts.sheenColorTexture !== undefined ||\n opts.sheenRoughnessTexture !== undefined\n ) {\n addPhysical('sheenColor', 'sheenRoughness');\n if (opts.sheenColorTexture !== undefined) addPhysical('sheenColorTexture');\n if (opts.sheenRoughnessTexture !== undefined) addPhysical('sheenRoughnessTexture');\n }\n if (\n opts.iridescence !== undefined ||\n opts.iridescenceIor !== undefined ||\n opts.iridescenceThicknessMinimum !== undefined ||\n opts.iridescenceThicknessMaximum !== undefined ||\n opts.iridescenceTexture !== undefined ||\n opts.iridescenceThicknessTexture !== undefined\n ) {\n addPhysical(\n 'iridescence',\n 'iridescenceIor',\n 'iridescenceThicknessMinimum',\n 'iridescenceThicknessMaximum',\n ...(opts.iridescenceTexture === undefined ? [] : ['iridescenceTexture']),\n ...(opts.iridescenceThicknessTexture === undefined ? [] : ['iridescenceThicknessTexture']),\n );\n }\n const baseNames = new Set([\n 'baseColor',\n 'metallic',\n 'roughness',\n 'metallicChannel',\n 'roughnessChannel',\n 'aoChannel',\n 'extraChannel',\n 'emissive',\n 'emissiveIntensity',\n 'occlusionStrength',\n 'alphaCutoff',\n 'normalScale',\n 'baseColorTexture',\n 'metallicRoughnessTexture',\n 'normalTexture',\n 'emissiveTexture',\n 'occlusionTexture',\n 'specular',\n 'specularColor',\n // IOR is part of the always-present dielectric F0 contract. The\n // transmission layer may be absent, but the Standard shader still\n // consumes this scalar for the base reflection path.\n 'ior',\n ]);\n if (opts.specularTexture !== undefined) baseNames.add('specularTexture');\n if (opts.specularColorTexture !== undefined) baseNames.add('specularColorTexture');\n if (\n opts.transmission !== undefined ||\n opts.ior !== undefined ||\n opts.thickness !== undefined ||\n opts.transmissionTexture !== undefined ||\n opts.thicknessTexture !== undefined ||\n opts.attenuationColor !== undefined ||\n opts.attenuationDistance !== undefined\n ) {\n for (const name of [\n 'transmission',\n 'ior',\n 'thickness',\n 'attenuationColor',\n 'attenuationDistance',\n 'transmissionTexture',\n 'thicknessTexture',\n ]) {\n baseNames.add(name);\n }\n }\n // All Standard fields come from one root schema. Physical fields are\n // projected by the authored option membership above; appending a second\n // physical schema would create a parallel ABI authority.\n const availableSchema = DEFAULT_STANDARD_PBR_PARAM_SCHEMA;\n // Keep the generated Standard UBO's numeric run contiguous before any\n // texture coordinate records. The built-in WGSL places the complete\n // physical root (including clearcoat scalars) after the base numeric run\n // and before all coordinate pairs; appending physical entries after the\n // base texture records would otherwise derive a different ABI.\n const numericSchema = availableSchema.filter((entry) => !entry.type.startsWith('texture'));\n const textureSchema = availableSchema.filter((entry) => entry.type.startsWith('texture'));\n const orderedSchema = [...numericSchema, ...textureSchema];\n return orderedSchema\n .filter((entry) => baseNames.has(entry.name) || physicalNames.has(entry.name))\n .map((entry) => {\n const type = entry.type.startsWith('texture') ? 'texture' : entry.type;\n const isRequired =\n entry.name === 'baseColor' || entry.name === 'metallic' || entry.name === 'roughness';\n const authoredColor =\n entry.type === 'color' || (entry.type === 'vec3' && entry.name !== 'attenuationColor');\n const schemaColorSpace = 'colorSpace' in entry ? entry.colorSpace : undefined;\n const colorSpaceProjection: { colorSpace?: MaterialColorSpace } = {};\n if (authoredColor && !(type === 'color' && colorSpace === 'srgb')) {\n colorSpaceProjection.colorSpace = colorSpace;\n } else if (!authoredColor && schemaColorSpace !== undefined) {\n colorSpaceProjection.colorSpace = schemaColorSpace;\n }\n return {\n name: entry.name,\n type,\n ...colorSpaceProjection,\n ...(isRequired ? {} : { optional: true }),\n } as MaterialParameter;\n });\n}\n\nfunction unlitParameters(colorSpace: MaterialColorSpace): readonly MaterialParameter[] {\n return [\n authoredColorParameter('baseColor', 'color', colorSpace),\n { name: 'alphaCutoff', type: 'f32', optional: true },\n { name: 'baseColorTexture', type: 'texture', optional: true },\n ];\n}\n\nfunction pass(\n name: string,\n module: string,\n renderState: MaterialRenderState | undefined,\n fragmentEntry?: string,\n queue?: number,\n): MaterialPass {\n const lightMode =\n name === 'shadow-caster' ? 'ShadowCaster' : name === 'deferred' ? 'Deferred' : 'Forward';\n const authoredState = (renderState ?? {}) as Readonly<Record<string, unknown>>;\n const authoredTags = authoredState.tags as Readonly<Record<string, string>> | undefined;\n return {\n name,\n program: {\n module,\n ...(fragmentEntry === undefined ? {} : { fragmentEntry }),\n },\n renderState: {\n ...authoredState,\n tags: { LightMode: lightMode, ...authoredTags },\n ...(queue === undefined ? {} : { queue }),\n },\n };\n}\n\nfunction shadowCasterRenderState(\n renderState: MaterialRenderState | undefined,\n): MaterialRenderState | undefined {\n if (renderState?.cullMode === undefined && renderState?.frontFace === undefined) return undefined;\n return {\n ...(renderState.cullMode === undefined ? {} : { cullMode: renderState.cullMode }),\n ...(renderState.frontFace === undefined ? {} : { frontFace: renderState.frontFace }),\n };\n}\n\ninterface UnlitOpts {\n readonly castShadow?: boolean;\n readonly baseColorTexture?: MaterialValue;\n readonly alphaCutoff?: number;\n readonly renderState?: MaterialRenderState;\n readonly queue?: number;\n}\n\nfunction unlit(rgba: MaterialColorInput4, opts?: UnlitOpts): MaterialAsset {\n if (opts?.alphaCutoff !== undefined && (opts.alphaCutoff < 0 || opts.alphaCutoff > 1)) {\n throw new Error(`Materials.unlit: alphaCutoff must be in [0, 1], got ${opts.alphaCutoff}`);\n }\n const values: Record<string, MaterialValue> = { baseColor: linearColorFromInput(rgba, 4) };\n if (opts?.baseColorTexture !== undefined) values.baseColorTexture = opts.baseColorTexture;\n if (opts?.alphaCutoff !== undefined) values.alphaCutoff = opts.alphaCutoff;\n const passes: [MaterialPass, ...MaterialPass[]] = [\n pass('forward', UNLIT_MODULE, opts?.renderState, undefined, opts?.queue),\n ];\n if (opts?.castShadow !== false) {\n passes.push(pass('shadow-caster', UNLIT_MODULE, shadowCasterRenderState(opts?.renderState)));\n }\n return {\n kind: 'material',\n colorSpace: 'linear',\n passes,\n parameters: unlitParameters('linear'),\n values,\n };\n}\n\ninterface StandardOpts {\n /** Numeric tuples are linear; Hex/CSS strings and numbers are sRGB inputs. */\n readonly baseColor: MaterialColorInput4;\n readonly metallic?: number;\n readonly roughness?: number;\n /** Texture channel used for the metallic factor; glTF defaults to B (2). */\n readonly metallicChannel?: number;\n /** Texture channel used for the roughness factor; glTF defaults to G (1). */\n readonly roughnessChannel?: number;\n readonly clearcoat?: number;\n readonly clearcoatRoughness?: number;\n readonly clearcoatTexture?: MaterialValue;\n readonly clearcoatRoughnessTexture?: MaterialValue;\n readonly clearcoatNormalTexture?: MaterialValue;\n readonly clearcoatNormalScale?: number;\n readonly anisotropyStrength?: number;\n readonly anisotropyRotation?: number;\n readonly anisotropyTexture?: MaterialValue;\n readonly sheenColor?: MaterialColorInput3;\n readonly sheenRoughness?: number;\n readonly sheenColorTexture?: MaterialValue;\n readonly sheenRoughnessTexture?: MaterialValue;\n readonly iridescence?: number;\n readonly iridescenceIor?: number;\n readonly iridescenceThicknessMinimum?: number;\n readonly iridescenceThicknessMaximum?: number;\n readonly iridescenceTexture?: MaterialValue;\n readonly iridescenceThicknessTexture?: MaterialValue;\n readonly specular?: number;\n readonly specularColor?: MaterialColorInput3;\n readonly specularTexture?: MaterialValue;\n readonly specularColorTexture?: MaterialValue;\n readonly emissive?: MaterialColorInput3;\n readonly emissiveIntensity?: number;\n readonly emissiveTexture?: MaterialValue;\n readonly baseColorTexture?: MaterialValue;\n readonly metallicRoughnessTexture?: MaterialValue;\n readonly normalTexture?: MaterialValue;\n readonly occlusionTexture?: MaterialValue;\n readonly occlusionStrength?: number;\n readonly alphaCutoff?: number;\n readonly transmission?: number;\n readonly transmissionTexture?: MaterialValue;\n readonly ior?: number;\n readonly thickness?: number;\n readonly thicknessTexture?: MaterialValue;\n readonly attenuationColor?: readonly [number, number, number];\n readonly attenuationDistance?: number;\n readonly renderState?: MaterialRenderState;\n readonly castShadow?: boolean;\n readonly queue?: number;\n}\n\n/** Built-in Standard authoring surface with engine-owned parameter defaults. */\nexport interface DefaultStandardOptions extends StandardOpts {\n readonly surfaceModule?: never;\n readonly parameters?: never;\n readonly values?: never;\n}\n\n/** Import-first Standard Surface authoring; the root parameter contract stays caller-owned. */\nexport interface CustomStandardSurfaceOptions {\n readonly surfaceModule: string;\n readonly parameters: readonly MaterialParameter[];\n readonly values: Readonly<Record<string, MaterialValue>>;\n readonly colorSpace?: MaterialColorSpace;\n readonly renderState?: MaterialRenderState;\n readonly castShadow?: boolean;\n readonly queue?: number;\n readonly baseColor?: never;\n readonly metallic?: never;\n readonly roughness?: never;\n readonly metallicChannel?: never;\n readonly roughnessChannel?: never;\n readonly clearcoat?: never;\n readonly clearcoatRoughness?: never;\n readonly clearcoatTexture?: never;\n readonly clearcoatRoughnessTexture?: never;\n readonly clearcoatNormalTexture?: never;\n readonly clearcoatNormalScale?: never;\n readonly anisotropyStrength?: never;\n readonly anisotropyRotation?: never;\n readonly anisotropyTexture?: never;\n readonly sheenColor?: never;\n readonly sheenRoughness?: never;\n readonly sheenColorTexture?: never;\n readonly sheenRoughnessTexture?: never;\n readonly iridescence?: never;\n readonly iridescenceIor?: never;\n readonly iridescenceThicknessMinimum?: never;\n readonly iridescenceThicknessMaximum?: never;\n readonly iridescenceTexture?: never;\n readonly iridescenceThicknessTexture?: never;\n readonly specular?: never;\n readonly specularColor?: never;\n readonly specularTexture?: never;\n readonly specularColorTexture?: never;\n readonly emissive?: never;\n readonly emissiveIntensity?: never;\n readonly emissiveTexture?: never;\n readonly baseColorTexture?: never;\n readonly metallicRoughnessTexture?: never;\n readonly normalTexture?: never;\n readonly occlusionTexture?: never;\n readonly occlusionStrength?: never;\n readonly alphaCutoff?: never;\n readonly transmission?: never;\n readonly transmissionTexture?: never;\n readonly ior?: never;\n readonly thickness?: never;\n readonly thicknessTexture?: never;\n readonly attenuationColor?: never;\n readonly attenuationDistance?: never;\n}\n\nexport type StandardOptions = DefaultStandardOptions | CustomStandardSurfaceOptions;\n\nfunction validateChannel(\n name: 'metallicChannel' | 'roughnessChannel',\n value: number | undefined,\n): void {\n if (value !== undefined && (!Number.isInteger(value) || value < 0 || value > 3)) {\n throw new Error(`Materials.standard: ${name} must be an integer in [0, 3], got ${value}`);\n }\n}\n\nfunction validateFiniteRange(\n name: 'transmission' | 'ior' | 'thickness' | 'attenuationDistance',\n value: number | undefined,\n minimum: number,\n maximum?: number,\n): void {\n if (value === undefined || !Number.isFinite(value)) {\n if (value === undefined) return;\n throw new MaterialTransmissionContractError(name, 'non-finite', value);\n }\n if (value < minimum || (maximum !== undefined && value > maximum)) {\n throw new MaterialTransmissionContractError(name, 'range', value);\n }\n}\n\nfunction standardDefault(opts: DefaultStandardOptions): MaterialAsset {\n const occlusionStrength = opts.occlusionStrength ?? 1;\n if (occlusionStrength < 0 || occlusionStrength > 1) {\n throw new Error(\n `Materials.standard: occlusionStrength must be in [0, 1], got ${occlusionStrength}`,\n );\n }\n if (opts.alphaCutoff !== undefined && (opts.alphaCutoff < 0 || opts.alphaCutoff > 1)) {\n throw new Error(`Materials.standard: alphaCutoff must be in [0, 1], got ${opts.alphaCutoff}`);\n }\n validateChannel('metallicChannel', opts.metallicChannel);\n validateChannel('roughnessChannel', opts.roughnessChannel);\n const transmission = opts.transmission ?? 0;\n const ior = opts.ior ?? 1.5;\n const thickness = opts.thickness ?? 0;\n const attenuationColor = opts.attenuationColor ?? [1, 1, 1];\n validateFiniteRange('transmission', transmission, 0, 1);\n validateFiniteRange('ior', ior, 1);\n validateFiniteRange('thickness', thickness, 0);\n validateFiniteRange('attenuationDistance', opts.attenuationDistance, Number.MIN_VALUE);\n if (\n attenuationColor.length !== 3 ||\n attenuationColor.some((value) => !Number.isFinite(value) || value < 0 || value > 1)\n ) {\n throw new MaterialTransmissionContractError('attenuationColor', 'shape', attenuationColor);\n }\n if (transmission > 0 && opts.renderState?.blend !== undefined) {\n throw new MaterialTransmissionContractError('transmission', 'blend', opts.renderState.blend);\n }\n if (transmission > 0 && opts.renderState?.depthWriteEnabled === true) {\n throw new MaterialTransmissionContractError('transmission', 'depth-write', true);\n }\n const values: Record<string, MaterialValue> = {\n baseColor: linearColorFromInput(opts.baseColor, 4),\n metallic: opts.metallic ?? 0,\n roughness: opts.roughness ?? 0.5,\n occlusionStrength,\n specular: opts.specular ?? 1,\n specularColor:\n opts.specularColor === undefined ? [1, 1, 1] : linearColorFromInput(opts.specularColor, 3),\n transmission,\n ior,\n thickness,\n attenuationColor,\n };\n if (opts.metallicChannel !== undefined) values.metallicChannel = opts.metallicChannel;\n if (opts.roughnessChannel !== undefined) values.roughnessChannel = opts.roughnessChannel;\n if (opts.clearcoat !== undefined) values.clearcoat = opts.clearcoat;\n if (opts.clearcoatRoughness !== undefined) values.clearcoatRoughness = opts.clearcoatRoughness;\n if (opts.clearcoatTexture !== undefined) values.clearcoatTexture = opts.clearcoatTexture;\n if (opts.clearcoatRoughnessTexture !== undefined) {\n values.clearcoatRoughnessTexture = opts.clearcoatRoughnessTexture;\n }\n if (opts.clearcoatNormalTexture !== undefined) {\n values.clearcoatNormalTexture = opts.clearcoatNormalTexture;\n }\n if (opts.clearcoatNormalScale !== undefined)\n values.clearcoatNormalScale = opts.clearcoatNormalScale;\n if (opts.anisotropyStrength !== undefined) values.anisotropyStrength = opts.anisotropyStrength;\n if (opts.anisotropyRotation !== undefined) values.anisotropyRotation = opts.anisotropyRotation;\n if (opts.anisotropyTexture !== undefined) values.anisotropyTexture = opts.anisotropyTexture;\n if (opts.sheenColor !== undefined) values.sheenColor = linearColorFromInput(opts.sheenColor, 3);\n if (opts.sheenRoughness !== undefined) values.sheenRoughness = opts.sheenRoughness;\n if (opts.sheenColorTexture !== undefined) values.sheenColorTexture = opts.sheenColorTexture;\n if (opts.sheenRoughnessTexture !== undefined) {\n values.sheenRoughnessTexture = opts.sheenRoughnessTexture;\n }\n if (opts.iridescence !== undefined) values.iridescence = opts.iridescence;\n if (opts.iridescenceIor !== undefined) values.iridescenceIor = opts.iridescenceIor;\n if (opts.iridescenceThicknessMinimum !== undefined) {\n values.iridescenceThicknessMinimum = opts.iridescenceThicknessMinimum;\n }\n if (opts.iridescenceThicknessMaximum !== undefined) {\n values.iridescenceThicknessMaximum = opts.iridescenceThicknessMaximum;\n }\n if (opts.iridescenceTexture !== undefined) values.iridescenceTexture = opts.iridescenceTexture;\n if (opts.iridescenceThicknessTexture !== undefined) {\n values.iridescenceThicknessTexture = opts.iridescenceThicknessTexture;\n }\n if (opts.emissive !== undefined) values.emissive = linearColorFromInput(opts.emissive, 3);\n if (opts.emissiveIntensity !== undefined) values.emissiveIntensity = opts.emissiveIntensity;\n if (opts.emissiveTexture !== undefined) values.emissiveTexture = opts.emissiveTexture;\n if (opts.baseColorTexture !== undefined) values.baseColorTexture = opts.baseColorTexture;\n if (opts.metallicRoughnessTexture !== undefined) {\n values.metallicRoughnessTexture = opts.metallicRoughnessTexture;\n }\n if (opts.normalTexture !== undefined) values.normalTexture = opts.normalTexture;\n if (opts.occlusionTexture !== undefined) values.occlusionTexture = opts.occlusionTexture;\n if (opts.specularTexture !== undefined) values.specularTexture = opts.specularTexture;\n if (opts.specularColorTexture !== undefined) {\n values.specularColorTexture = opts.specularColorTexture;\n }\n if (opts.alphaCutoff !== undefined) values.alphaCutoff = opts.alphaCutoff;\n if (opts.transmissionTexture !== undefined) values.transmissionTexture = opts.transmissionTexture;\n if (opts.thicknessTexture !== undefined) values.thicknessTexture = opts.thicknessTexture;\n if (opts.attenuationDistance !== undefined) values.attenuationDistance = opts.attenuationDistance;\n const forwardRenderState =\n transmission > 0 ? { ...(opts.renderState ?? {}), depthWriteEnabled: false } : opts.renderState;\n const parameters = standardSurfaceParameters(standardParameters('linear', opts));\n const declaredNames = new Set(parameters.map((parameter) => parameter.name));\n for (const name of Object.keys(values)) {\n if (!declaredNames.has(name)) delete values[name];\n }\n const layerPlan = deriveStandardLayerPlan(parameters);\n const projected = projectStandardSurfacePasses({\n surfaceModule: DEFAULT_STANDARD_SURFACE_MODULE,\n values,\n ...(forwardRenderState === undefined ? {} : { renderState: forwardRenderState }),\n ...(opts.castShadow === undefined ? {} : { castShadow: opts.castShadow }),\n ...(opts.queue === undefined ? {} : { queue: opts.queue }),\n layerPlan,\n });\n const passes = (\n transmission > 0 ? projected.filter((entry) => entry.name !== 'deferred') : projected\n ) as [MaterialPass, ...MaterialPass[]];\n return {\n kind: 'material',\n colorSpace: 'linear',\n passes,\n parameters,\n values,\n };\n}\n\nfunction standardCustom(opts: CustomStandardSurfaceOptions): MaterialAsset {\n const layerPlan = deriveStandardLayerPlan(\n opts.parameters.filter((parameter) => parameter.optional !== true),\n );\n return {\n kind: 'material',\n ...(opts.colorSpace === undefined || opts.colorSpace === 'srgb'\n ? {}\n : { colorSpace: opts.colorSpace }),\n passes: projectStandardSurfacePasses({\n surfaceModule: opts.surfaceModule,\n values: opts.values,\n ...(opts.renderState === undefined ? {} : { renderState: opts.renderState }),\n ...(opts.castShadow === undefined ? {} : { castShadow: opts.castShadow }),\n ...(opts.queue === undefined ? {} : { queue: opts.queue }),\n layerPlan,\n }),\n parameters: standardSurfaceParameters(opts.parameters),\n values: opts.values,\n };\n}\n\nexport function standard(options: StandardOptions): MaterialAsset {\n return options.surfaceModule === undefined ? standardDefault(options) : standardCustom(options);\n}\n\nexport const Materials = { unlit, standard, srgb } as const;\n\nexport { SPRITE_MODULE };\n"]}