@babylonjs/core 9.14.0 → 9.15.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 (141) hide show
  1. package/Animations/animationGroup.d.ts +0 -1
  2. package/Animations/animationGroup.js +0 -1
  3. package/Animations/animationGroup.js.map +1 -1
  4. package/Animations/animationGroup.pure.js +2 -0
  5. package/Animations/animationGroup.pure.js.map +1 -1
  6. package/Cameras/Inputs/BaseCameraPointersInput.d.ts +2 -1
  7. package/Cameras/Inputs/BaseCameraPointersInput.js +3 -2
  8. package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
  9. package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.d.ts +3 -0
  10. package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.js +37 -10
  11. package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.js.map +1 -1
  12. package/Cameras/Inputs/flyCameraKeyboardInput.js +19 -9
  13. package/Cameras/Inputs/flyCameraKeyboardInput.js.map +1 -1
  14. package/Cameras/Inputs/freeCameraKeyboardMoveInput.js +21 -18
  15. package/Cameras/Inputs/freeCameraKeyboardMoveInput.js.map +1 -1
  16. package/Cameras/Inputs/geospatialCameraKeyboardInput.d.ts +2 -0
  17. package/Cameras/Inputs/geospatialCameraKeyboardInput.js +31 -12
  18. package/Cameras/Inputs/geospatialCameraKeyboardInput.js.map +1 -1
  19. package/Cameras/Inputs/geospatialCameraPointersInput.d.ts +11 -1
  20. package/Cameras/Inputs/geospatialCameraPointersInput.js +18 -2
  21. package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
  22. package/Cameras/VR/vrExperienceHelper.d.ts +0 -2
  23. package/Cameras/VR/vrExperienceHelper.js +0 -2
  24. package/Cameras/VR/vrExperienceHelper.js.map +1 -1
  25. package/Cameras/VR/vrExperienceHelper.pure.js +5 -0
  26. package/Cameras/VR/vrExperienceHelper.pure.js.map +1 -1
  27. package/Engines/WebGPU/webgpuClearQuad.pure.js +7 -1
  28. package/Engines/WebGPU/webgpuClearQuad.pure.js.map +1 -1
  29. package/Engines/abstractEngine.pure.js +2 -2
  30. package/Engines/abstractEngine.pure.js.map +1 -1
  31. package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.d.ts +0 -1
  32. package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.js +0 -1
  33. package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.js.map +1 -1
  34. package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.js +3 -0
  35. package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.js.map +1 -1
  36. package/Helpers/environmentHelper.js +2 -2
  37. package/Helpers/environmentHelper.js.map +1 -1
  38. package/Lights/Clustered/clusteredLightContainer.pure.js +13 -0
  39. package/Lights/Clustered/clusteredLightContainer.pure.js.map +1 -1
  40. package/Loading/Plugins/babylonFileLoader.pure.js +3 -3
  41. package/Loading/Plugins/babylonFileLoader.pure.js.map +1 -1
  42. package/Materials/Background/backgroundMaterial.pure.js +3 -1
  43. package/Materials/Background/backgroundMaterial.pure.js.map +1 -1
  44. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.pure.js +2 -2
  45. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.pure.js.map +1 -1
  46. package/Materials/Node/Blocks/PBR/refractionBlock.pure.js +2 -2
  47. package/Materials/Node/Blocks/PBR/refractionBlock.pure.js.map +1 -1
  48. package/Materials/Node/nodeMaterial.pure.js +3 -0
  49. package/Materials/Node/nodeMaterial.pure.js.map +1 -1
  50. package/Materials/Node/nodeMaterialBuildState.d.ts +3 -3
  51. package/Materials/PBR/openpbrMaterial.pure.js +3 -1
  52. package/Materials/PBR/openpbrMaterial.pure.js.map +1 -1
  53. package/Materials/PBR/pbrMaterial.pure.js +3 -0
  54. package/Materials/PBR/pbrMaterial.pure.js.map +1 -1
  55. package/Materials/PBR/pbrMetallicRoughnessMaterial.pure.js +3 -0
  56. package/Materials/PBR/pbrMetallicRoughnessMaterial.pure.js.map +1 -1
  57. package/Materials/PBR/pbrSpecularGlossinessMaterial.pure.js +3 -0
  58. package/Materials/PBR/pbrSpecularGlossinessMaterial.pure.js.map +1 -1
  59. package/Materials/Textures/cubeTexture.d.ts +0 -1
  60. package/Materials/Textures/cubeTexture.js +0 -1
  61. package/Materials/Textures/cubeTexture.js.map +1 -1
  62. package/Materials/Textures/cubeTexture.pure.js +2 -0
  63. package/Materials/Textures/cubeTexture.pure.js.map +1 -1
  64. package/Materials/Textures/dynamicTexture.d.ts +0 -1
  65. package/Materials/Textures/dynamicTexture.js +0 -1
  66. package/Materials/Textures/dynamicTexture.js.map +1 -1
  67. package/Materials/Textures/dynamicTexture.pure.js +2 -0
  68. package/Materials/Textures/dynamicTexture.pure.js.map +1 -1
  69. package/Materials/Textures/htmlElementTexture.d.ts +0 -2
  70. package/Materials/Textures/htmlElementTexture.js +0 -2
  71. package/Materials/Textures/htmlElementTexture.js.map +1 -1
  72. package/Materials/Textures/htmlElementTexture.pure.js +4 -0
  73. package/Materials/Textures/htmlElementTexture.pure.js.map +1 -1
  74. package/Materials/Textures/multiRenderTarget.d.ts +0 -1
  75. package/Materials/Textures/multiRenderTarget.js +0 -1
  76. package/Materials/Textures/multiRenderTarget.js.map +1 -1
  77. package/Materials/Textures/multiRenderTarget.pure.js +2 -0
  78. package/Materials/Textures/multiRenderTarget.pure.js.map +1 -1
  79. package/Materials/standardMaterial.pure.js +3 -1
  80. package/Materials/standardMaterial.pure.js.map +1 -1
  81. package/Misc/decorators.functions.d.ts +7 -0
  82. package/Misc/decorators.functions.js +86 -35
  83. package/Misc/decorators.functions.js.map +1 -1
  84. package/Misc/snapshotRenderingHelper.d.ts +4 -1
  85. package/Misc/snapshotRenderingHelper.js.map +1 -1
  86. package/Misc/symbolMetadataPolyfill.d.ts +11 -0
  87. package/Misc/symbolMetadataPolyfill.js +22 -0
  88. package/Misc/symbolMetadataPolyfill.js.map +1 -0
  89. package/Misc/tools.pure.js +1 -1
  90. package/Misc/tools.pure.js.map +1 -1
  91. package/Particles/gpuParticleSystem.d.ts +0 -1
  92. package/Particles/gpuParticleSystem.js +0 -1
  93. package/Particles/gpuParticleSystem.js.map +1 -1
  94. package/Particles/thinParticleSystem.d.ts +0 -1
  95. package/Particles/thinParticleSystem.js +0 -1
  96. package/Particles/thinParticleSystem.js.map +1 -1
  97. package/Particles/thinParticleSystem.pure.js +2 -0
  98. package/Particles/thinParticleSystem.pure.js.map +1 -1
  99. package/Particles/webgl2ParticleSystem.pure.js +2 -0
  100. package/Particles/webgl2ParticleSystem.pure.js.map +1 -1
  101. package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.d.ts +0 -1
  102. package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.js +0 -1
  103. package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.js.map +1 -1
  104. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.pure.js +7 -0
  105. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.pure.js.map +1 -1
  106. package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.d.ts +0 -1
  107. package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js +0 -1
  108. package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js.map +1 -1
  109. package/PostProcesses/postProcess.pure.js +5 -0
  110. package/PostProcesses/postProcess.pure.js.map +1 -1
  111. package/PostProcesses/vrMultiviewToSingleviewPostProcess.d.ts +0 -1
  112. package/PostProcesses/vrMultiviewToSingleviewPostProcess.js +0 -1
  113. package/PostProcesses/vrMultiviewToSingleviewPostProcess.js.map +1 -1
  114. package/PostProcesses/vrMultiviewToSingleviewPostProcess.pure.js +2 -0
  115. package/PostProcesses/vrMultiviewToSingleviewPostProcess.pure.js.map +1 -1
  116. package/Rendering/IBLShadows/iblShadowsRenderPipeline.d.ts +0 -2
  117. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +0 -2
  118. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
  119. package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js +5 -0
  120. package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js.map +1 -1
  121. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.d.ts +0 -1
  122. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +0 -1
  123. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
  124. package/Rendering/prePassRenderer.d.ts +0 -2
  125. package/Rendering/prePassRenderer.js +0 -2
  126. package/Rendering/prePassRenderer.js.map +1 -1
  127. package/Rendering/prePassRenderer.pure.js +2 -0
  128. package/Rendering/prePassRenderer.pure.js.map +1 -1
  129. package/Rendering/thinDepthPeelingRenderer.d.ts +0 -1
  130. package/Rendering/thinDepthPeelingRenderer.js +0 -1
  131. package/Rendering/thinDepthPeelingRenderer.js.map +1 -1
  132. package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js +35 -5
  133. package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
  134. package/ShadersWGSL/ShadersInclude/helperFunctions.js +2 -2
  135. package/ShadersWGSL/ShadersInclude/helperFunctions.js.map +1 -1
  136. package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js +39 -7
  137. package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
  138. package/index.d.ts +1 -0
  139. package/index.js +1 -0
  140. package/index.js.map +1 -1
  141. package/package.json +3 -11
@@ -4,6 +4,7 @@ import { serialize, serializeAsColor3, expandToProperty, serializeAsTexture } fr
4
4
  import { GetEnvironmentBRDFTexture } from "../../Misc/brdfTextureTools.js";
5
5
  import { Color3 } from "../../Maths/math.color.pure.js";
6
6
  import { PBRBaseMaterial } from "./pbrBaseMaterial.pure.js";
7
+ import { RegisterImageProcessingConfiguration } from "../imageProcessingConfiguration.pure.js";
7
8
  import { Material } from "../material.pure.js";
8
9
  import { SerializationHelper } from "../../Misc/decorators.serialization.js";
9
10
  import { RegisterClass } from "../../Misc/typeStore.js";
@@ -722,6 +723,8 @@ export function RegisterPbrMaterial() {
722
723
  return;
723
724
  }
724
725
  _Registered = true;
726
+ // PBRMaterial serializes its image processing configuration, so the parser must be registered for clone/parse to work.
727
+ RegisterImageProcessingConfiguration();
725
728
  RegisterClass("BABYLON.PBRMaterial", PBRMaterial);
726
729
  }
727
730
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"pbrMaterial.pure.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/PBR/pbrMaterial.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;;AAE7D,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3G,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAGxE,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAErD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,OAAO,WAAY,SAAQ,eAAe;IA6O5C;;OAEG;IACH,IAAW,iBAAiB;QACxB,OAAO,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC;IAC7C,CAAC;IACD,IAAW,iBAAiB,CAAC,KAA4B;QACrD,IAAI,CAAC,UAAU,CAAC,iBAAiB,GAAG,KAAK,CAAC;QAC1C,IAAI,KAAK,EAAE,CAAC;YACR,IAAI,CAAC,UAAU,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAC/C,CAAC;aAAM,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,8BAA8B,EAAE,CAAC;YACzD,IAAI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AFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;oDACtB;AAQxB;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;0DAChB;AAW9B;IADN,gBAAgB,CAAC,kCAAkC,CAAC;2DACO;AAOrD;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;uDACnB;AAS3B;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;+DACX;AAQnC;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;wDACnB;AAQ3B;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;yDAClB;AAO5B;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,8BAA8B,CAAC;0CAC5B;AAOd;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,8BAA8B,CAAC;gEACN;AA8F/C,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,mBAAmB;IAC/B,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC;AACtD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB;IAC/B,mBAAmB,EAAE,CAAC;AAC1B,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { serialize, serializeAsColor3, expandToProperty, serializeAsTexture } from \"../../Misc/decorators\";\r\nimport { GetEnvironmentBRDFTexture } from \"../../Misc/brdfTextureTools\";\r\nimport { type Nullable } from \"../../types\";\r\nimport { type Scene } from \"../../scene.pure\";\r\nimport { Color3 } from \"../../Maths/math.color.pure\";\r\nimport { type BaseTexture } from \"../../Materials/Textures/baseTexture.pure\";\r\nimport { PBRBaseMaterial } from \"./pbrBaseMaterial.pure\";\r\nimport { Material } from \"../material.pure\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\nimport { RegisterClass } from \"../../Misc/typeStore\";\r\n\r\n/**\r\n * The Physically based material of BJS.\r\n *\r\n * This offers the main features of a standard PBR material.\r\n * For more information, please refer to the documentation :\r\n * https://doc.babylonjs.com/features/featuresDeepDive/materials/using/introToPBR\r\n */\r\nexport class PBRMaterial extends PBRBaseMaterial {\r\n /**\r\n * PBRMaterialTransparencyMode: No transparency mode, Alpha channel is not use.\r\n */\r\n public static override readonly PBRMATERIAL_OPAQUE = PBRBaseMaterial.PBRMATERIAL_OPAQUE;\r\n\r\n /**\r\n * PBRMaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.\r\n */\r\n public static override readonly PBRMATERIAL_ALPHATEST = PBRBaseMaterial.PBRMATERIAL_ALPHATEST;\r\n\r\n /**\r\n * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\r\n */\r\n public static override readonly PBRMATERIAL_ALPHABLEND = PBRBaseMaterial.PBRMATERIAL_ALPHABLEND;\r\n\r\n /**\r\n * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\r\n * They are also discarded below the alpha cutoff threshold to improve performances.\r\n */\r\n public static override readonly PBRMATERIAL_ALPHATESTANDBLEND = PBRBaseMaterial.PBRMATERIAL_ALPHATESTANDBLEND;\r\n\r\n /**\r\n * Defines the default value of how much AO map is occluding the analytical lights\r\n * (point spot...).\r\n */\r\n public static override DEFAULT_AO_ON_ANALYTICAL_LIGHTS = PBRBaseMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS;\r\n\r\n /**\r\n * Intensity of the direct lights e.g. the four lights available in your scene.\r\n * This impacts both the direct diffuse and specular highlights.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public directIntensity: number = 1.0;\r\n\r\n /**\r\n * Intensity of the emissive part of the material.\r\n * This helps controlling the emissive effect without modifying the emissive color.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public emissiveIntensity: number = 1.0;\r\n\r\n /**\r\n * Intensity of the environment e.g. how much the environment will light the object\r\n * either through harmonics for rough material or through the reflection for shiny ones.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public environmentIntensity: number = 1.0;\r\n\r\n /**\r\n * This is a special control allowing the reduction of the specular highlights coming from the\r\n * four lights of the scene. Those highlights may not be needed in full environment lighting.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public specularIntensity: number = 1.0;\r\n\r\n /**\r\n * Debug Control allowing disabling the bump map on this material.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public disableBumpMap: boolean = false;\r\n\r\n /**\r\n * AKA Diffuse Texture in standard nomenclature.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public albedoTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * OpenPBR Base Weight texture (multiplier to the diffuse and metal lobes).\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public baseWeightTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * OpenPBR Base Diffuse Roughness texture (roughness of the diffuse lobe).\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public baseDiffuseRoughnessTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * AKA Occlusion Texture in other nomenclature.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public ambientTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * AKA Occlusion Texture Intensity in other nomenclature.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public ambientTextureStrength: number = 1.0;\r\n\r\n /**\r\n * Defines how much the AO map is occluding the analytical lights (point spot...).\r\n * 1 means it completely occludes it\r\n * 0 mean it has no impact\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public ambientTextureImpactOnAnalyticalLights: number = PBRMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS;\r\n\r\n /**\r\n * Stores the alpha values in a texture. Use luminance if texture.getAlphaFromRGB is true.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n public opacityTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Stores the reflection values in a texture.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public reflectionTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Stores the emissive values in a texture.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public emissiveTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * AKA Specular texture in other nomenclature.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public reflectivityTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Used to switch from specular/glossiness to metallic/roughness workflow.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public metallicTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Specifies the metallic scalar of the metallic/roughness workflow.\r\n * Can also be used to scale the metalness values of the metallic texture.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public metallic: Nullable<number>;\r\n\r\n /**\r\n * Specifies the roughness scalar of the metallic/roughness workflow.\r\n * Can also be used to scale the roughness values of the metallic texture.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public roughness: Nullable<number>;\r\n\r\n /**\r\n * In metallic workflow, specifies an F0 factor to help configuring the material F0.\r\n * By default the indexOfrefraction is used to compute F0;\r\n *\r\n * This is used as a factor against the default reflectance at normal incidence to tweak it.\r\n *\r\n * F0 = defaultF0 * metallicF0Factor * metallicReflectanceColor;\r\n * F90 = metallicReflectanceColor;\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public metallicF0Factor = 1;\r\n\r\n /**\r\n * In metallic workflow, specifies an F0 color.\r\n * By default the F90 is always 1;\r\n *\r\n * Please note that this factor is also used as a factor against the default reflectance at normal incidence.\r\n *\r\n * F0 = defaultF0_from_IOR * metallicF0Factor * metallicReflectanceColor\r\n * F90 = metallicF0Factor;\r\n */\r\n @serializeAsColor3()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public metallicReflectanceColor = Color3.White();\r\n\r\n /**\r\n * Specifies that only the A channel from metallicReflectanceTexture should be used.\r\n * If false, both RGB and A channels will be used\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useOnlyMetallicFromMetallicReflectanceTexture = false;\r\n\r\n /**\r\n * Defines to store metallicReflectanceColor in RGB and metallicF0Factor in A\r\n * This is multiplied against the scalar values defined in the material.\r\n * If useOnlyMetallicFromMetallicReflectanceTexture is true, don't use the RGB channels, only A\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public metallicReflectanceTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Defines to store reflectanceColor in RGB\r\n * This is multiplied against the scalar values defined in the material.\r\n * If both reflectanceTexture and metallicReflectanceTexture textures are provided and useOnlyMetallicFromMetallicReflectanceTexture\r\n * is false, metallicReflectanceTexture takes priority and reflectanceTexture is not used\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public reflectanceTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Used to enable roughness/glossiness fetch from a separate channel depending on the current mode.\r\n * Gray Scale represents roughness in metallic mode and glossiness in specular mode.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public microSurfaceTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Stores surface normal data used to displace a mesh in a texture.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public bumpTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Stores the pre-calculated light information of a mesh in a texture.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", null)\r\n public lightmapTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Stores the refracted light information in a texture.\r\n */\r\n public get refractionTexture(): Nullable<BaseTexture> {\r\n return this.subSurface.refractionTexture;\r\n }\r\n public set refractionTexture(value: Nullable<BaseTexture>) {\r\n this.subSurface.refractionTexture = value;\r\n if (value) {\r\n this.subSurface.isRefractionEnabled = true;\r\n } else if (!this.subSurface.linkRefractionWithTransparency) {\r\n this.subSurface.isRefractionEnabled = false;\r\n }\r\n }\r\n\r\n /**\r\n * The color of a material in ambient lighting.\r\n */\r\n @serializeAsColor3(\"ambient\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public ambientColor = new Color3(0, 0, 0);\r\n\r\n /**\r\n * AKA Diffuse Color in other nomenclature.\r\n */\r\n @serializeAsColor3(\"albedo\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public albedoColor = new Color3(1, 1, 1);\r\n\r\n /**\r\n * OpenPBR Base Weight (multiplier to the diffuse and metal lobes).\r\n */\r\n @serialize(\"baseWeight\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public baseWeight = 1;\r\n\r\n /**\r\n * OpenPBR Base Diffuse Roughness (roughness of the diffuse lobe).\r\n */\r\n @serialize(\"baseDiffuseRoughness\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public baseDiffuseRoughness: Nullable<number>;\r\n\r\n /**\r\n * AKA Specular Color in other nomenclature.\r\n */\r\n @serializeAsColor3(\"reflectivity\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public reflectivityColor = new Color3(1, 1, 1);\r\n\r\n /**\r\n * The color reflected from the material.\r\n */\r\n @serializeAsColor3(\"reflection\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public reflectionColor = new Color3(1.0, 1.0, 1.0);\r\n\r\n /**\r\n * The color emitted from the material.\r\n */\r\n @serializeAsColor3(\"emissive\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public emissiveColor = new Color3(0, 0, 0);\r\n\r\n /**\r\n * AKA Glossiness in other nomenclature.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public microSurface = 1.0;\r\n\r\n /**\r\n * Index of refraction of the material base layer.\r\n * https://en.wikipedia.org/wiki/List_of_refractive_indices\r\n *\r\n * This does not only impact refraction but also the Base F0 of Dielectric Materials.\r\n *\r\n * From dielectric fresnel rules: F0 = square((iorT - iorI) / (iorT + iorI))\r\n */\r\n public get indexOfRefraction(): number {\r\n return this.subSurface.indexOfRefraction;\r\n }\r\n public set indexOfRefraction(value: number) {\r\n this.subSurface.indexOfRefraction = value;\r\n }\r\n\r\n /**\r\n * Controls if refraction needs to be inverted on Y. This could be useful for procedural texture.\r\n */\r\n public get invertRefractionY(): boolean {\r\n return this.subSurface.invertRefractionY;\r\n }\r\n public set invertRefractionY(value: boolean) {\r\n this.subSurface.invertRefractionY = value;\r\n }\r\n\r\n /**\r\n * This parameters will make the material used its opacity to control how much it is refracting against not.\r\n * Materials half opaque for instance using refraction could benefit from this control.\r\n */\r\n public get linkRefractionWithTransparency(): boolean {\r\n return this.subSurface.linkRefractionWithTransparency;\r\n }\r\n public set linkRefractionWithTransparency(value: boolean) {\r\n this.subSurface.linkRefractionWithTransparency = value;\r\n if (value) {\r\n this.subSurface.isRefractionEnabled = true;\r\n }\r\n }\r\n\r\n /**\r\n * If true, the light map contains occlusion information instead of lighting info.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useLightmapAsShadowmap = false;\r\n\r\n /**\r\n * Specifies that the alpha is coming form the albedo channel alpha channel for alpha blending.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n public useAlphaFromAlbedoTexture = false;\r\n\r\n /**\r\n * Enforces alpha test in opaque or blend mode in order to improve the performances of some situations.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n public forceAlphaTest = false;\r\n\r\n /**\r\n * Defines the alpha limits in alpha test mode.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n public alphaCutOff = 0.4;\r\n\r\n /**\r\n * Specifies that the material will keep the specular highlights over a transparent surface (only the most luminous ones).\r\n * A car glass is a good example of that. When sun reflects on it you can not see what is behind.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useSpecularOverAlpha = true;\r\n\r\n /**\r\n * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useMicroSurfaceFromReflectivityMapAlpha = false;\r\n\r\n /**\r\n * Specifies if the metallic texture contains the roughness information in its alpha channel.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useRoughnessFromMetallicTextureAlpha = true;\r\n\r\n /**\r\n * Specifies if the metallic texture contains the roughness information in its green channel.\r\n * Needs useRoughnessFromMetallicTextureAlpha to be false.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useRoughnessFromMetallicTextureGreen = false;\r\n\r\n /**\r\n * Specifies if the metallic texture contains the metallness information in its blue channel.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useMetallnessFromMetallicTextureBlue = false;\r\n\r\n /**\r\n * Specifies if the metallic texture contains the ambient occlusion information in its red channel.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useAmbientOcclusionFromMetallicTextureRed = false;\r\n\r\n /**\r\n * Specifies if the ambient texture contains the ambient occlusion information in its red channel only.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useAmbientInGrayScale = false;\r\n\r\n /**\r\n * In case the reflectivity map does not contain the microsurface information in its alpha channel,\r\n * The material will try to infer what glossiness each pixel should be.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useAutoMicroSurfaceFromReflectivityMap = false;\r\n\r\n /**\r\n * BJS is using an hardcoded light falloff based on a manually sets up range.\r\n * In PBR, one way to represents the falloff is to use the inverse squared root algorithm.\r\n * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.\r\n */\r\n @serialize()\r\n public get usePhysicalLightFalloff(): boolean {\r\n return this._lightFalloff === PBRBaseMaterial.LIGHTFALLOFF_PHYSICAL;\r\n }\r\n\r\n /**\r\n * BJS is using an hardcoded light falloff based on a manually sets up range.\r\n * In PBR, one way to represents the falloff is to use the inverse squared root algorithm.\r\n * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.\r\n */\r\n public set usePhysicalLightFalloff(value: boolean) {\r\n if (value !== this.usePhysicalLightFalloff) {\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n\r\n if (value) {\r\n this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_PHYSICAL;\r\n } else {\r\n this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_STANDARD;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * In order to support the falloff compatibility with gltf, a special mode has been added\r\n * to reproduce the gltf light falloff.\r\n */\r\n @serialize()\r\n public get useGLTFLightFalloff(): boolean {\r\n return this._lightFalloff === PBRBaseMaterial.LIGHTFALLOFF_GLTF;\r\n }\r\n\r\n /**\r\n * In order to support the falloff compatibility with gltf, a special mode has been added\r\n * to reproduce the gltf light falloff.\r\n */\r\n public set useGLTFLightFalloff(value: boolean) {\r\n if (value !== this.useGLTFLightFalloff) {\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n\r\n if (value) {\r\n this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_GLTF;\r\n } else {\r\n this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_STANDARD;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Specifies that the material will keeps the reflection highlights over a transparent surface (only the most luminous ones).\r\n * A car glass is a good example of that. When the street lights reflects on it you can not see what is behind.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useRadianceOverAlpha = true;\r\n\r\n /**\r\n * Allows using an object space normal map (instead of tangent space).\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useObjectSpaceNormalMap = false;\r\n\r\n /**\r\n * Allows using the bump map in parallax mode.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useParallax = false;\r\n\r\n /**\r\n * Allows using the bump map in parallax occlusion mode.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useParallaxOcclusion = false;\r\n\r\n /**\r\n * Controls the scale bias of the parallax mode.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public parallaxScaleBias = 0.05;\r\n\r\n /**\r\n * If sets to true, disables all the lights affecting the material.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting = false;\r\n\r\n /**\r\n * Force the shader to compute irradiance in the fragment shader in order to take bump in account.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public forceIrradianceInFragment = false;\r\n\r\n /**\r\n * Number of Simultaneous lights allowed on the material.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights = 4;\r\n\r\n /**\r\n * If sets to true, x component of normal map value will invert (x = 1.0 - x).\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public invertNormalMapX = false;\r\n\r\n /**\r\n * If sets to true, y component of normal map value will invert (y = 1.0 - y).\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public invertNormalMapY = false;\r\n\r\n /**\r\n * If sets to true and backfaceCulling is false, normals will be flipped on the backside.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public twoSidedLighting = false;\r\n\r\n /**\r\n * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.\r\n * And/Or occlude the blended part. (alpha is converted to gamma to compute the fresnel)\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useAlphaFresnel = false;\r\n\r\n /**\r\n * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.\r\n * And/Or occlude the blended part. (alpha stays linear to compute the fresnel)\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useLinearAlphaFresnel = false;\r\n\r\n /**\r\n * Let user defines the brdf lookup texture used for IBL.\r\n * A default 8bit version is embedded but you could point at :\r\n * * Default texture: https://assets.babylonjs.com/environments/correlatedMSBRDF_RGBD.png\r\n * * Default 16bit pixel depth texture: https://assets.babylonjs.com/environments/correlatedMSBRDF.dds\r\n * * LEGACY Default None correlated https://assets.babylonjs.com/environments/uncorrelatedBRDF_RGBD.png\r\n * * LEGACY Default None correlated 16bit pixel depth https://assets.babylonjs.com/environments/uncorrelatedBRDF.dds\r\n */\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public environmentBRDFTexture: Nullable<BaseTexture> = null;\r\n\r\n /**\r\n * Force normal to face away from face.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public forceNormalForward = false;\r\n\r\n /**\r\n * Enables specular anti aliasing in the PBR shader.\r\n * It will both interacts on the Geometry for analytical and IBL lighting.\r\n * It also prefilter the roughness map based on the bump values.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public enableSpecularAntiAliasing = false;\r\n\r\n /**\r\n * This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal\r\n * makes the reflect vector face the model (under horizon).\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useHorizonOcclusion = true;\r\n\r\n /**\r\n * This parameters will enable/disable radiance occlusion by preventing the radiance to lit\r\n * too much the area relying on ambient texture to define their ambient occlusion.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useRadianceOcclusion = true;\r\n\r\n /**\r\n * If set to true, no lighting calculations will be applied.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\r\n public unlit = false;\r\n\r\n /**\r\n * If sets to true, the decal map will be applied after the detail map. Else, it is applied before (default: false)\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\r\n public applyDecalMapAfterDetailMap = false;\r\n\r\n /**\r\n * Instantiates a new PBRMaterial instance.\r\n *\r\n * @param name The material name\r\n * @param scene The scene the material will be use in.\r\n * @param forceGLSL Use the GLSL code generation for the shader (even on WebGPU). Default is false\r\n */\r\n constructor(name: string, scene?: Scene, forceGLSL = false) {\r\n super(name, scene, forceGLSL);\r\n\r\n this._environmentBRDFTexture = GetEnvironmentBRDFTexture(this.getScene());\r\n }\r\n\r\n /**\r\n * @returns the name of this material class.\r\n */\r\n public override getClassName(): string {\r\n return \"PBRMaterial\";\r\n }\r\n\r\n /**\r\n * Makes a duplicate of the current material.\r\n * @param name - name to use for the new material.\r\n * @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.\r\n * @param rootUrl defines the root URL to use to load textures\r\n * @returns cloned material instance\r\n */\r\n public override clone(name: string, cloneTexturesOnlyOnce: boolean = true, rootUrl = \"\"): PBRMaterial {\r\n const clone = SerializationHelper.Clone(() => new PBRMaterial(name, this.getScene()), this, { cloneTexturesOnlyOnce });\r\n\r\n clone.id = name;\r\n clone.name = name;\r\n\r\n this.stencil.copyTo(clone.stencil);\r\n\r\n this._clonePlugins(clone, rootUrl);\r\n\r\n return clone;\r\n }\r\n\r\n /**\r\n * Serializes this PBR Material.\r\n * @returns - An object with the serialized material.\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.PBRMaterial\";\r\n\r\n return serializationObject;\r\n }\r\n\r\n // Statics\r\n /**\r\n * Parses a PBR Material from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene - BJS scene instance.\r\n * @param rootUrl - url for the scene object\r\n * @returns - PBRMaterial\r\n */\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): PBRMaterial {\r\n const material = SerializationHelper.Parse(() => new PBRMaterial(source.name, scene), source, scene, rootUrl);\r\n\r\n if (source.stencil) {\r\n material.stencil.parse(source.stencil, scene, rootUrl);\r\n }\r\n\r\n Material._ParsePlugins(source, material, scene, rootUrl);\r\n\r\n // The code block below ensures backward compatibility with serialized materials before plugins are automatically serialized.\r\n if (source.clearCoat) {\r\n material.clearCoat.parse(source.clearCoat, scene, rootUrl);\r\n }\r\n if (source.anisotropy) {\r\n material.anisotropy.parse(source.anisotropy, scene, rootUrl);\r\n }\r\n if (source.brdf) {\r\n material.brdf.parse(source.brdf, scene, rootUrl);\r\n }\r\n if (source.sheen) {\r\n material.sheen.parse(source.sheen, scene, rootUrl);\r\n }\r\n if (source.subSurface) {\r\n material.subSurface.parse(source.subSurface, scene, rootUrl);\r\n }\r\n if (source.iridescence) {\r\n material.iridescence.parse(source.iridescence, scene, rootUrl);\r\n }\r\n\r\n return material;\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for pbrMaterial.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterPbrMaterial(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n RegisterClass(\"BABYLON.PBRMaterial\", PBRMaterial);\r\n}\r\n\r\n/**\r\n * Register side effects for PBRMaterial.\r\n * Safe to call multiple times; only the first call has an effect.\r\n * Alias for {@link RegisterPbrMaterial}.\r\n */\r\nexport function RegisterPBRMaterial(): void {\r\n RegisterPbrMaterial();\r\n}\r\n"]}
1
+ {"version":3,"file":"pbrMaterial.pure.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/PBR/pbrMaterial.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;;AAE7D,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3G,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAGxE,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAErD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,oCAAoC,EAAE,MAAM,sCAAsC,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,MAAM,kB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ACD,WAAW,GAAG,IAAI,CAAC;IAEnB,uHAAuH;IACvH,oCAAoC,EAAE,CAAC;IAEvC,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC;AACtD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB;IAC/B,mBAAmB,EAAE,CAAC;AAC1B,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { serialize, serializeAsColor3, expandToProperty, serializeAsTexture } from \"../../Misc/decorators\";\r\nimport { GetEnvironmentBRDFTexture } from \"../../Misc/brdfTextureTools\";\r\nimport { type Nullable } from \"../../types\";\r\nimport { type Scene } from \"../../scene.pure\";\r\nimport { Color3 } from \"../../Maths/math.color.pure\";\r\nimport { type BaseTexture } from \"../../Materials/Textures/baseTexture.pure\";\r\nimport { PBRBaseMaterial } from \"./pbrBaseMaterial.pure\";\r\nimport { RegisterImageProcessingConfiguration } from \"../imageProcessingConfiguration.pure\";\r\nimport { Material } from \"../material.pure\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\nimport { RegisterClass } from \"../../Misc/typeStore\";\r\n\r\n/**\r\n * The Physically based material of BJS.\r\n *\r\n * This offers the main features of a standard PBR material.\r\n * For more information, please refer to the documentation :\r\n * https://doc.babylonjs.com/features/featuresDeepDive/materials/using/introToPBR\r\n */\r\nexport class PBRMaterial extends PBRBaseMaterial {\r\n /**\r\n * PBRMaterialTransparencyMode: No transparency mode, Alpha channel is not use.\r\n */\r\n public static override readonly PBRMATERIAL_OPAQUE = PBRBaseMaterial.PBRMATERIAL_OPAQUE;\r\n\r\n /**\r\n * PBRMaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.\r\n */\r\n public static override readonly PBRMATERIAL_ALPHATEST = PBRBaseMaterial.PBRMATERIAL_ALPHATEST;\r\n\r\n /**\r\n * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\r\n */\r\n public static override readonly PBRMATERIAL_ALPHABLEND = PBRBaseMaterial.PBRMATERIAL_ALPHABLEND;\r\n\r\n /**\r\n * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\r\n * They are also discarded below the alpha cutoff threshold to improve performances.\r\n */\r\n public static override readonly PBRMATERIAL_ALPHATESTANDBLEND = PBRBaseMaterial.PBRMATERIAL_ALPHATESTANDBLEND;\r\n\r\n /**\r\n * Defines the default value of how much AO map is occluding the analytical lights\r\n * (point spot...).\r\n */\r\n public static override DEFAULT_AO_ON_ANALYTICAL_LIGHTS = PBRBaseMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS;\r\n\r\n /**\r\n * Intensity of the direct lights e.g. the four lights available in your scene.\r\n * This impacts both the direct diffuse and specular highlights.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public directIntensity: number = 1.0;\r\n\r\n /**\r\n * Intensity of the emissive part of the material.\r\n * This helps controlling the emissive effect without modifying the emissive color.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public emissiveIntensity: number = 1.0;\r\n\r\n /**\r\n * Intensity of the environment e.g. how much the environment will light the object\r\n * either through harmonics for rough material or through the reflection for shiny ones.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public environmentIntensity: number = 1.0;\r\n\r\n /**\r\n * This is a special control allowing the reduction of the specular highlights coming from the\r\n * four lights of the scene. Those highlights may not be needed in full environment lighting.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public specularIntensity: number = 1.0;\r\n\r\n /**\r\n * Debug Control allowing disabling the bump map on this material.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public disableBumpMap: boolean = false;\r\n\r\n /**\r\n * AKA Diffuse Texture in standard nomenclature.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public albedoTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * OpenPBR Base Weight texture (multiplier to the diffuse and metal lobes).\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public baseWeightTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * OpenPBR Base Diffuse Roughness texture (roughness of the diffuse lobe).\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public baseDiffuseRoughnessTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * AKA Occlusion Texture in other nomenclature.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public ambientTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * AKA Occlusion Texture Intensity in other nomenclature.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public ambientTextureStrength: number = 1.0;\r\n\r\n /**\r\n * Defines how much the AO map is occluding the analytical lights (point spot...).\r\n * 1 means it completely occludes it\r\n * 0 mean it has no impact\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public ambientTextureImpactOnAnalyticalLights: number = PBRMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS;\r\n\r\n /**\r\n * Stores the alpha values in a texture. Use luminance if texture.getAlphaFromRGB is true.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n public opacityTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Stores the reflection values in a texture.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public reflectionTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Stores the emissive values in a texture.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public emissiveTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * AKA Specular texture in other nomenclature.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public reflectivityTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Used to switch from specular/glossiness to metallic/roughness workflow.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public metallicTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Specifies the metallic scalar of the metallic/roughness workflow.\r\n * Can also be used to scale the metalness values of the metallic texture.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public metallic: Nullable<number>;\r\n\r\n /**\r\n * Specifies the roughness scalar of the metallic/roughness workflow.\r\n * Can also be used to scale the roughness values of the metallic texture.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public roughness: Nullable<number>;\r\n\r\n /**\r\n * In metallic workflow, specifies an F0 factor to help configuring the material F0.\r\n * By default the indexOfrefraction is used to compute F0;\r\n *\r\n * This is used as a factor against the default reflectance at normal incidence to tweak it.\r\n *\r\n * F0 = defaultF0 * metallicF0Factor * metallicReflectanceColor;\r\n * F90 = metallicReflectanceColor;\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public metallicF0Factor = 1;\r\n\r\n /**\r\n * In metallic workflow, specifies an F0 color.\r\n * By default the F90 is always 1;\r\n *\r\n * Please note that this factor is also used as a factor against the default reflectance at normal incidence.\r\n *\r\n * F0 = defaultF0_from_IOR * metallicF0Factor * metallicReflectanceColor\r\n * F90 = metallicF0Factor;\r\n */\r\n @serializeAsColor3()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public metallicReflectanceColor = Color3.White();\r\n\r\n /**\r\n * Specifies that only the A channel from metallicReflectanceTexture should be used.\r\n * If false, both RGB and A channels will be used\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useOnlyMetallicFromMetallicReflectanceTexture = false;\r\n\r\n /**\r\n * Defines to store metallicReflectanceColor in RGB and metallicF0Factor in A\r\n * This is multiplied against the scalar values defined in the material.\r\n * If useOnlyMetallicFromMetallicReflectanceTexture is true, don't use the RGB channels, only A\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public metallicReflectanceTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Defines to store reflectanceColor in RGB\r\n * This is multiplied against the scalar values defined in the material.\r\n * If both reflectanceTexture and metallicReflectanceTexture textures are provided and useOnlyMetallicFromMetallicReflectanceTexture\r\n * is false, metallicReflectanceTexture takes priority and reflectanceTexture is not used\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public reflectanceTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Used to enable roughness/glossiness fetch from a separate channel depending on the current mode.\r\n * Gray Scale represents roughness in metallic mode and glossiness in specular mode.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public microSurfaceTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Stores surface normal data used to displace a mesh in a texture.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public bumpTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Stores the pre-calculated light information of a mesh in a texture.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", null)\r\n public lightmapTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Stores the refracted light information in a texture.\r\n */\r\n public get refractionTexture(): Nullable<BaseTexture> {\r\n return this.subSurface.refractionTexture;\r\n }\r\n public set refractionTexture(value: Nullable<BaseTexture>) {\r\n this.subSurface.refractionTexture = value;\r\n if (value) {\r\n this.subSurface.isRefractionEnabled = true;\r\n } else if (!this.subSurface.linkRefractionWithTransparency) {\r\n this.subSurface.isRefractionEnabled = false;\r\n }\r\n }\r\n\r\n /**\r\n * The color of a material in ambient lighting.\r\n */\r\n @serializeAsColor3(\"ambient\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public ambientColor = new Color3(0, 0, 0);\r\n\r\n /**\r\n * AKA Diffuse Color in other nomenclature.\r\n */\r\n @serializeAsColor3(\"albedo\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public albedoColor = new Color3(1, 1, 1);\r\n\r\n /**\r\n * OpenPBR Base Weight (multiplier to the diffuse and metal lobes).\r\n */\r\n @serialize(\"baseWeight\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public baseWeight = 1;\r\n\r\n /**\r\n * OpenPBR Base Diffuse Roughness (roughness of the diffuse lobe).\r\n */\r\n @serialize(\"baseDiffuseRoughness\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public baseDiffuseRoughness: Nullable<number>;\r\n\r\n /**\r\n * AKA Specular Color in other nomenclature.\r\n */\r\n @serializeAsColor3(\"reflectivity\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public reflectivityColor = new Color3(1, 1, 1);\r\n\r\n /**\r\n * The color reflected from the material.\r\n */\r\n @serializeAsColor3(\"reflection\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public reflectionColor = new Color3(1.0, 1.0, 1.0);\r\n\r\n /**\r\n * The color emitted from the material.\r\n */\r\n @serializeAsColor3(\"emissive\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public emissiveColor = new Color3(0, 0, 0);\r\n\r\n /**\r\n * AKA Glossiness in other nomenclature.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public microSurface = 1.0;\r\n\r\n /**\r\n * Index of refraction of the material base layer.\r\n * https://en.wikipedia.org/wiki/List_of_refractive_indices\r\n *\r\n * This does not only impact refraction but also the Base F0 of Dielectric Materials.\r\n *\r\n * From dielectric fresnel rules: F0 = square((iorT - iorI) / (iorT + iorI))\r\n */\r\n public get indexOfRefraction(): number {\r\n return this.subSurface.indexOfRefraction;\r\n }\r\n public set indexOfRefraction(value: number) {\r\n this.subSurface.indexOfRefraction = value;\r\n }\r\n\r\n /**\r\n * Controls if refraction needs to be inverted on Y. This could be useful for procedural texture.\r\n */\r\n public get invertRefractionY(): boolean {\r\n return this.subSurface.invertRefractionY;\r\n }\r\n public set invertRefractionY(value: boolean) {\r\n this.subSurface.invertRefractionY = value;\r\n }\r\n\r\n /**\r\n * This parameters will make the material used its opacity to control how much it is refracting against not.\r\n * Materials half opaque for instance using refraction could benefit from this control.\r\n */\r\n public get linkRefractionWithTransparency(): boolean {\r\n return this.subSurface.linkRefractionWithTransparency;\r\n }\r\n public set linkRefractionWithTransparency(value: boolean) {\r\n this.subSurface.linkRefractionWithTransparency = value;\r\n if (value) {\r\n this.subSurface.isRefractionEnabled = true;\r\n }\r\n }\r\n\r\n /**\r\n * If true, the light map contains occlusion information instead of lighting info.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useLightmapAsShadowmap = false;\r\n\r\n /**\r\n * Specifies that the alpha is coming form the albedo channel alpha channel for alpha blending.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n public useAlphaFromAlbedoTexture = false;\r\n\r\n /**\r\n * Enforces alpha test in opaque or blend mode in order to improve the performances of some situations.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n public forceAlphaTest = false;\r\n\r\n /**\r\n * Defines the alpha limits in alpha test mode.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n public alphaCutOff = 0.4;\r\n\r\n /**\r\n * Specifies that the material will keep the specular highlights over a transparent surface (only the most luminous ones).\r\n * A car glass is a good example of that. When sun reflects on it you can not see what is behind.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useSpecularOverAlpha = true;\r\n\r\n /**\r\n * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useMicroSurfaceFromReflectivityMapAlpha = false;\r\n\r\n /**\r\n * Specifies if the metallic texture contains the roughness information in its alpha channel.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useRoughnessFromMetallicTextureAlpha = true;\r\n\r\n /**\r\n * Specifies if the metallic texture contains the roughness information in its green channel.\r\n * Needs useRoughnessFromMetallicTextureAlpha to be false.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useRoughnessFromMetallicTextureGreen = false;\r\n\r\n /**\r\n * Specifies if the metallic texture contains the metallness information in its blue channel.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useMetallnessFromMetallicTextureBlue = false;\r\n\r\n /**\r\n * Specifies if the metallic texture contains the ambient occlusion information in its red channel.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useAmbientOcclusionFromMetallicTextureRed = false;\r\n\r\n /**\r\n * Specifies if the ambient texture contains the ambient occlusion information in its red channel only.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useAmbientInGrayScale = false;\r\n\r\n /**\r\n * In case the reflectivity map does not contain the microsurface information in its alpha channel,\r\n * The material will try to infer what glossiness each pixel should be.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useAutoMicroSurfaceFromReflectivityMap = false;\r\n\r\n /**\r\n * BJS is using an hardcoded light falloff based on a manually sets up range.\r\n * In PBR, one way to represents the falloff is to use the inverse squared root algorithm.\r\n * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.\r\n */\r\n @serialize()\r\n public get usePhysicalLightFalloff(): boolean {\r\n return this._lightFalloff === PBRBaseMaterial.LIGHTFALLOFF_PHYSICAL;\r\n }\r\n\r\n /**\r\n * BJS is using an hardcoded light falloff based on a manually sets up range.\r\n * In PBR, one way to represents the falloff is to use the inverse squared root algorithm.\r\n * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.\r\n */\r\n public set usePhysicalLightFalloff(value: boolean) {\r\n if (value !== this.usePhysicalLightFalloff) {\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n\r\n if (value) {\r\n this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_PHYSICAL;\r\n } else {\r\n this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_STANDARD;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * In order to support the falloff compatibility with gltf, a special mode has been added\r\n * to reproduce the gltf light falloff.\r\n */\r\n @serialize()\r\n public get useGLTFLightFalloff(): boolean {\r\n return this._lightFalloff === PBRBaseMaterial.LIGHTFALLOFF_GLTF;\r\n }\r\n\r\n /**\r\n * In order to support the falloff compatibility with gltf, a special mode has been added\r\n * to reproduce the gltf light falloff.\r\n */\r\n public set useGLTFLightFalloff(value: boolean) {\r\n if (value !== this.useGLTFLightFalloff) {\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n\r\n if (value) {\r\n this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_GLTF;\r\n } else {\r\n this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_STANDARD;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Specifies that the material will keeps the reflection highlights over a transparent surface (only the most luminous ones).\r\n * A car glass is a good example of that. When the street lights reflects on it you can not see what is behind.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useRadianceOverAlpha = true;\r\n\r\n /**\r\n * Allows using an object space normal map (instead of tangent space).\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useObjectSpaceNormalMap = false;\r\n\r\n /**\r\n * Allows using the bump map in parallax mode.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useParallax = false;\r\n\r\n /**\r\n * Allows using the bump map in parallax occlusion mode.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useParallaxOcclusion = false;\r\n\r\n /**\r\n * Controls the scale bias of the parallax mode.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public parallaxScaleBias = 0.05;\r\n\r\n /**\r\n * If sets to true, disables all the lights affecting the material.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting = false;\r\n\r\n /**\r\n * Force the shader to compute irradiance in the fragment shader in order to take bump in account.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public forceIrradianceInFragment = false;\r\n\r\n /**\r\n * Number of Simultaneous lights allowed on the material.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights = 4;\r\n\r\n /**\r\n * If sets to true, x component of normal map value will invert (x = 1.0 - x).\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public invertNormalMapX = false;\r\n\r\n /**\r\n * If sets to true, y component of normal map value will invert (y = 1.0 - y).\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public invertNormalMapY = false;\r\n\r\n /**\r\n * If sets to true and backfaceCulling is false, normals will be flipped on the backside.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public twoSidedLighting = false;\r\n\r\n /**\r\n * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.\r\n * And/Or occlude the blended part. (alpha is converted to gamma to compute the fresnel)\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useAlphaFresnel = false;\r\n\r\n /**\r\n * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.\r\n * And/Or occlude the blended part. (alpha stays linear to compute the fresnel)\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useLinearAlphaFresnel = false;\r\n\r\n /**\r\n * Let user defines the brdf lookup texture used for IBL.\r\n * A default 8bit version is embedded but you could point at :\r\n * * Default texture: https://assets.babylonjs.com/environments/correlatedMSBRDF_RGBD.png\r\n * * Default 16bit pixel depth texture: https://assets.babylonjs.com/environments/correlatedMSBRDF.dds\r\n * * LEGACY Default None correlated https://assets.babylonjs.com/environments/uncorrelatedBRDF_RGBD.png\r\n * * LEGACY Default None correlated 16bit pixel depth https://assets.babylonjs.com/environments/uncorrelatedBRDF.dds\r\n */\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public environmentBRDFTexture: Nullable<BaseTexture> = null;\r\n\r\n /**\r\n * Force normal to face away from face.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public forceNormalForward = false;\r\n\r\n /**\r\n * Enables specular anti aliasing in the PBR shader.\r\n * It will both interacts on the Geometry for analytical and IBL lighting.\r\n * It also prefilter the roughness map based on the bump values.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public enableSpecularAntiAliasing = false;\r\n\r\n /**\r\n * This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal\r\n * makes the reflect vector face the model (under horizon).\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useHorizonOcclusion = true;\r\n\r\n /**\r\n * This parameters will enable/disable radiance occlusion by preventing the radiance to lit\r\n * too much the area relying on ambient texture to define their ambient occlusion.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useRadianceOcclusion = true;\r\n\r\n /**\r\n * If set to true, no lighting calculations will be applied.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\r\n public unlit = false;\r\n\r\n /**\r\n * If sets to true, the decal map will be applied after the detail map. Else, it is applied before (default: false)\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\r\n public applyDecalMapAfterDetailMap = false;\r\n\r\n /**\r\n * Instantiates a new PBRMaterial instance.\r\n *\r\n * @param name The material name\r\n * @param scene The scene the material will be use in.\r\n * @param forceGLSL Use the GLSL code generation for the shader (even on WebGPU). Default is false\r\n */\r\n constructor(name: string, scene?: Scene, forceGLSL = false) {\r\n super(name, scene, forceGLSL);\r\n\r\n this._environmentBRDFTexture = GetEnvironmentBRDFTexture(this.getScene());\r\n }\r\n\r\n /**\r\n * @returns the name of this material class.\r\n */\r\n public override getClassName(): string {\r\n return \"PBRMaterial\";\r\n }\r\n\r\n /**\r\n * Makes a duplicate of the current material.\r\n * @param name - name to use for the new material.\r\n * @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.\r\n * @param rootUrl defines the root URL to use to load textures\r\n * @returns cloned material instance\r\n */\r\n public override clone(name: string, cloneTexturesOnlyOnce: boolean = true, rootUrl = \"\"): PBRMaterial {\r\n const clone = SerializationHelper.Clone(() => new PBRMaterial(name, this.getScene()), this, { cloneTexturesOnlyOnce });\r\n\r\n clone.id = name;\r\n clone.name = name;\r\n\r\n this.stencil.copyTo(clone.stencil);\r\n\r\n this._clonePlugins(clone, rootUrl);\r\n\r\n return clone;\r\n }\r\n\r\n /**\r\n * Serializes this PBR Material.\r\n * @returns - An object with the serialized material.\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.PBRMaterial\";\r\n\r\n return serializationObject;\r\n }\r\n\r\n // Statics\r\n /**\r\n * Parses a PBR Material from a serialized object.\r\n * @param source - Serialized object.\r\n * @param scene - BJS scene instance.\r\n * @param rootUrl - url for the scene object\r\n * @returns - PBRMaterial\r\n */\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): PBRMaterial {\r\n const material = SerializationHelper.Parse(() => new PBRMaterial(source.name, scene), source, scene, rootUrl);\r\n\r\n if (source.stencil) {\r\n material.stencil.parse(source.stencil, scene, rootUrl);\r\n }\r\n\r\n Material._ParsePlugins(source, material, scene, rootUrl);\r\n\r\n // The code block below ensures backward compatibility with serialized materials before plugins are automatically serialized.\r\n if (source.clearCoat) {\r\n material.clearCoat.parse(source.clearCoat, scene, rootUrl);\r\n }\r\n if (source.anisotropy) {\r\n material.anisotropy.parse(source.anisotropy, scene, rootUrl);\r\n }\r\n if (source.brdf) {\r\n material.brdf.parse(source.brdf, scene, rootUrl);\r\n }\r\n if (source.sheen) {\r\n material.sheen.parse(source.sheen, scene, rootUrl);\r\n }\r\n if (source.subSurface) {\r\n material.subSurface.parse(source.subSurface, scene, rootUrl);\r\n }\r\n if (source.iridescence) {\r\n material.iridescence.parse(source.iridescence, scene, rootUrl);\r\n }\r\n\r\n return material;\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for pbrMaterial.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterPbrMaterial(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n // PBRMaterial serializes its image processing configuration, so the parser must be registered for clone/parse to work.\r\n RegisterImageProcessingConfiguration();\r\n\r\n RegisterClass(\"BABYLON.PBRMaterial\", PBRMaterial);\r\n}\r\n\r\n/**\r\n * Register side effects for PBRMaterial.\r\n * Safe to call multiple times; only the first call has an effect.\r\n * Alias for {@link RegisterPbrMaterial}.\r\n */\r\nexport function RegisterPBRMaterial(): void {\r\n RegisterPbrMaterial();\r\n}\r\n"]}
@@ -3,6 +3,7 @@ import { __decorate } from "../../tslib.es6.js";
3
3
  import { serialize, serializeAsColor3, expandToProperty, serializeAsTexture } from "../../Misc/decorators.js";
4
4
  import { SerializationHelper } from "../../Misc/decorators.serialization.js";
5
5
  import { PBRBaseSimpleMaterial } from "./pbrBaseSimpleMaterial.js";
6
+ import { RegisterImageProcessingConfiguration } from "../imageProcessingConfiguration.pure.js";
6
7
  import { RegisterClass } from "../../Misc/typeStore.js";
7
8
  /**
8
9
  * The PBR material of BJS following the metal roughness convention.
@@ -134,6 +135,8 @@ export function RegisterPbrMetallicRoughnessMaterial() {
134
135
  return;
135
136
  }
136
137
  _Registered = true;
138
+ // PBRMetallicRoughnessMaterial serializes its image processing configuration, so the parser must be registered for clone/parse to work.
139
+ RegisterImageProcessingConfiguration();
137
140
  RegisterClass("BABYLON.PBRMetallicRoughnessMaterial", PBRMetallicRoughnessMaterial);
138
141
  }
139
142
  //# sourceMappingURL=pbrMetallicRoughnessMaterial.pure.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pbrMetallicRoughnessMaterial.pure.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/PBR/pbrMetallicRoughnessMaterial.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;;AAE7D,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3G,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAI1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAE,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kCAAkC,CAAC;+DAC5B;AAQlB;IAFN,kBAAkB,EAAE;IACpB,gBAAgB,CAAC,kCAAkC,EAAE,kBAAkB,CAAC;8EAClB;AAyG3D,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,oCAAoC;IAChD,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,aAAa,CAAC,sCAAsC,EAAE,4BAA4B,CAAC,CAAC;AACxF,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { serialize, serializeAsColor3, expandToProperty, serializeAsTexture } from \"../../Misc/decorators\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\nimport { type Scene } from \"../../scene.pure\";\r\nimport { type Color3 } from \"../../Maths/math.color.pure\";\r\nimport { type BaseTexture } from \"../../Materials/Textures/baseTexture.pure\";\r\nimport { PBRBaseSimpleMaterial } from \"./pbrBaseSimpleMaterial\";\r\nimport { type Nullable } from \"../../types\";\r\nimport { RegisterClass } from \"../../Misc/typeStore\";\r\n\r\n/**\r\n * The PBR material of BJS following the metal roughness convention.\r\n *\r\n * This fits to the PBR convention in the GLTF definition:\r\n * https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Archived/KHR_materials_pbrSpecularGlossiness/README.md\r\n */\r\nexport class PBRMetallicRoughnessMaterial extends PBRBaseSimpleMaterial {\r\n /**\r\n * The base color has two different interpretations depending on the value of metalness.\r\n * When the material is a metal, the base color is the specific measured reflectance value\r\n * at normal incidence (F0). For a non-metal the base color represents the reflected diffuse color\r\n * of the material.\r\n */\r\n @serializeAsColor3()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_albedoColor\")\r\n public baseColor: Color3;\r\n\r\n /**\r\n * Base texture of the metallic workflow. It contains both the baseColor information in RGB as\r\n * well as opacity information in the alpha channel.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_albedoTexture\")\r\n public baseTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Specifies the metallic scalar value of the material.\r\n * Can also be used to scale the metalness values of the metallic texture.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public metallic: number;\r\n\r\n /**\r\n * Specifies the roughness scalar value of the material.\r\n * Can also be used to scale the roughness values of the metallic texture.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public roughness: number;\r\n\r\n /**\r\n * Texture containing both the metallic value in the B channel and the\r\n * roughness value in the G channel to keep better precision.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_metallicTexture\")\r\n public metallicRoughnessTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Instantiates a new PBRMetalRoughnessMaterial instance.\r\n *\r\n * @param name The material name\r\n * @param scene The scene the material will be use in.\r\n */\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n this._useRoughnessFromMetallicTextureAlpha = false;\r\n this._useRoughnessFromMetallicTextureGreen = true;\r\n this._useMetallnessFromMetallicTextureBlue = true;\r\n this.metallic = 1.0;\r\n this.roughness = 1.0;\r\n }\r\n\r\n /**\r\n * @returns the current class name of the material.\r\n */\r\n public override getClassName(): string {\r\n return \"PBRMetallicRoughnessMaterial\";\r\n }\r\n\r\n /**\r\n * Makes a duplicate of the current material.\r\n * @param name - name to use for the new material.\r\n * @returns cloned material instance\r\n */\r\n public override clone(name: string): PBRMetallicRoughnessMaterial {\r\n const clone = SerializationHelper.Clone(() => new PBRMetallicRoughnessMaterial(name, this.getScene()), this);\r\n\r\n clone.id = name;\r\n clone.name = name;\r\n\r\n this.clearCoat.copyTo(clone.clearCoat);\r\n this.anisotropy.copyTo(clone.anisotropy);\r\n this.brdf.copyTo(clone.brdf);\r\n this.sheen.copyTo(clone.sheen);\r\n this.subSurface.copyTo(clone.subSurface);\r\n\r\n return clone;\r\n }\r\n\r\n /**\r\n * Serialize the material to a parsable JSON object.\r\n * @returns the JSON object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.PBRMetallicRoughnessMaterial\";\r\n\r\n if (!this.clearCoat.doNotSerialize) {\r\n serializationObject.clearCoat = this.clearCoat.serialize();\r\n }\r\n if (!this.anisotropy.doNotSerialize) {\r\n serializationObject.anisotropy = this.anisotropy.serialize();\r\n }\r\n if (!this.brdf.doNotSerialize) {\r\n serializationObject.brdf = this.brdf.serialize();\r\n }\r\n if (!this.sheen.doNotSerialize) {\r\n serializationObject.sheen = this.sheen.serialize();\r\n }\r\n if (!this.subSurface.doNotSerialize) {\r\n serializationObject.subSurface = this.subSurface.serialize();\r\n }\r\n if (!this.iridescence.doNotSerialize) {\r\n serializationObject.iridescence = this.iridescence.serialize();\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parses a JSON object corresponding to the serialize function.\r\n * @param source - JSON source object.\r\n * @param scene - Defines the scene we are parsing for\r\n * @param rootUrl - Defines the rootUrl of this parsed object\r\n * @returns a new PBRMetalRoughnessMaterial\r\n */\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): PBRMetallicRoughnessMaterial {\r\n const material = SerializationHelper.Parse(() => new PBRMetallicRoughnessMaterial(source.name, scene), source, scene, rootUrl);\r\n if (source.clearCoat) {\r\n material.clearCoat.parse(source.clearCoat, scene, rootUrl);\r\n }\r\n if (source.anisotropy) {\r\n material.anisotropy.parse(source.anisotropy, scene, rootUrl);\r\n }\r\n if (source.brdf) {\r\n material.brdf.parse(source.brdf, scene, rootUrl);\r\n }\r\n if (source.sheen) {\r\n material.sheen.parse(source.sheen, scene, rootUrl);\r\n }\r\n if (source.subSurface) {\r\n material.subSurface.parse(source.subSurface, scene, rootUrl);\r\n }\r\n if (source.iridescence) {\r\n material.iridescence.parse(source.iridescence, scene, rootUrl);\r\n }\r\n return material;\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for pbrMetallicRoughnessMaterial.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterPbrMetallicRoughnessMaterial(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n RegisterClass(\"BABYLON.PBRMetallicRoughnessMaterial\", PBRMetallicRoughnessMaterial);\r\n}\r\n"]}
1
+ {"version":3,"file":"pbrMetallicRoughnessMaterial.pure.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/PBR/pbrMetallicRoughnessMaterial.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;;AAE7D,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3G,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAI1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,oCAAoC,EAAE,MAAM,sCAAsC,CAAC;AAE5F,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD;;;;;GAKG;AACH,MAAM,OAAO,4BAA6B,SAAQ,qBAAqB;IA2CnE;;;;;OAKG;IACH,YAAY,IAAY,EAAE,KAAa;QACnC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACnB,IAAI,CAAC,qCAAqC,GAAG,KAAK,CAAC;QACnD,IAAI,CAAC,qCAAqC,GAAG,IAAI,CAAC;QAClD,IAAI,CAAC,qCAAqC,GAAG,IAAI,CAAC;QAClD,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC;QACpB,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC;IACzB,CAAC;IAED;;OAEG;IACa,YAAY;QACxB,OAAO,8BAA8B,CAAC;IAC1C,CAAC;IAED;;;;OAIG;IACa,KAAK,CAAC,IAAY;QAC9B,MAAM,K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AAK,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QACvD,CAAC;QACD,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YACpB,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QACjE,CAAC;QACD,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;YACrB,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QACnE,CAAC;QACD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AAvIU;IAFN,iBAAiB,EAAE;IACnB,gBAAgB,CAAC,kCAAkC,EAAE,cAAc,CAAC;+DAC5C;AAQlB;IAFN,kBAAkB,EAAE;IACpB,gBAAgB,CAAC,kCAAkC,EAAE,gBAAgB,CAAC;iEAC7B;AAQnC;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;8DAC7B;AAQjB;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;+DAC5B;AAQlB;IAFN,kBAAkB,EAAE;IACpB,gBAAgB,CAAC,kCAAkC,EAAE,kBAAkB,CAAC;8EAClB;AAyG3D,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,oCAAoC;IAChD,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,wIAAwI;IACxI,oCAAoC,EAAE,CAAC;IAEvC,aAAa,CAAC,sCAAsC,EAAE,4BAA4B,CAAC,CAAC;AACxF,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { serialize, serializeAsColor3, expandToProperty, serializeAsTexture } from \"../../Misc/decorators\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\nimport { type Scene } from \"../../scene.pure\";\r\nimport { type Color3 } from \"../../Maths/math.color.pure\";\r\nimport { type BaseTexture } from \"../../Materials/Textures/baseTexture.pure\";\r\nimport { PBRBaseSimpleMaterial } from \"./pbrBaseSimpleMaterial\";\r\nimport { RegisterImageProcessingConfiguration } from \"../imageProcessingConfiguration.pure\";\r\nimport { type Nullable } from \"../../types\";\r\nimport { RegisterClass } from \"../../Misc/typeStore\";\r\n\r\n/**\r\n * The PBR material of BJS following the metal roughness convention.\r\n *\r\n * This fits to the PBR convention in the GLTF definition:\r\n * https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Archived/KHR_materials_pbrSpecularGlossiness/README.md\r\n */\r\nexport class PBRMetallicRoughnessMaterial extends PBRBaseSimpleMaterial {\r\n /**\r\n * The base color has two different interpretations depending on the value of metalness.\r\n * When the material is a metal, the base color is the specific measured reflectance value\r\n * at normal incidence (F0). For a non-metal the base color represents the reflected diffuse color\r\n * of the material.\r\n */\r\n @serializeAsColor3()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_albedoColor\")\r\n public baseColor: Color3;\r\n\r\n /**\r\n * Base texture of the metallic workflow. It contains both the baseColor information in RGB as\r\n * well as opacity information in the alpha channel.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_albedoTexture\")\r\n public baseTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Specifies the metallic scalar value of the material.\r\n * Can also be used to scale the metalness values of the metallic texture.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public metallic: number;\r\n\r\n /**\r\n * Specifies the roughness scalar value of the material.\r\n * Can also be used to scale the roughness values of the metallic texture.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public roughness: number;\r\n\r\n /**\r\n * Texture containing both the metallic value in the B channel and the\r\n * roughness value in the G channel to keep better precision.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_metallicTexture\")\r\n public metallicRoughnessTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Instantiates a new PBRMetalRoughnessMaterial instance.\r\n *\r\n * @param name The material name\r\n * @param scene The scene the material will be use in.\r\n */\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n this._useRoughnessFromMetallicTextureAlpha = false;\r\n this._useRoughnessFromMetallicTextureGreen = true;\r\n this._useMetallnessFromMetallicTextureBlue = true;\r\n this.metallic = 1.0;\r\n this.roughness = 1.0;\r\n }\r\n\r\n /**\r\n * @returns the current class name of the material.\r\n */\r\n public override getClassName(): string {\r\n return \"PBRMetallicRoughnessMaterial\";\r\n }\r\n\r\n /**\r\n * Makes a duplicate of the current material.\r\n * @param name - name to use for the new material.\r\n * @returns cloned material instance\r\n */\r\n public override clone(name: string): PBRMetallicRoughnessMaterial {\r\n const clone = SerializationHelper.Clone(() => new PBRMetallicRoughnessMaterial(name, this.getScene()), this);\r\n\r\n clone.id = name;\r\n clone.name = name;\r\n\r\n this.clearCoat.copyTo(clone.clearCoat);\r\n this.anisotropy.copyTo(clone.anisotropy);\r\n this.brdf.copyTo(clone.brdf);\r\n this.sheen.copyTo(clone.sheen);\r\n this.subSurface.copyTo(clone.subSurface);\r\n\r\n return clone;\r\n }\r\n\r\n /**\r\n * Serialize the material to a parsable JSON object.\r\n * @returns the JSON object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.PBRMetallicRoughnessMaterial\";\r\n\r\n if (!this.clearCoat.doNotSerialize) {\r\n serializationObject.clearCoat = this.clearCoat.serialize();\r\n }\r\n if (!this.anisotropy.doNotSerialize) {\r\n serializationObject.anisotropy = this.anisotropy.serialize();\r\n }\r\n if (!this.brdf.doNotSerialize) {\r\n serializationObject.brdf = this.brdf.serialize();\r\n }\r\n if (!this.sheen.doNotSerialize) {\r\n serializationObject.sheen = this.sheen.serialize();\r\n }\r\n if (!this.subSurface.doNotSerialize) {\r\n serializationObject.subSurface = this.subSurface.serialize();\r\n }\r\n if (!this.iridescence.doNotSerialize) {\r\n serializationObject.iridescence = this.iridescence.serialize();\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parses a JSON object corresponding to the serialize function.\r\n * @param source - JSON source object.\r\n * @param scene - Defines the scene we are parsing for\r\n * @param rootUrl - Defines the rootUrl of this parsed object\r\n * @returns a new PBRMetalRoughnessMaterial\r\n */\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): PBRMetallicRoughnessMaterial {\r\n const material = SerializationHelper.Parse(() => new PBRMetallicRoughnessMaterial(source.name, scene), source, scene, rootUrl);\r\n if (source.clearCoat) {\r\n material.clearCoat.parse(source.clearCoat, scene, rootUrl);\r\n }\r\n if (source.anisotropy) {\r\n material.anisotropy.parse(source.anisotropy, scene, rootUrl);\r\n }\r\n if (source.brdf) {\r\n material.brdf.parse(source.brdf, scene, rootUrl);\r\n }\r\n if (source.sheen) {\r\n material.sheen.parse(source.sheen, scene, rootUrl);\r\n }\r\n if (source.subSurface) {\r\n material.subSurface.parse(source.subSurface, scene, rootUrl);\r\n }\r\n if (source.iridescence) {\r\n material.iridescence.parse(source.iridescence, scene, rootUrl);\r\n }\r\n return material;\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for pbrMetallicRoughnessMaterial.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterPbrMetallicRoughnessMaterial(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n // PBRMetallicRoughnessMaterial serializes its image processing configuration, so the parser must be registered for clone/parse to work.\r\n RegisterImageProcessingConfiguration();\r\n\r\n RegisterClass(\"BABYLON.PBRMetallicRoughnessMaterial\", PBRMetallicRoughnessMaterial);\r\n}\r\n"]}
@@ -2,6 +2,7 @@
2
2
  import { __decorate } from "../../tslib.es6.js";
3
3
  import { serialize, serializeAsColor3, expandToProperty, serializeAsTexture } from "../../Misc/decorators.js";
4
4
  import { PBRBaseSimpleMaterial } from "./pbrBaseSimpleMaterial.js";
5
+ import { RegisterImageProcessingConfiguration } from "../imageProcessingConfiguration.pure.js";
5
6
  import { SerializationHelper } from "../../Misc/decorators.serialization.js";
6
7
  import { RegisterClass } from "../../Misc/typeStore.js";
7
8
  /**
@@ -136,6 +137,8 @@ export function RegisterPbrSpecularGlossinessMaterial() {
136
137
  return;
137
138
  }
138
139
  _Registered = true;
140
+ // PBRSpecularGlossinessMaterial serializes its image processing configuration, so the parser must be registered for clone/parse to work.
141
+ RegisterImageProcessingConfiguration();
139
142
  RegisterClass("BABYLON.PBRSpecularGlossinessMaterial", PBRSpecularGlossinessMaterial);
140
143
  }
141
144
  //# sourceMappingURL=pbrSpecularGlossinessMaterial.pure.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pbrSpecularGlossinessMaterial.pure.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/PBR/pbrSpecularGlossinessMaterial.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;;AAE7D,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAI3G,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD;;;;;GAKG;AACH,MAAM,OAAO,6BAA8B,SAAQ,qBAAqB;IAqCpE;;OAEG;IACH,IAAW,uCAAuC;QAC9C,OAAO,IAAI,CAAC,wCAAwC,CAAC;IACzD,CAAC;IAED;;;;;OAKG;IACH,YAAY,IAAY,EAAE,KAAa;QACnC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACnB,IAAI,CAAC,wCAAwC,GAAG,IAAI,CAAC;IACzD,CAAC;IAED;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n\r\nimport { serialize, serializeAsColor3, expandToProperty, serializeAsTexture } from \"../../Misc/decorators\";\r\nimport { type Scene } from \"../../scene.pure\";\r\nimport { type Color3 } from \"../../Maths/math.color.pure\";\r\nimport { type BaseTexture } from \"../../Materials/Textures/baseTexture.pure\";\r\nimport { PBRBaseSimpleMaterial } from \"./pbrBaseSimpleMaterial\";\r\nimport { type Nullable } from \"../../types\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\nimport { RegisterClass } from \"../../Misc/typeStore\";\r\n\r\n/**\r\n * The PBR material of BJS following the specular glossiness convention.\r\n *\r\n * This fits to the PBR convention in the GLTF definition:\r\n * https://github.com/KhronosGroup/glTF/tree/2.0/extensions/Khronos/KHR_materials_pbrSpecularGlossiness\r\n */\r\nexport class PBRSpecularGlossinessMaterial extends PBRBaseSimpleMaterial {\r\n /**\r\n * Specifies the diffuse color of the material.\r\n */\r\n @serializeAsColor3(\"diffuse\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_albedoColor\")\r\n public diffuseColor: Color3;\r\n\r\n /**\r\n * Specifies the diffuse texture of the material. This can also contains the opacity value in its alpha\r\n * channel.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_albedoTexture\")\r\n public diffuseTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Specifies the specular color of the material. This indicates how reflective is the material (none to mirror).\r\n */\r\n @serializeAsColor3(\"specular\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_reflectivityColor\")\r\n public specularColor: Color3;\r\n\r\n /**\r\n * Specifies the glossiness of the material. This indicates \"how sharp is the reflection\".\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_microSurface\")\r\n public glossiness: number;\r\n\r\n /**\r\n * Specifies both the specular color RGB and the glossiness A of the material per pixels.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_reflectivityTexture\")\r\n public specularGlossinessTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.\r\n */\r\n public get useMicroSurfaceFromReflectivityMapAlpha() {\r\n return this._useMicroSurfaceFromReflectivityMapAlpha;\r\n }\r\n\r\n /**\r\n * Instantiates a new PBRSpecularGlossinessMaterial instance.\r\n *\r\n * @param name The material name\r\n * @param scene The scene the material will be use in.\r\n */\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n this._useMicroSurfaceFromReflectivityMapAlpha = true;\r\n }\r\n\r\n /**\r\n * @returns the current class name of the material.\r\n */\r\n public override getClassName(): string {\r\n return \"PBRSpecularGlossinessMaterial\";\r\n }\r\n\r\n /**\r\n * Makes a duplicate of the current material.\r\n * @param name - name to use for the new material.\r\n * @returns cloned material instance\r\n */\r\n public override clone(name: string): PBRSpecularGlossinessMaterial {\r\n const clone = SerializationHelper.Clone(() => new PBRSpecularGlossinessMaterial(name, this.getScene()), this);\r\n\r\n clone.id = name;\r\n clone.name = name;\r\n\r\n this.clearCoat.copyTo(clone.clearCoat);\r\n this.anisotropy.copyTo(clone.anisotropy);\r\n this.brdf.copyTo(clone.brdf);\r\n this.sheen.copyTo(clone.sheen);\r\n this.subSurface.copyTo(clone.subSurface);\r\n\r\n return clone;\r\n }\r\n\r\n /**\r\n * Serialize the material to a parsable JSON object.\r\n * @returns the JSON object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.PBRSpecularGlossinessMaterial\";\r\n\r\n if (!this.clearCoat.doNotSerialize) {\r\n serializationObject.clearCoat = this.clearCoat.serialize();\r\n }\r\n if (!this.anisotropy.doNotSerialize) {\r\n serializationObject.anisotropy = this.anisotropy.serialize();\r\n }\r\n if (!this.brdf.doNotSerialize) {\r\n serializationObject.brdf = this.brdf.serialize();\r\n }\r\n if (!this.sheen.doNotSerialize) {\r\n serializationObject.sheen = this.sheen.serialize();\r\n }\r\n if (!this.subSurface.doNotSerialize) {\r\n serializationObject.subSurface = this.subSurface.serialize();\r\n }\r\n if (!this.iridescence.doNotSerialize) {\r\n serializationObject.iridescence = this.iridescence.serialize();\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parses a JSON object corresponding to the serialize function.\r\n * @param source - JSON source object.\r\n * @param scene - the scene to parse to.\r\n * @param rootUrl - root url of the assets.\r\n * @returns a new PBRSpecularGlossinessMaterial.\r\n */\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): PBRSpecularGlossinessMaterial {\r\n const material = SerializationHelper.Parse(() => new PBRSpecularGlossinessMaterial(source.name, scene), source, scene, rootUrl);\r\n if (source.clearCoat) {\r\n material.clearCoat.parse(source.clearCoat, scene, rootUrl);\r\n }\r\n if (source.anisotropy) {\r\n material.anisotropy.parse(source.anisotropy, scene, rootUrl);\r\n }\r\n if (source.brdf) {\r\n material.brdf.parse(source.brdf, scene, rootUrl);\r\n }\r\n if (source.sheen) {\r\n material.sheen.parse(source.sheen, scene, rootUrl);\r\n }\r\n if (source.subSurface) {\r\n material.subSurface.parse(source.subSurface, scene, rootUrl);\r\n }\r\n if (source.iridescence) {\r\n material.iridescence.parse(source.iridescence, scene, rootUrl);\r\n }\r\n return material;\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for pbrSpecularGlossinessMaterial.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterPbrSpecularGlossinessMaterial(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n RegisterClass(\"BABYLON.PBRSpecularGlossinessMaterial\", PBRSpecularGlossinessMaterial);\r\n}\r\n"]}
1
+ {"version":3,"file":"pbrSpecularGlossinessMaterial.pure.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/PBR/pbrSpecularGlossinessMaterial.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;;AAE7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;IAFN,kBAAkB,EAAE;IACpB,gBAAgB,CAAC,kCAAkC,EAAE,gBAAgB,CAAC;qEAC1B;AAOtC;IAFN,iBAAiB,CAAC,UAAU,CAAC;IAC7B,gBAAgB,CAAC,kCAAkC,EAAE,oBAAoB,CAAC;oEAC9C;AAOtB;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,EAAE,eAAe,CAAC;iEAC5C;AAOnB;IAFN,kBAAkB,EAAE;IACpB,gBAAgB,CAAC,kCAAkC,EAAE,sBAAsB,CAAC;gFACrB;AA4G5D,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,qCAAqC;IACjD,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,yIAAyI;IACzI,oCAAoC,EAAE,CAAC;IAEvC,aAAa,CAAC,uCAAuC,EAAE,6BAA6B,CAAC,CAAC;AAC1F,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { serialize, serializeAsColor3, expandToProperty, serializeAsTexture } from \"../../Misc/decorators\";\r\nimport { type Scene } from \"../../scene.pure\";\r\nimport { type Color3 } from \"../../Maths/math.color.pure\";\r\nimport { type BaseTexture } from \"../../Materials/Textures/baseTexture.pure\";\r\nimport { PBRBaseSimpleMaterial } from \"./pbrBaseSimpleMaterial\";\r\nimport { RegisterImageProcessingConfiguration } from \"../imageProcessingConfiguration.pure\";\r\nimport { type Nullable } from \"../../types\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\nimport { RegisterClass } from \"../../Misc/typeStore\";\r\n\r\n/**\r\n * The PBR material of BJS following the specular glossiness convention.\r\n *\r\n * This fits to the PBR convention in the GLTF definition:\r\n * https://github.com/KhronosGroup/glTF/tree/2.0/extensions/Khronos/KHR_materials_pbrSpecularGlossiness\r\n */\r\nexport class PBRSpecularGlossinessMaterial extends PBRBaseSimpleMaterial {\r\n /**\r\n * Specifies the diffuse color of the material.\r\n */\r\n @serializeAsColor3(\"diffuse\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_albedoColor\")\r\n public diffuseColor: Color3;\r\n\r\n /**\r\n * Specifies the diffuse texture of the material. This can also contains the opacity value in its alpha\r\n * channel.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_albedoTexture\")\r\n public diffuseTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Specifies the specular color of the material. This indicates how reflective is the material (none to mirror).\r\n */\r\n @serializeAsColor3(\"specular\")\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_reflectivityColor\")\r\n public specularColor: Color3;\r\n\r\n /**\r\n * Specifies the glossiness of the material. This indicates \"how sharp is the reflection\".\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_microSurface\")\r\n public glossiness: number;\r\n\r\n /**\r\n * Specifies both the specular color RGB and the glossiness A of the material per pixels.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_reflectivityTexture\")\r\n public specularGlossinessTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.\r\n */\r\n public get useMicroSurfaceFromReflectivityMapAlpha() {\r\n return this._useMicroSurfaceFromReflectivityMapAlpha;\r\n }\r\n\r\n /**\r\n * Instantiates a new PBRSpecularGlossinessMaterial instance.\r\n *\r\n * @param name The material name\r\n * @param scene The scene the material will be use in.\r\n */\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n this._useMicroSurfaceFromReflectivityMapAlpha = true;\r\n }\r\n\r\n /**\r\n * @returns the current class name of the material.\r\n */\r\n public override getClassName(): string {\r\n return \"PBRSpecularGlossinessMaterial\";\r\n }\r\n\r\n /**\r\n * Makes a duplicate of the current material.\r\n * @param name - name to use for the new material.\r\n * @returns cloned material instance\r\n */\r\n public override clone(name: string): PBRSpecularGlossinessMaterial {\r\n const clone = SerializationHelper.Clone(() => new PBRSpecularGlossinessMaterial(name, this.getScene()), this);\r\n\r\n clone.id = name;\r\n clone.name = name;\r\n\r\n this.clearCoat.copyTo(clone.clearCoat);\r\n this.anisotropy.copyTo(clone.anisotropy);\r\n this.brdf.copyTo(clone.brdf);\r\n this.sheen.copyTo(clone.sheen);\r\n this.subSurface.copyTo(clone.subSurface);\r\n\r\n return clone;\r\n }\r\n\r\n /**\r\n * Serialize the material to a parsable JSON object.\r\n * @returns the JSON object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.PBRSpecularGlossinessMaterial\";\r\n\r\n if (!this.clearCoat.doNotSerialize) {\r\n serializationObject.clearCoat = this.clearCoat.serialize();\r\n }\r\n if (!this.anisotropy.doNotSerialize) {\r\n serializationObject.anisotropy = this.anisotropy.serialize();\r\n }\r\n if (!this.brdf.doNotSerialize) {\r\n serializationObject.brdf = this.brdf.serialize();\r\n }\r\n if (!this.sheen.doNotSerialize) {\r\n serializationObject.sheen = this.sheen.serialize();\r\n }\r\n if (!this.subSurface.doNotSerialize) {\r\n serializationObject.subSurface = this.subSurface.serialize();\r\n }\r\n if (!this.iridescence.doNotSerialize) {\r\n serializationObject.iridescence = this.iridescence.serialize();\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parses a JSON object corresponding to the serialize function.\r\n * @param source - JSON source object.\r\n * @param scene - the scene to parse to.\r\n * @param rootUrl - root url of the assets.\r\n * @returns a new PBRSpecularGlossinessMaterial.\r\n */\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): PBRSpecularGlossinessMaterial {\r\n const material = SerializationHelper.Parse(() => new PBRSpecularGlossinessMaterial(source.name, scene), source, scene, rootUrl);\r\n if (source.clearCoat) {\r\n material.clearCoat.parse(source.clearCoat, scene, rootUrl);\r\n }\r\n if (source.anisotropy) {\r\n material.anisotropy.parse(source.anisotropy, scene, rootUrl);\r\n }\r\n if (source.brdf) {\r\n material.brdf.parse(source.brdf, scene, rootUrl);\r\n }\r\n if (source.sheen) {\r\n material.sheen.parse(source.sheen, scene, rootUrl);\r\n }\r\n if (source.subSurface) {\r\n material.subSurface.parse(source.subSurface, scene, rootUrl);\r\n }\r\n if (source.iridescence) {\r\n material.iridescence.parse(source.iridescence, scene, rootUrl);\r\n }\r\n return material;\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for pbrSpecularGlossinessMaterial.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterPbrSpecularGlossinessMaterial(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n // PBRSpecularGlossinessMaterial serializes its image processing configuration, so the parser must be registered for clone/parse to work.\r\n RegisterImageProcessingConfiguration();\r\n\r\n RegisterClass(\"BABYLON.PBRSpecularGlossinessMaterial\", PBRSpecularGlossinessMaterial);\r\n}\r\n"]}
@@ -2,6 +2,5 @@
2
2
  * Re-exports pure implementation and applies runtime side effects.
3
3
  * Import cubeTexture.pure for tree-shakeable, side-effect-free usage.
4
4
  */
5
- import "../../Engines/AbstractEngine/abstractEngine.cubeTexture.js";
6
5
  export * from "./cubeTexture.pure.js";
7
6
  export * from "./cubeTexture.types.js";
@@ -2,7 +2,6 @@
2
2
  * Re-exports pure implementation and applies runtime side effects.
3
3
  * Import cubeTexture.pure for tree-shakeable, side-effect-free usage.
4
4
  */
5
- import "../../Engines/AbstractEngine/abstractEngine.cubeTexture.js";
6
5
  export * from "./cubeTexture.pure.js";
7
6
  export * from "./cubeTexture.types.js";
8
7
  import { RegisterCubeTexture } from "./cubeTexture.pure.js";
@@ -1 +1 @@
1
- {"version":3,"file":"cubeTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/cubeTexture.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,yDAAyD,CAAC;AACjE,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AAEpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,mBAAmB,EAAE,CAAC","sourcesContent":["/**\n * Re-exports pure implementation and applies runtime side effects.\n * Import cubeTexture.pure for tree-shakeable, side-effect-free usage.\n */\nimport \"../../Engines/AbstractEngine/abstractEngine.cubeTexture\";\nexport * from \"./cubeTexture.pure\";\nexport * from \"./cubeTexture.types\";\n\nimport { RegisterCubeTexture } from \"./cubeTexture.pure\";\nRegisterCubeTexture();\n"]}
1
+ {"version":3,"file":"cubeTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/cubeTexture.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AAEpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,mBAAmB,EAAE,CAAC","sourcesContent":["/**\n * Re-exports pure implementation and applies runtime side effects.\n * Import cubeTexture.pure for tree-shakeable, side-effect-free usage.\n */\nexport * from \"./cubeTexture.pure\";\nexport * from \"./cubeTexture.types\";\n\nimport { RegisterCubeTexture } from \"./cubeTexture.pure\";\nRegisterCubeTexture();\n"]}
@@ -9,6 +9,7 @@ import { Texture } from "../../Materials/Textures/texture.pure.js";
9
9
  import { GetClass, RegisterClass } from "../../Misc/typeStore.js";
10
10
  import { Observable } from "../../Misc/observable.pure.js";
11
11
  import { SerializationHelper } from "../../Misc/decorators.serialization.js";
12
+ import { RegisterAbstractEngineCubeTexture } from "../../Engines/AbstractEngine/abstractEngine.cubeTexture.pure.js";
12
13
  // The default scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness
13
14
  const DefaultLodScale = 0.8;
14
15
  /**
@@ -102,6 +103,7 @@ export class CubeTexture extends BaseTexture {
102
103
  this._extensions = null;
103
104
  this._textureMatrixRefraction = new Matrix();
104
105
  this._buffer = null;
106
+ RegisterAbstractEngineCubeTexture();
105
107
  this.name = rootUrl;
106
108
  this.url = rootUrl;
107
109
  this._noMipmap = noMipmap;
@@ -1 +1 @@
1
- {"version":3,"file":"cubeTexture.pure.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/cubeTexture.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;;AAE7D,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGrD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAoD1E,gIAAgI;AAChI,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,WAAW;IA2BxC;;;;;OAKG;IACH,IAAW,eAAe,CAAC,KAAc;QACrC,IAAI,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/D,OAAO;QACX,CAAC;QACD,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;QAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC9B,IAAI,KAAK,EAAE,CAAC;YACR,KAAK,CAAC,uBAAuB,CAAC,SAAS,CAAC,yBAAyB,CAAC,CAAC;QACvE,CAAC;IACL,CAAC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AiB;IACjB,IAAI,aAAa,CAAC,mBAAmB,EAAE,CAAC;QACpC,OAAO,CAAC,mBAAmB,GAAG,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;IACvF,CAAC;IACD,IAAI,aAAa,CAAC,eAAe,EAAE,CAAC;QAChC,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;IAC/E,CAAC;IAED,aAAa;IACb,IAAI,aAAa,CAAC,UAAU,EAAE,CAAC;QAC3B,KAAK,IAAI,cAAc,GAAG,CAAC,EAAE,cAAc,GAAG,aAAa,CAAC,UAAU,CAAC,MAAM,EAAE,cAAc,EAAE,EAAE,CAAC;YAC9F,MAAM,eAAe,GAAG,aAAa,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;YACjE,MAAM,aAAa,GAAG,QAAQ,CAAC,mBAAmB,CAAC,CAAC;YACpD,IAAI,aAAa,EAAE,CAAC;gBAChB,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC;YAClE,CAAC;QACL,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACnB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB;IAC/B,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,WAAW,CAAC,gBAAgB,GAAG,2BAA2B,CAAC;IAC3D,WAAW,CAAC,yBAAyB,GAAG,oCAAoC,CAAC;IAC7E,WAAW,CAAC,KAAK,GAAG,gBAAgB,CAAC;IAErC,OAAO,CAAC,kBAAkB,GAAG,gBAAgB,CAAC;IAE9C,6CAA6C;IAC7C,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC;AACtD,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\n\nimport { serialize, serializeAsMatrix, serializeAsVector3 } from \"../../Misc/decorators\";\nimport { TimingTools } from \"../../Misc/timingTools\";\nimport { type Nullable } from \"../../types\";\nimport { type Scene } from \"../../scene.pure\";\nimport { Matrix, TmpVectors, Vector3 } from \"../../Maths/math.vector.pure\";\nimport { BaseTexture } from \"../../Materials/Textures/baseTexture.pure\";\nimport { Texture } from \"../../Materials/Textures/texture.pure\";\nimport { Constants } from \"../../Engines/constants\";\nimport { GetClass, RegisterClass } from \"../../Misc/typeStore\";\nimport { type AbstractEngine } from \"../../Engines/abstractEngine.pure\";\nimport { Observable } from \"../../Misc/observable.pure\";\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\n\n/**\n * Defines the available options when creating a cube texture\n */\nexport interface ICubeTextureCreationOptions {\n /** Defines the suffixes add to the picture name in case six images are in use like _px.jpg */\n extensions?: string[];\n\n /** noMipmap defines if mipmaps should be created or not */\n noMipmap?: boolean;\n\n /** files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz */\n files?: string[];\n\n /** buffer to load instead of loading the data from the url */\n buffer?: ArrayBufferView;\n\n /** onLoad defines a callback triggered at the end of the file load if no errors occurred */\n onLoad?: () => void;\n\n /** onError defines a callback triggered in case of error during load */\n onError?: (message?: string, exception?: any) => void;\n\n /** format defines the internal format to use for the texture once loaded */\n format?: number;\n\n /** prefiltered defines whether or not the texture is created from prefiltered data */\n prefiltered?: boolean;\n\n /** forcedExtension defines the extensions to use (force a special type of file to load) in case it is different from the file name */\n forcedExtension?: any;\n\n /** createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary */\n createPolynomials?: boolean;\n\n /** lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness */\n lodScale?: number;\n\n /** lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness */\n lodOffset?: number;\n\n /** loaderOptions options to be passed to the loader */\n loaderOptions?: any;\n\n /** useSRGBBuffer Defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU) (default: false) */\n useSRGBBuffer?: boolean;\n\n /** Target face size for spherical polynomial computation. 0 = full resolution (default). */\n sphericalPolynomialTargetSize?: number;\n}\n\n// The default scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\nconst DefaultLodScale = 0.8;\n\n/**\n * Class for creating a cube texture\n */\nexport class CubeTexture extends BaseTexture {\n private _delayedOnLoad: Nullable<() => void>;\n private _delayedOnError: Nullable<(message?: string, exception?: any) => void>;\n private _lodScale: number;\n private _lodOffset: number;\n\n /**\n * Observable triggered once the texture has been loaded.\n */\n public onLoadObservable: Observable<CubeTexture> = new Observable<CubeTexture>();\n\n /**\n * The url of the texture\n */\n @serialize()\n public url: string;\n\n /**\n * Gets or sets the center of the bounding box associated with the cube texture.\n * It must define where the camera used to render the texture was set\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/reflectionTexture#using-local-cubemap-mode\n */\n @serializeAsVector3()\n public boundingBoxPosition = Vector3.Zero();\n\n private _boundingBoxSize: Vector3;\n\n /**\n * Gets or sets the size of the bounding box associated with the cube texture\n * When defined, the cubemap will switch to local mode\n * @see https://community.arm.com/graphics/b/blog/posts/reflections-based-on-local-cubemaps-in-unity\n * @example https://www.babylonjs-playground.com/#RNASML\n */\n public set boundingBoxSize(value: Vector3) {\n if (this._boundingBoxSize && this._boundingBoxSize.equals(value)) {\n return;\n }\n this._boundingBoxSize = value;\n const scene = this.getScene();\n if (scene) {\n scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);\n }\n }\n /**\n * Returns the bounding box size\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/reflectionTexture#using-local-cubemap-mode\n */\n @serializeAsVector3()\n public get boundingBoxSize(): Vector3 {\n return this._boundingBoxSize;\n }\n\n protected _rotationY: number = 0;\n\n /**\n * Sets texture matrix rotation angle around Y axis in radians.\n */\n @serialize(\"rotationY\")\n public set rotationY(value: number) {\n this._rotationY = value;\n this.setReflectionTextureMatrix(Matrix.RotationY(this._rotationY));\n }\n /**\n * Gets texture matrix rotation angle around Y axis radians.\n */\n public get rotationY(): number {\n return this._rotationY;\n }\n\n /**\n * Are mip maps generated for this texture or not.\n */\n public override get noMipmap(): boolean {\n return this._noMipmap;\n }\n\n private _noMipmap: boolean;\n\n /** @internal */\n @serialize(\"files\")\n public _files: Nullable<string[]> = null;\n\n @serialize(\"forcedExtension\")\n protected _forcedExtension: Nullable<string> = null;\n\n /**\n * Gets the forced extension (if any)\n */\n public get forcedExtension(): Nullable<string> {\n return this._forcedExtension;\n }\n\n @serialize(\"extensions\")\n private _extensions: Nullable<string[]> = null;\n\n @serializeAsMatrix(\"textureMatrix\")\n private _textureMatrix: Matrix;\n\n @serializeAsMatrix(\"textureMatrixRefraction\")\n private _textureMatrixRefraction: Matrix = new Matrix();\n\n private _format: number;\n private _createPolynomials: boolean;\n private _loaderOptions: any;\n private _useSRGBBuffer?: boolean;\n private _buffer: Nullable<ArrayBufferView> = null;\n\n /**\n * Creates a cube texture to use with reflection for instance. It can be based upon dds or six images as well\n * as prefiltered data.\n * @param rootUrl defines the url of the texture or the root name of the six images\n * @param sceneOrEngine defines the scene or engine the texture is attached to\n * @param extensionsOrOptions defines the suffixes add to the picture name in case six images are in use like _px.jpg or set of all options to create the cube texture\n * @param noMipmap defines if mipmaps should be created or not\n * @param files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz\n * @param onLoad defines a callback triggered at the end of the file load if no errors occurred\n * @param onError defines a callback triggered in case of error during load\n * @param format defines the internal format to use for the texture once loaded\n * @param prefiltered defines whether or not the texture is created from prefiltered data\n * @param forcedExtension defines the extensions to use (force a special type of file to load) in case it is different from the file name\n * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary\n * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\n * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness\n * @param loaderOptions options to be passed to the loader\n * @param useSRGBBuffer Defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU) (default: false)\n * @returns the cube texture\n */\n constructor(\n rootUrl: string,\n sceneOrEngine: Scene | AbstractEngine,\n extensionsOrOptions: Nullable<string[] | ICubeTextureCreationOptions> = null,\n noMipmap: boolean = false,\n files: Nullable<string[]> = null,\n onLoad: Nullable<() => void> = null,\n onError: Nullable<(message?: string, exception?: any) => void> = null,\n format: number = Constants.TEXTUREFORMAT_RGBA,\n prefiltered = false,\n forcedExtension: any = null,\n createPolynomials: boolean = false,\n lodScale: number = DefaultLodScale,\n lodOffset: number = 0,\n loaderOptions?: any,\n useSRGBBuffer?: boolean\n ) {\n super(sceneOrEngine);\n\n this.name = rootUrl;\n this.url = rootUrl;\n this._noMipmap = noMipmap;\n this.hasAlpha = false;\n this.isCube = true;\n this._textureMatrix = Matrix.Identity();\n this.coordinatesMode = Texture.CUBIC_MODE;\n\n let extensions: Nullable<string[]>;\n let buffer: Nullable<ArrayBufferView> = null;\n\n if (extensionsOrOptions !== null && !Array.isArray(extensionsOrOptions)) {\n extensions = extensionsOrOptions.extensions ?? null;\n this._noMipmap = extensionsOrOptions.noMipmap ?? false;\n files = extensionsOrOptions.files ?? null;\n buffer = extensionsOrOptions.buffer ?? null;\n this._format = extensionsOrOptions.format ?? Constants.TEXTUREFORMAT_RGBA;\n prefiltered = extensionsOrOptions.prefiltered ?? false;\n forcedExtension = extensionsOrOptions.forcedExtension ?? null;\n this._createPolynomials = extensionsOrOptions.createPolynomials ?? false;\n this._lodScale = extensionsOrOptions.lodScale ?? DefaultLodScale;\n this._lodOffset = extensionsOrOptions.lodOffset ?? 0;\n this._loaderOptions = extensionsOrOptions.loaderOptions;\n this._useSRGBBuffer = extensionsOrOptions.useSRGBBuffer;\n this._sphericalPolynomialTargetSize = extensionsOrOptions.sphericalPolynomialTargetSize ?? 0;\n onLoad = extensionsOrOptions.onLoad ?? null;\n onError = extensionsOrOptions.onError ?? null;\n } else {\n this._noMipmap = noMipmap;\n this._format = format;\n this._createPolynomials = createPolynomials;\n extensions = extensionsOrOptions;\n this._loaderOptions = loaderOptions;\n this._useSRGBBuffer = useSRGBBuffer;\n this._lodScale = lodScale;\n this._lodOffset = lodOffset;\n }\n\n if (!rootUrl && !files) {\n return;\n }\n\n this.updateURL(rootUrl, forcedExtension, onLoad, prefiltered, onError, extensions, this.getScene()?.useDelayedTextureLoading, files, buffer);\n }\n\n /**\n * Get the current class name of the texture useful for serialization or dynamic coding.\n * @returns \"CubeTexture\"\n */\n public override getClassName(): string {\n return \"CubeTexture\";\n }\n\n /**\n * Update the url (and optional buffer) of this texture if url was null during construction.\n * @param url the url of the texture\n * @param forcedExtension defines the extension to use\n * @param onLoad callback called when the texture is loaded (defaults to null)\n * @param prefiltered Defines whether the updated texture is prefiltered or not\n * @param onError callback called if there was an error during the loading process (defaults to null)\n * @param extensions defines the suffixes add to the picture name in case six images are in use like _px.jpg...\n * @param delayLoad defines if the texture should be loaded now (false by default)\n * @param files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz\n * @param buffer the buffer to use instead of loading from the url\n */\n public updateURL(\n url: string,\n forcedExtension: Nullable<string> = null,\n onLoad: Nullable<() => void> = null,\n prefiltered: boolean = false,\n onError: Nullable<(message?: string, exception?: any) => void> = null,\n extensions: Nullable<string[]> = null,\n delayLoad = false,\n files: Nullable<string[]> = null,\n buffer: Nullable<ArrayBufferView> = null\n ): void {\n if (!this.name || this.name.startsWith(\"data:\")) {\n this.name = url;\n }\n this.url = url;\n\n if (forcedExtension) {\n this._forcedExtension = forcedExtension;\n }\n\n const lastDot = url.lastIndexOf(\".\");\n const extension = forcedExtension ? forcedExtension : lastDot > -1 ? url.substring(lastDot).toLowerCase() : \"\";\n const isDDS = extension.indexOf(\".dds\") === 0;\n const isEnv = extension.indexOf(\".env\") === 0;\n const isBasis = extension.indexOf(\".basis\") === 0;\n\n if (isEnv) {\n this.gammaSpace = false;\n this._prefiltered = false;\n this.anisotropicFilteringLevel = 1;\n } else {\n this._prefiltered = prefiltered;\n\n if (prefiltered) {\n this.gammaSpace = false;\n this.anisotropicFilteringLevel = 1;\n }\n }\n\n if (files) {\n this._files = files;\n } else {\n if (!isBasis && !isEnv && !isDDS && !extensions) {\n extensions = [\"_px.jpg\", \"_py.jpg\", \"_pz.jpg\", \"_nx.jpg\", \"_ny.jpg\", \"_nz.jpg\"];\n }\n\n this._files = this._files || [];\n this._files.length = 0;\n\n if (extensions) {\n for (let index = 0; index < extensions.length; index++) {\n this._files.push(url + extensions[index]);\n }\n this._extensions = extensions;\n }\n }\n\n this._buffer = buffer;\n\n if (delayLoad) {\n this.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;\n this._delayedOnLoad = onLoad;\n this._delayedOnError = onError;\n } else {\n this._loadTexture(onLoad, onError);\n }\n }\n\n /**\n * Delays loading of the cube texture\n * @param forcedExtension defines the extension to use\n */\n public override delayLoad(forcedExtension?: string): void {\n if (this.delayLoadState !== Constants.DELAYLOADSTATE_NOTLOADED) {\n return;\n }\n if (forcedExtension) {\n this._forcedExtension = forcedExtension;\n }\n\n this.delayLoadState = Constants.DELAYLOADSTATE_LOADED;\n this._loadTexture(this._delayedOnLoad, this._delayedOnError);\n }\n\n /**\n * Returns the reflection texture matrix\n * @returns the reflection texture matrix\n */\n public override getReflectionTextureMatrix(): Matrix {\n return this._textureMatrix;\n }\n\n /**\n * Sets the reflection texture matrix\n * @param value Reflection texture matrix\n */\n public setReflectionTextureMatrix(value: Matrix): void {\n if (value.updateFlag === this._textureMatrix.updateFlag) {\n return;\n }\n\n if (value.isIdentity() !== this._textureMatrix.isIdentity()) {\n this.getScene()?.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => mat.getActiveTextures().indexOf(this) !== -1);\n }\n\n this._textureMatrix = value;\n\n if (!this.getScene()?.useRightHandedSystem) {\n return;\n }\n\n const scale = TmpVectors.Vector3[0];\n const quat = TmpVectors.Quaternion[0];\n const trans = TmpVectors.Vector3[1];\n\n this._textureMatrix.decompose(scale, quat, trans);\n\n quat.z *= -1; // these two operations correspond to negating the x and y euler angles\n quat.w *= -1;\n\n Matrix.ComposeToRef(scale, quat, trans, this._textureMatrixRefraction);\n }\n\n /**\n * Gets a suitable rotate/transform matrix when the texture is used for refraction.\n * There's a separate function from getReflectionTextureMatrix because refraction requires a special configuration of the matrix in right-handed mode.\n * @returns The refraction matrix\n */\n public override getRefractionTextureMatrix(): Matrix {\n return this.getScene()?.useRightHandedSystem ? this._textureMatrixRefraction : this._textureMatrix;\n }\n\n private _loadTexture(onLoad: Nullable<() => void> = null, onError: Nullable<(message?: string, exception?: any) => void> = null) {\n const scene = this.getScene();\n const oldTexture = this._texture;\n this._texture = this._getFromCache(this.url, this._noMipmap, undefined, undefined, this._useSRGBBuffer, this.isCube);\n\n const onLoadProcessing = () => {\n this.onLoadObservable.notifyObservers(this);\n if (oldTexture) {\n oldTexture.dispose();\n this.getScene()?.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);\n }\n if (onLoad) {\n onLoad();\n }\n };\n\n const errorHandler = (message?: string, exception?: any) => {\n this._loadingError = true;\n this._errorObject = { message, exception };\n if (onError) {\n onError(message, exception);\n }\n Texture.OnTextureLoadErrorObservable.notifyObservers(this);\n };\n\n if (!this._texture) {\n if (this._prefiltered) {\n this._texture = this._getEngine()!.createPrefilteredCubeTexture(\n this.url,\n scene,\n this._lodScale,\n this._lodOffset,\n onLoad,\n errorHandler,\n this._format,\n this._forcedExtension,\n this._createPolynomials\n );\n } else {\n this._texture = this._getEngine()!.createCubeTexture(\n this.url,\n scene,\n this._files,\n this._noMipmap,\n onLoad,\n errorHandler,\n this._format,\n this._forcedExtension,\n false,\n this._lodScale,\n this._lodOffset,\n null,\n this._loaderOptions,\n !!this._useSRGBBuffer,\n this._buffer\n );\n }\n\n this._texture?.onLoadedObservable.add(() => this.onLoadObservable.notifyObservers(this));\n } else {\n if (this._texture.isReady) {\n TimingTools.SetImmediate(() => onLoadProcessing());\n } else {\n this._texture.onLoadedObservable.add(() => onLoadProcessing());\n }\n }\n }\n\n /**\n * Makes a clone, or deep copy, of the cube texture\n * @returns a new cube texture\n */\n public override clone(): CubeTexture {\n let uniqueId = 0;\n\n // Save the irradianceTexture before cloning. The irradianceTexture is\n // stored on the InternalTexture (_texture._irradianceTexture), which may\n // be shared between the source and clone when loaded from cache.\n // BaseTexture.clone() returns null, so CopySource sets the shared\n // irradianceTexture to null, losing it on both the original and the clone.\n const savedIrradianceTexture = this.irradianceTexture;\n\n const newCubeTexture = SerializationHelper.Clone(() => {\n const cubeTexture = new CubeTexture(this.url, this.getScene() || this._getEngine()!, this._extensions, this._noMipmap, this._files);\n uniqueId = cubeTexture.uniqueId;\n\n return cubeTexture;\n }, this);\n\n newCubeTexture.uniqueId = uniqueId;\n\n // Restore the irradianceTexture if it was cleared during cloning.\n if (savedIrradianceTexture && !this.irradianceTexture) {\n this.irradianceTexture = savedIrradianceTexture;\n }\n\n return newCubeTexture;\n }\n}\n\nlet _Registered = false;\n\n/**\n * Creates a cube texture from an array of image urls\n * @param files defines an array of image urls\n * @param scene defines the hosting scene\n * @param noMipmap specifies if mip maps are not used\n * @returns a cube texture\n */\nexport function CubeTextureCreateFromImages(files: string[], scene: Scene, noMipmap?: boolean): CubeTexture {\n let rootUrlKey = \"\";\n\n for (const url of files) {\n rootUrlKey += url;\n }\n\n return new CubeTexture(rootUrlKey, scene, null, noMipmap, files);\n}\n\n/**\n * Creates and return a texture created from prefilterd data by tools like IBL Baker or Lys.\n * @param url defines the url of the prefiltered texture\n * @param scene defines the scene the texture is attached to\n * @param forcedExtension defines the extension of the file if different from the url\n * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary\n * @returns the prefiltered texture\n */\nexport function CubeTextureCreateFromPrefilteredData(url: string, scene: Scene, forcedExtension: any = null, createPolynomials: boolean = true): CubeTexture {\n const oldValue = scene.useDelayedTextureLoading;\n scene.useDelayedTextureLoading = false;\n\n const result = new CubeTexture(url, scene, null, false, null, null, null, undefined, true, forcedExtension, createPolynomials);\n\n scene.useDelayedTextureLoading = oldValue;\n\n return result;\n}\n\n/**\n * Parses text to create a cube texture\n * @param parsedTexture define the serialized text to read from\n * @param scene defines the hosting scene\n * @param rootUrl defines the root url of the cube texture\n * @returns a cube texture\n */\nexport function CubeTextureParse(parsedTexture: any, scene: Scene, rootUrl: string): CubeTexture {\n const texture = SerializationHelper.Parse(\n () => {\n let prefiltered: boolean = false;\n if (parsedTexture.prefiltered) {\n prefiltered = parsedTexture.prefiltered;\n }\n return new CubeTexture(\n rootUrl + (parsedTexture.url ?? parsedTexture.name),\n scene,\n parsedTexture.extensions,\n false,\n parsedTexture.files || null,\n null,\n null,\n undefined,\n prefiltered,\n parsedTexture.forcedExtension\n );\n },\n parsedTexture,\n scene\n );\n\n // Local Cubemaps\n if (parsedTexture.boundingBoxPosition) {\n texture.boundingBoxPosition = Vector3.FromArray(parsedTexture.boundingBoxPosition);\n }\n if (parsedTexture.boundingBoxSize) {\n texture.boundingBoxSize = Vector3.FromArray(parsedTexture.boundingBoxSize);\n }\n\n // Animations\n if (parsedTexture.animations) {\n for (let animationIndex = 0; animationIndex < parsedTexture.animations.length; animationIndex++) {\n const parsedAnimation = parsedTexture.animations[animationIndex];\n const internalClass = GetClass(\"BABYLON.Animation\");\n if (internalClass) {\n texture.animations.push(internalClass.Parse(parsedAnimation));\n }\n }\n }\n\n return texture;\n}\n\n/**\n * Register side effects for cubeTexture.\n * Safe to call multiple times; only the first call has an effect.\n */\nexport function RegisterCubeTexture(): void {\n if (_Registered) {\n return;\n }\n _Registered = true;\n\n CubeTexture.CreateFromImages = CubeTextureCreateFromImages;\n CubeTexture.CreateFromPrefilteredData = CubeTextureCreateFromPrefilteredData;\n CubeTexture.Parse = CubeTextureParse;\n\n Texture._CubeTextureParser = CubeTextureParse;\n\n // Some exporters relies on Tools.Instantiate\n RegisterClass(\"BABYLON.CubeTexture\", CubeTexture);\n}\n"]}
1
+ {"version":3,"file":"cubeTexture.pure.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/cubeTexture.pure.ts"],"names":[],"m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Aa,CAAC,mBAAmB,CAAC,CAAC;IACvF,CAAC;IACD,IAAI,aAAa,CAAC,eAAe,EAAE,CAAC;QAChC,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;IAC/E,CAAC;IAED,aAAa;IACb,IAAI,aAAa,CAAC,UAAU,EAAE,CAAC;QAC3B,KAAK,IAAI,cAAc,GAAG,CAAC,EAAE,cAAc,GAAG,aAAa,CAAC,UAAU,CAAC,MAAM,EAAE,cAAc,EAAE,EAAE,CAAC;YAC9F,MAAM,eAAe,GAAG,aAAa,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;YACjE,MAAM,aAAa,GAAG,QAAQ,CAAC,mBAAmB,CAAC,CAAC;YACpD,IAAI,aAAa,EAAE,CAAC;gBAChB,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC;YAClE,CAAC;QACL,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACnB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB;IAC/B,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,WAAW,CAAC,gBAAgB,GAAG,2BAA2B,CAAC;IAC3D,WAAW,CAAC,yBAAyB,GAAG,oCAAoC,CAAC;IAC7E,WAAW,CAAC,KAAK,GAAG,gBAAgB,CAAC;IAErC,OAAO,CAAC,kBAAkB,GAAG,gBAAgB,CAAC;IAE9C,6CAA6C;IAC7C,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC;AACtD,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\n\nimport { serialize, serializeAsMatrix, serializeAsVector3 } from \"../../Misc/decorators\";\nimport { TimingTools } from \"../../Misc/timingTools\";\nimport { type Nullable } from \"../../types\";\nimport { type Scene } from \"../../scene.pure\";\nimport { Matrix, TmpVectors, Vector3 } from \"../../Maths/math.vector.pure\";\nimport { BaseTexture } from \"../../Materials/Textures/baseTexture.pure\";\nimport { Texture } from \"../../Materials/Textures/texture.pure\";\nimport { Constants } from \"../../Engines/constants\";\nimport { GetClass, RegisterClass } from \"../../Misc/typeStore\";\nimport { type AbstractEngine } from \"../../Engines/abstractEngine.pure\";\nimport { Observable } from \"../../Misc/observable.pure\";\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\nimport { RegisterAbstractEngineCubeTexture } from \"../../Engines/AbstractEngine/abstractEngine.cubeTexture.pure\";\n\n/**\n * Defines the available options when creating a cube texture\n */\nexport interface ICubeTextureCreationOptions {\n /** Defines the suffixes add to the picture name in case six images are in use like _px.jpg */\n extensions?: string[];\n\n /** noMipmap defines if mipmaps should be created or not */\n noMipmap?: boolean;\n\n /** files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz */\n files?: string[];\n\n /** buffer to load instead of loading the data from the url */\n buffer?: ArrayBufferView;\n\n /** onLoad defines a callback triggered at the end of the file load if no errors occurred */\n onLoad?: () => void;\n\n /** onError defines a callback triggered in case of error during load */\n onError?: (message?: string, exception?: any) => void;\n\n /** format defines the internal format to use for the texture once loaded */\n format?: number;\n\n /** prefiltered defines whether or not the texture is created from prefiltered data */\n prefiltered?: boolean;\n\n /** forcedExtension defines the extensions to use (force a special type of file to load) in case it is different from the file name */\n forcedExtension?: any;\n\n /** createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary */\n createPolynomials?: boolean;\n\n /** lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness */\n lodScale?: number;\n\n /** lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness */\n lodOffset?: number;\n\n /** loaderOptions options to be passed to the loader */\n loaderOptions?: any;\n\n /** useSRGBBuffer Defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU) (default: false) */\n useSRGBBuffer?: boolean;\n\n /** Target face size for spherical polynomial computation. 0 = full resolution (default). */\n sphericalPolynomialTargetSize?: number;\n}\n\n// The default scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\nconst DefaultLodScale = 0.8;\n\n/**\n * Class for creating a cube texture\n */\nexport class CubeTexture extends BaseTexture {\n private _delayedOnLoad: Nullable<() => void>;\n private _delayedOnError: Nullable<(message?: string, exception?: any) => void>;\n private _lodScale: number;\n private _lodOffset: number;\n\n /**\n * Observable triggered once the texture has been loaded.\n */\n public onLoadObservable: Observable<CubeTexture> = new Observable<CubeTexture>();\n\n /**\n * The url of the texture\n */\n @serialize()\n public url: string;\n\n /**\n * Gets or sets the center of the bounding box associated with the cube texture.\n * It must define where the camera used to render the texture was set\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/reflectionTexture#using-local-cubemap-mode\n */\n @serializeAsVector3()\n public boundingBoxPosition = Vector3.Zero();\n\n private _boundingBoxSize: Vector3;\n\n /**\n * Gets or sets the size of the bounding box associated with the cube texture\n * When defined, the cubemap will switch to local mode\n * @see https://community.arm.com/graphics/b/blog/posts/reflections-based-on-local-cubemaps-in-unity\n * @example https://www.babylonjs-playground.com/#RNASML\n */\n public set boundingBoxSize(value: Vector3) {\n if (this._boundingBoxSize && this._boundingBoxSize.equals(value)) {\n return;\n }\n this._boundingBoxSize = value;\n const scene = this.getScene();\n if (scene) {\n scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);\n }\n }\n /**\n * Returns the bounding box size\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/reflectionTexture#using-local-cubemap-mode\n */\n @serializeAsVector3()\n public get boundingBoxSize(): Vector3 {\n return this._boundingBoxSize;\n }\n\n protected _rotationY: number = 0;\n\n /**\n * Sets texture matrix rotation angle around Y axis in radians.\n */\n @serialize(\"rotationY\")\n public set rotationY(value: number) {\n this._rotationY = value;\n this.setReflectionTextureMatrix(Matrix.RotationY(this._rotationY));\n }\n /**\n * Gets texture matrix rotation angle around Y axis radians.\n */\n public get rotationY(): number {\n return this._rotationY;\n }\n\n /**\n * Are mip maps generated for this texture or not.\n */\n public override get noMipmap(): boolean {\n return this._noMipmap;\n }\n\n private _noMipmap: boolean;\n\n /** @internal */\n @serialize(\"files\")\n public _files: Nullable<string[]> = null;\n\n @serialize(\"forcedExtension\")\n protected _forcedExtension: Nullable<string> = null;\n\n /**\n * Gets the forced extension (if any)\n */\n public get forcedExtension(): Nullable<string> {\n return this._forcedExtension;\n }\n\n @serialize(\"extensions\")\n private _extensions: Nullable<string[]> = null;\n\n @serializeAsMatrix(\"textureMatrix\")\n private _textureMatrix: Matrix;\n\n @serializeAsMatrix(\"textureMatrixRefraction\")\n private _textureMatrixRefraction: Matrix = new Matrix();\n\n private _format: number;\n private _createPolynomials: boolean;\n private _loaderOptions: any;\n private _useSRGBBuffer?: boolean;\n private _buffer: Nullable<ArrayBufferView> = null;\n\n /**\n * Creates a cube texture to use with reflection for instance. It can be based upon dds or six images as well\n * as prefiltered data.\n * @param rootUrl defines the url of the texture or the root name of the six images\n * @param sceneOrEngine defines the scene or engine the texture is attached to\n * @param extensionsOrOptions defines the suffixes add to the picture name in case six images are in use like _px.jpg or set of all options to create the cube texture\n * @param noMipmap defines if mipmaps should be created or not\n * @param files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz\n * @param onLoad defines a callback triggered at the end of the file load if no errors occurred\n * @param onError defines a callback triggered in case of error during load\n * @param format defines the internal format to use for the texture once loaded\n * @param prefiltered defines whether or not the texture is created from prefiltered data\n * @param forcedExtension defines the extensions to use (force a special type of file to load) in case it is different from the file name\n * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary\n * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\n * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness\n * @param loaderOptions options to be passed to the loader\n * @param useSRGBBuffer Defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU) (default: false)\n * @returns the cube texture\n */\n constructor(\n rootUrl: string,\n sceneOrEngine: Scene | AbstractEngine,\n extensionsOrOptions: Nullable<string[] | ICubeTextureCreationOptions> = null,\n noMipmap: boolean = false,\n files: Nullable<string[]> = null,\n onLoad: Nullable<() => void> = null,\n onError: Nullable<(message?: string, exception?: any) => void> = null,\n format: number = Constants.TEXTUREFORMAT_RGBA,\n prefiltered = false,\n forcedExtension: any = null,\n createPolynomials: boolean = false,\n lodScale: number = DefaultLodScale,\n lodOffset: number = 0,\n loaderOptions?: any,\n useSRGBBuffer?: boolean\n ) {\n super(sceneOrEngine);\n\n RegisterAbstractEngineCubeTexture();\n\n this.name = rootUrl;\n this.url = rootUrl;\n this._noMipmap = noMipmap;\n this.hasAlpha = false;\n this.isCube = true;\n this._textureMatrix = Matrix.Identity();\n this.coordinatesMode = Texture.CUBIC_MODE;\n\n let extensions: Nullable<string[]>;\n let buffer: Nullable<ArrayBufferView> = null;\n\n if (extensionsOrOptions !== null && !Array.isArray(extensionsOrOptions)) {\n extensions = extensionsOrOptions.extensions ?? null;\n this._noMipmap = extensionsOrOptions.noMipmap ?? false;\n files = extensionsOrOptions.files ?? null;\n buffer = extensionsOrOptions.buffer ?? null;\n this._format = extensionsOrOptions.format ?? Constants.TEXTUREFORMAT_RGBA;\n prefiltered = extensionsOrOptions.prefiltered ?? false;\n forcedExtension = extensionsOrOptions.forcedExtension ?? null;\n this._createPolynomials = extensionsOrOptions.createPolynomials ?? false;\n this._lodScale = extensionsOrOptions.lodScale ?? DefaultLodScale;\n this._lodOffset = extensionsOrOptions.lodOffset ?? 0;\n this._loaderOptions = extensionsOrOptions.loaderOptions;\n this._useSRGBBuffer = extensionsOrOptions.useSRGBBuffer;\n this._sphericalPolynomialTargetSize = extensionsOrOptions.sphericalPolynomialTargetSize ?? 0;\n onLoad = extensionsOrOptions.onLoad ?? null;\n onError = extensionsOrOptions.onError ?? null;\n } else {\n this._noMipmap = noMipmap;\n this._format = format;\n this._createPolynomials = createPolynomials;\n extensions = extensionsOrOptions;\n this._loaderOptions = loaderOptions;\n this._useSRGBBuffer = useSRGBBuffer;\n this._lodScale = lodScale;\n this._lodOffset = lodOffset;\n }\n\n if (!rootUrl && !files) {\n return;\n }\n\n this.updateURL(rootUrl, forcedExtension, onLoad, prefiltered, onError, extensions, this.getScene()?.useDelayedTextureLoading, files, buffer);\n }\n\n /**\n * Get the current class name of the texture useful for serialization or dynamic coding.\n * @returns \"CubeTexture\"\n */\n public override getClassName(): string {\n return \"CubeTexture\";\n }\n\n /**\n * Update the url (and optional buffer) of this texture if url was null during construction.\n * @param url the url of the texture\n * @param forcedExtension defines the extension to use\n * @param onLoad callback called when the texture is loaded (defaults to null)\n * @param prefiltered Defines whether the updated texture is prefiltered or not\n * @param onError callback called if there was an error during the loading process (defaults to null)\n * @param extensions defines the suffixes add to the picture name in case six images are in use like _px.jpg...\n * @param delayLoad defines if the texture should be loaded now (false by default)\n * @param files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz\n * @param buffer the buffer to use instead of loading from the url\n */\n public updateURL(\n url: string,\n forcedExtension: Nullable<string> = null,\n onLoad: Nullable<() => void> = null,\n prefiltered: boolean = false,\n onError: Nullable<(message?: string, exception?: any) => void> = null,\n extensions: Nullable<string[]> = null,\n delayLoad = false,\n files: Nullable<string[]> = null,\n buffer: Nullable<ArrayBufferView> = null\n ): void {\n if (!this.name || this.name.startsWith(\"data:\")) {\n this.name = url;\n }\n this.url = url;\n\n if (forcedExtension) {\n this._forcedExtension = forcedExtension;\n }\n\n const lastDot = url.lastIndexOf(\".\");\n const extension = forcedExtension ? forcedExtension : lastDot > -1 ? url.substring(lastDot).toLowerCase() : \"\";\n const isDDS = extension.indexOf(\".dds\") === 0;\n const isEnv = extension.indexOf(\".env\") === 0;\n const isBasis = extension.indexOf(\".basis\") === 0;\n\n if (isEnv) {\n this.gammaSpace = false;\n this._prefiltered = false;\n this.anisotropicFilteringLevel = 1;\n } else {\n this._prefiltered = prefiltered;\n\n if (prefiltered) {\n this.gammaSpace = false;\n this.anisotropicFilteringLevel = 1;\n }\n }\n\n if (files) {\n this._files = files;\n } else {\n if (!isBasis && !isEnv && !isDDS && !extensions) {\n extensions = [\"_px.jpg\", \"_py.jpg\", \"_pz.jpg\", \"_nx.jpg\", \"_ny.jpg\", \"_nz.jpg\"];\n }\n\n this._files = this._files || [];\n this._files.length = 0;\n\n if (extensions) {\n for (let index = 0; index < extensions.length; index++) {\n this._files.push(url + extensions[index]);\n }\n this._extensions = extensions;\n }\n }\n\n this._buffer = buffer;\n\n if (delayLoad) {\n this.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;\n this._delayedOnLoad = onLoad;\n this._delayedOnError = onError;\n } else {\n this._loadTexture(onLoad, onError);\n }\n }\n\n /**\n * Delays loading of the cube texture\n * @param forcedExtension defines the extension to use\n */\n public override delayLoad(forcedExtension?: string): void {\n if (this.delayLoadState !== Constants.DELAYLOADSTATE_NOTLOADED) {\n return;\n }\n if (forcedExtension) {\n this._forcedExtension = forcedExtension;\n }\n\n this.delayLoadState = Constants.DELAYLOADSTATE_LOADED;\n this._loadTexture(this._delayedOnLoad, this._delayedOnError);\n }\n\n /**\n * Returns the reflection texture matrix\n * @returns the reflection texture matrix\n */\n public override getReflectionTextureMatrix(): Matrix {\n return this._textureMatrix;\n }\n\n /**\n * Sets the reflection texture matrix\n * @param value Reflection texture matrix\n */\n public setReflectionTextureMatrix(value: Matrix): void {\n if (value.updateFlag === this._textureMatrix.updateFlag) {\n return;\n }\n\n if (value.isIdentity() !== this._textureMatrix.isIdentity()) {\n this.getScene()?.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => mat.getActiveTextures().indexOf(this) !== -1);\n }\n\n this._textureMatrix = value;\n\n if (!this.getScene()?.useRightHandedSystem) {\n return;\n }\n\n const scale = TmpVectors.Vector3[0];\n const quat = TmpVectors.Quaternion[0];\n const trans = TmpVectors.Vector3[1];\n\n this._textureMatrix.decompose(scale, quat, trans);\n\n quat.z *= -1; // these two operations correspond to negating the x and y euler angles\n quat.w *= -1;\n\n Matrix.ComposeToRef(scale, quat, trans, this._textureMatrixRefraction);\n }\n\n /**\n * Gets a suitable rotate/transform matrix when the texture is used for refraction.\n * There's a separate function from getReflectionTextureMatrix because refraction requires a special configuration of the matrix in right-handed mode.\n * @returns The refraction matrix\n */\n public override getRefractionTextureMatrix(): Matrix {\n return this.getScene()?.useRightHandedSystem ? this._textureMatrixRefraction : this._textureMatrix;\n }\n\n private _loadTexture(onLoad: Nullable<() => void> = null, onError: Nullable<(message?: string, exception?: any) => void> = null) {\n const scene = this.getScene();\n const oldTexture = this._texture;\n this._texture = this._getFromCache(this.url, this._noMipmap, undefined, undefined, this._useSRGBBuffer, this.isCube);\n\n const onLoadProcessing = () => {\n this.onLoadObservable.notifyObservers(this);\n if (oldTexture) {\n oldTexture.dispose();\n this.getScene()?.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);\n }\n if (onLoad) {\n onLoad();\n }\n };\n\n const errorHandler = (message?: string, exception?: any) => {\n this._loadingError = true;\n this._errorObject = { message, exception };\n if (onError) {\n onError(message, exception);\n }\n Texture.OnTextureLoadErrorObservable.notifyObservers(this);\n };\n\n if (!this._texture) {\n if (this._prefiltered) {\n this._texture = this._getEngine()!.createPrefilteredCubeTexture(\n this.url,\n scene,\n this._lodScale,\n this._lodOffset,\n onLoad,\n errorHandler,\n this._format,\n this._forcedExtension,\n this._createPolynomials\n );\n } else {\n this._texture = this._getEngine()!.createCubeTexture(\n this.url,\n scene,\n this._files,\n this._noMipmap,\n onLoad,\n errorHandler,\n this._format,\n this._forcedExtension,\n false,\n this._lodScale,\n this._lodOffset,\n null,\n this._loaderOptions,\n !!this._useSRGBBuffer,\n this._buffer\n );\n }\n\n this._texture?.onLoadedObservable.add(() => this.onLoadObservable.notifyObservers(this));\n } else {\n if (this._texture.isReady) {\n TimingTools.SetImmediate(() => onLoadProcessing());\n } else {\n this._texture.onLoadedObservable.add(() => onLoadProcessing());\n }\n }\n }\n\n /**\n * Makes a clone, or deep copy, of the cube texture\n * @returns a new cube texture\n */\n public override clone(): CubeTexture {\n let uniqueId = 0;\n\n // Save the irradianceTexture before cloning. The irradianceTexture is\n // stored on the InternalTexture (_texture._irradianceTexture), which may\n // be shared between the source and clone when loaded from cache.\n // BaseTexture.clone() returns null, so CopySource sets the shared\n // irradianceTexture to null, losing it on both the original and the clone.\n const savedIrradianceTexture = this.irradianceTexture;\n\n const newCubeTexture = SerializationHelper.Clone(() => {\n const cubeTexture = new CubeTexture(this.url, this.getScene() || this._getEngine()!, this._extensions, this._noMipmap, this._files);\n uniqueId = cubeTexture.uniqueId;\n\n return cubeTexture;\n }, this);\n\n newCubeTexture.uniqueId = uniqueId;\n\n // Restore the irradianceTexture if it was cleared during cloning.\n if (savedIrradianceTexture && !this.irradianceTexture) {\n this.irradianceTexture = savedIrradianceTexture;\n }\n\n return newCubeTexture;\n }\n}\n\nlet _Registered = false;\n\n/**\n * Creates a cube texture from an array of image urls\n * @param files defines an array of image urls\n * @param scene defines the hosting scene\n * @param noMipmap specifies if mip maps are not used\n * @returns a cube texture\n */\nexport function CubeTextureCreateFromImages(files: string[], scene: Scene, noMipmap?: boolean): CubeTexture {\n let rootUrlKey = \"\";\n\n for (const url of files) {\n rootUrlKey += url;\n }\n\n return new CubeTexture(rootUrlKey, scene, null, noMipmap, files);\n}\n\n/**\n * Creates and return a texture created from prefilterd data by tools like IBL Baker or Lys.\n * @param url defines the url of the prefiltered texture\n * @param scene defines the scene the texture is attached to\n * @param forcedExtension defines the extension of the file if different from the url\n * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary\n * @returns the prefiltered texture\n */\nexport function CubeTextureCreateFromPrefilteredData(url: string, scene: Scene, forcedExtension: any = null, createPolynomials: boolean = true): CubeTexture {\n const oldValue = scene.useDelayedTextureLoading;\n scene.useDelayedTextureLoading = false;\n\n const result = new CubeTexture(url, scene, null, false, null, null, null, undefined, true, forcedExtension, createPolynomials);\n\n scene.useDelayedTextureLoading = oldValue;\n\n return result;\n}\n\n/**\n * Parses text to create a cube texture\n * @param parsedTexture define the serialized text to read from\n * @param scene defines the hosting scene\n * @param rootUrl defines the root url of the cube texture\n * @returns a cube texture\n */\nexport function CubeTextureParse(parsedTexture: any, scene: Scene, rootUrl: string): CubeTexture {\n const texture = SerializationHelper.Parse(\n () => {\n let prefiltered: boolean = false;\n if (parsedTexture.prefiltered) {\n prefiltered = parsedTexture.prefiltered;\n }\n return new CubeTexture(\n rootUrl + (parsedTexture.url ?? parsedTexture.name),\n scene,\n parsedTexture.extensions,\n false,\n parsedTexture.files || null,\n null,\n null,\n undefined,\n prefiltered,\n parsedTexture.forcedExtension\n );\n },\n parsedTexture,\n scene\n );\n\n // Local Cubemaps\n if (parsedTexture.boundingBoxPosition) {\n texture.boundingBoxPosition = Vector3.FromArray(parsedTexture.boundingBoxPosition);\n }\n if (parsedTexture.boundingBoxSize) {\n texture.boundingBoxSize = Vector3.FromArray(parsedTexture.boundingBoxSize);\n }\n\n // Animations\n if (parsedTexture.animations) {\n for (let animationIndex = 0; animationIndex < parsedTexture.animations.length; animationIndex++) {\n const parsedAnimation = parsedTexture.animations[animationIndex];\n const internalClass = GetClass(\"BABYLON.Animation\");\n if (internalClass) {\n texture.animations.push(internalClass.Parse(parsedAnimation));\n }\n }\n }\n\n return texture;\n}\n\n/**\n * Register side effects for cubeTexture.\n * Safe to call multiple times; only the first call has an effect.\n */\nexport function RegisterCubeTexture(): void {\n if (_Registered) {\n return;\n }\n _Registered = true;\n\n CubeTexture.CreateFromImages = CubeTextureCreateFromImages;\n CubeTexture.CreateFromPrefilteredData = CubeTextureCreateFromPrefilteredData;\n CubeTexture.Parse = CubeTextureParse;\n\n Texture._CubeTextureParser = CubeTextureParse;\n\n // Some exporters relies on Tools.Instantiate\n RegisterClass(\"BABYLON.CubeTexture\", CubeTexture);\n}\n"]}