@plastic-software/three 0.167.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1023) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +86 -0
  3. package/build/three.cjs +54311 -0
  4. package/build/three.module.js +53897 -0
  5. package/build/three.module.min.js +6 -0
  6. package/build/three.webgpu.js +76281 -0
  7. package/build/three.webgpu.min.js +6 -0
  8. package/examples/fonts/LICENSE +13 -0
  9. package/examples/fonts/README.md +11 -0
  10. package/examples/fonts/droid/NOTICE +190 -0
  11. package/examples/fonts/droid/README.txt +18 -0
  12. package/examples/fonts/droid/droid_sans_bold.typeface.json +1 -0
  13. package/examples/fonts/droid/droid_sans_mono_regular.typeface.json +1 -0
  14. package/examples/fonts/droid/droid_sans_regular.typeface.json +1 -0
  15. package/examples/fonts/droid/droid_serif_bold.typeface.json +1 -0
  16. package/examples/fonts/droid/droid_serif_regular.typeface.json +1 -0
  17. package/examples/fonts/gentilis_bold.typeface.json +1 -0
  18. package/examples/fonts/gentilis_regular.typeface.json +1 -0
  19. package/examples/fonts/helvetiker_bold.typeface.json +1 -0
  20. package/examples/fonts/helvetiker_regular.typeface.json +1 -0
  21. package/examples/fonts/optimer_bold.typeface.json +1 -0
  22. package/examples/fonts/optimer_regular.typeface.json +1 -0
  23. package/examples/fonts/ttf/README.md +9 -0
  24. package/examples/fonts/ttf/kenpixel.ttf +0 -0
  25. package/examples/jsm/Addons.js +299 -0
  26. package/examples/jsm/animation/AnimationClipCreator.js +116 -0
  27. package/examples/jsm/animation/CCDIKSolver.js +484 -0
  28. package/examples/jsm/animation/MMDAnimationHelper.js +1207 -0
  29. package/examples/jsm/animation/MMDPhysics.js +1406 -0
  30. package/examples/jsm/cameras/CinematicCamera.js +208 -0
  31. package/examples/jsm/capabilities/WebGL.js +108 -0
  32. package/examples/jsm/capabilities/WebGPU.js +57 -0
  33. package/examples/jsm/controls/ArcballControls.js +3224 -0
  34. package/examples/jsm/controls/DragControls.js +282 -0
  35. package/examples/jsm/controls/FirstPersonControls.js +325 -0
  36. package/examples/jsm/controls/FlyControls.js +326 -0
  37. package/examples/jsm/controls/MapControls.js +28 -0
  38. package/examples/jsm/controls/OrbitControls.js +1532 -0
  39. package/examples/jsm/controls/PointerLockControls.js +162 -0
  40. package/examples/jsm/controls/TrackballControls.js +828 -0
  41. package/examples/jsm/controls/TransformControls.js +1573 -0
  42. package/examples/jsm/csm/CSM.js +384 -0
  43. package/examples/jsm/csm/CSMFrustum.js +152 -0
  44. package/examples/jsm/csm/CSMHelper.js +193 -0
  45. package/examples/jsm/csm/CSMShader.js +295 -0
  46. package/examples/jsm/curves/CurveExtras.js +422 -0
  47. package/examples/jsm/curves/NURBSCurve.js +80 -0
  48. package/examples/jsm/curves/NURBSSurface.js +52 -0
  49. package/examples/jsm/curves/NURBSUtils.js +542 -0
  50. package/examples/jsm/curves/NURBSVolume.js +62 -0
  51. package/examples/jsm/effects/AnaglyphEffect.js +154 -0
  52. package/examples/jsm/effects/AsciiEffect.js +263 -0
  53. package/examples/jsm/effects/OutlineEffect.js +539 -0
  54. package/examples/jsm/effects/ParallaxBarrierEffect.js +119 -0
  55. package/examples/jsm/effects/PeppersGhostEffect.js +153 -0
  56. package/examples/jsm/effects/StereoEffect.js +55 -0
  57. package/examples/jsm/environments/DebugEnvironment.js +52 -0
  58. package/examples/jsm/environments/RoomEnvironment.js +144 -0
  59. package/examples/jsm/exporters/DRACOExporter.js +267 -0
  60. package/examples/jsm/exporters/EXRExporter.js +579 -0
  61. package/examples/jsm/exporters/GLTFExporter.js +3389 -0
  62. package/examples/jsm/exporters/KTX2Exporter.js +292 -0
  63. package/examples/jsm/exporters/MMDExporter.js +217 -0
  64. package/examples/jsm/exporters/OBJExporter.js +284 -0
  65. package/examples/jsm/exporters/PLYExporter.js +528 -0
  66. package/examples/jsm/exporters/STLExporter.js +199 -0
  67. package/examples/jsm/exporters/USDZExporter.js +743 -0
  68. package/examples/jsm/geometries/BoxLineGeometry.js +69 -0
  69. package/examples/jsm/geometries/ConvexGeometry.js +53 -0
  70. package/examples/jsm/geometries/DecalGeometry.js +356 -0
  71. package/examples/jsm/geometries/InstancedPointsGeometry.js +174 -0
  72. package/examples/jsm/geometries/ParametricGeometries.js +254 -0
  73. package/examples/jsm/geometries/ParametricGeometry.js +139 -0
  74. package/examples/jsm/geometries/RoundedBoxGeometry.js +155 -0
  75. package/examples/jsm/geometries/SDFGeometryGenerator.js +144 -0
  76. package/examples/jsm/geometries/TeapotGeometry.js +704 -0
  77. package/examples/jsm/geometries/TextGeometry.js +65 -0
  78. package/examples/jsm/helpers/LightProbeHelper.js +130 -0
  79. package/examples/jsm/helpers/OctreeHelper.js +73 -0
  80. package/examples/jsm/helpers/PositionalAudioHelper.js +109 -0
  81. package/examples/jsm/helpers/RectAreaLightHelper.js +85 -0
  82. package/examples/jsm/helpers/TextureHelper.js +237 -0
  83. package/examples/jsm/helpers/VertexNormalsHelper.js +96 -0
  84. package/examples/jsm/helpers/VertexTangentsHelper.js +88 -0
  85. package/examples/jsm/helpers/ViewHelper.js +347 -0
  86. package/examples/jsm/interactive/HTMLMesh.js +570 -0
  87. package/examples/jsm/interactive/InteractiveGroup.js +106 -0
  88. package/examples/jsm/interactive/SelectionBox.js +227 -0
  89. package/examples/jsm/interactive/SelectionHelper.js +104 -0
  90. package/examples/jsm/libs/ammo.wasm.js +822 -0
  91. package/examples/jsm/libs/ammo.wasm.wasm +0 -0
  92. package/examples/jsm/libs/basis/README.md +46 -0
  93. package/examples/jsm/libs/basis/basis_transcoder.js +21 -0
  94. package/examples/jsm/libs/basis/basis_transcoder.wasm +0 -0
  95. package/examples/jsm/libs/chevrotain.module.min.js +141 -0
  96. package/examples/jsm/libs/draco/README.md +32 -0
  97. package/examples/jsm/libs/draco/draco_decoder.js +34 -0
  98. package/examples/jsm/libs/draco/draco_decoder.wasm +0 -0
  99. package/examples/jsm/libs/draco/draco_encoder.js +33 -0
  100. package/examples/jsm/libs/draco/draco_wasm_wrapper.js +117 -0
  101. package/examples/jsm/libs/draco/gltf/draco_decoder.js +33 -0
  102. package/examples/jsm/libs/draco/gltf/draco_decoder.wasm +0 -0
  103. package/examples/jsm/libs/draco/gltf/draco_encoder.js +33 -0
  104. package/examples/jsm/libs/draco/gltf/draco_wasm_wrapper.js +116 -0
  105. package/examples/jsm/libs/ecsy.module.js +1792 -0
  106. package/examples/jsm/libs/fflate.module.js +2672 -0
  107. package/examples/jsm/libs/ktx-parse.module.js +1 -0
  108. package/examples/jsm/libs/lil-gui.module.min.js +8 -0
  109. package/examples/jsm/libs/lottie_canvas.module.js +14849 -0
  110. package/examples/jsm/libs/meshopt_decoder.module.js +178 -0
  111. package/examples/jsm/libs/mikktspace.module.js +128 -0
  112. package/examples/jsm/libs/mmdparser.module.js +11530 -0
  113. package/examples/jsm/libs/motion-controllers.module.js +397 -0
  114. package/examples/jsm/libs/opentype.module.js +14506 -0
  115. package/examples/jsm/libs/potpack.module.js +125 -0
  116. package/examples/jsm/libs/rhino3dm/rhino3dm.js +21 -0
  117. package/examples/jsm/libs/rhino3dm/rhino3dm.module.js +16 -0
  118. package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
  119. package/examples/jsm/libs/stats.module.js +167 -0
  120. package/examples/jsm/libs/surfaceNet.js +201 -0
  121. package/examples/jsm/libs/tween.module.js +876 -0
  122. package/examples/jsm/libs/utif.module.js +1665 -0
  123. package/examples/jsm/libs/zstddec.module.js +1 -0
  124. package/examples/jsm/lights/LightProbeGenerator.js +286 -0
  125. package/examples/jsm/lights/RectAreaLightTexturesLib.js +91 -0
  126. package/examples/jsm/lights/RectAreaLightUniformsLib.js +24 -0
  127. package/examples/jsm/lines/Line2.js +19 -0
  128. package/examples/jsm/lines/LineGeometry.js +79 -0
  129. package/examples/jsm/lines/LineMaterial.js +603 -0
  130. package/examples/jsm/lines/LineSegments2.js +376 -0
  131. package/examples/jsm/lines/LineSegmentsGeometry.js +241 -0
  132. package/examples/jsm/lines/Wireframe.js +71 -0
  133. package/examples/jsm/lines/WireframeGeometry2.js +24 -0
  134. package/examples/jsm/lines/webgpu/Line2.js +20 -0
  135. package/examples/jsm/lines/webgpu/LineSegments2.js +376 -0
  136. package/examples/jsm/loaders/3DMLoader.js +1764 -0
  137. package/examples/jsm/loaders/3MFLoader.js +1480 -0
  138. package/examples/jsm/loaders/AMFLoader.js +521 -0
  139. package/examples/jsm/loaders/BVHLoader.js +437 -0
  140. package/examples/jsm/loaders/ColladaLoader.js +4116 -0
  141. package/examples/jsm/loaders/DDSLoader.js +318 -0
  142. package/examples/jsm/loaders/DRACOLoader.js +613 -0
  143. package/examples/jsm/loaders/EXRLoader.js +2563 -0
  144. package/examples/jsm/loaders/FBXLoader.js +4303 -0
  145. package/examples/jsm/loaders/FontLoader.js +183 -0
  146. package/examples/jsm/loaders/GCodeLoader.js +261 -0
  147. package/examples/jsm/loaders/GLTFLoader.js +4730 -0
  148. package/examples/jsm/loaders/HDRCubeTextureLoader.js +115 -0
  149. package/examples/jsm/loaders/IESLoader.js +337 -0
  150. package/examples/jsm/loaders/KMZLoader.js +130 -0
  151. package/examples/jsm/loaders/KTX2Loader.js +937 -0
  152. package/examples/jsm/loaders/KTXLoader.js +176 -0
  153. package/examples/jsm/loaders/LDrawLoader.js +2471 -0
  154. package/examples/jsm/loaders/LUT3dlLoader.js +168 -0
  155. package/examples/jsm/loaders/LUTCubeLoader.js +153 -0
  156. package/examples/jsm/loaders/LUTImageLoader.js +149 -0
  157. package/examples/jsm/loaders/LWOLoader.js +1052 -0
  158. package/examples/jsm/loaders/LogLuvLoader.js +606 -0
  159. package/examples/jsm/loaders/LottieLoader.js +77 -0
  160. package/examples/jsm/loaders/MD2Loader.js +399 -0
  161. package/examples/jsm/loaders/MDDLoader.js +102 -0
  162. package/examples/jsm/loaders/MMDLoader.js +2295 -0
  163. package/examples/jsm/loaders/MTLLoader.js +567 -0
  164. package/examples/jsm/loaders/MaterialXLoader.js +845 -0
  165. package/examples/jsm/loaders/NRRDLoader.js +686 -0
  166. package/examples/jsm/loaders/OBJLoader.js +905 -0
  167. package/examples/jsm/loaders/PCDLoader.js +467 -0
  168. package/examples/jsm/loaders/PDBLoader.js +232 -0
  169. package/examples/jsm/loaders/PLYLoader.js +771 -0
  170. package/examples/jsm/loaders/PVRLoader.js +251 -0
  171. package/examples/jsm/loaders/RGBELoader.js +450 -0
  172. package/examples/jsm/loaders/RGBMLoader.js +1081 -0
  173. package/examples/jsm/loaders/STLLoader.js +410 -0
  174. package/examples/jsm/loaders/SVGLoader.js +3173 -0
  175. package/examples/jsm/loaders/TDSLoader.js +1124 -0
  176. package/examples/jsm/loaders/TGALoader.js +517 -0
  177. package/examples/jsm/loaders/TIFFLoader.js +36 -0
  178. package/examples/jsm/loaders/TTFLoader.js +214 -0
  179. package/examples/jsm/loaders/TiltLoader.js +520 -0
  180. package/examples/jsm/loaders/USDZLoader.js +870 -0
  181. package/examples/jsm/loaders/UltraHDRLoader.js +583 -0
  182. package/examples/jsm/loaders/VOXLoader.js +318 -0
  183. package/examples/jsm/loaders/VRMLLoader.js +3537 -0
  184. package/examples/jsm/loaders/VTKLoader.js +1236 -0
  185. package/examples/jsm/loaders/XYZLoader.js +106 -0
  186. package/examples/jsm/loaders/lwo/IFFParser.js +1217 -0
  187. package/examples/jsm/loaders/lwo/LWO2Parser.js +414 -0
  188. package/examples/jsm/loaders/lwo/LWO3Parser.js +373 -0
  189. package/examples/jsm/materials/MeshGouraudMaterial.js +432 -0
  190. package/examples/jsm/materials/MeshPostProcessingMaterial.js +144 -0
  191. package/examples/jsm/math/Capsule.js +82 -0
  192. package/examples/jsm/math/ColorConverter.js +36 -0
  193. package/examples/jsm/math/ConvexHull.js +1271 -0
  194. package/examples/jsm/math/ImprovedNoise.js +71 -0
  195. package/examples/jsm/math/Lut.js +204 -0
  196. package/examples/jsm/math/MeshSurfaceSampler.js +250 -0
  197. package/examples/jsm/math/OBB.js +423 -0
  198. package/examples/jsm/math/Octree.js +546 -0
  199. package/examples/jsm/math/SimplexNoise.js +444 -0
  200. package/examples/jsm/misc/ConvexObjectBreaker.js +519 -0
  201. package/examples/jsm/misc/GPUComputationRenderer.js +430 -0
  202. package/examples/jsm/misc/Gyroscope.js +66 -0
  203. package/examples/jsm/misc/MD2Character.js +276 -0
  204. package/examples/jsm/misc/MD2CharacterComplex.js +576 -0
  205. package/examples/jsm/misc/MorphAnimMesh.js +75 -0
  206. package/examples/jsm/misc/MorphBlendMesh.js +322 -0
  207. package/examples/jsm/misc/ProgressiveLightMap.js +324 -0
  208. package/examples/jsm/misc/RollerCoaster.js +566 -0
  209. package/examples/jsm/misc/Timer.js +128 -0
  210. package/examples/jsm/misc/TubePainter.js +202 -0
  211. package/examples/jsm/misc/Volume.js +473 -0
  212. package/examples/jsm/misc/VolumeSlice.js +229 -0
  213. package/examples/jsm/modifiers/CurveModifier.js +346 -0
  214. package/examples/jsm/modifiers/EdgeSplitModifier.js +279 -0
  215. package/examples/jsm/modifiers/SimplifyModifier.js +618 -0
  216. package/examples/jsm/modifiers/TessellateModifier.js +307 -0
  217. package/examples/jsm/objects/GroundedSkybox.js +50 -0
  218. package/examples/jsm/objects/InstancedPoints.js +21 -0
  219. package/examples/jsm/objects/Lensflare.js +397 -0
  220. package/examples/jsm/objects/MarchingCubes.js +1176 -0
  221. package/examples/jsm/objects/Reflector.js +264 -0
  222. package/examples/jsm/objects/ReflectorForSSRPass.js +352 -0
  223. package/examples/jsm/objects/Refractor.js +327 -0
  224. package/examples/jsm/objects/ShadowMesh.js +80 -0
  225. package/examples/jsm/objects/Sky.js +219 -0
  226. package/examples/jsm/objects/SkyMesh.js +189 -0
  227. package/examples/jsm/objects/Water.js +333 -0
  228. package/examples/jsm/objects/Water2.js +361 -0
  229. package/examples/jsm/objects/Water2Mesh.js +160 -0
  230. package/examples/jsm/objects/WaterMesh.js +103 -0
  231. package/examples/jsm/offscreen/jank.js +45 -0
  232. package/examples/jsm/offscreen/offscreen.js +8 -0
  233. package/examples/jsm/offscreen/scene.js +86 -0
  234. package/examples/jsm/physics/AmmoPhysics.js +306 -0
  235. package/examples/jsm/physics/JoltPhysics.js +281 -0
  236. package/examples/jsm/physics/RapierPhysics.js +240 -0
  237. package/examples/jsm/postprocessing/AfterimagePass.js +104 -0
  238. package/examples/jsm/postprocessing/BloomPass.js +172 -0
  239. package/examples/jsm/postprocessing/BokehPass.js +141 -0
  240. package/examples/jsm/postprocessing/ClearPass.js +46 -0
  241. package/examples/jsm/postprocessing/CubeTexturePass.js +85 -0
  242. package/examples/jsm/postprocessing/DotScreenPass.js +65 -0
  243. package/examples/jsm/postprocessing/EffectComposer.js +231 -0
  244. package/examples/jsm/postprocessing/FilmPass.js +64 -0
  245. package/examples/jsm/postprocessing/GTAOPass.js +582 -0
  246. package/examples/jsm/postprocessing/GlitchPass.js +125 -0
  247. package/examples/jsm/postprocessing/HalftonePass.js +79 -0
  248. package/examples/jsm/postprocessing/LUTPass.js +108 -0
  249. package/examples/jsm/postprocessing/MaskPass.js +104 -0
  250. package/examples/jsm/postprocessing/OutlinePass.js +654 -0
  251. package/examples/jsm/postprocessing/OutputPass.js +97 -0
  252. package/examples/jsm/postprocessing/Pass.js +95 -0
  253. package/examples/jsm/postprocessing/RenderPass.js +99 -0
  254. package/examples/jsm/postprocessing/RenderPixelatedPass.js +235 -0
  255. package/examples/jsm/postprocessing/RenderTransitionPass.js +168 -0
  256. package/examples/jsm/postprocessing/SAOPass.js +334 -0
  257. package/examples/jsm/postprocessing/SMAAPass.js +199 -0
  258. package/examples/jsm/postprocessing/SSAARenderPass.js +228 -0
  259. package/examples/jsm/postprocessing/SSAOPass.js +414 -0
  260. package/examples/jsm/postprocessing/SSRPass.js +641 -0
  261. package/examples/jsm/postprocessing/SavePass.js +79 -0
  262. package/examples/jsm/postprocessing/ShaderPass.js +77 -0
  263. package/examples/jsm/postprocessing/TAARenderPass.js +188 -0
  264. package/examples/jsm/postprocessing/TexturePass.js +67 -0
  265. package/examples/jsm/postprocessing/UnrealBloomPass.js +415 -0
  266. package/examples/jsm/renderers/CSS2DRenderer.js +235 -0
  267. package/examples/jsm/renderers/CSS3DRenderer.js +350 -0
  268. package/examples/jsm/renderers/Projector.js +918 -0
  269. package/examples/jsm/renderers/SVGRenderer.js +556 -0
  270. package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +89 -0
  271. package/examples/jsm/shaders/AfterimageShader.js +58 -0
  272. package/examples/jsm/shaders/BasicShader.js +29 -0
  273. package/examples/jsm/shaders/BleachBypassShader.js +61 -0
  274. package/examples/jsm/shaders/BlendShader.js +49 -0
  275. package/examples/jsm/shaders/BokehShader.js +145 -0
  276. package/examples/jsm/shaders/BokehShader2.js +397 -0
  277. package/examples/jsm/shaders/BrightnessContrastShader.js +56 -0
  278. package/examples/jsm/shaders/ColorCorrectionShader.js +52 -0
  279. package/examples/jsm/shaders/ColorifyShader.js +50 -0
  280. package/examples/jsm/shaders/ConvolutionShader.js +103 -0
  281. package/examples/jsm/shaders/CopyShader.js +45 -0
  282. package/examples/jsm/shaders/DOFMipMapShader.js +56 -0
  283. package/examples/jsm/shaders/DepthLimitedBlurShader.js +171 -0
  284. package/examples/jsm/shaders/DigitalGlitch.js +101 -0
  285. package/examples/jsm/shaders/DotScreenShader.js +70 -0
  286. package/examples/jsm/shaders/ExposureShader.js +44 -0
  287. package/examples/jsm/shaders/FXAAShader.js +286 -0
  288. package/examples/jsm/shaders/FilmShader.js +59 -0
  289. package/examples/jsm/shaders/FocusShader.js +89 -0
  290. package/examples/jsm/shaders/FreiChenShader.js +96 -0
  291. package/examples/jsm/shaders/GTAOShader.js +424 -0
  292. package/examples/jsm/shaders/GammaCorrectionShader.js +43 -0
  293. package/examples/jsm/shaders/GodRaysShader.js +321 -0
  294. package/examples/jsm/shaders/HalftoneShader.js +312 -0
  295. package/examples/jsm/shaders/HorizontalBlurShader.js +59 -0
  296. package/examples/jsm/shaders/HorizontalTiltShiftShader.js +63 -0
  297. package/examples/jsm/shaders/HueSaturationShader.js +67 -0
  298. package/examples/jsm/shaders/KaleidoShader.js +58 -0
  299. package/examples/jsm/shaders/LuminosityHighPassShader.js +64 -0
  300. package/examples/jsm/shaders/LuminosityShader.js +48 -0
  301. package/examples/jsm/shaders/MMDToonShader.js +134 -0
  302. package/examples/jsm/shaders/MirrorShader.js +56 -0
  303. package/examples/jsm/shaders/NormalMapShader.js +55 -0
  304. package/examples/jsm/shaders/OutputShader.js +85 -0
  305. package/examples/jsm/shaders/PoissonDenoiseShader.js +226 -0
  306. package/examples/jsm/shaders/RGBShiftShader.js +54 -0
  307. package/examples/jsm/shaders/SAOShader.js +179 -0
  308. package/examples/jsm/shaders/SMAAShader.js +466 -0
  309. package/examples/jsm/shaders/SSAOShader.js +300 -0
  310. package/examples/jsm/shaders/SSRShader.js +370 -0
  311. package/examples/jsm/shaders/SepiaShader.js +52 -0
  312. package/examples/jsm/shaders/SobelOperatorShader.js +92 -0
  313. package/examples/jsm/shaders/SubsurfaceScatteringShader.js +90 -0
  314. package/examples/jsm/shaders/TechnicolorShader.js +45 -0
  315. package/examples/jsm/shaders/ToonShader.js +326 -0
  316. package/examples/jsm/shaders/TriangleBlurShader.js +74 -0
  317. package/examples/jsm/shaders/UnpackDepthRGBAShader.js +47 -0
  318. package/examples/jsm/shaders/VelocityShader.js +130 -0
  319. package/examples/jsm/shaders/VerticalBlurShader.js +59 -0
  320. package/examples/jsm/shaders/VerticalTiltShiftShader.js +63 -0
  321. package/examples/jsm/shaders/VignetteShader.js +51 -0
  322. package/examples/jsm/shaders/VolumeShader.js +289 -0
  323. package/examples/jsm/shaders/WaterRefractionShader.js +95 -0
  324. package/examples/jsm/textures/FlakesTexture.js +40 -0
  325. package/examples/jsm/transpiler/AST.js +270 -0
  326. package/examples/jsm/transpiler/GLSLDecoder.js +983 -0
  327. package/examples/jsm/transpiler/ShaderToyDecoder.js +49 -0
  328. package/examples/jsm/transpiler/TSLEncoder.js +717 -0
  329. package/examples/jsm/transpiler/Transpiler.js +18 -0
  330. package/examples/jsm/utils/BufferGeometryUtils.js +1373 -0
  331. package/examples/jsm/utils/CameraUtils.js +73 -0
  332. package/examples/jsm/utils/GPUStatsPanel.js +95 -0
  333. package/examples/jsm/utils/GeometryCompressionUtils.js +639 -0
  334. package/examples/jsm/utils/GeometryUtils.js +221 -0
  335. package/examples/jsm/utils/LDrawUtils.js +202 -0
  336. package/examples/jsm/utils/PackedPhongMaterial.js +178 -0
  337. package/examples/jsm/utils/SceneUtils.js +313 -0
  338. package/examples/jsm/utils/ShadowMapViewer.js +210 -0
  339. package/examples/jsm/utils/SkeletonUtils.js +424 -0
  340. package/examples/jsm/utils/SortUtils.js +163 -0
  341. package/examples/jsm/utils/TextureUtils.js +98 -0
  342. package/examples/jsm/utils/UVsDebug.js +165 -0
  343. package/examples/jsm/utils/WorkerPool.js +102 -0
  344. package/examples/jsm/webxr/ARButton.js +232 -0
  345. package/examples/jsm/webxr/OculusHandModel.js +110 -0
  346. package/examples/jsm/webxr/OculusHandPointerModel.js +413 -0
  347. package/examples/jsm/webxr/Text2D.js +38 -0
  348. package/examples/jsm/webxr/VRButton.js +233 -0
  349. package/examples/jsm/webxr/XRButton.js +223 -0
  350. package/examples/jsm/webxr/XRControllerModelFactory.js +312 -0
  351. package/examples/jsm/webxr/XREstimatedLight.js +223 -0
  352. package/examples/jsm/webxr/XRHandMeshModel.js +114 -0
  353. package/examples/jsm/webxr/XRHandModelFactory.js +107 -0
  354. package/examples/jsm/webxr/XRHandPrimitiveModel.js +103 -0
  355. package/examples/jsm/webxr/XRPlanes.js +100 -0
  356. package/package.json +127 -0
  357. package/src/Three.Legacy.js +21 -0
  358. package/src/Three.WebGPU.js +194 -0
  359. package/src/Three.js +184 -0
  360. package/src/animation/AnimationAction.js +700 -0
  361. package/src/animation/AnimationClip.js +473 -0
  362. package/src/animation/AnimationMixer.js +770 -0
  363. package/src/animation/AnimationObjectGroup.js +387 -0
  364. package/src/animation/AnimationUtils.js +356 -0
  365. package/src/animation/KeyframeTrack.js +462 -0
  366. package/src/animation/PropertyBinding.js +719 -0
  367. package/src/animation/PropertyMixer.js +318 -0
  368. package/src/animation/tracks/BooleanKeyframeTrack.js +28 -0
  369. package/src/animation/tracks/ColorKeyframeTrack.js +15 -0
  370. package/src/animation/tracks/NumberKeyframeTrack.js +12 -0
  371. package/src/animation/tracks/QuaternionKeyframeTrack.js +22 -0
  372. package/src/animation/tracks/StringKeyframeTrack.js +24 -0
  373. package/src/animation/tracks/VectorKeyframeTrack.js +12 -0
  374. package/src/audio/Audio.js +400 -0
  375. package/src/audio/AudioAnalyser.js +40 -0
  376. package/src/audio/AudioContext.js +25 -0
  377. package/src/audio/AudioListener.js +137 -0
  378. package/src/audio/PositionalAudio.js +146 -0
  379. package/src/cameras/ArrayCamera.js +17 -0
  380. package/src/cameras/Camera.js +69 -0
  381. package/src/cameras/CubeCamera.js +173 -0
  382. package/src/cameras/OrthographicCamera.js +136 -0
  383. package/src/cameras/PerspectiveCamera.js +268 -0
  384. package/src/cameras/StereoCamera.js +100 -0
  385. package/src/constants.js +216 -0
  386. package/src/core/BufferAttribute.js +639 -0
  387. package/src/core/BufferGeometry.js +1073 -0
  388. package/src/core/Clock.js +74 -0
  389. package/src/core/EventDispatcher.js +87 -0
  390. package/src/core/GLBufferAttribute.js +60 -0
  391. package/src/core/InstancedBufferAttribute.js +39 -0
  392. package/src/core/InstancedBufferGeometry.js +40 -0
  393. package/src/core/InstancedInterleavedBuffer.js +48 -0
  394. package/src/core/InterleavedBuffer.js +166 -0
  395. package/src/core/InterleavedBufferAttribute.js +351 -0
  396. package/src/core/Layers.js +60 -0
  397. package/src/core/Object3D.js +1024 -0
  398. package/src/core/Raycaster.js +128 -0
  399. package/src/core/RenderTarget.js +162 -0
  400. package/src/core/Uniform.js +17 -0
  401. package/src/core/UniformsGroup.js +98 -0
  402. package/src/extras/DataUtils.js +176 -0
  403. package/src/extras/Earcut.js +789 -0
  404. package/src/extras/ImageUtils.js +129 -0
  405. package/src/extras/PMREMGenerator.js +918 -0
  406. package/src/extras/ShapeUtils.js +92 -0
  407. package/src/extras/TextureUtils.js +210 -0
  408. package/src/extras/core/Curve.js +416 -0
  409. package/src/extras/core/CurvePath.js +255 -0
  410. package/src/extras/core/Interpolations.js +79 -0
  411. package/src/extras/core/Path.js +196 -0
  412. package/src/extras/core/Shape.js +102 -0
  413. package/src/extras/core/ShapePath.js +291 -0
  414. package/src/extras/curves/ArcCurve.js +17 -0
  415. package/src/extras/curves/CatmullRomCurve3.js +255 -0
  416. package/src/extras/curves/CubicBezierCurve.js +78 -0
  417. package/src/extras/curves/CubicBezierCurve3.js +79 -0
  418. package/src/extras/curves/Curves.js +10 -0
  419. package/src/extras/curves/EllipseCurve.js +156 -0
  420. package/src/extras/curves/LineCurve.js +92 -0
  421. package/src/extras/curves/LineCurve3.js +92 -0
  422. package/src/extras/curves/QuadraticBezierCurve.js +74 -0
  423. package/src/extras/curves/QuadraticBezierCurve3.js +75 -0
  424. package/src/extras/curves/SplineCurve.js +97 -0
  425. package/src/geometries/BoxGeometry.js +180 -0
  426. package/src/geometries/CapsuleGeometry.js +33 -0
  427. package/src/geometries/CircleGeometry.js +101 -0
  428. package/src/geometries/ConeGeometry.js +31 -0
  429. package/src/geometries/CylinderGeometry.js +286 -0
  430. package/src/geometries/DodecahedronGeometry.js +66 -0
  431. package/src/geometries/EdgesGeometry.js +152 -0
  432. package/src/geometries/ExtrudeGeometry.js +814 -0
  433. package/src/geometries/Geometries.js +21 -0
  434. package/src/geometries/IcosahedronGeometry.js +42 -0
  435. package/src/geometries/LatheGeometry.js +189 -0
  436. package/src/geometries/OctahedronGeometry.js +37 -0
  437. package/src/geometries/PlaneGeometry.js +98 -0
  438. package/src/geometries/PolyhedronGeometry.js +319 -0
  439. package/src/geometries/RingGeometry.js +128 -0
  440. package/src/geometries/ShapeGeometry.js +195 -0
  441. package/src/geometries/SphereGeometry.js +137 -0
  442. package/src/geometries/TetrahedronGeometry.js +34 -0
  443. package/src/geometries/TorusGeometry.js +120 -0
  444. package/src/geometries/TorusKnotGeometry.js +167 -0
  445. package/src/geometries/TubeGeometry.js +203 -0
  446. package/src/geometries/WireframeGeometry.js +147 -0
  447. package/src/helpers/ArrowHelper.js +114 -0
  448. package/src/helpers/AxesHelper.js +68 -0
  449. package/src/helpers/Box3Helper.js +55 -0
  450. package/src/helpers/BoxHelper.js +113 -0
  451. package/src/helpers/CameraHelper.js +269 -0
  452. package/src/helpers/DirectionalLightHelper.js +93 -0
  453. package/src/helpers/GridHelper.js +56 -0
  454. package/src/helpers/HemisphereLightHelper.js +88 -0
  455. package/src/helpers/PlaneHelper.js +63 -0
  456. package/src/helpers/PointLightHelper.js +92 -0
  457. package/src/helpers/PolarGridHelper.js +96 -0
  458. package/src/helpers/SkeletonHelper.js +128 -0
  459. package/src/helpers/SpotLightHelper.js +111 -0
  460. package/src/lights/AmbientLight.js +17 -0
  461. package/src/lights/DirectionalLight.js +43 -0
  462. package/src/lights/DirectionalLightShadow.js +16 -0
  463. package/src/lights/HemisphereLight.js +34 -0
  464. package/src/lights/Light.js +59 -0
  465. package/src/lights/LightProbe.js +47 -0
  466. package/src/lights/LightShadow.js +152 -0
  467. package/src/lights/PointLight.js +57 -0
  468. package/src/lights/PointLightShadow.js +96 -0
  469. package/src/lights/RectAreaLight.js +56 -0
  470. package/src/lights/SpotLight.js +71 -0
  471. package/src/lights/SpotLightShadow.js +50 -0
  472. package/src/lights/webgpu/IESSpotLight.js +25 -0
  473. package/src/loaders/AnimationLoader.js +66 -0
  474. package/src/loaders/AudioLoader.js +66 -0
  475. package/src/loaders/BufferGeometryLoader.js +217 -0
  476. package/src/loaders/Cache.js +42 -0
  477. package/src/loaders/CompressedTextureLoader.js +134 -0
  478. package/src/loaders/CubeTextureLoader.js +58 -0
  479. package/src/loaders/DataTextureLoader.js +131 -0
  480. package/src/loaders/FileLoader.js +288 -0
  481. package/src/loaders/ImageBitmapLoader.js +123 -0
  482. package/src/loaders/ImageLoader.js +91 -0
  483. package/src/loaders/Loader.js +72 -0
  484. package/src/loaders/LoaderUtils.js +77 -0
  485. package/src/loaders/LoadingManager.js +142 -0
  486. package/src/loaders/MaterialLoader.js +374 -0
  487. package/src/loaders/ObjectLoader.js +1183 -0
  488. package/src/loaders/TextureLoader.js +41 -0
  489. package/src/materials/LineBasicMaterial.js +49 -0
  490. package/src/materials/LineDashedMaterial.js +35 -0
  491. package/src/materials/Material.js +531 -0
  492. package/src/materials/Materials.js +39 -0
  493. package/src/materials/MeshBasicMaterial.js +84 -0
  494. package/src/materials/MeshDepthMaterial.js +54 -0
  495. package/src/materials/MeshDistanceMaterial.js +43 -0
  496. package/src/materials/MeshLambertMaterial.js +119 -0
  497. package/src/materials/MeshMatcapMaterial.js +81 -0
  498. package/src/materials/MeshNormalMaterial.js +61 -0
  499. package/src/materials/MeshPhongMaterial.js +123 -0
  500. package/src/materials/MeshPhysicalMaterial.js +244 -0
  501. package/src/materials/MeshStandardMaterial.js +127 -0
  502. package/src/materials/MeshToonMaterial.js +102 -0
  503. package/src/materials/PointsMaterial.js +50 -0
  504. package/src/materials/RawShaderMaterial.js +17 -0
  505. package/src/materials/ShaderMaterial.js +185 -0
  506. package/src/materials/ShadowMaterial.js +37 -0
  507. package/src/materials/SpriteMaterial.js +54 -0
  508. package/src/math/Box2.js +204 -0
  509. package/src/math/Box3.js +534 -0
  510. package/src/math/Color.js +623 -0
  511. package/src/math/ColorManagement.js +149 -0
  512. package/src/math/Cylindrical.js +61 -0
  513. package/src/math/Euler.js +315 -0
  514. package/src/math/Frustum.js +186 -0
  515. package/src/math/Interpolant.js +241 -0
  516. package/src/math/Line3.js +115 -0
  517. package/src/math/MathUtils.js +363 -0
  518. package/src/math/Matrix2.js +54 -0
  519. package/src/math/Matrix3.js +388 -0
  520. package/src/math/Matrix4.js +915 -0
  521. package/src/math/Plane.js +205 -0
  522. package/src/math/Quaternion.js +686 -0
  523. package/src/math/Ray.js +493 -0
  524. package/src/math/Sphere.js +245 -0
  525. package/src/math/Spherical.js +85 -0
  526. package/src/math/SphericalHarmonics3.js +243 -0
  527. package/src/math/Triangle.js +311 -0
  528. package/src/math/Vector2.js +480 -0
  529. package/src/math/Vector3.js +724 -0
  530. package/src/math/Vector4.js +657 -0
  531. package/src/math/interpolants/CubicInterpolant.js +150 -0
  532. package/src/math/interpolants/DiscreteInterpolant.js +26 -0
  533. package/src/math/interpolants/LinearInterpolant.js +38 -0
  534. package/src/math/interpolants/QuaternionLinearInterpolant.js +39 -0
  535. package/src/nodes/Nodes.js +225 -0
  536. package/src/nodes/accessors/AccessorsUtils.js +25 -0
  537. package/src/nodes/accessors/BatchNode.js +96 -0
  538. package/src/nodes/accessors/BitangentNode.js +13 -0
  539. package/src/nodes/accessors/BufferAttributeNode.js +162 -0
  540. package/src/nodes/accessors/BufferNode.js +36 -0
  541. package/src/nodes/accessors/CameraNode.js +19 -0
  542. package/src/nodes/accessors/ClippingNode.js +145 -0
  543. package/src/nodes/accessors/CubeTextureNode.js +78 -0
  544. package/src/nodes/accessors/InstanceNode.js +140 -0
  545. package/src/nodes/accessors/InstancedPointsMaterialNode.js +21 -0
  546. package/src/nodes/accessors/MaterialNode.js +435 -0
  547. package/src/nodes/accessors/MaterialProperties.js +3 -0
  548. package/src/nodes/accessors/MaterialReferenceNode.js +43 -0
  549. package/src/nodes/accessors/ModelNode.js +37 -0
  550. package/src/nodes/accessors/ModelViewProjectionNode.js +39 -0
  551. package/src/nodes/accessors/MorphNode.js +259 -0
  552. package/src/nodes/accessors/NormalNode.js +14 -0
  553. package/src/nodes/accessors/Object3DNode.js +150 -0
  554. package/src/nodes/accessors/PointUVNode.js +26 -0
  555. package/src/nodes/accessors/PositionNode.js +10 -0
  556. package/src/nodes/accessors/ReferenceNode.js +171 -0
  557. package/src/nodes/accessors/ReflectVectorNode.js +10 -0
  558. package/src/nodes/accessors/RendererReferenceNode.js +29 -0
  559. package/src/nodes/accessors/SceneNode.js +52 -0
  560. package/src/nodes/accessors/SkinningNode.js +124 -0
  561. package/src/nodes/accessors/StorageBufferNode.js +130 -0
  562. package/src/nodes/accessors/StorageTextureNode.js +104 -0
  563. package/src/nodes/accessors/TangentNode.js +23 -0
  564. package/src/nodes/accessors/Texture3DNode.js +100 -0
  565. package/src/nodes/accessors/TextureBicubicNode.js +94 -0
  566. package/src/nodes/accessors/TextureNode.js +445 -0
  567. package/src/nodes/accessors/TextureSizeNode.js +35 -0
  568. package/src/nodes/accessors/UVNode.js +3 -0
  569. package/src/nodes/accessors/UniformArrayNode.js +153 -0
  570. package/src/nodes/accessors/UserDataNode.js +29 -0
  571. package/src/nodes/accessors/VertexColorNode.js +71 -0
  572. package/src/nodes/code/CodeNode.js +84 -0
  573. package/src/nodes/code/ExpressionNode.js +37 -0
  574. package/src/nodes/code/FunctionCallNode.js +96 -0
  575. package/src/nodes/code/FunctionNode.js +130 -0
  576. package/src/nodes/code/ScriptableNode.js +502 -0
  577. package/src/nodes/code/ScriptableValueNode.js +168 -0
  578. package/src/nodes/core/AssignNode.js +128 -0
  579. package/src/nodes/core/AttributeNode.js +134 -0
  580. package/src/nodes/core/BypassNode.js +45 -0
  581. package/src/nodes/core/CacheNode.js +46 -0
  582. package/src/nodes/core/ConstNode.js +32 -0
  583. package/src/nodes/core/ContextNode.js +67 -0
  584. package/src/nodes/core/IndexNode.js +72 -0
  585. package/src/nodes/core/InputNode.js +83 -0
  586. package/src/nodes/core/LightingModel.js +17 -0
  587. package/src/nodes/core/MRTNode.js +76 -0
  588. package/src/nodes/core/Node.js +571 -0
  589. package/src/nodes/core/NodeAttribute.js +15 -0
  590. package/src/nodes/core/NodeBuilder.js +1403 -0
  591. package/src/nodes/core/NodeCache.js +36 -0
  592. package/src/nodes/core/NodeCode.js +15 -0
  593. package/src/nodes/core/NodeFrame.js +185 -0
  594. package/src/nodes/core/NodeFunction.js +22 -0
  595. package/src/nodes/core/NodeFunctionInput.js +17 -0
  596. package/src/nodes/core/NodeKeywords.js +80 -0
  597. package/src/nodes/core/NodeParser.js +11 -0
  598. package/src/nodes/core/NodeUniform.js +39 -0
  599. package/src/nodes/core/NodeUtils.js +215 -0
  600. package/src/nodes/core/NodeVar.js +14 -0
  601. package/src/nodes/core/NodeVarying.js +17 -0
  602. package/src/nodes/core/OutputStructNode.js +59 -0
  603. package/src/nodes/core/ParameterNode.js +33 -0
  604. package/src/nodes/core/PropertyNode.js +84 -0
  605. package/src/nodes/core/StackNode.js +89 -0
  606. package/src/nodes/core/StructTypeNode.js +24 -0
  607. package/src/nodes/core/TempNode.js +58 -0
  608. package/src/nodes/core/UniformGroup.js +13 -0
  609. package/src/nodes/core/UniformGroupNode.js +56 -0
  610. package/src/nodes/core/UniformNode.js +109 -0
  611. package/src/nodes/core/VarNode.js +56 -0
  612. package/src/nodes/core/VaryingNode.js +104 -0
  613. package/src/nodes/core/constants.js +28 -0
  614. package/src/nodes/display/AfterImageNode.js +152 -0
  615. package/src/nodes/display/AnamorphicNode.js +145 -0
  616. package/src/nodes/display/BleachBypassNode.js +28 -0
  617. package/src/nodes/display/BlendModeNode.js +128 -0
  618. package/src/nodes/display/BloomNode.js +333 -0
  619. package/src/nodes/display/BumpMapNode.js +80 -0
  620. package/src/nodes/display/ColorAdjustmentNode.js +104 -0
  621. package/src/nodes/display/ColorSpaceNode.js +108 -0
  622. package/src/nodes/display/DenoiseNode.js +198 -0
  623. package/src/nodes/display/DepthOfFieldNode.js +119 -0
  624. package/src/nodes/display/DotScreenNode.js +75 -0
  625. package/src/nodes/display/FXAANode.js +327 -0
  626. package/src/nodes/display/FilmNode.js +52 -0
  627. package/src/nodes/display/FrontFacingNode.js +41 -0
  628. package/src/nodes/display/GTAONode.js +324 -0
  629. package/src/nodes/display/GaussianBlurNode.js +207 -0
  630. package/src/nodes/display/Lut3DNode.js +53 -0
  631. package/src/nodes/display/NormalMapNode.js +106 -0
  632. package/src/nodes/display/PassNode.js +291 -0
  633. package/src/nodes/display/PixelationPassNode.js +201 -0
  634. package/src/nodes/display/PosterizeNode.js +32 -0
  635. package/src/nodes/display/RGBShiftNode.js +49 -0
  636. package/src/nodes/display/RenderOutputNode.js +56 -0
  637. package/src/nodes/display/SepiaNode.js +18 -0
  638. package/src/nodes/display/SobelOperatorNode.js +121 -0
  639. package/src/nodes/display/ToneMappingNode.js +227 -0
  640. package/src/nodes/display/TransitionNode.js +76 -0
  641. package/src/nodes/display/ViewportDepthNode.js +120 -0
  642. package/src/nodes/display/ViewportDepthTextureNode.js +32 -0
  643. package/src/nodes/display/ViewportNode.js +137 -0
  644. package/src/nodes/display/ViewportSharedTextureNode.js +38 -0
  645. package/src/nodes/display/ViewportTextureNode.js +81 -0
  646. package/src/nodes/fog/FogExp2Node.js +34 -0
  647. package/src/nodes/fog/FogNode.js +48 -0
  648. package/src/nodes/fog/FogRangeNode.js +35 -0
  649. package/src/nodes/functions/BSDF/BRDF_GGX.js +59 -0
  650. package/src/nodes/functions/BSDF/BRDF_Lambert.js +9 -0
  651. package/src/nodes/functions/BSDF/BRDF_Sheen.js +57 -0
  652. package/src/nodes/functions/BSDF/DFGApprox.js +30 -0
  653. package/src/nodes/functions/BSDF/D_GGX.js +23 -0
  654. package/src/nodes/functions/BSDF/D_GGX_Anisotropic.js +28 -0
  655. package/src/nodes/functions/BSDF/EnvironmentBRDF.js +13 -0
  656. package/src/nodes/functions/BSDF/F_Schlick.js +16 -0
  657. package/src/nodes/functions/BSDF/LTC.js +131 -0
  658. package/src/nodes/functions/BSDF/Schlick_to_F0.js +21 -0
  659. package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +26 -0
  660. package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +29 -0
  661. package/src/nodes/functions/BasicLightingModel.js +78 -0
  662. package/src/nodes/functions/PhongLightingModel.js +69 -0
  663. package/src/nodes/functions/PhysicalLightingModel.js +632 -0
  664. package/src/nodes/functions/ShadowMaskModel.js +31 -0
  665. package/src/nodes/functions/ToonLightingModel.js +51 -0
  666. package/src/nodes/functions/material/getGeometryRoughness.js +13 -0
  667. package/src/nodes/functions/material/getRoughness.js +18 -0
  668. package/src/nodes/geometry/RangeNode.js +117 -0
  669. package/src/nodes/gpgpu/ComputeNode.js +85 -0
  670. package/src/nodes/lighting/AONode.js +24 -0
  671. package/src/nodes/lighting/AmbientLightNode.js +27 -0
  672. package/src/nodes/lighting/AnalyticLightNode.js +334 -0
  673. package/src/nodes/lighting/BasicEnvironmentNode.js +26 -0
  674. package/src/nodes/lighting/BasicLightMapNode.js +29 -0
  675. package/src/nodes/lighting/DirectionalLightNode.js +40 -0
  676. package/src/nodes/lighting/EnvironmentNode.js +136 -0
  677. package/src/nodes/lighting/HemisphereLightNode.js +56 -0
  678. package/src/nodes/lighting/IESSpotLightNode.js +39 -0
  679. package/src/nodes/lighting/IrradianceNode.js +24 -0
  680. package/src/nodes/lighting/LightNode.js +57 -0
  681. package/src/nodes/lighting/LightUtils.js +17 -0
  682. package/src/nodes/lighting/LightingContextNode.js +66 -0
  683. package/src/nodes/lighting/LightingNode.js +23 -0
  684. package/src/nodes/lighting/LightsNode.js +213 -0
  685. package/src/nodes/lighting/PointLightNode.js +68 -0
  686. package/src/nodes/lighting/RectAreaLightNode.js +97 -0
  687. package/src/nodes/lighting/SpotLightNode.js +89 -0
  688. package/src/nodes/loaders/NodeLoader.js +110 -0
  689. package/src/nodes/loaders/NodeMaterialLoader.js +60 -0
  690. package/src/nodes/loaders/NodeObjectLoader.js +71 -0
  691. package/src/nodes/materials/InstancedPointsNodeMaterial.js +162 -0
  692. package/src/nodes/materials/Line2NodeMaterial.js +440 -0
  693. package/src/nodes/materials/LineBasicNodeMaterial.js +28 -0
  694. package/src/nodes/materials/LineDashedNodeMaterial.js +55 -0
  695. package/src/nodes/materials/Materials.js +20 -0
  696. package/src/nodes/materials/MeshBasicNodeMaterial.js +73 -0
  697. package/src/nodes/materials/MeshLambertNodeMaterial.js +43 -0
  698. package/src/nodes/materials/MeshMatcapNodeMaterial.js +53 -0
  699. package/src/nodes/materials/MeshNormalNodeMaterial.js +40 -0
  700. package/src/nodes/materials/MeshPhongNodeMaterial.js +74 -0
  701. package/src/nodes/materials/MeshPhysicalNodeMaterial.js +244 -0
  702. package/src/nodes/materials/MeshSSSNodeMaterial.js +84 -0
  703. package/src/nodes/materials/MeshStandardNodeMaterial.js +104 -0
  704. package/src/nodes/materials/MeshToonNodeMaterial.js +34 -0
  705. package/src/nodes/materials/NodeMaterial.js +680 -0
  706. package/src/nodes/materials/PointsNodeMaterial.js +39 -0
  707. package/src/nodes/materials/ShadowNodeMaterial.js +34 -0
  708. package/src/nodes/materials/SpriteNodeMaterial.js +90 -0
  709. package/src/nodes/materials/VolumeNodeMaterial.js +106 -0
  710. package/src/nodes/materialx/DISCLAIMER.md +199 -0
  711. package/src/nodes/materialx/MaterialXNodes.js +68 -0
  712. package/src/nodes/materialx/lib/mx_hsv.js +122 -0
  713. package/src/nodes/materialx/lib/mx_noise.js +1327 -0
  714. package/src/nodes/materialx/lib/mx_transform_color.js +23 -0
  715. package/src/nodes/math/CondNode.js +128 -0
  716. package/src/nodes/math/HashNode.js +34 -0
  717. package/src/nodes/math/MathNode.js +404 -0
  718. package/src/nodes/math/MathUtils.js +15 -0
  719. package/src/nodes/math/OperatorNode.js +306 -0
  720. package/src/nodes/math/TriNoise3D.js +71 -0
  721. package/src/nodes/parsers/GLSLNodeFunction.js +152 -0
  722. package/src/nodes/parsers/GLSLNodeParser.js +14 -0
  723. package/src/nodes/pmrem/PMREMNode.js +237 -0
  724. package/src/nodes/pmrem/PMREMUtils.js +288 -0
  725. package/src/nodes/procedural/CheckerNode.js +42 -0
  726. package/src/nodes/shadernode/ShaderNode.js +652 -0
  727. package/src/nodes/utils/ArrayElementNode.js +35 -0
  728. package/src/nodes/utils/ConvertNode.js +65 -0
  729. package/src/nodes/utils/DiscardNode.js +28 -0
  730. package/src/nodes/utils/EquirectUVNode.js +33 -0
  731. package/src/nodes/utils/FunctionOverloadingNode.js +97 -0
  732. package/src/nodes/utils/JoinNode.js +61 -0
  733. package/src/nodes/utils/LoopNode.js +201 -0
  734. package/src/nodes/utils/MatcapUVNode.js +30 -0
  735. package/src/nodes/utils/MaxMipLevelNode.js +52 -0
  736. package/src/nodes/utils/OscNode.js +81 -0
  737. package/src/nodes/utils/PackingNode.js +55 -0
  738. package/src/nodes/utils/RTTNode.js +130 -0
  739. package/src/nodes/utils/ReflectorNode.js +235 -0
  740. package/src/nodes/utils/RemapNode.js +42 -0
  741. package/src/nodes/utils/RotateNode.js +68 -0
  742. package/src/nodes/utils/SetNode.js +62 -0
  743. package/src/nodes/utils/SplitNode.js +112 -0
  744. package/src/nodes/utils/SpriteSheetUVNode.js +41 -0
  745. package/src/nodes/utils/SpriteUtils.js +47 -0
  746. package/src/nodes/utils/StorageArrayElementNode.js +91 -0
  747. package/src/nodes/utils/TimerNode.js +94 -0
  748. package/src/nodes/utils/TriplanarTexturesNode.js +62 -0
  749. package/src/nodes/utils/UVUtils.js +21 -0
  750. package/src/nodes/utils/ViewportUtils.js +14 -0
  751. package/src/objects/BatchedMesh.js +1113 -0
  752. package/src/objects/Bone.js +17 -0
  753. package/src/objects/Group.js +17 -0
  754. package/src/objects/InstancedMesh.js +277 -0
  755. package/src/objects/LOD.js +214 -0
  756. package/src/objects/Line.js +245 -0
  757. package/src/objects/LineLoop.js +17 -0
  758. package/src/objects/LineSegments.js +55 -0
  759. package/src/objects/Mesh.js +428 -0
  760. package/src/objects/Points.js +166 -0
  761. package/src/objects/Skeleton.js +277 -0
  762. package/src/objects/SkinnedMesh.js +257 -0
  763. package/src/objects/Sprite.js +181 -0
  764. package/src/renderers/WebGL3DRenderTarget.js +22 -0
  765. package/src/renderers/WebGLArrayRenderTarget.js +22 -0
  766. package/src/renderers/WebGLCubeRenderTarget.js +146 -0
  767. package/src/renderers/WebGLRenderTarget.js +15 -0
  768. package/src/renderers/WebGLRenderer.js +2847 -0
  769. package/src/renderers/common/Animation.js +50 -0
  770. package/src/renderers/common/Attributes.js +78 -0
  771. package/src/renderers/common/Backend.js +198 -0
  772. package/src/renderers/common/Background.js +141 -0
  773. package/src/renderers/common/BindGroup.js +17 -0
  774. package/src/renderers/common/Binding.js +25 -0
  775. package/src/renderers/common/Bindings.js +205 -0
  776. package/src/renderers/common/Buffer.js +38 -0
  777. package/src/renderers/common/BufferUtils.js +33 -0
  778. package/src/renderers/common/ChainMap.js +59 -0
  779. package/src/renderers/common/ClippingContext.js +167 -0
  780. package/src/renderers/common/Color4.js +37 -0
  781. package/src/renderers/common/ComputePipeline.js +17 -0
  782. package/src/renderers/common/Constants.js +14 -0
  783. package/src/renderers/common/CubeRenderTarget.js +71 -0
  784. package/src/renderers/common/DataMap.js +54 -0
  785. package/src/renderers/common/Geometries.js +247 -0
  786. package/src/renderers/common/Info.js +127 -0
  787. package/src/renderers/common/Pipeline.js +13 -0
  788. package/src/renderers/common/Pipelines.js +322 -0
  789. package/src/renderers/common/PostProcessing.js +87 -0
  790. package/src/renderers/common/ProgrammableStage.js +20 -0
  791. package/src/renderers/common/QuadMesh.js +53 -0
  792. package/src/renderers/common/RenderBundle.js +18 -0
  793. package/src/renderers/common/RenderBundles.js +38 -0
  794. package/src/renderers/common/RenderContext.js +43 -0
  795. package/src/renderers/common/RenderContexts.js +63 -0
  796. package/src/renderers/common/RenderList.js +195 -0
  797. package/src/renderers/common/RenderLists.js +38 -0
  798. package/src/renderers/common/RenderObject.js +302 -0
  799. package/src/renderers/common/RenderObjects.js +93 -0
  800. package/src/renderers/common/RenderPipeline.js +16 -0
  801. package/src/renderers/common/Renderer.js +1632 -0
  802. package/src/renderers/common/SampledTexture.js +83 -0
  803. package/src/renderers/common/Sampler.js +18 -0
  804. package/src/renderers/common/StorageBuffer.js +17 -0
  805. package/src/renderers/common/StorageBufferAttribute.js +17 -0
  806. package/src/renderers/common/StorageInstancedBufferAttribute.js +17 -0
  807. package/src/renderers/common/StorageTexture.js +21 -0
  808. package/src/renderers/common/Textures.js +348 -0
  809. package/src/renderers/common/Uniform.js +145 -0
  810. package/src/renderers/common/UniformBuffer.js +15 -0
  811. package/src/renderers/common/UniformsGroup.js +339 -0
  812. package/src/renderers/common/extras/PMREMGenerator.js +774 -0
  813. package/src/renderers/common/nodes/NodeBuilderState.js +58 -0
  814. package/src/renderers/common/nodes/NodeSampledTexture.js +64 -0
  815. package/src/renderers/common/nodes/NodeSampler.js +22 -0
  816. package/src/renderers/common/nodes/NodeStorageBuffer.js +27 -0
  817. package/src/renderers/common/nodes/NodeUniform.js +135 -0
  818. package/src/renderers/common/nodes/NodeUniformBuffer.js +24 -0
  819. package/src/renderers/common/nodes/NodeUniformsGroup.js +38 -0
  820. package/src/renderers/common/nodes/Nodes.js +488 -0
  821. package/src/renderers/shaders/ShaderChunk/alphahash_fragment.glsl.js +7 -0
  822. package/src/renderers/shaders/ShaderChunk/alphahash_pars_fragment.glsl.js +68 -0
  823. package/src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl.js +7 -0
  824. package/src/renderers/shaders/ShaderChunk/alphamap_pars_fragment.glsl.js +7 -0
  825. package/src/renderers/shaders/ShaderChunk/alphatest_fragment.glsl.js +16 -0
  826. package/src/renderers/shaders/ShaderChunk/alphatest_pars_fragment.glsl.js +5 -0
  827. package/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js +26 -0
  828. package/src/renderers/shaders/ShaderChunk/aomap_pars_fragment.glsl.js +8 -0
  829. package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +49 -0
  830. package/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +7 -0
  831. package/src/renderers/shaders/ShaderChunk/begin_vertex.glsl.js +9 -0
  832. package/src/renderers/shaders/ShaderChunk/beginnormal_vertex.glsl.js +9 -0
  833. package/src/renderers/shaders/ShaderChunk/bsdfs.glsl.js +33 -0
  834. package/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js +43 -0
  835. package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.js +7 -0
  836. package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.js +10 -0
  837. package/src/renderers/shaders/ShaderChunk/clearcoat_pars_fragment.glsl.js +21 -0
  838. package/src/renderers/shaders/ShaderChunk/clipping_planes_fragment.glsl.js +78 -0
  839. package/src/renderers/shaders/ShaderChunk/clipping_planes_pars_fragment.glsl.js +9 -0
  840. package/src/renderers/shaders/ShaderChunk/clipping_planes_pars_vertex.glsl.js +7 -0
  841. package/src/renderers/shaders/ShaderChunk/clipping_planes_vertex.glsl.js +7 -0
  842. package/src/renderers/shaders/ShaderChunk/color_fragment.glsl.js +11 -0
  843. package/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.js +11 -0
  844. package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +11 -0
  845. package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +31 -0
  846. package/src/renderers/shaders/ShaderChunk/colorspace_fragment.glsl.js +3 -0
  847. package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +35 -0
  848. package/src/renderers/shaders/ShaderChunk/common.glsl.js +137 -0
  849. package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +186 -0
  850. package/src/renderers/shaders/ShaderChunk/default_fragment.glsl.js +5 -0
  851. package/src/renderers/shaders/ShaderChunk/default_vertex.glsl.js +5 -0
  852. package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +63 -0
  853. package/src/renderers/shaders/ShaderChunk/displacementmap_pars_vertex.glsl.js +9 -0
  854. package/src/renderers/shaders/ShaderChunk/displacementmap_vertex.glsl.js +7 -0
  855. package/src/renderers/shaders/ShaderChunk/dithering_fragment.glsl.js +7 -0
  856. package/src/renderers/shaders/ShaderChunk/dithering_pars_fragment.glsl.js +20 -0
  857. package/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.js +9 -0
  858. package/src/renderers/shaders/ShaderChunk/emissivemap_pars_fragment.glsl.js +7 -0
  859. package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +15 -0
  860. package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +62 -0
  861. package/src/renderers/shaders/ShaderChunk/envmap_pars_fragment.glsl.js +21 -0
  862. package/src/renderers/shaders/ShaderChunk/envmap_pars_vertex.glsl.js +22 -0
  863. package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +69 -0
  864. package/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.js +37 -0
  865. package/src/renderers/shaders/ShaderChunk/fog_fragment.glsl.js +17 -0
  866. package/src/renderers/shaders/ShaderChunk/fog_pars_fragment.glsl.js +19 -0
  867. package/src/renderers/shaders/ShaderChunk/fog_pars_vertex.glsl.js +7 -0
  868. package/src/renderers/shaders/ShaderChunk/fog_vertex.glsl.js +7 -0
  869. package/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.js +27 -0
  870. package/src/renderers/shaders/ShaderChunk/iridescence_fragment.glsl.js +120 -0
  871. package/src/renderers/shaders/ShaderChunk/iridescence_pars_fragment.glsl.js +14 -0
  872. package/src/renderers/shaders/ShaderChunk/lightmap_pars_fragment.glsl.js +8 -0
  873. package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +202 -0
  874. package/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js +13 -0
  875. package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +40 -0
  876. package/src/renderers/shaders/ShaderChunk/lights_lambert_fragment.glsl.js +5 -0
  877. package/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.js +28 -0
  878. package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +214 -0
  879. package/src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl.js +7 -0
  880. package/src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl.js +32 -0
  881. package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +157 -0
  882. package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +563 -0
  883. package/src/renderers/shaders/ShaderChunk/lights_toon_fragment.glsl.js +4 -0
  884. package/src/renderers/shaders/ShaderChunk/lights_toon_pars_fragment.glsl.js +26 -0
  885. package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +9 -0
  886. package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +9 -0
  887. package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +8 -0
  888. package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +8 -0
  889. package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +17 -0
  890. package/src/renderers/shaders/ShaderChunk/map_pars_fragment.glsl.js +7 -0
  891. package/src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl.js +27 -0
  892. package/src/renderers/shaders/ShaderChunk/map_particle_pars_fragment.glsl.js +27 -0
  893. package/src/renderers/shaders/ShaderChunk/metalnessmap_fragment.glsl.js +12 -0
  894. package/src/renderers/shaders/ShaderChunk/metalnessmap_pars_fragment.glsl.js +7 -0
  895. package/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.js +24 -0
  896. package/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.js +14 -0
  897. package/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js +16 -0
  898. package/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.js +26 -0
  899. package/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js +16 -0
  900. package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +76 -0
  901. package/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js +33 -0
  902. package/src/renderers/shaders/ShaderChunk/normal_pars_fragment.glsl.js +14 -0
  903. package/src/renderers/shaders/ShaderChunk/normal_pars_vertex.glsl.js +14 -0
  904. package/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.js +14 -0
  905. package/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js +43 -0
  906. package/src/renderers/shaders/ShaderChunk/opaque_fragment.glsl.js +11 -0
  907. package/src/renderers/shaders/ShaderChunk/packing.glsl.js +100 -0
  908. package/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.js +8 -0
  909. package/src/renderers/shaders/ShaderChunk/project_vertex.glsl.js +19 -0
  910. package/src/renderers/shaders/ShaderChunk/roughnessmap_fragment.glsl.js +12 -0
  911. package/src/renderers/shaders/ShaderChunk/roughnessmap_pars_fragment.glsl.js +7 -0
  912. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +327 -0
  913. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +71 -0
  914. package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +68 -0
  915. package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +66 -0
  916. package/src/renderers/shaders/ShaderChunk/skinbase_vertex.glsl.js +10 -0
  917. package/src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl.js +25 -0
  918. package/src/renderers/shaders/ShaderChunk/skinning_vertex.glsl.js +15 -0
  919. package/src/renderers/shaders/ShaderChunk/skinnormal_vertex.glsl.js +20 -0
  920. package/src/renderers/shaders/ShaderChunk/specularmap_fragment.glsl.js +14 -0
  921. package/src/renderers/shaders/ShaderChunk/specularmap_pars_fragment.glsl.js +7 -0
  922. package/src/renderers/shaders/ShaderChunk/tonemapping_fragment.glsl.js +7 -0
  923. package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +200 -0
  924. package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +36 -0
  925. package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +235 -0
  926. package/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.js +119 -0
  927. package/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.js +145 -0
  928. package/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.js +122 -0
  929. package/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.js +21 -0
  930. package/src/renderers/shaders/ShaderChunk.js +270 -0
  931. package/src/renderers/shaders/ShaderLib/background.glsl.js +40 -0
  932. package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +63 -0
  933. package/src/renderers/shaders/ShaderLib/cube.glsl.js +36 -0
  934. package/src/renderers/shaders/ShaderLib/depth.glsl.js +105 -0
  935. package/src/renderers/shaders/ShaderLib/distanceRGBA.glsl.js +78 -0
  936. package/src/renderers/shaders/ShaderLib/equirect.glsl.js +35 -0
  937. package/src/renderers/shaders/ShaderLib/linedashed.glsl.js +78 -0
  938. package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +116 -0
  939. package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +125 -0
  940. package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +112 -0
  941. package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +87 -0
  942. package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +127 -0
  943. package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +229 -0
  944. package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +119 -0
  945. package/src/renderers/shaders/ShaderLib/points.glsl.js +89 -0
  946. package/src/renderers/shaders/ShaderLib/shadow.glsl.js +58 -0
  947. package/src/renderers/shaders/ShaderLib/sprite.glsl.js +81 -0
  948. package/src/renderers/shaders/ShaderLib/vsm.glsl.js +53 -0
  949. package/src/renderers/shaders/ShaderLib.js +361 -0
  950. package/src/renderers/shaders/UniformsLib.js +234 -0
  951. package/src/renderers/shaders/UniformsUtils.js +113 -0
  952. package/src/renderers/webgl/WebGLAnimation.js +53 -0
  953. package/src/renderers/webgl/WebGLAttributes.js +202 -0
  954. package/src/renderers/webgl/WebGLBackground.js +278 -0
  955. package/src/renderers/webgl/WebGLBindingStates.js +594 -0
  956. package/src/renderers/webgl/WebGLBufferRenderer.js +93 -0
  957. package/src/renderers/webgl/WebGLCapabilities.js +142 -0
  958. package/src/renderers/webgl/WebGLClipping.js +171 -0
  959. package/src/renderers/webgl/WebGLCubeMaps.js +99 -0
  960. package/src/renderers/webgl/WebGLCubeUVMaps.js +134 -0
  961. package/src/renderers/webgl/WebGLExtensions.js +84 -0
  962. package/src/renderers/webgl/WebGLGeometries.js +211 -0
  963. package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +104 -0
  964. package/src/renderers/webgl/WebGLInfo.js +71 -0
  965. package/src/renderers/webgl/WebGLLights.js +567 -0
  966. package/src/renderers/webgl/WebGLMaterials.js +591 -0
  967. package/src/renderers/webgl/WebGLMorphtargets.js +168 -0
  968. package/src/renderers/webgl/WebGLObjects.js +92 -0
  969. package/src/renderers/webgl/WebGLProgram.js +1087 -0
  970. package/src/renderers/webgl/WebGLPrograms.js +658 -0
  971. package/src/renderers/webgl/WebGLProperties.js +55 -0
  972. package/src/renderers/webgl/WebGLRenderLists.js +238 -0
  973. package/src/renderers/webgl/WebGLRenderStates.js +113 -0
  974. package/src/renderers/webgl/WebGLShader.js +12 -0
  975. package/src/renderers/webgl/WebGLShaderCache.js +124 -0
  976. package/src/renderers/webgl/WebGLShadowMap.js +424 -0
  977. package/src/renderers/webgl/WebGLState.js +1274 -0
  978. package/src/renderers/webgl/WebGLTextures.js +2146 -0
  979. package/src/renderers/webgl/WebGLUniforms.js +1166 -0
  980. package/src/renderers/webgl/WebGLUniformsGroups.js +392 -0
  981. package/src/renderers/webgl/WebGLUtils.js +214 -0
  982. package/src/renderers/webgl-fallback/WebGLBackend.js +1593 -0
  983. package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +145 -0
  984. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +987 -0
  985. package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +258 -0
  986. package/src/renderers/webgl-fallback/utils/WebGLCapabilities.js +36 -0
  987. package/src/renderers/webgl-fallback/utils/WebGLConstants.js +13 -0
  988. package/src/renderers/webgl-fallback/utils/WebGLExtensions.js +38 -0
  989. package/src/renderers/webgl-fallback/utils/WebGLState.js +738 -0
  990. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +870 -0
  991. package/src/renderers/webgl-fallback/utils/WebGLUtils.js +268 -0
  992. package/src/renderers/webgpu/WebGPUBackend.js +1473 -0
  993. package/src/renderers/webgpu/WebGPURenderer.js +53 -0
  994. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +1287 -0
  995. package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +159 -0
  996. package/src/renderers/webgpu/nodes/WGSLNodeParser.js +14 -0
  997. package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +322 -0
  998. package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +274 -0
  999. package/src/renderers/webgpu/utils/WebGPUConstants.js +332 -0
  1000. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +641 -0
  1001. package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +285 -0
  1002. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +1190 -0
  1003. package/src/renderers/webgpu/utils/WebGPUUtils.js +114 -0
  1004. package/src/renderers/webxr/WebXRController.js +343 -0
  1005. package/src/renderers/webxr/WebXRDepthSensing.js +110 -0
  1006. package/src/renderers/webxr/WebXRManager.js +832 -0
  1007. package/src/scenes/Fog.js +38 -0
  1008. package/src/scenes/FogExp2.js +35 -0
  1009. package/src/scenes/Scene.js +77 -0
  1010. package/src/textures/CanvasTexture.js +17 -0
  1011. package/src/textures/CompressedArrayTexture.js +32 -0
  1012. package/src/textures/CompressedCubeTexture.js +19 -0
  1013. package/src/textures/CompressedTexture.js +28 -0
  1014. package/src/textures/CubeTexture.js +33 -0
  1015. package/src/textures/Data3DTexture.js +35 -0
  1016. package/src/textures/DataArrayTexture.js +41 -0
  1017. package/src/textures/DataTexture.js +22 -0
  1018. package/src/textures/DepthTexture.js +56 -0
  1019. package/src/textures/FramebufferTexture.js +23 -0
  1020. package/src/textures/Source.js +128 -0
  1021. package/src/textures/Texture.js +320 -0
  1022. package/src/textures/VideoTexture.js +55 -0
  1023. package/src/utils.js +120 -0
@@ -0,0 +1,1190 @@
1
+ import {
2
+ GPUTextureFormat, GPUAddressMode, GPUFilterMode, GPUTextureDimension, GPUFeatureName
3
+ } from './WebGPUConstants.js';
4
+
5
+ import WebGPUTexturePassUtils from './WebGPUTexturePassUtils.js';
6
+
7
+ import {
8
+ ByteType, ShortType,
9
+ NearestFilter, NearestMipmapNearestFilter, NearestMipmapLinearFilter,
10
+ RepeatWrapping, MirroredRepeatWrapping,
11
+ RGB_ETC2_Format, RGBA_ETC2_EAC_Format,
12
+ RGBAFormat, RGBFormat, RedFormat, RGFormat, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, UnsignedByteType, FloatType, HalfFloatType, SRGBColorSpace, DepthFormat, DepthStencilFormat,
13
+ RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format,
14
+ RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, UnsignedIntType, UnsignedShortType, UnsignedInt248Type, UnsignedInt5999Type,
15
+ NeverCompare, AlwaysCompare, LessCompare, LessEqualCompare, EqualCompare, GreaterEqualCompare, GreaterCompare, NotEqualCompare, IntType, RedIntegerFormat, RGIntegerFormat, RGBAIntegerFormat,
16
+ CubeReflectionMapping, CubeRefractionMapping, EquirectangularReflectionMapping, EquirectangularRefractionMapping
17
+ } from '../../../constants.js';
18
+ import { CubeTexture } from '../../../textures/CubeTexture.js';
19
+ import { DepthTexture } from '../../../textures/DepthTexture.js';
20
+ import { Texture } from '../../../textures/Texture.js';
21
+
22
+ const _compareToWebGPU = {
23
+ [ NeverCompare ]: 'never',
24
+ [ LessCompare ]: 'less',
25
+ [ EqualCompare ]: 'equal',
26
+ [ LessEqualCompare ]: 'less-equal',
27
+ [ GreaterCompare ]: 'greater',
28
+ [ GreaterEqualCompare ]: 'greater-equal',
29
+ [ AlwaysCompare ]: 'always',
30
+ [ NotEqualCompare ]: 'not-equal'
31
+ };
32
+
33
+ const _flipMap = [ 0, 1, 3, 2, 4, 5 ];
34
+
35
+ class WebGPUTextureUtils {
36
+
37
+ constructor( backend ) {
38
+
39
+ this.backend = backend;
40
+
41
+ this._passUtils = null;
42
+
43
+ this.defaultTexture = {};
44
+ this.defaultCubeTexture = {};
45
+ this.defaultVideoFrame = null;
46
+
47
+ this.colorBuffer = null;
48
+
49
+ this.depthTexture = new DepthTexture();
50
+ this.depthTexture.name = 'depthBuffer';
51
+
52
+ }
53
+
54
+ createSampler( texture ) {
55
+
56
+ const backend = this.backend;
57
+ const device = backend.device;
58
+
59
+ const textureGPU = backend.get( texture );
60
+
61
+ const samplerDescriptorGPU = {
62
+ addressModeU: this._convertAddressMode( texture.wrapS ),
63
+ addressModeV: this._convertAddressMode( texture.wrapT ),
64
+ addressModeW: this._convertAddressMode( texture.wrapR ),
65
+ magFilter: this._convertFilterMode( texture.magFilter ),
66
+ minFilter: this._convertFilterMode( texture.minFilter ),
67
+ mipmapFilter: this._convertFilterMode( texture.minFilter ),
68
+ maxAnisotropy: texture.anisotropy
69
+ };
70
+
71
+ if ( texture.isDepthTexture && texture.compareFunction !== null ) {
72
+
73
+ samplerDescriptorGPU.compare = _compareToWebGPU[ texture.compareFunction ];
74
+
75
+ }
76
+
77
+ textureGPU.sampler = device.createSampler( samplerDescriptorGPU );
78
+
79
+ }
80
+
81
+ createDefaultTexture( texture ) {
82
+
83
+ let textureGPU;
84
+
85
+ const format = getFormat( texture );
86
+
87
+ if ( texture.isCubeTexture ) {
88
+
89
+ textureGPU = this._getDefaultCubeTextureGPU( format );
90
+
91
+ } else if ( texture.isVideoTexture ) {
92
+
93
+ this.backend.get( texture ).externalTexture = this._getDefaultVideoFrame();
94
+
95
+ } else {
96
+
97
+ textureGPU = this._getDefaultTextureGPU( format );
98
+
99
+ }
100
+
101
+ this.backend.get( texture ).texture = textureGPU;
102
+
103
+ }
104
+
105
+ createTexture( texture, options = {} ) {
106
+
107
+ const backend = this.backend;
108
+ const textureData = backend.get( texture );
109
+
110
+ if ( textureData.initialized ) {
111
+
112
+ throw new Error( 'WebGPUTextureUtils: Texture already initialized.' );
113
+
114
+ }
115
+
116
+ if ( options.needsMipmaps === undefined ) options.needsMipmaps = false;
117
+ if ( options.levels === undefined ) options.levels = 1;
118
+ if ( options.depth === undefined ) options.depth = 1;
119
+
120
+ const { width, height, depth, levels } = options;
121
+
122
+ const dimension = this._getDimension( texture );
123
+ const format = texture.internalFormat || options.format || getFormat( texture, backend.device );
124
+
125
+ let sampleCount = options.sampleCount !== undefined ? options.sampleCount : 1;
126
+
127
+ sampleCount = backend.utils.getSampleCount( sampleCount );
128
+
129
+ const primarySampleCount = texture.isRenderTargetTexture && ! texture.isMultisampleRenderTargetTexture ? 1 : sampleCount;
130
+
131
+ let usage = GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.COPY_SRC;
132
+
133
+ if ( texture.isStorageTexture === true ) {
134
+
135
+ usage |= GPUTextureUsage.STORAGE_BINDING;
136
+
137
+ }
138
+
139
+ if ( texture.isCompressedTexture !== true ) {
140
+
141
+ usage |= GPUTextureUsage.RENDER_ATTACHMENT;
142
+
143
+ }
144
+
145
+ const textureDescriptorGPU = {
146
+ label: texture.name,
147
+ size: {
148
+ width: width,
149
+ height: height,
150
+ depthOrArrayLayers: depth,
151
+ },
152
+ mipLevelCount: levels,
153
+ sampleCount: primarySampleCount,
154
+ dimension: dimension,
155
+ format: format,
156
+ usage: usage
157
+ };
158
+
159
+ // texture creation
160
+
161
+ if ( texture.isVideoTexture ) {
162
+
163
+ const video = texture.source.data;
164
+ const videoFrame = new VideoFrame( video );
165
+
166
+ textureDescriptorGPU.size.width = videoFrame.displayWidth;
167
+ textureDescriptorGPU.size.height = videoFrame.displayHeight;
168
+
169
+ videoFrame.close();
170
+
171
+ textureData.externalTexture = video;
172
+
173
+ } else {
174
+
175
+ if ( format === undefined ) {
176
+
177
+ console.warn( 'WebGPURenderer: Texture format not supported.' );
178
+
179
+ return this.createDefaultTexture( texture );
180
+
181
+ }
182
+
183
+ textureData.texture = backend.device.createTexture( textureDescriptorGPU );
184
+
185
+ }
186
+
187
+ if ( texture.isRenderTargetTexture && sampleCount > 1 && ! texture.isMultisampleRenderTargetTexture ) {
188
+
189
+ const msaaTextureDescriptorGPU = Object.assign( {}, textureDescriptorGPU );
190
+
191
+ msaaTextureDescriptorGPU.label = msaaTextureDescriptorGPU.label + '-msaa';
192
+ msaaTextureDescriptorGPU.sampleCount = sampleCount;
193
+
194
+ textureData.msaaTexture = backend.device.createTexture( msaaTextureDescriptorGPU );
195
+
196
+ }
197
+
198
+ textureData.initialized = true;
199
+
200
+ textureData.textureDescriptorGPU = textureDescriptorGPU;
201
+
202
+ }
203
+
204
+ destroyTexture( texture ) {
205
+
206
+ const backend = this.backend;
207
+ const textureData = backend.get( texture );
208
+
209
+ textureData.texture.destroy();
210
+
211
+ if ( textureData.msaaTexture !== undefined ) textureData.msaaTexture.destroy();
212
+
213
+ backend.delete( texture );
214
+
215
+ }
216
+
217
+ destroySampler( texture ) {
218
+
219
+ const backend = this.backend;
220
+ const textureData = backend.get( texture );
221
+
222
+ delete textureData.sampler;
223
+
224
+ }
225
+
226
+ generateMipmaps( texture ) {
227
+
228
+ const textureData = this.backend.get( texture );
229
+
230
+ if ( texture.isCubeTexture ) {
231
+
232
+ for ( let i = 0; i < 6; i ++ ) {
233
+
234
+ this._generateMipmaps( textureData.texture, textureData.textureDescriptorGPU, i );
235
+
236
+ }
237
+
238
+ } else {
239
+
240
+ this._generateMipmaps( textureData.texture, textureData.textureDescriptorGPU );
241
+
242
+ }
243
+
244
+ }
245
+
246
+ getColorBuffer() {
247
+
248
+ if ( this.colorBuffer ) this.colorBuffer.destroy();
249
+
250
+ const backend = this.backend;
251
+ const { width, height } = backend.getDrawingBufferSize();
252
+
253
+ this.colorBuffer = backend.device.createTexture( {
254
+ label: 'colorBuffer',
255
+ size: {
256
+ width: width,
257
+ height: height,
258
+ depthOrArrayLayers: 1
259
+ },
260
+ sampleCount: backend.utils.getSampleCount( backend.renderer.samples ),
261
+ format: GPUTextureFormat.BGRA8Unorm,
262
+ usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.COPY_SRC
263
+ } );
264
+
265
+ return this.colorBuffer;
266
+
267
+ }
268
+
269
+ getDepthBuffer( depth = true, stencil = false ) {
270
+
271
+ const backend = this.backend;
272
+ const { width, height } = backend.getDrawingBufferSize();
273
+
274
+ const depthTexture = this.depthTexture;
275
+ const depthTextureGPU = backend.get( depthTexture ).texture;
276
+
277
+ let format, type;
278
+
279
+ if ( stencil ) {
280
+
281
+ format = DepthStencilFormat;
282
+ type = UnsignedInt248Type;
283
+
284
+ } else if ( depth ) {
285
+
286
+ format = DepthFormat;
287
+ type = UnsignedIntType;
288
+
289
+ }
290
+
291
+ if ( depthTextureGPU !== undefined ) {
292
+
293
+ if ( depthTexture.image.width === width && depthTexture.image.height === height && depthTexture.format === format && depthTexture.type === type ) {
294
+
295
+ return depthTextureGPU;
296
+
297
+ }
298
+
299
+ this.destroyTexture( depthTexture );
300
+
301
+ }
302
+
303
+ depthTexture.name = 'depthBuffer';
304
+ depthTexture.format = format;
305
+ depthTexture.type = type;
306
+ depthTexture.image.width = width;
307
+ depthTexture.image.height = height;
308
+
309
+ this.createTexture( depthTexture, { sampleCount: backend.utils.getSampleCount( backend.renderer.samples ), width, height } );
310
+
311
+ return backend.get( depthTexture ).texture;
312
+
313
+ }
314
+
315
+ updateTexture( texture, options ) {
316
+
317
+ const textureData = this.backend.get( texture );
318
+
319
+ const { textureDescriptorGPU } = textureData;
320
+
321
+ if ( texture.isRenderTargetTexture || ( textureDescriptorGPU === undefined /* unsupported texture format */ ) )
322
+ return;
323
+
324
+ // transfer texture data
325
+
326
+ if ( texture.isDataTexture ) {
327
+
328
+ this._copyBufferToTexture( options.image, textureData.texture, textureDescriptorGPU, 0, texture.flipY );
329
+
330
+ } else if ( texture.isDataArrayTexture || texture.isData3DTexture ) {
331
+
332
+ for ( let i = 0; i < options.image.depth; i ++ ) {
333
+
334
+ this._copyBufferToTexture( options.image, textureData.texture, textureDescriptorGPU, i, texture.flipY, i );
335
+
336
+ }
337
+
338
+ } else if ( texture.isCompressedTexture ) {
339
+
340
+ this._copyCompressedBufferToTexture( texture.mipmaps, textureData.texture, textureDescriptorGPU );
341
+
342
+ } else if ( texture.isCubeTexture ) {
343
+
344
+ this._copyCubeMapToTexture( options.images, textureData.texture, textureDescriptorGPU, texture.flipY );
345
+
346
+ } else if ( texture.isVideoTexture ) {
347
+
348
+ const video = texture.source.data;
349
+
350
+ textureData.externalTexture = video;
351
+
352
+ } else {
353
+
354
+ this._copyImageToTexture( options.image, textureData.texture, textureDescriptorGPU, 0, texture.flipY );
355
+
356
+ }
357
+
358
+ //
359
+
360
+ textureData.version = texture.version;
361
+
362
+ if ( texture.onUpdate ) texture.onUpdate( texture );
363
+
364
+ }
365
+
366
+ async copyTextureToBuffer( texture, x, y, width, height ) {
367
+
368
+ const device = this.backend.device;
369
+
370
+ const textureData = this.backend.get( texture );
371
+ const textureGPU = textureData.texture;
372
+ const format = textureData.textureDescriptorGPU.format;
373
+ const bytesPerTexel = this._getBytesPerTexel( format );
374
+
375
+ let bytesPerRow = width * bytesPerTexel;
376
+ bytesPerRow = Math.ceil( bytesPerRow / 256 ) * 256; // Align to 256 bytes
377
+
378
+ const readBuffer = device.createBuffer(
379
+ {
380
+ size: width * height * bytesPerTexel,
381
+ usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ
382
+ }
383
+ );
384
+
385
+ const encoder = device.createCommandEncoder();
386
+
387
+ encoder.copyTextureToBuffer(
388
+ {
389
+ texture: textureGPU,
390
+ origin: { x, y },
391
+ },
392
+ {
393
+ buffer: readBuffer,
394
+ bytesPerRow: bytesPerRow
395
+ },
396
+ {
397
+ width: width,
398
+ height: height
399
+ }
400
+
401
+ );
402
+
403
+ const typedArrayType = this._getTypedArrayType( format );
404
+
405
+ device.queue.submit( [ encoder.finish() ] );
406
+
407
+ await readBuffer.mapAsync( GPUMapMode.READ );
408
+
409
+ const buffer = readBuffer.getMappedRange();
410
+
411
+ return new typedArrayType( buffer );
412
+
413
+ }
414
+
415
+ _isEnvironmentTexture( texture ) {
416
+
417
+ const mapping = texture.mapping;
418
+
419
+ return ( mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping ) || ( mapping === CubeReflectionMapping || mapping === CubeRefractionMapping );
420
+
421
+ }
422
+
423
+ _getDefaultTextureGPU( format ) {
424
+
425
+ let defaultTexture = this.defaultTexture[ format ];
426
+
427
+ if ( defaultTexture === undefined ) {
428
+
429
+ const texture = new Texture();
430
+ texture.minFilter = NearestFilter;
431
+ texture.magFilter = NearestFilter;
432
+
433
+ this.createTexture( texture, { width: 1, height: 1, format } );
434
+
435
+ this.defaultTexture[ format ] = defaultTexture = texture;
436
+
437
+ }
438
+
439
+ return this.backend.get( defaultTexture ).texture;
440
+
441
+ }
442
+
443
+ _getDefaultCubeTextureGPU( format ) {
444
+
445
+ let defaultCubeTexture = this.defaultTexture[ format ];
446
+
447
+ if ( defaultCubeTexture === undefined ) {
448
+
449
+ const texture = new CubeTexture();
450
+ texture.minFilter = NearestFilter;
451
+ texture.magFilter = NearestFilter;
452
+
453
+ this.createTexture( texture, { width: 1, height: 1, depth: 6 } );
454
+
455
+ this.defaultCubeTexture[ format ] = defaultCubeTexture = texture;
456
+
457
+ }
458
+
459
+ return this.backend.get( defaultCubeTexture ).texture;
460
+
461
+ }
462
+
463
+ _getDefaultVideoFrame() {
464
+
465
+ let defaultVideoFrame = this.defaultVideoFrame;
466
+
467
+ if ( defaultVideoFrame === null ) {
468
+
469
+ const init = {
470
+ timestamp: 0,
471
+ codedWidth: 1,
472
+ codedHeight: 1,
473
+ format: 'RGBA',
474
+ };
475
+
476
+ this.defaultVideoFrame = defaultVideoFrame = new VideoFrame( new Uint8Array( [ 0, 0, 0, 0xff ] ), init );
477
+
478
+ }
479
+
480
+ return defaultVideoFrame;
481
+
482
+ }
483
+
484
+ _copyCubeMapToTexture( images, textureGPU, textureDescriptorGPU, flipY ) {
485
+
486
+ for ( let i = 0; i < 6; i ++ ) {
487
+
488
+ const image = images[ i ];
489
+
490
+ const flipIndex = flipY === true ? _flipMap[ i ] : i;
491
+
492
+ if ( image.isDataTexture ) {
493
+
494
+ this._copyBufferToTexture( image.image, textureGPU, textureDescriptorGPU, flipIndex, flipY );
495
+
496
+ } else {
497
+
498
+ this._copyImageToTexture( image, textureGPU, textureDescriptorGPU, flipIndex, flipY );
499
+
500
+ }
501
+
502
+ }
503
+
504
+ }
505
+
506
+ _copyImageToTexture( image, textureGPU, textureDescriptorGPU, originDepth, flipY ) {
507
+
508
+ const device = this.backend.device;
509
+
510
+ device.queue.copyExternalImageToTexture(
511
+ {
512
+ source: image
513
+ }, {
514
+ texture: textureGPU,
515
+ mipLevel: 0,
516
+ origin: { x: 0, y: 0, z: originDepth }
517
+ }, {
518
+ width: image.width,
519
+ height: image.height,
520
+ depthOrArrayLayers: 1
521
+ }
522
+ );
523
+
524
+ if ( flipY === true ) {
525
+
526
+ this._flipY( textureGPU, textureDescriptorGPU, originDepth );
527
+
528
+ }
529
+
530
+ }
531
+
532
+ _getPassUtils() {
533
+
534
+ let passUtils = this._passUtils;
535
+
536
+ if ( passUtils === null ) {
537
+
538
+ this._passUtils = passUtils = new WebGPUTexturePassUtils( this.backend.device );
539
+
540
+ }
541
+
542
+ return passUtils;
543
+
544
+ }
545
+
546
+ _generateMipmaps( textureGPU, textureDescriptorGPU, baseArrayLayer = 0 ) {
547
+
548
+ this._getPassUtils().generateMipmaps( textureGPU, textureDescriptorGPU, baseArrayLayer );
549
+
550
+ }
551
+
552
+ _flipY( textureGPU, textureDescriptorGPU, originDepth = 0 ) {
553
+
554
+ this._getPassUtils().flipY( textureGPU, textureDescriptorGPU, originDepth );
555
+
556
+ }
557
+
558
+ _copyBufferToTexture( image, textureGPU, textureDescriptorGPU, originDepth, flipY, depth = 0 ) {
559
+
560
+ // @TODO: Consider to use GPUCommandEncoder.copyBufferToTexture()
561
+ // @TODO: Consider to support valid buffer layouts with other formats like RGB
562
+
563
+ const device = this.backend.device;
564
+
565
+ const data = image.data;
566
+
567
+ const bytesPerTexel = this._getBytesPerTexel( textureDescriptorGPU.format );
568
+ const bytesPerRow = image.width * bytesPerTexel;
569
+
570
+ device.queue.writeTexture(
571
+ {
572
+ texture: textureGPU,
573
+ mipLevel: 0,
574
+ origin: { x: 0, y: 0, z: originDepth }
575
+ },
576
+ data,
577
+ {
578
+ offset: image.width * image.height * bytesPerTexel * depth,
579
+ bytesPerRow
580
+ },
581
+ {
582
+ width: image.width,
583
+ height: image.height,
584
+ depthOrArrayLayers: 1
585
+ } );
586
+
587
+ if ( flipY === true ) {
588
+
589
+ this._flipY( textureGPU, textureDescriptorGPU, originDepth );
590
+
591
+ }
592
+
593
+ }
594
+
595
+ _copyCompressedBufferToTexture( mipmaps, textureGPU, textureDescriptorGPU ) {
596
+
597
+ // @TODO: Consider to use GPUCommandEncoder.copyBufferToTexture()
598
+
599
+ const device = this.backend.device;
600
+
601
+ const blockData = this._getBlockData( textureDescriptorGPU.format );
602
+
603
+ for ( let i = 0; i < mipmaps.length; i ++ ) {
604
+
605
+ const mipmap = mipmaps[ i ];
606
+
607
+ const width = mipmap.width;
608
+ const height = mipmap.height;
609
+
610
+ const bytesPerRow = Math.ceil( width / blockData.width ) * blockData.byteLength;
611
+
612
+ device.queue.writeTexture(
613
+ {
614
+ texture: textureGPU,
615
+ mipLevel: i
616
+ },
617
+ mipmap.data,
618
+ {
619
+ offset: 0,
620
+ bytesPerRow
621
+ },
622
+ {
623
+ width: Math.ceil( width / blockData.width ) * blockData.width,
624
+ height: Math.ceil( height / blockData.width ) * blockData.width,
625
+ depthOrArrayLayers: 1
626
+ }
627
+ );
628
+
629
+ }
630
+
631
+ }
632
+
633
+ _getBlockData( format ) {
634
+
635
+ // this method is only relevant for compressed texture formats
636
+
637
+ if ( format === GPUTextureFormat.BC1RGBAUnorm || format === GPUTextureFormat.BC1RGBAUnormSRGB ) return { byteLength: 8, width: 4, height: 4 }; // DXT1
638
+ if ( format === GPUTextureFormat.BC2RGBAUnorm || format === GPUTextureFormat.BC2RGBAUnormSRGB ) return { byteLength: 16, width: 4, height: 4 }; // DXT3
639
+ if ( format === GPUTextureFormat.BC3RGBAUnorm || format === GPUTextureFormat.BC3RGBAUnormSRGB ) return { byteLength: 16, width: 4, height: 4 }; // DXT5
640
+ if ( format === GPUTextureFormat.BC4RUnorm || format === GPUTextureFormat.BC4RSNorm ) return { byteLength: 8, width: 4, height: 4 }; // RGTC1
641
+ if ( format === GPUTextureFormat.BC5RGUnorm || format === GPUTextureFormat.BC5RGSnorm ) return { byteLength: 16, width: 4, height: 4 }; // RGTC2
642
+ if ( format === GPUTextureFormat.BC6HRGBUFloat || format === GPUTextureFormat.BC6HRGBFloat ) return { byteLength: 16, width: 4, height: 4 }; // BPTC (float)
643
+ if ( format === GPUTextureFormat.BC7RGBAUnorm || format === GPUTextureFormat.BC7RGBAUnormSRGB ) return { byteLength: 16, width: 4, height: 4 }; // BPTC (unorm)
644
+
645
+ if ( format === GPUTextureFormat.ETC2RGB8Unorm || format === GPUTextureFormat.ETC2RGB8UnormSRGB ) return { byteLength: 8, width: 4, height: 4 };
646
+ if ( format === GPUTextureFormat.ETC2RGB8A1Unorm || format === GPUTextureFormat.ETC2RGB8A1UnormSRGB ) return { byteLength: 8, width: 4, height: 4 };
647
+ if ( format === GPUTextureFormat.ETC2RGBA8Unorm || format === GPUTextureFormat.ETC2RGBA8UnormSRGB ) return { byteLength: 16, width: 4, height: 4 };
648
+ if ( format === GPUTextureFormat.EACR11Unorm ) return { byteLength: 8, width: 4, height: 4 };
649
+ if ( format === GPUTextureFormat.EACR11Snorm ) return { byteLength: 8, width: 4, height: 4 };
650
+ if ( format === GPUTextureFormat.EACRG11Unorm ) return { byteLength: 16, width: 4, height: 4 };
651
+ if ( format === GPUTextureFormat.EACRG11Snorm ) return { byteLength: 16, width: 4, height: 4 };
652
+
653
+ if ( format === GPUTextureFormat.ASTC4x4Unorm || format === GPUTextureFormat.ASTC4x4UnormSRGB ) return { byteLength: 16, width: 4, height: 4 };
654
+ if ( format === GPUTextureFormat.ASTC5x4Unorm || format === GPUTextureFormat.ASTC5x4UnormSRGB ) return { byteLength: 16, width: 5, height: 4 };
655
+ if ( format === GPUTextureFormat.ASTC5x5Unorm || format === GPUTextureFormat.ASTC5x5UnormSRGB ) return { byteLength: 16, width: 5, height: 5 };
656
+ if ( format === GPUTextureFormat.ASTC6x5Unorm || format === GPUTextureFormat.ASTC6x5UnormSRGB ) return { byteLength: 16, width: 6, height: 5 };
657
+ if ( format === GPUTextureFormat.ASTC6x6Unorm || format === GPUTextureFormat.ASTC6x6UnormSRGB ) return { byteLength: 16, width: 6, height: 6 };
658
+ if ( format === GPUTextureFormat.ASTC8x5Unorm || format === GPUTextureFormat.ASTC8x5UnormSRGB ) return { byteLength: 16, width: 8, height: 5 };
659
+ if ( format === GPUTextureFormat.ASTC8x6Unorm || format === GPUTextureFormat.ASTC8x6UnormSRGB ) return { byteLength: 16, width: 8, height: 6 };
660
+ if ( format === GPUTextureFormat.ASTC8x8Unorm || format === GPUTextureFormat.ASTC8x8UnormSRGB ) return { byteLength: 16, width: 8, height: 8 };
661
+ if ( format === GPUTextureFormat.ASTC10x5Unorm || format === GPUTextureFormat.ASTC10x5UnormSRGB ) return { byteLength: 16, width: 10, height: 5 };
662
+ if ( format === GPUTextureFormat.ASTC10x6Unorm || format === GPUTextureFormat.ASTC10x6UnormSRGB ) return { byteLength: 16, width: 10, height: 6 };
663
+ if ( format === GPUTextureFormat.ASTC10x8Unorm || format === GPUTextureFormat.ASTC10x8UnormSRGB ) return { byteLength: 16, width: 10, height: 8 };
664
+ if ( format === GPUTextureFormat.ASTC10x10Unorm || format === GPUTextureFormat.ASTC10x10UnormSRGB ) return { byteLength: 16, width: 10, height: 10 };
665
+ if ( format === GPUTextureFormat.ASTC12x10Unorm || format === GPUTextureFormat.ASTC12x10UnormSRGB ) return { byteLength: 16, width: 12, height: 10 };
666
+ if ( format === GPUTextureFormat.ASTC12x12Unorm || format === GPUTextureFormat.ASTC12x12UnormSRGB ) return { byteLength: 16, width: 12, height: 12 };
667
+
668
+ }
669
+
670
+ _convertAddressMode( value ) {
671
+
672
+ let addressMode = GPUAddressMode.ClampToEdge;
673
+
674
+ if ( value === RepeatWrapping ) {
675
+
676
+ addressMode = GPUAddressMode.Repeat;
677
+
678
+ } else if ( value === MirroredRepeatWrapping ) {
679
+
680
+ addressMode = GPUAddressMode.MirrorRepeat;
681
+
682
+ }
683
+
684
+ return addressMode;
685
+
686
+ }
687
+
688
+ _convertFilterMode( value ) {
689
+
690
+ let filterMode = GPUFilterMode.Linear;
691
+
692
+ if ( value === NearestFilter || value === NearestMipmapNearestFilter || value === NearestMipmapLinearFilter ) {
693
+
694
+ filterMode = GPUFilterMode.Nearest;
695
+
696
+ }
697
+
698
+ return filterMode;
699
+
700
+ }
701
+
702
+ _getBytesPerTexel( format ) {
703
+
704
+ // 8-bit formats
705
+ if ( format === GPUTextureFormat.R8Unorm ||
706
+ format === GPUTextureFormat.R8Snorm ||
707
+ format === GPUTextureFormat.R8Uint ||
708
+ format === GPUTextureFormat.R8Sint ) return 1;
709
+
710
+ // 16-bit formats
711
+ if ( format === GPUTextureFormat.R16Uint ||
712
+ format === GPUTextureFormat.R16Sint ||
713
+ format === GPUTextureFormat.R16Float ||
714
+ format === GPUTextureFormat.RG8Unorm ||
715
+ format === GPUTextureFormat.RG8Snorm ||
716
+ format === GPUTextureFormat.RG8Uint ||
717
+ format === GPUTextureFormat.RG8Sint ) return 2;
718
+
719
+ // 32-bit formats
720
+ if ( format === GPUTextureFormat.R32Uint ||
721
+ format === GPUTextureFormat.R32Sint ||
722
+ format === GPUTextureFormat.R32Float ||
723
+ format === GPUTextureFormat.RG16Uint ||
724
+ format === GPUTextureFormat.RG16Sint ||
725
+ format === GPUTextureFormat.RG16Float ||
726
+ format === GPUTextureFormat.RGBA8Unorm ||
727
+ format === GPUTextureFormat.RGBA8UnormSRGB ||
728
+ format === GPUTextureFormat.RGBA8Snorm ||
729
+ format === GPUTextureFormat.RGBA8Uint ||
730
+ format === GPUTextureFormat.RGBA8Sint ||
731
+ format === GPUTextureFormat.BGRA8Unorm ||
732
+ format === GPUTextureFormat.BGRA8UnormSRGB ||
733
+ // Packed 32-bit formats
734
+ format === GPUTextureFormat.RGB9E5UFloat ||
735
+ format === GPUTextureFormat.RGB10A2Unorm ||
736
+ format === GPUTextureFormat.RG11B10UFloat ||
737
+ format === GPUTextureFormat.Depth32Float ||
738
+ format === GPUTextureFormat.Depth24Plus ||
739
+ format === GPUTextureFormat.Depth24PlusStencil8 ||
740
+ format === GPUTextureFormat.Depth32FloatStencil8 ) return 4;
741
+
742
+ // 64-bit formats
743
+ if ( format === GPUTextureFormat.RG32Uint ||
744
+ format === GPUTextureFormat.RG32Sint ||
745
+ format === GPUTextureFormat.RG32Float ||
746
+ format === GPUTextureFormat.RGBA16Uint ||
747
+ format === GPUTextureFormat.RGBA16Sint ||
748
+ format === GPUTextureFormat.RGBA16Float ) return 8;
749
+
750
+ // 128-bit formats
751
+ if ( format === GPUTextureFormat.RGBA32Uint ||
752
+ format === GPUTextureFormat.RGBA32Sint ||
753
+ format === GPUTextureFormat.RGBA32Float ) return 16;
754
+
755
+
756
+ }
757
+
758
+ _getTypedArrayType( format ) {
759
+
760
+ if ( format === GPUTextureFormat.R8Uint ) return Uint8Array;
761
+ if ( format === GPUTextureFormat.R8Sint ) return Int8Array;
762
+ if ( format === GPUTextureFormat.R8Unorm ) return Uint8Array;
763
+ if ( format === GPUTextureFormat.R8Snorm ) return Int8Array;
764
+ if ( format === GPUTextureFormat.RG8Uint ) return Uint8Array;
765
+ if ( format === GPUTextureFormat.RG8Sint ) return Int8Array;
766
+ if ( format === GPUTextureFormat.RG8Unorm ) return Uint8Array;
767
+ if ( format === GPUTextureFormat.RG8Snorm ) return Int8Array;
768
+ if ( format === GPUTextureFormat.RGBA8Uint ) return Uint8Array;
769
+ if ( format === GPUTextureFormat.RGBA8Sint ) return Int8Array;
770
+ if ( format === GPUTextureFormat.RGBA8Unorm ) return Uint8Array;
771
+ if ( format === GPUTextureFormat.RGBA8Snorm ) return Int8Array;
772
+
773
+
774
+ if ( format === GPUTextureFormat.R16Uint ) return Uint16Array;
775
+ if ( format === GPUTextureFormat.R16Sint ) return Int16Array;
776
+ if ( format === GPUTextureFormat.RG16Uint ) return Uint16Array;
777
+ if ( format === GPUTextureFormat.RG16Sint ) return Int16Array;
778
+ if ( format === GPUTextureFormat.RGBA16Uint ) return Uint16Array;
779
+ if ( format === GPUTextureFormat.RGBA16Sint ) return Int16Array;
780
+ if ( format === GPUTextureFormat.R16Float ) return Float32Array;
781
+ if ( format === GPUTextureFormat.RG16Float ) return Float32Array;
782
+ if ( format === GPUTextureFormat.RGBA16Float ) return Float32Array;
783
+
784
+
785
+ if ( format === GPUTextureFormat.R32Uint ) return Uint32Array;
786
+ if ( format === GPUTextureFormat.R32Sint ) return Int32Array;
787
+ if ( format === GPUTextureFormat.R32Float ) return Float32Array;
788
+ if ( format === GPUTextureFormat.RG32Uint ) return Uint32Array;
789
+ if ( format === GPUTextureFormat.RG32Sint ) return Int32Array;
790
+ if ( format === GPUTextureFormat.RG32Float ) return Float32Array;
791
+ if ( format === GPUTextureFormat.RGBA32Uint ) return Uint32Array;
792
+ if ( format === GPUTextureFormat.RGBA32Sint ) return Int32Array;
793
+ if ( format === GPUTextureFormat.RGBA32Float ) return Float32Array;
794
+
795
+ if ( format === GPUTextureFormat.BGRA8Unorm ) return Uint8Array;
796
+ if ( format === GPUTextureFormat.BGRA8UnormSRGB ) return Uint8Array;
797
+ if ( format === GPUTextureFormat.RGB10A2Unorm ) return Uint32Array;
798
+ if ( format === GPUTextureFormat.RGB9E5UFloat ) return Uint32Array;
799
+ if ( format === GPUTextureFormat.RG11B10UFloat ) return Uint32Array;
800
+
801
+ if ( format === GPUTextureFormat.Depth32Float ) return Float32Array;
802
+ if ( format === GPUTextureFormat.Depth24Plus ) return Uint32Array;
803
+ if ( format === GPUTextureFormat.Depth24PlusStencil8 ) return Uint32Array;
804
+ if ( format === GPUTextureFormat.Depth32FloatStencil8 ) return Float32Array;
805
+
806
+ }
807
+
808
+ _getDimension( texture ) {
809
+
810
+ let dimension;
811
+
812
+ if ( texture.isData3DTexture ) {
813
+
814
+ dimension = GPUTextureDimension.ThreeD;
815
+
816
+ } else {
817
+
818
+ dimension = GPUTextureDimension.TwoD;
819
+
820
+ }
821
+
822
+ return dimension;
823
+
824
+ }
825
+
826
+ }
827
+
828
+ export function getFormat( texture, device = null ) {
829
+
830
+ const format = texture.format;
831
+ const type = texture.type;
832
+ const colorSpace = texture.colorSpace;
833
+
834
+ let formatGPU;
835
+
836
+ if ( texture.isFramebufferTexture === true && texture.type === UnsignedByteType ) {
837
+
838
+ formatGPU = GPUTextureFormat.BGRA8Unorm;
839
+
840
+ } else if ( texture.isCompressedTexture === true ) {
841
+
842
+ switch ( format ) {
843
+
844
+ case RGBA_S3TC_DXT1_Format:
845
+ formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.BC1RGBAUnormSRGB : GPUTextureFormat.BC1RGBAUnorm;
846
+ break;
847
+
848
+ case RGBA_S3TC_DXT3_Format:
849
+ formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.BC2RGBAUnormSRGB : GPUTextureFormat.BC2RGBAUnorm;
850
+ break;
851
+
852
+ case RGBA_S3TC_DXT5_Format:
853
+ formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.BC3RGBAUnormSRGB : GPUTextureFormat.BC3RGBAUnorm;
854
+ break;
855
+
856
+ case RGB_ETC2_Format:
857
+ formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ETC2RGB8UnormSRGB : GPUTextureFormat.ETC2RGB8Unorm;
858
+ break;
859
+
860
+ case RGBA_ETC2_EAC_Format:
861
+ formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ETC2RGBA8UnormSRGB : GPUTextureFormat.ETC2RGBA8Unorm;
862
+ break;
863
+
864
+ case RGBA_ASTC_4x4_Format:
865
+ formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ASTC4x4UnormSRGB : GPUTextureFormat.ASTC4x4Unorm;
866
+ break;
867
+
868
+ case RGBA_ASTC_5x4_Format:
869
+ formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ASTC5x4UnormSRGB : GPUTextureFormat.ASTC5x4Unorm;
870
+ break;
871
+
872
+ case RGBA_ASTC_5x5_Format:
873
+ formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ASTC5x5UnormSRGB : GPUTextureFormat.ASTC5x5Unorm;
874
+ break;
875
+
876
+ case RGBA_ASTC_6x5_Format:
877
+ formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ASTC6x5UnormSRGB : GPUTextureFormat.ASTC6x5Unorm;
878
+ break;
879
+
880
+ case RGBA_ASTC_6x6_Format:
881
+ formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ASTC6x6UnormSRGB : GPUTextureFormat.ASTC6x6Unorm;
882
+ break;
883
+
884
+ case RGBA_ASTC_8x5_Format:
885
+ formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ASTC8x5UnormSRGB : GPUTextureFormat.ASTC8x5Unorm;
886
+ break;
887
+
888
+ case RGBA_ASTC_8x6_Format:
889
+ formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ASTC8x6UnormSRGB : GPUTextureFormat.ASTC8x6Unorm;
890
+ break;
891
+
892
+ case RGBA_ASTC_8x8_Format:
893
+ formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ASTC8x8UnormSRGB : GPUTextureFormat.ASTC8x8Unorm;
894
+ break;
895
+
896
+ case RGBA_ASTC_10x5_Format:
897
+ formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ASTC10x5UnormSRGB : GPUTextureFormat.ASTC10x5Unorm;
898
+ break;
899
+
900
+ case RGBA_ASTC_10x6_Format:
901
+ formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ASTC10x6UnormSRGB : GPUTextureFormat.ASTC10x6Unorm;
902
+ break;
903
+
904
+ case RGBA_ASTC_10x8_Format:
905
+ formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ASTC10x8UnormSRGB : GPUTextureFormat.ASTC10x8Unorm;
906
+ break;
907
+
908
+ case RGBA_ASTC_10x10_Format:
909
+ formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ASTC10x10UnormSRGB : GPUTextureFormat.ASTC10x10Unorm;
910
+ break;
911
+
912
+ case RGBA_ASTC_12x10_Format:
913
+ formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ASTC12x10UnormSRGB : GPUTextureFormat.ASTC12x10Unorm;
914
+ break;
915
+
916
+ case RGBA_ASTC_12x12_Format:
917
+ formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.ASTC12x12UnormSRGB : GPUTextureFormat.ASTC12x12Unorm;
918
+ break;
919
+
920
+ default:
921
+ console.error( 'WebGPURenderer: Unsupported texture format.', format );
922
+
923
+ }
924
+
925
+ } else {
926
+
927
+ switch ( format ) {
928
+
929
+ case RGBAFormat:
930
+
931
+ switch ( type ) {
932
+
933
+ case ByteType:
934
+ formatGPU = GPUTextureFormat.RGBA8Snorm;
935
+ break;
936
+
937
+ case ShortType:
938
+ formatGPU = GPUTextureFormat.RGBA16Sint;
939
+ break;
940
+
941
+ case UnsignedShortType:
942
+ formatGPU = GPUTextureFormat.RGBA16Uint;
943
+ break;
944
+ case UnsignedIntType:
945
+ formatGPU = GPUTextureFormat.RGBA32Uint;
946
+ break;
947
+
948
+ case IntType:
949
+ formatGPU = GPUTextureFormat.RGBA32Sint;
950
+ break;
951
+
952
+ case UnsignedByteType:
953
+ formatGPU = ( colorSpace === SRGBColorSpace ) ? GPUTextureFormat.RGBA8UnormSRGB : GPUTextureFormat.RGBA8Unorm;
954
+ break;
955
+
956
+ case HalfFloatType:
957
+ formatGPU = GPUTextureFormat.RGBA16Float;
958
+ break;
959
+
960
+ case FloatType:
961
+ formatGPU = GPUTextureFormat.RGBA32Float;
962
+ break;
963
+
964
+ default:
965
+ console.error( 'WebGPURenderer: Unsupported texture type with RGBAFormat.', type );
966
+
967
+ }
968
+
969
+ break;
970
+
971
+ case RGBFormat:
972
+
973
+ switch ( type ) {
974
+
975
+ case UnsignedInt5999Type:
976
+ formatGPU = GPUTextureFormat.RGB9E5UFloat;
977
+ break;
978
+
979
+ default:
980
+ console.error( 'WebGPURenderer: Unsupported texture type with RGBFormat.', type );
981
+
982
+ }
983
+
984
+ break;
985
+
986
+ case RedFormat:
987
+
988
+ switch ( type ) {
989
+
990
+ case ByteType:
991
+ formatGPU = GPUTextureFormat.R8Snorm;
992
+ break;
993
+
994
+ case ShortType:
995
+ formatGPU = GPUTextureFormat.R16Sint;
996
+ break;
997
+
998
+ case UnsignedShortType:
999
+ formatGPU = GPUTextureFormat.R16Uint;
1000
+ break;
1001
+
1002
+ case UnsignedIntType:
1003
+ formatGPU = GPUTextureFormat.R32Uint;
1004
+ break;
1005
+
1006
+ case IntType:
1007
+ formatGPU = GPUTextureFormat.R32Sint;
1008
+ break;
1009
+
1010
+ case UnsignedByteType:
1011
+ formatGPU = GPUTextureFormat.R8Unorm;
1012
+ break;
1013
+
1014
+ case HalfFloatType:
1015
+ formatGPU = GPUTextureFormat.R16Float;
1016
+ break;
1017
+
1018
+ case FloatType:
1019
+ formatGPU = GPUTextureFormat.R32Float;
1020
+ break;
1021
+
1022
+ default:
1023
+ console.error( 'WebGPURenderer: Unsupported texture type with RedFormat.', type );
1024
+
1025
+ }
1026
+
1027
+ break;
1028
+
1029
+ case RGFormat:
1030
+
1031
+ switch ( type ) {
1032
+
1033
+ case ByteType:
1034
+ formatGPU = GPUTextureFormat.RG8Snorm;
1035
+ break;
1036
+
1037
+ case ShortType:
1038
+ formatGPU = GPUTextureFormat.RG16Sint;
1039
+ break;
1040
+
1041
+ case UnsignedShortType:
1042
+ formatGPU = GPUTextureFormat.RG16Uint;
1043
+ break;
1044
+
1045
+ case UnsignedIntType:
1046
+ formatGPU = GPUTextureFormat.RG32Uint;
1047
+ break;
1048
+
1049
+ case IntType:
1050
+ formatGPU = GPUTextureFormat.RG32Sint;
1051
+ break;
1052
+
1053
+ case UnsignedByteType:
1054
+ formatGPU = GPUTextureFormat.RG8Unorm;
1055
+ break;
1056
+
1057
+ case HalfFloatType:
1058
+ formatGPU = GPUTextureFormat.RG16Float;
1059
+ break;
1060
+
1061
+ case FloatType:
1062
+ formatGPU = GPUTextureFormat.RG32Float;
1063
+ break;
1064
+
1065
+ default:
1066
+ console.error( 'WebGPURenderer: Unsupported texture type with RGFormat.', type );
1067
+
1068
+ }
1069
+
1070
+ break;
1071
+
1072
+ case DepthFormat:
1073
+
1074
+ switch ( type ) {
1075
+
1076
+ case UnsignedShortType:
1077
+ formatGPU = GPUTextureFormat.Depth16Unorm;
1078
+ break;
1079
+
1080
+ case UnsignedIntType:
1081
+ formatGPU = GPUTextureFormat.Depth24Plus;
1082
+ break;
1083
+
1084
+ case FloatType:
1085
+ formatGPU = GPUTextureFormat.Depth32Float;
1086
+ break;
1087
+
1088
+ default:
1089
+ console.error( 'WebGPURenderer: Unsupported texture type with DepthFormat.', type );
1090
+
1091
+ }
1092
+
1093
+ break;
1094
+
1095
+ case DepthStencilFormat:
1096
+
1097
+ switch ( type ) {
1098
+
1099
+ case UnsignedInt248Type:
1100
+ formatGPU = GPUTextureFormat.Depth24PlusStencil8;
1101
+ break;
1102
+
1103
+ case FloatType:
1104
+
1105
+ if ( device && device.features.has( GPUFeatureName.Depth32FloatStencil8 ) === false ) {
1106
+
1107
+ console.error( 'WebGPURenderer: Depth textures with DepthStencilFormat + FloatType can only be used with the "depth32float-stencil8" GPU feature.' );
1108
+
1109
+ }
1110
+
1111
+ formatGPU = GPUTextureFormat.Depth32FloatStencil8;
1112
+
1113
+ break;
1114
+
1115
+ default:
1116
+ console.error( 'WebGPURenderer: Unsupported texture type with DepthStencilFormat.', type );
1117
+
1118
+ }
1119
+
1120
+ break;
1121
+
1122
+ case RedIntegerFormat:
1123
+
1124
+ switch ( type ) {
1125
+
1126
+ case IntType:
1127
+ formatGPU = GPUTextureFormat.R32Sint;
1128
+ break;
1129
+
1130
+ case UnsignedIntType:
1131
+ formatGPU = GPUTextureFormat.R32Uint;
1132
+ break;
1133
+
1134
+ default:
1135
+ console.error( 'WebGPURenderer: Unsupported texture type with RedIntegerFormat.', type );
1136
+
1137
+ }
1138
+
1139
+ break;
1140
+
1141
+ case RGIntegerFormat:
1142
+
1143
+ switch ( type ) {
1144
+
1145
+ case IntType:
1146
+ formatGPU = GPUTextureFormat.RG32Sint;
1147
+ break;
1148
+
1149
+ case UnsignedIntType:
1150
+ formatGPU = GPUTextureFormat.RG32Uint;
1151
+ break;
1152
+
1153
+ default:
1154
+ console.error( 'WebGPURenderer: Unsupported texture type with RGIntegerFormat.', type );
1155
+
1156
+ }
1157
+
1158
+ break;
1159
+
1160
+ case RGBAIntegerFormat:
1161
+
1162
+ switch ( type ) {
1163
+
1164
+ case IntType:
1165
+ formatGPU = GPUTextureFormat.RGBA32Sint;
1166
+ break;
1167
+
1168
+ case UnsignedIntType:
1169
+ formatGPU = GPUTextureFormat.RGBA32Uint;
1170
+ break;
1171
+
1172
+ default:
1173
+ console.error( 'WebGPURenderer: Unsupported texture type with RGBAIntegerFormat.', type );
1174
+
1175
+ }
1176
+
1177
+ break;
1178
+
1179
+ default:
1180
+ console.error( 'WebGPURenderer: Unsupported texture format.', format );
1181
+
1182
+ }
1183
+
1184
+ }
1185
+
1186
+ return formatGPU;
1187
+
1188
+ }
1189
+
1190
+ export default WebGPUTextureUtils;