@vived/component-abb-6700 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. package/.todo.md +13 -0
  2. package/README.md +122 -0
  3. package/dist/.gitkeep +0 -0
  4. package/dist/Adapters/aBB6700PMAdapter.d.ts +10 -0
  5. package/dist/Adapters/aBB6700PMAdapter.d.ts.map +1 -0
  6. package/dist/Controllers/createABB6700.d.ts +12 -0
  7. package/dist/Controllers/createABB6700.d.ts.map +1 -0
  8. package/dist/Controllers/getPose.d.ts +11 -0
  9. package/dist/Controllers/getPose.d.ts.map +1 -0
  10. package/dist/Controllers/setJointAngle.d.ts +12 -0
  11. package/dist/Controllers/setJointAngle.d.ts.map +1 -0
  12. package/dist/Controllers/setPose.d.ts +11 -0
  13. package/dist/Controllers/setPose.d.ts.map +1 -0
  14. package/dist/Entities/ABB6700Entity.d.ts +35 -0
  15. package/dist/Entities/ABB6700Entity.d.ts.map +1 -0
  16. package/dist/Entities/ABB6700Repo.d.ts +32 -0
  17. package/dist/Entities/ABB6700Repo.d.ts.map +1 -0
  18. package/dist/Factory/ABB6700FeatureFactory.d.ts +26 -0
  19. package/dist/Factory/ABB6700FeatureFactory.d.ts.map +1 -0
  20. package/dist/Mocks/MockABB6700PM.d.ts +11 -0
  21. package/dist/Mocks/MockABB6700PM.d.ts.map +1 -0
  22. package/dist/Mocks/MockSetJointAngleUC.d.ts +7 -0
  23. package/dist/Mocks/MockSetJointAngleUC.d.ts.map +1 -0
  24. package/dist/Mocks/MockSetPoseUC.d.ts +7 -0
  25. package/dist/Mocks/MockSetPoseUC.d.ts.map +1 -0
  26. package/dist/PMs/ABB6700PM.d.ts +32 -0
  27. package/dist/PMs/ABB6700PM.d.ts.map +1 -0
  28. package/dist/UCs/CalcStabilizerUC.d.ts +7 -0
  29. package/dist/UCs/CalcStabilizerUC.d.ts.map +1 -0
  30. package/dist/UCs/SetJointAngleUC.d.ts +15 -0
  31. package/dist/UCs/SetJointAngleUC.d.ts.map +1 -0
  32. package/dist/UCs/SetPoseUC.d.ts +22 -0
  33. package/dist/UCs/SetPoseUC.d.ts.map +1 -0
  34. package/dist/Views/ABB6700BabylonView.d.ts +27 -0
  35. package/dist/Views/ABB6700BabylonView.d.ts.map +1 -0
  36. package/dist/abb_6700.glb +0 -0
  37. package/dist/abstractAudioBus-CyBWsmuN.js +14 -0
  38. package/dist/animationGroup-BhNThqQe.js +1454 -0
  39. package/dist/basisTextureLoader-BT391BsV.js +310 -0
  40. package/dist/brdfTextureTools-DUyKBAXf.js +79 -0
  41. package/dist/bumpFragment-Dd-ojPA1.js +134 -0
  42. package/dist/bumpFragment-KE1_PuMl.js +287 -0
  43. package/dist/bumpVertex-BcdvVFVx.js +8 -0
  44. package/dist/bumpVertexDeclaration-B5Uvs-RS.js +8 -0
  45. package/dist/bumpVertexDeclaration-ixSg-yGI.js +8 -0
  46. package/dist/clipPlaneFragment-DJwQynjA.js +136 -0
  47. package/dist/clipPlaneVertex-D4Wk50XG.js +376 -0
  48. package/dist/clipPlaneVertex-eQ147Tn2.js +350 -0
  49. package/dist/component.config.d.ts +17 -0
  50. package/dist/component.config.d.ts.map +1 -0
  51. package/dist/ddsTextureLoader-DeoF3iGO.js +331 -0
  52. package/dist/default.fragment-DKnTR9nY.js +548 -0
  53. package/dist/default.fragment-rIGWrUS5.js +486 -0
  54. package/dist/default.vertex-Bt5y1VyA.js +212 -0
  55. package/dist/default.vertex-Dext1liJ.js +224 -0
  56. package/dist/defaultUboDeclaration-BwslQZX8.js +11 -0
  57. package/dist/defaultUboDeclaration-DSXACgip.js +9 -0
  58. package/dist/easing-BAt0SO-B.js +163 -0
  59. package/dist/envTextureLoader-CBiW_Q-U.js +40 -0
  60. package/dist/exrTextureLoader-5SC6PKIA.js +740 -0
  61. package/dist/flowGraphApplyForceBlock-6e8-wcaw.js +32 -0
  62. package/dist/flowGraphApplyImpulseBlock-B27EZQow.js +32 -0
  63. package/dist/flowGraphArrayIndexBlock-DIUn5e4i.js +31 -0
  64. package/dist/flowGraphBezierCurveEasingBlock-BJmiHk40.js +25 -0
  65. package/dist/flowGraphBinaryOperationBlock-Bj7TANCc.js +25 -0
  66. package/dist/flowGraphBranchBlock-7CRvIKWc.js +19 -0
  67. package/dist/flowGraphCachedOperationBlock-CP1ZiuIB.js +26 -0
  68. package/dist/flowGraphCancelDelayBlock-DqtgzBGm.js +20 -0
  69. package/dist/flowGraphCodeExecutionBlock-CaYXCGqo.js +23 -0
  70. package/dist/flowGraphConditionalDataBlock-DJ7evX8_.js +28 -0
  71. package/dist/flowGraphConsoleLogBlock-cMkpqLzO.js +68 -0
  72. package/dist/flowGraphConstantBlock-JWybwT0A.js +28 -0
  73. package/dist/flowGraphContextBlock-CFDXHcbn.js +19 -0
  74. package/dist/flowGraphCounterBlock-B0uPkgw9.js +24 -0
  75. package/dist/flowGraphDataSwitchBlock-B0GSifvJ.js +27 -0
  76. package/dist/flowGraphDebounceBlock-CSw8zKym.js +24 -0
  77. package/dist/flowGraphDebugBlock-DiSR6Ahn.js +65 -0
  78. package/dist/flowGraphDoNBlock-C-48oQ2H.js +24 -0
  79. package/dist/flowGraphEasingBlock-DKUaE7Rp.js +50 -0
  80. package/dist/flowGraphFlipFlopBlock-DX5BGhMV.js +20 -0
  81. package/dist/flowGraphForLoopBlock-Di-Qwg23.js +27 -0
  82. package/dist/flowGraphFunctionReferenceBlock-D8X5TFsO.js +20 -0
  83. package/dist/flowGraphGLTFDataProvider-C4j7nPQv.js +16 -0
  84. package/dist/flowGraphGetAngularVelocityBlock-Cq-yTQ4D.js +31 -0
  85. package/dist/flowGraphGetAssetBlock-B36eioor.js +21 -0
  86. package/dist/flowGraphGetLinearVelocityBlock-MdrV0eUD.js +31 -0
  87. package/dist/flowGraphGetPhysicsMassPropertiesBlock-wXDZP1wM.js +30 -0
  88. package/dist/flowGraphGetPropertyBlock-eP0badwf.js +46 -0
  89. package/dist/flowGraphGetSoundVolumeBlock-D3gXGHXa.js +29 -0
  90. package/dist/flowGraphGetVariableBlock-C7-qZAec.js +31 -0
  91. package/dist/flowGraphIndexOfBlock-CC5l9n9P.js +31 -0
  92. package/dist/flowGraphInterpolationBlock-B6922jzt.js +50 -0
  93. package/dist/flowGraphIsKeyPressedBlock-X_iuiUOX.js +31 -0
  94. package/dist/flowGraphIsSoundPlayingBlock-DONQX8N8.js +29 -0
  95. package/dist/flowGraphJsonPointerParserBlock-DBH_gN8I.js +95 -0
  96. package/dist/flowGraphKeyDownEventBlock-D5T1Uyfv.js +26 -0
  97. package/dist/flowGraphKeyUpEventBlock-BPY_Kgkm.js +21 -0
  98. package/dist/flowGraphKeyboardEventBlock-C49fx3TC.js +20 -0
  99. package/dist/flowGraphMathBlocks-CkvrN3VJ.js +864 -0
  100. package/dist/flowGraphMathCombineExtractBlocks-QSjGlnoz.js +248 -0
  101. package/dist/flowGraphMatrixMathBlocks-B3D7Cz9p.js +117 -0
  102. package/dist/flowGraphMeshPickEventBlock-BBTz-taa.js +35 -0
  103. package/dist/flowGraphMultiGateBlock-BhY1y5BG.js +50 -0
  104. package/dist/flowGraphPauseAnimationBlock-CHZZXMbg.js +19 -0
  105. package/dist/flowGraphPauseSoundBlock-B7hMmJ0c.js +31 -0
  106. package/dist/flowGraphPhysicsCollisionEventBlock-CxoPpT-q.js +56 -0
  107. package/dist/flowGraphPlayAnimationBlock-DVAvIFux.js +99 -0
  108. package/dist/flowGraphPlaySoundBlock-DjHGrqbC.js +32 -0
  109. package/dist/flowGraphPointerDownEventBlock-qI-H0JST.js +31 -0
  110. package/dist/flowGraphPointerMoveEventBlock-DAi4VUyy.js +31 -0
  111. package/dist/flowGraphPointerOutEventBlock-CFtj68aC.js +21 -0
  112. package/dist/flowGraphPointerOverEventBlock-VxdHhFuu.js +23 -0
  113. package/dist/flowGraphPointerUpEventBlock-DRR1f07q.js +31 -0
  114. package/dist/flowGraphReceiveCustomEventBlock-B3bwdB66.js +52 -0
  115. package/dist/flowGraphSceneReadyEventBlock-Dy6lDT3j.js +23 -0
  116. package/dist/flowGraphSceneTickEventBlock-Bl9BF_Xw.js +32 -0
  117. package/dist/flowGraphSendCustomEventBlock-BAR4PGFq.js +35 -0
  118. package/dist/flowGraphSequenceBlock-veqU32ZZ.js +32 -0
  119. package/dist/flowGraphSetAngularVelocityBlock-Dj9b-zu6.js +31 -0
  120. package/dist/flowGraphSetDelayBlock-CMjudtvk.js +131 -0
  121. package/dist/flowGraphSetLinearVelocityBlock-DVDhhJBd.js +31 -0
  122. package/dist/flowGraphSetPhysicsMotionTypeBlock-CL3cxNCO.js +36 -0
  123. package/dist/flowGraphSetPropertyBlock-D3sWL3Ss.js +47 -0
  124. package/dist/flowGraphSetSoundVolumeBlock-CxVk45yR.js +32 -0
  125. package/dist/flowGraphSetVariableBlock-D1oJiwLj.js +47 -0
  126. package/dist/flowGraphSoundEndedEventBlock-CubEwii0.js +47 -0
  127. package/dist/flowGraphStopAnimationBlock-B9inwIQx.js +48 -0
  128. package/dist/flowGraphStopSoundBlock-BijIX2jC.js +31 -0
  129. package/dist/flowGraphSwitchBlock-BMhPb4OX.js +54 -0
  130. package/dist/flowGraphThrottleBlock-C7vrnkb1.js +37 -0
  131. package/dist/flowGraphTransformCoordinatesSystemBlock-DoISqaUG.js +29 -0
  132. package/dist/flowGraphTypeToTypeBlocks-CSML6QWx.js +57 -0
  133. package/dist/flowGraphUnaryOperationBlock-B0Shf-lJ.js +24 -0
  134. package/dist/flowGraphVectorMathBlocks-DoTRR_E0.js +178 -0
  135. package/dist/flowGraphWaitAllBlock-BvmDMc24.js +54 -0
  136. package/dist/flowGraphWhileLoopBlock-BaIq4-K2.js +27 -0
  137. package/dist/geometry.fragment-Bsis3UG2.js +275 -0
  138. package/dist/geometry.vertex-DskQ5b8j.js +222 -0
  139. package/dist/harmonicsFunctions-CtNrRfir.js +193 -0
  140. package/dist/harmonicsFunctions-PEz6APC7.js +18 -0
  141. package/dist/hdrTextureLoader-D9rYxJ9q.js +112 -0
  142. package/dist/helperFunctions-Bt7Zfkrp.js +89 -0
  143. package/dist/helperFunctions-CPmRxd37.js +121 -0
  144. package/dist/iesTextureLoader-BGUFjVhI.js +93 -0
  145. package/dist/index-CS3Icp_r.js +67657 -0
  146. package/dist/index.d.ts +23 -0
  147. package/dist/index.d.ts.map +1 -0
  148. package/dist/index.js +27 -0
  149. package/dist/ktxTextureLoader-cUaGg9_L.js +459 -0
  150. package/dist/lightFragment-BRDibDKG.js +404 -0
  151. package/dist/lightFragment-DCqtGMp_.js +402 -0
  152. package/dist/logDepthDeclaration-Bwm-3KyB.js +16 -0
  153. package/dist/logDepthDeclaration-gUfeSnXX.js +20 -0
  154. package/dist/logDepthVertex-CKeuJ6ae.js +213 -0
  155. package/dist/logDepthVertex-CXkmZels.js +459 -0
  156. package/dist/mesh.vertexData.functions-Bc9lJlrU.js +74 -0
  157. package/dist/oitFragment-B8zuQigp.js +792 -0
  158. package/dist/oitFragment-DH3h3T6x.js +657 -0
  159. package/dist/openpbr.fragment-BglYS6LA.js +1405 -0
  160. package/dist/openpbr.fragment-DrOTZs4m.js +1553 -0
  161. package/dist/openpbr.vertex-B-PaLFOR.js +384 -0
  162. package/dist/openpbr.vertex-DMdFRTnX.js +268 -0
  163. package/dist/openpbrMaterial-HCU0aOca.js +2880 -0
  164. package/dist/openpbrMaterialLoadingAdapter-CWRAa-7S.js +1122 -0
  165. package/dist/openpbrTransmissionLayerData-CfDVObj5.js +352 -0
  166. package/dist/openpbrUboDeclaration-CA2pvSbt.js +9 -0
  167. package/dist/openpbrUboDeclaration-xU8VOaib.js +10 -0
  168. package/dist/pass.fragment-1mMP54bb.js +10 -0
  169. package/dist/pass.fragment-DzaUp_jk.js +10 -0
  170. package/dist/passCube.fragment-CQaXS7g3.js +29 -0
  171. package/dist/passCube.fragment-QJGPwAXI.js +29 -0
  172. package/dist/pbr.fragment-BnaAAGxb.js +2775 -0
  173. package/dist/pbr.fragment-CYZk_EGU.js +2619 -0
  174. package/dist/pbr.vertex-CyvdCw91.js +372 -0
  175. package/dist/pbr.vertex-DJMAkDxs.js +270 -0
  176. package/dist/pbrBRDFFunctions-EugoWm6O.js +175 -0
  177. package/dist/pbrDebug-Bk3sPoEG.js +719 -0
  178. package/dist/pbrDebug-Cdalzb1I.js +614 -0
  179. package/dist/pbrIBLFunctions-B0bVAXCF.js +47 -0
  180. package/dist/pbrIBLFunctions-C06z-ouZ.js +51 -0
  181. package/dist/pbrMaterial-C4FCKBZQ.js +1660 -0
  182. package/dist/pbrMaterialLoadingAdapter-BGHlS_ZN.js +1032 -0
  183. package/dist/pbrUboDeclaration-1lN5_-Bw.js +9 -0
  184. package/dist/pbrUboDeclaration-BJOUUOZ2.js +10 -0
  185. package/dist/procedural.vertex-CFPKczKj.js +14 -0
  186. package/dist/procedural.vertex-DUW7bYZt.js +13 -0
  187. package/dist/rgbdDecode.fragment-CEGgE4tL.js +8 -0
  188. package/dist/rgbdDecode.fragment-FT0wkgah.js +8 -0
  189. package/dist/rgbdEncode.fragment-CLnJJf6E.js +8 -0
  190. package/dist/rgbdEncode.fragment-CaAcMsY9.js +8 -0
  191. package/dist/sceneUboDeclaration-B6oxsfcj.js +8 -0
  192. package/dist/sceneUboDeclaration-JByfVKik.js +13 -0
  193. package/dist/setupABB6700InstanceFactory.d.ts +7 -0
  194. package/dist/setupABB6700InstanceFactory.d.ts.map +1 -0
  195. package/dist/studio.env +0 -0
  196. package/dist/textureProcessor.fragment-BYPw6SMQ.js +152 -0
  197. package/dist/textureProcessor.fragment-Ciw9-F3w.js +157 -0
  198. package/dist/textureTools-Cct_bGgp.js +40 -0
  199. package/dist/tgaTextureLoader-BJOIdnFr.js +198 -0
  200. package/dist/thinEngine-Bt9FW4dD.js +2425 -0
  201. package/dist/webAudioBus-BUzRHSxr.js +88 -0
  202. package/dist/webAudioMainBus-Dds1TgJG.js +49 -0
  203. package/package.json +49 -0
@@ -0,0 +1,1660 @@
1
+ import { ac as P, a9 as v, bC as s, c6 as a, bS as r, y as d, aa as l, aw as p, u as I, c8 as x, c7 as M, be as q, bh as F, c9 as ee, b8 as V, bg as te, b1 as se, H as ie, al as w, a7 as re, j as ae, J as le, Z as ne, ao as ue, ap as oe, aq as he, an as Te, aD as _e, ab as X, g as ce, aF as Ee, _ as Y, aE as Ae, av as fe, ay as Se, aA as Re, az as xe, au as pe, ax as Ie, at as Ce, as as me, aC as de, l as be, v as ye, o as Le, b7 as H, p as Me, m as Ne, q as ge, aY as Oe, n as De, s as Fe, r as ve, a0 as Ue, aI as Pe, $ as ke, aG as He, ba as Ge, a8 as G, aZ as K, aK as Be } from "./index-CS3Icp_r.js";
2
+ import { G as Z } from "./brdfTextureTools-DUyKBAXf.js";
3
+ class Ve extends v {
4
+ constructor() {
5
+ super(...arguments), this.BRDF_V_HEIGHT_CORRELATED = !1, this.MS_BRDF_ENERGY_CONSERVATION = !1, this.SPHERICAL_HARMONICS = !1, this.SPECULAR_GLOSSINESS_ENERGY_CONSERVATION = !1, this.MIX_IBL_RADIANCE_WITH_IRRADIANCE = !0, this.LEGACY_SPECULAR_ENERGY_CONSERVATION = !1, this.BASE_DIFFUSE_MODEL = 0, this.DIELECTRIC_SPECULAR_MODEL = 0, this.CONDUCTOR_SPECULAR_MODEL = 0;
6
+ }
7
+ }
8
+ class c extends P {
9
+ /** @internal */
10
+ _markAllSubMeshesAsMiscDirty() {
11
+ this._internalMarkAllSubMeshesAsMiscDirty();
12
+ }
13
+ /**
14
+ * Gets a boolean indicating that the plugin is compatible with a given shader language.
15
+ * @returns true if the plugin is compatible with the shader language
16
+ */
17
+ isCompatible() {
18
+ return !0;
19
+ }
20
+ constructor(e, i = !0) {
21
+ super(e, "PBRBRDF", 90, new Ve(), i), this._useEnergyConservation = c.DEFAULT_USE_ENERGY_CONSERVATION, this.useEnergyConservation = c.DEFAULT_USE_ENERGY_CONSERVATION, this._useSmithVisibilityHeightCorrelated = c.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED, this.useSmithVisibilityHeightCorrelated = c.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED, this._useSphericalHarmonics = c.DEFAULT_USE_SPHERICAL_HARMONICS, this.useSphericalHarmonics = c.DEFAULT_USE_SPHERICAL_HARMONICS, this._useSpecularGlossinessInputEnergyConservation = c.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION, this.useSpecularGlossinessInputEnergyConservation = c.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION, this._mixIblRadianceWithIrradiance = c.DEFAULT_MIX_IBL_RADIANCE_WITH_IRRADIANCE, this.mixIblRadianceWithIrradiance = c.DEFAULT_MIX_IBL_RADIANCE_WITH_IRRADIANCE, this._useLegacySpecularEnergyConservation = c.DEFAULT_USE_LEGACY_SPECULAR_ENERGY_CONSERVATION, this.useLegacySpecularEnergyConservation = c.DEFAULT_USE_LEGACY_SPECULAR_ENERGY_CONSERVATION, this._baseDiffuseModel = c.DEFAULT_DIFFUSE_MODEL, this.baseDiffuseModel = c.DEFAULT_DIFFUSE_MODEL, this._dielectricSpecularModel = c.DEFAULT_DIELECTRIC_SPECULAR_MODEL, this.dielectricSpecularModel = c.DEFAULT_DIELECTRIC_SPECULAR_MODEL, this._conductorSpecularModel = c.DEFAULT_CONDUCTOR_SPECULAR_MODEL, this.conductorSpecularModel = c.DEFAULT_CONDUCTOR_SPECULAR_MODEL, this._internalMarkAllSubMeshesAsMiscDirty = e._dirtyCallbacks[16], this._enable(!0);
22
+ }
23
+ prepareDefines(e) {
24
+ e.BRDF_V_HEIGHT_CORRELATED = this._useSmithVisibilityHeightCorrelated, e.MS_BRDF_ENERGY_CONSERVATION = this._useEnergyConservation && this._useSmithVisibilityHeightCorrelated, e.SPHERICAL_HARMONICS = this._useSphericalHarmonics, e.SPECULAR_GLOSSINESS_ENERGY_CONSERVATION = this._useSpecularGlossinessInputEnergyConservation, e.MIX_IBL_RADIANCE_WITH_IRRADIANCE = this._mixIblRadianceWithIrradiance && !this._material._disableLighting, e.LEGACY_SPECULAR_ENERGY_CONSERVATION = this._useLegacySpecularEnergyConservation, e.BASE_DIFFUSE_MODEL = this._baseDiffuseModel, e.DIELECTRIC_SPECULAR_MODEL = this._dielectricSpecularModel, e.CONDUCTOR_SPECULAR_MODEL = this._conductorSpecularModel;
25
+ }
26
+ getClassName() {
27
+ return "PBRBRDFConfiguration";
28
+ }
29
+ }
30
+ c.DEFAULT_USE_ENERGY_CONSERVATION = !0;
31
+ c.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED = !0;
32
+ c.DEFAULT_USE_SPHERICAL_HARMONICS = !0;
33
+ c.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION = !0;
34
+ c.DEFAULT_MIX_IBL_RADIANCE_WITH_IRRADIANCE = !0;
35
+ c.DEFAULT_USE_LEGACY_SPECULAR_ENERGY_CONSERVATION = !0;
36
+ c.DEFAULT_DIFFUSE_MODEL = 0;
37
+ c.DEFAULT_DIELECTRIC_SPECULAR_MODEL = 0;
38
+ c.DEFAULT_CONDUCTOR_SPECULAR_MODEL = 0;
39
+ s([
40
+ a(),
41
+ r("_markAllSubMeshesAsMiscDirty")
42
+ ], c.prototype, "useEnergyConservation", void 0);
43
+ s([
44
+ a(),
45
+ r("_markAllSubMeshesAsMiscDirty")
46
+ ], c.prototype, "useSmithVisibilityHeightCorrelated", void 0);
47
+ s([
48
+ a(),
49
+ r("_markAllSubMeshesAsMiscDirty")
50
+ ], c.prototype, "useSphericalHarmonics", void 0);
51
+ s([
52
+ a(),
53
+ r("_markAllSubMeshesAsMiscDirty")
54
+ ], c.prototype, "useSpecularGlossinessInputEnergyConservation", void 0);
55
+ s([
56
+ a(),
57
+ r("_markAllSubMeshesAsMiscDirty")
58
+ ], c.prototype, "mixIblRadianceWithIrradiance", void 0);
59
+ s([
60
+ a(),
61
+ r("_markAllSubMeshesAsMiscDirty")
62
+ ], c.prototype, "useLegacySpecularEnergyConservation", void 0);
63
+ s([
64
+ a("baseDiffuseModel"),
65
+ r("_markAllSubMeshesAsMiscDirty")
66
+ ], c.prototype, "baseDiffuseModel", void 0);
67
+ s([
68
+ a("dielectricSpecularModel"),
69
+ r("_markAllSubMeshesAsMiscDirty")
70
+ ], c.prototype, "dielectricSpecularModel", void 0);
71
+ s([
72
+ a("conductorSpecularModel"),
73
+ r("_markAllSubMeshesAsMiscDirty")
74
+ ], c.prototype, "conductorSpecularModel", void 0);
75
+ class Xe extends v {
76
+ constructor() {
77
+ super(...arguments), this.CLEARCOAT = !1, this.CLEARCOAT_DEFAULTIOR = !1, this.CLEARCOAT_TEXTURE = !1, this.CLEARCOAT_TEXTURE_ROUGHNESS = !1, this.CLEARCOAT_TEXTUREDIRECTUV = 0, this.CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV = 0, this.CLEARCOAT_BUMP = !1, this.CLEARCOAT_BUMPDIRECTUV = 0, this.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE = !1, this.CLEARCOAT_REMAP_F0 = !1, this.CLEARCOAT_TINT = !1, this.CLEARCOAT_TINT_TEXTURE = !1, this.CLEARCOAT_TINT_TEXTUREDIRECTUV = 0, this.CLEARCOAT_TINT_GAMMATEXTURE = !1;
78
+ }
79
+ }
80
+ class m extends P {
81
+ /** @internal */
82
+ _markAllSubMeshesAsTexturesDirty() {
83
+ this._enable(this._isEnabled), this._internalMarkAllSubMeshesAsTexturesDirty();
84
+ }
85
+ /**
86
+ * Gets a boolean indicating that the plugin is compatible with a given shader language.
87
+ * @returns true if the plugin is compatible with the shader language
88
+ */
89
+ isCompatible() {
90
+ return !0;
91
+ }
92
+ constructor(e, i = !0) {
93
+ super(e, "PBRClearCoat", 100, new Xe(), i), this._isEnabled = !1, this.isEnabled = !1, this.intensity = 1, this.roughness = 0, this._indexOfRefraction = m._DefaultIndexOfRefraction, this.indexOfRefraction = m._DefaultIndexOfRefraction, this._texture = null, this.texture = null, this._useRoughnessFromMainTexture = !0, this.useRoughnessFromMainTexture = !0, this._textureRoughness = null, this.textureRoughness = null, this._remapF0OnInterfaceChange = !0, this.remapF0OnInterfaceChange = !0, this._bumpTexture = null, this.bumpTexture = null, this._isTintEnabled = !1, this.isTintEnabled = !1, this.tintColor = d.White(), this.tintColorAtDistance = 1, this.tintThickness = 1, this._tintTexture = null, this.tintTexture = null, this._internalMarkAllSubMeshesAsTexturesDirty = e._dirtyCallbacks[1];
94
+ }
95
+ isReadyForSubMesh(e, i, t) {
96
+ if (!this._isEnabled)
97
+ return !0;
98
+ const o = this._material._disableBumpMap;
99
+ return !(e._areTexturesDirty && i.texturesEnabled && (this._texture && l.ClearCoatTextureEnabled && !this._texture.isReadyOrNotBlocking() || this._textureRoughness && l.ClearCoatTextureEnabled && !this._textureRoughness.isReadyOrNotBlocking() || t.getCaps().standardDerivatives && this._bumpTexture && l.ClearCoatBumpTextureEnabled && !o && !this._bumpTexture.isReady() || this._isTintEnabled && this._tintTexture && l.ClearCoatTintTextureEnabled && !this._tintTexture.isReadyOrNotBlocking()));
100
+ }
101
+ prepareDefinesBeforeAttributes(e, i) {
102
+ this._isEnabled ? (e.CLEARCOAT = !0, e.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE = this._useRoughnessFromMainTexture, e.CLEARCOAT_REMAP_F0 = this._remapF0OnInterfaceChange, e._areTexturesDirty && i.texturesEnabled && (this._texture && l.ClearCoatTextureEnabled ? p(this._texture, e, "CLEARCOAT_TEXTURE") : e.CLEARCOAT_TEXTURE = !1, this._textureRoughness && l.ClearCoatTextureEnabled ? p(this._textureRoughness, e, "CLEARCOAT_TEXTURE_ROUGHNESS") : e.CLEARCOAT_TEXTURE_ROUGHNESS = !1, this._bumpTexture && l.ClearCoatBumpTextureEnabled ? p(this._bumpTexture, e, "CLEARCOAT_BUMP") : e.CLEARCOAT_BUMP = !1, e.CLEARCOAT_DEFAULTIOR = this._indexOfRefraction === m._DefaultIndexOfRefraction, this._isTintEnabled ? (e.CLEARCOAT_TINT = !0, this._tintTexture && l.ClearCoatTintTextureEnabled ? (p(this._tintTexture, e, "CLEARCOAT_TINT_TEXTURE"), e.CLEARCOAT_TINT_GAMMATEXTURE = this._tintTexture.gammaSpace) : e.CLEARCOAT_TINT_TEXTURE = !1) : (e.CLEARCOAT_TINT = !1, e.CLEARCOAT_TINT_TEXTURE = !1))) : (e.CLEARCOAT = !1, e.CLEARCOAT_TEXTURE = !1, e.CLEARCOAT_TEXTURE_ROUGHNESS = !1, e.CLEARCOAT_BUMP = !1, e.CLEARCOAT_TINT = !1, e.CLEARCOAT_TINT_TEXTURE = !1, e.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE = !1, e.CLEARCOAT_DEFAULTIOR = !1, e.CLEARCOAT_TEXTUREDIRECTUV = 0, e.CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV = 0, e.CLEARCOAT_BUMPDIRECTUV = 0, e.CLEARCOAT_REMAP_F0 = !1, e.CLEARCOAT_TINT_TEXTUREDIRECTUV = 0, e.CLEARCOAT_TINT_GAMMATEXTURE = !1);
103
+ }
104
+ bindForSubMesh(e, i, t, o) {
105
+ if (!this._isEnabled)
106
+ return;
107
+ const h = o.materialDefines, R = this._material.isFrozen, S = this._material._disableBumpMap, C = this._material._invertNormalMapX, A = this._material._invertNormalMapY;
108
+ if (!e.useUbo || !R || !e.isSync) {
109
+ (this._texture || this._textureRoughness) && l.ClearCoatTextureEnabled && (e.updateFloat4("vClearCoatInfos", this._texture?.coordinatesIndex ?? 0, this._texture?.level ?? 0, this._textureRoughness?.coordinatesIndex ?? 0, this._textureRoughness?.level ?? 0), this._texture && I(this._texture, e, "clearCoat"), this._textureRoughness && !h.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE && I(this._textureRoughness, e, "clearCoatRoughness")), this._bumpTexture && t.getCaps().standardDerivatives && l.ClearCoatTextureEnabled && !S && (e.updateFloat2("vClearCoatBumpInfos", this._bumpTexture.coordinatesIndex, this._bumpTexture.level), I(this._bumpTexture, e, "clearCoatBump"), i._mirroredCameraPosition ? e.updateFloat2("vClearCoatTangentSpaceParams", C ? 1 : -1, A ? 1 : -1) : e.updateFloat2("vClearCoatTangentSpaceParams", C ? -1 : 1, A ? -1 : 1)), this._tintTexture && l.ClearCoatTintTextureEnabled && (e.updateFloat2("vClearCoatTintInfos", this._tintTexture.coordinatesIndex, this._tintTexture.level), I(this._tintTexture, e, "clearCoatTint")), e.updateFloat2("vClearCoatParams", this.intensity, this.roughness);
110
+ const T = 1 - this._indexOfRefraction, _ = 1 + this._indexOfRefraction, n = Math.pow(-T / _, 2), L = 1 / this._indexOfRefraction;
111
+ e.updateFloat4("vClearCoatRefractionParams", n, L, T, _), this._isTintEnabled && (e.updateFloat4("vClearCoatTintParams", this.tintColor.r, this.tintColor.g, this.tintColor.b, Math.max(1e-5, this.tintThickness)), e.updateFloat("clearCoatColorAtDistance", Math.max(1e-5, this.tintColorAtDistance)));
112
+ }
113
+ i.texturesEnabled && (this._texture && l.ClearCoatTextureEnabled && e.setTexture("clearCoatSampler", this._texture), this._textureRoughness && !h.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE && l.ClearCoatTextureEnabled && e.setTexture("clearCoatRoughnessSampler", this._textureRoughness), this._bumpTexture && t.getCaps().standardDerivatives && l.ClearCoatBumpTextureEnabled && !S && e.setTexture("clearCoatBumpSampler", this._bumpTexture), this._isTintEnabled && this._tintTexture && l.ClearCoatTintTextureEnabled && e.setTexture("clearCoatTintSampler", this._tintTexture));
114
+ }
115
+ hasTexture(e) {
116
+ return this._texture === e || this._textureRoughness === e || this._bumpTexture === e || this._tintTexture === e;
117
+ }
118
+ getActiveTextures(e) {
119
+ this._texture && e.push(this._texture), this._textureRoughness && e.push(this._textureRoughness), this._bumpTexture && e.push(this._bumpTexture), this._tintTexture && e.push(this._tintTexture);
120
+ }
121
+ getAnimatables(e) {
122
+ this._texture && this._texture.animations && this._texture.animations.length > 0 && e.push(this._texture), this._textureRoughness && this._textureRoughness.animations && this._textureRoughness.animations.length > 0 && e.push(this._textureRoughness), this._bumpTexture && this._bumpTexture.animations && this._bumpTexture.animations.length > 0 && e.push(this._bumpTexture), this._tintTexture && this._tintTexture.animations && this._tintTexture.animations.length > 0 && e.push(this._tintTexture);
123
+ }
124
+ dispose(e) {
125
+ e && (this._texture?.dispose(), this._textureRoughness?.dispose(), this._bumpTexture?.dispose(), this._tintTexture?.dispose());
126
+ }
127
+ getClassName() {
128
+ return "PBRClearCoatConfiguration";
129
+ }
130
+ addFallbacks(e, i, t) {
131
+ return e.CLEARCOAT_BUMP && i.addFallback(t++, "CLEARCOAT_BUMP"), e.CLEARCOAT_TINT && i.addFallback(t++, "CLEARCOAT_TINT"), e.CLEARCOAT && i.addFallback(t++, "CLEARCOAT"), t;
132
+ }
133
+ getSamplers(e) {
134
+ e.push("clearCoatSampler", "clearCoatRoughnessSampler", "clearCoatBumpSampler", "clearCoatTintSampler");
135
+ }
136
+ getUniforms() {
137
+ return {
138
+ ubo: [
139
+ { name: "vClearCoatParams", size: 2, type: "vec2" },
140
+ { name: "vClearCoatRefractionParams", size: 4, type: "vec4" },
141
+ { name: "vClearCoatInfos", size: 4, type: "vec4" },
142
+ { name: "clearCoatMatrix", size: 16, type: "mat4" },
143
+ { name: "clearCoatRoughnessMatrix", size: 16, type: "mat4" },
144
+ { name: "vClearCoatBumpInfos", size: 2, type: "vec2" },
145
+ { name: "vClearCoatTangentSpaceParams", size: 2, type: "vec2" },
146
+ { name: "clearCoatBumpMatrix", size: 16, type: "mat4" },
147
+ { name: "vClearCoatTintParams", size: 4, type: "vec4" },
148
+ { name: "clearCoatColorAtDistance", size: 1, type: "float" },
149
+ { name: "vClearCoatTintInfos", size: 2, type: "vec2" },
150
+ { name: "clearCoatTintMatrix", size: 16, type: "mat4" }
151
+ ]
152
+ };
153
+ }
154
+ }
155
+ m._DefaultIndexOfRefraction = 1.5;
156
+ s([
157
+ a(),
158
+ r("_markAllSubMeshesAsTexturesDirty")
159
+ ], m.prototype, "isEnabled", void 0);
160
+ s([
161
+ a()
162
+ ], m.prototype, "intensity", void 0);
163
+ s([
164
+ a()
165
+ ], m.prototype, "roughness", void 0);
166
+ s([
167
+ a(),
168
+ r("_markAllSubMeshesAsTexturesDirty")
169
+ ], m.prototype, "indexOfRefraction", void 0);
170
+ s([
171
+ x(),
172
+ r("_markAllSubMeshesAsTexturesDirty")
173
+ ], m.prototype, "texture", void 0);
174
+ s([
175
+ a(),
176
+ r("_markAllSubMeshesAsTexturesDirty")
177
+ ], m.prototype, "useRoughnessFromMainTexture", void 0);
178
+ s([
179
+ x(),
180
+ r("_markAllSubMeshesAsTexturesDirty")
181
+ ], m.prototype, "textureRoughness", void 0);
182
+ s([
183
+ a(),
184
+ r("_markAllSubMeshesAsTexturesDirty")
185
+ ], m.prototype, "remapF0OnInterfaceChange", void 0);
186
+ s([
187
+ x(),
188
+ r("_markAllSubMeshesAsTexturesDirty")
189
+ ], m.prototype, "bumpTexture", void 0);
190
+ s([
191
+ a(),
192
+ r("_markAllSubMeshesAsTexturesDirty")
193
+ ], m.prototype, "isTintEnabled", void 0);
194
+ s([
195
+ M()
196
+ ], m.prototype, "tintColor", void 0);
197
+ s([
198
+ a()
199
+ ], m.prototype, "tintColorAtDistance", void 0);
200
+ s([
201
+ a()
202
+ ], m.prototype, "tintThickness", void 0);
203
+ s([
204
+ x(),
205
+ r("_markAllSubMeshesAsTexturesDirty")
206
+ ], m.prototype, "tintTexture", void 0);
207
+ class Ye extends v {
208
+ constructor() {
209
+ super(...arguments), this.IRIDESCENCE = !1, this.IRIDESCENCE_TEXTURE = !1, this.IRIDESCENCE_TEXTUREDIRECTUV = 0, this.IRIDESCENCE_THICKNESS_TEXTURE = !1, this.IRIDESCENCE_THICKNESS_TEXTUREDIRECTUV = 0;
210
+ }
211
+ }
212
+ class b extends P {
213
+ /** @internal */
214
+ _markAllSubMeshesAsTexturesDirty() {
215
+ this._enable(this._isEnabled), this._internalMarkAllSubMeshesAsTexturesDirty();
216
+ }
217
+ /**
218
+ * Gets a boolean indicating that the plugin is compatible with a given shader language.
219
+ * @returns true if the plugin is compatible with the shader language
220
+ */
221
+ isCompatible() {
222
+ return !0;
223
+ }
224
+ constructor(e, i = !0) {
225
+ super(e, "PBRIridescence", 110, new Ye(), i), this._isEnabled = !1, this.isEnabled = !1, this.intensity = 1, this.minimumThickness = b._DefaultMinimumThickness, this.maximumThickness = b._DefaultMaximumThickness, this.indexOfRefraction = b._DefaultIndexOfRefraction, this._texture = null, this.texture = null, this._thicknessTexture = null, this.thicknessTexture = null, this._internalMarkAllSubMeshesAsTexturesDirty = e._dirtyCallbacks[1];
226
+ }
227
+ isReadyForSubMesh(e, i) {
228
+ return this._isEnabled ? !(e._areTexturesDirty && i.texturesEnabled && (this._texture && l.IridescenceTextureEnabled && !this._texture.isReadyOrNotBlocking() || this._thicknessTexture && l.IridescenceTextureEnabled && !this._thicknessTexture.isReadyOrNotBlocking())) : !0;
229
+ }
230
+ prepareDefinesBeforeAttributes(e, i) {
231
+ this._isEnabled ? (e.IRIDESCENCE = !0, e._areTexturesDirty && i.texturesEnabled && (this._texture && l.IridescenceTextureEnabled ? p(this._texture, e, "IRIDESCENCE_TEXTURE") : e.IRIDESCENCE_TEXTURE = !1, this._thicknessTexture && l.IridescenceTextureEnabled ? p(this._thicknessTexture, e, "IRIDESCENCE_THICKNESS_TEXTURE") : e.IRIDESCENCE_THICKNESS_TEXTURE = !1)) : (e.IRIDESCENCE = !1, e.IRIDESCENCE_TEXTURE = !1, e.IRIDESCENCE_THICKNESS_TEXTURE = !1, e.IRIDESCENCE_TEXTUREDIRECTUV = 0, e.IRIDESCENCE_THICKNESS_TEXTUREDIRECTUV = 0);
232
+ }
233
+ bindForSubMesh(e, i) {
234
+ if (!this._isEnabled)
235
+ return;
236
+ const t = this._material.isFrozen;
237
+ (!e.useUbo || !t || !e.isSync) && ((this._texture || this._thicknessTexture) && l.IridescenceTextureEnabled && (e.updateFloat4("vIridescenceInfos", this._texture?.coordinatesIndex ?? 0, this._texture?.level ?? 0, this._thicknessTexture?.coordinatesIndex ?? 0, this._thicknessTexture?.level ?? 0), this._texture && I(this._texture, e, "iridescence"), this._thicknessTexture && I(this._thicknessTexture, e, "iridescenceThickness")), e.updateFloat4("vIridescenceParams", this.intensity, this.indexOfRefraction, this.minimumThickness, this.maximumThickness)), i.texturesEnabled && (this._texture && l.IridescenceTextureEnabled && e.setTexture("iridescenceSampler", this._texture), this._thicknessTexture && l.IridescenceTextureEnabled && e.setTexture("iridescenceThicknessSampler", this._thicknessTexture));
238
+ }
239
+ hasTexture(e) {
240
+ return this._texture === e || this._thicknessTexture === e;
241
+ }
242
+ getActiveTextures(e) {
243
+ this._texture && e.push(this._texture), this._thicknessTexture && e.push(this._thicknessTexture);
244
+ }
245
+ getAnimatables(e) {
246
+ this._texture && this._texture.animations && this._texture.animations.length > 0 && e.push(this._texture), this._thicknessTexture && this._thicknessTexture.animations && this._thicknessTexture.animations.length > 0 && e.push(this._thicknessTexture);
247
+ }
248
+ dispose(e) {
249
+ e && (this._texture?.dispose(), this._thicknessTexture?.dispose());
250
+ }
251
+ getClassName() {
252
+ return "PBRIridescenceConfiguration";
253
+ }
254
+ addFallbacks(e, i, t) {
255
+ return e.IRIDESCENCE && i.addFallback(t++, "IRIDESCENCE"), t;
256
+ }
257
+ getSamplers(e) {
258
+ e.push("iridescenceSampler", "iridescenceThicknessSampler");
259
+ }
260
+ getUniforms() {
261
+ return {
262
+ ubo: [
263
+ { name: "vIridescenceParams", size: 4, type: "vec4" },
264
+ { name: "vIridescenceInfos", size: 4, type: "vec4" },
265
+ { name: "iridescenceMatrix", size: 16, type: "mat4" },
266
+ { name: "iridescenceThicknessMatrix", size: 16, type: "mat4" }
267
+ ]
268
+ };
269
+ }
270
+ }
271
+ b._DefaultMinimumThickness = 100;
272
+ b._DefaultMaximumThickness = 400;
273
+ b._DefaultIndexOfRefraction = 1.3;
274
+ s([
275
+ a(),
276
+ r("_markAllSubMeshesAsTexturesDirty")
277
+ ], b.prototype, "isEnabled", void 0);
278
+ s([
279
+ a()
280
+ ], b.prototype, "intensity", void 0);
281
+ s([
282
+ a()
283
+ ], b.prototype, "minimumThickness", void 0);
284
+ s([
285
+ a()
286
+ ], b.prototype, "maximumThickness", void 0);
287
+ s([
288
+ a()
289
+ ], b.prototype, "indexOfRefraction", void 0);
290
+ s([
291
+ x(),
292
+ r("_markAllSubMeshesAsTexturesDirty")
293
+ ], b.prototype, "texture", void 0);
294
+ s([
295
+ x(),
296
+ r("_markAllSubMeshesAsTexturesDirty")
297
+ ], b.prototype, "thicknessTexture", void 0);
298
+ class We extends v {
299
+ constructor() {
300
+ super(...arguments), this.ANISOTROPIC = !1, this.ANISOTROPIC_TEXTURE = !1, this.ANISOTROPIC_TEXTUREDIRECTUV = 0, this.ANISOTROPIC_LEGACY = !1, this.MAINUV1 = !1;
301
+ }
302
+ }
303
+ class k extends P {
304
+ /**
305
+ * Sets the anisotropy direction as an angle.
306
+ */
307
+ set angle(e) {
308
+ this.direction.x = Math.cos(e), this.direction.y = Math.sin(e);
309
+ }
310
+ /**
311
+ * Gets the anisotropy angle value in radians.
312
+ * @returns the anisotropy angle value in radians.
313
+ */
314
+ get angle() {
315
+ return Math.atan2(this.direction.y, this.direction.x);
316
+ }
317
+ /** @internal */
318
+ _markAllSubMeshesAsTexturesDirty() {
319
+ this._enable(this._isEnabled), this._internalMarkAllSubMeshesAsTexturesDirty();
320
+ }
321
+ /** @internal */
322
+ _markAllSubMeshesAsMiscDirty() {
323
+ this._enable(this._isEnabled), this._internalMarkAllSubMeshesAsMiscDirty();
324
+ }
325
+ /**
326
+ * Gets a boolean indicating that the plugin is compatible with a given shader language.
327
+ * @returns true if the plugin is compatible with the shader language
328
+ */
329
+ isCompatible() {
330
+ return !0;
331
+ }
332
+ constructor(e, i = !0) {
333
+ super(e, "PBRAnisotropic", 110, new We(), i), this._isEnabled = !1, this.isEnabled = !1, this.intensity = 1, this.direction = new q(1, 0), this._texture = null, this.texture = null, this._legacy = !1, this.legacy = !1, this._internalMarkAllSubMeshesAsTexturesDirty = e._dirtyCallbacks[1], this._internalMarkAllSubMeshesAsMiscDirty = e._dirtyCallbacks[16];
334
+ }
335
+ isReadyForSubMesh(e, i) {
336
+ return this._isEnabled ? !(e._areTexturesDirty && i.texturesEnabled && this._texture && l.AnisotropicTextureEnabled && !this._texture.isReadyOrNotBlocking()) : !0;
337
+ }
338
+ prepareDefinesBeforeAttributes(e, i, t) {
339
+ this._isEnabled ? (e.ANISOTROPIC = this._isEnabled, this._isEnabled && !t.isVerticesDataPresent(F.TangentKind) && (e._needUVs = !0, e.MAINUV1 = !0), e._areTexturesDirty && i.texturesEnabled && (this._texture && l.AnisotropicTextureEnabled ? p(this._texture, e, "ANISOTROPIC_TEXTURE") : e.ANISOTROPIC_TEXTURE = !1), e._areMiscDirty && (e.ANISOTROPIC_LEGACY = this._legacy)) : (e.ANISOTROPIC = !1, e.ANISOTROPIC_TEXTURE = !1, e.ANISOTROPIC_TEXTUREDIRECTUV = 0, e.ANISOTROPIC_LEGACY = !1);
340
+ }
341
+ bindForSubMesh(e, i) {
342
+ if (!this._isEnabled)
343
+ return;
344
+ const t = this._material.isFrozen;
345
+ (!e.useUbo || !t || !e.isSync) && (this._texture && l.AnisotropicTextureEnabled && (e.updateFloat2("vAnisotropyInfos", this._texture.coordinatesIndex, this._texture.level), I(this._texture, e, "anisotropy")), e.updateFloat3("vAnisotropy", this.direction.x, this.direction.y, this.intensity)), i.texturesEnabled && this._texture && l.AnisotropicTextureEnabled && e.setTexture("anisotropySampler", this._texture);
346
+ }
347
+ hasTexture(e) {
348
+ return this._texture === e;
349
+ }
350
+ getActiveTextures(e) {
351
+ this._texture && e.push(this._texture);
352
+ }
353
+ getAnimatables(e) {
354
+ this._texture && this._texture.animations && this._texture.animations.length > 0 && e.push(this._texture);
355
+ }
356
+ dispose(e) {
357
+ e && this._texture && this._texture.dispose();
358
+ }
359
+ getClassName() {
360
+ return "PBRAnisotropicConfiguration";
361
+ }
362
+ addFallbacks(e, i, t) {
363
+ return e.ANISOTROPIC && i.addFallback(t++, "ANISOTROPIC"), t;
364
+ }
365
+ getSamplers(e) {
366
+ e.push("anisotropySampler");
367
+ }
368
+ getUniforms() {
369
+ return {
370
+ ubo: [
371
+ { name: "vAnisotropy", size: 3, type: "vec3" },
372
+ { name: "vAnisotropyInfos", size: 2, type: "vec2" },
373
+ { name: "anisotropyMatrix", size: 16, type: "mat4" }
374
+ ]
375
+ };
376
+ }
377
+ /**
378
+ * Parses a anisotropy Configuration from a serialized object.
379
+ * @param source - Serialized object.
380
+ * @param scene Defines the scene we are parsing for
381
+ * @param rootUrl Defines the rootUrl to load from
382
+ */
383
+ parse(e, i, t) {
384
+ super.parse(e, i, t), e.legacy === void 0 && (this.legacy = !0);
385
+ }
386
+ }
387
+ s([
388
+ a(),
389
+ r("_markAllSubMeshesAsTexturesDirty")
390
+ ], k.prototype, "isEnabled", void 0);
391
+ s([
392
+ a()
393
+ ], k.prototype, "intensity", void 0);
394
+ s([
395
+ ee()
396
+ ], k.prototype, "direction", void 0);
397
+ s([
398
+ x(),
399
+ r("_markAllSubMeshesAsTexturesDirty")
400
+ ], k.prototype, "texture", void 0);
401
+ s([
402
+ a(),
403
+ r("_markAllSubMeshesAsMiscDirty")
404
+ ], k.prototype, "legacy", void 0);
405
+ class ze extends v {
406
+ constructor() {
407
+ super(...arguments), this.SHEEN = !1, this.SHEEN_TEXTURE = !1, this.SHEEN_GAMMATEXTURE = !1, this.SHEEN_TEXTURE_ROUGHNESS = !1, this.SHEEN_TEXTUREDIRECTUV = 0, this.SHEEN_TEXTURE_ROUGHNESSDIRECTUV = 0, this.SHEEN_LINKWITHALBEDO = !1, this.SHEEN_ROUGHNESS = !1, this.SHEEN_ALBEDOSCALING = !1, this.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE = !1;
408
+ }
409
+ }
410
+ class g extends P {
411
+ /** @internal */
412
+ _markAllSubMeshesAsTexturesDirty() {
413
+ this._enable(this._isEnabled), this._internalMarkAllSubMeshesAsTexturesDirty();
414
+ }
415
+ /**
416
+ * Gets a boolean indicating that the plugin is compatible with a given shader language.
417
+ * @returns true if the plugin is compatible with the shader language
418
+ */
419
+ isCompatible() {
420
+ return !0;
421
+ }
422
+ constructor(e, i = !0) {
423
+ super(e, "Sheen", 120, new ze(), i), this._isEnabled = !1, this.isEnabled = !1, this._linkSheenWithAlbedo = !1, this.linkSheenWithAlbedo = !1, this.intensity = 1, this.color = d.White(), this._texture = null, this.texture = null, this._useRoughnessFromMainTexture = !0, this.useRoughnessFromMainTexture = !0, this._roughness = null, this.roughness = null, this._textureRoughness = null, this.textureRoughness = null, this._albedoScaling = !1, this.albedoScaling = !1, this._internalMarkAllSubMeshesAsTexturesDirty = e._dirtyCallbacks[1];
424
+ }
425
+ isReadyForSubMesh(e, i) {
426
+ return this._isEnabled ? !(e._areTexturesDirty && i.texturesEnabled && (this._texture && l.SheenTextureEnabled && !this._texture.isReadyOrNotBlocking() || this._textureRoughness && l.SheenTextureEnabled && !this._textureRoughness.isReadyOrNotBlocking())) : !0;
427
+ }
428
+ prepareDefinesBeforeAttributes(e, i) {
429
+ this._isEnabled ? (e.SHEEN = !0, e.SHEEN_LINKWITHALBEDO = this._linkSheenWithAlbedo, e.SHEEN_ROUGHNESS = this._roughness !== null, e.SHEEN_ALBEDOSCALING = this._albedoScaling, e.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE = this._useRoughnessFromMainTexture, e._areTexturesDirty && i.texturesEnabled && (this._texture && l.SheenTextureEnabled ? (p(this._texture, e, "SHEEN_TEXTURE"), e.SHEEN_GAMMATEXTURE = this._texture.gammaSpace) : e.SHEEN_TEXTURE = !1, this._textureRoughness && l.SheenTextureEnabled ? p(this._textureRoughness, e, "SHEEN_TEXTURE_ROUGHNESS") : e.SHEEN_TEXTURE_ROUGHNESS = !1)) : (e.SHEEN = !1, e.SHEEN_TEXTURE = !1, e.SHEEN_TEXTURE_ROUGHNESS = !1, e.SHEEN_LINKWITHALBEDO = !1, e.SHEEN_ROUGHNESS = !1, e.SHEEN_ALBEDOSCALING = !1, e.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE = !1, e.SHEEN_GAMMATEXTURE = !1, e.SHEEN_TEXTUREDIRECTUV = 0, e.SHEEN_TEXTURE_ROUGHNESSDIRECTUV = 0);
430
+ }
431
+ bindForSubMesh(e, i, t, o) {
432
+ if (!this._isEnabled)
433
+ return;
434
+ const h = o.materialDefines, R = this._material.isFrozen;
435
+ (!e.useUbo || !R || !e.isSync) && ((this._texture || this._textureRoughness) && l.SheenTextureEnabled && (e.updateFloat4("vSheenInfos", this._texture?.coordinatesIndex ?? 0, this._texture?.level ?? 0, this._textureRoughness?.coordinatesIndex ?? 0, this._textureRoughness?.level ?? 0), this._texture && I(this._texture, e, "sheen"), this._textureRoughness && !h.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE && I(this._textureRoughness, e, "sheenRoughness")), e.updateFloat4("vSheenColor", this.color.r, this.color.g, this.color.b, this.intensity), this._roughness !== null && e.updateFloat("vSheenRoughness", this._roughness)), i.texturesEnabled && (this._texture && l.SheenTextureEnabled && e.setTexture("sheenSampler", this._texture), this._textureRoughness && !h.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE && l.SheenTextureEnabled && e.setTexture("sheenRoughnessSampler", this._textureRoughness));
436
+ }
437
+ hasTexture(e) {
438
+ return this._texture === e || this._textureRoughness === e;
439
+ }
440
+ getActiveTextures(e) {
441
+ this._texture && e.push(this._texture), this._textureRoughness && e.push(this._textureRoughness);
442
+ }
443
+ getAnimatables(e) {
444
+ this._texture && this._texture.animations && this._texture.animations.length > 0 && e.push(this._texture), this._textureRoughness && this._textureRoughness.animations && this._textureRoughness.animations.length > 0 && e.push(this._textureRoughness);
445
+ }
446
+ dispose(e) {
447
+ e && (this._texture?.dispose(), this._textureRoughness?.dispose());
448
+ }
449
+ getClassName() {
450
+ return "PBRSheenConfiguration";
451
+ }
452
+ addFallbacks(e, i, t) {
453
+ return e.SHEEN && i.addFallback(t++, "SHEEN"), t;
454
+ }
455
+ getSamplers(e) {
456
+ e.push("sheenSampler", "sheenRoughnessSampler");
457
+ }
458
+ getUniforms() {
459
+ return {
460
+ ubo: [
461
+ { name: "vSheenColor", size: 4, type: "vec4" },
462
+ { name: "vSheenRoughness", size: 1, type: "float" },
463
+ { name: "vSheenInfos", size: 4, type: "vec4" },
464
+ { name: "sheenMatrix", size: 16, type: "mat4" },
465
+ { name: "sheenRoughnessMatrix", size: 16, type: "mat4" }
466
+ ]
467
+ };
468
+ }
469
+ }
470
+ s([
471
+ a(),
472
+ r("_markAllSubMeshesAsTexturesDirty")
473
+ ], g.prototype, "isEnabled", void 0);
474
+ s([
475
+ a(),
476
+ r("_markAllSubMeshesAsTexturesDirty")
477
+ ], g.prototype, "linkSheenWithAlbedo", void 0);
478
+ s([
479
+ a()
480
+ ], g.prototype, "intensity", void 0);
481
+ s([
482
+ M()
483
+ ], g.prototype, "color", void 0);
484
+ s([
485
+ x(),
486
+ r("_markAllSubMeshesAsTexturesDirty")
487
+ ], g.prototype, "texture", void 0);
488
+ s([
489
+ a(),
490
+ r("_markAllSubMeshesAsTexturesDirty")
491
+ ], g.prototype, "useRoughnessFromMainTexture", void 0);
492
+ s([
493
+ a(),
494
+ r("_markAllSubMeshesAsTexturesDirty")
495
+ ], g.prototype, "roughness", void 0);
496
+ s([
497
+ x(),
498
+ r("_markAllSubMeshesAsTexturesDirty")
499
+ ], g.prototype, "textureRoughness", void 0);
500
+ s([
501
+ a(),
502
+ r("_markAllSubMeshesAsTexturesDirty")
503
+ ], g.prototype, "albedoScaling", void 0);
504
+ class we extends v {
505
+ constructor() {
506
+ super(...arguments), this.SUBSURFACE = !1, this.SS_REFRACTION = !1, this.SS_REFRACTION_USE_INTENSITY_FROM_THICKNESS = !1, this.SS_TRANSLUCENCY = !1, this.SS_TRANSLUCENCY_USE_INTENSITY_FROM_THICKNESS = !1, this.SS_SCATTERING = !1, this.SS_DISPERSION = !1, this.SS_THICKNESSANDMASK_TEXTURE = !1, this.SS_THICKNESSANDMASK_TEXTUREDIRECTUV = 0, this.SS_HAS_THICKNESS = !1, this.SS_REFRACTIONINTENSITY_TEXTURE = !1, this.SS_REFRACTIONINTENSITY_TEXTUREDIRECTUV = 0, this.SS_TRANSLUCENCYINTENSITY_TEXTURE = !1, this.SS_TRANSLUCENCYINTENSITY_TEXTUREDIRECTUV = 0, this.SS_TRANSLUCENCYCOLOR_TEXTURE = !1, this.SS_TRANSLUCENCYCOLOR_TEXTUREDIRECTUV = 0, this.SS_TRANSLUCENCYCOLOR_TEXTURE_GAMMA = !1, this.SS_REFRACTIONMAP_3D = !1, this.SS_REFRACTIONMAP_OPPOSITEZ = !1, this.SS_LODINREFRACTIONALPHA = !1, this.SS_GAMMAREFRACTION = !1, this.SS_RGBDREFRACTION = !1, this.SS_LINEARSPECULARREFRACTION = !1, this.SS_LINKREFRACTIONTOTRANSPARENCY = !1, this.SS_ALBEDOFORREFRACTIONTINT = !1, this.SS_ALBEDOFORTRANSLUCENCYTINT = !1, this.SS_USE_LOCAL_REFRACTIONMAP_CUBIC = !1, this.SS_USE_THICKNESS_AS_DEPTH = !1, this.SS_USE_GLTF_TEXTURES = !1, this.SS_APPLY_ALBEDO_AFTER_SUBSURFACE = !1, this.SS_TRANSLUCENCY_LEGACY = !1;
507
+ }
508
+ }
509
+ class E extends P {
510
+ /**
511
+ * Diffusion profile for subsurface scattering.
512
+ * Useful for better scattering in the skins or foliages.
513
+ */
514
+ get scatteringDiffusionProfile() {
515
+ return this._scene.subSurfaceConfiguration ? this._scene.subSurfaceConfiguration.ssDiffusionProfileColors[this._scatteringDiffusionProfileIndex] : null;
516
+ }
517
+ set scatteringDiffusionProfile(e) {
518
+ this._scene.enableSubSurfaceForPrePass() && e && (this._scatteringDiffusionProfileIndex = this._scene.subSurfaceConfiguration.addDiffusionProfile(e));
519
+ }
520
+ /**
521
+ * Index of refraction of the material's volume.
522
+ * https://en.wikipedia.org/wiki/List_of_refractive_indices
523
+ *
524
+ * This ONLY impacts refraction. If not provided or given a non-valid value,
525
+ * the volume will use the same IOR as the surface.
526
+ */
527
+ get volumeIndexOfRefraction() {
528
+ return this._volumeIndexOfRefraction >= 1 ? this._volumeIndexOfRefraction : this._indexOfRefraction;
529
+ }
530
+ set volumeIndexOfRefraction(e) {
531
+ e >= 1 ? this._volumeIndexOfRefraction = e : this._volumeIndexOfRefraction = -1;
532
+ }
533
+ /**
534
+ * Keeping for backward compatibility... Should not be used anymore. It has been replaced by
535
+ * the property with the correct spelling.
536
+ * @see legacyTranslucency
537
+ */
538
+ get legacyTransluceny() {
539
+ return this.legacyTranslucency;
540
+ }
541
+ set legacyTransluceny(e) {
542
+ this.legacyTranslucency = e;
543
+ }
544
+ /** @internal */
545
+ _markAllSubMeshesAsTexturesDirty() {
546
+ this._enable(this._isRefractionEnabled || this._isTranslucencyEnabled || this._isScatteringEnabled), this._internalMarkAllSubMeshesAsTexturesDirty();
547
+ }
548
+ /** @internal */
549
+ _markScenePrePassDirty() {
550
+ this._enable(this._isRefractionEnabled || this._isTranslucencyEnabled || this._isScatteringEnabled), this._internalMarkAllSubMeshesAsTexturesDirty(), this._internalMarkScenePrePassDirty();
551
+ }
552
+ /**
553
+ * Gets a boolean indicating that the plugin is compatible with a given shader language.
554
+ * @returns true if the plugin is compatible with the shader language
555
+ */
556
+ isCompatible() {
557
+ return !0;
558
+ }
559
+ constructor(e, i = !0) {
560
+ super(e, "PBRSubSurface", 130, new we(), i), this._isRefractionEnabled = !1, this.isRefractionEnabled = !1, this._isTranslucencyEnabled = !1, this.isTranslucencyEnabled = !1, this._isDispersionEnabled = !1, this.isDispersionEnabled = !1, this._isScatteringEnabled = !1, this.isScatteringEnabled = !1, this._scatteringDiffusionProfileIndex = 0, this.refractionIntensity = 1, this.translucencyIntensity = 1, this._useAlbedoToTintRefraction = !1, this.useAlbedoToTintRefraction = !1, this._useAlbedoToTintTranslucency = !1, this.useAlbedoToTintTranslucency = !1, this._thicknessTexture = null, this.thicknessTexture = null, this._refractionTexture = null, this.refractionTexture = null, this._indexOfRefraction = 1.5, this.indexOfRefraction = 1.5, this._volumeIndexOfRefraction = -1, this._invertRefractionY = !1, this.invertRefractionY = !1, this._linkRefractionWithTransparency = !1, this.linkRefractionWithTransparency = !1, this.minimumThickness = 0, this.maximumThickness = 1, this.useThicknessAsDepth = !1, this.tintColor = d.White(), this.tintColorAtDistance = 1, this.dispersion = 0, this.diffusionDistance = d.White(), this._useMaskFromThicknessTexture = !1, this.useMaskFromThicknessTexture = !1, this._refractionIntensityTexture = null, this.refractionIntensityTexture = null, this._translucencyIntensityTexture = null, this.translucencyIntensityTexture = null, this.translucencyColor = null, this._translucencyColorTexture = null, this.translucencyColorTexture = null, this._useGltfStyleTextures = !0, this.useGltfStyleTextures = !0, this.applyAlbedoAfterSubSurface = E.DEFAULT_APPLY_ALBEDO_AFTERSUBSURFACE, this.legacyTranslucency = E.DEFAULT_LEGACY_TRANSLUCENCY, this._scene = e.getScene(), this.registerForExtraEvents = !0, this._internalMarkAllSubMeshesAsTexturesDirty = e._dirtyCallbacks[1], this._internalMarkScenePrePassDirty = e._dirtyCallbacks[32];
561
+ }
562
+ isReadyForSubMesh(e, i) {
563
+ if (!this._isRefractionEnabled && !this._isTranslucencyEnabled && !this._isScatteringEnabled)
564
+ return !0;
565
+ if (e._areTexturesDirty && i.texturesEnabled) {
566
+ if (this._thicknessTexture && l.ThicknessTextureEnabled && !this._thicknessTexture.isReadyOrNotBlocking() || this._refractionIntensityTexture && l.RefractionIntensityTextureEnabled && !this._refractionIntensityTexture.isReadyOrNotBlocking() || this._translucencyColorTexture && l.TranslucencyColorTextureEnabled && !this._translucencyColorTexture.isReadyOrNotBlocking() || this._translucencyIntensityTexture && l.TranslucencyIntensityTextureEnabled && !this._translucencyIntensityTexture.isReadyOrNotBlocking())
567
+ return !1;
568
+ const t = this._getRefractionTexture(i);
569
+ if (t && l.RefractionTextureEnabled && !t.isReadyOrNotBlocking())
570
+ return !1;
571
+ }
572
+ return !0;
573
+ }
574
+ prepareDefinesBeforeAttributes(e, i) {
575
+ if (!this._isRefractionEnabled && !this._isTranslucencyEnabled && !this._isScatteringEnabled) {
576
+ e.SUBSURFACE = !1, e.SS_DISPERSION = !1, e.SS_TRANSLUCENCY = !1, e.SS_SCATTERING = !1, e.SS_REFRACTION = !1, e.SS_REFRACTION_USE_INTENSITY_FROM_THICKNESS = !1, e.SS_TRANSLUCENCY_USE_INTENSITY_FROM_THICKNESS = !1, e.SS_THICKNESSANDMASK_TEXTURE = !1, e.SS_THICKNESSANDMASK_TEXTUREDIRECTUV = 0, e.SS_HAS_THICKNESS = !1, e.SS_REFRACTIONINTENSITY_TEXTURE = !1, e.SS_REFRACTIONINTENSITY_TEXTUREDIRECTUV = 0, e.SS_TRANSLUCENCYINTENSITY_TEXTURE = !1, e.SS_TRANSLUCENCYINTENSITY_TEXTUREDIRECTUV = 0, e.SS_REFRACTIONMAP_3D = !1, e.SS_REFRACTIONMAP_OPPOSITEZ = !1, e.SS_LODINREFRACTIONALPHA = !1, e.SS_GAMMAREFRACTION = !1, e.SS_RGBDREFRACTION = !1, e.SS_LINEARSPECULARREFRACTION = !1, e.SS_LINKREFRACTIONTOTRANSPARENCY = !1, e.SS_ALBEDOFORREFRACTIONTINT = !1, e.SS_ALBEDOFORTRANSLUCENCYTINT = !1, e.SS_USE_LOCAL_REFRACTIONMAP_CUBIC = !1, e.SS_USE_THICKNESS_AS_DEPTH = !1, e.SS_USE_GLTF_TEXTURES = !1, e.SS_TRANSLUCENCYCOLOR_TEXTURE = !1, e.SS_TRANSLUCENCYCOLOR_TEXTUREDIRECTUV = 0, e.SS_TRANSLUCENCYCOLOR_TEXTURE_GAMMA = !1, e.SS_APPLY_ALBEDO_AFTER_SUBSURFACE = !1;
577
+ return;
578
+ }
579
+ if (e._areTexturesDirty) {
580
+ if (e.SUBSURFACE = !0, e.SS_DISPERSION = this._isDispersionEnabled, e.SS_TRANSLUCENCY = this._isTranslucencyEnabled, e.SS_TRANSLUCENCY_USE_INTENSITY_FROM_THICKNESS = !1, e.SS_TRANSLUCENCY_LEGACY = this.legacyTranslucency, e.SS_SCATTERING = this._isScatteringEnabled, e.SS_THICKNESSANDMASK_TEXTURE = !1, e.SS_REFRACTIONINTENSITY_TEXTURE = !1, e.SS_TRANSLUCENCYINTENSITY_TEXTURE = !1, e.SS_HAS_THICKNESS = !1, e.SS_USE_GLTF_TEXTURES = !1, e.SS_REFRACTION = !1, e.SS_REFRACTION_USE_INTENSITY_FROM_THICKNESS = !1, e.SS_REFRACTIONMAP_3D = !1, e.SS_GAMMAREFRACTION = !1, e.SS_RGBDREFRACTION = !1, e.SS_LINEARSPECULARREFRACTION = !1, e.SS_REFRACTIONMAP_OPPOSITEZ = !1, e.SS_LODINREFRACTIONALPHA = !1, e.SS_LINKREFRACTIONTOTRANSPARENCY = !1, e.SS_ALBEDOFORREFRACTIONTINT = !1, e.SS_ALBEDOFORTRANSLUCENCYTINT = !1, e.SS_USE_LOCAL_REFRACTIONMAP_CUBIC = !1, e.SS_USE_THICKNESS_AS_DEPTH = !1, e.SS_TRANSLUCENCYCOLOR_TEXTURE = !1, e.SS_APPLY_ALBEDO_AFTER_SUBSURFACE = this.applyAlbedoAfterSubSurface, e._areTexturesDirty && i.texturesEnabled && (this._thicknessTexture && l.ThicknessTextureEnabled && p(this._thicknessTexture, e, "SS_THICKNESSANDMASK_TEXTURE"), this._refractionIntensityTexture && l.RefractionIntensityTextureEnabled && p(this._refractionIntensityTexture, e, "SS_REFRACTIONINTENSITY_TEXTURE"), this._translucencyIntensityTexture && l.TranslucencyIntensityTextureEnabled && p(this._translucencyIntensityTexture, e, "SS_TRANSLUCENCYINTENSITY_TEXTURE"), this._translucencyColorTexture && l.TranslucencyColorTextureEnabled && (p(this._translucencyColorTexture, e, "SS_TRANSLUCENCYCOLOR_TEXTURE"), e.SS_TRANSLUCENCYCOLOR_TEXTURE_GAMMA = this._translucencyColorTexture.gammaSpace)), e.SS_HAS_THICKNESS = this.maximumThickness - this.minimumThickness !== 0, e.SS_USE_GLTF_TEXTURES = this._useGltfStyleTextures, e.SS_REFRACTION_USE_INTENSITY_FROM_THICKNESS = this._useMaskFromThicknessTexture && !this._refractionIntensityTexture, e.SS_TRANSLUCENCY_USE_INTENSITY_FROM_THICKNESS = this._useMaskFromThicknessTexture && !this._translucencyIntensityTexture, this._isRefractionEnabled && i.texturesEnabled) {
581
+ const t = this._getRefractionTexture(i);
582
+ t && l.RefractionTextureEnabled && (e.SS_REFRACTION = !0, e.SS_REFRACTIONMAP_3D = t.isCube, e.SS_GAMMAREFRACTION = t.gammaSpace, e.SS_RGBDREFRACTION = t.isRGBD, e.SS_LINEARSPECULARREFRACTION = t.linearSpecularLOD, e.SS_REFRACTIONMAP_OPPOSITEZ = this._scene.useRightHandedSystem && t.isCube ? !t.invertZ : t.invertZ, e.SS_LODINREFRACTIONALPHA = t.lodLevelInAlpha, e.SS_LINKREFRACTIONTOTRANSPARENCY = this._linkRefractionWithTransparency, e.SS_ALBEDOFORREFRACTIONTINT = this._useAlbedoToTintRefraction, e.SS_USE_LOCAL_REFRACTIONMAP_CUBIC = t.isCube && t.boundingBoxSize, e.SS_USE_THICKNESS_AS_DEPTH = this.useThicknessAsDepth);
583
+ }
584
+ this._isTranslucencyEnabled && (e.SS_ALBEDOFORTRANSLUCENCYTINT = this._useAlbedoToTintTranslucency);
585
+ }
586
+ }
587
+ /**
588
+ * Binds the material data (this function is called even if mustRebind() returns false)
589
+ * @param uniformBuffer defines the Uniform buffer to fill in.
590
+ * @param scene defines the scene the material belongs to.
591
+ * @param engine defines the engine the material belongs to.
592
+ * @param subMesh the submesh to bind data for
593
+ */
594
+ hardBindForSubMesh(e, i, t, o) {
595
+ if (!(!this._isRefractionEnabled && !this._isTranslucencyEnabled && !this._isScatteringEnabled))
596
+ if (this.maximumThickness === 0 && this.minimumThickness === 0)
597
+ e.updateFloat2("vThicknessParam", 0, 0);
598
+ else {
599
+ o.getRenderingMesh().getWorldMatrix().decompose(V.Vector3[0]);
600
+ const h = Math.max(Math.abs(V.Vector3[0].x), Math.abs(V.Vector3[0].y), Math.abs(V.Vector3[0].z));
601
+ e.updateFloat2("vThicknessParam", this.minimumThickness * h, (this.maximumThickness - this.minimumThickness) * h);
602
+ }
603
+ }
604
+ bindForSubMesh(e, i, t, o) {
605
+ if (!this._isRefractionEnabled && !this._isTranslucencyEnabled && !this._isScatteringEnabled)
606
+ return;
607
+ const h = o.materialDefines, R = this._material.isFrozen, S = this._material.realTimeFiltering, C = h.LODBASEDMICROSFURACE, A = this._getRefractionTexture(i);
608
+ if (!e.useUbo || !R || !e.isSync) {
609
+ if (this._thicknessTexture && l.ThicknessTextureEnabled && (e.updateFloat2("vThicknessInfos", this._thicknessTexture.coordinatesIndex, this._thicknessTexture.level), I(this._thicknessTexture, e, "thickness")), this._refractionIntensityTexture && l.RefractionIntensityTextureEnabled && h.SS_REFRACTIONINTENSITY_TEXTURE && (e.updateFloat2("vRefractionIntensityInfos", this._refractionIntensityTexture.coordinatesIndex, this._refractionIntensityTexture.level), I(this._refractionIntensityTexture, e, "refractionIntensity")), this._translucencyColorTexture && l.TranslucencyColorTextureEnabled && h.SS_TRANSLUCENCYCOLOR_TEXTURE && (e.updateFloat2("vTranslucencyColorInfos", this._translucencyColorTexture.coordinatesIndex, this._translucencyColorTexture.level), I(this._translucencyColorTexture, e, "translucencyColor")), this._translucencyIntensityTexture && l.TranslucencyIntensityTextureEnabled && h.SS_TRANSLUCENCYINTENSITY_TEXTURE && (e.updateFloat2("vTranslucencyIntensityInfos", this._translucencyIntensityTexture.coordinatesIndex, this._translucencyIntensityTexture.level), I(this._translucencyIntensityTexture, e, "translucencyIntensity")), A && l.RefractionTextureEnabled) {
610
+ e.updateMatrix("refractionMatrix", A.getRefractionTextureMatrix());
611
+ let T = 1;
612
+ A.isCube || A.depth && (T = A.depth);
613
+ const _ = A.getSize().width, n = this.volumeIndexOfRefraction;
614
+ if (e.updateFloat4("vRefractionInfos", A.level, 1 / n, T, this._invertRefractionY ? -1 : 1), e.updateFloat4("vRefractionMicrosurfaceInfos", _, A.lodGenerationScale, A.lodGenerationOffset, 1 / this.indexOfRefraction), S && e.updateFloat2("vRefractionFilteringInfo", _, Math.log2(_)), A.boundingBoxSize) {
615
+ const L = A;
616
+ e.updateVector3("vRefractionPosition", L.boundingBoxPosition), e.updateVector3("vRefractionSize", L.boundingBoxSize);
617
+ }
618
+ }
619
+ this._isScatteringEnabled && e.updateFloat("scatteringDiffusionProfile", this._scatteringDiffusionProfileIndex), e.updateColor3("vDiffusionDistance", this.diffusionDistance), e.updateFloat4("vTintColor", this.tintColor.r, this.tintColor.g, this.tintColor.b, Math.max(1e-5, this.tintColorAtDistance)), e.updateColor4("vTranslucencyColor", this.translucencyColor ?? this.tintColor, 0), e.updateFloat3("vSubSurfaceIntensity", this.refractionIntensity, this.translucencyIntensity, 0), e.updateFloat("dispersion", this.dispersion);
620
+ }
621
+ i.texturesEnabled && (this._thicknessTexture && l.ThicknessTextureEnabled && e.setTexture("thicknessSampler", this._thicknessTexture), this._refractionIntensityTexture && l.RefractionIntensityTextureEnabled && h.SS_REFRACTIONINTENSITY_TEXTURE && e.setTexture("refractionIntensitySampler", this._refractionIntensityTexture), this._translucencyIntensityTexture && l.TranslucencyIntensityTextureEnabled && h.SS_TRANSLUCENCYINTENSITY_TEXTURE && e.setTexture("translucencyIntensitySampler", this._translucencyIntensityTexture), this._translucencyColorTexture && l.TranslucencyColorTextureEnabled && h.SS_TRANSLUCENCYCOLOR_TEXTURE && e.setTexture("translucencyColorSampler", this._translucencyColorTexture), A && l.RefractionTextureEnabled && (C ? e.setTexture("refractionSampler", A) : (e.setTexture("refractionSampler", A._lodTextureMid || A), e.setTexture("refractionSamplerLow", A._lodTextureLow || A), e.setTexture("refractionSamplerHigh", A._lodTextureHigh || A))));
622
+ }
623
+ /**
624
+ * Returns the texture used for refraction or null if none is used.
625
+ * @param scene defines the scene the material belongs to.
626
+ * @returns - Refraction texture if present. If no refraction texture and refraction
627
+ * is linked with transparency, returns environment texture. Otherwise, returns null.
628
+ */
629
+ _getRefractionTexture(e) {
630
+ return this._refractionTexture ? this._refractionTexture : this._isRefractionEnabled ? e.environmentTexture : null;
631
+ }
632
+ /**
633
+ * Returns true if alpha blending should be disabled.
634
+ */
635
+ get disableAlphaBlending() {
636
+ return this._isRefractionEnabled && this._linkRefractionWithTransparency;
637
+ }
638
+ /**
639
+ * Fills the list of render target textures.
640
+ * @param renderTargets the list of render targets to update
641
+ */
642
+ fillRenderTargetTextures(e) {
643
+ l.RefractionTextureEnabled && this._refractionTexture && this._refractionTexture.isRenderTarget && e.push(this._refractionTexture);
644
+ }
645
+ hasTexture(e) {
646
+ return this._thicknessTexture === e || this._refractionTexture === e || this._refractionIntensityTexture === e || this._translucencyIntensityTexture === e || this._translucencyColorTexture === e;
647
+ }
648
+ hasRenderTargetTextures() {
649
+ return !!(l.RefractionTextureEnabled && this._refractionTexture && this._refractionTexture.isRenderTarget);
650
+ }
651
+ getActiveTextures(e) {
652
+ this._thicknessTexture && e.push(this._thicknessTexture), this._refractionTexture && e.push(this._refractionTexture), this._refractionIntensityTexture && e.push(this._refractionIntensityTexture), this._translucencyColorTexture && e.push(this._translucencyColorTexture), this._translucencyIntensityTexture && e.push(this._translucencyIntensityTexture);
653
+ }
654
+ getAnimatables(e) {
655
+ this._thicknessTexture && this._thicknessTexture.animations && this._thicknessTexture.animations.length > 0 && e.push(this._thicknessTexture), this._refractionTexture && this._refractionTexture.animations && this._refractionTexture.animations.length > 0 && e.push(this._refractionTexture), this._refractionIntensityTexture && this._refractionIntensityTexture.animations && this._refractionIntensityTexture.animations.length > 0 && e.push(this._refractionIntensityTexture), this._translucencyColorTexture && this._translucencyColorTexture.animations && this._translucencyColorTexture.animations.length > 0 && e.push(this._translucencyColorTexture), this._translucencyIntensityTexture && this._translucencyIntensityTexture.animations && this._translucencyIntensityTexture.animations.length > 0 && e.push(this._translucencyIntensityTexture);
656
+ }
657
+ dispose(e) {
658
+ e && (this._thicknessTexture && this._thicknessTexture.dispose(), this._refractionTexture && this._refractionTexture.dispose(), this._refractionIntensityTexture && this._refractionIntensityTexture.dispose(), this._translucencyColorTexture && this._translucencyColorTexture.dispose(), this._translucencyIntensityTexture && this._translucencyIntensityTexture.dispose());
659
+ }
660
+ getClassName() {
661
+ return "PBRSubSurfaceConfiguration";
662
+ }
663
+ addFallbacks(e, i, t) {
664
+ return e.SS_SCATTERING && i.addFallback(t++, "SS_SCATTERING"), e.SS_TRANSLUCENCY && i.addFallback(t++, "SS_TRANSLUCENCY"), t;
665
+ }
666
+ getSamplers(e) {
667
+ e.push("thicknessSampler", "refractionIntensitySampler", "translucencyIntensitySampler", "refractionSampler", "refractionSamplerLow", "refractionSamplerHigh", "translucencyColorSampler");
668
+ }
669
+ getUniforms() {
670
+ return {
671
+ ubo: [
672
+ { name: "vRefractionMicrosurfaceInfos", size: 4, type: "vec4" },
673
+ { name: "vRefractionFilteringInfo", size: 2, type: "vec2" },
674
+ { name: "vTranslucencyIntensityInfos", size: 2, type: "vec2" },
675
+ { name: "vRefractionInfos", size: 4, type: "vec4" },
676
+ { name: "refractionMatrix", size: 16, type: "mat4" },
677
+ { name: "vThicknessInfos", size: 2, type: "vec2" },
678
+ { name: "vRefractionIntensityInfos", size: 2, type: "vec2" },
679
+ { name: "thicknessMatrix", size: 16, type: "mat4" },
680
+ { name: "refractionIntensityMatrix", size: 16, type: "mat4" },
681
+ { name: "translucencyIntensityMatrix", size: 16, type: "mat4" },
682
+ { name: "vThicknessParam", size: 2, type: "vec2" },
683
+ { name: "vDiffusionDistance", size: 3, type: "vec3" },
684
+ { name: "vTintColor", size: 4, type: "vec4" },
685
+ { name: "vSubSurfaceIntensity", size: 3, type: "vec3" },
686
+ { name: "vRefractionPosition", size: 3, type: "vec3" },
687
+ { name: "vRefractionSize", size: 3, type: "vec3" },
688
+ { name: "scatteringDiffusionProfile", size: 1, type: "float" },
689
+ { name: "dispersion", size: 1, type: "float" },
690
+ { name: "vTranslucencyColor", size: 4, type: "vec4" },
691
+ { name: "vTranslucencyColorInfos", size: 2, type: "vec2" },
692
+ { name: "translucencyColorMatrix", size: 16, type: "mat4" }
693
+ ]
694
+ };
695
+ }
696
+ }
697
+ E.DEFAULT_APPLY_ALBEDO_AFTERSUBSURFACE = !1;
698
+ E.DEFAULT_LEGACY_TRANSLUCENCY = !1;
699
+ s([
700
+ a(),
701
+ r("_markAllSubMeshesAsTexturesDirty")
702
+ ], E.prototype, "isRefractionEnabled", void 0);
703
+ s([
704
+ a(),
705
+ r("_markAllSubMeshesAsTexturesDirty")
706
+ ], E.prototype, "isTranslucencyEnabled", void 0);
707
+ s([
708
+ a(),
709
+ r("_markAllSubMeshesAsTexturesDirty")
710
+ ], E.prototype, "isDispersionEnabled", void 0);
711
+ s([
712
+ a(),
713
+ r("_markScenePrePassDirty")
714
+ ], E.prototype, "isScatteringEnabled", void 0);
715
+ s([
716
+ a()
717
+ ], E.prototype, "_scatteringDiffusionProfileIndex", void 0);
718
+ s([
719
+ a()
720
+ ], E.prototype, "refractionIntensity", void 0);
721
+ s([
722
+ a()
723
+ ], E.prototype, "translucencyIntensity", void 0);
724
+ s([
725
+ a(),
726
+ r("_markAllSubMeshesAsTexturesDirty")
727
+ ], E.prototype, "useAlbedoToTintRefraction", void 0);
728
+ s([
729
+ a(),
730
+ r("_markAllSubMeshesAsTexturesDirty")
731
+ ], E.prototype, "useAlbedoToTintTranslucency", void 0);
732
+ s([
733
+ x(),
734
+ r("_markAllSubMeshesAsTexturesDirty")
735
+ ], E.prototype, "thicknessTexture", void 0);
736
+ s([
737
+ x(),
738
+ r("_markAllSubMeshesAsTexturesDirty")
739
+ ], E.prototype, "refractionTexture", void 0);
740
+ s([
741
+ a(),
742
+ r("_markAllSubMeshesAsTexturesDirty")
743
+ ], E.prototype, "indexOfRefraction", void 0);
744
+ s([
745
+ a()
746
+ ], E.prototype, "_volumeIndexOfRefraction", void 0);
747
+ s([
748
+ r("_markAllSubMeshesAsTexturesDirty")
749
+ ], E.prototype, "volumeIndexOfRefraction", null);
750
+ s([
751
+ a(),
752
+ r("_markAllSubMeshesAsTexturesDirty")
753
+ ], E.prototype, "invertRefractionY", void 0);
754
+ s([
755
+ a(),
756
+ r("_markAllSubMeshesAsTexturesDirty")
757
+ ], E.prototype, "linkRefractionWithTransparency", void 0);
758
+ s([
759
+ a()
760
+ ], E.prototype, "minimumThickness", void 0);
761
+ s([
762
+ a()
763
+ ], E.prototype, "maximumThickness", void 0);
764
+ s([
765
+ a()
766
+ ], E.prototype, "useThicknessAsDepth", void 0);
767
+ s([
768
+ M()
769
+ ], E.prototype, "tintColor", void 0);
770
+ s([
771
+ a()
772
+ ], E.prototype, "tintColorAtDistance", void 0);
773
+ s([
774
+ a()
775
+ ], E.prototype, "dispersion", void 0);
776
+ s([
777
+ M()
778
+ ], E.prototype, "diffusionDistance", void 0);
779
+ s([
780
+ a(),
781
+ r("_markAllSubMeshesAsTexturesDirty")
782
+ ], E.prototype, "useMaskFromThicknessTexture", void 0);
783
+ s([
784
+ x(),
785
+ r("_markAllSubMeshesAsTexturesDirty")
786
+ ], E.prototype, "refractionIntensityTexture", void 0);
787
+ s([
788
+ x(),
789
+ r("_markAllSubMeshesAsTexturesDirty")
790
+ ], E.prototype, "translucencyIntensityTexture", void 0);
791
+ s([
792
+ M()
793
+ ], E.prototype, "translucencyColor", void 0);
794
+ s([
795
+ x(),
796
+ r("_markAllSubMeshesAsTexturesDirty")
797
+ ], E.prototype, "translucencyColorTexture", void 0);
798
+ s([
799
+ a(),
800
+ r("_markAllSubMeshesAsTexturesDirty")
801
+ ], E.prototype, "useGltfStyleTextures", void 0);
802
+ s([
803
+ a()
804
+ ], E.prototype, "applyAlbedoAfterSubSurface", void 0);
805
+ s([
806
+ a()
807
+ ], E.prototype, "legacyTranslucency", void 0);
808
+ const U = { effect: null, subMesh: null };
809
+ class Ke extends He(Ge(v)) {
810
+ }
811
+ class Q extends ke(Ke) {
812
+ /**
813
+ * Initializes the PBR Material defines.
814
+ * @param externalProperties The external properties
815
+ */
816
+ constructor(e) {
817
+ super(e), this.PBR = !0, this.NUM_SAMPLES = "0", this.REALTIME_FILTERING = !1, this.IBL_CDF_FILTERING = !1, this.ALBEDO = !1, this.GAMMAALBEDO = !1, this.ALBEDODIRECTUV = 0, this.VERTEXCOLOR = !1, this.BASE_WEIGHT = !1, this.BASE_WEIGHTDIRECTUV = 0, this.BASE_DIFFUSE_ROUGHNESS = !1, this.BASE_DIFFUSE_ROUGHNESSDIRECTUV = 0, this.BAKED_VERTEX_ANIMATION_TEXTURE = !1, this.AMBIENT = !1, this.AMBIENTDIRECTUV = 0, this.AMBIENTINGRAYSCALE = !1, this.OPACITY = !1, this.VERTEXALPHA = !1, this.OPACITYDIRECTUV = 0, this.OPACITYRGB = !1, this.ALPHATEST = !1, this.DEPTHPREPASS = !1, this.ALPHABLEND = !1, this.ALPHAFROMALBEDO = !1, this.ALPHATESTVALUE = "0.5", this.SPECULAROVERALPHA = !1, this.RADIANCEOVERALPHA = !1, this.ALPHAFRESNEL = !1, this.LINEARALPHAFRESNEL = !1, this.PREMULTIPLYALPHA = !1, this.EMISSIVE = !1, this.EMISSIVEDIRECTUV = 0, this.GAMMAEMISSIVE = !1, this.REFLECTIVITY = !1, this.REFLECTIVITY_GAMMA = !1, this.REFLECTIVITYDIRECTUV = 0, this.SPECULARTERM = !1, this.MICROSURFACEFROMREFLECTIVITYMAP = !1, this.MICROSURFACEAUTOMATIC = !1, this.LODBASEDMICROSFURACE = !1, this.MICROSURFACEMAP = !1, this.MICROSURFACEMAPDIRECTUV = 0, this.METALLICWORKFLOW = !1, this.ROUGHNESSSTOREINMETALMAPALPHA = !1, this.ROUGHNESSSTOREINMETALMAPGREEN = !1, this.METALLNESSSTOREINMETALMAPBLUE = !1, this.AOSTOREINMETALMAPRED = !1, this.METALLIC_REFLECTANCE = !1, this.METALLIC_REFLECTANCE_GAMMA = !1, this.METALLIC_REFLECTANCEDIRECTUV = 0, this.METALLIC_REFLECTANCE_USE_ALPHA_ONLY = !1, this.REFLECTANCE = !1, this.REFLECTANCE_GAMMA = !1, this.REFLECTANCEDIRECTUV = 0, this.ENVIRONMENTBRDF = !1, this.ENVIRONMENTBRDF_RGBD = !1, this.NORMAL = !1, this.TANGENT = !1, this.BUMP = !1, this.BUMPDIRECTUV = 0, this.OBJECTSPACE_NORMALMAP = !1, this.PARALLAX = !1, this.PARALLAX_RHS = !1, this.PARALLAXOCCLUSION = !1, this.NORMALXYSCALE = !0, this.LIGHTMAP = !1, this.LIGHTMAPDIRECTUV = 0, this.USELIGHTMAPASSHADOWMAP = !1, this.GAMMALIGHTMAP = !1, this.RGBDLIGHTMAP = !1, this.REFLECTION = !1, this.REFLECTIONMAP_3D = !1, this.REFLECTIONMAP_SPHERICAL = !1, this.REFLECTIONMAP_PLANAR = !1, this.REFLECTIONMAP_CUBIC = !1, this.USE_LOCAL_REFLECTIONMAP_CUBIC = !1, this.REFLECTIONMAP_PROJECTION = !1, this.REFLECTIONMAP_SKYBOX = !1, this.REFLECTIONMAP_EXPLICIT = !1, this.REFLECTIONMAP_EQUIRECTANGULAR = !1, this.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = !1, this.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = !1, this.INVERTCUBICMAP = !1, this.USESPHERICALFROMREFLECTIONMAP = !1, this.USEIRRADIANCEMAP = !1, this.USE_IRRADIANCE_DOMINANT_DIRECTION = !1, this.USESPHERICALINVERTEX = !1, this.REFLECTIONMAP_OPPOSITEZ = !1, this.LODINREFLECTIONALPHA = !1, this.GAMMAREFLECTION = !1, this.RGBDREFLECTION = !1, this.LINEARSPECULARREFLECTION = !1, this.RADIANCEOCCLUSION = !1, this.HORIZONOCCLUSION = !1, this.INSTANCES = !1, this.THIN_INSTANCES = !1, this.INSTANCESCOLOR = !1, this.NUM_BONE_INFLUENCERS = 0, this.BonesPerMesh = 0, this.BONETEXTURE = !1, this.BONES_VELOCITY_ENABLED = !1, this.NONUNIFORMSCALING = !1, this.MORPHTARGETS = !1, this.MORPHTARGETS_POSITION = !1, this.MORPHTARGETS_NORMAL = !1, this.MORPHTARGETS_TANGENT = !1, this.MORPHTARGETS_UV = !1, this.MORPHTARGETS_UV2 = !1, this.MORPHTARGETS_COLOR = !1, this.MORPHTARGETTEXTURE_HASPOSITIONS = !1, this.MORPHTARGETTEXTURE_HASNORMALS = !1, this.MORPHTARGETTEXTURE_HASTANGENTS = !1, this.MORPHTARGETTEXTURE_HASUVS = !1, this.MORPHTARGETTEXTURE_HASUV2S = !1, this.MORPHTARGETTEXTURE_HASCOLORS = !1, this.NUM_MORPH_INFLUENCERS = 0, this.MORPHTARGETS_TEXTURE = !1, this.MULTIVIEW = !1, this.ORDER_INDEPENDENT_TRANSPARENCY = !1, this.ORDER_INDEPENDENT_TRANSPARENCY_16BITS = !1, this.USEPHYSICALLIGHTFALLOFF = !1, this.USEGLTFLIGHTFALLOFF = !1, this.TWOSIDEDLIGHTING = !1, this.MIRRORED = !1, this.SHADOWFLOAT = !1, this.CLIPPLANE = !1, this.CLIPPLANE2 = !1, this.CLIPPLANE3 = !1, this.CLIPPLANE4 = !1, this.CLIPPLANE5 = !1, this.CLIPPLANE6 = !1, this.POINTSIZE = !1, this.FOG = !1, this.LOGARITHMICDEPTH = !1, this.CAMERA_ORTHOGRAPHIC = !1, this.CAMERA_PERSPECTIVE = !1, this.AREALIGHTSUPPORTED = !0, this.FORCENORMALFORWARD = !1, this.SPECULARAA = !1, this.UNLIT = !1, this.DECAL_AFTER_DETAIL = !1, this.TEXTURE_REPETITION_MODE = 0, this.DEBUGMODE = 0, this.USE_VERTEX_PULLING = !1, this.VERTEX_PULLING_USE_INDEX_BUFFER = !1, this.VERTEX_PULLING_INDEX_BUFFER_32BITS = !1, this.RIGHT_HANDED = !1, this.CLUSTLIGHT_SLICES = 0, this.CLUSTLIGHT_BATCH = 0, this.rebuild();
818
+ }
819
+ /**
820
+ * Resets the PBR Material defines.
821
+ */
822
+ reset() {
823
+ super.reset(), this.ALPHATESTVALUE = "0.5", this.PBR = !0, this.NORMALXYSCALE = !0;
824
+ }
825
+ }
826
+ class Qe extends Ue(Pe) {
827
+ }
828
+ class f extends Qe {
829
+ /**
830
+ * Enables realtime filtering on the texture.
831
+ */
832
+ get realTimeFiltering() {
833
+ return this._realTimeFiltering;
834
+ }
835
+ set realTimeFiltering(e) {
836
+ this._realTimeFiltering = e, this.markAsDirty(1);
837
+ }
838
+ /**
839
+ * Quality switch for realtime filtering
840
+ */
841
+ get realTimeFilteringQuality() {
842
+ return this._realTimeFilteringQuality;
843
+ }
844
+ set realTimeFilteringQuality(e) {
845
+ this._realTimeFilteringQuality = e, this.markAsDirty(1);
846
+ }
847
+ /**
848
+ * Can this material render to several textures at once
849
+ */
850
+ get canRenderToMRT() {
851
+ return !0;
852
+ }
853
+ /**
854
+ * Instantiates a new PBRMaterial instance.
855
+ *
856
+ * @param name The material name
857
+ * @param scene The scene the material will be use in.
858
+ * @param forceGLSL Use the GLSL code generation for the shader (even on WebGPU). Default is false
859
+ */
860
+ constructor(e, i, t = !1) {
861
+ super(e, i, void 0, t || f.ForceGLSL), this._directIntensity = 1, this._emissiveIntensity = 1, this._environmentIntensity = 1, this._specularIntensity = 1, this._lightingInfos = new te(this._directIntensity, this._emissiveIntensity, this._environmentIntensity, this._specularIntensity), this._disableBumpMap = !1, this._albedoTexture = null, this._baseWeightTexture = null, this._baseDiffuseRoughnessTexture = null, this._ambientTexture = null, this._ambientTextureStrength = 1, this._ambientTextureImpactOnAnalyticalLights = f.DEFAULT_AO_ON_ANALYTICAL_LIGHTS, this._opacityTexture = null, this._reflectionTexture = null, this._emissiveTexture = null, this._reflectivityTexture = null, this._metallicTexture = null, this._metallic = null, this._roughness = null, this._metallicF0Factor = 1, this._metallicReflectanceColor = d.White(), this._useOnlyMetallicFromMetallicReflectanceTexture = !1, this._metallicReflectanceTexture = null, this._reflectanceTexture = null, this._microSurfaceTexture = null, this._bumpTexture = null, this._lightmapTexture = null, this._ambientColor = new d(0, 0, 0), this._albedoColor = new d(1, 1, 1), this._baseWeight = 1, this._baseDiffuseRoughness = null, this._reflectivityColor = new d(1, 1, 1), this._reflectionColor = new d(1, 1, 1), this._emissiveColor = new d(0, 0, 0), this._microSurface = 0.9, this._useLightmapAsShadowmap = !1, this._useHorizonOcclusion = !0, this._useRadianceOcclusion = !0, this._useAlphaFromAlbedoTexture = !1, this._useSpecularOverAlpha = !0, this._useMicroSurfaceFromReflectivityMapAlpha = !1, this._useRoughnessFromMetallicTextureAlpha = !0, this._useRoughnessFromMetallicTextureGreen = !1, this._useMetallnessFromMetallicTextureBlue = !1, this._useAmbientOcclusionFromMetallicTextureRed = !1, this._useAmbientInGrayScale = !1, this._useAutoMicroSurfaceFromReflectivityMap = !1, this._lightFalloff = f.LIGHTFALLOFF_PHYSICAL, this._useRadianceOverAlpha = !0, this._useObjectSpaceNormalMap = !1, this._useParallax = !1, this._useParallaxOcclusion = !1, this._parallaxScaleBias = 0.05, this._disableLighting = !1, this._maxSimultaneousLights = 4, this._invertNormalMapX = !1, this._invertNormalMapY = !1, this._twoSidedLighting = !1, this._alphaCutOff = 0.4, this._useAlphaFresnel = !1, this._useLinearAlphaFresnel = !1, this._environmentBRDFTexture = null, this._forceIrradianceInFragment = !1, this._realTimeFiltering = !1, this._realTimeFilteringQuality = 8, this._forceNormalForward = !1, this._enableSpecularAntiAliasing = !1, this._renderTargets = new se(16), this._globalAmbientColor = new d(0, 0, 0), this._unlit = !1, this._applyDecalMapAfterDetailMap = !1, this._debugMode = 0, this._shadersLoaded = !1, this._breakShaderLoadedCheck = !1, this._vertexPullingMetadata = null, this.debugMode = 0, this.debugLimit = -1, this.debugFactor = 1, this._cacheHasRenderTargetTextures = !1, this.brdf = new c(this), this.clearCoat = new m(this), this.iridescence = new b(this), this.anisotropy = new k(this), this.sheen = new g(this), this.subSurface = new E(this), this.detailMap = new ie(this), this._attachImageProcessingConfiguration(null), this.getRenderTargetTextures = () => (this._renderTargets.reset(), l.ReflectionTextureEnabled && this._reflectionTexture && this._reflectionTexture.isRenderTarget && this._renderTargets.push(this._reflectionTexture), this._eventInfo.renderTargets = this._renderTargets, this._callbackPluginEventFillRenderTargetTextures(this._eventInfo), this._renderTargets), this._environmentBRDFTexture = Z(this.getScene()), this.prePassConfiguration = new w();
862
+ }
863
+ /**
864
+ * Gets a boolean indicating that current material needs to register RTT
865
+ */
866
+ get hasRenderTargetTextures() {
867
+ return l.ReflectionTextureEnabled && this._reflectionTexture && this._reflectionTexture.isRenderTarget ? !0 : this._cacheHasRenderTargetTextures;
868
+ }
869
+ /**
870
+ * Can this material render to prepass
871
+ */
872
+ get isPrePassCapable() {
873
+ return !this.disableDepthWrite;
874
+ }
875
+ /**
876
+ * @returns the name of the material class.
877
+ */
878
+ getClassName() {
879
+ return "PBRBaseMaterial";
880
+ }
881
+ /**
882
+ * Returns true if alpha blending should be disabled.
883
+ */
884
+ get _disableAlphaBlending() {
885
+ return this._transparencyMode === f.PBRMATERIAL_OPAQUE || this._transparencyMode === f.PBRMATERIAL_ALPHATEST || this.subSurface?.disableAlphaBlending;
886
+ }
887
+ /**
888
+ * @returns whether or not this material should be rendered in alpha blend mode.
889
+ */
890
+ needAlphaBlending() {
891
+ return this._hasTransparencyMode ? this._transparencyModeIsBlend : this._disableAlphaBlending ? !1 : this.alpha < 1 || this._opacityTexture != null || this._shouldUseAlphaFromAlbedoTexture();
892
+ }
893
+ /**
894
+ * @returns whether or not this material should be rendered in alpha test mode.
895
+ */
896
+ needAlphaTesting() {
897
+ return this._hasTransparencyMode ? this._transparencyModeIsTest : this.subSurface?.disableAlphaBlending ? !1 : this._hasAlphaChannel() && (this._transparencyMode == null || this._transparencyMode === f.PBRMATERIAL_ALPHATEST);
898
+ }
899
+ /**
900
+ * @returns whether or not the alpha value of the albedo texture should be used for alpha blending.
901
+ */
902
+ _shouldUseAlphaFromAlbedoTexture() {
903
+ return this._albedoTexture != null && this._albedoTexture.hasAlpha && this._useAlphaFromAlbedoTexture && this._transparencyMode !== f.PBRMATERIAL_OPAQUE;
904
+ }
905
+ /**
906
+ * @returns whether or not there is a usable alpha channel for transparency.
907
+ */
908
+ _hasAlphaChannel() {
909
+ return this._albedoTexture != null && this._albedoTexture.hasAlpha || this._opacityTexture != null;
910
+ }
911
+ /**
912
+ * @returns the texture used for the alpha test.
913
+ */
914
+ getAlphaTestTexture() {
915
+ return this._albedoTexture;
916
+ }
917
+ /**
918
+ * Specifies that the submesh is ready to be used.
919
+ * @param mesh - BJS mesh.
920
+ * @param subMesh - A submesh of the BJS mesh. Used to check if it is ready.
921
+ * @param useInstances - Specifies that instances should be used.
922
+ * @returns - boolean indicating that the submesh is ready or not.
923
+ */
924
+ isReadyForSubMesh(e, i, t) {
925
+ this._uniformBufferLayoutBuilt || this.buildUniformLayout();
926
+ const o = i._drawWrapper;
927
+ if (o.effect && this.isFrozen && o._wasPreviouslyReady && o._wasPreviouslyUsingInstances === t)
928
+ return !0;
929
+ i.materialDefines || (this._callbackPluginEventGeneric(4, this._eventInfo), i.materialDefines = new Q(this._eventInfo.defineNames));
930
+ const h = i.materialDefines;
931
+ if (this._isReadyForSubMesh(i))
932
+ return !0;
933
+ const R = this.getScene(), S = R.getEngine();
934
+ if (h._areTexturesDirty && (this._eventInfo.hasRenderTargetTextures = !1, this._callbackPluginEventHasRenderTargetTextures(this._eventInfo), this._cacheHasRenderTargetTextures = this._eventInfo.hasRenderTargetTextures, R.texturesEnabled)) {
935
+ if (this._albedoTexture && l.DiffuseTextureEnabled && !this._albedoTexture.isReadyOrNotBlocking() || this._baseWeightTexture && l.BaseWeightTextureEnabled && !this._baseWeightTexture.isReadyOrNotBlocking() || this._baseDiffuseRoughnessTexture && l.BaseDiffuseRoughnessTextureEnabled && !this._baseDiffuseRoughnessTexture.isReadyOrNotBlocking() || this._ambientTexture && l.AmbientTextureEnabled && !this._ambientTexture.isReadyOrNotBlocking() || this._opacityTexture && l.OpacityTextureEnabled && !this._opacityTexture.isReadyOrNotBlocking())
936
+ return !1;
937
+ const n = this._getReflectionTexture();
938
+ if (n && l.ReflectionTextureEnabled) {
939
+ if (!n.isReadyOrNotBlocking())
940
+ return !1;
941
+ if (n.irradianceTexture) {
942
+ if (!n.irradianceTexture.isReadyOrNotBlocking())
943
+ return !1;
944
+ } else if (!n.sphericalPolynomial && n.getInternalTexture()?._sphericalPolynomialPromise)
945
+ return !1;
946
+ }
947
+ if (this._lightmapTexture && l.LightmapTextureEnabled && !this._lightmapTexture.isReadyOrNotBlocking() || this._emissiveTexture && l.EmissiveTextureEnabled && !this._emissiveTexture.isReadyOrNotBlocking())
948
+ return !1;
949
+ if (l.SpecularTextureEnabled) {
950
+ if (this._metallicTexture) {
951
+ if (!this._metallicTexture.isReadyOrNotBlocking())
952
+ return !1;
953
+ } else if (this._reflectivityTexture && !this._reflectivityTexture.isReadyOrNotBlocking())
954
+ return !1;
955
+ if (this._metallicReflectanceTexture && !this._metallicReflectanceTexture.isReadyOrNotBlocking() || this._reflectanceTexture && !this._reflectanceTexture.isReadyOrNotBlocking() || this._microSurfaceTexture && !this._microSurfaceTexture.isReadyOrNotBlocking())
956
+ return !1;
957
+ }
958
+ if (S.getCaps().standardDerivatives && this._bumpTexture && l.BumpTextureEnabled && !this._disableBumpMap && !this._bumpTexture.isReady() || this._environmentBRDFTexture && l.ReflectionTextureEnabled && !this._environmentBRDFTexture.isReady())
959
+ return !1;
960
+ }
961
+ if (this._eventInfo.isReadyForSubMesh = !0, this._eventInfo.defines = h, this._eventInfo.subMesh = i, this._callbackPluginEventIsReadyForSubMesh(this._eventInfo), !this._eventInfo.isReadyForSubMesh || h._areImageProcessingDirty && this._imageProcessingConfiguration && !this._imageProcessingConfiguration.isReady())
962
+ return !1;
963
+ if (h.AREALIGHTUSED || h.CLUSTLIGHT_BATCH) {
964
+ for (let n = 0; n < e.lightSources.length; n++)
965
+ if (!e.lightSources[n]._isReady())
966
+ return !1;
967
+ }
968
+ if (!S.getCaps().standardDerivatives && !e.isVerticesDataPresent(F.NormalKind) && (e.createNormals(!0), re.Warn("PBRMaterial: Normals have been created for the mesh: " + e.name)), !ae(R, e, this._maxSimultaneousLights, this._disableLighting))
969
+ return !1;
970
+ const C = i.effect, A = h._areLightsDisposed, T = this._prepareEffect(e, i.getRenderingMesh(), h, this.onCompiled, this.onError, t, null);
971
+ let _ = !1;
972
+ if (T)
973
+ if (this._onEffectCreatedObservable && (U.effect = T, U.subMesh = i, this._onEffectCreatedObservable.notifyObservers(U)), this.allowShaderHotSwapping && C && !T.isReady()) {
974
+ if (h.markAsUnprocessed(), _ = this.isFrozen, A)
975
+ return h._areLightsDisposed = !0, !1;
976
+ } else
977
+ R.resetCachedMaterial(), i.setEffect(T, h, this._materialContext);
978
+ return !i.effect || !i.effect.isReady() ? !1 : (h._renderId = R.getRenderId(), o._wasPreviouslyReady = !_, o._wasPreviouslyUsingInstances = !!t, this._checkScenePerformancePriority(), !0);
979
+ }
980
+ /**
981
+ * Specifies if the material uses metallic roughness workflow.
982
+ * @returns boolean specifying if the material uses metallic roughness workflow.
983
+ */
984
+ isMetallicWorkflow() {
985
+ return !!(this._metallic != null || this._roughness != null || this._metallicTexture);
986
+ }
987
+ _prepareEffect(e, i, t, o = null, h = null, R = null, S = null) {
988
+ if (this._prepareDefines(e, i, t, R, S), !t.isDirty)
989
+ return null;
990
+ t.markAsProcessed();
991
+ const A = this.getScene().getEngine(), T = new le();
992
+ let _ = 0;
993
+ t.USESPHERICALINVERTEX && T.addFallback(_++, "USESPHERICALINVERTEX"), t.FOG && T.addFallback(_, "FOG"), t.SPECULARAA && T.addFallback(_, "SPECULARAA"), t.POINTSIZE && T.addFallback(_, "POINTSIZE"), t.LOGARITHMICDEPTH && T.addFallback(_, "LOGARITHMICDEPTH"), t.PARALLAX && T.addFallback(_, "PARALLAX"), t.PARALLAX_RHS && T.addFallback(_, "PARALLAX_RHS"), t.PARALLAXOCCLUSION && T.addFallback(_++, "PARALLAXOCCLUSION"), t.ENVIRONMENTBRDF && T.addFallback(_++, "ENVIRONMENTBRDF"), t.TANGENT && T.addFallback(_++, "TANGENT"), t.BUMP && T.addFallback(_++, "BUMP"), _ = ne(t, T, this._maxSimultaneousLights, _), t.SPECULARTERM && T.addFallback(_++, "SPECULARTERM"), t.USESPHERICALFROMREFLECTIONMAP && T.addFallback(_++, "USESPHERICALFROMREFLECTIONMAP"), t.USEIRRADIANCEMAP && T.addFallback(_++, "USEIRRADIANCEMAP"), t.LIGHTMAP && T.addFallback(_++, "LIGHTMAP"), t.NORMAL && T.addFallback(_++, "NORMAL"), t.AMBIENT && T.addFallback(_++, "AMBIENT"), t.EMISSIVE && T.addFallback(_++, "EMISSIVE"), t.VERTEXCOLOR && T.addFallback(_++, "VERTEXCOLOR"), t.MORPHTARGETS && T.addFallback(_++, "MORPHTARGETS"), t.MULTIVIEW && T.addFallback(0, "MULTIVIEW");
994
+ const n = [F.PositionKind];
995
+ t.NORMAL && n.push(F.NormalKind), t.TANGENT && n.push(F.TangentKind);
996
+ for (let D = 1; D <= 6; ++D)
997
+ t["UV" + D] && n.push(`uv${D === 1 ? "" : D}`);
998
+ t.VERTEXCOLOR && n.push(F.ColorKind), ue(n, e, t, T), oe(n, t), he(n, e, t), Te(n, e, t);
999
+ let L = "pbr";
1000
+ const y = [
1001
+ "world",
1002
+ "view",
1003
+ "viewProjection",
1004
+ "vEyePosition",
1005
+ "vLightsType",
1006
+ "vAmbientColor",
1007
+ "vAlbedoColor",
1008
+ "baseWeight",
1009
+ "baseDiffuseRoughness",
1010
+ "vReflectivityColor",
1011
+ "vMetallicReflectanceFactors",
1012
+ "vEmissiveColor",
1013
+ "visibility",
1014
+ "vFogInfos",
1015
+ "vFogColor",
1016
+ "pointSize",
1017
+ "vAlbedoInfos",
1018
+ "vBaseWeightInfos",
1019
+ "vBaseDiffuseRoughnessInfos",
1020
+ "vAmbientInfos",
1021
+ "vOpacityInfos",
1022
+ "vEmissiveInfos",
1023
+ "vReflectivityInfos",
1024
+ "vMetallicReflectanceInfos",
1025
+ "vReflectanceInfos",
1026
+ "vMicroSurfaceSamplerInfos",
1027
+ "vBumpInfos",
1028
+ "vLightmapInfos",
1029
+ "mBones",
1030
+ "albedoMatrix",
1031
+ "baseWeightMatrix",
1032
+ "baseDiffuseRoughnessMatrix",
1033
+ "ambientMatrix",
1034
+ "opacityMatrix",
1035
+ "emissiveMatrix",
1036
+ "reflectivityMatrix",
1037
+ "normalMatrix",
1038
+ "microSurfaceSamplerMatrix",
1039
+ "bumpMatrix",
1040
+ "lightmapMatrix",
1041
+ "metallicReflectanceMatrix",
1042
+ "reflectanceMatrix",
1043
+ "vLightingIntensity",
1044
+ "logarithmicDepthConstant",
1045
+ "vTangentSpaceParams",
1046
+ "boneTextureInfo",
1047
+ "vDebugMode",
1048
+ "morphTargetTextureInfo",
1049
+ "morphTargetTextureIndices",
1050
+ "cameraInfo",
1051
+ "vTextureRepetitionHexTilingParams"
1052
+ ], O = [
1053
+ "albedoSampler",
1054
+ "baseWeightSampler",
1055
+ "baseDiffuseRoughnessSampler",
1056
+ "reflectivitySampler",
1057
+ "ambientSampler",
1058
+ "emissiveSampler",
1059
+ "bumpSampler",
1060
+ "lightmapSampler",
1061
+ "opacitySampler",
1062
+ "microSurfaceSampler",
1063
+ "environmentBrdfSampler",
1064
+ "boneSampler",
1065
+ "metallicReflectanceSampler",
1066
+ "reflectanceSampler",
1067
+ "morphTargets",
1068
+ "oitDepthSampler",
1069
+ "oitFrontColorSampler",
1070
+ "areaLightsLTC1Sampler",
1071
+ "areaLightsLTC2Sampler"
1072
+ ];
1073
+ _e(y, O, !0);
1074
+ const B = ["Material", "Scene", "Mesh"], W = { maxSimultaneousLights: this._maxSimultaneousLights, maxSimultaneousMorphTargets: t.NUM_MORPH_INFLUENCERS };
1075
+ if (this._eventInfo.fallbacks = T, this._eventInfo.fallbackRank = _, this._eventInfo.defines = t, this._eventInfo.uniforms = y, this._eventInfo.attributes = n, this._eventInfo.samplers = O, this._eventInfo.uniformBuffersNames = B, this._eventInfo.customCode = void 0, this._eventInfo.mesh = e, this._eventInfo.indexParameters = W, this._callbackPluginEventGeneric(128, this._eventInfo), X.AddUniformsAndSamplers(y, O), w.AddUniforms(y), ce(y), this._useVertexPulling) {
1076
+ const D = i?.geometry;
1077
+ D && (this._vertexPullingMetadata = Ee(D), this._vertexPullingMetadata && this._vertexPullingMetadata.forEach((Ze, $) => {
1078
+ y.push(`vp_${$}_info`);
1079
+ }));
1080
+ } else
1081
+ this._vertexPullingMetadata = null;
1082
+ Y && (Y.PrepareUniforms(y, t), Y.PrepareSamplers(O, t)), Ae({
1083
+ uniformsNames: y,
1084
+ uniformBuffersNames: B,
1085
+ samplers: O,
1086
+ defines: t,
1087
+ maxSimultaneousLights: this._maxSimultaneousLights,
1088
+ shaderLanguage: this._shaderLanguage
1089
+ });
1090
+ const z = {};
1091
+ this.customShaderNameResolve && (L = this.customShaderNameResolve(L, y, B, O, t, n, z));
1092
+ const j = t.toString(), J = A.createEffect(L, {
1093
+ attributes: n,
1094
+ uniformsNames: y,
1095
+ uniformBuffersNames: B,
1096
+ samplers: O,
1097
+ defines: j,
1098
+ fallbacks: T,
1099
+ onCompiled: o,
1100
+ onError: h,
1101
+ indexParameters: W,
1102
+ processFinalCode: z.processFinalCode,
1103
+ processCodeAfterIncludes: this._eventInfo.customCode,
1104
+ multiTarget: t.PREPASS,
1105
+ shaderLanguage: this._shaderLanguage,
1106
+ extraInitializationsAsync: this._shadersLoaded ? void 0 : async () => {
1107
+ this.shaderLanguage === 1 ? await Promise.all([import("./pbr.vertex-DJMAkDxs.js"), import("./pbr.fragment-CYZk_EGU.js")]) : await Promise.all([import("./pbr.vertex-CyvdCw91.js"), import("./pbr.fragment-BnaAAGxb.js")]), this._shadersLoaded = !0;
1108
+ }
1109
+ }, A);
1110
+ return this._eventInfo.customCode = void 0, J;
1111
+ }
1112
+ _prepareDefines(e, i, t, o = null, h = null) {
1113
+ const R = i.hasThinInstances, S = this.getScene(), C = S.getEngine();
1114
+ fe(S, e, t, !0, this._maxSimultaneousLights, this._disableLighting), t._needNormals = !0, Se(S, t);
1115
+ const A = this.needAlphaBlendingForMesh(e) && this.getScene().useOrderIndependentTransparency;
1116
+ if (Re(S, t, this.canRenderToMRT && !A), xe(S, t, A), X.PrepareDefines(C.currentRenderPassId, e, t), t.METALLICWORKFLOW = this.isMetallicWorkflow(), t._areTexturesDirty) {
1117
+ t._needUVs = !1;
1118
+ for (let T = 1; T <= 6; ++T)
1119
+ t["MAINUV" + T] = !1;
1120
+ if (S.texturesEnabled) {
1121
+ t.ALBEDODIRECTUV = 0, t.BASE_WEIGHTDIRECTUV = 0, t.BASE_DIFFUSE_ROUGHNESSDIRECTUV = 0, t.AMBIENTDIRECTUV = 0, t.OPACITYDIRECTUV = 0, t.EMISSIVEDIRECTUV = 0, t.REFLECTIVITYDIRECTUV = 0, t.MICROSURFACEMAPDIRECTUV = 0, t.METALLIC_REFLECTANCEDIRECTUV = 0, t.REFLECTANCEDIRECTUV = 0, t.BUMPDIRECTUV = 0, t.LIGHTMAPDIRECTUV = 0, C.getCaps().textureLOD && (t.LODBASEDMICROSFURACE = !0), this._albedoTexture && l.DiffuseTextureEnabled ? (p(this._albedoTexture, t, "ALBEDO"), t.GAMMAALBEDO = this._albedoTexture.gammaSpace) : t.ALBEDO = !1, this._baseWeightTexture && l.BaseWeightTextureEnabled ? p(this._baseWeightTexture, t, "BASE_WEIGHT") : t.BASE_WEIGHT = !1, this._baseDiffuseRoughnessTexture && l.BaseDiffuseRoughnessTextureEnabled ? p(this._baseDiffuseRoughnessTexture, t, "BASE_DIFFUSE_ROUGHNESS") : t.BASE_DIFFUSE_ROUGHNESS = !1, this._ambientTexture && l.AmbientTextureEnabled ? (p(this._ambientTexture, t, "AMBIENT"), t.AMBIENTINGRAYSCALE = this._useAmbientInGrayScale) : t.AMBIENT = !1, this._opacityTexture && l.OpacityTextureEnabled ? (p(this._opacityTexture, t, "OPACITY"), t.OPACITYRGB = this._opacityTexture.getAlphaFromRGB) : t.OPACITY = !1;
1122
+ const T = this._getReflectionTexture(), _ = this._forceIrradianceInFragment || this.realTimeFiltering || this._twoSidedLighting || C.getCaps().maxVaryingVectors <= 8 || this._baseDiffuseRoughnessTexture != null;
1123
+ pe(S, T, t, this.realTimeFiltering, this.realTimeFilteringQuality, !_), this._lightmapTexture && l.LightmapTextureEnabled ? (p(this._lightmapTexture, t, "LIGHTMAP"), t.USELIGHTMAPASSHADOWMAP = this._useLightmapAsShadowmap, t.GAMMALIGHTMAP = this._lightmapTexture.gammaSpace, t.RGBDLIGHTMAP = this._lightmapTexture.isRGBD) : t.LIGHTMAP = !1, this._emissiveTexture && l.EmissiveTextureEnabled ? (p(this._emissiveTexture, t, "EMISSIVE"), t.GAMMAEMISSIVE = this._emissiveTexture.gammaSpace) : t.EMISSIVE = !1, l.SpecularTextureEnabled ? (this._metallicTexture ? (p(this._metallicTexture, t, "REFLECTIVITY"), t.ROUGHNESSSTOREINMETALMAPALPHA = this._useRoughnessFromMetallicTextureAlpha, t.ROUGHNESSSTOREINMETALMAPGREEN = !this._useRoughnessFromMetallicTextureAlpha && this._useRoughnessFromMetallicTextureGreen, t.METALLNESSSTOREINMETALMAPBLUE = this._useMetallnessFromMetallicTextureBlue, t.AOSTOREINMETALMAPRED = this._useAmbientOcclusionFromMetallicTextureRed, t.REFLECTIVITY_GAMMA = !1) : this._reflectivityTexture ? (p(this._reflectivityTexture, t, "REFLECTIVITY"), t.MICROSURFACEFROMREFLECTIVITYMAP = this._useMicroSurfaceFromReflectivityMapAlpha, t.MICROSURFACEAUTOMATIC = this._useAutoMicroSurfaceFromReflectivityMap, t.REFLECTIVITY_GAMMA = this._reflectivityTexture.gammaSpace) : t.REFLECTIVITY = !1, this._metallicReflectanceTexture || this._reflectanceTexture ? (t.METALLIC_REFLECTANCE_USE_ALPHA_ONLY = this._useOnlyMetallicFromMetallicReflectanceTexture, this._metallicReflectanceTexture ? (p(this._metallicReflectanceTexture, t, "METALLIC_REFLECTANCE"), t.METALLIC_REFLECTANCE_GAMMA = this._metallicReflectanceTexture.gammaSpace) : t.METALLIC_REFLECTANCE = !1, this._reflectanceTexture && (!this._metallicReflectanceTexture || this._metallicReflectanceTexture && this._useOnlyMetallicFromMetallicReflectanceTexture) ? (p(this._reflectanceTexture, t, "REFLECTANCE"), t.REFLECTANCE_GAMMA = this._reflectanceTexture.gammaSpace) : t.REFLECTANCE = !1) : (t.METALLIC_REFLECTANCE = !1, t.REFLECTANCE = !1), this._microSurfaceTexture ? p(this._microSurfaceTexture, t, "MICROSURFACEMAP") : t.MICROSURFACEMAP = !1) : (t.REFLECTIVITY = !1, t.MICROSURFACEMAP = !1), C.getCaps().standardDerivatives && this._bumpTexture && l.BumpTextureEnabled && !this._disableBumpMap ? (p(this._bumpTexture, t, "BUMP"), this._useParallax && this._albedoTexture && l.DiffuseTextureEnabled ? (t.PARALLAX = !0, t.PARALLAX_RHS = S.useRightHandedSystem, t.PARALLAXOCCLUSION = !!this._useParallaxOcclusion) : t.PARALLAX = !1, t.OBJECTSPACE_NORMALMAP = this._useObjectSpaceNormalMap) : (t.BUMP = !1, t.PARALLAX = !1, t.PARALLAX_RHS = !1, t.PARALLAXOCCLUSION = !1, t.OBJECTSPACE_NORMALMAP = !1), this._environmentBRDFTexture && l.ReflectionTextureEnabled ? (t.ENVIRONMENTBRDF = !0, t.ENVIRONMENTBRDF_RGBD = this._environmentBRDFTexture.isRGBD) : (t.ENVIRONMENTBRDF = !1, t.ENVIRONMENTBRDF_RGBD = !1), this._shouldUseAlphaFromAlbedoTexture() ? t.ALPHAFROMALBEDO = !0 : t.ALPHAFROMALBEDO = !1;
1124
+ }
1125
+ t.SPECULAROVERALPHA = this._useSpecularOverAlpha, this._lightFalloff === f.LIGHTFALLOFF_STANDARD ? (t.USEPHYSICALLIGHTFALLOFF = !1, t.USEGLTFLIGHTFALLOFF = !1) : this._lightFalloff === f.LIGHTFALLOFF_GLTF ? (t.USEPHYSICALLIGHTFALLOFF = !1, t.USEGLTFLIGHTFALLOFF = !0) : (t.USEPHYSICALLIGHTFALLOFF = !0, t.USEGLTFLIGHTFALLOFF = !1), t.RADIANCEOVERALPHA = this._useRadianceOverAlpha, !this.backFaceCulling && this._twoSidedLighting ? t.TWOSIDEDLIGHTING = !0 : t.TWOSIDEDLIGHTING = !1, t.MIRRORED = !!S._mirroredCameraPosition, t.SPECULARAA = C.getCaps().standardDerivatives && this._enableSpecularAntiAliasing;
1126
+ }
1127
+ (t._areTexturesDirty || t._areMiscDirty) && (t.ALPHATESTVALUE = `${this._alphaCutOff}${this._alphaCutOff % 1 === 0 ? "." : ""}`, t.PREMULTIPLYALPHA = this.alphaMode === 7 || this.alphaMode === 8, t.ALPHABLEND = this.needAlphaBlendingForMesh(e), t.ALPHAFRESNEL = this._useAlphaFresnel || this._useLinearAlphaFresnel, t.LINEARALPHAFRESNEL = this._useLinearAlphaFresnel), t._areTexturesDirty && (t.TEXTURE_REPETITION_MODE = C.version > 1 || C.isWebGPU ? this.textureRepetitionMode : 0), t._areImageProcessingDirty && this._imageProcessingConfiguration && this._imageProcessingConfiguration.prepareDefines(t), t.FORCENORMALFORWARD = this._forceNormalForward, t.RADIANCEOCCLUSION = this._useRadianceOcclusion, t.HORIZONOCCLUSION = this._useHorizonOcclusion, t._areMiscDirty && (Ie(e, S, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this.needAlphaTestingForMesh(e), t, this._applyDecalMapAfterDetailMap, this._useVertexPulling, i, this._isVertexOutputInvariant), t.UNLIT = this._unlit || (this.pointsCloud || this.wireframe) && !e.isVerticesDataPresent(F.NormalKind), t.DEBUGMODE = this._debugMode), Ce(S, C, this, t, !!o, h, R), this._eventInfo.defines = t, this._eventInfo.mesh = e, this._callbackPluginEventPrepareDefinesBeforeAttributes(this._eventInfo), me(e, t, !0, !0, !0, this._transparencyMode !== f.PBRMATERIAL_OPAQUE), this._callbackPluginEventPrepareDefines(this._eventInfo);
1128
+ }
1129
+ /**
1130
+ * Force shader compilation
1131
+ * @param mesh - Define the mesh we want to force the compilation for
1132
+ * @param onCompiled - Define a callback triggered when the compilation completes
1133
+ * @param options - Define the options used to create the compilation
1134
+ */
1135
+ forceCompilation(e, i, t) {
1136
+ const o = {
1137
+ clipPlane: !1,
1138
+ useInstances: !1,
1139
+ ...t
1140
+ };
1141
+ this._uniformBufferLayoutBuilt || this.buildUniformLayout(), this._callbackPluginEventGeneric(4, this._eventInfo), (() => {
1142
+ if (this._breakShaderLoadedCheck)
1143
+ return;
1144
+ const R = new Q(this._eventInfo.defineNames), S = this._prepareEffect(e, e, R, void 0, void 0, o.useInstances, o.clipPlane);
1145
+ this._onEffectCreatedObservable && (U.effect = S, U.subMesh = null, this._onEffectCreatedObservable.notifyObservers(U)), S.isReady() ? i && i(this) : S.onCompileObservable.add(() => {
1146
+ i && i(this);
1147
+ });
1148
+ })();
1149
+ }
1150
+ /**
1151
+ * Initializes the uniform buffer layout for the shader.
1152
+ */
1153
+ buildUniformLayout() {
1154
+ const e = this._uniformBuffer;
1155
+ e.addUniform("vAlbedoInfos", 2), e.addUniform("vBaseWeightInfos", 2), e.addUniform("vBaseDiffuseRoughnessInfos", 2), e.addUniform("vAmbientInfos", 4), e.addUniform("vOpacityInfos", 2), e.addUniform("vEmissiveInfos", 2), e.addUniform("vLightmapInfos", 2), e.addUniform("vReflectivityInfos", 3), e.addUniform("vMicroSurfaceSamplerInfos", 2), e.addUniform("vBumpInfos", 3), e.addUniform("albedoMatrix", 16), e.addUniform("baseWeightMatrix", 16), e.addUniform("baseDiffuseRoughnessMatrix", 16), e.addUniform("ambientMatrix", 16), e.addUniform("opacityMatrix", 16), e.addUniform("emissiveMatrix", 16), e.addUniform("lightmapMatrix", 16), e.addUniform("reflectivityMatrix", 16), e.addUniform("microSurfaceSamplerMatrix", 16), e.addUniform("bumpMatrix", 16), e.addUniform("vTangentSpaceParams", 2), e.addUniform("vAlbedoColor", 4), e.addUniform("baseWeight", 1), e.addUniform("baseDiffuseRoughness", 1), e.addUniform("vLightingIntensity", 4), e.addUniform("pointSize", 1), e.addUniform("vReflectivityColor", 4), e.addUniform("vEmissiveColor", 3), e.addUniform("vAmbientColor", 3), e.addUniform("vDebugMode", 2), e.addUniform("vMetallicReflectanceFactors", 4), e.addUniform("vMetallicReflectanceInfos", 2), e.addUniform("metallicReflectanceMatrix", 16), e.addUniform("vReflectanceInfos", 2), e.addUniform("reflectanceMatrix", 16), e.addUniform("cameraInfo", 4), e.addUniform("vTextureRepetitionHexTilingParams", 4), de(e, !0, !0, !0, !0, !0), super.buildUniformLayout();
1156
+ }
1157
+ /**
1158
+ * Binds the submesh data.
1159
+ * @param world - The world matrix.
1160
+ * @param mesh - The BJS mesh.
1161
+ * @param subMesh - A submesh of the BJS mesh.
1162
+ */
1163
+ bindForSubMesh(e, i, t) {
1164
+ const o = this.getScene(), h = t.materialDefines;
1165
+ if (!h)
1166
+ return;
1167
+ const R = t.effect;
1168
+ if (!R)
1169
+ return;
1170
+ this._activeEffect = R, i.getMeshUniformBuffer().bindToEffect(R, "Mesh"), i.transferToEffect(e);
1171
+ const S = o.getEngine();
1172
+ this._uniformBuffer.bindToEffect(R, "Material"), this.prePassConfiguration.bindForSubMesh(this._activeEffect, o, i, e, this.isFrozen), X.Bind(S.currentRenderPassId, this._activeEffect, i, e, this);
1173
+ const C = o.activeCamera;
1174
+ C ? this._uniformBuffer.updateFloat4("cameraInfo", C.minZ, C.maxZ, 0, 0) : this._uniformBuffer.updateFloat4("cameraInfo", 0, 0, 0, 0);
1175
+ const A = this.textureRepetitionHexTilingParams;
1176
+ this._uniformBuffer.updateFloat4("vTextureRepetitionHexTilingParams", A[0], A[1], A[2], A[3]), this._eventInfo.subMesh = t, this._callbackPluginEventHardBindForSubMesh(this._eventInfo), h.OBJECTSPACE_NORMALMAP && (e.toNormalMatrix(this._normalMatrix), this.bindOnlyNormalMatrix(this._normalMatrix));
1177
+ const T = this._mustRebind(o, R, t, i.visibility);
1178
+ be(i, this._activeEffect, this.prePassConfiguration), this._vertexPullingMetadata && ye(this._activeEffect, this._vertexPullingMetadata);
1179
+ let _ = null;
1180
+ const n = this._uniformBuffer;
1181
+ if (T) {
1182
+ if (this.bindViewProjection(R), _ = this._getReflectionTexture(), !n.useUbo || !this.isFrozen || !n.isSync || t._drawWrapper._forceRebindOnNextCall) {
1183
+ if (o.texturesEnabled && (this._albedoTexture && l.DiffuseTextureEnabled && (n.updateFloat2("vAlbedoInfos", this._albedoTexture.coordinatesIndex, this._albedoTexture.level), I(this._albedoTexture, n, "albedo")), this._baseWeightTexture && l.BaseWeightTextureEnabled && (n.updateFloat2("vBaseWeightInfos", this._baseWeightTexture.coordinatesIndex, this._baseWeightTexture.level), I(this._baseWeightTexture, n, "baseWeight")), this._baseDiffuseRoughnessTexture && l.BaseDiffuseRoughnessTextureEnabled && (n.updateFloat2("vBaseDiffuseRoughnessInfos", this._baseDiffuseRoughnessTexture.coordinatesIndex, this._baseDiffuseRoughnessTexture.level), I(this._baseDiffuseRoughnessTexture, n, "baseDiffuseRoughness")), this._ambientTexture && l.AmbientTextureEnabled && (n.updateFloat4("vAmbientInfos", this._ambientTexture.coordinatesIndex, this._ambientTexture.level, this._ambientTextureStrength, this._ambientTextureImpactOnAnalyticalLights), I(this._ambientTexture, n, "ambient")), this._opacityTexture && l.OpacityTextureEnabled && (n.updateFloat2("vOpacityInfos", this._opacityTexture.coordinatesIndex, this._opacityTexture.level), I(this._opacityTexture, n, "opacity")), this._emissiveTexture && l.EmissiveTextureEnabled && (n.updateFloat2("vEmissiveInfos", this._emissiveTexture.coordinatesIndex, this._emissiveTexture.level), I(this._emissiveTexture, n, "emissive")), this._lightmapTexture && l.LightmapTextureEnabled && (n.updateFloat2("vLightmapInfos", this._lightmapTexture.coordinatesIndex, this._lightmapTexture.level), I(this._lightmapTexture, n, "lightmap")), l.SpecularTextureEnabled && (this._metallicTexture ? (n.updateFloat3("vReflectivityInfos", this._metallicTexture.coordinatesIndex, this._metallicTexture.level, this._ambientTextureStrength), I(this._metallicTexture, n, "reflectivity")) : this._reflectivityTexture && (n.updateFloat3("vReflectivityInfos", this._reflectivityTexture.coordinatesIndex, this._reflectivityTexture.level, 1), I(this._reflectivityTexture, n, "reflectivity")), this._metallicReflectanceTexture && (n.updateFloat2("vMetallicReflectanceInfos", this._metallicReflectanceTexture.coordinatesIndex, this._metallicReflectanceTexture.level), I(this._metallicReflectanceTexture, n, "metallicReflectance")), this._reflectanceTexture && h.REFLECTANCE && (n.updateFloat2("vReflectanceInfos", this._reflectanceTexture.coordinatesIndex, this._reflectanceTexture.level), I(this._reflectanceTexture, n, "reflectance")), this._microSurfaceTexture && (n.updateFloat2("vMicroSurfaceSamplerInfos", this._microSurfaceTexture.coordinatesIndex, this._microSurfaceTexture.level), I(this._microSurfaceTexture, n, "microSurfaceSampler"))), this._bumpTexture && S.getCaps().standardDerivatives && l.BumpTextureEnabled && !this._disableBumpMap && (n.updateFloat3("vBumpInfos", this._bumpTexture.coordinatesIndex, this._bumpTexture.level, this._parallaxScaleBias), I(this._bumpTexture, n, "bump"), o._mirroredCameraPosition ? n.updateFloat2("vTangentSpaceParams", this._invertNormalMapX ? 1 : -1, this._invertNormalMapY ? 1 : -1) : n.updateFloat2("vTangentSpaceParams", this._invertNormalMapX ? -1 : 1, this._invertNormalMapY ? -1 : 1)), Le(o, h, n, this._reflectionColor, _, this.realTimeFiltering, !0, !0, !0, !0, !0)), this.pointsCloud && n.updateFloat("pointSize", this.pointSize), h.METALLICWORKFLOW) {
1184
+ H.Color4[0].r = this._metallic === void 0 || this._metallic === null ? 1 : this._metallic, H.Color4[0].g = this._roughness === void 0 || this._roughness === null ? 1 : this._roughness;
1185
+ const L = this.subSurface?._indexOfRefraction ?? 1.5, y = 1;
1186
+ H.Color4[0].b = L;
1187
+ const O = Math.pow((L - y) / (L + y), 2);
1188
+ H.Color4[0].a = O, n.updateDirectColor4("vReflectivityColor", H.Color4[0]), n.updateColor4("vMetallicReflectanceFactors", this._metallicReflectanceColor, this._metallicF0Factor);
1189
+ } else
1190
+ n.updateColor4("vReflectivityColor", this._reflectivityColor, this._microSurface);
1191
+ n.updateColor3("vEmissiveColor", l.EmissiveTextureEnabled ? this._emissiveColor : d.BlackReadOnly), !h.SS_REFRACTION && this.subSurface?._linkRefractionWithTransparency ? n.updateColor4("vAlbedoColor", this._albedoColor, 1) : n.updateColor4("vAlbedoColor", this._albedoColor, this.alpha), n.updateFloat("baseWeight", this._baseWeight), n.updateFloat("baseDiffuseRoughness", this._baseDiffuseRoughness || 0), this._lightingInfos.x = this._directIntensity, this._lightingInfos.y = this._emissiveIntensity, this._lightingInfos.z = this._environmentIntensity * o.environmentIntensity, this._lightingInfos.w = this._specularIntensity, n.updateVector4("vLightingIntensity", this._lightingInfos), o.ambientColor.multiplyToRef(this._ambientColor, this._globalAmbientColor), n.updateColor3("vAmbientColor", this._globalAmbientColor), n.updateFloat2("vDebugMode", this.debugLimit, this.debugFactor);
1192
+ }
1193
+ o.texturesEnabled && (this._albedoTexture && l.DiffuseTextureEnabled && n.setTexture("albedoSampler", this._albedoTexture), this._baseWeightTexture && l.BaseWeightTextureEnabled && n.setTexture("baseWeightSampler", this._baseWeightTexture), this._baseDiffuseRoughnessTexture && l.BaseDiffuseRoughnessTextureEnabled && n.setTexture("baseDiffuseRoughnessSampler", this._baseDiffuseRoughnessTexture), this._ambientTexture && l.AmbientTextureEnabled && n.setTexture("ambientSampler", this._ambientTexture), this._opacityTexture && l.OpacityTextureEnabled && n.setTexture("opacitySampler", this._opacityTexture), Me(o, h, n, _, this.realTimeFiltering), h.ENVIRONMENTBRDF && n.setTexture("environmentBrdfSampler", this._environmentBRDFTexture), this._emissiveTexture && l.EmissiveTextureEnabled && n.setTexture("emissiveSampler", this._emissiveTexture), this._lightmapTexture && l.LightmapTextureEnabled && n.setTexture("lightmapSampler", this._lightmapTexture), l.SpecularTextureEnabled && (this._metallicTexture ? n.setTexture("reflectivitySampler", this._metallicTexture) : this._reflectivityTexture && n.setTexture("reflectivitySampler", this._reflectivityTexture), this._metallicReflectanceTexture && n.setTexture("metallicReflectanceSampler", this._metallicReflectanceTexture), this._reflectanceTexture && h.REFLECTANCE && n.setTexture("reflectanceSampler", this._reflectanceTexture), this._microSurfaceTexture && n.setTexture("microSurfaceSampler", this._microSurfaceTexture)), this._bumpTexture && S.getCaps().standardDerivatives && l.BumpTextureEnabled && !this._disableBumpMap && n.setTexture("bumpSampler", this._bumpTexture)), this.getScene().useOrderIndependentTransparency && this.needAlphaBlendingForMesh(i) && this.getScene().depthPeelingRenderer.bind(R), this._eventInfo.subMesh = t, this._callbackPluginEventBindForSubMesh(this._eventInfo), Ne(this._activeEffect, this, o), this.bindEyePosition(R);
1194
+ } else o.getEngine()._features.needToAlwaysBindUniformBuffers && (this._needToBindSceneUbo = !0);
1195
+ (T || !this.isFrozen) && (o.lightsEnabled && !this._disableLighting && ge(o, i, this._activeEffect, h, this._maxSimultaneousLights), (o.fogEnabled && i.applyFog && o.fogMode !== Oe.FOGMODE_NONE || _ || this.subSurface.refractionTexture || i.receiveShadows || h.PREPASS || h.CLUSTLIGHT_BATCH) && this.bindView(R), De(o, i, this._activeEffect, !0), h.NUM_MORPH_INFLUENCERS && Fe(i, this._activeEffect), h.BAKED_VERTEX_ANIMATION_TEXTURE && i.bakedVertexAnimationManager?.bind(R, h.INSTANCES), this._imageProcessingConfiguration.bind(this._activeEffect), ve(h, this._activeEffect, o)), this._afterBind(i, this._activeEffect, t), n.update();
1196
+ }
1197
+ /**
1198
+ * Returns the animatable textures.
1199
+ * If material have animatable metallic texture, then reflectivity texture will not be returned, even if it has animations.
1200
+ * @returns - Array of animatable textures.
1201
+ */
1202
+ getAnimatables() {
1203
+ const e = super.getAnimatables();
1204
+ return this._albedoTexture && this._albedoTexture.animations && this._albedoTexture.animations.length > 0 && e.push(this._albedoTexture), this._baseWeightTexture && this._baseWeightTexture.animations && this._baseWeightTexture.animations.length > 0 && e.push(this._baseWeightTexture), this._baseDiffuseRoughnessTexture && this._baseDiffuseRoughnessTexture.animations && this._baseDiffuseRoughnessTexture.animations.length > 0 && e.push(this._baseDiffuseRoughnessTexture), this._ambientTexture && this._ambientTexture.animations && this._ambientTexture.animations.length > 0 && e.push(this._ambientTexture), this._opacityTexture && this._opacityTexture.animations && this._opacityTexture.animations.length > 0 && e.push(this._opacityTexture), this._reflectionTexture && this._reflectionTexture.animations && this._reflectionTexture.animations.length > 0 && e.push(this._reflectionTexture), this._emissiveTexture && this._emissiveTexture.animations && this._emissiveTexture.animations.length > 0 && e.push(this._emissiveTexture), this._metallicTexture && this._metallicTexture.animations && this._metallicTexture.animations.length > 0 ? e.push(this._metallicTexture) : this._reflectivityTexture && this._reflectivityTexture.animations && this._reflectivityTexture.animations.length > 0 && e.push(this._reflectivityTexture), this._bumpTexture && this._bumpTexture.animations && this._bumpTexture.animations.length > 0 && e.push(this._bumpTexture), this._lightmapTexture && this._lightmapTexture.animations && this._lightmapTexture.animations.length > 0 && e.push(this._lightmapTexture), this._metallicReflectanceTexture && this._metallicReflectanceTexture.animations && this._metallicReflectanceTexture.animations.length > 0 && e.push(this._metallicReflectanceTexture), this._reflectanceTexture && this._reflectanceTexture.animations && this._reflectanceTexture.animations.length > 0 && e.push(this._reflectanceTexture), this._microSurfaceTexture && this._microSurfaceTexture.animations && this._microSurfaceTexture.animations.length > 0 && e.push(this._microSurfaceTexture), e;
1205
+ }
1206
+ /**
1207
+ * Returns the texture used for reflections.
1208
+ * @returns - Reflection texture if present. Otherwise, returns the environment texture.
1209
+ */
1210
+ _getReflectionTexture() {
1211
+ return this._reflectionTexture ? this._reflectionTexture : this.getScene().environmentTexture;
1212
+ }
1213
+ /**
1214
+ * Returns an array of the actively used textures.
1215
+ * @returns - Array of BaseTextures
1216
+ */
1217
+ getActiveTextures() {
1218
+ const e = super.getActiveTextures();
1219
+ return this._albedoTexture && e.push(this._albedoTexture), this._baseWeightTexture && e.push(this._baseWeightTexture), this._baseDiffuseRoughnessTexture && e.push(this._baseDiffuseRoughnessTexture), this._ambientTexture && e.push(this._ambientTexture), this._opacityTexture && e.push(this._opacityTexture), this._reflectionTexture && e.push(this._reflectionTexture), this._emissiveTexture && e.push(this._emissiveTexture), this._reflectivityTexture && e.push(this._reflectivityTexture), this._metallicTexture && e.push(this._metallicTexture), this._metallicReflectanceTexture && e.push(this._metallicReflectanceTexture), this._reflectanceTexture && e.push(this._reflectanceTexture), this._microSurfaceTexture && e.push(this._microSurfaceTexture), this._bumpTexture && e.push(this._bumpTexture), this._lightmapTexture && e.push(this._lightmapTexture), e;
1220
+ }
1221
+ /**
1222
+ * Checks to see if a texture is used in the material.
1223
+ * @param texture - Base texture to use.
1224
+ * @returns - Boolean specifying if a texture is used in the material.
1225
+ */
1226
+ hasTexture(e) {
1227
+ return !!(super.hasTexture(e) || this._albedoTexture === e || this._baseWeightTexture === e || this._baseDiffuseRoughnessTexture === e || this._ambientTexture === e || this._opacityTexture === e || this._reflectionTexture === e || this._emissiveTexture === e || this._reflectivityTexture === e || this._metallicTexture === e || this._metallicReflectanceTexture === e || this._reflectanceTexture === e || this._microSurfaceTexture === e || this._bumpTexture === e || this._lightmapTexture === e);
1228
+ }
1229
+ /**
1230
+ * Sets the required values to the prepass renderer.
1231
+ * It can't be sets when subsurface scattering of this material is disabled.
1232
+ * When scene have ability to enable subsurface prepass effect, it will enable.
1233
+ * @returns - If prepass is enabled or not.
1234
+ */
1235
+ setPrePassRenderer() {
1236
+ if (!this.subSurface?.isScatteringEnabled)
1237
+ return !1;
1238
+ const e = this.getScene().enableSubSurfaceForPrePass();
1239
+ return e && (e.enabled = !0), !0;
1240
+ }
1241
+ /**
1242
+ * Disposes the resources of the material.
1243
+ * @param forceDisposeEffect - Forces the disposal of effects.
1244
+ * @param forceDisposeTextures - Forces the disposal of all textures.
1245
+ */
1246
+ dispose(e, i) {
1247
+ this._breakShaderLoadedCheck = !0, i && (this._environmentBRDFTexture && this.getScene().environmentBRDFTexture !== this._environmentBRDFTexture && this._environmentBRDFTexture.dispose(), this._albedoTexture?.dispose(), this._baseWeightTexture?.dispose(), this._baseDiffuseRoughnessTexture?.dispose(), this._ambientTexture?.dispose(), this._opacityTexture?.dispose(), this._reflectionTexture?.dispose(), this._emissiveTexture?.dispose(), this._metallicTexture?.dispose(), this._reflectivityTexture?.dispose(), this._bumpTexture?.dispose(), this._lightmapTexture?.dispose(), this._metallicReflectanceTexture?.dispose(), this._reflectanceTexture?.dispose(), this._microSurfaceTexture?.dispose()), this._renderTargets.dispose(), this._imageProcessingConfiguration && this._imageProcessingObserver && this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver), super.dispose(e, i);
1248
+ }
1249
+ }
1250
+ f.PBRMATERIAL_OPAQUE = G.MATERIAL_OPAQUE;
1251
+ f.PBRMATERIAL_ALPHATEST = G.MATERIAL_ALPHATEST;
1252
+ f.PBRMATERIAL_ALPHABLEND = G.MATERIAL_ALPHABLEND;
1253
+ f.PBRMATERIAL_ALPHATESTANDBLEND = G.MATERIAL_ALPHATESTANDBLEND;
1254
+ f.DEFAULT_AO_ON_ANALYTICAL_LIGHTS = 0;
1255
+ f.LIGHTFALLOFF_PHYSICAL = 0;
1256
+ f.LIGHTFALLOFF_GLTF = 1;
1257
+ f.LIGHTFALLOFF_STANDARD = 2;
1258
+ f.ForceGLSL = !1;
1259
+ s([
1260
+ r("_markAllSubMeshesAsMiscDirty")
1261
+ ], f.prototype, "debugMode", void 0);
1262
+ class u extends f {
1263
+ /**
1264
+ * Stores the refracted light information in a texture.
1265
+ */
1266
+ get refractionTexture() {
1267
+ return this.subSurface.refractionTexture;
1268
+ }
1269
+ set refractionTexture(e) {
1270
+ this.subSurface.refractionTexture = e, e ? this.subSurface.isRefractionEnabled = !0 : this.subSurface.linkRefractionWithTransparency || (this.subSurface.isRefractionEnabled = !1);
1271
+ }
1272
+ /**
1273
+ * Index of refraction of the material base layer.
1274
+ * https://en.wikipedia.org/wiki/List_of_refractive_indices
1275
+ *
1276
+ * This does not only impact refraction but also the Base F0 of Dielectric Materials.
1277
+ *
1278
+ * From dielectric fresnel rules: F0 = square((iorT - iorI) / (iorT + iorI))
1279
+ */
1280
+ get indexOfRefraction() {
1281
+ return this.subSurface.indexOfRefraction;
1282
+ }
1283
+ set indexOfRefraction(e) {
1284
+ this.subSurface.indexOfRefraction = e;
1285
+ }
1286
+ /**
1287
+ * Controls if refraction needs to be inverted on Y. This could be useful for procedural texture.
1288
+ */
1289
+ get invertRefractionY() {
1290
+ return this.subSurface.invertRefractionY;
1291
+ }
1292
+ set invertRefractionY(e) {
1293
+ this.subSurface.invertRefractionY = e;
1294
+ }
1295
+ /**
1296
+ * This parameters will make the material used its opacity to control how much it is refracting against not.
1297
+ * Materials half opaque for instance using refraction could benefit from this control.
1298
+ */
1299
+ get linkRefractionWithTransparency() {
1300
+ return this.subSurface.linkRefractionWithTransparency;
1301
+ }
1302
+ set linkRefractionWithTransparency(e) {
1303
+ this.subSurface.linkRefractionWithTransparency = e, e && (this.subSurface.isRefractionEnabled = !0);
1304
+ }
1305
+ /**
1306
+ * BJS is using an hardcoded light falloff based on a manually sets up range.
1307
+ * In PBR, one way to represents the falloff is to use the inverse squared root algorithm.
1308
+ * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.
1309
+ */
1310
+ get usePhysicalLightFalloff() {
1311
+ return this._lightFalloff === f.LIGHTFALLOFF_PHYSICAL;
1312
+ }
1313
+ /**
1314
+ * BJS is using an hardcoded light falloff based on a manually sets up range.
1315
+ * In PBR, one way to represents the falloff is to use the inverse squared root algorithm.
1316
+ * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.
1317
+ */
1318
+ set usePhysicalLightFalloff(e) {
1319
+ e !== this.usePhysicalLightFalloff && (this._markAllSubMeshesAsTexturesDirty(), e ? this._lightFalloff = f.LIGHTFALLOFF_PHYSICAL : this._lightFalloff = f.LIGHTFALLOFF_STANDARD);
1320
+ }
1321
+ /**
1322
+ * In order to support the falloff compatibility with gltf, a special mode has been added
1323
+ * to reproduce the gltf light falloff.
1324
+ */
1325
+ get useGLTFLightFalloff() {
1326
+ return this._lightFalloff === f.LIGHTFALLOFF_GLTF;
1327
+ }
1328
+ /**
1329
+ * In order to support the falloff compatibility with gltf, a special mode has been added
1330
+ * to reproduce the gltf light falloff.
1331
+ */
1332
+ set useGLTFLightFalloff(e) {
1333
+ e !== this.useGLTFLightFalloff && (this._markAllSubMeshesAsTexturesDirty(), e ? this._lightFalloff = f.LIGHTFALLOFF_GLTF : this._lightFalloff = f.LIGHTFALLOFF_STANDARD);
1334
+ }
1335
+ /**
1336
+ * Instantiates a new PBRMaterial instance.
1337
+ *
1338
+ * @param name The material name
1339
+ * @param scene The scene the material will be use in.
1340
+ * @param forceGLSL Use the GLSL code generation for the shader (even on WebGPU). Default is false
1341
+ */
1342
+ constructor(e, i, t = !1) {
1343
+ super(e, i, t), this.directIntensity = 1, this.emissiveIntensity = 1, this.environmentIntensity = 1, this.specularIntensity = 1, this.disableBumpMap = !1, this.ambientTextureStrength = 1, this.ambientTextureImpactOnAnalyticalLights = u.DEFAULT_AO_ON_ANALYTICAL_LIGHTS, this.metallicF0Factor = 1, this.metallicReflectanceColor = d.White(), this.useOnlyMetallicFromMetallicReflectanceTexture = !1, this.ambientColor = new d(0, 0, 0), this.albedoColor = new d(1, 1, 1), this.baseWeight = 1, this.reflectivityColor = new d(1, 1, 1), this.reflectionColor = new d(1, 1, 1), this.emissiveColor = new d(0, 0, 0), this.microSurface = 1, this.useLightmapAsShadowmap = !1, this.useAlphaFromAlbedoTexture = !1, this.forceAlphaTest = !1, this.alphaCutOff = 0.4, this.useSpecularOverAlpha = !0, this.useMicroSurfaceFromReflectivityMapAlpha = !1, this.useRoughnessFromMetallicTextureAlpha = !0, this.useRoughnessFromMetallicTextureGreen = !1, this.useMetallnessFromMetallicTextureBlue = !1, this.useAmbientOcclusionFromMetallicTextureRed = !1, this.useAmbientInGrayScale = !1, this.useAutoMicroSurfaceFromReflectivityMap = !1, this.useRadianceOverAlpha = !0, this.useObjectSpaceNormalMap = !1, this.useParallax = !1, this.useParallaxOcclusion = !1, this.parallaxScaleBias = 0.05, this.disableLighting = !1, this.forceIrradianceInFragment = !1, this.maxSimultaneousLights = 4, this.invertNormalMapX = !1, this.invertNormalMapY = !1, this.twoSidedLighting = !1, this.useAlphaFresnel = !1, this.useLinearAlphaFresnel = !1, this.environmentBRDFTexture = null, this.forceNormalForward = !1, this.enableSpecularAntiAliasing = !1, this.useHorizonOcclusion = !0, this.useRadianceOcclusion = !0, this.unlit = !1, this.applyDecalMapAfterDetailMap = !1, this._environmentBRDFTexture = Z(this.getScene());
1344
+ }
1345
+ /**
1346
+ * @returns the name of this material class.
1347
+ */
1348
+ getClassName() {
1349
+ return "PBRMaterial";
1350
+ }
1351
+ /**
1352
+ * Makes a duplicate of the current material.
1353
+ * @param name - name to use for the new material.
1354
+ * @param cloneTexturesOnlyOnce - if a texture is used in more than one channel (e.g diffuse and opacity), only clone it once and reuse it on the other channels. Default false.
1355
+ * @param rootUrl defines the root URL to use to load textures
1356
+ * @returns cloned material instance
1357
+ */
1358
+ clone(e, i = !0, t = "") {
1359
+ const o = K.Clone(() => new u(e, this.getScene()), this, { cloneTexturesOnlyOnce: i });
1360
+ return o.id = e, o.name = e, this.stencil.copyTo(o.stencil), this._clonePlugins(o, t), o;
1361
+ }
1362
+ /**
1363
+ * Serializes this PBR Material.
1364
+ * @returns - An object with the serialized material.
1365
+ */
1366
+ serialize() {
1367
+ const e = super.serialize();
1368
+ return e.customType = "BABYLON.PBRMaterial", e;
1369
+ }
1370
+ // Statics
1371
+ /**
1372
+ * Parses a PBR Material from a serialized object.
1373
+ * @param source - Serialized object.
1374
+ * @param scene - BJS scene instance.
1375
+ * @param rootUrl - url for the scene object
1376
+ * @returns - PBRMaterial
1377
+ */
1378
+ static Parse(e, i, t) {
1379
+ const o = K.Parse(() => new u(e.name, i), e, i, t);
1380
+ return e.stencil && o.stencil.parse(e.stencil, i, t), G._ParsePlugins(e, o, i, t), e.clearCoat && o.clearCoat.parse(e.clearCoat, i, t), e.anisotropy && o.anisotropy.parse(e.anisotropy, i, t), e.brdf && o.brdf.parse(e.brdf, i, t), e.sheen && o.sheen.parse(e.sheen, i, t), e.subSurface && o.subSurface.parse(e.subSurface, i, t), e.iridescence && o.iridescence.parse(e.iridescence, i, t), o;
1381
+ }
1382
+ }
1383
+ u.PBRMATERIAL_OPAQUE = f.PBRMATERIAL_OPAQUE;
1384
+ u.PBRMATERIAL_ALPHATEST = f.PBRMATERIAL_ALPHATEST;
1385
+ u.PBRMATERIAL_ALPHABLEND = f.PBRMATERIAL_ALPHABLEND;
1386
+ u.PBRMATERIAL_ALPHATESTANDBLEND = f.PBRMATERIAL_ALPHATESTANDBLEND;
1387
+ u.DEFAULT_AO_ON_ANALYTICAL_LIGHTS = f.DEFAULT_AO_ON_ANALYTICAL_LIGHTS;
1388
+ s([
1389
+ a(),
1390
+ r("_markAllSubMeshesAsTexturesDirty")
1391
+ ], u.prototype, "directIntensity", void 0);
1392
+ s([
1393
+ a(),
1394
+ r("_markAllSubMeshesAsTexturesDirty")
1395
+ ], u.prototype, "emissiveIntensity", void 0);
1396
+ s([
1397
+ a(),
1398
+ r("_markAllSubMeshesAsTexturesDirty")
1399
+ ], u.prototype, "environmentIntensity", void 0);
1400
+ s([
1401
+ a(),
1402
+ r("_markAllSubMeshesAsTexturesDirty")
1403
+ ], u.prototype, "specularIntensity", void 0);
1404
+ s([
1405
+ a(),
1406
+ r("_markAllSubMeshesAsTexturesDirty")
1407
+ ], u.prototype, "disableBumpMap", void 0);
1408
+ s([
1409
+ x(),
1410
+ r("_markAllSubMeshesAsTexturesDirty")
1411
+ ], u.prototype, "albedoTexture", void 0);
1412
+ s([
1413
+ x(),
1414
+ r("_markAllSubMeshesAsTexturesDirty")
1415
+ ], u.prototype, "baseWeightTexture", void 0);
1416
+ s([
1417
+ x(),
1418
+ r("_markAllSubMeshesAsTexturesDirty")
1419
+ ], u.prototype, "baseDiffuseRoughnessTexture", void 0);
1420
+ s([
1421
+ x(),
1422
+ r("_markAllSubMeshesAsTexturesDirty")
1423
+ ], u.prototype, "ambientTexture", void 0);
1424
+ s([
1425
+ a(),
1426
+ r("_markAllSubMeshesAsTexturesDirty")
1427
+ ], u.prototype, "ambientTextureStrength", void 0);
1428
+ s([
1429
+ a(),
1430
+ r("_markAllSubMeshesAsTexturesDirty")
1431
+ ], u.prototype, "ambientTextureImpactOnAnalyticalLights", void 0);
1432
+ s([
1433
+ x(),
1434
+ r("_markAllSubMeshesAsTexturesAndMiscDirty")
1435
+ ], u.prototype, "opacityTexture", void 0);
1436
+ s([
1437
+ x(),
1438
+ r("_markAllSubMeshesAsTexturesDirty")
1439
+ ], u.prototype, "reflectionTexture", void 0);
1440
+ s([
1441
+ x(),
1442
+ r("_markAllSubMeshesAsTexturesDirty")
1443
+ ], u.prototype, "emissiveTexture", void 0);
1444
+ s([
1445
+ x(),
1446
+ r("_markAllSubMeshesAsTexturesDirty")
1447
+ ], u.prototype, "reflectivityTexture", void 0);
1448
+ s([
1449
+ x(),
1450
+ r("_markAllSubMeshesAsTexturesDirty")
1451
+ ], u.prototype, "metallicTexture", void 0);
1452
+ s([
1453
+ a(),
1454
+ r("_markAllSubMeshesAsTexturesDirty")
1455
+ ], u.prototype, "metallic", void 0);
1456
+ s([
1457
+ a(),
1458
+ r("_markAllSubMeshesAsTexturesDirty")
1459
+ ], u.prototype, "roughness", void 0);
1460
+ s([
1461
+ a(),
1462
+ r("_markAllSubMeshesAsTexturesDirty")
1463
+ ], u.prototype, "metallicF0Factor", void 0);
1464
+ s([
1465
+ M(),
1466
+ r("_markAllSubMeshesAsTexturesDirty")
1467
+ ], u.prototype, "metallicReflectanceColor", void 0);
1468
+ s([
1469
+ a(),
1470
+ r("_markAllSubMeshesAsTexturesDirty")
1471
+ ], u.prototype, "useOnlyMetallicFromMetallicReflectanceTexture", void 0);
1472
+ s([
1473
+ x(),
1474
+ r("_markAllSubMeshesAsTexturesDirty")
1475
+ ], u.prototype, "metallicReflectanceTexture", void 0);
1476
+ s([
1477
+ x(),
1478
+ r("_markAllSubMeshesAsTexturesDirty")
1479
+ ], u.prototype, "reflectanceTexture", void 0);
1480
+ s([
1481
+ x(),
1482
+ r("_markAllSubMeshesAsTexturesDirty")
1483
+ ], u.prototype, "microSurfaceTexture", void 0);
1484
+ s([
1485
+ x(),
1486
+ r("_markAllSubMeshesAsTexturesDirty")
1487
+ ], u.prototype, "bumpTexture", void 0);
1488
+ s([
1489
+ x(),
1490
+ r("_markAllSubMeshesAsTexturesDirty", null)
1491
+ ], u.prototype, "lightmapTexture", void 0);
1492
+ s([
1493
+ M("ambient"),
1494
+ r("_markAllSubMeshesAsTexturesDirty")
1495
+ ], u.prototype, "ambientColor", void 0);
1496
+ s([
1497
+ M("albedo"),
1498
+ r("_markAllSubMeshesAsTexturesDirty")
1499
+ ], u.prototype, "albedoColor", void 0);
1500
+ s([
1501
+ a("baseWeight"),
1502
+ r("_markAllSubMeshesAsTexturesDirty")
1503
+ ], u.prototype, "baseWeight", void 0);
1504
+ s([
1505
+ a("baseDiffuseRoughness"),
1506
+ r("_markAllSubMeshesAsTexturesDirty")
1507
+ ], u.prototype, "baseDiffuseRoughness", void 0);
1508
+ s([
1509
+ M("reflectivity"),
1510
+ r("_markAllSubMeshesAsTexturesDirty")
1511
+ ], u.prototype, "reflectivityColor", void 0);
1512
+ s([
1513
+ M("reflection"),
1514
+ r("_markAllSubMeshesAsTexturesDirty")
1515
+ ], u.prototype, "reflectionColor", void 0);
1516
+ s([
1517
+ M("emissive"),
1518
+ r("_markAllSubMeshesAsTexturesDirty")
1519
+ ], u.prototype, "emissiveColor", void 0);
1520
+ s([
1521
+ a(),
1522
+ r("_markAllSubMeshesAsTexturesDirty")
1523
+ ], u.prototype, "microSurface", void 0);
1524
+ s([
1525
+ a(),
1526
+ r("_markAllSubMeshesAsTexturesDirty")
1527
+ ], u.prototype, "useLightmapAsShadowmap", void 0);
1528
+ s([
1529
+ a(),
1530
+ r("_markAllSubMeshesAsTexturesAndMiscDirty")
1531
+ ], u.prototype, "useAlphaFromAlbedoTexture", void 0);
1532
+ s([
1533
+ a(),
1534
+ r("_markAllSubMeshesAsTexturesAndMiscDirty")
1535
+ ], u.prototype, "forceAlphaTest", void 0);
1536
+ s([
1537
+ a(),
1538
+ r("_markAllSubMeshesAsTexturesAndMiscDirty")
1539
+ ], u.prototype, "alphaCutOff", void 0);
1540
+ s([
1541
+ a(),
1542
+ r("_markAllSubMeshesAsTexturesDirty")
1543
+ ], u.prototype, "useSpecularOverAlpha", void 0);
1544
+ s([
1545
+ a(),
1546
+ r("_markAllSubMeshesAsTexturesDirty")
1547
+ ], u.prototype, "useMicroSurfaceFromReflectivityMapAlpha", void 0);
1548
+ s([
1549
+ a(),
1550
+ r("_markAllSubMeshesAsTexturesDirty")
1551
+ ], u.prototype, "useRoughnessFromMetallicTextureAlpha", void 0);
1552
+ s([
1553
+ a(),
1554
+ r("_markAllSubMeshesAsTexturesDirty")
1555
+ ], u.prototype, "useRoughnessFromMetallicTextureGreen", void 0);
1556
+ s([
1557
+ a(),
1558
+ r("_markAllSubMeshesAsTexturesDirty")
1559
+ ], u.prototype, "useMetallnessFromMetallicTextureBlue", void 0);
1560
+ s([
1561
+ a(),
1562
+ r("_markAllSubMeshesAsTexturesDirty")
1563
+ ], u.prototype, "useAmbientOcclusionFromMetallicTextureRed", void 0);
1564
+ s([
1565
+ a(),
1566
+ r("_markAllSubMeshesAsTexturesDirty")
1567
+ ], u.prototype, "useAmbientInGrayScale", void 0);
1568
+ s([
1569
+ a(),
1570
+ r("_markAllSubMeshesAsTexturesDirty")
1571
+ ], u.prototype, "useAutoMicroSurfaceFromReflectivityMap", void 0);
1572
+ s([
1573
+ a()
1574
+ ], u.prototype, "usePhysicalLightFalloff", null);
1575
+ s([
1576
+ a()
1577
+ ], u.prototype, "useGLTFLightFalloff", null);
1578
+ s([
1579
+ a(),
1580
+ r("_markAllSubMeshesAsTexturesDirty")
1581
+ ], u.prototype, "useRadianceOverAlpha", void 0);
1582
+ s([
1583
+ a(),
1584
+ r("_markAllSubMeshesAsTexturesDirty")
1585
+ ], u.prototype, "useObjectSpaceNormalMap", void 0);
1586
+ s([
1587
+ a(),
1588
+ r("_markAllSubMeshesAsTexturesDirty")
1589
+ ], u.prototype, "useParallax", void 0);
1590
+ s([
1591
+ a(),
1592
+ r("_markAllSubMeshesAsTexturesDirty")
1593
+ ], u.prototype, "useParallaxOcclusion", void 0);
1594
+ s([
1595
+ a(),
1596
+ r("_markAllSubMeshesAsTexturesDirty")
1597
+ ], u.prototype, "parallaxScaleBias", void 0);
1598
+ s([
1599
+ a(),
1600
+ r("_markAllSubMeshesAsLightsDirty")
1601
+ ], u.prototype, "disableLighting", void 0);
1602
+ s([
1603
+ a(),
1604
+ r("_markAllSubMeshesAsTexturesDirty")
1605
+ ], u.prototype, "forceIrradianceInFragment", void 0);
1606
+ s([
1607
+ a(),
1608
+ r("_markAllSubMeshesAsLightsDirty")
1609
+ ], u.prototype, "maxSimultaneousLights", void 0);
1610
+ s([
1611
+ a(),
1612
+ r("_markAllSubMeshesAsTexturesDirty")
1613
+ ], u.prototype, "invertNormalMapX", void 0);
1614
+ s([
1615
+ a(),
1616
+ r("_markAllSubMeshesAsTexturesDirty")
1617
+ ], u.prototype, "invertNormalMapY", void 0);
1618
+ s([
1619
+ a(),
1620
+ r("_markAllSubMeshesAsTexturesDirty")
1621
+ ], u.prototype, "twoSidedLighting", void 0);
1622
+ s([
1623
+ a(),
1624
+ r("_markAllSubMeshesAsTexturesDirty")
1625
+ ], u.prototype, "useAlphaFresnel", void 0);
1626
+ s([
1627
+ a(),
1628
+ r("_markAllSubMeshesAsTexturesDirty")
1629
+ ], u.prototype, "useLinearAlphaFresnel", void 0);
1630
+ s([
1631
+ r("_markAllSubMeshesAsTexturesDirty")
1632
+ ], u.prototype, "environmentBRDFTexture", void 0);
1633
+ s([
1634
+ a(),
1635
+ r("_markAllSubMeshesAsTexturesDirty")
1636
+ ], u.prototype, "forceNormalForward", void 0);
1637
+ s([
1638
+ a(),
1639
+ r("_markAllSubMeshesAsTexturesDirty")
1640
+ ], u.prototype, "enableSpecularAntiAliasing", void 0);
1641
+ s([
1642
+ a(),
1643
+ r("_markAllSubMeshesAsTexturesDirty")
1644
+ ], u.prototype, "useHorizonOcclusion", void 0);
1645
+ s([
1646
+ a(),
1647
+ r("_markAllSubMeshesAsTexturesDirty")
1648
+ ], u.prototype, "useRadianceOcclusion", void 0);
1649
+ s([
1650
+ a(),
1651
+ r("_markAllSubMeshesAsMiscDirty")
1652
+ ], u.prototype, "unlit", void 0);
1653
+ s([
1654
+ a(),
1655
+ r("_markAllSubMeshesAsMiscDirty")
1656
+ ], u.prototype, "applyDecalMapAfterDetailMap", void 0);
1657
+ Be("BABYLON.PBRMaterial", u);
1658
+ export {
1659
+ u as PBRMaterial
1660
+ };