@babylonjs/core 7.37.0 → 7.37.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 (222) hide show
  1. package/Buffers/buffer.d.ts +3 -1
  2. package/Buffers/buffer.js +20 -122
  3. package/Buffers/buffer.js.map +1 -1
  4. package/Buffers/bufferUtils.d.ts +32 -1
  5. package/Buffers/bufferUtils.js +221 -10
  6. package/Buffers/bufferUtils.js.map +1 -1
  7. package/Cameras/arcRotateCamera.d.ts +3 -1
  8. package/Cameras/arcRotateCamera.js +14 -3
  9. package/Cameras/arcRotateCamera.js.map +1 -1
  10. package/Engines/abstractEngine.js +2 -2
  11. package/Engines/abstractEngine.js.map +1 -1
  12. package/Engines/engine.js +0 -4
  13. package/Engines/engine.js.map +1 -1
  14. package/Engines/thinEngine.js +2 -2
  15. package/Engines/thinEngine.js.map +1 -1
  16. package/FrameGraph/Node/nodeRenderGraphBlock.js +1 -0
  17. package/FrameGraph/Node/nodeRenderGraphBlock.js.map +1 -1
  18. package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.d.ts +2 -0
  19. package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js +3 -1
  20. package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js.map +1 -1
  21. package/Inputs/scene.inputManager.js +2 -0
  22. package/Inputs/scene.inputManager.js.map +1 -1
  23. package/Lights/IES/iesLoader.d.ts +19 -0
  24. package/Lights/IES/iesLoader.js +150 -0
  25. package/Lights/IES/iesLoader.js.map +1 -0
  26. package/Lights/index.d.ts +1 -0
  27. package/Lights/index.js +1 -0
  28. package/Lights/index.js.map +1 -1
  29. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +12 -2
  30. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  31. package/Materials/GreasedLine/greasedLineMaterialInterfaces.d.ts +5 -0
  32. package/Materials/GreasedLine/greasedLineMaterialInterfaces.js.map +1 -1
  33. package/Materials/GreasedLine/greasedLinePluginMaterial.d.ts +21 -5
  34. package/Materials/GreasedLine/greasedLinePluginMaterial.js +52 -176
  35. package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
  36. package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.d.ts +11 -0
  37. package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.js +158 -0
  38. package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.js.map +1 -0
  39. package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.d.ts +11 -0
  40. package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.js +177 -0
  41. package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.js.map +1 -0
  42. package/Materials/GreasedLine/greasedLineSimpleMaterial.d.ts +4 -2
  43. package/Materials/GreasedLine/greasedLineSimpleMaterial.js +45 -25
  44. package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
  45. package/Materials/Node/Blocks/PBR/reflectionBlock.js +6 -0
  46. package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
  47. package/Materials/Node/Blocks/index.d.ts +1 -0
  48. package/Materials/Node/Blocks/index.js +1 -0
  49. package/Materials/Node/Blocks/index.js.map +1 -1
  50. package/Materials/Node/Blocks/matrixSplitterBlock.d.ts +56 -0
  51. package/Materials/Node/Blocks/matrixSplitterBlock.js +130 -0
  52. package/Materials/Node/Blocks/matrixSplitterBlock.js.map +1 -0
  53. package/Materials/Node/nodeMaterialBlock.js +1 -0
  54. package/Materials/Node/nodeMaterialBlock.js.map +1 -1
  55. package/Materials/Node/nodeMaterialBlockConnectionPoint.d.ts +2 -0
  56. package/Materials/Node/nodeMaterialBlockConnectionPoint.js +4 -1
  57. package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
  58. package/Materials/PBR/pbrBaseMaterial.d.ts +1 -0
  59. package/Materials/PBR/pbrBaseMaterial.js +12 -0
  60. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  61. package/Materials/Textures/Loaders/iesTextureLoader.d.ts +23 -0
  62. package/Materials/Textures/Loaders/iesTextureLoader.js +40 -0
  63. package/Materials/Textures/Loaders/iesTextureLoader.js.map +1 -0
  64. package/Materials/Textures/Loaders/index.d.ts +1 -0
  65. package/Materials/Textures/Loaders/index.js +1 -0
  66. package/Materials/Textures/Loaders/index.js.map +1 -1
  67. package/Materials/Textures/Loaders/textureLoaderManager.js +3 -0
  68. package/Materials/Textures/Loaders/textureLoaderManager.js.map +1 -1
  69. package/Materials/effectRenderer.js +1 -1
  70. package/Materials/effectRenderer.js.map +1 -1
  71. package/Materials/index.d.ts +4 -0
  72. package/Materials/index.js +5 -0
  73. package/Materials/index.js.map +1 -1
  74. package/Maths/math.scalar.d.ts +0 -1
  75. package/Maths/math.scalar.js +1 -2
  76. package/Maths/math.scalar.js.map +1 -1
  77. package/Meshes/Builders/greasedLineBuilder.js +2 -2
  78. package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
  79. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +15 -2
  80. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +68 -20
  81. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  82. package/Meshes/Node/Blocks/geometryInputBlock.d.ts +4 -0
  83. package/Meshes/Node/Blocks/geometryInputBlock.js +8 -0
  84. package/Meshes/Node/Blocks/geometryInputBlock.js.map +1 -1
  85. package/Meshes/Node/nodeGeometryBlock.js +1 -0
  86. package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
  87. package/Meshes/Node/nodeGeometryBlockConnectionPoint.d.ts +2 -0
  88. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +3 -1
  89. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
  90. package/Meshes/abstractMesh.hotSpot.d.ts +8 -1
  91. package/Meshes/abstractMesh.hotSpot.js +17 -0
  92. package/Meshes/abstractMesh.hotSpot.js.map +1 -1
  93. package/Meshes/linesMesh.js +1 -1
  94. package/Meshes/linesMesh.js.map +1 -1
  95. package/Misc/deepMerger.d.ts +6 -0
  96. package/Misc/deepMerger.js +26 -0
  97. package/Misc/deepMerger.js.map +1 -0
  98. package/Misc/index.d.ts +1 -0
  99. package/Misc/index.js +1 -0
  100. package/Misc/index.js.map +1 -1
  101. package/Misc/virtualJoystick.js +2 -0
  102. package/Misc/virtualJoystick.js.map +1 -1
  103. package/Rendering/IBLShadows/iblShadowsRenderPipeline.d.ts +3 -23
  104. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +30 -67
  105. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
  106. package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.d.ts +1 -1
  107. package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js +8 -4
  108. package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js.map +1 -1
  109. package/Rendering/boundingBoxRenderer.d.ts +63 -1
  110. package/Rendering/boundingBoxRenderer.js +224 -3
  111. package/Rendering/boundingBoxRenderer.js.map +1 -1
  112. package/Rendering/edgesRenderer.js +4 -1
  113. package/Rendering/edgesRenderer.js.map +1 -1
  114. package/Rendering/{IBLShadows/iblShadowsImportanceSamplingRenderer.d.ts → iblCdfGenerator.d.ts} +15 -12
  115. package/Rendering/{IBLShadows/iblShadowsImportanceSamplingRenderer.js → iblCdfGenerator.js} +37 -27
  116. package/Rendering/iblCdfGenerator.js.map +1 -0
  117. package/Rendering/iblCdfGeneratorSceneComponent.d.ts +59 -0
  118. package/Rendering/iblCdfGeneratorSceneComponent.js +83 -0
  119. package/Rendering/iblCdfGeneratorSceneComponent.js.map +1 -0
  120. package/Rendering/index.d.ts +12 -10
  121. package/Rendering/index.js +12 -10
  122. package/Rendering/index.js.map +1 -1
  123. package/Shaders/ShadersInclude/gaussianSplatting.js +72 -2
  124. package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
  125. package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js +1 -1
  126. package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -1
  127. package/Shaders/ShadersInclude/hdrFilteringFunctions.js +29 -4
  128. package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  129. package/Shaders/ShadersInclude/pbrBlockReflection.js +9 -1
  130. package/Shaders/ShadersInclude/pbrBlockReflection.js.map +1 -1
  131. package/Shaders/ShadersInclude/pbrBlockSubSurface.js +9 -1
  132. package/Shaders/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
  133. package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js +3 -0
  134. package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
  135. package/Shaders/boundingBoxRenderer.vertex.js +7 -0
  136. package/Shaders/boundingBoxRenderer.vertex.js.map +1 -1
  137. package/Shaders/gaussianSplatting.vertex.js +16 -2
  138. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  139. package/Shaders/{iblShadowsCdfy.fragment.d.ts → iblCdfx.fragment.d.ts} +1 -1
  140. package/Shaders/{iblShadowsCdfx.fragment.js → iblCdfx.fragment.js} +3 -3
  141. package/Shaders/iblCdfx.fragment.js.map +1 -0
  142. package/Shaders/{iblShadowsCdfx.fragment.d.ts → iblCdfy.fragment.d.ts} +1 -1
  143. package/Shaders/{iblShadowsCdfy.fragment.js → iblCdfy.fragment.js} +3 -3
  144. package/Shaders/iblCdfy.fragment.js.map +1 -0
  145. package/Shaders/{iblShadowsIcdfx.fragment.d.ts → iblIcdfx.fragment.d.ts} +1 -1
  146. package/Shaders/{iblShadowsIcdfx.fragment.js → iblIcdfx.fragment.js} +3 -3
  147. package/Shaders/iblIcdfx.fragment.js.map +1 -0
  148. package/Shaders/{iblShadowsIcdfy.fragment.d.ts → iblIcdfy.fragment.d.ts} +1 -1
  149. package/Shaders/{iblShadowsIcdfy.fragment.js → iblIcdfy.fragment.js} +3 -3
  150. package/Shaders/iblIcdfy.fragment.js.map +1 -0
  151. package/Shaders/importanceSamplingDebug.fragment.d.ts +5 -0
  152. package/Shaders/{iblShadowsImportanceSamplingDebug.fragment.js → importanceSamplingDebug.fragment.js} +3 -3
  153. package/Shaders/importanceSamplingDebug.fragment.js.map +1 -0
  154. package/Shaders/pbr.fragment.js +8 -0
  155. package/Shaders/pbr.fragment.js.map +1 -1
  156. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +77 -1
  157. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
  158. package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js +28 -4
  159. package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  160. package/ShadersWGSL/ShadersInclude/lightFragment.js +1 -1
  161. package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
  162. package/ShadersWGSL/ShadersInclude/oitFragment.js +1 -1
  163. package/ShadersWGSL/ShadersInclude/oitFragment.js.map +1 -1
  164. package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js +14 -1
  165. package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js.map +1 -1
  166. package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.js +14 -1
  167. package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
  168. package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.js +3 -0
  169. package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
  170. package/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions.js +1 -1
  171. package/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions.js.map +1 -1
  172. package/ShadersWGSL/boundingBoxRenderer.vertex.js +9 -1
  173. package/ShadersWGSL/boundingBoxRenderer.vertex.js.map +1 -1
  174. package/ShadersWGSL/gaussianSplatting.vertex.js +18 -2
  175. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  176. package/ShadersWGSL/greasedLine.fragment.d.ts +5 -0
  177. package/ShadersWGSL/greasedLine.fragment.js +25 -0
  178. package/ShadersWGSL/greasedLine.fragment.js.map +1 -0
  179. package/ShadersWGSL/greasedLine.vertex.d.ts +9 -0
  180. package/ShadersWGSL/greasedLine.vertex.js +43 -0
  181. package/ShadersWGSL/greasedLine.vertex.js.map +1 -0
  182. package/ShadersWGSL/iblCdfx.fragment.d.ts +5 -0
  183. package/ShadersWGSL/{iblShadowsCdfx.fragment.js → iblCdfx.fragment.js} +3 -3
  184. package/ShadersWGSL/iblCdfx.fragment.js.map +1 -0
  185. package/ShadersWGSL/iblCdfy.fragment.d.ts +5 -0
  186. package/ShadersWGSL/{iblShadowsCdfy.fragment.js → iblCdfy.fragment.js} +3 -3
  187. package/ShadersWGSL/iblCdfy.fragment.js.map +1 -0
  188. package/ShadersWGSL/iblIcdfx.fragment.d.ts +5 -0
  189. package/ShadersWGSL/{iblShadowsIcdfx.fragment.js → iblIcdfx.fragment.js} +3 -3
  190. package/ShadersWGSL/iblIcdfx.fragment.js.map +1 -0
  191. package/ShadersWGSL/iblIcdfy.fragment.d.ts +5 -0
  192. package/ShadersWGSL/{iblShadowsIcdfy.fragment.js → iblIcdfy.fragment.js} +3 -3
  193. package/ShadersWGSL/iblIcdfy.fragment.js.map +1 -0
  194. package/ShadersWGSL/importanceSamplingDebug.fragment.d.ts +5 -0
  195. package/ShadersWGSL/{iblShadowsImportanceSamplingDebug.fragment.js → importanceSamplingDebug.fragment.js} +3 -3
  196. package/ShadersWGSL/importanceSamplingDebug.fragment.js.map +1 -0
  197. package/ShadersWGSL/pbr.fragment.js +12 -0
  198. package/ShadersWGSL/pbr.fragment.js.map +1 -1
  199. package/package.json +1 -1
  200. package/scene.d.ts +4 -0
  201. package/scene.js +6 -0
  202. package/scene.js.map +1 -1
  203. package/sceneComponent.d.ts +1 -1
  204. package/sceneComponent.js +1 -1
  205. package/sceneComponent.js.map +1 -1
  206. package/Rendering/IBLShadows/iblShadowsImportanceSamplingRenderer.js.map +0 -1
  207. package/Shaders/iblShadowsCdfx.fragment.js.map +0 -1
  208. package/Shaders/iblShadowsCdfy.fragment.js.map +0 -1
  209. package/Shaders/iblShadowsIcdfx.fragment.js.map +0 -1
  210. package/Shaders/iblShadowsIcdfy.fragment.js.map +0 -1
  211. package/Shaders/iblShadowsImportanceSamplingDebug.fragment.d.ts +0 -5
  212. package/Shaders/iblShadowsImportanceSamplingDebug.fragment.js.map +0 -1
  213. package/ShadersWGSL/iblShadowsCdfx.fragment.d.ts +0 -5
  214. package/ShadersWGSL/iblShadowsCdfx.fragment.js.map +0 -1
  215. package/ShadersWGSL/iblShadowsCdfy.fragment.d.ts +0 -5
  216. package/ShadersWGSL/iblShadowsCdfy.fragment.js.map +0 -1
  217. package/ShadersWGSL/iblShadowsIcdfx.fragment.d.ts +0 -5
  218. package/ShadersWGSL/iblShadowsIcdfx.fragment.js.map +0 -1
  219. package/ShadersWGSL/iblShadowsIcdfy.fragment.d.ts +0 -5
  220. package/ShadersWGSL/iblShadowsIcdfy.fragment.js.map +0 -1
  221. package/ShadersWGSL/iblShadowsImportanceSamplingDebug.fragment.d.ts +0 -5
  222. package/ShadersWGSL/iblShadowsImportanceSamplingDebug.fragment.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iesLoader.js","sourceRoot":"","sources":["../../../../../dev/core/src/Lights/IES/iesLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,6CAAyC;AA4BxD,SAAS,WAAW,CAAC,IAAY;IAC7B,OAAO,IAAI;SACN,KAAK,CAAC,GAAG,CAAC;SACV,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;SACvB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,SAAS,CAAC,WAAyB,EAAE,KAAa,EAAE,WAAqB;IAC9E,OAAO,WAAW,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;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GAAG,MAAM,CAAC;IAC5B,MAAM,WAAW,GAAG,IAAI,YAAY,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC;IAErD,mBAAmB;IACnB,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,wBAAwB,GAAG,CAAC,CAAC,CAAC;IAC1E,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACxC,IAAI,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;QAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;QAEtC,WAAW;QACX,IAAI,QAAQ,GAAG,UAAU,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,UAAU,IAAI,KAAK,IAAI,QAAQ,CAAC,EAAE,CAAC;YAC3E,KAAK,IAAI,QAAQ,GAAG,CAAC,CAAC;YACtB,IAAI,KAAK,GAAG,QAAQ,EAAE,CAAC;gBACnB,KAAK,GAAG,QAAQ,GAAG,CAAC,GAAG,KAAK,CAAC;YACjC,CAAC;QACL,CAAC;QAED,WAAW,CAAC,GAAG,GAAG,KAAK,GAAG,MAAM,CAAC,GAAG,wBAAwB,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACnF,CAAC;IAED,sJAAsJ;IACtJ,OAAO;QACH,KAAK,EAAE,KAAK,GAAG,CAAC;QAChB,MAAM,EAAE,CAAC;QACT,IAAI,EAAE,WAAW;KACpB,CAAC;AACN,CAAC","sourcesContent":["import { Lerp } from \"core/Maths/math.scalar.functions\";\r\n\r\ninterface IIESData {\r\n version: string;\r\n tilt?: {};\r\n numberOfLights?: number;\r\n lumensPerLamp?: number;\r\n candelaMultiplier?: number;\r\n numberOfVerticalAngles: number;\r\n numberOfHorizontalAngles: number;\r\n horizontalAngles: number[];\r\n verticalAngles: number[];\r\n photometricType?: number;\r\n unitsType?: number;\r\n width?: number;\r\n length?: number;\r\n height?: number;\r\n ballastFactor?: number;\r\n fileGenerationType?: number;\r\n inputWatts?: number;\r\n candelaValues: number[][];\r\n}\r\n\r\ninterface IDataPointer {\r\n lines: string[];\r\n index: number;\r\n}\r\n\r\nfunction lineToArray(line: string): number[] {\r\n return line\r\n .split(\" \")\r\n .filter((x) => x !== \"\")\r\n .map((x) => parseFloat(x));\r\n}\r\n\r\nfunction readArray(dataPointer: IDataPointer, count: number, targetArray: number[]) {\r\n while (targetArray.length !== count) {\r\n const line = lineToArray(dataPointer.lines[dataPointer.index++]);\r\n targetArray.push(...line);\r\n }\r\n}\r\n\r\nfunction interpolateCandelaValues(data: IIESData, phi: number, theta: number): number {\r\n let phiIndex = 0;\r\n let thetaIndex = 0;\r\n let startTheta = 0;\r\n let endTheta = 0;\r\n let startPhi = 0;\r\n let endPhi = 0;\r\n\r\n // Check if the angle is outside the range\r\n for (let index = 0; index < data.numberOfHorizontalAngles - 1; index++) {\r\n if (theta < data.horizontalAngles[index + 1] || index === data.numberOfHorizontalAngles - 2) {\r\n thetaIndex = index;\r\n startTheta = data.horizontalAngles[index];\r\n endTheta = data.horizontalAngles[index + 1];\r\n\r\n break;\r\n }\r\n }\r\n\r\n for (let index = 0; index < data.numberOfVerticalAngles - 1; index++) {\r\n if (phi < data.verticalAngles[index + 1] || index === data.numberOfVerticalAngles - 2) {\r\n phiIndex = index;\r\n startPhi = data.verticalAngles[index];\r\n endPhi = data.verticalAngles[index + 1];\r\n\r\n break;\r\n }\r\n }\r\n\r\n const deltaTheta = endTheta - startTheta;\r\n const deltaPhi = endPhi - startPhi;\r\n\r\n if (deltaPhi === 0) {\r\n return 0;\r\n }\r\n\r\n // Interpolate\r\n const t1 = deltaTheta === 0 ? 0 : (theta - startTheta) / deltaTheta;\r\n const t2 = (phi - startPhi) / deltaPhi;\r\n\r\n const nextThetaIndex = deltaTheta === 0 ? thetaIndex : thetaIndex + 1;\r\n\r\n const v1 = Lerp(data.candelaValues[thetaIndex][phiIndex], data.candelaValues[nextThetaIndex][phiIndex], t1);\r\n const v2 = Lerp(data.candelaValues[thetaIndex][phiIndex + 1], data.candelaValues[nextThetaIndex][phiIndex + 1], t1);\r\n const v = Lerp(v1, v2, t2);\r\n\r\n return v;\r\n}\r\n/**\r\n * Interface for IES texture data.\r\n */\r\nexport interface IIESTextureData {\r\n /** The width of the texture */\r\n width: number;\r\n /** The height of the texture */\r\n height: number;\r\n /** The data of the texture */\r\n data: Float32Array;\r\n}\r\n\r\n/**\r\n * Generates IES data buffer from a string representing the IES data.\r\n * @param uint8Array defines the IES data\r\n * @returns the IES data buffer\r\n * @see https://ieslibrary.com/browse\r\n * #UQGPDT#1\r\n */\r\nexport function LoadIESData(uint8Array: Uint8Array): IIESTextureData {\r\n const decoder = new TextDecoder(\"utf-8\");\r\n const source = decoder.decode(uint8Array);\r\n\r\n // Read data\r\n const dataPointer: IDataPointer = {\r\n lines: source.split(\"\\n\"),\r\n index: 0,\r\n };\r\n const data: IIESData = { version: dataPointer.lines[0], candelaValues: [], horizontalAngles: [], verticalAngles: [], numberOfHorizontalAngles: 0, numberOfVerticalAngles: 0 };\r\n\r\n // Skip metadata\r\n dataPointer.index = 1;\r\n while (dataPointer.lines.length > 0 && !dataPointer.lines[dataPointer.index].includes(\"TILT=\")) {\r\n dataPointer.index++;\r\n }\r\n\r\n // Process tilt data?\r\n if (dataPointer.lines[dataPointer.index].includes(\"INCLUDE\")) {\r\n // Not supported yet as I did not manage to find an example :)\r\n }\r\n dataPointer.index++;\r\n\r\n // Header\r\n const header = lineToArray(dataPointer.lines[dataPointer.index++]);\r\n data.numberOfLights = header[0];\r\n data.lumensPerLamp = header[1];\r\n data.candelaMultiplier = header[2];\r\n data.numberOfVerticalAngles = header[3];\r\n data.numberOfHorizontalAngles = header[4];\r\n data.photometricType = header[5]; // We ignore cylindrical type for now. Will add support later if needed\r\n data.unitsType = header[6];\r\n data.width = header[7];\r\n data.length = header[8];\r\n data.height = header[9];\r\n\r\n // Additional data\r\n const additionalData = lineToArray(dataPointer.lines[dataPointer.index++]);\r\n data.ballastFactor = additionalData[0];\r\n data.fileGenerationType = additionalData[1];\r\n data.inputWatts = additionalData[2];\r\n\r\n // Prepare arrays\r\n for (let index = 0; index < data.numberOfHorizontalAngles; index++) {\r\n data.candelaValues[index] = [];\r\n }\r\n\r\n // Vertical angles\r\n readArray(dataPointer, data.numberOfVerticalAngles, data.verticalAngles);\r\n\r\n // Horizontal angles\r\n readArray(dataPointer, data.numberOfHorizontalAngles, data.horizontalAngles);\r\n\r\n // Candela values\r\n for (let index = 0; index < data.numberOfHorizontalAngles; index++) {\r\n readArray(dataPointer, data.numberOfVerticalAngles, data.candelaValues[index]);\r\n }\r\n\r\n // Evaluate candela values\r\n let maxCandela = -1;\r\n for (let index = 0; index < data.numberOfHorizontalAngles; index++) {\r\n for (let subIndex = 0; subIndex < data.numberOfVerticalAngles; subIndex++) {\r\n data.candelaValues[index][subIndex] *= data.candelaValues[index][subIndex] * data.candelaMultiplier * data.ballastFactor * data.fileGenerationType;\r\n maxCandela = Math.max(maxCandela, data.candelaValues[index][subIndex]);\r\n }\r\n }\r\n\r\n // Normalize candela values\r\n if (maxCandela > 0) {\r\n for (let index = 0; index < data.numberOfHorizontalAngles; index++) {\r\n for (let subIndex = 0; subIndex < data.numberOfVerticalAngles; subIndex++) {\r\n data.candelaValues[index][subIndex] /= maxCandela;\r\n }\r\n }\r\n }\r\n\r\n // Create the cylindrical texture\r\n const height = 180;\r\n const width = height * 2;\r\n const size = width * height;\r\n const arrayBuffer = new Float32Array(width * height);\r\n\r\n // Fill the texture\r\n const startTheta = data.horizontalAngles[0];\r\n const endTheta = data.horizontalAngles[data.numberOfHorizontalAngles - 1];\r\n for (let index = 0; index < size; index++) {\r\n let theta = index % width;\r\n const phi = Math.floor(index / width);\r\n\r\n // Symmetry\r\n if (endTheta - startTheta !== 0 && (theta < startTheta || theta >= endTheta)) {\r\n theta %= endTheta * 2;\r\n if (theta > endTheta) {\r\n theta = endTheta * 2 - theta;\r\n }\r\n }\r\n\r\n arrayBuffer[phi + theta * height] = interpolateCandelaValues(data, phi, theta);\r\n }\r\n\r\n // So far we only need the first half of the first row of the texture as we only support IES for spot light. We can add support for other types later.\r\n return {\r\n width: width / 2,\r\n height: 1,\r\n data: arrayBuffer,\r\n };\r\n}\r\n"]}
package/Lights/index.d.ts CHANGED
@@ -5,3 +5,4 @@ export * from "./directionalLight";
5
5
  export * from "./hemisphericLight";
6
6
  export * from "./pointLight";
7
7
  export * from "./spotLight";
8
+ export * from "./IES/iesLoader";
package/Lights/index.js CHANGED
@@ -6,4 +6,5 @@ export * from "./directionalLight.js";
6
6
  export * from "./hemisphericLight.js";
7
7
  export * from "./pointLight.js";
8
8
  export * from "./spotLight.js";
9
+ export * from "./IES/iesLoader.js";
9
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/Lights/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nexport * from \"./light\";\r\nexport * from \"./shadowLight\";\r\nexport * from \"./Shadows/index\";\r\nexport * from \"./directionalLight\";\r\nexport * from \"./hemisphericLight\";\r\nexport * from \"./pointLight\";\r\nexport * from \"./spotLight\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/Lights/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nexport * from \"./light\";\r\nexport * from \"./shadowLight\";\r\nexport * from \"./Shadows/index\";\r\nexport * from \"./directionalLight\";\r\nexport * from \"./hemisphericLight\";\r\nexport * from \"./pointLight\";\r\nexport * from \"./spotLight\";\r\nexport * from \"./IES/iesLoader\";\r\n"]}
@@ -28,6 +28,7 @@ class GaussianSplattingMaterialDefines extends MaterialDefines {
28
28
  this.CLIPPLANE4 = false;
29
29
  this.CLIPPLANE5 = false;
30
30
  this.CLIPPLANE6 = false;
31
+ this.SH_DEGREE = 0;
31
32
  this.rebuild();
32
33
  }
33
34
  }
@@ -94,6 +95,10 @@ export class GaussianSplattingMaterial extends PushMaterial {
94
95
  PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances, null, true);
95
96
  // Attribs
96
97
  PrepareDefinesForAttributes(mesh, defines, false, false);
98
+ // SH is disabled for webGL1
99
+ if (engine.version > 1 || engine.isWebGPU) {
100
+ defines["SH_DEGREE"] = mesh.shDegree;
101
+ }
97
102
  // Get correct effect
98
103
  if (defines.isDirty) {
99
104
  defines.markAsProcessed();
@@ -101,8 +106,8 @@ export class GaussianSplattingMaterial extends PushMaterial {
101
106
  //Attributes
102
107
  const attribs = [VertexBuffer.PositionKind, "splatIndex"];
103
108
  PrepareAttributesForInstances(attribs, defines);
104
- const uniforms = ["world", "view", "projection", "vFogInfos", "vFogColor", "logarithmicDepthConstant", "invViewport", "dataTextureSize", "focal"];
105
- const samplers = ["covariancesATexture", "covariancesBTexture", "centersTexture", "colorsTexture"];
109
+ const uniforms = ["world", "view", "projection", "vFogInfos", "vFogColor", "logarithmicDepthConstant", "invViewport", "dataTextureSize", "focal", "vEyePosition"];
110
+ const samplers = ["covariancesATexture", "covariancesBTexture", "centersTexture", "colorsTexture", "shTexture0", "shTexture1", "shTexture2"];
106
111
  const uniformBuffers = ["Scene", "Mesh"];
107
112
  PrepareUniformsAndSamplersList({
108
113
  uniformsNames: uniforms,
@@ -181,6 +186,11 @@ export class GaussianSplattingMaterial extends PushMaterial {
181
186
  effect.setTexture("covariancesBTexture", gsMesh.covariancesBTexture);
182
187
  effect.setTexture("centersTexture", gsMesh.centersTexture);
183
188
  effect.setTexture("colorsTexture", gsMesh.colorsTexture);
189
+ if (gsMesh.shTextures) {
190
+ for (let i = 0; i < gsMesh.shTextures?.length; i++) {
191
+ effect.setTexture(`shTexture${i}`, gsMesh.shTextures[i]);
192
+ }
193
+ }
184
194
  }
185
195
  }
186
196
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"gaussianSplattingMaterial.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GaussianSplatting/gaussianSplattingMaterial.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAAE,MAAM,EAAE,gCAA4B;AAE7C,OAAO,0CAA0C,CAAC;AAClD,OAAO,wCAAwC,CAAC;AAChD,OAAO,8CAA8C,CAAC;AACtD,OAAO,4CAA4C,CAAC;AACpD,OAAO,EACH,iBAAiB,EACjB,YAAY,EACZ,6BAA6B,EAC7B,2BAA2B,EAC3B,iCAAiC,EACjC,qBAAqB,EACrB,8BAA8B,GACjC,MAAM,6BAA6B,CAAC;AAGrC;;GAEG;AACH,MAAM,gCAAiC,SAAQ,eAAe;IAW1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AAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACtH,CAAC;CACJ;AAED,aAAa,CAAC,mCAAmC,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import type { SubMesh } from \"../../Meshes/subMesh\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport type { Mesh } from \"../../Meshes/mesh\";\r\nimport type { Effect, IEffectCreationOptions } from \"../../Materials/effect\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { Matrix } from \"../../Maths/math.vector\";\r\nimport type { GaussianSplattingMesh } from \"core/Meshes\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\nimport { VertexBuffer } from \"../../Buffers/buffer\";\r\nimport { MaterialDefines } from \"../../Materials/materialDefines\";\r\nimport { PushMaterial } from \"../../Materials/pushMaterial\";\r\nimport { RegisterClass } from \"../../Misc/typeStore\";\r\nimport { addClipPlaneUniforms, bindClipPlane } from \"../clipPlaneMaterialHelper\";\r\nimport { Camera } from \"core/Cameras/camera\";\r\n\r\nimport \"../../Shaders/gaussianSplatting.fragment\";\r\nimport \"../../Shaders/gaussianSplatting.vertex\";\r\nimport \"../../ShadersWGSL/gaussianSplatting.fragment\";\r\nimport \"../../ShadersWGSL/gaussianSplatting.vertex\";\r\nimport {\r\n BindFogParameters,\r\n BindLogDepth,\r\n PrepareAttributesForInstances,\r\n PrepareDefinesForAttributes,\r\n PrepareDefinesForFrameBoundValues,\r\n PrepareDefinesForMisc,\r\n PrepareUniformsAndSamplersList,\r\n} from \"../materialHelper.functions\";\r\nimport { ShaderLanguage } from \"../shaderLanguage\";\r\n\r\n/**\r\n * @internal\r\n */\r\nclass GaussianSplattingMaterialDefines extends MaterialDefines {\r\n public FOG = false;\r\n public THIN_INSTANCES = true;\r\n public LOGARITHMICDEPTH = false;\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public CLIPPLANE5 = false;\r\n public CLIPPLANE6 = false;\r\n\r\n /**\r\n * Constructor of the defines.\r\n */\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\n/**\r\n * GaussianSplattingMaterial material used to render Gaussian Splatting\r\n * @experimental\r\n */\r\nexport class GaussianSplattingMaterial extends PushMaterial {\r\n /**\r\n * Instantiates a Gaussian Splatting Material in the given scene\r\n * @param name The friendly name of the material\r\n * @param scene The scene to add the material to\r\n */\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n\r\n this.backFaceCulling = false;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating that current material needs to register RTT\r\n */\r\n public override get hasRenderTargetTextures(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Specifies whether or not this material should be rendered in alpha test mode.\r\n * @returns false\r\n */\r\n public override needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Specifies whether or not this material should be rendered in alpha blend mode.\r\n * @returns true\r\n */\r\n public override needAlphaBlending(): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * Checks whether the material is ready to be rendered for a given mesh.\r\n * @param mesh The mesh to render\r\n * @param subMesh The submesh to check against\r\n * @returns true if all the dependencies are ready (Textures, Effects...)\r\n */\r\n public override isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh): boolean {\r\n const useInstances = true;\r\n\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (drawWrapper.effect && this.isFrozen) {\r\n if (drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new GaussianSplattingMaterialDefines();\r\n }\r\n\r\n const scene = this.getScene();\r\n const defines = <GaussianSplattingMaterialDefines>subMesh.materialDefines;\r\n\r\n if (this._isReadyForSubMesh(subMesh)) {\r\n return true;\r\n }\r\n\r\n const engine = scene.getEngine();\r\n\r\n // Misc.\r\n PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, false, defines);\r\n\r\n // Values that need to be evaluated on every frame\r\n PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances, null, true);\r\n\r\n // Attribs\r\n PrepareDefinesForAttributes(mesh, defines, false, false);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n scene.resetCachedMaterial();\r\n\r\n //Attributes\r\n const attribs = [VertexBuffer.PositionKind, \"splatIndex\"];\r\n\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n const uniforms = [\"world\", \"view\", \"projection\", \"vFogInfos\", \"vFogColor\", \"logarithmicDepthConstant\", \"invViewport\", \"dataTextureSize\", \"focal\"];\r\n const samplers = [\"covariancesATexture\", \"covariancesBTexture\", \"centersTexture\", \"colorsTexture\"];\r\n const uniformBuffers = [\"Scene\", \"Mesh\"];\r\n\r\n PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n });\r\n\r\n addClipPlaneUniforms(uniforms);\r\n\r\n const join = defines.toString();\r\n const effect = scene.getEngine().createEffect(\r\n \"gaussianSplatting\",\r\n <IEffectCreationOptions>{\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: {},\r\n shaderLanguage: this._shaderLanguage,\r\n extraInitializationsAsync: async () => {\r\n if (this._shaderLanguage === ShaderLanguage.WGSL) {\r\n await Promise.all([import(\"../../ShadersWGSL/gaussianSplatting.fragment\"), import(\"../../ShadersWGSL/gaussianSplatting.vertex\")]);\r\n } else {\r\n await Promise.all([import(\"../../Shaders/gaussianSplatting.fragment\"), import(\"../../Shaders/gaussianSplatting.vertex\")]);\r\n }\r\n },\r\n },\r\n engine\r\n );\r\n subMesh.setEffect(effect, defines, this._materialContext);\r\n }\r\n\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._renderId = scene.getRenderId();\r\n drawWrapper._wasPreviouslyReady = true;\r\n drawWrapper._wasPreviouslyUsingInstances = useInstances;\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Bind material effect for a specific Gaussian Splatting mesh\r\n * @param mesh Gaussian splatting mesh\r\n * @param effect Splatting material or node material\r\n * @param scene scene that contains mesh and camera used for rendering\r\n */\r\n public static BindEffect(mesh: Mesh, effect: Effect, scene: Scene): void {\r\n const engine = scene.getEngine();\r\n const camera = scene.activeCamera;\r\n\r\n const renderWidth = engine.getRenderWidth();\r\n const renderHeight = engine.getRenderHeight();\r\n\r\n // check if rigcamera, get number of rigs\r\n const numberOfRigs = camera?.rigParent?.rigCameras.length || 1;\r\n\r\n effect.setFloat2(\"invViewport\", 1 / (renderWidth / numberOfRigs), 1 / renderHeight);\r\n\r\n let focal = 1000;\r\n\r\n if (camera) {\r\n /*\r\n more explicit version:\r\n const t = camera.getProjectionMatrix().m[5];\r\n const FovY = Math.atan(1.0 / t) * 2.0;\r\n focal = renderHeight / 2.0 / Math.tan(FovY / 2.0);\r\n Using a shorter version here to not have tan(atan) and 2.0 factor\r\n */\r\n const t = camera.getProjectionMatrix().m[5];\r\n if (camera.fovMode == Camera.FOVMODE_VERTICAL_FIXED) {\r\n focal = (renderHeight * t) / 2.0;\r\n } else {\r\n focal = (renderWidth * t) / 2.0;\r\n }\r\n }\r\n\r\n effect.setFloat2(\"focal\", focal, focal);\r\n\r\n const gsMesh = mesh as GaussianSplattingMesh;\r\n\r\n if (gsMesh.covariancesATexture) {\r\n const textureSize = gsMesh.covariancesATexture.getSize();\r\n\r\n effect.setFloat2(\"dataTextureSize\", textureSize.width, textureSize.height);\r\n\r\n effect.setTexture(\"covariancesATexture\", gsMesh.covariancesATexture);\r\n effect.setTexture(\"covariancesBTexture\", gsMesh.covariancesBTexture);\r\n effect.setTexture(\"centersTexture\", gsMesh.centersTexture);\r\n effect.setTexture(\"colorsTexture\", gsMesh.colorsTexture);\r\n }\r\n }\r\n /**\r\n * Binds the submesh to this material by preparing the effect and shader to draw\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh containing the submesh\r\n * @param subMesh defines the submesh to bind the material to\r\n */\r\n public override bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <GaussianSplattingMaterialDefines>subMesh.materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n const effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices Mesh.\r\n mesh.getMeshUniformBuffer().bindToEffect(effect, \"Mesh\");\r\n mesh.transferToEffect(world);\r\n\r\n // Bind data\r\n const mustRebind = this._mustRebind(scene, effect, subMesh, mesh.visibility);\r\n\r\n if (mustRebind) {\r\n this.bindView(effect);\r\n this.bindViewProjection(effect);\r\n GaussianSplattingMaterial.BindEffect(mesh, this._activeEffect, scene);\r\n // Clip plane\r\n bindClipPlane(effect, this, scene);\r\n } else if (scene.getEngine()._features.needToAlwaysBindUniformBuffers) {\r\n this._needToBindSceneUbo = true;\r\n }\r\n\r\n // Fog\r\n BindFogParameters(scene, mesh, effect);\r\n\r\n // Log. depth\r\n if (this.useLogarithmicDepth) {\r\n BindLogDepth(defines, effect, scene);\r\n }\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n /**\r\n * Clones the material.\r\n * @param name The cloned name.\r\n * @returns The cloned material.\r\n */\r\n public override clone(name: string): GaussianSplattingMaterial {\r\n return SerializationHelper.Clone(() => new GaussianSplattingMaterial(name, this.getScene()), this);\r\n }\r\n\r\n /**\r\n * Serializes the current material to its JSON representation.\r\n * @returns The JSON representation.\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.GaussianSplattingMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Gets the class name of the material\r\n * @returns \"GaussianSplattingMaterial\"\r\n */\r\n public override getClassName(): string {\r\n return \"GaussianSplattingMaterial\";\r\n }\r\n\r\n /**\r\n * Parse a JSON input to create back a Gaussian Splatting material.\r\n * @param source The JSON data to parse\r\n * @param scene The scene to create the parsed material in\r\n * @param rootUrl The root url of the assets the material depends upon\r\n * @returns the instantiated GaussianSplattingMaterial.\r\n */\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): GaussianSplattingMaterial {\r\n return SerializationHelper.Parse(() => new GaussianSplattingMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GaussianSplattingMaterial\", GaussianSplattingMaterial);\r\n"]}
1
+ {"version":3,"file":"gaussianSplattingMaterial.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GaussianSplatting/gaussianSplattingMaterial.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAAE,MAAM,EAAE,gCAA4B;AAE7C,OAAO,0CAA0C,CAAC;AAClD,OAAO,wCAAwC,CAAC;AAChD,OAAO,8CAA8C,CAAC;AACtD,OAAO,4CAA4C,CAAC;AACpD,OAAO,EACH,iBAAiB,EACjB,YAAY,EACZ,6BAA6B,EAC7B,2BAA2B,EAC3B,iCAAiC,EACjC,qBAAqB,EACrB,8BAA8B,GACj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O,CAAC,CAAC;IACvD,CAAC;IAED;;;;OAIG;IACa,KAAK,CAAC,IAAY;QAC9B,OAAO,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,yBAAyB,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IACvG,CAAC;IAED;;;OAGG;IACa,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC9C,mBAAmB,CAAC,UAAU,GAAG,mCAAmC,CAAC;QACrE,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACa,YAAY;QACxB,OAAO,2BAA2B,CAAC;IACvC,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAU,KAAK,CAAC,MAAW,EAAE,KAAY,EAAE,OAAe;QACnE,OAAO,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,yBAAyB,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACtH,CAAC;CACJ;AAED,aAAa,CAAC,mCAAmC,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import type { SubMesh } from \"../../Meshes/subMesh\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport type { Mesh } from \"../../Meshes/mesh\";\r\nimport type { Effect, IEffectCreationOptions } from \"../../Materials/effect\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { Matrix } from \"../../Maths/math.vector\";\r\nimport type { GaussianSplattingMesh } from \"core/Meshes\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\nimport { VertexBuffer } from \"../../Buffers/buffer\";\r\nimport { MaterialDefines } from \"../../Materials/materialDefines\";\r\nimport { PushMaterial } from \"../../Materials/pushMaterial\";\r\nimport { RegisterClass } from \"../../Misc/typeStore\";\r\nimport { addClipPlaneUniforms, bindClipPlane } from \"../clipPlaneMaterialHelper\";\r\nimport { Camera } from \"core/Cameras/camera\";\r\n\r\nimport \"../../Shaders/gaussianSplatting.fragment\";\r\nimport \"../../Shaders/gaussianSplatting.vertex\";\r\nimport \"../../ShadersWGSL/gaussianSplatting.fragment\";\r\nimport \"../../ShadersWGSL/gaussianSplatting.vertex\";\r\nimport {\r\n BindFogParameters,\r\n BindLogDepth,\r\n PrepareAttributesForInstances,\r\n PrepareDefinesForAttributes,\r\n PrepareDefinesForFrameBoundValues,\r\n PrepareDefinesForMisc,\r\n PrepareUniformsAndSamplersList,\r\n} from \"../materialHelper.functions\";\r\nimport { ShaderLanguage } from \"../shaderLanguage\";\r\n\r\n/**\r\n * @internal\r\n */\r\nclass GaussianSplattingMaterialDefines extends MaterialDefines {\r\n public FOG = false;\r\n public THIN_INSTANCES = true;\r\n public LOGARITHMICDEPTH = false;\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public CLIPPLANE5 = false;\r\n public CLIPPLANE6 = false;\r\n public SH_DEGREE = 0;\r\n\r\n /**\r\n * Constructor of the defines.\r\n */\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\n/**\r\n * GaussianSplattingMaterial material used to render Gaussian Splatting\r\n * @experimental\r\n */\r\nexport class GaussianSplattingMaterial extends PushMaterial {\r\n /**\r\n * Instantiates a Gaussian Splatting Material in the given scene\r\n * @param name The friendly name of the material\r\n * @param scene The scene to add the material to\r\n */\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n\r\n this.backFaceCulling = false;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating that current material needs to register RTT\r\n */\r\n public override get hasRenderTargetTextures(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Specifies whether or not this material should be rendered in alpha test mode.\r\n * @returns false\r\n */\r\n public override needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Specifies whether or not this material should be rendered in alpha blend mode.\r\n * @returns true\r\n */\r\n public override needAlphaBlending(): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * Checks whether the material is ready to be rendered for a given mesh.\r\n * @param mesh The mesh to render\r\n * @param subMesh The submesh to check against\r\n * @returns true if all the dependencies are ready (Textures, Effects...)\r\n */\r\n public override isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh): boolean {\r\n const useInstances = true;\r\n\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (drawWrapper.effect && this.isFrozen) {\r\n if (drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new GaussianSplattingMaterialDefines();\r\n }\r\n\r\n const scene = this.getScene();\r\n const defines = <GaussianSplattingMaterialDefines>subMesh.materialDefines;\r\n\r\n if (this._isReadyForSubMesh(subMesh)) {\r\n return true;\r\n }\r\n\r\n const engine = scene.getEngine();\r\n\r\n // Misc.\r\n PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, false, defines);\r\n\r\n // Values that need to be evaluated on every frame\r\n PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances, null, true);\r\n\r\n // Attribs\r\n PrepareDefinesForAttributes(mesh, defines, false, false);\r\n\r\n // SH is disabled for webGL1\r\n if (engine.version > 1 || engine.isWebGPU) {\r\n defines[\"SH_DEGREE\"] = (<GaussianSplattingMesh>mesh).shDegree;\r\n }\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n scene.resetCachedMaterial();\r\n\r\n //Attributes\r\n const attribs = [VertexBuffer.PositionKind, \"splatIndex\"];\r\n\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n const uniforms = [\"world\", \"view\", \"projection\", \"vFogInfos\", \"vFogColor\", \"logarithmicDepthConstant\", \"invViewport\", \"dataTextureSize\", \"focal\", \"vEyePosition\"];\r\n const samplers = [\"covariancesATexture\", \"covariancesBTexture\", \"centersTexture\", \"colorsTexture\", \"shTexture0\", \"shTexture1\", \"shTexture2\"];\r\n const uniformBuffers = [\"Scene\", \"Mesh\"];\r\n\r\n PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n });\r\n\r\n addClipPlaneUniforms(uniforms);\r\n\r\n const join = defines.toString();\r\n const effect = scene.getEngine().createEffect(\r\n \"gaussianSplatting\",\r\n <IEffectCreationOptions>{\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: {},\r\n shaderLanguage: this._shaderLanguage,\r\n extraInitializationsAsync: async () => {\r\n if (this._shaderLanguage === ShaderLanguage.WGSL) {\r\n await Promise.all([import(\"../../ShadersWGSL/gaussianSplatting.fragment\"), import(\"../../ShadersWGSL/gaussianSplatting.vertex\")]);\r\n } else {\r\n await Promise.all([import(\"../../Shaders/gaussianSplatting.fragment\"), import(\"../../Shaders/gaussianSplatting.vertex\")]);\r\n }\r\n },\r\n },\r\n engine\r\n );\r\n subMesh.setEffect(effect, defines, this._materialContext);\r\n }\r\n\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._renderId = scene.getRenderId();\r\n drawWrapper._wasPreviouslyReady = true;\r\n drawWrapper._wasPreviouslyUsingInstances = useInstances;\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Bind material effect for a specific Gaussian Splatting mesh\r\n * @param mesh Gaussian splatting mesh\r\n * @param effect Splatting material or node material\r\n * @param scene scene that contains mesh and camera used for rendering\r\n */\r\n public static BindEffect(mesh: Mesh, effect: Effect, scene: Scene): void {\r\n const engine = scene.getEngine();\r\n const camera = scene.activeCamera;\r\n\r\n const renderWidth = engine.getRenderWidth();\r\n const renderHeight = engine.getRenderHeight();\r\n\r\n // check if rigcamera, get number of rigs\r\n const numberOfRigs = camera?.rigParent?.rigCameras.length || 1;\r\n\r\n effect.setFloat2(\"invViewport\", 1 / (renderWidth / numberOfRigs), 1 / renderHeight);\r\n\r\n let focal = 1000;\r\n\r\n if (camera) {\r\n /*\r\n more explicit version:\r\n const t = camera.getProjectionMatrix().m[5];\r\n const FovY = Math.atan(1.0 / t) * 2.0;\r\n focal = renderHeight / 2.0 / Math.tan(FovY / 2.0);\r\n Using a shorter version here to not have tan(atan) and 2.0 factor\r\n */\r\n const t = camera.getProjectionMatrix().m[5];\r\n if (camera.fovMode == Camera.FOVMODE_VERTICAL_FIXED) {\r\n focal = (renderHeight * t) / 2.0;\r\n } else {\r\n focal = (renderWidth * t) / 2.0;\r\n }\r\n }\r\n\r\n effect.setFloat2(\"focal\", focal, focal);\r\n\r\n const gsMesh = mesh as GaussianSplattingMesh;\r\n\r\n if (gsMesh.covariancesATexture) {\r\n const textureSize = gsMesh.covariancesATexture.getSize();\r\n\r\n effect.setFloat2(\"dataTextureSize\", textureSize.width, textureSize.height);\r\n\r\n effect.setTexture(\"covariancesATexture\", gsMesh.covariancesATexture);\r\n effect.setTexture(\"covariancesBTexture\", gsMesh.covariancesBTexture);\r\n effect.setTexture(\"centersTexture\", gsMesh.centersTexture);\r\n effect.setTexture(\"colorsTexture\", gsMesh.colorsTexture);\r\n\r\n if (gsMesh.shTextures) {\r\n for (let i = 0; i < gsMesh.shTextures?.length; i++) {\r\n effect.setTexture(`shTexture${i}`, gsMesh.shTextures[i]);\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * Binds the submesh to this material by preparing the effect and shader to draw\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh containing the submesh\r\n * @param subMesh defines the submesh to bind the material to\r\n */\r\n public override bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <GaussianSplattingMaterialDefines>subMesh.materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n const effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices Mesh.\r\n mesh.getMeshUniformBuffer().bindToEffect(effect, \"Mesh\");\r\n mesh.transferToEffect(world);\r\n\r\n // Bind data\r\n const mustRebind = this._mustRebind(scene, effect, subMesh, mesh.visibility);\r\n\r\n if (mustRebind) {\r\n this.bindView(effect);\r\n this.bindViewProjection(effect);\r\n GaussianSplattingMaterial.BindEffect(mesh, this._activeEffect, scene);\r\n // Clip plane\r\n bindClipPlane(effect, this, scene);\r\n } else if (scene.getEngine()._features.needToAlwaysBindUniformBuffers) {\r\n this._needToBindSceneUbo = true;\r\n }\r\n\r\n // Fog\r\n BindFogParameters(scene, mesh, effect);\r\n\r\n // Log. depth\r\n if (this.useLogarithmicDepth) {\r\n BindLogDepth(defines, effect, scene);\r\n }\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n /**\r\n * Clones the material.\r\n * @param name The cloned name.\r\n * @returns The cloned material.\r\n */\r\n public override clone(name: string): GaussianSplattingMaterial {\r\n return SerializationHelper.Clone(() => new GaussianSplattingMaterial(name, this.getScene()), this);\r\n }\r\n\r\n /**\r\n * Serializes the current material to its JSON representation.\r\n * @returns The JSON representation.\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.GaussianSplattingMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Gets the class name of the material\r\n * @returns \"GaussianSplattingMaterial\"\r\n */\r\n public override getClassName(): string {\r\n return \"GaussianSplattingMaterial\";\r\n }\r\n\r\n /**\r\n * Parse a JSON input to create back a Gaussian Splatting material.\r\n * @param source The JSON data to parse\r\n * @param scene The scene to create the parsed material in\r\n * @param rootUrl The root url of the assets the material depends upon\r\n * @returns the instantiated GaussianSplattingMaterial.\r\n */\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): GaussianSplattingMaterial {\r\n return SerializationHelper.Parse(() => new GaussianSplattingMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GaussianSplattingMaterial\", GaussianSplattingMaterial);\r\n"]}
@@ -151,6 +151,11 @@ export declare enum GreasedLineMeshColorDistributionType {
151
151
  * Options for GreasedLineMaterial
152
152
  */
153
153
  export interface GreasedLineMaterialOptions {
154
+ /**
155
+ * Force the greased lines to compile to glsl even on WebGPU engines.
156
+ * False by default. This is mostly meant for backward compatibility.
157
+ */
158
+ forceGLSL?: boolean;
154
159
  /**
155
160
  * Line width. If sizeAttenuation os false scene units will be used for width.
156
161
  * Defaults to 0.1 if @see sizeAttenuation is false, or to 1 if it's true.
@@ -1 +1 @@
1
- {"version":3,"file":"greasedLineMaterialInterfaces.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GreasedLine/greasedLineMaterialInterfaces.ts"],"names":[],"mappings":"AAiHA;;;GAGG;AACH,MAAM,CAAN,IAAkB,2BAejB;AAfD,WAAkB,2BAA2B;IACzC;;OAEG;IACH,iHAA0B,CAAA;IAC1B;;OAEG;IACH,uGAAqB,CAAA;IACrB;;;;OAIG;IACH,6GAAwB,CAAA;AAC5B,CAAC,EAfiB,2BAA2B,KAA3B,2BAA2B,QAe5C;AAED;;;GAGG;AACH,MAAM,CAAN,IAAkB,wBAajB;AAbD,WAAkB,wBAAwB;IACtC;;OAEG;IACH,2FAAkB,CAAA;IAClB;;OAEG;IACH,2FAAkB,CAAA;IAClB;;OAEG;IACH,qGAAuB,CAAA;AAC3B,CAAC,EAbiB,wBAAwB,KAAxB,wBAAwB,QAazC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAkB,oCASjB;AATD,WAAkB,oCAAoC;IAClD;;OAEG;IACH,qJAAmC,CAAA;IACnC;;OAEG;IACH,+IAAgC,CAAA;AACpC,CAAC,EATiB,oCAAoC,KAApC,oCAAoC,QASrD","sourcesContent":["import type { RawTexture } from \"../Textures/rawTexture\";\r\nimport type { Vector2 } from \"../../Maths/math.vector\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Color3 } from \"../../Maths/math.color\";\r\n/**\r\n * Interface which defines the available methods for a GreasedLineMaterial\r\n */\r\nexport interface IGreasedLineMaterial {\r\n /**\r\n * Normalized value of how much of the line will be visible\r\n * 0 - 0% of the line will be visible\r\n * 1 - 100% of the line will be visible\r\n */\r\n visibility: number;\r\n\r\n /**\r\n * Line base width. At each point the line width is calculated by widths[pointIndex] * width\r\n */\r\n width: number;\r\n\r\n /**\r\n * Turns on/off dash mode\r\n */\r\n useDash: boolean;\r\n\r\n /**\r\n * @see GreasedLinePluginMaterial.setDashCount\r\n * Number of dashes in the line.\r\n * Defaults to 1.\r\n */\r\n dashCount: number;\r\n\r\n /**\r\n * Dash offset\r\n */\r\n dashOffset: number;\r\n\r\n /**\r\n * Length of the dash. 0 to 1. 0.5 means half empty, half drawn.\r\n */\r\n dashRatio: number;\r\n\r\n /**\r\n * Whether to use the colors option to colorize the line\r\n */\r\n useColors: boolean;\r\n\r\n /**\r\n * The mixing mode of the color paramater. Default value is GreasedLineMeshColorMode.SET.\r\n * MATERIAL_TYPE_SIMPLE mixes the color and colors of the greased line material.\r\n * MATERIAL_TYPE_STANDARD and MATERIAL_TYPE_PBR mixes the color from the base material with the color and/or colors of the greased line material.\r\n * @see GreasedLineMeshColorMode\r\n */\r\n colorMode: GreasedLineMeshColorMode;\r\n\r\n /**\r\n * Colors of the line segments.\r\n * Defaults to empty.\r\n */\r\n colors: Nullable<Color3[]>;\r\n\r\n /**\r\n * If false then width units = scene units. If true then line will width be reduced.\r\n * Defaults to false.\r\n */\r\n sizeAttenuation: boolean;\r\n\r\n /**\r\n * Color of the line. Applies to all line segments.\r\n * Defaults to White.\r\n */\r\n color: Nullable<Color3>;\r\n\r\n /**\r\n * The method used to distribute the colors along the line.\r\n * You can use segment distribution when each segment will use on color from the color table.\r\n * Or you can use line distribution when the colors are distributed evenly along the line ignoring the segments.\r\n */\r\n colorsDistributionType: GreasedLineMeshColorDistributionType;\r\n\r\n /**\r\n * Defaults to engine.getRenderWidth() and engine.getRenderHeight()\r\n * Rendering resolution\r\n */\r\n resolution: Vector2;\r\n\r\n /**\r\n * You can provide a colorsTexture to use instead of one generated from the 'colors' option\r\n */\r\n colorsTexture: Nullable<RawTexture>;\r\n\r\n /**\r\n * Allows to change the color without marking the material dirty.\r\n * MATERIAL_TYPE_STANDARD and MATERIAL_TYPE_PBR material's shaders will get recompiled if there was no color set and you set a color or when there was a color set and you set it to null.\r\n * @param value the color\r\n * @param doNotMarkDirty the flag\r\n */\r\n setColor(value: Nullable<Color3>, doNotMarkDirty?: boolean): void;\r\n\r\n /**\r\n * Set the colors\r\n * @param colors colors array\r\n * @param lazy if true the colors texture will not be updated\r\n * @param forceNewTexture forces to create a new colors texture\r\n */\r\n setColors(colors: Nullable<Color3[]>, lazy: boolean, forceNewTexture?: boolean): void;\r\n\r\n /**\r\n * Creates and sets the colors texture from the colors array which was created in lazy mode\r\n */\r\n updateLazy(): void;\r\n}\r\n\r\n/**\r\n * Material types for GreasedLine\r\n * {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#materialtype}\r\n */\r\nexport const enum GreasedLineMeshMaterialType {\r\n /**\r\n * StandardMaterial\r\n */\r\n MATERIAL_TYPE_STANDARD = 0,\r\n /**\r\n * PBR Material\r\n */\r\n MATERIAL_TYPE_PBR = 1,\r\n /**\r\n * Simple and fast shader material without texture, light, fog, instances, ... support.\r\n * Just raw colored lines.\r\n * Dashing and visibility is supported.\r\n */\r\n MATERIAL_TYPE_SIMPLE = 2,\r\n}\r\n\r\n/**\r\n * Color blending mode of the @see GreasedLineMaterial and the base material\r\n * {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#colormode}\r\n */\r\nexport const enum GreasedLineMeshColorMode {\r\n /**\r\n * Color blending mode SET\r\n */\r\n COLOR_MODE_SET = 0,\r\n /**\r\n * Color blending mode ADD\r\n */\r\n COLOR_MODE_ADD = 1,\r\n /**\r\n * Color blending mode ADD\r\n */\r\n COLOR_MODE_MULTIPLY = 2,\r\n}\r\n\r\n/**\r\n * Color distribution type of the @see colors.\r\n * {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#colordistributiontype}\r\n *\r\n */\r\nexport const enum GreasedLineMeshColorDistributionType {\r\n /**\r\n * Colors distributed between segments of the line\r\n */\r\n COLOR_DISTRIBUTION_TYPE_SEGMENT = 0,\r\n /**\r\n * Colors distributed along the line ingoring the segments\r\n */\r\n COLOR_DISTRIBUTION_TYPE_LINE = 1,\r\n}\r\n\r\n/**\r\n * Options for GreasedLineMaterial\r\n */\r\nexport interface GreasedLineMaterialOptions {\r\n /**\r\n * Line width. If sizeAttenuation os false scene units will be used for width.\r\n * Defaults to 0.1 if @see sizeAttenuation is false, or to 1 if it's true.\r\n */\r\n width?: number;\r\n /**\r\n * If false then width units = scene units. If true then line will width be reduced.\r\n * Defaults to false.\r\n */\r\n sizeAttenuation?: boolean;\r\n /**\r\n * Type of the material to use to render the line.\r\n * Defaults to StandardMaterial.\r\n */\r\n materialType?: GreasedLineMeshMaterialType;\r\n /**\r\n * Color of the line. Applies to all line segments.\r\n * Defaults to White.\r\n */\r\n color?: Color3;\r\n /**\r\n * Color mode of the line. Applies to all line segments.\r\n * The pixel color from the material shader will be modified with the value of @see color using the colorMode.\r\n * Defaults to @see GreasedLineMeshColorMode.SET\r\n */\r\n colorMode?: GreasedLineMeshColorMode;\r\n /**\r\n * Colors of the line segments.\r\n * Defaults to empty.\r\n */\r\n colors?: Color3[];\r\n /**\r\n * If true, @see colors are used, otherwise they're ignored.\r\n * Defaults to false.\r\n */\r\n useColors?: boolean;\r\n /**\r\n * Sampling type of the colors texture\r\n * Defaults to NEAREST_NEAREST.\r\n */\r\n colorsSampling?: number;\r\n /**\r\n * The method used to distribute the colors along the line.\r\n * You can use segment distribution when each segment will use on color from the color table.\r\n * Or you can use line distribution when the colors are distributed evenly along the line ignoring the segments.\r\n */\r\n colorDistributionType?: GreasedLineMeshColorDistributionType;\r\n /**\r\n * If true, dashing is used.\r\n * Defaults to false.\r\n */\r\n useDash?: boolean;\r\n /**\r\n * @see GreasedLinePluginMaterial.setDashCount\r\n * Number of dashes in the line.\r\n * Defaults to 1.\r\n */\r\n dashCount?: number;\r\n /**\r\n * Offset of the dashes along the line. 0 to 1.\r\n * Defaults to 0.\r\n * @see GreasedLinePluginMaterial.setDashOffset\r\n */\r\n dashOffset?: number;\r\n /**\r\n * Length of the dash. 0 to 1. 0.5 means half empty, half drawn.\r\n * Defaults to 0.5.\r\n * @see GreasedLinePluginMaterial.setDashRatio\r\n */\r\n dashRatio?: number;\r\n /**\r\n * Sets the line length visibility.\r\n * 0 - 0% of the line will be visible.\r\n * 1 - 100% of the line will be visible.\r\n * @see GreasedLinePluginMaterial.setVisibility\r\n */\r\n visibility?: number;\r\n /**\r\n * Defaults to engine.getRenderWidth() and engine.getRenderHeight()\r\n * Rendering resolution\r\n */\r\n resolution?: Vector2;\r\n /**\r\n * Whether to use camera facing for the line.\r\n * Defaults to true.\r\n */\r\n cameraFacing?: boolean;\r\n /**\r\n * You can provide a colorsTexture to use instead of one generated from the 'colors' option\r\n */\r\n colorsTexture?: RawTexture;\r\n}\r\n"]}
1
+ {"version":3,"file":"greasedLineMaterialInterfaces.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GreasedLine/greasedLineMaterialInterfaces.ts"],"names":[],"mappings":"AAiHA;;;GAGG;AACH,MAAM,CAAN,IAAkB,2BAejB;AAfD,WAAkB,2BAA2B;IACzC;;OAEG;IACH,iHAA0B,CAAA;IAC1B;;OAEG;IACH,uGAAqB,CAAA;IACrB;;;;OAIG;IACH,6GAAwB,CAAA;AAC5B,CAAC,EAfiB,2BAA2B,KAA3B,2BAA2B,QAe5C;AAED;;;GAGG;AACH,MAAM,CAAN,IAAkB,wBAajB;AAbD,WAAkB,wBAAwB;IACtC;;OAEG;IACH,2FAAkB,CAAA;IAClB;;OAEG;IACH,2FAAkB,CAAA;IAClB;;OAEG;IACH,qGAAuB,CAAA;AAC3B,CAAC,EAbiB,wBAAwB,KAAxB,wBAAwB,QAazC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAkB,oCASjB;AATD,WAAkB,oCAAoC;IAClD;;OAEG;IACH,qJAAmC,CAAA;IACnC;;OAEG;IACH,+IAAgC,CAAA;AACpC,CAAC,EATiB,oCAAoC,KAApC,oCAAoC,QASrD","sourcesContent":["import type { RawTexture } from \"../Textures/rawTexture\";\r\nimport type { Vector2 } from \"../../Maths/math.vector\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Color3 } from \"../../Maths/math.color\";\r\n/**\r\n * Interface which defines the available methods for a GreasedLineMaterial\r\n */\r\nexport interface IGreasedLineMaterial {\r\n /**\r\n * Normalized value of how much of the line will be visible\r\n * 0 - 0% of the line will be visible\r\n * 1 - 100% of the line will be visible\r\n */\r\n visibility: number;\r\n\r\n /**\r\n * Line base width. At each point the line width is calculated by widths[pointIndex] * width\r\n */\r\n width: number;\r\n\r\n /**\r\n * Turns on/off dash mode\r\n */\r\n useDash: boolean;\r\n\r\n /**\r\n * @see GreasedLinePluginMaterial.setDashCount\r\n * Number of dashes in the line.\r\n * Defaults to 1.\r\n */\r\n dashCount: number;\r\n\r\n /**\r\n * Dash offset\r\n */\r\n dashOffset: number;\r\n\r\n /**\r\n * Length of the dash. 0 to 1. 0.5 means half empty, half drawn.\r\n */\r\n dashRatio: number;\r\n\r\n /**\r\n * Whether to use the colors option to colorize the line\r\n */\r\n useColors: boolean;\r\n\r\n /**\r\n * The mixing mode of the color paramater. Default value is GreasedLineMeshColorMode.SET.\r\n * MATERIAL_TYPE_SIMPLE mixes the color and colors of the greased line material.\r\n * MATERIAL_TYPE_STANDARD and MATERIAL_TYPE_PBR mixes the color from the base material with the color and/or colors of the greased line material.\r\n * @see GreasedLineMeshColorMode\r\n */\r\n colorMode: GreasedLineMeshColorMode;\r\n\r\n /**\r\n * Colors of the line segments.\r\n * Defaults to empty.\r\n */\r\n colors: Nullable<Color3[]>;\r\n\r\n /**\r\n * If false then width units = scene units. If true then line will width be reduced.\r\n * Defaults to false.\r\n */\r\n sizeAttenuation: boolean;\r\n\r\n /**\r\n * Color of the line. Applies to all line segments.\r\n * Defaults to White.\r\n */\r\n color: Nullable<Color3>;\r\n\r\n /**\r\n * The method used to distribute the colors along the line.\r\n * You can use segment distribution when each segment will use on color from the color table.\r\n * Or you can use line distribution when the colors are distributed evenly along the line ignoring the segments.\r\n */\r\n colorsDistributionType: GreasedLineMeshColorDistributionType;\r\n\r\n /**\r\n * Defaults to engine.getRenderWidth() and engine.getRenderHeight()\r\n * Rendering resolution\r\n */\r\n resolution: Vector2;\r\n\r\n /**\r\n * You can provide a colorsTexture to use instead of one generated from the 'colors' option\r\n */\r\n colorsTexture: Nullable<RawTexture>;\r\n\r\n /**\r\n * Allows to change the color without marking the material dirty.\r\n * MATERIAL_TYPE_STANDARD and MATERIAL_TYPE_PBR material's shaders will get recompiled if there was no color set and you set a color or when there was a color set and you set it to null.\r\n * @param value the color\r\n * @param doNotMarkDirty the flag\r\n */\r\n setColor(value: Nullable<Color3>, doNotMarkDirty?: boolean): void;\r\n\r\n /**\r\n * Set the colors\r\n * @param colors colors array\r\n * @param lazy if true the colors texture will not be updated\r\n * @param forceNewTexture forces to create a new colors texture\r\n */\r\n setColors(colors: Nullable<Color3[]>, lazy: boolean, forceNewTexture?: boolean): void;\r\n\r\n /**\r\n * Creates and sets the colors texture from the colors array which was created in lazy mode\r\n */\r\n updateLazy(): void;\r\n}\r\n\r\n/**\r\n * Material types for GreasedLine\r\n * {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#materialtype}\r\n */\r\nexport const enum GreasedLineMeshMaterialType {\r\n /**\r\n * StandardMaterial\r\n */\r\n MATERIAL_TYPE_STANDARD = 0,\r\n /**\r\n * PBR Material\r\n */\r\n MATERIAL_TYPE_PBR = 1,\r\n /**\r\n * Simple and fast shader material without texture, light, fog, instances, ... support.\r\n * Just raw colored lines.\r\n * Dashing and visibility is supported.\r\n */\r\n MATERIAL_TYPE_SIMPLE = 2,\r\n}\r\n\r\n/**\r\n * Color blending mode of the @see GreasedLineMaterial and the base material\r\n * {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#colormode}\r\n */\r\nexport const enum GreasedLineMeshColorMode {\r\n /**\r\n * Color blending mode SET\r\n */\r\n COLOR_MODE_SET = 0,\r\n /**\r\n * Color blending mode ADD\r\n */\r\n COLOR_MODE_ADD = 1,\r\n /**\r\n * Color blending mode ADD\r\n */\r\n COLOR_MODE_MULTIPLY = 2,\r\n}\r\n\r\n/**\r\n * Color distribution type of the @see colors.\r\n * {@link https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line#colordistributiontype}\r\n *\r\n */\r\nexport const enum GreasedLineMeshColorDistributionType {\r\n /**\r\n * Colors distributed between segments of the line\r\n */\r\n COLOR_DISTRIBUTION_TYPE_SEGMENT = 0,\r\n /**\r\n * Colors distributed along the line ingoring the segments\r\n */\r\n COLOR_DISTRIBUTION_TYPE_LINE = 1,\r\n}\r\n\r\n/**\r\n * Options for GreasedLineMaterial\r\n */\r\nexport interface GreasedLineMaterialOptions {\r\n /**\r\n * Force the greased lines to compile to glsl even on WebGPU engines.\r\n * False by default. This is mostly meant for backward compatibility.\r\n */\r\n forceGLSL?: boolean;\r\n /**\r\n * Line width. If sizeAttenuation os false scene units will be used for width.\r\n * Defaults to 0.1 if @see sizeAttenuation is false, or to 1 if it's true.\r\n */\r\n width?: number;\r\n /**\r\n * If false then width units = scene units. If true then line will width be reduced.\r\n * Defaults to false.\r\n */\r\n sizeAttenuation?: boolean;\r\n /**\r\n * Type of the material to use to render the line.\r\n * Defaults to StandardMaterial.\r\n */\r\n materialType?: GreasedLineMeshMaterialType;\r\n /**\r\n * Color of the line. Applies to all line segments.\r\n * Defaults to White.\r\n */\r\n color?: Color3;\r\n /**\r\n * Color mode of the line. Applies to all line segments.\r\n * The pixel color from the material shader will be modified with the value of @see color using the colorMode.\r\n * Defaults to @see GreasedLineMeshColorMode.SET\r\n */\r\n colorMode?: GreasedLineMeshColorMode;\r\n /**\r\n * Colors of the line segments.\r\n * Defaults to empty.\r\n */\r\n colors?: Color3[];\r\n /**\r\n * If true, @see colors are used, otherwise they're ignored.\r\n * Defaults to false.\r\n */\r\n useColors?: boolean;\r\n /**\r\n * Sampling type of the colors texture\r\n * Defaults to NEAREST_NEAREST.\r\n */\r\n colorsSampling?: number;\r\n /**\r\n * The method used to distribute the colors along the line.\r\n * You can use segment distribution when each segment will use on color from the color table.\r\n * Or you can use line distribution when the colors are distributed evenly along the line ignoring the segments.\r\n */\r\n colorDistributionType?: GreasedLineMeshColorDistributionType;\r\n /**\r\n * If true, dashing is used.\r\n * Defaults to false.\r\n */\r\n useDash?: boolean;\r\n /**\r\n * @see GreasedLinePluginMaterial.setDashCount\r\n * Number of dashes in the line.\r\n * Defaults to 1.\r\n */\r\n dashCount?: number;\r\n /**\r\n * Offset of the dashes along the line. 0 to 1.\r\n * Defaults to 0.\r\n * @see GreasedLinePluginMaterial.setDashOffset\r\n */\r\n dashOffset?: number;\r\n /**\r\n * Length of the dash. 0 to 1. 0.5 means half empty, half drawn.\r\n * Defaults to 0.5.\r\n * @see GreasedLinePluginMaterial.setDashRatio\r\n */\r\n dashRatio?: number;\r\n /**\r\n * Sets the line length visibility.\r\n * 0 - 0% of the line will be visible.\r\n * 1 - 100% of the line will be visible.\r\n * @see GreasedLinePluginMaterial.setVisibility\r\n */\r\n visibility?: number;\r\n /**\r\n * Defaults to engine.getRenderWidth() and engine.getRenderHeight()\r\n * Rendering resolution\r\n */\r\n resolution?: Vector2;\r\n /**\r\n * Whether to use camera facing for the line.\r\n * Defaults to true.\r\n */\r\n cameraFacing?: boolean;\r\n /**\r\n * You can provide a colorsTexture to use instead of one generated from the 'colors' option\r\n */\r\n colorsTexture?: RawTexture;\r\n}\r\n"]}
@@ -9,6 +9,7 @@ import type { Material } from "../material";
9
9
  import { MaterialDefines } from "../materialDefines";
10
10
  import type { AbstractMesh } from "../../Meshes/abstractMesh";
11
11
  import type { BaseTexture } from "../Textures/baseTexture";
12
+ import { ShaderLanguage } from "../shaderLanguage";
12
13
  import type { GreasedLineMaterialOptions, IGreasedLineMaterial } from "./greasedLineMaterialInterfaces";
13
14
  import { GreasedLineMeshColorDistributionType, GreasedLineMeshColorMode } from "./greasedLineMaterialInterfaces";
14
15
  /**
@@ -45,6 +46,11 @@ export declare class GreasedLinePluginMaterial extends MaterialPluginBase implem
45
46
  * Plugin name
46
47
  */
47
48
  static readonly GREASED_LINE_MATERIAL_NAME = "GreasedLinePluginMaterial";
49
+ /**
50
+ * Force all the greased lines to compile to glsl even on WebGPU engines.
51
+ * False by default. This is mostly meant for backward compatibility.
52
+ */
53
+ static ForceGLSL: boolean;
48
54
  /**
49
55
  * Whether to use the colors option to colorize the line
50
56
  */
@@ -95,11 +101,18 @@ export declare class GreasedLinePluginMaterial extends MaterialPluginBase implem
95
101
  private _sizeAttenuation;
96
102
  private _cameraFacing;
97
103
  private _engine;
104
+ private _forceGLSL;
105
+ /**
106
+ * Gets a boolean indicating that the plugin is compatible with a given shader language
107
+ * @param _shaderLanguage The shader language to use
108
+ * @returns true if the plugin is compatible with the shader language. Return always true since both GLSL and WGSL are supported
109
+ */
110
+ isCompatible(_shaderLanguage: ShaderLanguage): boolean;
98
111
  /**
99
112
  * Creates a new instance of the GreasedLinePluginMaterial
100
- * @param material base material for the plugin
101
- * @param scene the scene
102
- * @param options plugin options
113
+ * @param material Base material for the plugin
114
+ * @param scene The scene
115
+ * @param options Plugin options
103
116
  */
104
117
  constructor(material: Material, scene?: Scene, options?: GreasedLineMaterialOptions);
105
118
  /**
@@ -119,9 +132,10 @@ export declare class GreasedLinePluginMaterial extends MaterialPluginBase implem
119
132
  getActiveTextures(activeTextures: BaseTexture[]): void;
120
133
  /**
121
134
  * Get the shader uniforms
135
+ * @param shaderLanguage The shader language to use
122
136
  * @returns uniforms
123
137
  */
124
- getUniforms(): {
138
+ getUniforms(shaderLanguage?: ShaderLanguage): {
125
139
  ubo: {
126
140
  name: string;
127
141
  size: number;
@@ -151,9 +165,10 @@ export declare class GreasedLinePluginMaterial extends MaterialPluginBase implem
151
165
  /**
152
166
  * Get shader code
153
167
  * @param shaderType vertex/fragment
168
+ * @param shaderLanguage GLSL or WGSL
154
169
  * @returns shader code
155
170
  */
156
- getCustomCode(shaderType: string): Nullable<{
171
+ getCustomCode(shaderType: string, shaderLanguage?: ShaderLanguage): Nullable<{
157
172
  [pointName: string]: string;
158
173
  }>;
159
174
  /**
@@ -250,4 +265,5 @@ export declare class GreasedLinePluginMaterial extends MaterialPluginBase implem
250
265
  * @param plugin define the config where to copy the info
251
266
  */
252
267
  copyTo(plugin: MaterialPluginBase): void;
268
+ private _isGLSL;
253
269
  }