@zephyr3d/scene 0.9.4 → 0.9.5

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 (102) hide show
  1. package/dist/animation/animationmask.js +224 -0
  2. package/dist/animation/animationmask.js.map +1 -0
  3. package/dist/animation/animationset.js +268 -67
  4. package/dist/animation/animationset.js.map +1 -1
  5. package/dist/animation/animationtrack.js.map +1 -1
  6. package/dist/animation/eulerrotationtrack.js +3 -0
  7. package/dist/animation/eulerrotationtrack.js.map +1 -1
  8. package/dist/animation/fixed_geometry_cache_track.js +7 -0
  9. package/dist/animation/fixed_geometry_cache_track.js.map +1 -1
  10. package/dist/animation/ik_modifier.js.map +1 -1
  11. package/dist/animation/joint_dynamics/collision.js +6 -4
  12. package/dist/animation/joint_dynamics/collision.js.map +1 -1
  13. package/dist/animation/joint_dynamics/controller.js +390 -43
  14. package/dist/animation/joint_dynamics/controller.js.map +1 -1
  15. package/dist/animation/joint_dynamics/joint_dynamics_system.js +62 -3
  16. package/dist/animation/joint_dynamics/joint_dynamics_system.js.map +1 -1
  17. package/dist/animation/joint_dynamics/solver.js +4 -3
  18. package/dist/animation/joint_dynamics/solver.js.map +1 -1
  19. package/dist/animation/joint_dynamics/types.js.map +1 -1
  20. package/dist/animation/joint_dynamics_modifier.js +2 -0
  21. package/dist/animation/joint_dynamics_modifier.js.map +1 -1
  22. package/dist/animation/morphtarget.js +3 -72
  23. package/dist/animation/morphtarget.js.map +1 -1
  24. package/dist/animation/morphtrack.js +3 -0
  25. package/dist/animation/morphtrack.js.map +1 -1
  26. package/dist/animation/pca_geometry_cache_track.js +3 -0
  27. package/dist/animation/pca_geometry_cache_track.js.map +1 -1
  28. package/dist/animation/proptrack.js +3 -0
  29. package/dist/animation/proptrack.js.map +1 -1
  30. package/dist/animation/rotationtrack.js +3 -0
  31. package/dist/animation/rotationtrack.js.map +1 -1
  32. package/dist/animation/scaletrack.js +3 -0
  33. package/dist/animation/scaletrack.js.map +1 -1
  34. package/dist/animation/skeleton.js +254 -79
  35. package/dist/animation/skeleton.js.map +1 -1
  36. package/dist/animation/skeleton_modifier.js.map +1 -1
  37. package/dist/animation/spring_modifier.js.map +1 -1
  38. package/dist/animation/translationtrack.js +3 -0
  39. package/dist/animation/translationtrack.js.map +1 -1
  40. package/dist/app/engine.js +171 -107
  41. package/dist/app/engine.js.map +1 -1
  42. package/dist/app/scriptregistry.js +251 -80
  43. package/dist/app/scriptregistry.js.map +1 -1
  44. package/dist/asset/assetmanager.js +344 -365
  45. package/dist/asset/assetmanager.js.map +1 -1
  46. package/dist/asset/loaders/gltf/gltf_loader.js +17 -14
  47. package/dist/asset/loaders/gltf/gltf_loader.js.map +1 -1
  48. package/dist/asset/loaders/loader.js +1 -6
  49. package/dist/asset/loaders/loader.js.map +1 -1
  50. package/dist/asset/loaders/zabc/zabc_loader.js.map +1 -1
  51. package/dist/asset/model.js +1000 -131
  52. package/dist/asset/model.js.map +1 -1
  53. package/dist/avatar/wardrobe.js +474 -0
  54. package/dist/avatar/wardrobe.js.map +1 -0
  55. package/dist/index.d.ts +1125 -199
  56. package/dist/index.js +3 -2
  57. package/dist/index.js.map +1 -1
  58. package/dist/material/mixins/lightmodel/pbrmetallicroughness.js +6 -3
  59. package/dist/material/mixins/lightmodel/pbrmetallicroughness.js.map +1 -1
  60. package/dist/material/mixins/pbr/common.js +72 -15
  61. package/dist/material/mixins/pbr/common.js.map +1 -1
  62. package/dist/material/msdf_text_sprite.js +4 -4
  63. package/dist/material/msdf_text_sprite.js.map +1 -1
  64. package/dist/material/pbrblueprint.js +102 -102
  65. package/dist/material/pbrblueprint.js.map +1 -1
  66. package/dist/render/envlight.js +54 -1
  67. package/dist/render/envlight.js.map +1 -1
  68. package/dist/render/sky.js +9 -0
  69. package/dist/render/sky.js.map +1 -1
  70. package/dist/scene/batchgroup.js +11 -13
  71. package/dist/scene/batchgroup.js.map +1 -1
  72. package/dist/scene/environment.js +15 -2
  73. package/dist/scene/environment.js.map +1 -1
  74. package/dist/scene/mesh.js +79 -16
  75. package/dist/scene/mesh.js.map +1 -1
  76. package/dist/scene/scene.js +1 -0
  77. package/dist/scene/scene.js.map +1 -1
  78. package/dist/scene/scene_node.js +203 -2
  79. package/dist/scene/scene_node.js.map +1 -1
  80. package/dist/text/font/font_asset.js.map +1 -1
  81. package/dist/text/msdf/generator.js.map +1 -1
  82. package/dist/text/msdf/shape.js +4 -1
  83. package/dist/text/msdf/shape.js.map +1 -1
  84. package/dist/text/runtime/msdf_text_atlas_manager.js +4 -1
  85. package/dist/text/runtime/msdf_text_atlas_manager.js.map +1 -1
  86. package/dist/utility/blueprint/material/inputs.js +1157 -1154
  87. package/dist/utility/blueprint/material/inputs.js.map +1 -1
  88. package/dist/utility/bounding_volume.js.map +1 -1
  89. package/dist/utility/pmrem.js +34 -8
  90. package/dist/utility/pmrem.js.map +1 -1
  91. package/dist/utility/serialization/manager.js +22 -9
  92. package/dist/utility/serialization/manager.js.map +1 -1
  93. package/dist/utility/serialization/scene/animation.js +700 -7
  94. package/dist/utility/serialization/scene/animation.js.map +1 -1
  95. package/dist/utility/serialization/scene/mesh.js +64 -4
  96. package/dist/utility/serialization/scene/mesh.js.map +1 -1
  97. package/dist/utility/serialization/scene/node.js +187 -8
  98. package/dist/utility/serialization/scene/node.js.map +1 -1
  99. package/dist/utility/serialization/types.js.map +1 -1
  100. package/dist/utility/textures/sheenlut.js +138 -0
  101. package/dist/utility/textures/sheenlut.js.map +1 -0
  102. package/package.json +2 -2
@@ -2,10 +2,10 @@ import { ShaderHelper } from './shader/helper.js';
2
2
  import { MeshMaterial } from './meshmaterial.js';
3
3
  import { MSDFTextMaterial } from './msdf_text.js';
4
4
 
5
- /**
6
- * Billboard MSDF text material.
7
- *
8
- * @public
5
+ /**
6
+ * Billboard MSDF text material.
7
+ *
8
+ * @public
9
9
  */ class MSDFTextSpriteMaterial extends MSDFTextMaterial {
10
10
  _rotation;
11
11
  constructor(){
@@ -1 +1 @@
1
- {"version":3,"file":"msdf_text_sprite.js","sources":["../../src/material/msdf_text_sprite.ts"],"sourcesContent":["import type { BindGroup, PBFunctionScope } from '@zephyr3d/device';\nimport type { Clonable } from '@zephyr3d/base';\nimport { ShaderHelper } from './shader/helper';\nimport { MeshMaterial } from './meshmaterial';\nimport { MSDFTextMaterial } from './msdf_text';\nimport type { DrawContext } from '../render';\n\n/**\n * Billboard MSDF text material.\n *\n * @public\n */\nexport class MSDFTextSpriteMaterial extends MSDFTextMaterial implements Clonable<MSDFTextSpriteMaterial> {\n private _rotation: number;\n constructor() {\n super();\n this._rotation = 0;\n }\n get rotation() {\n return this._rotation;\n }\n set rotation(value: number) {\n if (this._rotation !== value) {\n this._rotation = value;\n this.uniformChanged();\n }\n }\n clone() {\n const other = new MSDFTextSpriteMaterial();\n other.copyFrom(this);\n return other;\n }\n copyFrom(other: this) {\n super.copyFrom(other);\n this.rotation = other.rotation;\n }\n vertexShader(scope: PBFunctionScope) {\n MeshMaterial.prototype.vertexShader.call(this, scope);\n const pb = scope.$builder;\n scope.$l.oPos = ShaderHelper.resolveVertexPosition(scope);\n scope.$inputs.zMSDFUV = pb.vec2().attrib('texCoord0');\n scope.$outputs.zMSDFUV = scope.$inputs.zMSDFUV;\n scope.$outputs.zMSDFLocalPos = scope.oPos.xy;\n scope.zMSDFSpriteRotation = pb.float().uniform(2);\n scope.$l.worldPos = ShaderHelper.getWorldMatrix(scope)[3].xyz;\n scope.$l.scaleX = pb.sqrt(\n pb.dot(ShaderHelper.getWorldMatrix(scope)[0].xyz, ShaderHelper.getWorldMatrix(scope)[0].xyz)\n );\n scope.$l.scaleY = pb.sqrt(\n pb.dot(ShaderHelper.getWorldMatrix(scope)[1].xyz, ShaderHelper.getWorldMatrix(scope)[1].xyz)\n );\n scope.$l.localPos = scope.oPos.xy;\n const viewMatrix = ShaderHelper.getViewMatrix(scope);\n scope.$l.forward = pb.vec3(viewMatrix[0].z, viewMatrix[1].z, viewMatrix[2].z);\n scope.$l.axis = scope.$choice(\n pb.lessThan(pb.abs(scope.forward.y), 0.999),\n pb.vec3(0, 1, 0),\n pb.vec3(1, 0, 0)\n );\n scope.$l.right = pb.normalize(pb.cross(scope.axis, scope.forward));\n scope.$l.up = pb.normalize(pb.cross(scope.forward, scope.right));\n scope.$l.c = pb.cos(scope.zMSDFSpriteRotation);\n scope.$l.s = pb.sin(scope.zMSDFSpriteRotation);\n scope.$l.rightRot = pb.add(pb.mul(scope.up, scope.s), pb.mul(scope.right, scope.c));\n scope.$l.upRot = pb.sub(pb.mul(scope.up, scope.c), pb.mul(scope.right, scope.s));\n scope.$outputs.worldPos = pb.add(\n scope.worldPos,\n pb.mul(scope.rightRot, pb.mul(scope.localPos.x, scope.scaleX)),\n pb.mul(scope.upRot, pb.mul(scope.localPos.y, scope.scaleY))\n );\n ShaderHelper.setClipSpacePosition(\n scope,\n pb.mul(ShaderHelper.getViewProjectionMatrix(scope), pb.vec4(scope.$outputs.worldPos, 1))\n );\n }\n applyUniformValues(bindGroup: BindGroup, ctx: DrawContext, pass: number) {\n super.applyUniformValues(bindGroup, ctx, pass);\n bindGroup.setValue('zMSDFSpriteRotation', this._rotation);\n }\n}\n"],"names":["MSDFTextSpriteMaterial","MSDFTextMaterial","_rotation","rotation","value","uniformChanged","clone","other","copyFrom","vertexShader","scope","MeshMaterial","prototype","call","pb","$builder","$l","oPos","ShaderHelper","resolveVertexPosition","$inputs","zMSDFUV","vec2","attrib","$outputs","zMSDFLocalPos","xy","zMSDFSpriteRotation","float","uniform","worldPos","getWorldMatrix","xyz","scaleX","sqrt","dot","scaleY","localPos","viewMatrix","getViewMatrix","forward","vec3","z","axis","$choice","lessThan","abs","y","right","normalize","cross","up","c","cos","s","sin","rightRot","add","mul","upRot","sub","x","setClipSpacePosition","getViewProjectionMatrix","vec4","applyUniformValues","bindGroup","ctx","pass","setValue"],"mappings":";;;;AAOA;;;;IAKO,MAAMA,sBAA+BC,SAAAA,gBAAAA,CAAAA;IAClCC,SAAkB;IAC1B,WAA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;AAC9E5C,QAAAA,KAAAA,CAAMc,QAAQ,CAACM,QAAQ,GAAGhB,EAAG2C,CAAAA,GAAG,CAC9B/C,KAAMoB,CAAAA,QAAQ,EACdhB,EAAG4C,CAAAA,GAAG,CAAChD,KAAM8C,CAAAA,QAAQ,EAAE1C,EAAG4C,CAAAA,GAAG,CAAChD,KAAM2B,CAAAA,QAAQ,CAACwB,CAAC,EAAEnD,KAAMuB,CAAAA,MAAM,IAC5DnB,EAAG4C,CAAAA,GAAG,CAAChD,KAAMiD,CAAAA,KAAK,EAAE7C,EAAG4C,CAAAA,GAAG,CAAChD,KAAM2B,CAAAA,QAAQ,CAACU,CAAC,EAAErC,MAAM0B,MAAM,CAAA,CAAA,CAAA;AAE3DlB,QAAAA,YAAAA,CAAa4C,oBAAoB,CAC/BpD,KAAAA,EACAI,EAAG4C,CAAAA,GAAG,CAACxC,YAAa6C,CAAAA,uBAAuB,CAACrD,KAAAA,CAAAA,EAAQI,GAAGkD,IAAI,CAACtD,MAAMc,QAAQ,CAACM,QAAQ,EAAE,CAAA,CAAA,CAAA,CAAA;AAEzF;AACAmC,IAAAA,kBAAAA,CAAmBC,SAAoB,EAAEC,GAAgB,EAAEC,IAAY,EAAE;QACvE,KAAK,CAACH,kBAAmBC,CAAAA,SAAAA,EAAWC,GAAKC,EAAAA,IAAAA,CAAAA;AACzCF,QAAAA,SAAAA,CAAUG,QAAQ,CAAC,qBAAuB,EAAA,IAAI,CAACnE,SAAS,CAAA;AAC1D;AACF;;;;"}
1
+ {"version":3,"file":"msdf_text_sprite.js","sources":["../../src/material/msdf_text_sprite.ts"],"sourcesContent":["import type { BindGroup, PBFunctionScope } from '@zephyr3d/device';\r\nimport type { Clonable } from '@zephyr3d/base';\r\nimport { ShaderHelper } from './shader/helper';\r\nimport { MeshMaterial } from './meshmaterial';\r\nimport { MSDFTextMaterial } from './msdf_text';\r\nimport type { DrawContext } from '../render';\r\n\r\n/**\r\n * Billboard MSDF text material.\r\n *\r\n * @public\r\n */\r\nexport class MSDFTextSpriteMaterial extends MSDFTextMaterial implements Clonable<MSDFTextSpriteMaterial> {\r\n private _rotation: number;\r\n constructor() {\r\n super();\r\n this._rotation = 0;\r\n }\r\n get rotation() {\r\n return this._rotation;\r\n }\r\n set rotation(value: number) {\r\n if (this._rotation !== value) {\r\n this._rotation = value;\r\n this.uniformChanged();\r\n }\r\n }\r\n clone() {\r\n const other = new MSDFTextSpriteMaterial();\r\n other.copyFrom(this);\r\n return other;\r\n }\r\n copyFrom(other: this) {\r\n super.copyFrom(other);\r\n this.rotation = other.rotation;\r\n }\r\n vertexShader(scope: PBFunctionScope) {\r\n MeshMaterial.prototype.vertexShader.call(this, scope);\r\n const pb = scope.$builder;\r\n scope.$l.oPos = ShaderHelper.resolveVertexPosition(scope);\r\n scope.$inputs.zMSDFUV = pb.vec2().attrib('texCoord0');\r\n scope.$outputs.zMSDFUV = scope.$inputs.zMSDFUV;\r\n scope.$outputs.zMSDFLocalPos = scope.oPos.xy;\r\n scope.zMSDFSpriteRotation = pb.float().uniform(2);\r\n scope.$l.worldPos = ShaderHelper.getWorldMatrix(scope)[3].xyz;\r\n scope.$l.scaleX = pb.sqrt(\r\n pb.dot(ShaderHelper.getWorldMatrix(scope)[0].xyz, ShaderHelper.getWorldMatrix(scope)[0].xyz)\r\n );\r\n scope.$l.scaleY = pb.sqrt(\r\n pb.dot(ShaderHelper.getWorldMatrix(scope)[1].xyz, ShaderHelper.getWorldMatrix(scope)[1].xyz)\r\n );\r\n scope.$l.localPos = scope.oPos.xy;\r\n const viewMatrix = ShaderHelper.getViewMatrix(scope);\r\n scope.$l.forward = pb.vec3(viewMatrix[0].z, viewMatrix[1].z, viewMatrix[2].z);\r\n scope.$l.axis = scope.$choice(\r\n pb.lessThan(pb.abs(scope.forward.y), 0.999),\r\n pb.vec3(0, 1, 0),\r\n pb.vec3(1, 0, 0)\r\n );\r\n scope.$l.right = pb.normalize(pb.cross(scope.axis, scope.forward));\r\n scope.$l.up = pb.normalize(pb.cross(scope.forward, scope.right));\r\n scope.$l.c = pb.cos(scope.zMSDFSpriteRotation);\r\n scope.$l.s = pb.sin(scope.zMSDFSpriteRotation);\r\n scope.$l.rightRot = pb.add(pb.mul(scope.up, scope.s), pb.mul(scope.right, scope.c));\r\n scope.$l.upRot = pb.sub(pb.mul(scope.up, scope.c), pb.mul(scope.right, scope.s));\r\n scope.$outputs.worldPos = pb.add(\r\n scope.worldPos,\r\n pb.mul(scope.rightRot, pb.mul(scope.localPos.x, scope.scaleX)),\r\n pb.mul(scope.upRot, pb.mul(scope.localPos.y, scope.scaleY))\r\n );\r\n ShaderHelper.setClipSpacePosition(\r\n scope,\r\n pb.mul(ShaderHelper.getViewProjectionMatrix(scope), pb.vec4(scope.$outputs.worldPos, 1))\r\n );\r\n }\r\n applyUniformValues(bindGroup: BindGroup, ctx: DrawContext, pass: number) {\r\n super.applyUniformValues(bindGroup, ctx, pass);\r\n bindGroup.setValue('zMSDFSpriteRotation', this._rotation);\r\n }\r\n}\r\n"],"names":["MSDFTextSpriteMaterial","MSDFTextMaterial","_rotation","rotation","value","uniformChanged","clone","other","copyFrom","vertexShader","scope","MeshMaterial","prototype","call","pb","$builder","$l","oPos","ShaderHelper","resolveVertexPosition","$inputs","zMSDFUV","vec2","attrib","$outputs","zMSDFLocalPos","xy","zMSDFSpriteRotation","float","uniform","worldPos","getWorldMatrix","xyz","scaleX","sqrt","dot","scaleY","localPos","viewMatrix","getViewMatrix","forward","vec3","z","axis","$choice","lessThan","abs","y","right","normalize","cross","up","c","cos","s","sin","rightRot","add","mul","upRot","sub","x","setClipSpacePosition","getViewProjectionMatrix","vec4","applyUniformValues","bindGroup","ctx","pass","setValue"],"mappings":";;;;AAOA;;;;IAKO,MAAMA,sBAA+BC,SAAAA,gBAAAA,CAAAA;IAClCC,SAAkB;IAC1B,WAAc,EAAA;QACZ,KAAK,EAAA;QACL,IAAI,CAACA,SAAS,GAAG,CAAA;AACnB;AACA,IAAA,IAAIC,QAAW,GAAA;Q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B,CAAAA,QAAQ,EACdhB,EAAG4C,CAAAA,GAAG,CAAChD,KAAM8C,CAAAA,QAAQ,EAAE1C,EAAG4C,CAAAA,GAAG,CAAChD,KAAM2B,CAAAA,QAAQ,CAACwB,CAAC,EAAEnD,KAAMuB,CAAAA,MAAM,IAC5DnB,EAAG4C,CAAAA,GAAG,CAAChD,KAAMiD,CAAAA,KAAK,EAAE7C,EAAG4C,CAAAA,GAAG,CAAChD,KAAM2B,CAAAA,QAAQ,CAACU,CAAC,EAAErC,MAAM0B,MAAM,CAAA,CAAA,CAAA;AAE3DlB,QAAAA,YAAAA,CAAa4C,oBAAoB,CAC/BpD,KAAAA,EACAI,EAAG4C,CAAAA,GAAG,CAACxC,YAAa6C,CAAAA,uBAAuB,CAACrD,KAAAA,CAAAA,EAAQI,GAAGkD,IAAI,CAACtD,MAAMc,QAAQ,CAACM,QAAQ,EAAE,CAAA,CAAA,CAAA,CAAA;AAEzF;AACAmC,IAAAA,kBAAAA,CAAmBC,SAAoB,EAAEC,GAAgB,EAAEC,IAAY,EAAE;QACvE,KAAK,CAACH,kBAAmBC,CAAAA,SAAAA,EAAWC,GAAKC,EAAAA,IAAAA,CAAAA;AACzCF,QAAAA,SAAAA,CAAUG,QAAQ,CAAC,qBAAuB,EAAA,IAAI,CAACnE,SAAS,CAAA;AAC1D;AACF;;;;"}
@@ -12,24 +12,24 @@ const PBR_REFLECTION_MODE = {
12
12
  anisotropic: 2,
13
13
  glint: 3
14
14
  };
15
- /**
16
- * Physically-based rendering material driven by blueprint graphs.
17
- *
18
- * @remarks
19
- * This material extends {@link MeshMaterial} with PBR behavior via
20
- * {@link mixinPBRBluePrint}, and uses {@link MaterialBlueprintIR}
21
- * graphs for both vertex and fragment stages.
22
- *
23
- * - The **vertex blueprint IR** (`vertexIR`) controls vertex
24
- * transformations and per-vertex data.
25
- * - The **fragment blueprint IR** (`fragmentIR`) produces inputs
26
- * for the PBR shading model (albedo, roughness, metalness, etc.).
27
- *
28
- * Uniform values and textures for the blueprints are provided via
29
- * {@link PBRBluePrintMaterial.uniformValues} and
30
- * {@link PBRBluePrintMaterial.uniformTextures}.
31
- *
32
- * @public
15
+ /**
16
+ * Physically-based rendering material driven by blueprint graphs.
17
+ *
18
+ * @remarks
19
+ * This material extends {@link MeshMaterial} with PBR behavior via
20
+ * {@link mixinPBRBluePrint}, and uses {@link MaterialBlueprintIR}
21
+ * graphs for both vertex and fragment stages.
22
+ *
23
+ * - The **vertex blueprint IR** (`vertexIR`) controls vertex
24
+ * transformations and per-vertex data.
25
+ * - The **fragment blueprint IR** (`fragmentIR`) produces inputs
26
+ * for the PBR shading model (albedo, roughness, metalness, etc.).
27
+ *
28
+ * Uniform values and textures for the blueprints are provided via
29
+ * {@link PBRBluePrintMaterial.uniformValues} and
30
+ * {@link PBRBluePrintMaterial.uniformTextures}.
31
+ *
32
+ * @public
33
33
  */ class PBRBluePrintMaterial extends applyMaterialMixins(MeshMaterial, mixinPBRBluePrint) {
34
34
  /** @internal */ static FEATURE_VERTEX_COLOR = this.defineFeature();
35
35
  /** @internal */ static FEATURE_VERTEX_UV = this.defineFeature();
@@ -46,15 +46,15 @@ const PBR_REFLECTION_MODE = {
46
46
  /** @internal */ _anisotropy;
47
47
  /** @internal */ _anisotropyDirection;
48
48
  /** @internal */ _anisotropyDirectionScaleBias;
49
- /**
50
- * Creates a new {@link PBRBluePrintMaterial} instance.
51
- *
52
- * @param irFrag - Optional fragment blueprint IR. If omitted, a default
53
- * IR containing a single {@link PBRBlockNode} is created.
54
- * @param irVertex - Optional vertex blueprint IR. If omitted, a default
55
- * IR containing a single {@link VertexBlockNode} is created.
56
- * @param uniformValues - Optional initial list of uniform value descriptors.
57
- * @param uniformTextures - Optional initial list of texture uniform descriptors.
49
+ /**
50
+ * Creates a new {@link PBRBluePrintMaterial} instance.
51
+ *
52
+ * @param irFrag - Optional fragment blueprint IR. If omitted, a default
53
+ * IR containing a single {@link PBRBlockNode} is created.
54
+ * @param irVertex - Optional vertex blueprint IR. If omitted, a default
55
+ * IR containing a single {@link VertexBlockNode} is created.
56
+ * @param uniformValues - Optional initial list of uniform value descriptors.
57
+ * @param uniformTextures - Optional initial list of texture uniform descriptors.
58
58
  */ constructor(irFrag, irVertex, uniformValues, uniformTextures){
59
59
  super();
60
60
  this._irFrag = irFrag ?? new MaterialBlueprintIR({
@@ -206,8 +206,8 @@ const PBR_REFLECTION_MODE = {
206
206
  this.uniformChanged();
207
207
  }
208
208
  }
209
- /**
210
- * Gets the fragment blueprint IR.
209
+ /**
210
+ * Gets the fragment blueprint IR.
211
211
  */ get fragmentIR() {
212
212
  return this._irFrag;
213
213
  }
@@ -218,8 +218,8 @@ const PBR_REFLECTION_MODE = {
218
218
  this.optionChanged(true);
219
219
  }
220
220
  }
221
- /**
222
- * Gets the vertex blueprint IR.
221
+ /**
222
+ * Gets the vertex blueprint IR.
223
223
  */ get vertexIR() {
224
224
  return this._irVertex;
225
225
  }
@@ -232,8 +232,8 @@ const PBR_REFLECTION_MODE = {
232
232
  this.optionChanged(true);
233
233
  }
234
234
  }
235
- /**
236
- * Gets the list of uniform value descriptors used by the blueprints.
235
+ /**
236
+ * Gets the list of uniform value descriptors used by the blueprints.
237
237
  */ get uniformValues() {
238
238
  return this._uniformValues;
239
239
  }
@@ -243,8 +243,8 @@ const PBR_REFLECTION_MODE = {
243
243
  }));
244
244
  this.uniformChanged();
245
245
  }
246
- /**
247
- * Gets the list of texture uniform descriptors used by the blueprints.
246
+ /**
247
+ * Gets the list of texture uniform descriptors used by the blueprints.
248
248
  */ get uniformTextures() {
249
249
  return this._uniformTextures;
250
250
  }
@@ -273,15 +273,15 @@ const PBR_REFLECTION_MODE = {
273
273
  this.uniformChanged();
274
274
  }
275
275
  }
276
- /**
277
- * Creates a deep copy of this material.
278
- *
279
- * @remarks
280
- * The clone shares the same vertex/fragment IR references and copies
281
- * the current blueprint uniform descriptors, then calls `copyFrom`
282
- * to copy base-class and mixin state.
283
- *
284
- * @returns A new {@link PBRBluePrintMaterial} instance.
276
+ /**
277
+ * Creates a deep copy of this material.
278
+ *
279
+ * @remarks
280
+ * The clone shares the same vertex/fragment IR references and copies
281
+ * the current blueprint uniform descriptors, then calls `copyFrom`
282
+ * to copy base-class and mixin state.
283
+ *
284
+ * @returns A new {@link PBRBluePrintMaterial} instance.
285
285
  */ clone() {
286
286
  const other = new PBRBluePrintMaterial(this._irFrag, this._irVertex, this._uniformValues, this._uniformTextures);
287
287
  other.copyFrom(this);
@@ -299,10 +299,10 @@ const PBR_REFLECTION_MODE = {
299
299
  this.anisotropyDirection = other.anisotropyDirection;
300
300
  this.anisotropyDirectionScaleBias = other.anisotropyDirectionScaleBias;
301
301
  }
302
- /**
303
- * Builds the vertex shader for this PBR blueprint material.
304
- *
305
- * @param scope - The current vertex shader function scope.
302
+ /**
303
+ * Builds the vertex shader for this PBR blueprint material.
304
+ *
305
+ * @param scope - The current vertex shader function scope.
306
306
  */ vertexShader(scope) {
307
307
  super.vertexShader(scope);
308
308
  const pb = scope.$builder;
@@ -349,10 +349,10 @@ const PBR_REFLECTION_MODE = {
349
349
  }
350
350
  }
351
351
  }
352
- /**
353
- * Builds the fragment shader for this PBR blueprint material.
354
- *
355
- * @param scope - The current fragment shader function scope.
352
+ /**
353
+ * Builds the fragment shader for this PBR blueprint material.
354
+ *
355
+ * @param scope - The current fragment shader function scope.
356
356
  */ fragmentShader(scope) {
357
357
  super.fragmentShader(scope);
358
358
  const pb = scope.$builder;
@@ -400,17 +400,17 @@ const PBR_REFLECTION_MODE = {
400
400
  this.outputFragmentColor(scope, scope.$inputs.worldPos, null);
401
401
  }
402
402
  }
403
- /**
404
- * Applies runtime uniform values and textures to the given bind group.
405
- *
406
- * @remarks
407
- * - Calls the base implementation first to bind standard mesh/PBR uniforms.
408
- * - If fragment color is needed for the current context, all blueprint
409
- * scalar/vector uniform values and textures are then bound by name.
410
- *
411
- * @param bindGroup - The bind group to which material resources are bound.
412
- * @param ctx - The current draw context.
413
- * @param pass - Index of the active render pass.
403
+ /**
404
+ * Applies runtime uniform values and textures to the given bind group.
405
+ *
406
+ * @remarks
407
+ * - Calls the base implementation first to bind standard mesh/PBR uniforms.
408
+ * - If fragment color is needed for the current context, all blueprint
409
+ * scalar/vector uniform values and textures are then bound by name.
410
+ *
411
+ * @param bindGroup - The bind group to which material resources are bound.
412
+ * @param ctx - The current draw context.
413
+ * @param pass - Index of the active render pass.
414
414
  */ applyUniformValues(bindGroup, ctx, pass) {
415
415
  super.applyUniformValues(bindGroup, ctx, pass);
416
416
  if (this.needFragmentColor(ctx)) {
@@ -436,60 +436,60 @@ const PBR_REFLECTION_MODE = {
436
436
  }
437
437
  }
438
438
  }
439
- /**
440
- * Creates a unique hash string used for program caching.
441
- *
442
- * @remarks
443
- * The hash includes:
444
- * - The base material hash (`super._createHash()`).
445
- * - The fragment IR hash.
446
- * - The vertex IR hash.
447
- *
448
- * Different blueprint graphs will therefore produce different programs.
449
- *
450
- * @returns A hash string that uniquely identifies this material configuration.
439
+ /**
440
+ * Creates a unique hash string used for program caching.
441
+ *
442
+ * @remarks
443
+ * The hash includes:
444
+ * - The base material hash (`super._createHash()`).
445
+ * - The fragment IR hash.
446
+ * - The vertex IR hash.
447
+ *
448
+ * Different blueprint graphs will therefore produce different programs.
449
+ *
450
+ * @returns A hash string that uniquely identifies this material configuration.
451
451
  */ _createHash() {
452
452
  return `${super._createHash()}:${this._irFrag.hash}:${this._irVertex.hash}`;
453
453
  }
454
- /**
455
- * Creates the GPU program for this blueprint PBR material.
456
- *
457
- * @remarks
458
- * This calls the base implementation and returns its result.
459
- * Commented-out `console.log` lines are provided for debugging the
460
- * generated vertex and fragment shader sources.
461
- *
462
- * @param ctx - The current draw context.
463
- * @param pass - Index of the active render pass.
464
- * @returns The created GPU program.
454
+ /**
455
+ * Creates the GPU program for this blueprint PBR material.
456
+ *
457
+ * @remarks
458
+ * This calls the base implementation and returns its result.
459
+ * Commented-out `console.log` lines are provided for debugging the
460
+ * generated vertex and fragment shader sources.
461
+ *
462
+ * @param ctx - The current draw context.
463
+ * @param pass - Index of the active render pass.
464
+ * @returns The created GPU program.
465
465
  */ createProgram(ctx, pass) {
466
466
  const program = super.createProgram(ctx, pass);
467
467
  //console.log(program.getShaderSource('vertex'));
468
468
  //console.log(program.getShaderSource('fragment'));
469
469
  return program;
470
470
  }
471
- /**
472
- * Disposes resources associated with this material.
473
- *
474
- * @remarks
475
- * - Calls the base `onDispose` to clean up inherited resources.
476
- * - Disposes all `finalTexture` references from the blueprint
477
- * texture uniform descriptors.
478
- *
479
- * This method is intended to be called by the engine's resource
480
- * management system rather than directly by user code.
471
+ /**
472
+ * Disposes resources associated with this material.
473
+ *
474
+ * @remarks
475
+ * - Calls the base `onDispose` to clean up inherited resources.
476
+ * - Disposes all `finalTexture` references from the blueprint
477
+ * texture uniform descriptors.
478
+ *
479
+ * This method is intended to be called by the engine's resource
480
+ * management system rather than directly by user code.
481
481
  */ onDispose() {
482
482
  super.onDispose();
483
483
  for (const u of this._uniformTextures){
484
484
  u.finalTexture.dispose();
485
485
  }
486
486
  }
487
- /**
488
- * Retrieves a named output expression from a blueprint output list.
489
- *
490
- * @param outputs - The list of outputs generated by a blueprint graph.
491
- * @param name - The desired output name (e.g. `"Position"`, `"Color"`, `"UV"`).
492
- * @returns The expression associated with the given name, or `undefined` if not found.
487
+ /**
488
+ * Retrieves a named output expression from a blueprint output list.
489
+ *
490
+ * @param outputs - The list of outputs generated by a blueprint graph.
491
+ * @param name - The desired output name (e.g. `"Position"`, `"Color"`, `"UV"`).
492
+ * @returns The expression associated with the given name, or `undefined` if not found.
493
493
  */ getOutput(outputs, name) {
494
494
  return outputs.find((output)=>output.name === name)?.exp;
495
495
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pbrblueprint.js","sources":["../../src/material/pbrblueprint.ts"],"sourcesContent":["import { MeshMaterial, applyMaterialMixins } from './meshmaterial';\nimport type { BindGroup, PBFunctionScope, PBInsideFunctionScope, PBShaderExp } from '@zephyr3d/device';\nimport { ShaderHelper } from './shader/helper';\nimport { MaterialVaryingFlags, RENDER_PASS_TYPE_LIGHT } from '../values';\nimport { DRef, Vector2, Vector3, Vector4, type Clonable, type Immutable } from '@zephyr3d/base';\nimport { mixinPBRBluePrint } from './mixins/lightmodel/pbrblueprintmixin';\nimport type { BluePrintUniformTexture, BluePrintUniformValue } from '../utility/blueprint/material/ir';\nimport { MaterialBlueprintIR } from '../utility/blueprint/material/ir';\nimport type { DrawContext } from '../render/drawable';\nimport { PBRBlockNode, VertexBlockNode } from '../utility/blueprint/material/pbr';\nimport type { PBRReflectionMode } from './mixins/lightmodel/pbrmetallicroughness';\n\nconst PBR_REFLECTION_MODE: Record<PBRReflectionMode, number> = {\n none: 0,\n ggx: 1,\n anisotropic: 2,\n glint: 3\n};\n\n/**\n * Physically-based rendering material driven by blueprint graphs.\n *\n * @remarks\n * This material extends {@link MeshMaterial} with PBR behavior via\n * {@link mixinPBRBluePrint}, and uses {@link MaterialBlueprintIR}\n * graphs for both vertex and fragment stages.\n *\n * - The **vertex blueprint IR** (`vertexIR`) controls vertex\n * transformations and per-vertex data.\n * - The **fragment blueprint IR** (`fragmentIR`) produces inputs\n * for the PBR shading model (albedo, roughness, metalness, etc.).\n *\n * Uniform values and textures for the blueprints are provided via\n * {@link PBRBluePrintMaterial.uniformValues} and\n * {@link PBRBluePrintMaterial.uniformTextures}.\n *\n * @public\n */\nexport class PBRBluePrintMaterial\n extends applyMaterialMixins(MeshMaterial, mixinPBRBluePrint)\n implements Clonable<PBRBluePrintMaterial>\n{\n /** @internal */\n private static readonly FEATURE_VERTEX_COLOR = this.defineFeature();\n /** @internal */\n private static readonly FEATURE_VERTEX_UV = this.defineFeature();\n /** @internal */\n private static readonly FEATURE_SUBSURFACE_SCATTERING = this.defineFeature();\n /** @internal */\n private _irFrag: MaterialBlueprintIR;\n /** @internal */\n private _irVertex: MaterialBlueprintIR;\n /** @internal */\n private _uniformValues: BluePrintUniformValue[];\n /** @internal */\n private _uniformTextures: BluePrintUniformTexture[];\n /** @internal */\n private _reflectionMode: PBRReflectionMode;\n /** @internal */\n private readonly _subsurfaceColor: Vector3;\n /** @internal */\n private _subsurfaceScale: number;\n /** @internal */\n private _subsurfacePower: number;\n /** @internal */\n private _subsurfaceIntensity: number;\n /** @internal */\n private _anisotropy: number;\n /** @internal */\n private _anisotropyDirection: number;\n /** @internal */\n private readonly _anisotropyDirectionScaleBias: Vector2;\n /**\n * Creates a new {@link PBRBluePrintMaterial} instance.\n *\n * @param irFrag - Optional fragment blueprint IR. If omitted, a default\n * IR containing a single {@link PBRBlockNode} is created.\n * @param irVertex - Optional vertex blueprint IR. If omitted, a default\n * IR containing a single {@link VertexBlockNode} is created.\n * @param uniformValues - Optional initial list of uniform value descriptors.\n * @param uniformTextures - Optional initial list of texture uniform descriptors.\n */\n constructor(\n irFrag?: MaterialBlueprintIR,\n irVertex?: MaterialBlueprintIR,\n uniformValues?: BluePrintUniformValue[],\n uniformTextures?: BluePrintUniformTexture[]\n ) {\n super();\n this._irFrag =\n irFrag ??\n new MaterialBlueprintIR(\n {\n nodeMap: { '1': new PBRBlockNode() },\n roots: [1],\n order: [1],\n graph: { incoming: {}, outgoing: {} }\n },\n '',\n {\n nodes: [{ id: 1, title: '', locked: true, node: { ClassName: 'PBRBlockNode', Object: '' } }],\n links: []\n }\n );\n this._irVertex =\n irVertex ??\n new MaterialBlueprintIR(\n {\n nodeMap: { '1': new VertexBlockNode() },\n roots: [1],\n order: [1],\n graph: { incoming: {}, outgoing: {} }\n },\n '',\n {\n nodes: [{ id: 1, title: '', locked: true, node: { ClassName: 'VertexBlockNode', Object: '' } }],\n links: []\n }\n );\n this._uniformValues = uniformValues ?? [];\n this._uniformTextures = uniformTextures ?? [];\n this._reflectionMode = 'ggx';\n this._subsurfaceColor = new Vector3(1, 0.3, 0.2);\n this._subsurfaceScale = 0.5;\n this._subsurfacePower = 1.5;\n this._subsurfaceIntensity = 0.5;\n this._anisotropy = 0.75;\n this._anisotropyDirection = 0;\n this._anisotropyDirectionScaleBias = new Vector2(1, 0);\n this.useFeature(PBRBluePrintMaterial.FEATURE_SUBSURFACE_SCATTERING, false);\n this.useFeature(PBRBluePrintMaterial.FEATURE_VERTEX_COLOR, this._irVertex.behaviors.useVertexColor);\n this.useFeature(PBRBluePrintMaterial.FEATURE_VERTEX_UV, this._irVertex.behaviors.useVertexUV);\n }\n get reflectionMode() {\n return this._reflectionMode;\n }\n set reflectionMode(val: PBRReflectionMode) {\n if (val !== this._reflectionMode) {\n this._reflectionMode = val;\n this.uniformChanged();\n }\n }\n get subsurfaceScattering() {\n return this.featureUsed<boolean>(PBRBluePrintMaterial.FEATURE_SUBSURFACE_SCATTERING);\n }\n set subsurfaceScattering(val: boolean) {\n this.useFeature(PBRBluePrintMaterial.FEATURE_SUBSURFACE_SCATTERING, !!val);\n }\n get subsurfaceColor(): Immutable<Vector3> {\n return this._subsurfaceColor;\n }\n set subsurfaceColor(val: Immutable<Vector3>) {\n if (!val.equalsTo(this._subsurfaceColor)) {\n this._subsurfaceColor.set(val);\n this.uniformChanged();\n }\n }\n get subsurfaceScale() {\n return this._subsurfaceScale;\n }\n set subsurfaceScale(val: number) {\n if (val !== this._subsurfaceScale) {\n this._subsurfaceScale = val;\n this.uniformChanged();\n }\n }\n get subsurfacePower() {\n return this._subsurfacePower;\n }\n set subsurfacePower(val: number) {\n if (val !== this._subsurfacePower) {\n this._subsurfacePower = val;\n this.uniformChanged();\n }\n }\n get subsurfaceIntensity() {\n return this._subsurfaceIntensity;\n }\n set subsurfaceIntensity(val: number) {\n if (val !== this._subsurfaceIntensity) {\n this._subsurfaceIntensity = val;\n this.uniformChanged();\n }\n }\n get anisotropy() {\n return this._anisotropy;\n }\n set anisotropy(val: number) {\n const clamped = Math.max(-0.95, Math.min(0.95, val));\n if (clamped !== this._anisotropy) {\n this._anisotropy = clamped;\n this.uniformChanged();\n }\n }\n get anisotropyDirection() {\n return this._anisotropyDirection;\n }\n set anisotropyDirection(val: number) {\n if (val !== this._anisotropyDirection) {\n this._anisotropyDirection = val;\n this.uniformChanged();\n }\n }\n get anisotropyDirectionScaleBias(): Immutable<Vector2> {\n return this._anisotropyDirectionScaleBias;\n }\n set anisotropyDirectionScaleBias(val: Immutable<Vector2>) {\n if (!val.equalsTo(this._anisotropyDirectionScaleBias)) {\n this._anisotropyDirectionScaleBias.set(val);\n this.uniformChanged();\n }\n }\n /**\n * Gets the fragment blueprint IR.\n */\n get fragmentIR() {\n return this._irFrag;\n }\n set fragmentIR(ir: MaterialBlueprintIR) {\n if (ir && ir !== this._irFrag) {\n this._irFrag = ir;\n this.clearCache();\n this.optionChanged(true);\n }\n }\n /**\n * Gets the vertex blueprint IR.\n */\n get vertexIR() {\n return this._irVertex;\n }\n set vertexIR(ir: MaterialBlueprintIR) {\n if (ir && ir !== this._irVertex) {\n this._irVertex = ir;\n this.useFeature(PBRBluePrintMaterial.FEATURE_VERTEX_COLOR, this._irVertex.behaviors.useVertexColor);\n this.useFeature(PBRBluePrintMaterial.FEATURE_VERTEX_UV, this._irVertex.behaviors.useVertexUV);\n this.clearCache();\n this.optionChanged(true);\n }\n }\n /**\n * Gets the list of uniform value descriptors used by the blueprints.\n */\n get uniformValues() {\n return this._uniformValues;\n }\n set uniformValues(val: BluePrintUniformValue[]) {\n this._uniformValues = (val ?? []).map((v) => ({ ...v }));\n this.uniformChanged();\n }\n /**\n * Gets the list of texture uniform descriptors used by the blueprints.\n */\n get uniformTextures() {\n return this._uniformTextures;\n }\n set uniformTextures(val: BluePrintUniformTexture[]) {\n if (val !== this._uniformTextures) {\n const newUniforms = val.map((v) => ({\n finalTexture: new DRef(v.finalTexture!.get()),\n finalSampler: v.finalSampler,\n name: v.name,\n params: v.params?.clone() ?? Vector4.zero(),\n texture: v.texture,\n type: v.type,\n sRGB: v.sRGB,\n wrapS: v.wrapS,\n wrapT: v.wrapT,\n inFragmentShader: v.inFragmentShader,\n inVertexShader: v.inVertexShader,\n minFilter: v.minFilter,\n magFilter: v.magFilter,\n mipFilter: v.mipFilter\n }));\n for (const u of this._uniformTextures) {\n u.finalTexture!.dispose();\n }\n this._uniformTextures = newUniforms;\n this.uniformChanged();\n }\n }\n /**\n * Creates a deep copy of this material.\n *\n * @remarks\n * The clone shares the same vertex/fragment IR references and copies\n * the current blueprint uniform descriptors, then calls `copyFrom`\n * to copy base-class and mixin state.\n *\n * @returns A new {@link PBRBluePrintMaterial} instance.\n */\n clone() {\n const other = new PBRBluePrintMaterial(\n this._irFrag,\n this._irVertex,\n this._uniformValues,\n this._uniformTextures\n );\n other.copyFrom(this);\n return other;\n }\n copyFrom(other: this) {\n super.copyFrom(other);\n this.reflectionMode = other.reflectionMode;\n this.subsurfaceScattering = other.subsurfaceScattering;\n this.subsurfaceColor = other.subsurfaceColor;\n this.subsurfaceScale = other.subsurfaceScale;\n this.subsurfacePower = other.subsurfacePower;\n this.subsurfaceIntensity = other.subsurfaceIntensity;\n this.anisotropy = other.anisotropy;\n this.anisotropyDirection = other.anisotropyDirection;\n this.anisotropyDirectionScaleBias = other.anisotropyDirectionScaleBias;\n }\n /**\n * Builds the vertex shader for this PBR blueprint material.\n *\n * @param scope - The current vertex shader function scope.\n */\n vertexShader(scope: PBFunctionScope) {\n super.vertexShader(scope);\n const pb = scope.$builder;\n scope.$inputs.zVertexPos = pb.vec3().attrib('position');\n scope.$inputs.zVertexNormal = pb.vec3().attrib('normal');\n scope.$inputs.zVertexTangent = pb.vec4().attrib('tangent');\n if (this.featureUsed(PBRBluePrintMaterial.FEATURE_VERTEX_COLOR)) {\n scope.$inputs.zVertexColor = pb.vec4().attrib('diffuse');\n }\n if (this.featureUsed(PBRBluePrintMaterial.FEATURE_VERTEX_UV)) {\n scope.$inputs.zVertexUV = pb.vec2().attrib('texCoord0');\n }\n\n for (const u of [...this._uniformValues, ...this._uniformTextures]) {\n if (u.inVertexShader) {\n // @ts-ignore\n pb.getGlobalScope()[u.name] = pb[u.type]().uniform(2);\n }\n }\n const outputs = this._irVertex.create(pb)!;\n scope.$l.oPos = this.getOutput(outputs, 'Position') ?? ShaderHelper.resolveVertexPosition(scope);\n const worldMatrix = ShaderHelper.getWorldMatrix(scope);\n scope.$outputs.worldPos = pb.mul(worldMatrix, pb.vec4(scope.oPos, 1)).xyz;\n scope.$l.csPos = pb.mul(ShaderHelper.getViewProjectionMatrix(scope), pb.vec4(scope.$outputs.worldPos, 1));\n ShaderHelper.setClipSpacePosition(scope, scope.csPos);\n scope.$outputs.zVertexColor =\n this.getOutput(outputs, 'Color') ??\n (this.featureUsed(PBRBluePrintMaterial.FEATURE_VERTEX_COLOR) ? scope.$inputs.zVertexColor : pb.vec4(1));\n scope.$outputs.zVertexUV =\n this.getOutput(outputs, 'UV') ??\n (this.featureUsed(PBRBluePrintMaterial.FEATURE_VERTEX_UV) ? scope.$inputs.zVertexUV : pb.vec2(0));\n scope.$l.oNorm = this.getOutput(outputs, 'Normal') ?? ShaderHelper.resolveVertexNormal(scope);\n scope.$outputs.zVertexNormal = pb.mul(ShaderHelper.getNormalMatrix(scope), pb.vec4(scope.oNorm, 0)).xyz;\n scope.$l.oTangent = this.getOutput(outputs, 'Tangent') ?? ShaderHelper.resolveVertexTangent(scope);\n scope.$outputs.zVertexTangent = pb.mul(\n ShaderHelper.getNormalMatrix(scope),\n pb.vec4(scope.oTangent.xyz, 0)\n ).xyz;\n scope.$outputs.zVertexBinormal = pb.mul(\n pb.cross(scope.$outputs.zVertexNormal, scope.$outputs.zVertexTangent),\n scope.oTangent.w\n );\n for (const outputName of ['Output1', 'Output2', 'Output3', 'Output4']) {\n const output = this.getOutput(outputs, outputName);\n if (output) {\n scope.$outputs[outputName] = output;\n }\n }\n }\n /**\n * Builds the fragment shader for this PBR blueprint material.\n *\n * @param scope - The current fragment shader function scope.\n */\n fragmentShader(scope: PBFunctionScope) {\n super.fragmentShader(scope);\n const pb = scope.$builder;\n if (\n this.subsurfaceScattering &&\n this.needFragmentColor() &&\n this.drawContext.renderPass!.type === RENDER_PASS_TYPE_LIGHT\n ) {\n scope.zSubsurfaceColor = pb.vec3().uniform(2);\n scope.zSubsurfaceScale = pb.float().uniform(2);\n scope.zSubsurfacePower = pb.float().uniform(2);\n scope.zSubsurfaceIntensity = pb.float().uniform(2);\n }\n if (this.needFragmentColor()) {\n scope.zAnisotropy = pb.float().uniform(2);\n scope.zAnisotropyDirection = pb.float().uniform(2);\n scope.zAnisotropyDirectionScaleBias = pb.vec2().uniform(2);\n for (const u of [...this._uniformValues, ...this._uniformTextures]) {\n if (u.inFragmentShader) {\n // @ts-ignore\n pb.getGlobalScope()[u.name] = pb[u.type]().uniform(2);\n }\n }\n scope.$l.viewVec = this.calculateViewVector(scope, scope.$inputs.worldPos);\n scope.$l.commonData = this.getCommonDatasStruct(scope)();\n this.getCommonData(\n scope,\n scope.commonData,\n scope.viewVec,\n scope.$inputs.worldPos,\n scope.$inputs.zVertexNormal,\n scope.$inputs.zVertexTangent,\n scope.$inputs.zVertexBinormal,\n scope.$inputs.zVertexColor,\n scope.$inputs.zVertexUV,\n this._irFrag\n );\n if (this.drawContext.renderPass!.type === RENDER_PASS_TYPE_LIGHT) {\n if (this.drawContext.materialFlags & MaterialVaryingFlags.SSR_STORE_ROUGHNESS) {\n scope.$l.outRoughness = pb.vec4();\n scope.$l.litColor = this.PBRLight(\n scope,\n scope.$inputs.worldPos,\n scope.viewVec,\n scope.commonData,\n scope.outRoughness\n );\n if (this.subsurfaceScattering) {\n scope.litColor = this.applySubsurfaceScattering(\n scope,\n scope.litColor,\n scope.commonData.albedo.rgb,\n scope.commonData.normal,\n scope.viewVec\n );\n }\n this.outputFragmentColor(\n scope,\n scope.$inputs.worldPos,\n scope.litColor,\n scope.outRoughness,\n pb.vec4(pb.add(pb.mul(scope.commonData.normal, 0.5), pb.vec3(0.5)), 1)\n );\n } else {\n scope.$l.litColor = this.PBRLight(scope, scope.$inputs.worldPos, scope.viewVec, scope.commonData);\n if (this.subsurfaceScattering) {\n scope.litColor = this.applySubsurfaceScattering(\n scope,\n scope.litColor,\n scope.commonData.albedo.rgb,\n scope.commonData.normal,\n scope.viewVec\n );\n }\n this.outputFragmentColor(scope, scope.$inputs.worldPos, scope.litColor);\n }\n } else {\n this.outputFragmentColor(scope, scope.$inputs.worldPos, scope.commonData.albedo);\n }\n } else {\n this.outputFragmentColor(scope, scope.$inputs.worldPos, null);\n }\n }\n /**\n * Applies runtime uniform values and textures to the given bind group.\n *\n * @remarks\n * - Calls the base implementation first to bind standard mesh/PBR uniforms.\n * - If fragment color is needed for the current context, all blueprint\n * scalar/vector uniform values and textures are then bound by name.\n *\n * @param bindGroup - The bind group to which material resources are bound.\n * @param ctx - The current draw context.\n * @param pass - Index of the active render pass.\n */\n applyUniformValues(bindGroup: BindGroup, ctx: DrawContext, pass: number) {\n super.applyUniformValues(bindGroup, ctx, pass);\n if (this.needFragmentColor(ctx)) {\n bindGroup.setValue('zReflectionMode', PBR_REFLECTION_MODE[this._reflectionMode]);\n bindGroup.setValue('zAnisotropy', this._anisotropy);\n bindGroup.setValue('zAnisotropyDirection', this._anisotropyDirection);\n bindGroup.setValue('zAnisotropyDirectionScaleBias', this._anisotropyDirectionScaleBias);\n if (this.subsurfaceScattering && ctx.renderPass!.type === RENDER_PASS_TYPE_LIGHT) {\n bindGroup.setValue('zSubsurfaceColor', this._subsurfaceColor);\n bindGroup.setValue('zSubsurfaceScale', this._subsurfaceScale);\n bindGroup.setValue('zSubsurfacePower', this._subsurfacePower);\n bindGroup.setValue('zSubsurfaceIntensity', this._subsurfaceIntensity);\n }\n }\n for (const u of this._uniformValues) {\n if (u.inVertexShader || this.needFragmentColor(ctx)) {\n bindGroup.setValue(u.name, u.finalValue!);\n }\n }\n for (const u of this._uniformTextures) {\n if (u.inVertexShader || this.needFragmentColor(ctx)) {\n bindGroup.setTexture(u.name, u.finalTexture!.get()!, u.finalSampler);\n }\n }\n }\n /**\n * Creates a unique hash string used for program caching.\n *\n * @remarks\n * The hash includes:\n * - The base material hash (`super._createHash()`).\n * - The fragment IR hash.\n * - The vertex IR hash.\n *\n * Different blueprint graphs will therefore produce different programs.\n *\n * @returns A hash string that uniquely identifies this material configuration.\n */\n protected _createHash() {\n return `${super._createHash()}:${this._irFrag.hash}:${this._irVertex.hash}`;\n }\n /**\n * Creates the GPU program for this blueprint PBR material.\n *\n * @remarks\n * This calls the base implementation and returns its result.\n * Commented-out `console.log` lines are provided for debugging the\n * generated vertex and fragment shader sources.\n *\n * @param ctx - The current draw context.\n * @param pass - Index of the active render pass.\n * @returns The created GPU program.\n */\n protected createProgram(ctx: DrawContext, pass: number) {\n const program = super.createProgram(ctx, pass);\n //console.log(program.getShaderSource('vertex'));\n //console.log(program.getShaderSource('fragment'));\n return program;\n }\n /**\n * Disposes resources associated with this material.\n *\n * @remarks\n * - Calls the base `onDispose` to clean up inherited resources.\n * - Disposes all `finalTexture` references from the blueprint\n * texture uniform descriptors.\n *\n * This method is intended to be called by the engine's resource\n * management system rather than directly by user code.\n */\n protected onDispose() {\n super.onDispose();\n for (const u of this._uniformTextures) {\n u.finalTexture!.dispose();\n }\n }\n /**\n * Retrieves a named output expression from a blueprint output list.\n *\n * @param outputs - The list of outputs generated by a blueprint graph.\n * @param name - The desired output name (e.g. `\"Position\"`, `\"Color\"`, `\"UV\"`).\n * @returns The expression associated with the given name, or `undefined` if not found.\n */\n private getOutput(\n outputs: {\n name: string;\n exp: number | boolean | PBShaderExp;\n }[],\n name: string\n ) {\n return outputs.find((output) => output.name === name)?.exp;\n }\n private applySubsurfaceScattering(\n scope: PBInsideFunctionScope,\n litColor: PBShaderExp,\n albedoRGB: PBShaderExp,\n normal: PBShaderExp,\n viewVec: PBShaderExp\n ) {\n const pb = scope.$builder;\n scope.$l.NoV = pb.clamp(pb.dot(normal, viewVec), 0, 1);\n scope.$l.wrapNdotV = pb.clamp(\n pb.div(pb.add(pb.sub(1, scope.NoV), scope.zSubsurfaceScale), pb.add(1, scope.zSubsurfaceScale)),\n 0,\n 1\n );\n scope.$l.sssFactor = pb.mul(pb.pow(scope.wrapNdotV, scope.zSubsurfacePower), scope.zSubsurfaceIntensity);\n return pb.vec4(\n pb.add(litColor.rgb, pb.mul(albedoRGB, scope.zSubsurfaceColor, scope.sssFactor)),\n litColor.a\n );\n }\n}\n"],"names":["PBR_REFLECTION_MODE","none","ggx","anisotropic","glint","PBRBluePrintMaterial","applyMaterialMixins","MeshMaterial","mixinPBRBluePrint","FEATURE_VERTEX_COLOR","defineFeature","FEATURE_VERTEX_UV","FEATURE_SUBSURFACE_SCATTERING","irFrag","irVertex","uniformValues","uniformTextures","_irFrag","MaterialBlueprintIR","nodeMap","PBRBlockNode","roots","order","graph","incoming","outgoing","nodes","id","title","locked","node","ClassName","Object","links","_irVertex","VertexBlockNode","_uniformValues","_uniformTextures","_reflectionMode","_subsurfaceColor","Vector3","_subsurfaceScale","_subsurfacePower","_subsurfaceIntensity","_anisotropy","_anisotropyDirection","_anisotropyDirectionScaleBias","Vector2","useFeature","behaviors","useVertexColor","useVertexUV","reflectionMode","val","uniformChanged","subsurfaceScattering","featureUsed","subsurfaceColor","equalsTo","set","subsurfaceScale","subsurfacePower","subsurfaceIntensity","anisotropy","clamped","Math","max","min","anisotropyDirection","anisotropyDirectionScaleBias","fragmentIR","ir","clearCache","optionChanged","vertexIR","map","v","newUniforms","finalTexture","DRef","get","finalSampler","name","params","clone","Vector4","zero","texture","type","sRGB","wrapS","wrapT","inFragmentShader","inVertexShader","minFilter","magFilter","mipFilter","u","dispose","other","copyFrom","vertexShader","scope","pb","$builder","$inputs","zVertexPos","vec3","attrib","zVertexNormal","zVertexTangent","vec4","zVertexColor","zVertexUV","vec2","getGlobalScope","uniform","outputs","create","$l","oPos","getOutput","ShaderHelper","resolveVertexPosition","worldMatrix","getWorldMatrix","$outputs","worldPos","mul","xyz","csPos","getViewProjectionMatrix","setClipSpacePosition","oNorm","resolveVertexNormal","getNormalMatrix","oTangent","resolveVertexTangent","zVertexBinormal","cross","w","outputName","output","fragmentShader","needFragmentColor","drawContext","renderPass","RENDER_PASS_TYPE_LIGHT","zSubsurfaceColor","zSubsurfaceScale","float","zSubsurfacePower","zSubsurfaceIntensity","zAnisotropy","zAnisotropyDirection","zAnisotropyDirectionScaleBias","viewVec","calculateViewVector","commonData","getCommonDatasStruct","getCommonData","materialFlags","MaterialVaryingFlags","SSR_STORE_ROUGHNESS","outRoughness","litColor","PBRLight","applySubsurfaceScattering","albedo","rgb","normal","outputFragmentColor","add","applyUniformValues","bindGroup","ctx","pass","setValue","finalValue","setTexture","_createHash","hash","createProgram","program","onDispose","find","exp","albedoRGB","NoV","clamp","dot","wrapNdotV","div","sub","sssFactor","pow","a"],"mappings":";;;;;;;;AAYA,MAAMA,mBAAyD,GAAA;IAC7DC,IAAM,EAAA,CAAA;IACNC,GAAK,EAAA,CAAA;IACLC,WAAa,EAAA,CAAA;IACbC,KAAO,EAAA;AACT,CAAA;AAEA;;;;;;;;;;;;;;;;;;AAkBC,IACM,MAAMC,oBACHC,SAAAA,mBAAAA,CAAoBC,YAAcC,EAAAA,iBAAAA,CAAAA,CAAAA;AAG1C,qBACA,OAAwBC,oBAAAA,GAAuB,IAAI,CAACC,aAAa,EAAG;AACpE,qBACA,OAAwBC,iBAAAA,GAAoB,IAAI,CAACD,aAAa,EAAG;AACjE,qBACA,OAAwBE,6BAAAA,GAAgC,IAAI,CAACF,aAAa,EAAG;qBAE7E,OAAqC;qBAErC,SAAuC;qBAEvC,cAAgD;qBAEhD,gBAAoD;qBAEpD,eAA2C;qBAE3C,gBAA2C;qBAE3C,gBAAiC;qBAEjC,gBAAiC;qBAEjC,oBAAqC;qBAErC,WAA4B;qBAE5B,oBAAqC;qBAErC,6BAAwD;AACxD;;;;;;;;;MAUA,WAAA,CACEG,MAA4B,EAC5BC,QAA8B,EAC9BC,aAAuC,EACvCC,eAA2C,CAC3C;QACA,KAAK,EAAA;AACL,QAAA,IAAI,CAACC,OAAO,GACVJ,MAAAA,IACA,IAAIK,mBACF,CAAA;YACEC,OAAS,EAAA;AAAE,gBAAA,GAAA,EAAK,IAAIC,YAAAA;AAAe,aAA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,CAAAA,gBAAgB,IAC7F,CACA,EAAA,CAAA,CAAA;AAEF/C,QAAAA,KAAAA,CAAMiB,EAAE,CAAC2E,SAAS,GAAG3F,EAAAA,CAAGyB,GAAG,CAACzB,EAAAA,CAAG4F,GAAG,CAAC7F,MAAMyF,SAAS,EAAEzF,MAAMiD,gBAAgB,CAAA,EAAGjD,MAAMkD,oBAAoB,CAAA;QACvG,OAAOjD,EAAAA,CAAGQ,IAAI,CACZR,EAAAA,CAAGqE,GAAG,CAACP,QAAAA,CAASI,GAAG,EAAElE,EAAAA,CAAGyB,GAAG,CAAC2D,SAAAA,EAAWrF,MAAM8C,gBAAgB,EAAE9C,MAAM4F,SAAS,CAAA,CAAA,EAC9E7B,SAAS+B,CAAC,CAAA;AAEd;AACF;;;;"}
1
+ {"version":3,"file":"pbrblueprint.js","sources":["../../src/material/pbrblueprint.ts"],"sourcesContent":["import { MeshMaterial, applyMaterialMixins } from './meshmaterial';\r\nimport type { BindGroup, PBFunctionScope, PBInsideFunctionScope, PBShaderExp } from '@zephyr3d/device';\r\nimport { ShaderHelper } from './shader/helper';\r\nimport { MaterialVaryingFlags, RENDER_PASS_TYPE_LIGHT } from '../values';\r\nimport { DRef, Vector2, Vector3, Vector4, type Clonable, type Immutable } from '@zephyr3d/base';\r\nimport { mixinPBRBluePrint } from './mixins/lightmodel/pbrblueprintmixin';\r\nimport type { BluePrintUniformTexture, BluePrintUniformValue } from '../utility/blueprint/material/ir';\r\nimport { MaterialBlueprintIR } from '../utility/blueprint/material/ir';\r\nimport type { DrawContext } from '../render/drawable';\r\nimport { PBRBlockNode, VertexBlockNode } from '../utility/blueprint/material/pbr';\r\nimport type { PBRReflectionMode } from './mixins/lightmodel/pbrmetallicroughness';\r\n\r\nconst PBR_REFLECTION_MODE: Record<PBRReflectionMode, number> = {\r\n none: 0,\r\n ggx: 1,\r\n anisotropic: 2,\r\n glint: 3\r\n};\r\n\r\n/**\r\n * Physically-based rendering material driven by blueprint graphs.\r\n *\r\n * @remarks\r\n * This material extends {@link MeshMaterial} with PBR behavior via\r\n * {@link mixinPBRBluePrint}, and uses {@link MaterialBlueprintIR}\r\n * graphs for both vertex and fragment stages.\r\n *\r\n * - The **vertex blueprint IR** (`vertexIR`) controls vertex\r\n * transformations and per-vertex data.\r\n * - The **fragment blueprint IR** (`fragmentIR`) produces inputs\r\n * for the PBR shading model (albedo, roughness, metalness, etc.).\r\n *\r\n * Uniform values and textures for the blueprints are provided via\r\n * {@link PBRBluePrintMaterial.uniformValues} and\r\n * {@link PBRBluePrintMaterial.uniformTextures}.\r\n *\r\n * @public\r\n */\r\nexport class PBRBluePrintMaterial\r\n extends applyMaterialMixins(MeshMaterial, mixinPBRBluePrint)\r\n implements Clonable<PBRBluePrintMaterial>\r\n{\r\n /** @internal */\r\n private static readonly FEATURE_VERTEX_COLOR = this.defineFeature();\r\n /** @internal */\r\n private static readonly FEATURE_VERTEX_UV = this.defineFeature();\r\n /** @internal */\r\n private static readonly FEATURE_SUBSURFACE_SCATTERING = this.defineFeature();\r\n /** @internal */\r\n private _irFrag: MaterialBlueprintIR;\r\n /** @internal */\r\n private _irVertex: MaterialBlueprintIR;\r\n /** @internal */\r\n private _uniformValues: BluePrintUniformValue[];\r\n /** @internal */\r\n private _uniformTextures: BluePrintUniformTexture[];\r\n /** @internal */\r\n private _reflectionMode: PBRReflectionMode;\r\n /** @internal */\r\n private readonly _subsurfaceColor: Vector3;\r\n /** @internal */\r\n private _subsurfaceScale: number;\r\n /** @internal */\r\n private _subsurfacePower: number;\r\n /** @internal */\r\n private _subsurfaceIntensity: number;\r\n /** @internal */\r\n private _anisotropy: number;\r\n /** @internal */\r\n private _anisotropyDirection: number;\r\n /** @internal */\r\n private readonly _anisotropyDirectionScaleBias: Vector2;\r\n /**\r\n * Creates a new {@link PBRBluePrintMaterial} instance.\r\n *\r\n * @param irFrag - Optional fragment blueprint IR. If omitted, a default\r\n * IR containing a single {@link PBRBlockNode} is created.\r\n * @param irVertex - Optional vertex blueprint IR. If omitted, a default\r\n * IR containing a single {@link VertexBlockNode} is created.\r\n * @param uniformValues - Optional initial list of uniform value descriptors.\r\n * @param uniformTextures - Optional initial list of texture uniform descriptors.\r\n */\r\n constructor(\r\n irFrag?: MaterialBlueprintIR,\r\n irVertex?: MaterialBlueprintIR,\r\n uniformValues?: BluePrintUniformValue[],\r\n uniformTextures?: BluePrintUniformTexture[]\r\n ) {\r\n super();\r\n this._irFrag =\r\n irFrag ??\r\n new MaterialBlueprintIR(\r\n {\r\n nodeMap: { '1': new PBRBlockNode() },\r\n roots: [1],\r\n order: [1],\r\n graph: { incoming: {}, outgoing: {} }\r\n },\r\n '',\r\n {\r\n nodes: [{ id: 1, title: '', locked: true, node: { ClassName: 'PBRBlockNode', Object: '' } }],\r\n links: []\r\n }\r\n );\r\n this._irVertex =\r\n irVertex ??\r\n new MaterialBlueprintIR(\r\n {\r\n nodeMap: { '1': new VertexBlockNode() },\r\n roots: [1],\r\n order: [1],\r\n graph: { incoming: {}, outgoing: {} }\r\n },\r\n '',\r\n {\r\n nodes: [{ id: 1, title: '', locked: true, node: { ClassName: 'VertexBlockNode', Object: '' } }],\r\n links: []\r\n }\r\n );\r\n this._uniformValues = uniformValues ?? [];\r\n this._uniformTextures = uniformTextures ?? [];\r\n this._reflectionMode = 'ggx';\r\n this._subsurfaceColor = new Vector3(1, 0.3, 0.2);\r\n this._subsurfaceScale = 0.5;\r\n this._subsurfacePower = 1.5;\r\n this._subsurfaceIntensity = 0.5;\r\n this._anisotropy = 0.75;\r\n this._anisotropyDirection = 0;\r\n this._anisotropyDirectionScaleBias = new Vector2(1, 0);\r\n this.useFeature(PBRBluePrintMaterial.FEATURE_SUBSURFACE_SCATTERING, false);\r\n this.useFeature(PBRBluePrintMaterial.FEATURE_VERTEX_COLOR, this._irVertex.behaviors.useVertexColor);\r\n this.useFeature(PBRBluePrintMaterial.FEATURE_VERTEX_UV, this._irVertex.behaviors.useVertexUV);\r\n }\r\n get reflectionMode() {\r\n return this._reflectionMode;\r\n }\r\n set reflectionMode(val: PBRReflectionMode) {\r\n if (val !== this._reflectionMode) {\r\n this._reflectionMode = val;\r\n this.uniformChanged();\r\n }\r\n }\r\n get subsurfaceScattering() {\r\n return this.featureUsed<boolean>(PBRBluePrintMaterial.FEATURE_SUBSURFACE_SCATTERING);\r\n }\r\n set subsurfaceScattering(val: boolean) {\r\n this.useFeature(PBRBluePrintMaterial.FEATURE_SUBSURFACE_SCATTERING, !!val);\r\n }\r\n get subsurfaceColor(): Immutable<Vector3> {\r\n return this._subsurfaceColor;\r\n }\r\n set subsurfaceColor(val: Immutable<Vector3>) {\r\n if (!val.equalsTo(this._subsurfaceColor)) {\r\n this._subsurfaceColor.set(val);\r\n this.uniformChanged();\r\n }\r\n }\r\n get subsurfaceScale() {\r\n return this._subsurfaceScale;\r\n }\r\n set subsurfaceScale(val: number) {\r\n if (val !== this._subsurfaceScale) {\r\n this._subsurfaceScale = val;\r\n this.uniformChanged();\r\n }\r\n }\r\n get subsurfacePower() {\r\n return this._subsurfacePower;\r\n }\r\n set subsurfacePower(val: number) {\r\n if (val !== this._subsurfacePower) {\r\n this._subsurfacePower = val;\r\n this.uniformChanged();\r\n }\r\n }\r\n get subsurfaceIntensity() {\r\n return this._subsurfaceIntensity;\r\n }\r\n set subsurfaceIntensity(val: number) {\r\n if (val !== this._subsurfaceIntensity) {\r\n this._subsurfaceIntensity = val;\r\n this.uniformChanged();\r\n }\r\n }\r\n get anisotropy() {\r\n return this._anisotropy;\r\n }\r\n set anisotropy(val: number) {\r\n const clamped = Math.max(-0.95, Math.min(0.95, val));\r\n if (clamped !== this._anisotropy) {\r\n this._anisotropy = clamped;\r\n this.uniformChanged();\r\n }\r\n }\r\n get anisotropyDirection() {\r\n return this._anisotropyDirection;\r\n }\r\n set anisotropyDirection(val: number) {\r\n if (val !== this._anisotropyDirection) {\r\n this._anisotropyDirection = val;\r\n this.uniformChanged();\r\n }\r\n }\r\n get anisotropyDirectionScaleBias(): Immutable<Vector2> {\r\n return this._anisotropyDirectionScaleBias;\r\n }\r\n set anisotropyDirectionScaleBias(val: Immutable<Vector2>) {\r\n if (!val.equalsTo(this._anisotropyDirectionScaleBias)) {\r\n this._anisotropyDirectionScaleBias.set(val);\r\n this.uniformChanged();\r\n }\r\n }\r\n /**\r\n * Gets the fragment blueprint IR.\r\n */\r\n get fragmentIR() {\r\n return this._irFrag;\r\n }\r\n set fragmentIR(ir: MaterialBlueprintIR) {\r\n if (ir && ir !== this._irFrag) {\r\n this._irFrag = ir;\r\n this.clearCache();\r\n this.optionChanged(true);\r\n }\r\n }\r\n /**\r\n * Gets the vertex blueprint IR.\r\n */\r\n get vertexIR() {\r\n return this._irVertex;\r\n }\r\n set vertexIR(ir: MaterialBlueprintIR) {\r\n if (ir && ir !== this._irVertex) {\r\n this._irVertex = ir;\r\n this.useFeature(PBRBluePrintMaterial.FEATURE_VERTEX_COLOR, this._irVertex.behaviors.useVertexColor);\r\n this.useFeature(PBRBluePrintMaterial.FEATURE_VERTEX_UV, this._irVertex.behaviors.useVertexUV);\r\n this.clearCache();\r\n this.optionChanged(true);\r\n }\r\n }\r\n /**\r\n * Gets the list of uniform value descriptors used by the blueprints.\r\n */\r\n get uniformValues() {\r\n return this._uniformValues;\r\n }\r\n set uniformValues(val: BluePrintUniformValue[]) {\r\n this._uniformValues = (val ?? []).map((v) => ({ ...v }));\r\n this.uniformChanged();\r\n }\r\n /**\r\n * Gets the list of texture uniform descriptors used by the blueprints.\r\n */\r\n get uniformTextures() {\r\n return this._uniformTextures;\r\n }\r\n set uniformTextures(val: BluePrintUniformTexture[]) {\r\n if (val !== this._uniformTextures) {\r\n const newUniforms = val.map((v) => ({\r\n finalTexture: new DRef(v.finalTexture!.get()),\r\n finalSampler: v.finalSampler,\r\n name: v.name,\r\n params: v.params?.clone() ?? Vector4.zero(),\r\n texture: v.texture,\r\n type: v.type,\r\n sRGB: v.sRGB,\r\n wrapS: v.wrapS,\r\n wrapT: v.wrapT,\r\n inFragmentShader: v.inFragmentShader,\r\n inVertexShader: v.inVertexShader,\r\n minFilter: v.minFilter,\r\n magFilter: v.magFilter,\r\n mipFilter: v.mipFilter\r\n }));\r\n for (const u of this._uniformTextures) {\r\n u.finalTexture!.dispose();\r\n }\r\n this._uniformTextures = newUniforms;\r\n this.uniformChanged();\r\n }\r\n }\r\n /**\r\n * Creates a deep copy of this material.\r\n *\r\n * @remarks\r\n * The clone shares the same vertex/fragment IR references and copies\r\n * the current blueprint uniform descriptors, then calls `copyFrom`\r\n * to copy base-class and mixin state.\r\n *\r\n * @returns A new {@link PBRBluePrintMaterial} instance.\r\n */\r\n clone() {\r\n const other = new PBRBluePrintMaterial(\r\n this._irFrag,\r\n this._irVertex,\r\n this._uniformValues,\r\n this._uniformTextures\r\n );\r\n other.copyFrom(this);\r\n return other;\r\n }\r\n copyFrom(other: this) {\r\n super.copyFrom(other);\r\n this.reflectionMode = other.reflectionMode;\r\n this.subsurfaceScattering = other.subsurfaceScattering;\r\n this.subsurfaceColor = other.subsurfaceColor;\r\n this.subsurfaceScale = other.subsurfaceScale;\r\n this.subsurfacePower = other.subsurfacePower;\r\n this.subsurfaceIntensity = other.subsurfaceIntensity;\r\n this.anisotropy = other.anisotropy;\r\n this.anisotropyDirection = other.anisotropyDirection;\r\n this.anisotropyDirectionScaleBias = other.anisotropyDirectionScaleBias;\r\n }\r\n /**\r\n * Builds the vertex shader for this PBR blueprint material.\r\n *\r\n * @param scope - The current vertex shader function scope.\r\n */\r\n vertexShader(scope: PBFunctionScope) {\r\n super.vertexShader(scope);\r\n const pb = scope.$builder;\r\n scope.$inputs.zVertexPos = pb.vec3().attrib('position');\r\n scope.$inputs.zVertexNormal = pb.vec3().attrib('normal');\r\n scope.$inputs.zVertexTangent = pb.vec4().attrib('tangent');\r\n if (this.featureUsed(PBRBluePrintMaterial.FEATURE_VERTEX_COLOR)) {\r\n scope.$inputs.zVertexColor = pb.vec4().attrib('diffuse');\r\n }\r\n if (this.featureUsed(PBRBluePrintMaterial.FEATURE_VERTEX_UV)) {\r\n scope.$inputs.zVertexUV = pb.vec2().attrib('texCoord0');\r\n }\r\n\r\n for (const u of [...this._uniformValues, ...this._uniformTextures]) {\r\n if (u.inVertexShader) {\r\n // @ts-ignore\r\n pb.getGlobalScope()[u.name] = pb[u.type]().uniform(2);\r\n }\r\n }\r\n const outputs = this._irVertex.create(pb)!;\r\n scope.$l.oPos = this.getOutput(outputs, 'Position') ?? ShaderHelper.resolveVertexPosition(scope);\r\n const worldMatrix = ShaderHelper.getWorldMatrix(scope);\r\n scope.$outputs.worldPos = pb.mul(worldMatrix, pb.vec4(scope.oPos, 1)).xyz;\r\n scope.$l.csPos = pb.mul(ShaderHelper.getViewProjectionMatrix(scope), pb.vec4(scope.$outputs.worldPos, 1));\r\n ShaderHelper.setClipSpacePosition(scope, scope.csPos);\r\n scope.$outputs.zVertexColor =\r\n this.getOutput(outputs, 'Color') ??\r\n (this.featureUsed(PBRBluePrintMaterial.FEATURE_VERTEX_COLOR) ? scope.$inputs.zVertexColor : pb.vec4(1));\r\n scope.$outputs.zVertexUV =\r\n this.getOutput(outputs, 'UV') ??\r\n (this.featureUsed(PBRBluePrintMaterial.FEATURE_VERTEX_UV) ? scope.$inputs.zVertexUV : pb.vec2(0));\r\n scope.$l.oNorm = this.getOutput(outputs, 'Normal') ?? ShaderHelper.resolveVertexNormal(scope);\r\n scope.$outputs.zVertexNormal = pb.mul(ShaderHelper.getNormalMatrix(scope), pb.vec4(scope.oNorm, 0)).xyz;\r\n scope.$l.oTangent = this.getOutput(outputs, 'Tangent') ?? ShaderHelper.resolveVertexTangent(scope);\r\n scope.$outputs.zVertexTangent = pb.mul(\r\n ShaderHelper.getNormalMatrix(scope),\r\n pb.vec4(scope.oTangent.xyz, 0)\r\n ).xyz;\r\n scope.$outputs.zVertexBinormal = pb.mul(\r\n pb.cross(scope.$outputs.zVertexNormal, scope.$outputs.zVertexTangent),\r\n scope.oTangent.w\r\n );\r\n for (const outputName of ['Output1', 'Output2', 'Output3', 'Output4']) {\r\n const output = this.getOutput(outputs, outputName);\r\n if (output) {\r\n scope.$outputs[outputName] = output;\r\n }\r\n }\r\n }\r\n /**\r\n * Builds the fragment shader for this PBR blueprint material.\r\n *\r\n * @param scope - The current fragment shader function scope.\r\n */\r\n fragmentShader(scope: PBFunctionScope) {\r\n super.fragmentShader(scope);\r\n const pb = scope.$builder;\r\n if (\r\n this.subsurfaceScattering &&\r\n this.needFragmentColor() &&\r\n this.drawContext.renderPass!.type === RENDER_PASS_TYPE_LIGHT\r\n ) {\r\n scope.zSubsurfaceColor = pb.vec3().uniform(2);\r\n scope.zSubsurfaceScale = pb.float().uniform(2);\r\n scope.zSubsurfacePower = pb.float().uniform(2);\r\n scope.zSubsurfaceIntensity = pb.float().uniform(2);\r\n }\r\n if (this.needFragmentColor()) {\r\n scope.zAnisotropy = pb.float().uniform(2);\r\n scope.zAnisotropyDirection = pb.float().uniform(2);\r\n scope.zAnisotropyDirectionScaleBias = pb.vec2().uniform(2);\r\n for (const u of [...this._uniformValues, ...this._uniformTextures]) {\r\n if (u.inFragmentShader) {\r\n // @ts-ignore\r\n pb.getGlobalScope()[u.name] = pb[u.type]().uniform(2);\r\n }\r\n }\r\n scope.$l.viewVec = this.calculateViewVector(scope, scope.$inputs.worldPos);\r\n scope.$l.commonData = this.getCommonDatasStruct(scope)();\r\n this.getCommonData(\r\n scope,\r\n scope.commonData,\r\n scope.viewVec,\r\n scope.$inputs.worldPos,\r\n scope.$inputs.zVertexNormal,\r\n scope.$inputs.zVertexTangent,\r\n scope.$inputs.zVertexBinormal,\r\n scope.$inputs.zVertexColor,\r\n scope.$inputs.zVertexUV,\r\n this._irFrag\r\n );\r\n if (this.drawContext.renderPass!.type === RENDER_PASS_TYPE_LIGHT) {\r\n if (this.drawContext.materialFlags & MaterialVaryingFlags.SSR_STORE_ROUGHNESS) {\r\n scope.$l.outRoughness = pb.vec4();\r\n scope.$l.litColor = this.PBRLight(\r\n scope,\r\n scope.$inputs.worldPos,\r\n scope.viewVec,\r\n scope.commonData,\r\n scope.outRoughness\r\n );\r\n if (this.subsurfaceScattering) {\r\n scope.litColor = this.applySubsurfaceScattering(\r\n scope,\r\n scope.litColor,\r\n scope.commonData.albedo.rgb,\r\n scope.commonData.normal,\r\n scope.viewVec\r\n );\r\n }\r\n this.outputFragmentColor(\r\n scope,\r\n scope.$inputs.worldPos,\r\n scope.litColor,\r\n scope.outRoughness,\r\n pb.vec4(pb.add(pb.mul(scope.commonData.normal, 0.5), pb.vec3(0.5)), 1)\r\n );\r\n } else {\r\n scope.$l.litColor = this.PBRLight(scope, scope.$inputs.worldPos, scope.viewVec, scope.commonData);\r\n if (this.subsurfaceScattering) {\r\n scope.litColor = this.applySubsurfaceScattering(\r\n scope,\r\n scope.litColor,\r\n scope.commonData.albedo.rgb,\r\n scope.commonData.normal,\r\n scope.viewVec\r\n );\r\n }\r\n this.outputFragmentColor(scope, scope.$inputs.worldPos, scope.litColor);\r\n }\r\n } else {\r\n this.outputFragmentColor(scope, scope.$inputs.worldPos, scope.commonData.albedo);\r\n }\r\n } else {\r\n this.outputFragmentColor(scope, scope.$inputs.worldPos, null);\r\n }\r\n }\r\n /**\r\n * Applies runtime uniform values and textures to the given bind group.\r\n *\r\n * @remarks\r\n * - Calls the base implementation first to bind standard mesh/PBR uniforms.\r\n * - If fragment color is needed for the current context, all blueprint\r\n * scalar/vector uniform values and textures are then bound by name.\r\n *\r\n * @param bindGroup - The bind group to which material resources are bound.\r\n * @param ctx - The current draw context.\r\n * @param pass - Index of the active render pass.\r\n */\r\n applyUniformValues(bindGroup: BindGroup, ctx: DrawContext, pass: number) {\r\n super.applyUniformValues(bindGroup, ctx, pass);\r\n if (this.needFragmentColor(ctx)) {\r\n bindGroup.setValue('zReflectionMode', PBR_REFLECTION_MODE[this._reflectionMode]);\r\n bindGroup.setValue('zAnisotropy', this._anisotropy);\r\n bindGroup.setValue('zAnisotropyDirection', this._anisotropyDirection);\r\n bindGroup.setValue('zAnisotropyDirectionScaleBias', this._anisotropyDirectionScaleBias);\r\n if (this.subsurfaceScattering && ctx.renderPass!.type === RENDER_PASS_TYPE_LIGHT) {\r\n bindGroup.setValue('zSubsurfaceColor', this._subsurfaceColor);\r\n bindGroup.setValue('zSubsurfaceScale', this._subsurfaceScale);\r\n bindGroup.setValue('zSubsurfacePower', this._subsurfacePower);\r\n bindGroup.setValue('zSubsurfaceIntensity', this._subsurfaceIntensity);\r\n }\r\n }\r\n for (const u of this._uniformValues) {\r\n if (u.inVertexShader || this.needFragmentColor(ctx)) {\r\n bindGroup.setValue(u.name, u.finalValue!);\r\n }\r\n }\r\n for (const u of this._uniformTextures) {\r\n if (u.inVertexShader || this.needFragmentColor(ctx)) {\r\n bindGroup.setTexture(u.name, u.finalTexture!.get()!, u.finalSampler);\r\n }\r\n }\r\n }\r\n /**\r\n * Creates a unique hash string used for program caching.\r\n *\r\n * @remarks\r\n * The hash includes:\r\n * - The base material hash (`super._createHash()`).\r\n * - The fragment IR hash.\r\n * - The vertex IR hash.\r\n *\r\n * Different blueprint graphs will therefore produce different programs.\r\n *\r\n * @returns A hash string that uniquely identifies this material configuration.\r\n */\r\n protected _createHash() {\r\n return `${super._createHash()}:${this._irFrag.hash}:${this._irVertex.hash}`;\r\n }\r\n /**\r\n * Creates the GPU program for this blueprint PBR material.\r\n *\r\n * @remarks\r\n * This calls the base implementation and returns its result.\r\n * Commented-out `console.log` lines are provided for debugging the\r\n * generated vertex and fragment shader sources.\r\n *\r\n * @param ctx - The current draw context.\r\n * @param pass - Index of the active render pass.\r\n * @returns The created GPU program.\r\n */\r\n protected createProgram(ctx: DrawContext, pass: number) {\r\n const program = super.createProgram(ctx, pass);\r\n //console.log(program.getShaderSource('vertex'));\r\n //console.log(program.getShaderSource('fragment'));\r\n return program;\r\n }\r\n /**\r\n * Disposes resources associated with this material.\r\n *\r\n * @remarks\r\n * - Calls the base `onDispose` to clean up inherited resources.\r\n * - Disposes all `finalTexture` references from the blueprint\r\n * texture uniform descriptors.\r\n *\r\n * This method is intended to be called by the engine's resource\r\n * management system rather than directly by user code.\r\n */\r\n protected onDispose() {\r\n super.onDispose();\r\n for (const u of this._uniformTextures) {\r\n u.finalTexture!.dispose();\r\n }\r\n }\r\n /**\r\n * Retrieves a named output expression from a blueprint output list.\r\n *\r\n * @param outputs - The list of outputs generated by a blueprint graph.\r\n * @param name - The desired output name (e.g. `\"Position\"`, `\"Color\"`, `\"UV\"`).\r\n * @returns The expression associated with the given name, or `undefined` if not found.\r\n */\r\n private getOutput(\r\n outputs: {\r\n name: string;\r\n exp: number | boolean | PBShaderExp;\r\n }[],\r\n name: string\r\n ) {\r\n return outputs.find((output) => output.name === name)?.exp;\r\n }\r\n private applySubsurfaceScattering(\r\n scope: PBInsideFunctionScope,\r\n litColor: PBShaderExp,\r\n albedoRGB: PBShaderExp,\r\n normal: PBShaderExp,\r\n viewVec: PBShaderExp\r\n ) {\r\n const pb = scope.$builder;\r\n scope.$l.NoV = pb.clamp(pb.dot(normal, viewVec), 0, 1);\r\n scope.$l.wrapNdotV = pb.clamp(\r\n pb.div(pb.add(pb.sub(1, scope.NoV), scope.zSubsurfaceScale), pb.add(1, scope.zSubsurfaceScale)),\r\n 0,\r\n 1\r\n );\r\n scope.$l.sssFactor = pb.mul(pb.pow(scope.wrapNdotV, scope.zSubsurfacePower), scope.zSubsurfaceIntensity);\r\n return pb.vec4(\r\n pb.add(litColor.rgb, pb.mul(albedoRGB, scope.zSubsurfaceColor, scope.sssFactor)),\r\n litColor.a\r\n );\r\n }\r\n}\r\n"],"names":["PBR_REFLECTION_MODE","none","ggx","anisotropic","glint","PBRBluePrintMaterial","applyMaterialMixins","MeshMaterial","mixinPBRBluePrint","FEATURE_VERTEX_COLOR","defineFeature","FEATURE_VERTEX_UV","FEATURE_SUBSURFACE_SCATTERING","irFrag","irVertex","uniformValues","uniformTextures","_irFrag","MaterialBlueprintIR","nodeMap","PBRBlockNode","roots","order","graph","incoming","outgoing","nodes","id","title","locked","node","ClassName","Object","links","_irVertex","VertexBlockNode","_uniformValues","_uniformTextures","_reflectionMode","_subsurfaceColor","Vector3","_subsurfaceScale","_subsurfacePower","_subsurfaceIntensity","_anisotropy","_anisotropyDirection","_anisotropyDirectionScaleBias","Vector2","useFeature","behaviors","useVertexColor","useVertexUV","reflectionMode","val","uniformChanged","subsurfaceScattering","featureUsed","subsurfaceColor","equalsTo","set","subsurfaceScale","subsurfacePower","subsurfaceIntensity","anisotropy","clamped","Math","max","min","anisotropyDirection","anisotropyDirectionScaleBias","fragmentIR","ir","clearCache","optionChanged","vertexIR","map","v","newUniforms","finalTexture","DRef","get","finalSampler","name","params","clone","Vector4","zero","texture","type","sRGB","wrapS","wrapT","inFragmentShader","inVertexShader","minFilter","magFilter","mipFilter","u","dispose","other","copyFrom","vertexShader","scope","pb","$builder","$inputs","zVertexPos","vec3","attrib","zVertexNormal","zVertexTangent","vec4","zVertexColor","zVertexUV","vec2","getGlobalScope","uniform","outputs","create","$l","oPos","getOutput","ShaderHelper","resolveVertexPosition","worldMatrix","getWorldMatrix","$outputs","worldPos","mul","xyz","csPos","getViewProjectionMatrix","setClipSpacePosition","oNorm","resolveVertexNormal","getNormalMatrix","oTangent","resolveVertexTangent","zVertexBinormal","cross","w","outputName","output","fragmentShader","needFragmentColor","drawContext","renderPass","RENDER_PASS_TYPE_LIGHT","zSubsurfaceColor","zSubsurfaceScale","float","zSubsurfacePower","zSubsurfaceIntensity","zAnisotropy","zAnisotropyDirection","zAnisotropyDirectionScaleBias","viewVec","calculateViewVector","commonData","getCommonDatasStruct","getCommonData","materialFlags","MaterialVaryingFlags","SSR_STORE_ROUGHNESS","outRoughness","litColor","PBRLight","applySubsurfaceScattering","albedo","rgb","normal","outputFragmentColor","add","applyUniformValues","bindGroup","ctx","pass","setValue","finalValue","setTexture","_createHash","hash","createProgram","program","onDispose","find","exp","albedoRGB","NoV","clamp","dot","wrapNdotV","div","sub","sssFactor","pow","a"],"mappings":";;;;;;;;AAYA,MAAMA,mBAAyD,GAAA;IAC7DC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