@babylonjs/core 7.3.0 → 7.3.2

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 (454) hide show
  1. package/Actions/condition.js.map +1 -1
  2. package/Actions/directActions.js.map +1 -1
  3. package/Actions/directAudioActions.js.map +1 -1
  4. package/Actions/interpolateValueAction.js.map +1 -1
  5. package/Animations/easing.js.map +1 -1
  6. package/Behaviors/Meshes/sixDofDragBehavior.js.map +1 -1
  7. package/Bones/bone.js.map +1 -1
  8. package/Cameras/Inputs/arcRotateCameraPointersInput.js.map +1 -1
  9. package/Cameras/Inputs/followCameraPointersInput.js.map +1 -1
  10. package/Cameras/Inputs/freeCameraMouseWheelInput.js.map +1 -1
  11. package/Cameras/Stereoscopic/anaglyphArcRotateCamera.js.map +1 -1
  12. package/Cameras/Stereoscopic/anaglyphFreeCamera.js.map +1 -1
  13. package/Cameras/Stereoscopic/anaglyphGamepadCamera.js.map +1 -1
  14. package/Cameras/Stereoscopic/anaglyphUniversalCamera.js.map +1 -1
  15. package/Cameras/Stereoscopic/stereoscopicArcRotateCamera.js.map +1 -1
  16. package/Cameras/Stereoscopic/stereoscopicFreeCamera.js.map +1 -1
  17. package/Cameras/Stereoscopic/stereoscopicGamepadCamera.js.map +1 -1
  18. package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js.map +1 -1
  19. package/Cameras/Stereoscopic/stereoscopicUniversalCamera.js.map +1 -1
  20. package/Cameras/VR/vrDeviceOrientationArcRotateCamera.js.map +1 -1
  21. package/Cameras/VR/vrDeviceOrientationFreeCamera.js.map +1 -1
  22. package/Cameras/VR/vrDeviceOrientationGamepadCamera.js.map +1 -1
  23. package/Cameras/VR/vrExperienceHelper.js.map +1 -1
  24. package/Cameras/arcRotateCamera.js.map +1 -1
  25. package/Cameras/camera.js.map +1 -1
  26. package/Cameras/deviceOrientationCamera.js.map +1 -1
  27. package/Cameras/flyCamera.js.map +1 -1
  28. package/Cameras/followCamera.js.map +1 -1
  29. package/Cameras/freeCamera.js.map +1 -1
  30. package/Cameras/freeCameraInputsManager.js.map +1 -1
  31. package/Cameras/gamepadCamera.js.map +1 -1
  32. package/Cameras/targetCamera.js.map +1 -1
  33. package/Cameras/touchCamera.js.map +1 -1
  34. package/Cameras/universalCamera.js.map +1 -1
  35. package/Cameras/virtualJoysticksCamera.js.map +1 -1
  36. package/Debug/boneAxesViewer.js.map +1 -1
  37. package/Engines/Native/nativeRenderTargetWrapper.js.map +1 -1
  38. package/Engines/Processors/Expressions/Operators/shaderDefineAndOperator.js.map +1 -1
  39. package/Engines/Processors/Expressions/Operators/shaderDefineArithmeticOperator.js.map +1 -1
  40. package/Engines/Processors/Expressions/Operators/shaderDefineIsDefinedOperator.js.map +1 -1
  41. package/Engines/Processors/Expressions/Operators/shaderDefineOrOperator.js.map +1 -1
  42. package/Engines/Processors/shaderCodeConditionNode.js.map +1 -1
  43. package/Engines/Processors/shaderCodeTestNode.js.map +1 -1
  44. package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
  45. package/Engines/WebGPU/Extensions/engine.rawTexture.js +10 -10
  46. package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
  47. package/Engines/WebGPU/webgpuCacheRenderPipelineTree.js.map +1 -1
  48. package/Engines/WebGPU/webgpuDepthCullingState.js.map +1 -1
  49. package/Engines/WebGPU/webgpuHardwareTexture.d.ts +2 -0
  50. package/Engines/WebGPU/webgpuHardwareTexture.js +2 -0
  51. package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
  52. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
  53. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
  54. package/Engines/WebGPU/webgpuStencilStateComposer.js.map +1 -1
  55. package/Engines/abstractEngine.js +14 -2
  56. package/Engines/abstractEngine.js.map +1 -1
  57. package/Engines/engine.d.ts +0 -8
  58. package/Engines/engine.js +0 -28
  59. package/Engines/engine.js.map +1 -1
  60. package/Engines/nativeEngine.js.map +1 -1
  61. package/Engines/nullEngine.js.map +1 -1
  62. package/Engines/thinEngine.js.map +1 -1
  63. package/Engines/webgpuEngine.d.ts +4 -0
  64. package/Engines/webgpuEngine.js +4 -0
  65. package/Engines/webgpuEngine.js.map +1 -1
  66. package/Events/keyboardEvents.js.map +1 -1
  67. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js.map +1 -1
  68. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
  69. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js.map +1 -1
  70. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js.map +1 -1
  71. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js.map +1 -1
  72. package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js.map +1 -1
  73. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js.map +1 -1
  74. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js.map +1 -1
  75. package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.js.map +1 -1
  76. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js.map +1 -1
  77. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
  78. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js.map +1 -1
  79. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js.map +1 -1
  80. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js.map +1 -1
  81. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js.map +1 -1
  82. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
  83. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js.map +1 -1
  84. package/FlowGraph/Blocks/Execution/Audio/flowGraphPlayAudioBlock.js.map +1 -1
  85. package/FlowGraph/Blocks/Execution/Audio/flowGraphStopAudioBlock.js.map +1 -1
  86. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js.map +1 -1
  87. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js.map +1 -1
  88. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js.map +1 -1
  89. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js.map +1 -1
  90. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js.map +1 -1
  91. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js.map +1 -1
  92. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js.map +1 -1
  93. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.js.map +1 -1
  94. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js.map +1 -1
  95. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js.map +1 -1
  96. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js.map +1 -1
  97. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js.map +1 -1
  98. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js.map +1 -1
  99. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js.map +1 -1
  100. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js.map +1 -1
  101. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -1
  102. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -1
  103. package/FlowGraph/flowGraphDataConnection.js.map +1 -1
  104. package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
  105. package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
  106. package/Gamepads/dualShockGamepad.js.map +1 -1
  107. package/Gamepads/gamepad.js.map +1 -1
  108. package/Gamepads/xboxGamepad.js.map +1 -1
  109. package/Gizmos/axisDragGizmo.js.map +1 -1
  110. package/Gizmos/axisScaleGizmo.js.map +1 -1
  111. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  112. package/Gizmos/cameraGizmo.js.map +1 -1
  113. package/Gizmos/lightGizmo.js.map +1 -1
  114. package/Gizmos/planeDragGizmo.js.map +1 -1
  115. package/Gizmos/planeRotationGizmo.js.map +1 -1
  116. package/Gizmos/positionGizmo.js.map +1 -1
  117. package/Gizmos/rotationGizmo.js.map +1 -1
  118. package/Gizmos/scaleGizmo.js.map +1 -1
  119. package/Helpers/photoDome.js.map +1 -1
  120. package/Helpers/textureDome.js.map +1 -1
  121. package/Helpers/videoDome.js.map +1 -1
  122. package/Layers/glowLayer.js.map +1 -1
  123. package/Layers/highlightLayer.js.map +1 -1
  124. package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
  125. package/Lights/directionalLight.js.map +1 -1
  126. package/Lights/hemisphericLight.js.map +1 -1
  127. package/Lights/light.js.map +1 -1
  128. package/Lights/pointLight.js.map +1 -1
  129. package/Lights/shadowLight.js.map +1 -1
  130. package/Lights/spotLight.js.map +1 -1
  131. package/Materials/Background/backgroundMaterial.js.map +1 -1
  132. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  133. package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
  134. package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
  135. package/Materials/Node/Blocks/Dual/clipPlanesBlock.js.map +1 -1
  136. package/Materials/Node/Blocks/Dual/currentScreenBlock.js.map +1 -1
  137. package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
  138. package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
  139. package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
  140. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
  141. package/Materials/Node/Blocks/Dual/reflectionTextureBlock.js.map +1 -1
  142. package/Materials/Node/Blocks/Dual/sceneDepthBlock.js.map +1 -1
  143. package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
  144. package/Materials/Node/Blocks/Fragment/TBNBlock.js.map +1 -1
  145. package/Materials/Node/Blocks/Fragment/derivativeBlock.js.map +1 -1
  146. package/Materials/Node/Blocks/Fragment/discardBlock.js.map +1 -1
  147. package/Materials/Node/Blocks/Fragment/fragCoordBlock.js.map +1 -1
  148. package/Materials/Node/Blocks/Fragment/fragDepthBlock.js.map +1 -1
  149. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
  150. package/Materials/Node/Blocks/Fragment/frontFacingBlock.js.map +1 -1
  151. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js.map +1 -1
  152. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
  153. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
  154. package/Materials/Node/Blocks/Fragment/prePassOutputBlock.js.map +1 -1
  155. package/Materials/Node/Blocks/Fragment/screenSizeBlock.js.map +1 -1
  156. package/Materials/Node/Blocks/Fragment/screenSpaceBlock.js.map +1 -1
  157. package/Materials/Node/Blocks/Fragment/shadowMapBlock.js.map +1 -1
  158. package/Materials/Node/Blocks/Fragment/twirlBlock.js.map +1 -1
  159. package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
  160. package/Materials/Node/Blocks/Input/prePassTextureBlock.js.map +1 -1
  161. package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
  162. package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
  163. package/Materials/Node/Blocks/PBR/iridescenceBlock.js.map +1 -1
  164. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  165. package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
  166. package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
  167. package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
  168. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
  169. package/Materials/Node/Blocks/Particle/particleBlendMultiplyBlock.js.map +1 -1
  170. package/Materials/Node/Blocks/Particle/particleRampGradientBlock.js.map +1 -1
  171. package/Materials/Node/Blocks/Particle/particleTextureBlock.js.map +1 -1
  172. package/Materials/Node/Blocks/Teleport/teleportInBlock.js.map +1 -1
  173. package/Materials/Node/Blocks/Teleport/teleportOutBlock.js.map +1 -1
  174. package/Materials/Node/Blocks/Vertex/bonesBlock.js.map +1 -1
  175. package/Materials/Node/Blocks/Vertex/instancesBlock.js.map +1 -1
  176. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js.map +1 -1
  177. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
  178. package/Materials/Node/Blocks/Vertex/vertexOutputBlock.js.map +1 -1
  179. package/Materials/Node/Blocks/addBlock.js.map +1 -1
  180. package/Materials/Node/Blocks/arcTan2Block.js.map +1 -1
  181. package/Materials/Node/Blocks/biPlanarBlock.js.map +1 -1
  182. package/Materials/Node/Blocks/clampBlock.js.map +1 -1
  183. package/Materials/Node/Blocks/cloudBlock.js.map +1 -1
  184. package/Materials/Node/Blocks/colorMergerBlock.js.map +1 -1
  185. package/Materials/Node/Blocks/colorSplitterBlock.js.map +1 -1
  186. package/Materials/Node/Blocks/conditionalBlock.js.map +1 -1
  187. package/Materials/Node/Blocks/crossBlock.js.map +1 -1
  188. package/Materials/Node/Blocks/curveBlock.js.map +1 -1
  189. package/Materials/Node/Blocks/customBlock.js.map +1 -1
  190. package/Materials/Node/Blocks/desaturateBlock.js.map +1 -1
  191. package/Materials/Node/Blocks/distanceBlock.js.map +1 -1
  192. package/Materials/Node/Blocks/divideBlock.js.map +1 -1
  193. package/Materials/Node/Blocks/dotBlock.js.map +1 -1
  194. package/Materials/Node/Blocks/elbowBlock.js.map +1 -1
  195. package/Materials/Node/Blocks/fresnelBlock.js.map +1 -1
  196. package/Materials/Node/Blocks/gradientBlock.js.map +1 -1
  197. package/Materials/Node/Blocks/lengthBlock.js.map +1 -1
  198. package/Materials/Node/Blocks/lerpBlock.js.map +1 -1
  199. package/Materials/Node/Blocks/matrixBuilderBlock.js.map +1 -1
  200. package/Materials/Node/Blocks/matrixDeterminantBlock.js.map +1 -1
  201. package/Materials/Node/Blocks/matrixTransposeBlock.js.map +1 -1
  202. package/Materials/Node/Blocks/maxBlock.js.map +1 -1
  203. package/Materials/Node/Blocks/meshAttributeExistsBlock.js.map +1 -1
  204. package/Materials/Node/Blocks/minBlock.js.map +1 -1
  205. package/Materials/Node/Blocks/modBlock.js.map +1 -1
  206. package/Materials/Node/Blocks/multiplyBlock.js.map +1 -1
  207. package/Materials/Node/Blocks/nLerpBlock.js.map +1 -1
  208. package/Materials/Node/Blocks/negateBlock.js.map +1 -1
  209. package/Materials/Node/Blocks/normalBlendBlock.js.map +1 -1
  210. package/Materials/Node/Blocks/normalizeBlock.js.map +1 -1
  211. package/Materials/Node/Blocks/oneMinusBlock.js.map +1 -1
  212. package/Materials/Node/Blocks/posterizeBlock.js.map +1 -1
  213. package/Materials/Node/Blocks/powBlock.js.map +1 -1
  214. package/Materials/Node/Blocks/randomNumberBlock.js.map +1 -1
  215. package/Materials/Node/Blocks/reciprocalBlock.js.map +1 -1
  216. package/Materials/Node/Blocks/reflectBlock.js.map +1 -1
  217. package/Materials/Node/Blocks/refractBlock.js.map +1 -1
  218. package/Materials/Node/Blocks/remapBlock.js.map +1 -1
  219. package/Materials/Node/Blocks/replaceColorBlock.js.map +1 -1
  220. package/Materials/Node/Blocks/rotate2dBlock.js.map +1 -1
  221. package/Materials/Node/Blocks/scaleBlock.js.map +1 -1
  222. package/Materials/Node/Blocks/simplexPerlin3DBlock.js.map +1 -1
  223. package/Materials/Node/Blocks/smoothStepBlock.js.map +1 -1
  224. package/Materials/Node/Blocks/stepBlock.js.map +1 -1
  225. package/Materials/Node/Blocks/subtractBlock.js.map +1 -1
  226. package/Materials/Node/Blocks/transformBlock.js.map +1 -1
  227. package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
  228. package/Materials/Node/Blocks/trigonometryBlock.js.map +1 -1
  229. package/Materials/Node/Blocks/vectorMergerBlock.js.map +1 -1
  230. package/Materials/Node/Blocks/vectorSplitterBlock.js.map +1 -1
  231. package/Materials/Node/Blocks/viewDirectionBlock.js.map +1 -1
  232. package/Materials/Node/Blocks/voronoiNoiseBlock.js.map +1 -1
  233. package/Materials/Node/Blocks/waveBlock.js.map +1 -1
  234. package/Materials/Node/Blocks/worleyNoise3DBlock.js.map +1 -1
  235. package/Materials/Node/nodeMaterial.js.map +1 -1
  236. package/Materials/Node/nodeMaterialConnectionPointCustomObject.js.map +1 -1
  237. package/Materials/PBR/pbrAnisotropicConfiguration.js.map +1 -1
  238. package/Materials/PBR/pbrBRDFConfiguration.js.map +1 -1
  239. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  240. package/Materials/PBR/pbrBaseSimpleMaterial.js.map +1 -1
  241. package/Materials/PBR/pbrClearCoatConfiguration.js.map +1 -1
  242. package/Materials/PBR/pbrIridescenceConfiguration.js.map +1 -1
  243. package/Materials/PBR/pbrMaterial.js.map +1 -1
  244. package/Materials/PBR/pbrMetallicRoughnessMaterial.js.map +1 -1
  245. package/Materials/PBR/pbrSheenConfiguration.js.map +1 -1
  246. package/Materials/PBR/pbrSpecularGlossinessMaterial.js.map +1 -1
  247. package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
  248. package/Materials/Textures/MultiviewRenderTarget.js.map +1 -1
  249. package/Materials/Textures/Procedurals/customProceduralTexture.js.map +1 -1
  250. package/Materials/Textures/Procedurals/noiseProceduralTexture.js.map +1 -1
  251. package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
  252. package/Materials/Textures/baseTexture.js.map +1 -1
  253. package/Materials/Textures/colorGradingTexture.js.map +1 -1
  254. package/Materials/Textures/cubeTexture.js.map +1 -1
  255. package/Materials/Textures/dynamicTexture.js.map +1 -1
  256. package/Materials/Textures/equiRectangularCubeTexture.js +1 -1
  257. package/Materials/Textures/equiRectangularCubeTexture.js.map +1 -1
  258. package/Materials/Textures/hdrCubeTexture.js.map +1 -1
  259. package/Materials/Textures/htmlElementTexture.js.map +1 -1
  260. package/Materials/Textures/internalTexture.js.map +1 -1
  261. package/Materials/Textures/mirrorTexture.js.map +1 -1
  262. package/Materials/Textures/multiRenderTarget.js.map +1 -1
  263. package/Materials/Textures/prePassRenderTarget.js.map +1 -1
  264. package/Materials/Textures/rawCubeTexture.js.map +1 -1
  265. package/Materials/Textures/refractionTexture.js.map +1 -1
  266. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  267. package/Materials/Textures/texture.js.map +1 -1
  268. package/Materials/Textures/thinRenderTargetTexture.js.map +1 -1
  269. package/Materials/Textures/videoTexture.js.map +1 -1
  270. package/Materials/material.decalMapConfiguration.js.map +1 -1
  271. package/Materials/material.detailMapConfiguration.js.map +1 -1
  272. package/Materials/materialHelper.d.ts +2 -2
  273. package/Materials/materialHelper.js.map +1 -1
  274. package/Materials/meshDebugPluginMaterial.js.map +1 -1
  275. package/Materials/multiMaterial.js.map +1 -1
  276. package/Materials/pushMaterial.js.map +1 -1
  277. package/Materials/shaderMaterial.js.map +1 -1
  278. package/Materials/standardMaterial.js.map +1 -1
  279. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  280. package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
  281. package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
  282. package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
  283. package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js.map +1 -1
  284. package/Meshes/Node/Blocks/Instances/instantiateBlock.js.map +1 -1
  285. package/Meshes/Node/Blocks/Instances/instantiateLinearBlock.js.map +1 -1
  286. package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js.map +1 -1
  287. package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js.map +1 -1
  288. package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js.map +1 -1
  289. package/Meshes/Node/Blocks/Instances/instantiateRadialBlock.js.map +1 -1
  290. package/Meshes/Node/Blocks/Matrices/alignBlock.js.map +1 -1
  291. package/Meshes/Node/Blocks/Matrices/rotationXBlock.js.map +1 -1
  292. package/Meshes/Node/Blocks/Matrices/rotationYBlock.js.map +1 -1
  293. package/Meshes/Node/Blocks/Matrices/rotationZBlock.js.map +1 -1
  294. package/Meshes/Node/Blocks/Matrices/scalingBlock.js.map +1 -1
  295. package/Meshes/Node/Blocks/Matrices/translationBlock.js.map +1 -1
  296. package/Meshes/Node/Blocks/Set/setColorsBlock.js.map +1 -1
  297. package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js.map +1 -1
  298. package/Meshes/Node/Blocks/Set/setNormalsBlock.js.map +1 -1
  299. package/Meshes/Node/Blocks/Set/setPositionsBlock.js.map +1 -1
  300. package/Meshes/Node/Blocks/Set/setTangentsBlock.js.map +1 -1
  301. package/Meshes/Node/Blocks/Set/setUVsBlock.js.map +1 -1
  302. package/Meshes/Node/Blocks/Sources/boxBlock.js.map +1 -1
  303. package/Meshes/Node/Blocks/Sources/capsuleBlock.js.map +1 -1
  304. package/Meshes/Node/Blocks/Sources/cylinderBlock.js.map +1 -1
  305. package/Meshes/Node/Blocks/Sources/discBlock.js.map +1 -1
  306. package/Meshes/Node/Blocks/Sources/gridBlock.js.map +1 -1
  307. package/Meshes/Node/Blocks/Sources/icoSphereBlock.js.map +1 -1
  308. package/Meshes/Node/Blocks/Sources/meshBlock.js.map +1 -1
  309. package/Meshes/Node/Blocks/Sources/nullBlock.js.map +1 -1
  310. package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
  311. package/Meshes/Node/Blocks/Sources/sphereBlock.js.map +1 -1
  312. package/Meshes/Node/Blocks/Sources/torusBlock.js.map +1 -1
  313. package/Meshes/Node/Blocks/Teleport/teleportInBlock.js.map +1 -1
  314. package/Meshes/Node/Blocks/Teleport/teleportOutBlock.js.map +1 -1
  315. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js.map +1 -1
  316. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js.map +1 -1
  317. package/Meshes/Node/Blocks/booleanGeometryBlock.js.map +1 -1
  318. package/Meshes/Node/Blocks/boundingBlock.js.map +1 -1
  319. package/Meshes/Node/Blocks/computeNormalsBlock.js.map +1 -1
  320. package/Meshes/Node/Blocks/conditionBlock.js.map +1 -1
  321. package/Meshes/Node/Blocks/debugBlock.js.map +1 -1
  322. package/Meshes/Node/Blocks/geometryArcTan2Block.js.map +1 -1
  323. package/Meshes/Node/Blocks/geometryClampBlock.js.map +1 -1
  324. package/Meshes/Node/Blocks/geometryCollectionBlock.js.map +1 -1
  325. package/Meshes/Node/Blocks/geometryCrossBlock.js.map +1 -1
  326. package/Meshes/Node/Blocks/geometryCurveBlock.js.map +1 -1
  327. package/Meshes/Node/Blocks/geometryDesaturateBlock.js.map +1 -1
  328. package/Meshes/Node/Blocks/geometryDistanceBlock.js.map +1 -1
  329. package/Meshes/Node/Blocks/geometryDotBlock.js.map +1 -1
  330. package/Meshes/Node/Blocks/geometryElbowBlock.js.map +1 -1
  331. package/Meshes/Node/Blocks/geometryInfoBlock.js.map +1 -1
  332. package/Meshes/Node/Blocks/geometryInputBlock.js.map +1 -1
  333. package/Meshes/Node/Blocks/geometryLengthBlock.js.map +1 -1
  334. package/Meshes/Node/Blocks/geometryLerpBlock.js.map +1 -1
  335. package/Meshes/Node/Blocks/geometryModBlock.js.map +1 -1
  336. package/Meshes/Node/Blocks/geometryNLerpBlock.js.map +1 -1
  337. package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -1
  338. package/Meshes/Node/Blocks/geometryOutputBlock.js.map +1 -1
  339. package/Meshes/Node/Blocks/geometryPosterizeBlock.js.map +1 -1
  340. package/Meshes/Node/Blocks/geometryPowBlock.js.map +1 -1
  341. package/Meshes/Node/Blocks/geometryReplaceColorBlock.js.map +1 -1
  342. package/Meshes/Node/Blocks/geometryRotate2dBlock.js.map +1 -1
  343. package/Meshes/Node/Blocks/geometrySmoothStepBlock.js.map +1 -1
  344. package/Meshes/Node/Blocks/geometryStepBlock.js.map +1 -1
  345. package/Meshes/Node/Blocks/geometryTransformBlock.js.map +1 -1
  346. package/Meshes/Node/Blocks/geometryTrigonometryBlock.js.map +1 -1
  347. package/Meshes/Node/Blocks/intFloatConverterBlock.js.map +1 -1
  348. package/Meshes/Node/Blocks/mapRangeBlock.js.map +1 -1
  349. package/Meshes/Node/Blocks/mappingBlock.js.map +1 -1
  350. package/Meshes/Node/Blocks/mathBlock.js.map +1 -1
  351. package/Meshes/Node/Blocks/matrixComposeBlock.js.map +1 -1
  352. package/Meshes/Node/Blocks/mergeGeometryBlock.js.map +1 -1
  353. package/Meshes/Node/Blocks/noiseBlock.js.map +1 -1
  354. package/Meshes/Node/Blocks/normalizeVectorBlock.js.map +1 -1
  355. package/Meshes/Node/Blocks/randomBlock.js.map +1 -1
  356. package/Meshes/Node/Blocks/vectorConverterBlock.js.map +1 -1
  357. package/Meshes/WebGL/webGLDataBuffer.js.map +1 -1
  358. package/Meshes/WebGPU/webgpuDataBuffer.js.map +1 -1
  359. package/Meshes/abstractMesh.js.map +1 -1
  360. package/Meshes/geodesicMesh.js.map +1 -1
  361. package/Meshes/goldbergMesh.js.map +1 -1
  362. package/Meshes/groundMesh.js.map +1 -1
  363. package/Meshes/instancedMesh.js.map +1 -1
  364. package/Meshes/linesMesh.js.map +1 -1
  365. package/Meshes/mesh.js.map +1 -1
  366. package/Meshes/trailMesh.js.map +1 -1
  367. package/Meshes/transformNode.js.map +1 -1
  368. package/Misc/assetsManager.js.map +1 -1
  369. package/Misc/depthReducer.js.map +1 -1
  370. package/Misc/sceneOptimizer.js.map +1 -1
  371. package/Misc/smartArray.js.map +1 -1
  372. package/Misc/workerPool.js.map +1 -1
  373. package/Particles/EmitterTypes/cylinderParticleEmitter.js.map +1 -1
  374. package/Particles/EmitterTypes/sphereParticleEmitter.js.map +1 -1
  375. package/Particles/gpuParticleSystem.js.map +1 -1
  376. package/Particles/particleSystem.js.map +1 -1
  377. package/Particles/thinParticleSystem.js.map +1 -1
  378. package/Physics/physicsRaycastResult.js.map +1 -1
  379. package/Physics/proximityCastResult.js.map +1 -1
  380. package/Physics/v1/physicsJoint.js.map +1 -1
  381. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
  382. package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.js.map +1 -1
  383. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
  384. package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js.map +1 -1
  385. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js.map +1 -1
  386. package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js.map +1 -1
  387. package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js.map +1 -1
  388. package/PostProcesses/anaglyphPostProcess.js.map +1 -1
  389. package/PostProcesses/blackAndWhitePostProcess.js.map +1 -1
  390. package/PostProcesses/bloomMergePostProcess.js.map +1 -1
  391. package/PostProcesses/blurPostProcess.js.map +1 -1
  392. package/PostProcesses/chromaticAberrationPostProcess.js.map +1 -1
  393. package/PostProcesses/circleOfConfusionPostProcess.js.map +1 -1
  394. package/PostProcesses/colorCorrectionPostProcess.js.map +1 -1
  395. package/PostProcesses/convolutionPostProcess.js.map +1 -1
  396. package/PostProcesses/depthOfFieldBlurPostProcess.js.map +1 -1
  397. package/PostProcesses/depthOfFieldMergePostProcess.js.map +1 -1
  398. package/PostProcesses/displayPassPostProcess.js.map +1 -1
  399. package/PostProcesses/extractHighlightsPostProcess.js.map +1 -1
  400. package/PostProcesses/filterPostProcess.js.map +1 -1
  401. package/PostProcesses/fxaaPostProcess.js.map +1 -1
  402. package/PostProcesses/grainPostProcess.js.map +1 -1
  403. package/PostProcesses/highlightsPostProcess.js.map +1 -1
  404. package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
  405. package/PostProcesses/motionBlurPostProcess.js.map +1 -1
  406. package/PostProcesses/passPostProcess.js.map +1 -1
  407. package/PostProcesses/refractionPostProcess.js.map +1 -1
  408. package/PostProcesses/screenSpaceCurvaturePostProcess.js.map +1 -1
  409. package/PostProcesses/screenSpaceReflectionPostProcess.js.map +1 -1
  410. package/PostProcesses/sharpenPostProcess.js.map +1 -1
  411. package/PostProcesses/stereoscopicInterlacePostProcess.js.map +1 -1
  412. package/PostProcesses/subSurfaceScatteringPostProcess.js.map +1 -1
  413. package/PostProcesses/tonemapPostProcess.js.map +1 -1
  414. package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
  415. package/PostProcesses/vrDistortionCorrectionPostProcess.js.map +1 -1
  416. package/PostProcesses/vrMultiviewToSingleviewPostProcess.js.map +1 -1
  417. package/Rendering/GlobalIllumination/giRSMManager.js.map +1 -1
  418. package/Rendering/edgesRenderer.js.map +1 -1
  419. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js.map +1 -1
  420. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js.map +1 -1
  421. package/Rendering/reflectiveShadowMap.js.map +1 -1
  422. package/Sprites/sprite.js.map +1 -1
  423. package/Sprites/spritePackedManager.js.map +1 -1
  424. package/XR/features/Layers/WebXRCompositionLayer.js.map +1 -1
  425. package/XR/features/Layers/WebXRProjectionLayer.js.map +1 -1
  426. package/XR/features/WebXRAnchorSystem.js.map +1 -1
  427. package/XR/features/WebXRBackgroundRemover.js.map +1 -1
  428. package/XR/features/WebXRControllerMovement.js.map +1 -1
  429. package/XR/features/WebXRControllerPhysics.js.map +1 -1
  430. package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
  431. package/XR/features/WebXRControllerTeleportation.js.map +1 -1
  432. package/XR/features/WebXRDOMOverlay.js.map +1 -1
  433. package/XR/features/WebXRDepthSensing.js.map +1 -1
  434. package/XR/features/WebXREyeTracking.js.map +1 -1
  435. package/XR/features/WebXRFeaturePointSystem.js.map +1 -1
  436. package/XR/features/WebXRHandTracking.js.map +1 -1
  437. package/XR/features/WebXRHitTest.js.map +1 -1
  438. package/XR/features/WebXRHitTestLegacy.js.map +1 -1
  439. package/XR/features/WebXRImageTracking.js.map +1 -1
  440. package/XR/features/WebXRLayers.js.map +1 -1
  441. package/XR/features/WebXRLightEstimation.js.map +1 -1
  442. package/XR/features/WebXRMeshDetector.js.map +1 -1
  443. package/XR/features/WebXRNearInteraction.js.map +1 -1
  444. package/XR/features/WebXRPlaneDetector.js.map +1 -1
  445. package/XR/features/WebXRRawCameraAccess.js.map +1 -1
  446. package/XR/features/WebXRSpaceWarp.js.map +1 -1
  447. package/XR/features/WebXRWalkingLocomotion.js.map +1 -1
  448. package/XR/motionController/webXRProfiledMotionController.js.map +1 -1
  449. package/XR/native/nativeXRRenderTarget.js.map +1 -1
  450. package/XR/webXRCamera.js.map +1 -1
  451. package/XR/webXRWebGLLayer.js.map +1 -1
  452. package/assets/Draco/draco_wasm_wrapper.js +115 -115
  453. package/package.json +1 -1
  454. package/scene.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"pbrBaseSimpleMaterial.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/PBR/pbrBaseSimpleMaterial.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3G,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAIpD;;;;;GAKG;AACH,MAAM,OAAgB,qBAAsB,SAAQ,eAAe;IA8E/D;;OAEG;IAEH,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAClC,CAAC;IACD;;OAEG;IACH,IAAW,WAAW,CAAC,KAAc;QAC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AC,kCAAkC,EAAE,cAAc,CAAC;4DACzB;AAOrC;IAFN,iBAAiB,CAAC,UAAU,CAAC;IAC7B,gBAAgB,CAAC,kCAAkC,CAAC;4DACV;AAOpC;IAFN,kBAAkB,EAAE;IACpB,gBAAgB,CAAC,kCAAkC,CAAC;8DACP;AAOvC;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,EAAE,yBAAyB,CAAC;gEACzC;AAOhC;IAFN,kBAAkB,EAAE;IACpB,gBAAgB,CAAC,kCAAkC,EAAE,iBAAiB,CAAC;+DACzB;AAOxC;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,EAAE,cAAc,CAAC;0DAC1C;AAM3B;IADC,SAAS,EAAE;wDAGX;AAkBM;IAFN,kBAAkB,EAAE;IACpB,gBAAgB,CAAC,kCAAkC,EAAE,IAAI,CAAC;8DACb;AAOvC;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;qEACf","sourcesContent":["import { serialize, serializeAsColor3, expandToProperty, serializeAsTexture } from \"../../Misc/decorators\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\nimport { PBRBaseMaterial } from \"./pbrBaseMaterial\";\r\nimport type { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport type { Nullable } from \"../../types\";\r\n\r\n/**\r\n * The Physically based simple base material of BJS.\r\n *\r\n * This enables better naming and convention enforcements on top of the pbrMaterial.\r\n * It is used as the base class for both the specGloss and metalRough conventions.\r\n */\r\nexport abstract class PBRBaseSimpleMaterial extends PBRBaseMaterial {\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, 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 * Environment Texture used in the material (this is use for both reflection and environment lighting).\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_reflectionTexture\")\r\n public environmentTexture: Nullable<BaseTexture>;\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 * Normal map used in the model.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_bumpTexture\")\r\n public normalTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Emissivie color used to self-illuminate the model.\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 * Emissivie texture used to self-illuminate the model.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public emissiveTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Occlusion Channel Strength.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_ambientTextureStrength\")\r\n public occlusionStrength: number = 1.0;\r\n\r\n /**\r\n * Occlusion Texture of the material (adding extra occlusion effects).\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_ambientTexture\")\r\n public occlusionTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Defines the alpha limits in alpha test mode.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_alphaCutOff\")\r\n public alphaCutOff: number;\r\n\r\n /**\r\n * Gets the current double sided mode.\r\n */\r\n @serialize()\r\n public get doubleSided(): boolean {\r\n return this._twoSidedLighting;\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 public set doubleSided(value: boolean) {\r\n if (this._twoSidedLighting === value) {\r\n return;\r\n }\r\n this._twoSidedLighting = value;\r\n this.backFaceCulling = !value;\r\n this._markAllSubMeshesAsTexturesDirty();\r\n }\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 * 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 * 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 */\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n\r\n this._useAlphaFromAlbedoTexture = true;\r\n this._useAmbientInGrayScale = true;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"PBRBaseSimpleMaterial\";\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"pbrBaseSimpleMaterial.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/PBR/pbrBaseSimpleMaterial.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3G,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAIpD;;;;;GAKG;AACH,MAAM,OAAgB,qBAAsB,SAAQ,eAAe;IA8E/D;;OAEG;IAEH,IAAW,WAAW;QAClB,OA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;IACX,gBAAgB,CAAC,kCAAkC,CAAC;+DACrB;AAOzB;IAFN,kBAAkB,EAAE;IACpB,gBAAgB,CAAC,kCAAkC,EAAE,cAAc,CAAC;4DACzB;AAOrC;IAFN,iBAAiB,CAAC,UAAU,CAAC;IAC7B,gBAAgB,CAAC,kCAAkC,CAAC;4DACV;AAOpC;IAFN,kBAAkB,EAAE;IACpB,gBAAgB,CAAC,kCAAkC,CAAC;8DACP;AAOvC;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,EAAE,yBAAyB,CAAC;gEACzC;AAOhC;IAFN,kBAAkB,EAAE;IACpB,gBAAgB,CAAC,kCAAkC,EAAE,iBAAiB,CAAC;+DACzB;AAOxC;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,EAAE,cAAc,CAAC;0DAC1C;AAM3B;IADC,SAAS,EAAE;wDAGX;AAkBM;IAFN,kBAAkB,EAAE;IACpB,gBAAgB,CAAC,kCAAkC,EAAE,IAAI,CAAC;8DACb;AAOvC;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;qEACf","sourcesContent":["import { serialize, serializeAsColor3, expandToProperty, serializeAsTexture } from \"../../Misc/decorators\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\nimport { PBRBaseMaterial } from \"./pbrBaseMaterial\";\r\nimport type { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport type { Nullable } from \"../../types\";\r\n\r\n/**\r\n * The Physically based simple base material of BJS.\r\n *\r\n * This enables better naming and convention enforcements on top of the pbrMaterial.\r\n * It is used as the base class for both the specGloss and metalRough conventions.\r\n */\r\nexport abstract class PBRBaseSimpleMaterial extends PBRBaseMaterial {\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, 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 * Environment Texture used in the material (this is use for both reflection and environment lighting).\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_reflectionTexture\")\r\n public environmentTexture: Nullable<BaseTexture>;\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 * Normal map used in the model.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_bumpTexture\")\r\n public normalTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Emissivie color used to self-illuminate the model.\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 * Emissivie texture used to self-illuminate the model.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public emissiveTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Occlusion Channel Strength.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_ambientTextureStrength\")\r\n public occlusionStrength: number = 1.0;\r\n\r\n /**\r\n * Occlusion Texture of the material (adding extra occlusion effects).\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_ambientTexture\")\r\n public occlusionTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Defines the alpha limits in alpha test mode.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_alphaCutOff\")\r\n public alphaCutOff: number;\r\n\r\n /**\r\n * Gets the current double sided mode.\r\n */\r\n @serialize()\r\n public get doubleSided(): boolean {\r\n return this._twoSidedLighting;\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 public set doubleSided(value: boolean) {\r\n if (this._twoSidedLighting === value) {\r\n return;\r\n }\r\n this._twoSidedLighting = value;\r\n this.backFaceCulling = !value;\r\n this._markAllSubMeshesAsTexturesDirty();\r\n }\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 * 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 * 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 */\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n\r\n this._useAlphaFromAlbedoTexture = true;\r\n this._useAmbientInGrayScale = true;\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"PBRBaseSimpleMaterial\";\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"pbrClearCoatConfiguration.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/PBR/pbrClearCoatConfiguration.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC3G,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;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AFN,kBAAkB,EAAE;IACpB,gBAAgB,CAAC,kCAAkC,CAAC;8DACJ;AAQ1C;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;gEACxB;AAOtB;IADN,iBAAiB,EAAE;4DACc;AAQ3B;IADN,SAAS,EAAE;sEACmB;AAOxB;IADN,SAAS,EAAE;gEACqB;AAU1B;IAFN,kBAAkB,EAAE;IACpB,gBAAgB,CAAC,kCAAkC,CAAC;8DACJ","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"../../types\";\r\nimport { serialize, serializeAsTexture, expandToProperty, serializeAsColor3 } from \"../../Misc/decorators\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\nimport type { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport { MaterialFlags } from \"../materialFlags\";\r\nimport type { UniformBuffer } from \"../../Materials/uniformBuffer\";\r\nimport type { IAnimatable } from \"../../Animations/animatable.interface\";\r\nimport type { EffectFallbacks } from \"../effectFallbacks\";\r\nimport type { SubMesh } from \"../../Meshes/subMesh\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { MaterialPluginBase } from \"../materialPluginBase\";\r\nimport { MaterialDefines } from \"../materialDefines\";\r\n\r\nimport type { Engine } from \"../../Engines/engine\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { PBRBaseMaterial } from \"./pbrBaseMaterial\";\r\nimport { BindTextureMatrix, PrepareDefinesForMergedUV } from \"../materialHelper.functions\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class MaterialClearCoatDefines extends MaterialDefines {\r\n public CLEARCOAT = false;\r\n public CLEARCOAT_DEFAULTIOR = false;\r\n public CLEARCOAT_TEXTURE = false;\r\n public CLEARCOAT_TEXTURE_ROUGHNESS = false;\r\n public CLEARCOAT_TEXTUREDIRECTUV = 0;\r\n public CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV = 0;\r\n public CLEARCOAT_BUMP = false;\r\n public CLEARCOAT_BUMPDIRECTUV = 0;\r\n public CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE = false;\r\n public CLEARCOAT_REMAP_F0 = false;\r\n\r\n public CLEARCOAT_TINT = false;\r\n public CLEARCOAT_TINT_TEXTURE = false;\r\n public CLEARCOAT_TINT_TEXTUREDIRECTUV = 0;\r\n public CLEARCOAT_TINT_GAMMATEXTURE = false;\r\n}\r\n\r\n/**\r\n * Plugin that implements the clear coat component of the PBR material\r\n */\r\nexport class PBRClearCoatConfiguration extends MaterialPluginBase {\r\n protected _material: PBRBaseMaterial;\r\n\r\n /**\r\n * This defaults to 1.5 corresponding to a 0.04 f0 or a 4% reflectance at normal incidence\r\n * The default fits with a polyurethane material.\r\n * @internal\r\n */\r\n public static readonly _DefaultIndexOfRefraction = 1.5;\r\n\r\n private _isEnabled = false;\r\n /**\r\n * Defines if the clear coat is enabled in the material.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public isEnabled = false;\r\n\r\n /**\r\n * Defines the clear coat layer strength (between 0 and 1) it defaults to 1.\r\n */\r\n @serialize()\r\n public intensity: number = 1;\r\n\r\n /**\r\n * Defines the clear coat layer roughness.\r\n */\r\n @serialize()\r\n public roughness: number = 0;\r\n\r\n private _indexOfRefraction = PBRClearCoatConfiguration._DefaultIndexOfRefraction;\r\n /**\r\n * Defines the index of refraction of the clear coat.\r\n * This defaults to 1.5 corresponding to a 0.04 f0 or a 4% reflectance at normal incidence\r\n * The default fits with a polyurethane material.\r\n * Changing the default value is more performance intensive.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public indexOfRefraction = PBRClearCoatConfiguration._DefaultIndexOfRefraction;\r\n\r\n private _texture: Nullable<BaseTexture> = null;\r\n /**\r\n * Stores the clear coat values in a texture (red channel is intensity and green channel is roughness)\r\n * If useRoughnessFromMainTexture is false, the green channel of texture is not used and the green channel of textureRoughness is used instead\r\n * if textureRoughness is not empty, else no texture roughness is used\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public texture: Nullable<BaseTexture> = null;\r\n\r\n private _useRoughnessFromMainTexture = true;\r\n /**\r\n * Indicates that the green channel of the texture property will be used for roughness (default: true)\r\n * If false, the green channel from textureRoughness is used for roughness\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useRoughnessFromMainTexture = true;\r\n\r\n private _textureRoughness: Nullable<BaseTexture> = null;\r\n /**\r\n * Stores the clear coat roughness in a texture (green channel)\r\n * Not used if useRoughnessFromMainTexture is true\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public textureRoughness: Nullable<BaseTexture> = null;\r\n\r\n private _remapF0OnInterfaceChange = true;\r\n /**\r\n * Defines if the F0 value should be remapped to account for the interface change in the material.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public remapF0OnInterfaceChange = true;\r\n\r\n private _bumpTexture: Nullable<BaseTexture> = null;\r\n /**\r\n * Define the clear coat specific bump texture.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public bumpTexture: Nullable<BaseTexture> = null;\r\n\r\n private _isTintEnabled = false;\r\n /**\r\n * Defines if the clear coat tint is enabled in the material.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public isTintEnabled = false;\r\n\r\n /**\r\n * Defines the clear coat tint of the material.\r\n * This is only use if tint is enabled\r\n */\r\n @serializeAsColor3()\r\n public tintColor = Color3.White();\r\n\r\n /**\r\n * Defines the distance at which the tint color should be found in the\r\n * clear coat media.\r\n * This is only use if tint is enabled\r\n */\r\n @serialize()\r\n public tintColorAtDistance = 1;\r\n\r\n /**\r\n * Defines the clear coat layer thickness.\r\n * This is only use if tint is enabled\r\n */\r\n @serialize()\r\n public tintThickness: number = 1;\r\n\r\n private _tintTexture: Nullable<BaseTexture> = null;\r\n /**\r\n * Stores the clear tint values in a texture.\r\n * rgb is tint\r\n * a is a thickness factor\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public tintTexture: Nullable<BaseTexture> = null;\r\n\r\n /** @internal */\r\n private _internalMarkAllSubMeshesAsTexturesDirty: () => void;\r\n\r\n /** @internal */\r\n public _markAllSubMeshesAsTexturesDirty(): void {\r\n this._enable(this._isEnabled);\r\n this._internalMarkAllSubMeshesAsTexturesDirty();\r\n }\r\n\r\n constructor(material: PBRBaseMaterial, addToPluginList = true) {\r\n super(material, \"PBRClearCoat\", 100, new MaterialClearCoatDefines(), addToPluginList);\r\n\r\n this._internalMarkAllSubMeshesAsTexturesDirty = material._dirtyCallbacks[Constants.MATERIAL_TextureDirtyFlag];\r\n }\r\n\r\n public isReadyForSubMesh(defines: MaterialClearCoatDefines, scene: Scene, engine: Engine): boolean {\r\n if (!this._isEnabled) {\r\n return true;\r\n }\r\n\r\n const disableBumpMap = this._material._disableBumpMap;\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.ClearCoatTextureEnabled) {\r\n if (!this._texture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n\r\n if (this._textureRoughness && MaterialFlags.ClearCoatTextureEnabled) {\r\n if (!this._textureRoughness.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n\r\n if (engine.getCaps().standardDerivatives && this._bumpTexture && MaterialFlags.ClearCoatBumpTextureEnabled && !disableBumpMap) {\r\n // Bump texture cannot be not blocking.\r\n if (!this._bumpTexture.isReady()) {\r\n return false;\r\n }\r\n }\r\n\r\n if (this._isTintEnabled && this._tintTexture && MaterialFlags.ClearCoatTintTextureEnabled) {\r\n if (!this._tintTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n public prepareDefinesBeforeAttributes(defines: MaterialClearCoatDefines, scene: Scene): void {\r\n if (this._isEnabled) {\r\n defines.CLEARCOAT = true;\r\n defines.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE = this._useRoughnessFromMainTexture;\r\n defines.CLEARCOAT_REMAP_F0 = this._remapF0OnInterfaceChange;\r\n\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.ClearCoatTextureEnabled) {\r\n PrepareDefinesForMergedUV(this._texture, defines, \"CLEARCOAT_TEXTURE\");\r\n } else {\r\n defines.CLEARCOAT_TEXTURE = false;\r\n }\r\n\r\n if (this._textureRoughness && MaterialFlags.ClearCoatTextureEnabled) {\r\n PrepareDefinesForMergedUV(this._textureRoughness, defines, \"CLEARCOAT_TEXTURE_ROUGHNESS\");\r\n } else {\r\n defines.CLEARCOAT_TEXTURE_ROUGHNESS = false;\r\n }\r\n\r\n if (this._bumpTexture && MaterialFlags.ClearCoatBumpTextureEnabled) {\r\n PrepareDefinesForMergedUV(this._bumpTexture, defines, \"CLEARCOAT_BUMP\");\r\n } else {\r\n defines.CLEARCOAT_BUMP = false;\r\n }\r\n\r\n defines.CLEARCOAT_DEFAULTIOR = this._indexOfRefraction === PBRClearCoatConfiguration._DefaultIndexOfRefraction;\r\n\r\n if (this._isTintEnabled) {\r\n defines.CLEARCOAT_TINT = true;\r\n if (this._tintTexture && MaterialFlags.ClearCoatTintTextureEnabled) {\r\n PrepareDefinesForMergedUV(this._tintTexture, defines, \"CLEARCOAT_TINT_TEXTURE\");\r\n defines.CLEARCOAT_TINT_GAMMATEXTURE = this._tintTexture.gammaSpace;\r\n } else {\r\n defines.CLEARCOAT_TINT_TEXTURE = false;\r\n }\r\n } else {\r\n defines.CLEARCOAT_TINT = false;\r\n defines.CLEARCOAT_TINT_TEXTURE = false;\r\n }\r\n }\r\n }\r\n } else {\r\n defines.CLEARCOAT = false;\r\n defines.CLEARCOAT_TEXTURE = false;\r\n defines.CLEARCOAT_TEXTURE_ROUGHNESS = false;\r\n defines.CLEARCOAT_BUMP = false;\r\n defines.CLEARCOAT_TINT = false;\r\n defines.CLEARCOAT_TINT_TEXTURE = false;\r\n defines.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE = false;\r\n defines.CLEARCOAT_DEFAULTIOR = false;\r\n defines.CLEARCOAT_TEXTUREDIRECTUV = 0;\r\n defines.CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV = 0;\r\n defines.CLEARCOAT_BUMPDIRECTUV = 0;\r\n defines.CLEARCOAT_REMAP_F0 = false;\r\n defines.CLEARCOAT_TINT_TEXTUREDIRECTUV = 0;\r\n defines.CLEARCOAT_TINT_GAMMATEXTURE = false;\r\n }\r\n }\r\n\r\n public bindForSubMesh(uniformBuffer: UniformBuffer, scene: Scene, engine: Engine, subMesh: SubMesh): void {\r\n if (!this._isEnabled) {\r\n return;\r\n }\r\n\r\n const defines = subMesh!.materialDefines as unknown as MaterialClearCoatDefines;\r\n\r\n const isFrozen = this._material.isFrozen;\r\n\r\n const disableBumpMap = this._material._disableBumpMap;\r\n const invertNormalMapX = this._material._invertNormalMapX;\r\n const invertNormalMapY = this._material._invertNormalMapY;\r\n\r\n if (!uniformBuffer.useUbo || !isFrozen || !uniformBuffer.isSync) {\r\n if ((this._texture || this._textureRoughness) && MaterialFlags.ClearCoatTextureEnabled) {\r\n uniformBuffer.updateFloat4(\r\n \"vClearCoatInfos\",\r\n this._texture?.coordinatesIndex ?? 0,\r\n this._texture?.level ?? 0,\r\n this._textureRoughness?.coordinatesIndex ?? 0,\r\n this._textureRoughness?.level ?? 0\r\n );\r\n if (this._texture) {\r\n BindTextureMatrix(this._texture, uniformBuffer, \"clearCoat\");\r\n }\r\n if (this._textureRoughness && !defines.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE) {\r\n BindTextureMatrix(this._textureRoughness, uniformBuffer, \"clearCoatRoughness\");\r\n }\r\n }\r\n\r\n if (this._bumpTexture && engine.getCaps().standardDerivatives && MaterialFlags.ClearCoatTextureEnabled && !disableBumpMap) {\r\n uniformBuffer.updateFloat2(\"vClearCoatBumpInfos\", this._bumpTexture.coordinatesIndex, this._bumpTexture.level);\r\n BindTextureMatrix(this._bumpTexture, uniformBuffer, \"clearCoatBump\");\r\n\r\n if (scene._mirroredCameraPosition) {\r\n uniformBuffer.updateFloat2(\"vClearCoatTangentSpaceParams\", invertNormalMapX ? 1.0 : -1.0, invertNormalMapY ? 1.0 : -1.0);\r\n } else {\r\n uniformBuffer.updateFloat2(\"vClearCoatTangentSpaceParams\", invertNormalMapX ? -1.0 : 1.0, invertNormalMapY ? -1.0 : 1.0);\r\n }\r\n }\r\n\r\n if (this._tintTexture && MaterialFlags.ClearCoatTintTextureEnabled) {\r\n uniformBuffer.updateFloat2(\"vClearCoatTintInfos\", this._tintTexture.coordinatesIndex, this._tintTexture.level);\r\n BindTextureMatrix(this._tintTexture, uniformBuffer, \"clearCoatTint\");\r\n }\r\n\r\n // Clear Coat General params\r\n uniformBuffer.updateFloat2(\"vClearCoatParams\", this.intensity, this.roughness);\r\n\r\n // Clear Coat Refraction params\r\n const a = 1 - this._indexOfRefraction;\r\n const b = 1 + this._indexOfRefraction;\r\n const f0 = Math.pow(-a / b, 2); // Schlicks approx: (ior1 - ior2) / (ior1 + ior2) where ior2 for air is close to vacuum = 1.\r\n const eta = 1 / this._indexOfRefraction;\r\n uniformBuffer.updateFloat4(\"vClearCoatRefractionParams\", f0, eta, a, b);\r\n\r\n if (this._isTintEnabled) {\r\n uniformBuffer.updateFloat4(\"vClearCoatTintParams\", this.tintColor.r, this.tintColor.g, this.tintColor.b, Math.max(0.00001, this.tintThickness));\r\n uniformBuffer.updateFloat(\"clearCoatColorAtDistance\", Math.max(0.00001, this.tintColorAtDistance));\r\n }\r\n }\r\n\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.ClearCoatTextureEnabled) {\r\n uniformBuffer.setTexture(\"clearCoatSampler\", this._texture);\r\n }\r\n\r\n if (this._textureRoughness && !defines.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE && MaterialFlags.ClearCoatTextureEnabled) {\r\n uniformBuffer.setTexture(\"clearCoatRoughnessSampler\", this._textureRoughness);\r\n }\r\n\r\n if (this._bumpTexture && engine.getCaps().standardDerivatives && MaterialFlags.ClearCoatBumpTextureEnabled && !disableBumpMap) {\r\n uniformBuffer.setTexture(\"clearCoatBumpSampler\", this._bumpTexture);\r\n }\r\n\r\n if (this._isTintEnabled && this._tintTexture && MaterialFlags.ClearCoatTintTextureEnabled) {\r\n uniformBuffer.setTexture(\"clearCoatTintSampler\", this._tintTexture);\r\n }\r\n }\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (this._texture === texture) {\r\n return true;\r\n }\r\n\r\n if (this._textureRoughness === texture) {\r\n return true;\r\n }\r\n\r\n if (this._bumpTexture === texture) {\r\n return true;\r\n }\r\n\r\n if (this._tintTexture === texture) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public getActiveTextures(activeTextures: BaseTexture[]): void {\r\n if (this._texture) {\r\n activeTextures.push(this._texture);\r\n }\r\n\r\n if (this._textureRoughness) {\r\n activeTextures.push(this._textureRoughness);\r\n }\r\n\r\n if (this._bumpTexture) {\r\n activeTextures.push(this._bumpTexture);\r\n }\r\n\r\n if (this._tintTexture) {\r\n activeTextures.push(this._tintTexture);\r\n }\r\n }\r\n\r\n public getAnimatables(animatables: IAnimatable[]): void {\r\n if (this._texture && this._texture.animations && this._texture.animations.length > 0) {\r\n animatables.push(this._texture);\r\n }\r\n\r\n if (this._textureRoughness && this._textureRoughness.animations && this._textureRoughness.animations.length > 0) {\r\n animatables.push(this._textureRoughness);\r\n }\r\n\r\n if (this._bumpTexture && this._bumpTexture.animations && this._bumpTexture.animations.length > 0) {\r\n animatables.push(this._bumpTexture);\r\n }\r\n\r\n if (this._tintTexture && this._tintTexture.animations && this._tintTexture.animations.length > 0) {\r\n animatables.push(this._tintTexture);\r\n }\r\n }\r\n\r\n public dispose(forceDisposeTextures?: boolean): void {\r\n if (forceDisposeTextures) {\r\n this._texture?.dispose();\r\n this._textureRoughness?.dispose();\r\n this._bumpTexture?.dispose();\r\n this._tintTexture?.dispose();\r\n }\r\n }\r\n\r\n public getClassName(): string {\r\n return \"PBRClearCoatConfiguration\";\r\n }\r\n\r\n public addFallbacks(defines: MaterialClearCoatDefines, fallbacks: EffectFallbacks, currentRank: number): number {\r\n if (defines.CLEARCOAT_BUMP) {\r\n fallbacks.addFallback(currentRank++, \"CLEARCOAT_BUMP\");\r\n }\r\n if (defines.CLEARCOAT_TINT) {\r\n fallbacks.addFallback(currentRank++, \"CLEARCOAT_TINT\");\r\n }\r\n if (defines.CLEARCOAT) {\r\n fallbacks.addFallback(currentRank++, \"CLEARCOAT\");\r\n }\r\n return currentRank;\r\n }\r\n\r\n public getSamplers(samplers: string[]): void {\r\n samplers.push(\"clearCoatSampler\", \"clearCoatRoughnessSampler\", \"clearCoatBumpSampler\", \"clearCoatTintSampler\");\r\n }\r\n\r\n public getUniforms(): { ubo?: Array<{ name: string; size: number; type: string }>; vertex?: string; fragment?: string } {\r\n return {\r\n ubo: [\r\n { name: \"vClearCoatParams\", size: 2, type: \"vec2\" },\r\n { name: \"vClearCoatRefractionParams\", size: 4, type: \"vec4\" },\r\n { name: \"vClearCoatInfos\", size: 4, type: \"vec4\" },\r\n { name: \"clearCoatMatrix\", size: 16, type: \"mat4\" },\r\n { name: \"clearCoatRoughnessMatrix\", size: 16, type: \"mat4\" },\r\n { name: \"vClearCoatBumpInfos\", size: 2, type: \"vec2\" },\r\n { name: \"vClearCoatTangentSpaceParams\", size: 2, type: \"vec2\" },\r\n { name: \"clearCoatBumpMatrix\", size: 16, type: \"mat4\" },\r\n { name: \"vClearCoatTintParams\", size: 4, type: \"vec4\" },\r\n { name: \"clearCoatColorAtDistance\", size: 1, type: \"float\" },\r\n { name: \"vClearCoatTintInfos\", size: 2, type: \"vec2\" },\r\n { name: \"clearCoatTintMatrix\", size: 16, type: \"mat4\" },\r\n ],\r\n };\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"pbrClearCoatConfiguration.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/PBR/pbrClearCoatConfiguration.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC3G,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKjD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAKrD,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAE3F;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,eAAe;IAA7D;;QACW,cAAS,GAAG,KAAK,CAAC;QAClB,yBAAoB,GAAG,KAAK,CAAC;QAC7B,sBAAiB,GAAG,KAAK,CAAC;QAC1B,gCAA2B,GAAG,KAAK,CAAC;QACpC,8BAAyB,GAAG,CAAC,CAAC;QAC9B,wCAAmC,GAAG,CAAC,CAAC;QACxC,mBAAc,GAAG,KAAK,CAAC;QACvB,2BAAsB,GAAG,CAAC,CAAC;QAC3B,6CAAwC,GAAG,KAAK,CAAC;QACjD,uBAAkB,GAAG,KAAK,CAAC;QAE3B,mBAAc,GAAG,KAAK,CAAC;QACvB,2BAAsB,GAAG,KAAK,CAAC;QAC/B,mCAA8B,GAAG,CAAC,CAAC;QACnC,gCAA2B,GAAG,KAAK,CAAC;IAC/C,CAAC;CAAA;AAED;;GAEG;AACH,MAAM,OAAO,y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;IACX,gBAAgB,CAAC,kCAAkC,CAAC;4DAC5B;AAMlB;IADN,SAAS,EAAE;4DACiB;AAMtB;IADN,SAAS,EAAE;4DACiB;AAWtB;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;oEAC0B;AAUxE;IAFN,kBAAkB,EAAE;IACpB,gBAAgB,CAAC,kCAAkC,CAAC;0DACR;AAStC;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;8EACX;AASnC;IAFN,kBAAkB,EAAE;IACpB,gBAAgB,CAAC,kCAAkC,CAAC;mEACC;AAQ/C;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;2EACd;AAQhC;IAFN,kBAAkB,EAAE;IACpB,gBAAgB,CAAC,kCAAkC,CAAC;8DACJ;AAQ1C;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;gEACxB;AAOtB;IADN,iBAAiB,EAAE;4DACc;AAQ3B;IADN,SAAS,EAAE;sEACmB;AAOxB;IADN,SAAS,EAAE;gEACqB;AAU1B;IAFN,kBAAkB,EAAE;IACpB,gBAAgB,CAAC,kCAAkC,CAAC;8DACJ","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"../../types\";\r\nimport { serialize, serializeAsTexture, expandToProperty, serializeAsColor3 } from \"../../Misc/decorators\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\nimport type { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport { MaterialFlags } from \"../materialFlags\";\r\nimport type { UniformBuffer } from \"../../Materials/uniformBuffer\";\r\nimport type { IAnimatable } from \"../../Animations/animatable.interface\";\r\nimport type { EffectFallbacks } from \"../effectFallbacks\";\r\nimport type { SubMesh } from \"../../Meshes/subMesh\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { MaterialPluginBase } from \"../materialPluginBase\";\r\nimport { MaterialDefines } from \"../materialDefines\";\r\n\r\nimport type { Engine } from \"../../Engines/engine\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { PBRBaseMaterial } from \"./pbrBaseMaterial\";\r\nimport { BindTextureMatrix, PrepareDefinesForMergedUV } from \"../materialHelper.functions\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class MaterialClearCoatDefines extends MaterialDefines {\r\n public CLEARCOAT = false;\r\n public CLEARCOAT_DEFAULTIOR = false;\r\n public CLEARCOAT_TEXTURE = false;\r\n public CLEARCOAT_TEXTURE_ROUGHNESS = false;\r\n public CLEARCOAT_TEXTUREDIRECTUV = 0;\r\n public CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV = 0;\r\n public CLEARCOAT_BUMP = false;\r\n public CLEARCOAT_BUMPDIRECTUV = 0;\r\n public CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE = false;\r\n public CLEARCOAT_REMAP_F0 = false;\r\n\r\n public CLEARCOAT_TINT = false;\r\n public CLEARCOAT_TINT_TEXTURE = false;\r\n public CLEARCOAT_TINT_TEXTUREDIRECTUV = 0;\r\n public CLEARCOAT_TINT_GAMMATEXTURE = false;\r\n}\r\n\r\n/**\r\n * Plugin that implements the clear coat component of the PBR material\r\n */\r\nexport class PBRClearCoatConfiguration extends MaterialPluginBase {\r\n protected override _material: PBRBaseMaterial;\r\n\r\n /**\r\n * This defaults to 1.5 corresponding to a 0.04 f0 or a 4% reflectance at normal incidence\r\n * The default fits with a polyurethane material.\r\n * @internal\r\n */\r\n public static readonly _DefaultIndexOfRefraction = 1.5;\r\n\r\n private _isEnabled = false;\r\n /**\r\n * Defines if the clear coat is enabled in the material.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public isEnabled = false;\r\n\r\n /**\r\n * Defines the clear coat layer strength (between 0 and 1) it defaults to 1.\r\n */\r\n @serialize()\r\n public intensity: number = 1;\r\n\r\n /**\r\n * Defines the clear coat layer roughness.\r\n */\r\n @serialize()\r\n public roughness: number = 0;\r\n\r\n private _indexOfRefraction = PBRClearCoatConfiguration._DefaultIndexOfRefraction;\r\n /**\r\n * Defines the index of refraction of the clear coat.\r\n * This defaults to 1.5 corresponding to a 0.04 f0 or a 4% reflectance at normal incidence\r\n * The default fits with a polyurethane material.\r\n * Changing the default value is more performance intensive.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public indexOfRefraction = PBRClearCoatConfiguration._DefaultIndexOfRefraction;\r\n\r\n private _texture: Nullable<BaseTexture> = null;\r\n /**\r\n * Stores the clear coat values in a texture (red channel is intensity and green channel is roughness)\r\n * If useRoughnessFromMainTexture is false, the green channel of texture is not used and the green channel of textureRoughness is used instead\r\n * if textureRoughness is not empty, else no texture roughness is used\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public texture: Nullable<BaseTexture> = null;\r\n\r\n private _useRoughnessFromMainTexture = true;\r\n /**\r\n * Indicates that the green channel of the texture property will be used for roughness (default: true)\r\n * If false, the green channel from textureRoughness is used for roughness\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public useRoughnessFromMainTexture = true;\r\n\r\n private _textureRoughness: Nullable<BaseTexture> = null;\r\n /**\r\n * Stores the clear coat roughness in a texture (green channel)\r\n * Not used if useRoughnessFromMainTexture is true\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public textureRoughness: Nullable<BaseTexture> = null;\r\n\r\n private _remapF0OnInterfaceChange = true;\r\n /**\r\n * Defines if the F0 value should be remapped to account for the interface change in the material.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public remapF0OnInterfaceChange = true;\r\n\r\n private _bumpTexture: Nullable<BaseTexture> = null;\r\n /**\r\n * Define the clear coat specific bump texture.\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public bumpTexture: Nullable<BaseTexture> = null;\r\n\r\n private _isTintEnabled = false;\r\n /**\r\n * Defines if the clear coat tint is enabled in the material.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public isTintEnabled = false;\r\n\r\n /**\r\n * Defines the clear coat tint of the material.\r\n * This is only use if tint is enabled\r\n */\r\n @serializeAsColor3()\r\n public tintColor = Color3.White();\r\n\r\n /**\r\n * Defines the distance at which the tint color should be found in the\r\n * clear coat media.\r\n * This is only use if tint is enabled\r\n */\r\n @serialize()\r\n public tintColorAtDistance = 1;\r\n\r\n /**\r\n * Defines the clear coat layer thickness.\r\n * This is only use if tint is enabled\r\n */\r\n @serialize()\r\n public tintThickness: number = 1;\r\n\r\n private _tintTexture: Nullable<BaseTexture> = null;\r\n /**\r\n * Stores the clear tint values in a texture.\r\n * rgb is tint\r\n * a is a thickness factor\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public tintTexture: Nullable<BaseTexture> = null;\r\n\r\n /** @internal */\r\n private _internalMarkAllSubMeshesAsTexturesDirty: () => void;\r\n\r\n /** @internal */\r\n public _markAllSubMeshesAsTexturesDirty(): void {\r\n this._enable(this._isEnabled);\r\n this._internalMarkAllSubMeshesAsTexturesDirty();\r\n }\r\n\r\n constructor(material: PBRBaseMaterial, addToPluginList = true) {\r\n super(material, \"PBRClearCoat\", 100, new MaterialClearCoatDefines(), addToPluginList);\r\n\r\n this._internalMarkAllSubMeshesAsTexturesDirty = material._dirtyCallbacks[Constants.MATERIAL_TextureDirtyFlag];\r\n }\r\n\r\n public override isReadyForSubMesh(defines: MaterialClearCoatDefines, scene: Scene, engine: Engine): boolean {\r\n if (!this._isEnabled) {\r\n return true;\r\n }\r\n\r\n const disableBumpMap = this._material._disableBumpMap;\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.ClearCoatTextureEnabled) {\r\n if (!this._texture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n\r\n if (this._textureRoughness && MaterialFlags.ClearCoatTextureEnabled) {\r\n if (!this._textureRoughness.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n\r\n if (engine.getCaps().standardDerivatives && this._bumpTexture && MaterialFlags.ClearCoatBumpTextureEnabled && !disableBumpMap) {\r\n // Bump texture cannot be not blocking.\r\n if (!this._bumpTexture.isReady()) {\r\n return false;\r\n }\r\n }\r\n\r\n if (this._isTintEnabled && this._tintTexture && MaterialFlags.ClearCoatTintTextureEnabled) {\r\n if (!this._tintTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n public override prepareDefinesBeforeAttributes(defines: MaterialClearCoatDefines, scene: Scene): void {\r\n if (this._isEnabled) {\r\n defines.CLEARCOAT = true;\r\n defines.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE = this._useRoughnessFromMainTexture;\r\n defines.CLEARCOAT_REMAP_F0 = this._remapF0OnInterfaceChange;\r\n\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.ClearCoatTextureEnabled) {\r\n PrepareDefinesForMergedUV(this._texture, defines, \"CLEARCOAT_TEXTURE\");\r\n } else {\r\n defines.CLEARCOAT_TEXTURE = false;\r\n }\r\n\r\n if (this._textureRoughness && MaterialFlags.ClearCoatTextureEnabled) {\r\n PrepareDefinesForMergedUV(this._textureRoughness, defines, \"CLEARCOAT_TEXTURE_ROUGHNESS\");\r\n } else {\r\n defines.CLEARCOAT_TEXTURE_ROUGHNESS = false;\r\n }\r\n\r\n if (this._bumpTexture && MaterialFlags.ClearCoatBumpTextureEnabled) {\r\n PrepareDefinesForMergedUV(this._bumpTexture, defines, \"CLEARCOAT_BUMP\");\r\n } else {\r\n defines.CLEARCOAT_BUMP = false;\r\n }\r\n\r\n defines.CLEARCOAT_DEFAULTIOR = this._indexOfRefraction === PBRClearCoatConfiguration._DefaultIndexOfRefraction;\r\n\r\n if (this._isTintEnabled) {\r\n defines.CLEARCOAT_TINT = true;\r\n if (this._tintTexture && MaterialFlags.ClearCoatTintTextureEnabled) {\r\n PrepareDefinesForMergedUV(this._tintTexture, defines, \"CLEARCOAT_TINT_TEXTURE\");\r\n defines.CLEARCOAT_TINT_GAMMATEXTURE = this._tintTexture.gammaSpace;\r\n } else {\r\n defines.CLEARCOAT_TINT_TEXTURE = false;\r\n }\r\n } else {\r\n defines.CLEARCOAT_TINT = false;\r\n defines.CLEARCOAT_TINT_TEXTURE = false;\r\n }\r\n }\r\n }\r\n } else {\r\n defines.CLEARCOAT = false;\r\n defines.CLEARCOAT_TEXTURE = false;\r\n defines.CLEARCOAT_TEXTURE_ROUGHNESS = false;\r\n defines.CLEARCOAT_BUMP = false;\r\n defines.CLEARCOAT_TINT = false;\r\n defines.CLEARCOAT_TINT_TEXTURE = false;\r\n defines.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE = false;\r\n defines.CLEARCOAT_DEFAULTIOR = false;\r\n defines.CLEARCOAT_TEXTUREDIRECTUV = 0;\r\n defines.CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV = 0;\r\n defines.CLEARCOAT_BUMPDIRECTUV = 0;\r\n defines.CLEARCOAT_REMAP_F0 = false;\r\n defines.CLEARCOAT_TINT_TEXTUREDIRECTUV = 0;\r\n defines.CLEARCOAT_TINT_GAMMATEXTURE = false;\r\n }\r\n }\r\n\r\n public override bindForSubMesh(uniformBuffer: UniformBuffer, scene: Scene, engine: Engine, subMesh: SubMesh): void {\r\n if (!this._isEnabled) {\r\n return;\r\n }\r\n\r\n const defines = subMesh!.materialDefines as unknown as MaterialClearCoatDefines;\r\n\r\n const isFrozen = this._material.isFrozen;\r\n\r\n const disableBumpMap = this._material._disableBumpMap;\r\n const invertNormalMapX = this._material._invertNormalMapX;\r\n const invertNormalMapY = this._material._invertNormalMapY;\r\n\r\n if (!uniformBuffer.useUbo || !isFrozen || !uniformBuffer.isSync) {\r\n if ((this._texture || this._textureRoughness) && MaterialFlags.ClearCoatTextureEnabled) {\r\n uniformBuffer.updateFloat4(\r\n \"vClearCoatInfos\",\r\n this._texture?.coordinatesIndex ?? 0,\r\n this._texture?.level ?? 0,\r\n this._textureRoughness?.coordinatesIndex ?? 0,\r\n this._textureRoughness?.level ?? 0\r\n );\r\n if (this._texture) {\r\n BindTextureMatrix(this._texture, uniformBuffer, \"clearCoat\");\r\n }\r\n if (this._textureRoughness && !defines.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE) {\r\n BindTextureMatrix(this._textureRoughness, uniformBuffer, \"clearCoatRoughness\");\r\n }\r\n }\r\n\r\n if (this._bumpTexture && engine.getCaps().standardDerivatives && MaterialFlags.ClearCoatTextureEnabled && !disableBumpMap) {\r\n uniformBuffer.updateFloat2(\"vClearCoatBumpInfos\", this._bumpTexture.coordinatesIndex, this._bumpTexture.level);\r\n BindTextureMatrix(this._bumpTexture, uniformBuffer, \"clearCoatBump\");\r\n\r\n if (scene._mirroredCameraPosition) {\r\n uniformBuffer.updateFloat2(\"vClearCoatTangentSpaceParams\", invertNormalMapX ? 1.0 : -1.0, invertNormalMapY ? 1.0 : -1.0);\r\n } else {\r\n uniformBuffer.updateFloat2(\"vClearCoatTangentSpaceParams\", invertNormalMapX ? -1.0 : 1.0, invertNormalMapY ? -1.0 : 1.0);\r\n }\r\n }\r\n\r\n if (this._tintTexture && MaterialFlags.ClearCoatTintTextureEnabled) {\r\n uniformBuffer.updateFloat2(\"vClearCoatTintInfos\", this._tintTexture.coordinatesIndex, this._tintTexture.level);\r\n BindTextureMatrix(this._tintTexture, uniformBuffer, \"clearCoatTint\");\r\n }\r\n\r\n // Clear Coat General params\r\n uniformBuffer.updateFloat2(\"vClearCoatParams\", this.intensity, this.roughness);\r\n\r\n // Clear Coat Refraction params\r\n const a = 1 - this._indexOfRefraction;\r\n const b = 1 + this._indexOfRefraction;\r\n const f0 = Math.pow(-a / b, 2); // Schlicks approx: (ior1 - ior2) / (ior1 + ior2) where ior2 for air is close to vacuum = 1.\r\n const eta = 1 / this._indexOfRefraction;\r\n uniformBuffer.updateFloat4(\"vClearCoatRefractionParams\", f0, eta, a, b);\r\n\r\n if (this._isTintEnabled) {\r\n uniformBuffer.updateFloat4(\"vClearCoatTintParams\", this.tintColor.r, this.tintColor.g, this.tintColor.b, Math.max(0.00001, this.tintThickness));\r\n uniformBuffer.updateFloat(\"clearCoatColorAtDistance\", Math.max(0.00001, this.tintColorAtDistance));\r\n }\r\n }\r\n\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.ClearCoatTextureEnabled) {\r\n uniformBuffer.setTexture(\"clearCoatSampler\", this._texture);\r\n }\r\n\r\n if (this._textureRoughness && !defines.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE && MaterialFlags.ClearCoatTextureEnabled) {\r\n uniformBuffer.setTexture(\"clearCoatRoughnessSampler\", this._textureRoughness);\r\n }\r\n\r\n if (this._bumpTexture && engine.getCaps().standardDerivatives && MaterialFlags.ClearCoatBumpTextureEnabled && !disableBumpMap) {\r\n uniformBuffer.setTexture(\"clearCoatBumpSampler\", this._bumpTexture);\r\n }\r\n\r\n if (this._isTintEnabled && this._tintTexture && MaterialFlags.ClearCoatTintTextureEnabled) {\r\n uniformBuffer.setTexture(\"clearCoatTintSampler\", this._tintTexture);\r\n }\r\n }\r\n }\r\n\r\n public override hasTexture(texture: BaseTexture): boolean {\r\n if (this._texture === texture) {\r\n return true;\r\n }\r\n\r\n if (this._textureRoughness === texture) {\r\n return true;\r\n }\r\n\r\n if (this._bumpTexture === texture) {\r\n return true;\r\n }\r\n\r\n if (this._tintTexture === texture) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public override getActiveTextures(activeTextures: BaseTexture[]): void {\r\n if (this._texture) {\r\n activeTextures.push(this._texture);\r\n }\r\n\r\n if (this._textureRoughness) {\r\n activeTextures.push(this._textureRoughness);\r\n }\r\n\r\n if (this._bumpTexture) {\r\n activeTextures.push(this._bumpTexture);\r\n }\r\n\r\n if (this._tintTexture) {\r\n activeTextures.push(this._tintTexture);\r\n }\r\n }\r\n\r\n public override getAnimatables(animatables: IAnimatable[]): void {\r\n if (this._texture && this._texture.animations && this._texture.animations.length > 0) {\r\n animatables.push(this._texture);\r\n }\r\n\r\n if (this._textureRoughness && this._textureRoughness.animations && this._textureRoughness.animations.length > 0) {\r\n animatables.push(this._textureRoughness);\r\n }\r\n\r\n if (this._bumpTexture && this._bumpTexture.animations && this._bumpTexture.animations.length > 0) {\r\n animatables.push(this._bumpTexture);\r\n }\r\n\r\n if (this._tintTexture && this._tintTexture.animations && this._tintTexture.animations.length > 0) {\r\n animatables.push(this._tintTexture);\r\n }\r\n }\r\n\r\n public override dispose(forceDisposeTextures?: boolean): void {\r\n if (forceDisposeTextures) {\r\n this._texture?.dispose();\r\n this._textureRoughness?.dispose();\r\n this._bumpTexture?.dispose();\r\n this._tintTexture?.dispose();\r\n }\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"PBRClearCoatConfiguration\";\r\n }\r\n\r\n public override addFallbacks(defines: MaterialClearCoatDefines, fallbacks: EffectFallbacks, currentRank: number): number {\r\n if (defines.CLEARCOAT_BUMP) {\r\n fallbacks.addFallback(currentRank++, \"CLEARCOAT_BUMP\");\r\n }\r\n if (defines.CLEARCOAT_TINT) {\r\n fallbacks.addFallback(currentRank++, \"CLEARCOAT_TINT\");\r\n }\r\n if (defines.CLEARCOAT) {\r\n fallbacks.addFallback(currentRank++, \"CLEARCOAT\");\r\n }\r\n return currentRank;\r\n }\r\n\r\n public override getSamplers(samplers: string[]): void {\r\n samplers.push(\"clearCoatSampler\", \"clearCoatRoughnessSampler\", \"clearCoatBumpSampler\", \"clearCoatTintSampler\");\r\n }\r\n\r\n public override getUniforms(): { ubo?: Array<{ name: string; size: number; type: string }>; vertex?: string; fragment?: string } {\r\n return {\r\n ubo: [\r\n { name: \"vClearCoatParams\", size: 2, type: \"vec2\" },\r\n { name: \"vClearCoatRefractionParams\", size: 4, type: \"vec4\" },\r\n { name: \"vClearCoatInfos\", size: 4, type: \"vec4\" },\r\n { name: \"clearCoatMatrix\", size: 16, type: \"mat4\" },\r\n { name: \"clearCoatRoughnessMatrix\", size: 16, type: \"mat4\" },\r\n { name: \"vClearCoatBumpInfos\", size: 2, type: \"vec2\" },\r\n { name: \"vClearCoatTangentSpaceParams\", size: 2, type: \"vec2\" },\r\n { name: \"clearCoatBumpMatrix\", size: 16, type: \"mat4\" },\r\n { name: \"vClearCoatTintParams\", size: 4, type: \"vec4\" },\r\n { name: \"clearCoatColorAtDistance\", size: 1, type: \"float\" },\r\n { name: \"vClearCoatTintInfos\", size: 2, type: \"vec2\" },\r\n { name: \"clearCoatTintMatrix\", size: 16, type: \"mat4\" },\r\n ],\r\n };\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"pbrIridescenceConfiguration.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/PBR/pbrIridescenceConfiguration.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAExF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAIjD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAIrD,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAE3F;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,eAAe;IAA/D;;QACW,gBAAW,GAAG,KAAK,CAAC;QACpB,wBAAmB,GAAG,KAAK,CAAC;QAC5B,gCAA2B,GAAG,CAAC,CAAC;Q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,EAAE;IACpB,gBAAgB,CAAC,kCAAkC,CAAC;qEACC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"../../types\";\r\nimport { serialize, serializeAsTexture, expandToProperty } from \"../../Misc/decorators\";\r\nimport type { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport { MaterialFlags } from \"../materialFlags\";\r\nimport type { UniformBuffer } from \"../../Materials/uniformBuffer\";\r\nimport type { IAnimatable } from \"../../Animations/animatable.interface\";\r\nimport type { EffectFallbacks } from \"../effectFallbacks\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { MaterialPluginBase } from \"../materialPluginBase\";\r\nimport { MaterialDefines } from \"../materialDefines\";\r\n\r\nimport type { Scene } from \"../../scene\";\r\nimport type { PBRBaseMaterial } from \"./pbrBaseMaterial\";\r\nimport { BindTextureMatrix, PrepareDefinesForMergedUV } from \"../materialHelper.functions\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class MaterialIridescenceDefines extends MaterialDefines {\r\n public IRIDESCENCE = false;\r\n public IRIDESCENCE_TEXTURE = false;\r\n public IRIDESCENCE_TEXTUREDIRECTUV = 0;\r\n public IRIDESCENCE_THICKNESS_TEXTURE = false;\r\n public IRIDESCENCE_THICKNESS_TEXTUREDIRECTUV = 0;\r\n}\r\n\r\n/**\r\n * Plugin that implements the iridescence (thin film) component of the PBR material\r\n */\r\nexport class PBRIridescenceConfiguration extends MaterialPluginBase {\r\n protected _material: PBRBaseMaterial;\r\n\r\n /**\r\n * The default minimum thickness of the thin-film layer given in nanometers (nm).\r\n * Defaults to 100 nm.\r\n * @internal\r\n */\r\n public static readonly _DefaultMinimumThickness = 100;\r\n\r\n /**\r\n * The default maximum thickness of the thin-film layer given in nanometers (nm).\r\n * Defaults to 400 nm.\r\n * @internal\r\n */\r\n public static readonly _DefaultMaximumThickness = 400;\r\n\r\n /**\r\n * The default index of refraction of the thin-film layer.\r\n * Defaults to 1.3\r\n * @internal\r\n */\r\n public static readonly _DefaultIndexOfRefraction = 1.3;\r\n\r\n private _isEnabled = false;\r\n /**\r\n * Defines if the iridescence is enabled in the material.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public isEnabled = false;\r\n\r\n /**\r\n * Defines the iridescence layer strength (between 0 and 1) it defaults to 1.\r\n */\r\n @serialize()\r\n public intensity: number = 1;\r\n\r\n /**\r\n * Defines the minimum thickness of the thin-film layer given in nanometers (nm).\r\n */\r\n @serialize()\r\n public minimumThickness: number = PBRIridescenceConfiguration._DefaultMinimumThickness;\r\n\r\n /**\r\n * Defines the maximum thickness of the thin-film layer given in nanometers (nm). This will be the thickness used if not thickness texture has been set.\r\n */\r\n @serialize()\r\n public maximumThickness: number = PBRIridescenceConfiguration._DefaultMaximumThickness;\r\n\r\n /**\r\n * Defines the maximum thickness of the thin-film layer given in nanometers (nm).\r\n */\r\n @serialize()\r\n public indexOfRefraction: number = PBRIridescenceConfiguration._DefaultIndexOfRefraction;\r\n\r\n private _texture: Nullable<BaseTexture> = null;\r\n /**\r\n * Stores the iridescence intensity in a texture (red channel)\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public texture: Nullable<BaseTexture> = null;\r\n\r\n private _thicknessTexture: Nullable<BaseTexture> = null;\r\n /**\r\n * Stores the iridescence thickness in a texture (green channel)\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public thicknessTexture: Nullable<BaseTexture> = null;\r\n\r\n /** @internal */\r\n private _internalMarkAllSubMeshesAsTexturesDirty: () => void;\r\n\r\n /** @internal */\r\n public _markAllSubMeshesAsTexturesDirty(): void {\r\n this._enable(this._isEnabled);\r\n this._internalMarkAllSubMeshesAsTexturesDirty();\r\n }\r\n\r\n constructor(material: PBRBaseMaterial, addToPluginList = true) {\r\n super(material, \"PBRIridescence\", 110, new MaterialIridescenceDefines(), addToPluginList);\r\n\r\n this._internalMarkAllSubMeshesAsTexturesDirty = material._dirtyCallbacks[Constants.MATERIAL_TextureDirtyFlag];\r\n }\r\n\r\n public isReadyForSubMesh(defines: MaterialIridescenceDefines, scene: Scene): boolean {\r\n if (!this._isEnabled) {\r\n return true;\r\n }\r\n\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.IridescenceTextureEnabled) {\r\n if (!this._texture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n\r\n if (this._thicknessTexture && MaterialFlags.IridescenceTextureEnabled) {\r\n if (!this._thicknessTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n public prepareDefinesBeforeAttributes(defines: MaterialIridescenceDefines, scene: Scene): void {\r\n if (this._isEnabled) {\r\n defines.IRIDESCENCE = true;\r\n\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.IridescenceTextureEnabled) {\r\n PrepareDefinesForMergedUV(this._texture, defines, \"IRIDESCENCE_TEXTURE\");\r\n } else {\r\n defines.IRIDESCENCE_TEXTURE = false;\r\n }\r\n\r\n if (this._thicknessTexture && MaterialFlags.IridescenceTextureEnabled) {\r\n PrepareDefinesForMergedUV(this._thicknessTexture, defines, \"IRIDESCENCE_THICKNESS_TEXTURE\");\r\n } else {\r\n defines.IRIDESCENCE_THICKNESS_TEXTURE = false;\r\n }\r\n }\r\n }\r\n } else {\r\n defines.IRIDESCENCE = false;\r\n defines.IRIDESCENCE_TEXTURE = false;\r\n defines.IRIDESCENCE_THICKNESS_TEXTURE = false;\r\n defines.IRIDESCENCE_TEXTUREDIRECTUV = 0;\r\n defines.IRIDESCENCE_THICKNESS_TEXTUREDIRECTUV = 0;\r\n }\r\n }\r\n\r\n public bindForSubMesh(uniformBuffer: UniformBuffer, scene: Scene): void {\r\n if (!this._isEnabled) {\r\n return;\r\n }\r\n\r\n const isFrozen = this._material.isFrozen;\r\n\r\n if (!uniformBuffer.useUbo || !isFrozen || !uniformBuffer.isSync) {\r\n if ((this._texture || this._thicknessTexture) && MaterialFlags.IridescenceTextureEnabled) {\r\n uniformBuffer.updateFloat4(\r\n \"vIridescenceInfos\",\r\n this._texture?.coordinatesIndex ?? 0,\r\n this._texture?.level ?? 0,\r\n this._thicknessTexture?.coordinatesIndex ?? 0,\r\n this._thicknessTexture?.level ?? 0\r\n );\r\n if (this._texture) {\r\n BindTextureMatrix(this._texture, uniformBuffer, \"iridescence\");\r\n }\r\n if (this._thicknessTexture) {\r\n BindTextureMatrix(this._thicknessTexture, uniformBuffer, \"iridescenceThickness\");\r\n }\r\n }\r\n\r\n // Clear Coat General params\r\n uniformBuffer.updateFloat4(\"vIridescenceParams\", this.intensity, this.indexOfRefraction, this.minimumThickness, this.maximumThickness);\r\n }\r\n\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.IridescenceTextureEnabled) {\r\n uniformBuffer.setTexture(\"iridescenceSampler\", this._texture);\r\n }\r\n\r\n if (this._thicknessTexture && MaterialFlags.IridescenceTextureEnabled) {\r\n uniformBuffer.setTexture(\"iridescenceThicknessSampler\", this._thicknessTexture);\r\n }\r\n }\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (this._texture === texture) {\r\n return true;\r\n }\r\n\r\n if (this._thicknessTexture === texture) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public getActiveTextures(activeTextures: BaseTexture[]): void {\r\n if (this._texture) {\r\n activeTextures.push(this._texture);\r\n }\r\n\r\n if (this._thicknessTexture) {\r\n activeTextures.push(this._thicknessTexture);\r\n }\r\n }\r\n\r\n public getAnimatables(animatables: IAnimatable[]): void {\r\n if (this._texture && this._texture.animations && this._texture.animations.length > 0) {\r\n animatables.push(this._texture);\r\n }\r\n\r\n if (this._thicknessTexture && this._thicknessTexture.animations && this._thicknessTexture.animations.length > 0) {\r\n animatables.push(this._thicknessTexture);\r\n }\r\n }\r\n\r\n public dispose(forceDisposeTextures?: boolean): void {\r\n if (forceDisposeTextures) {\r\n this._texture?.dispose();\r\n this._thicknessTexture?.dispose();\r\n }\r\n }\r\n\r\n public getClassName(): string {\r\n return \"PBRIridescenceConfiguration\";\r\n }\r\n\r\n public addFallbacks(defines: MaterialIridescenceDefines, fallbacks: EffectFallbacks, currentRank: number): number {\r\n if (defines.IRIDESCENCE) {\r\n fallbacks.addFallback(currentRank++, \"IRIDESCENCE\");\r\n }\r\n return currentRank;\r\n }\r\n\r\n public getSamplers(samplers: string[]): void {\r\n samplers.push(\"iridescenceSampler\", \"iridescenceThicknessSampler\");\r\n }\r\n\r\n public getUniforms(): { ubo?: Array<{ name: string; size: number; type: string }>; vertex?: string; fragment?: string } {\r\n return {\r\n ubo: [\r\n { name: \"vIridescenceParams\", size: 4, type: \"vec4\" },\r\n { name: \"vIridescenceInfos\", size: 4, type: \"vec4\" },\r\n { name: \"iridescenceMatrix\", size: 16, type: \"mat4\" },\r\n { name: \"iridescenceThicknessMatrix\", size: 16, type: \"mat4\" },\r\n ],\r\n };\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"pbrIridescenceConfiguration.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/PBR/pbrIridescenceConfiguration.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAExF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAIjD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAIrD,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAE3F;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ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AMhF;IADN,SAAS,EAAE;sEAC6E;AAQlF;IAFN,kBAAkB,EAAE;IACpB,gBAAgB,CAAC,kCAAkC,CAAC;4DACR;AAQtC;IAFN,kBAAkB,EAAE;IACpB,gBAAgB,CAAC,kCAAkC,CAAC;qEACC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"../../types\";\r\nimport { serialize, serializeAsTexture, expandToProperty } from \"../../Misc/decorators\";\r\nimport type { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport { MaterialFlags } from \"../materialFlags\";\r\nimport type { UniformBuffer } from \"../../Materials/uniformBuffer\";\r\nimport type { IAnimatable } from \"../../Animations/animatable.interface\";\r\nimport type { EffectFallbacks } from \"../effectFallbacks\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { MaterialPluginBase } from \"../materialPluginBase\";\r\nimport { MaterialDefines } from \"../materialDefines\";\r\n\r\nimport type { Scene } from \"../../scene\";\r\nimport type { PBRBaseMaterial } from \"./pbrBaseMaterial\";\r\nimport { BindTextureMatrix, PrepareDefinesForMergedUV } from \"../materialHelper.functions\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class MaterialIridescenceDefines extends MaterialDefines {\r\n public IRIDESCENCE = false;\r\n public IRIDESCENCE_TEXTURE = false;\r\n public IRIDESCENCE_TEXTUREDIRECTUV = 0;\r\n public IRIDESCENCE_THICKNESS_TEXTURE = false;\r\n public IRIDESCENCE_THICKNESS_TEXTUREDIRECTUV = 0;\r\n}\r\n\r\n/**\r\n * Plugin that implements the iridescence (thin film) component of the PBR material\r\n */\r\nexport class PBRIridescenceConfiguration extends MaterialPluginBase {\r\n protected override _material: PBRBaseMaterial;\r\n\r\n /**\r\n * The default minimum thickness of the thin-film layer given in nanometers (nm).\r\n * Defaults to 100 nm.\r\n * @internal\r\n */\r\n public static readonly _DefaultMinimumThickness = 100;\r\n\r\n /**\r\n * The default maximum thickness of the thin-film layer given in nanometers (nm).\r\n * Defaults to 400 nm.\r\n * @internal\r\n */\r\n public static readonly _DefaultMaximumThickness = 400;\r\n\r\n /**\r\n * The default index of refraction of the thin-film layer.\r\n * Defaults to 1.3\r\n * @internal\r\n */\r\n public static readonly _DefaultIndexOfRefraction = 1.3;\r\n\r\n private _isEnabled = false;\r\n /**\r\n * Defines if the iridescence is enabled in the material.\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public isEnabled = false;\r\n\r\n /**\r\n * Defines the iridescence layer strength (between 0 and 1) it defaults to 1.\r\n */\r\n @serialize()\r\n public intensity: number = 1;\r\n\r\n /**\r\n * Defines the minimum thickness of the thin-film layer given in nanometers (nm).\r\n */\r\n @serialize()\r\n public minimumThickness: number = PBRIridescenceConfiguration._DefaultMinimumThickness;\r\n\r\n /**\r\n * Defines the maximum thickness of the thin-film layer given in nanometers (nm). This will be the thickness used if not thickness texture has been set.\r\n */\r\n @serialize()\r\n public maximumThickness: number = PBRIridescenceConfiguration._DefaultMaximumThickness;\r\n\r\n /**\r\n * Defines the maximum thickness of the thin-film layer given in nanometers (nm).\r\n */\r\n @serialize()\r\n public indexOfRefraction: number = PBRIridescenceConfiguration._DefaultIndexOfRefraction;\r\n\r\n private _texture: Nullable<BaseTexture> = null;\r\n /**\r\n * Stores the iridescence intensity in a texture (red channel)\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public texture: Nullable<BaseTexture> = null;\r\n\r\n private _thicknessTexture: Nullable<BaseTexture> = null;\r\n /**\r\n * Stores the iridescence thickness in a texture (green channel)\r\n */\r\n @serializeAsTexture()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public thicknessTexture: Nullable<BaseTexture> = null;\r\n\r\n /** @internal */\r\n private _internalMarkAllSubMeshesAsTexturesDirty: () => void;\r\n\r\n /** @internal */\r\n public _markAllSubMeshesAsTexturesDirty(): void {\r\n this._enable(this._isEnabled);\r\n this._internalMarkAllSubMeshesAsTexturesDirty();\r\n }\r\n\r\n constructor(material: PBRBaseMaterial, addToPluginList = true) {\r\n super(material, \"PBRIridescence\", 110, new MaterialIridescenceDefines(), addToPluginList);\r\n\r\n this._internalMarkAllSubMeshesAsTexturesDirty = material._dirtyCallbacks[Constants.MATERIAL_TextureDirtyFlag];\r\n }\r\n\r\n public override isReadyForSubMesh(defines: MaterialIridescenceDefines, scene: Scene): boolean {\r\n if (!this._isEnabled) {\r\n return true;\r\n }\r\n\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.IridescenceTextureEnabled) {\r\n if (!this._texture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n\r\n if (this._thicknessTexture && MaterialFlags.IridescenceTextureEnabled) {\r\n if (!this._thicknessTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n public override prepareDefinesBeforeAttributes(defines: MaterialIridescenceDefines, scene: Scene): void {\r\n if (this._isEnabled) {\r\n defines.IRIDESCENCE = true;\r\n\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.IridescenceTextureEnabled) {\r\n PrepareDefinesForMergedUV(this._texture, defines, \"IRIDESCENCE_TEXTURE\");\r\n } else {\r\n defines.IRIDESCENCE_TEXTURE = false;\r\n }\r\n\r\n if (this._thicknessTexture && MaterialFlags.IridescenceTextureEnabled) {\r\n PrepareDefinesForMergedUV(this._thicknessTexture, defines, \"IRIDESCENCE_THICKNESS_TEXTURE\");\r\n } else {\r\n defines.IRIDESCENCE_THICKNESS_TEXTURE = false;\r\n }\r\n }\r\n }\r\n } else {\r\n defines.IRIDESCENCE = false;\r\n defines.IRIDESCENCE_TEXTURE = false;\r\n defines.IRIDESCENCE_THICKNESS_TEXTURE = false;\r\n defines.IRIDESCENCE_TEXTUREDIRECTUV = 0;\r\n defines.IRIDESCENCE_THICKNESS_TEXTUREDIRECTUV = 0;\r\n }\r\n }\r\n\r\n public override bindForSubMesh(uniformBuffer: UniformBuffer, scene: Scene): void {\r\n if (!this._isEnabled) {\r\n return;\r\n }\r\n\r\n const isFrozen = this._material.isFrozen;\r\n\r\n if (!uniformBuffer.useUbo || !isFrozen || !uniformBuffer.isSync) {\r\n if ((this._texture || this._thicknessTexture) && MaterialFlags.IridescenceTextureEnabled) {\r\n uniformBuffer.updateFloat4(\r\n \"vIridescenceInfos\",\r\n this._texture?.coordinatesIndex ?? 0,\r\n this._texture?.level ?? 0,\r\n this._thicknessTexture?.coordinatesIndex ?? 0,\r\n this._thicknessTexture?.level ?? 0\r\n );\r\n if (this._texture) {\r\n BindTextureMatrix(this._texture, uniformBuffer, \"iridescence\");\r\n }\r\n if (this._thicknessTexture) {\r\n BindTextureMatrix(this._thicknessTexture, uniformBuffer, \"iridescenceThickness\");\r\n }\r\n }\r\n\r\n // Clear Coat General params\r\n uniformBuffer.updateFloat4(\"vIridescenceParams\", this.intensity, this.indexOfRefraction, this.minimumThickness, this.maximumThickness);\r\n }\r\n\r\n // Textures\r\n if (scene.texturesEnabled) {\r\n if (this._texture && MaterialFlags.IridescenceTextureEnabled) {\r\n uniformBuffer.setTexture(\"iridescenceSampler\", this._texture);\r\n }\r\n\r\n if (this._thicknessTexture && MaterialFlags.IridescenceTextureEnabled) {\r\n uniformBuffer.setTexture(\"iridescenceThicknessSampler\", this._thicknessTexture);\r\n }\r\n }\r\n }\r\n\r\n public override hasTexture(texture: BaseTexture): boolean {\r\n if (this._texture === texture) {\r\n return true;\r\n }\r\n\r\n if (this._thicknessTexture === texture) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public override getActiveTextures(activeTextures: BaseTexture[]): void {\r\n if (this._texture) {\r\n activeTextures.push(this._texture);\r\n }\r\n\r\n if (this._thicknessTexture) {\r\n activeTextures.push(this._thicknessTexture);\r\n }\r\n }\r\n\r\n public override getAnimatables(animatables: IAnimatable[]): void {\r\n if (this._texture && this._texture.animations && this._texture.animations.length > 0) {\r\n animatables.push(this._texture);\r\n }\r\n\r\n if (this._thicknessTexture && this._thicknessTexture.animations && this._thicknessTexture.animations.length > 0) {\r\n animatables.push(this._thicknessTexture);\r\n }\r\n }\r\n\r\n public override dispose(forceDisposeTextures?: boolean): void {\r\n if (forceDisposeTextures) {\r\n this._texture?.dispose();\r\n this._thicknessTexture?.dispose();\r\n }\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"PBRIridescenceConfiguration\";\r\n }\r\n\r\n public override addFallbacks(defines: MaterialIridescenceDefines, fallbacks: EffectFallbacks, currentRank: number): number {\r\n if (defines.IRIDESCENCE) {\r\n fallbacks.addFallback(currentRank++, \"IRIDESCENCE\");\r\n }\r\n return currentRank;\r\n }\r\n\r\n public override getSamplers(samplers: string[]): void {\r\n samplers.push(\"iridescenceSampler\", \"iridescenceThicknessSampler\");\r\n }\r\n\r\n public override getUniforms(): { ubo?: Array<{ name: string; size: number; type: string }>; vertex?: string; fragment?: string } {\r\n return {\r\n ubo: [\r\n { name: \"vIridescenceParams\", size: 4, type: \"vec4\" },\r\n { name: \"vIridescenceInfos\", size: 4, type: \"vec4\" },\r\n { name: \"iridescenceMatrix\", size: 16, type: \"mat4\" },\r\n { name: \"iridescenceThicknessMatrix\", size: 16, type: \"mat4\" },\r\n ],\r\n };\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"pbrMaterial.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/PBR/pbrMaterial.ts"],"names":[],"mappings":";AAAA,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,wBAAwB,CAAC;AAIhD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAA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B;AAO7B;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;sDACrB;AAOzB;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,gCAAgC,CAAC;oDACpB;AAOxB;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;8DACZ;AAOlC;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,gCAAgC,CAAC;0DAClB;AAO1B;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;qDACrB;AAOzB;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;qDACrB;AAOzB;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;qDACrB;AAQzB;IAFN,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;AAsN/C,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import { 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\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\nimport type { ImageProcessingConfiguration } from \"../../Materials/imageProcessingConfiguration\";\r\nimport type { ColorCurves } from \"../../Materials/colorCurves\";\r\nimport type { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport { PBRBaseMaterial } from \"./pbrBaseMaterial\";\r\nimport { RegisterClass } from \"../../Misc/typeStore\";\r\nimport { Material } from \"../material\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\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 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 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 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 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 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 * 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 * 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 * Gets the image processing configuration used either in this material.\r\n */\r\n public get imageProcessingConfiguration(): ImageProcessingConfiguration {\r\n return this._imageProcessingConfiguration;\r\n }\r\n\r\n /**\r\n * Sets the Default image processing configuration used either in the this material.\r\n *\r\n * If sets to null, the scene one is in use.\r\n */\r\n public set imageProcessingConfiguration(value: ImageProcessingConfiguration) {\r\n this._attachImageProcessingConfiguration(value);\r\n\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n }\r\n\r\n /**\r\n * Gets whether the color curves effect is enabled.\r\n */\r\n public get cameraColorCurvesEnabled(): boolean {\r\n return this.imageProcessingConfiguration.colorCurvesEnabled;\r\n }\r\n /**\r\n * Sets whether the color curves effect is enabled.\r\n */\r\n public set cameraColorCurvesEnabled(value: boolean) {\r\n this.imageProcessingConfiguration.colorCurvesEnabled = value;\r\n }\r\n\r\n /**\r\n * Gets whether the color grading effect is enabled.\r\n */\r\n public get cameraColorGradingEnabled(): boolean {\r\n return this.imageProcessingConfiguration.colorGradingEnabled;\r\n }\r\n /**\r\n * Gets whether the color grading effect is enabled.\r\n */\r\n public set cameraColorGradingEnabled(value: boolean) {\r\n this.imageProcessingConfiguration.colorGradingEnabled = value;\r\n }\r\n\r\n /**\r\n * Gets whether tonemapping is enabled or not.\r\n */\r\n public get cameraToneMappingEnabled(): boolean {\r\n return this._imageProcessingConfiguration.toneMappingEnabled;\r\n }\r\n /**\r\n * Sets whether tonemapping is enabled or not\r\n */\r\n public set cameraToneMappingEnabled(value: boolean) {\r\n this._imageProcessingConfiguration.toneMappingEnabled = value;\r\n }\r\n\r\n /**\r\n * The camera exposure used on this material.\r\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\r\n * This corresponds to a photographic exposure.\r\n */\r\n public get cameraExposure(): number {\r\n return this._imageProcessingConfiguration.exposure;\r\n }\r\n /**\r\n * The camera exposure used on this material.\r\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\r\n * This corresponds to a photographic exposure.\r\n */\r\n public set cameraExposure(value: number) {\r\n this._imageProcessingConfiguration.exposure = value;\r\n }\r\n\r\n /**\r\n * Gets The camera contrast used on this material.\r\n */\r\n public get cameraContrast(): number {\r\n return this._imageProcessingConfiguration.contrast;\r\n }\r\n\r\n /**\r\n * Sets The camera contrast used on this material.\r\n */\r\n public set cameraContrast(value: number) {\r\n this._imageProcessingConfiguration.contrast = value;\r\n }\r\n\r\n /**\r\n * Gets the Color Grading 2D Lookup Texture.\r\n */\r\n public get cameraColorGradingTexture(): Nullable<BaseTexture> {\r\n return this._imageProcessingConfiguration.colorGradingTexture;\r\n }\r\n /**\r\n * Sets the Color Grading 2D Lookup Texture.\r\n */\r\n public set cameraColorGradingTexture(value: Nullable<BaseTexture>) {\r\n this._imageProcessingConfiguration.colorGradingTexture = value;\r\n }\r\n\r\n /**\r\n * The color grading curves provide additional color adjustment that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\n public get cameraColorCurves(): Nullable<ColorCurves> {\r\n return this._imageProcessingConfiguration.colorCurves;\r\n }\r\n /**\r\n * The color grading curves provide additional color adjustment that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\n public set cameraColorCurves(value: Nullable<ColorCurves>) {\r\n this._imageProcessingConfiguration.colorCurves = value;\r\n }\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 */\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\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 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 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 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 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\nRegisterClass(\"BABYLON.PBRMaterial\", PBRMaterial);\r\n"]}
1
+ {"version":3,"file":"pbrMaterial.js","sourceRoot":"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;yDAClB;AAO5B;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,8BAA8B,CAAC;0CAC5B;AAOd;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,8BAA8B,CAAC;gEACN;AAsN/C,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import { 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\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\nimport type { ImageProcessingConfiguration } from \"../../Materials/imageProcessingConfiguration\";\r\nimport type { ColorCurves } from \"../../Materials/colorCurves\";\r\nimport type { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport { PBRBaseMaterial } from \"./pbrBaseMaterial\";\r\nimport { RegisterClass } from \"../../Misc/typeStore\";\r\nimport { Material } from \"../material\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\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 * 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 * 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 * Gets the image processing configuration used either in this material.\r\n */\r\n public get imageProcessingConfiguration(): ImageProcessingConfiguration {\r\n return this._imageProcessingConfiguration;\r\n }\r\n\r\n /**\r\n * Sets the Default image processing configuration used either in the this material.\r\n *\r\n * If sets to null, the scene one is in use.\r\n */\r\n public set imageProcessingConfiguration(value: ImageProcessingConfiguration) {\r\n this._attachImageProcessingConfiguration(value);\r\n\r\n // Ensure the effect will be rebuilt.\r\n this._markAllSubMeshesAsTexturesDirty();\r\n }\r\n\r\n /**\r\n * Gets whether the color curves effect is enabled.\r\n */\r\n public get cameraColorCurvesEnabled(): boolean {\r\n return this.imageProcessingConfiguration.colorCurvesEnabled;\r\n }\r\n /**\r\n * Sets whether the color curves effect is enabled.\r\n */\r\n public set cameraColorCurvesEnabled(value: boolean) {\r\n this.imageProcessingConfiguration.colorCurvesEnabled = value;\r\n }\r\n\r\n /**\r\n * Gets whether the color grading effect is enabled.\r\n */\r\n public get cameraColorGradingEnabled(): boolean {\r\n return this.imageProcessingConfiguration.colorGradingEnabled;\r\n }\r\n /**\r\n * Gets whether the color grading effect is enabled.\r\n */\r\n public set cameraColorGradingEnabled(value: boolean) {\r\n this.imageProcessingConfiguration.colorGradingEnabled = value;\r\n }\r\n\r\n /**\r\n * Gets whether tonemapping is enabled or not.\r\n */\r\n public get cameraToneMappingEnabled(): boolean {\r\n return this._imageProcessingConfiguration.toneMappingEnabled;\r\n }\r\n /**\r\n * Sets whether tonemapping is enabled or not\r\n */\r\n public set cameraToneMappingEnabled(value: boolean) {\r\n this._imageProcessingConfiguration.toneMappingEnabled = value;\r\n }\r\n\r\n /**\r\n * The camera exposure used on this material.\r\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\r\n * This corresponds to a photographic exposure.\r\n */\r\n public get cameraExposure(): number {\r\n return this._imageProcessingConfiguration.exposure;\r\n }\r\n /**\r\n * The camera exposure used on this material.\r\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\r\n * This corresponds to a photographic exposure.\r\n */\r\n public set cameraExposure(value: number) {\r\n this._imageProcessingConfiguration.exposure = value;\r\n }\r\n\r\n /**\r\n * Gets The camera contrast used on this material.\r\n */\r\n public get cameraContrast(): number {\r\n return this._imageProcessingConfiguration.contrast;\r\n }\r\n\r\n /**\r\n * Sets The camera contrast used on this material.\r\n */\r\n public set cameraContrast(value: number) {\r\n this._imageProcessingConfiguration.contrast = value;\r\n }\r\n\r\n /**\r\n * Gets the Color Grading 2D Lookup Texture.\r\n */\r\n public get cameraColorGradingTexture(): Nullable<BaseTexture> {\r\n return this._imageProcessingConfiguration.colorGradingTexture;\r\n }\r\n /**\r\n * Sets the Color Grading 2D Lookup Texture.\r\n */\r\n public set cameraColorGradingTexture(value: Nullable<BaseTexture>) {\r\n this._imageProcessingConfiguration.colorGradingTexture = value;\r\n }\r\n\r\n /**\r\n * The color grading curves provide additional color adjustment that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\n public get cameraColorCurves(): Nullable<ColorCurves> {\r\n return this._imageProcessingConfiguration.colorCurves;\r\n }\r\n /**\r\n * The color grading curves provide additional color adjustment that is applied after any color grading transform (3D LUT).\r\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\r\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\r\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\r\n */\r\n public set cameraColorCurves(value: Nullable<ColorCurves>) {\r\n this._imageProcessingConfiguration.colorCurves = value;\r\n }\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 */\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\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\nRegisterClass(\"BABYLON.PBRMaterial\", PBRMaterial);\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"pbrMetallicRoughnessMaterial.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/PBR/pbrMetallicRoughnessMaterial.ts"],"names":[],"mappings":";AAAA,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,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD;;;;;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;IACI,YAAY;QACf,OAAO,8BAA8B,CAAC;IAC1C,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,IAAY;QACrB,MAAM,KAAK,GAAG,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAA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B,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;AA6F3D,aAAa,CAAC,sCAAsC,EAAE,4BAA4B,CAAC,CAAC","sourcesContent":["import { serialize, serializeAsColor3, expandToProperty, serializeAsTexture } from \"../../Misc/decorators\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { Color3 } from \"../../Maths/math.color\";\r\nimport type { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport { PBRBaseSimpleMaterial } from \"./pbrBaseSimpleMaterial\";\r\nimport { RegisterClass } from \"../../Misc/typeStore\";\r\nimport type { Nullable } from \"../../types\";\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 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 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 serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.PBRMetallicRoughnessMaterial\";\r\n\r\n serializationObject.clearCoat = this.clearCoat.serialize();\r\n serializationObject.anisotropy = this.anisotropy.serialize();\r\n serializationObject.brdf = this.brdf.serialize();\r\n serializationObject.sheen = this.sheen.serialize();\r\n serializationObject.subSurface = this.subSurface.serialize();\r\n serializationObject.iridescence = this.iridescence.serialize();\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 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\nRegisterClass(\"BABYLON.PBRMetallicRoughnessMaterial\", PBRMetallicRoughnessMaterial);\r\n"]}
1
+ {"version":3,"file":"pbrMetallicRoughnessMaterial.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/PBR/pbrMetallicRoughnessMaterial.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,E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,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;SAChE;QACD,IAAI,MAAM,CAAC,IAAI,EAAE;YACb,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;SACpD;QACD,IAAI,MAAM,CAAC,KAAK,EAAE;YACd,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;SACtD;QACD,IAAI,MAAM,CAAC,UAAU,EAAE;YACnB,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;SAChE;QACD,IAAI,MAAM,CAAC,WAAW,EAAE;YACpB,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;SAClE;QACD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AA3HU;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;AA6F3D,aAAa,CAAC,sCAAsC,EAAE,4BAA4B,CAAC,CAAC","sourcesContent":["import { serialize, serializeAsColor3, expandToProperty, serializeAsTexture } from \"../../Misc/decorators\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { Color3 } from \"../../Maths/math.color\";\r\nimport type { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport { PBRBaseSimpleMaterial } from \"./pbrBaseSimpleMaterial\";\r\nimport { RegisterClass } from \"../../Misc/typeStore\";\r\nimport type { Nullable } from \"../../types\";\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 serializationObject.clearCoat = this.clearCoat.serialize();\r\n serializationObject.anisotropy = this.anisotropy.serialize();\r\n serializationObject.brdf = this.brdf.serialize();\r\n serializationObject.sheen = this.sheen.serialize();\r\n serializationObject.subSurface = this.subSurface.serialize();\r\n serializationObject.iridescence = this.iridescence.serialize();\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\nRegisterClass(\"BABYLON.PBRMetallicRoughnessMaterial\", PBRMetallicRoughnessMaterial);\r\n"]}