@plastic-software/three 0.174.0 → 0.175.1

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 (567) hide show
  1. package/build/three.cjs +10744 -1476
  2. package/build/three.core.js +9633 -1096
  3. package/build/three.core.min.js +1 -1
  4. package/build/three.module.js +918 -189
  5. package/build/three.module.min.js +1 -1
  6. package/build/three.tsl.js +4 -2
  7. package/build/three.tsl.min.js +1 -1
  8. package/build/three.webgpu.js +2658 -1697
  9. package/build/three.webgpu.min.js +1 -1
  10. package/build/three.webgpu.nodes.js +2654 -1709
  11. package/build/three.webgpu.nodes.min.js +1 -1
  12. package/examples/jsm/Addons.js +1 -1
  13. package/examples/jsm/animation/AnimationClipCreator.js +57 -6
  14. package/examples/jsm/animation/CCDIKSolver.js +93 -39
  15. package/examples/jsm/capabilities/WebGL.js +28 -3
  16. package/examples/jsm/capabilities/WebGPU.js +16 -6
  17. package/examples/jsm/controls/ArcballControls.js +424 -154
  18. package/examples/jsm/controls/DragControls.js +93 -2
  19. package/examples/jsm/controls/FirstPersonControls.js +113 -4
  20. package/examples/jsm/controls/FlyControls.js +49 -2
  21. package/examples/jsm/controls/MapControls.js +42 -9
  22. package/examples/jsm/controls/OrbitControls.js +345 -42
  23. package/examples/jsm/controls/PointerLockControls.js +111 -9
  24. package/examples/jsm/controls/TrackballControls.js +159 -8
  25. package/examples/jsm/controls/TransformControls.js +252 -6
  26. package/examples/jsm/csm/CSM.js +226 -15
  27. package/examples/jsm/csm/CSMFrustum.js +52 -0
  28. package/examples/jsm/csm/CSMHelper.js +47 -0
  29. package/examples/jsm/csm/CSMShader.js +10 -1
  30. package/examples/jsm/csm/CSMShadowNode.js +156 -13
  31. package/examples/jsm/curves/CurveExtras.js +289 -31
  32. package/examples/jsm/curves/NURBSCurve.js +57 -14
  33. package/examples/jsm/curves/NURBSSurface.js +50 -6
  34. package/examples/jsm/curves/NURBSUtils.js +96 -112
  35. package/examples/jsm/curves/NURBSVolume.js +22 -4
  36. package/examples/jsm/effects/AnaglyphEffect.js +30 -0
  37. package/examples/jsm/effects/AsciiEffect.js +60 -15
  38. package/examples/jsm/effects/OutlineEffect.js +59 -111
  39. package/examples/jsm/effects/ParallaxBarrierEffect.js +28 -0
  40. package/examples/jsm/effects/PeppersGhostEffect.js +21 -2
  41. package/examples/jsm/effects/StereoEffect.js +29 -0
  42. package/examples/jsm/environments/DebugEnvironment.js +49 -0
  43. package/examples/jsm/environments/RoomEnvironment.js +23 -4
  44. package/examples/jsm/exporters/DRACOExporter.js +53 -13
  45. package/examples/jsm/exporters/EXRExporter.js +37 -8
  46. package/examples/jsm/exporters/GLTFExporter.js +171 -48
  47. package/examples/jsm/exporters/KTX2Exporter.js +20 -0
  48. package/examples/jsm/exporters/OBJExporter.js +18 -0
  49. package/examples/jsm/exporters/PLYExporter.js +39 -9
  50. package/examples/jsm/exporters/STLExporter.js +25 -5
  51. package/examples/jsm/exporters/USDZExporter.js +70 -3
  52. package/examples/jsm/geometries/BoxLineGeometry.js +22 -0
  53. package/examples/jsm/geometries/ConvexGeometry.js +18 -0
  54. package/examples/jsm/geometries/DecalGeometry.js +20 -9
  55. package/examples/jsm/geometries/ParametricFunctions.js +97 -0
  56. package/examples/jsm/geometries/ParametricGeometry.js +37 -5
  57. package/examples/jsm/geometries/RoundedBoxGeometry.js +21 -0
  58. package/examples/jsm/geometries/TeapotGeometry.js +22 -38
  59. package/examples/jsm/geometries/TextGeometry.js +44 -16
  60. package/examples/jsm/helpers/LightProbeHelper.js +35 -0
  61. package/examples/jsm/helpers/LightProbeHelperGPU.js +36 -0
  62. package/examples/jsm/helpers/OctreeHelper.js +35 -0
  63. package/examples/jsm/helpers/PositionalAudioHelper.js +59 -0
  64. package/examples/jsm/helpers/RectAreaLightHelper.js +35 -3
  65. package/examples/jsm/helpers/TextureHelper.js +27 -0
  66. package/examples/jsm/helpers/TextureHelperGPU.js +28 -0
  67. package/examples/jsm/helpers/VertexNormalsHelper.js +58 -2
  68. package/examples/jsm/helpers/VertexTangentsHelper.js +46 -2
  69. package/examples/jsm/helpers/ViewHelper.js +75 -1
  70. package/examples/jsm/interactive/HTMLMesh.js +25 -0
  71. package/examples/jsm/interactive/InteractiveGroup.js +65 -5
  72. package/examples/jsm/interactive/SelectionBox.js +74 -9
  73. package/examples/jsm/interactive/SelectionHelper.js +71 -29
  74. package/examples/jsm/libs/motion-controllers.module.js +1 -1
  75. package/examples/jsm/lighting/TiledLighting.js +23 -0
  76. package/examples/jsm/lights/LightProbeGenerator.js +26 -1
  77. package/examples/jsm/lights/RectAreaLightTexturesLib.js +48 -13
  78. package/examples/jsm/lights/RectAreaLightUniformsLib.js +15 -0
  79. package/examples/jsm/lines/Line2.js +36 -0
  80. package/examples/jsm/lines/LineGeometry.js +52 -0
  81. package/examples/jsm/lines/LineMaterial.js +95 -0
  82. package/examples/jsm/lines/LineSegments2.js +51 -2
  83. package/examples/jsm/lines/LineSegmentsGeometry.js +62 -8
  84. package/examples/jsm/lines/Wireframe.js +38 -2
  85. package/examples/jsm/lines/WireframeGeometry2.js +24 -0
  86. package/examples/jsm/lines/webgpu/Line2.js +25 -1
  87. package/examples/jsm/lines/webgpu/LineSegments2.js +44 -6
  88. package/examples/jsm/lines/webgpu/Wireframe.js +30 -2
  89. package/examples/jsm/loaders/3DMLoader.js +71 -2
  90. package/examples/jsm/loaders/3MFLoader.js +41 -3
  91. package/examples/jsm/loaders/AMFLoader.js +31 -12
  92. package/examples/jsm/loaders/BVHLoader.js +57 -11
  93. package/examples/jsm/loaders/ColladaLoader.js +35 -0
  94. package/examples/jsm/loaders/DDSLoader.js +24 -0
  95. package/examples/jsm/loaders/DRACOLoader.js +73 -1
  96. package/examples/jsm/loaders/EXRLoader.js +40 -8
  97. package/examples/jsm/loaders/FBXLoader.js +42 -14
  98. package/examples/jsm/loaders/FontLoader.js +60 -2
  99. package/examples/jsm/loaders/GCodeLoader.js +33 -5
  100. package/examples/jsm/loaders/GLTFLoader.js +218 -5
  101. package/examples/jsm/loaders/HDRCubeTextureLoader.js +48 -0
  102. package/examples/jsm/loaders/IESLoader.js +41 -0
  103. package/examples/jsm/loaders/KMZLoader.js +32 -0
  104. package/examples/jsm/loaders/KTX2Loader.js +86 -18
  105. package/examples/jsm/loaders/KTXLoader.js +26 -6
  106. package/examples/jsm/loaders/LDrawLoader.js +115 -5
  107. package/examples/jsm/loaders/LUT3dlLoader.js +46 -10
  108. package/examples/jsm/loaders/LUTCubeLoader.js +45 -9
  109. package/examples/jsm/loaders/LUTImageLoader.js +78 -38
  110. package/examples/jsm/loaders/LWOLoader.js +46 -7
  111. package/examples/jsm/loaders/LottieLoader.js +37 -0
  112. package/examples/jsm/loaders/MD2Loader.js +36 -1
  113. package/examples/jsm/loaders/MDDLoader.js +56 -12
  114. package/examples/jsm/loaders/MTLLoader.js +38 -33
  115. package/examples/jsm/loaders/MaterialXLoader.js +33 -0
  116. package/examples/jsm/loaders/NRRDLoader.js +36 -5
  117. package/examples/jsm/loaders/OBJLoader.js +48 -1
  118. package/examples/jsm/loaders/PCDLoader.js +47 -0
  119. package/examples/jsm/loaders/PDBLoader.js +40 -2
  120. package/examples/jsm/loaders/PLYLoader.js +62 -32
  121. package/examples/jsm/loaders/PVRLoader.js +23 -5
  122. package/examples/jsm/loaders/RGBELoader.js +38 -5
  123. package/examples/jsm/loaders/RGBMLoader.js +67 -1
  124. package/examples/jsm/loaders/STLLoader.js +47 -38
  125. package/examples/jsm/loaders/SVGLoader.js +113 -20
  126. package/examples/jsm/loaders/TDSLoader.js +81 -61
  127. package/examples/jsm/loaders/TGALoader.js +22 -0
  128. package/examples/jsm/loaders/TIFFLoader.js +22 -0
  129. package/examples/jsm/loaders/TTFLoader.js +36 -2
  130. package/examples/jsm/loaders/USDZLoader.js +34 -1
  131. package/examples/jsm/loaders/UltraHDRLoader.js +58 -12
  132. package/examples/jsm/loaders/VOXLoader.js +57 -0
  133. package/examples/jsm/loaders/VRMLLoader.js +32 -1
  134. package/examples/jsm/loaders/VTKLoader.js +38 -0
  135. package/examples/jsm/loaders/XYZLoader.js +35 -0
  136. package/examples/jsm/materials/LDrawConditionalLineMaterial.js +39 -0
  137. package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +39 -0
  138. package/examples/jsm/materials/MeshPostProcessingMaterial.js +24 -2
  139. package/examples/jsm/math/Capsule.js +89 -14
  140. package/examples/jsm/math/ColorConverter.js +21 -0
  141. package/examples/jsm/math/ColorSpaces.js +53 -0
  142. package/examples/jsm/math/ConvexHull.js +514 -92
  143. package/examples/jsm/math/ImprovedNoise.js +14 -2
  144. package/examples/jsm/math/Lut.js +111 -0
  145. package/examples/jsm/math/MeshSurfaceSampler.js +76 -13
  146. package/examples/jsm/math/OBB.js +139 -46
  147. package/examples/jsm/math/Octree.js +132 -5
  148. package/examples/jsm/math/SimplexNoise.js +66 -42
  149. package/examples/jsm/misc/ConvexObjectBreaker.js +43 -25
  150. package/examples/jsm/misc/GPUComputationRenderer.js +92 -17
  151. package/examples/jsm/misc/Gyroscope.js +11 -0
  152. package/examples/jsm/misc/MD2Character.js +115 -2
  153. package/examples/jsm/misc/MD2CharacterComplex.js +170 -8
  154. package/examples/jsm/misc/MorphAnimMesh.js +43 -0
  155. package/examples/jsm/misc/MorphBlendMesh.js +102 -0
  156. package/examples/jsm/misc/ProgressiveLightMap.js +40 -15
  157. package/examples/jsm/misc/ProgressiveLightMapGPU.js +33 -13
  158. package/examples/jsm/misc/RollerCoaster.js +52 -0
  159. package/examples/jsm/misc/Timer.js +79 -2
  160. package/examples/jsm/misc/TubePainter.js +53 -0
  161. package/examples/jsm/misc/Volume.js +108 -72
  162. package/examples/jsm/misc/VolumeSlice.js +88 -45
  163. package/examples/jsm/modifiers/CurveModifier.js +57 -34
  164. package/examples/jsm/modifiers/CurveModifierGPU.js +36 -17
  165. package/examples/jsm/modifiers/EdgeSplitModifier.js +18 -0
  166. package/examples/jsm/modifiers/SimplifyModifier.js +20 -8
  167. package/examples/jsm/modifiers/TessellateModifier.js +33 -2
  168. package/examples/jsm/objects/GroundedSkybox.js +23 -5
  169. package/examples/jsm/objects/Lensflare.js +91 -2
  170. package/examples/jsm/objects/LensflareMesh.js +53 -2
  171. package/examples/jsm/objects/MarchingCubes.js +88 -5
  172. package/examples/jsm/objects/Reflector.js +70 -0
  173. package/examples/jsm/objects/ReflectorForSSRPass.js +39 -0
  174. package/examples/jsm/objects/Refractor.js +61 -0
  175. package/examples/jsm/objects/ShadowMesh.js +53 -4
  176. package/examples/jsm/objects/Sky.js +26 -9
  177. package/examples/jsm/objects/SkyMesh.js +60 -9
  178. package/examples/jsm/objects/Water.js +44 -5
  179. package/examples/jsm/objects/Water2.js +42 -3
  180. package/examples/jsm/objects/Water2Mesh.js +38 -3
  181. package/examples/jsm/objects/WaterMesh.js +94 -7
  182. package/examples/jsm/physics/AmmoPhysics.js +47 -0
  183. package/examples/jsm/physics/JoltPhysics.js +48 -0
  184. package/examples/jsm/physics/RapierPhysics.js +56 -0
  185. package/examples/jsm/postprocessing/AfterimagePass.js +90 -38
  186. package/examples/jsm/postprocessing/BloomPass.js +125 -24
  187. package/examples/jsm/postprocessing/BokehPass.js +98 -22
  188. package/examples/jsm/postprocessing/ClearPass.js +53 -3
  189. package/examples/jsm/postprocessing/CubeTexturePass.js +81 -21
  190. package/examples/jsm/postprocessing/DotScreenPass.js +58 -10
  191. package/examples/jsm/postprocessing/EffectComposer.js +131 -0
  192. package/examples/jsm/postprocessing/FilmPass.js +53 -5
  193. package/examples/jsm/postprocessing/GTAOPass.js +191 -48
  194. package/examples/jsm/postprocessing/GlitchPass.js +84 -33
  195. package/examples/jsm/postprocessing/HalftonePass.js +64 -10
  196. package/examples/jsm/postprocessing/LUTPass.js +37 -8
  197. package/examples/jsm/postprocessing/MaskPass.js +90 -0
  198. package/examples/jsm/postprocessing/OutlinePass.js +266 -133
  199. package/examples/jsm/postprocessing/OutputPass.js +53 -14
  200. package/examples/jsm/postprocessing/Pass.js +98 -4
  201. package/examples/jsm/postprocessing/RenderPass.js +83 -0
  202. package/examples/jsm/postprocessing/RenderPixelatedPass.js +123 -45
  203. package/examples/jsm/postprocessing/RenderTransitionPass.js +119 -21
  204. package/examples/jsm/postprocessing/SAOPass.js +126 -53
  205. package/examples/jsm/postprocessing/SMAAPass.js +103 -71
  206. package/examples/jsm/postprocessing/SSAARenderPass.js +117 -35
  207. package/examples/jsm/postprocessing/SSAOPass.js +160 -47
  208. package/examples/jsm/postprocessing/SSRPass.js +230 -49
  209. package/examples/jsm/postprocessing/SavePass.js +68 -16
  210. package/examples/jsm/postprocessing/ShaderPass.js +64 -7
  211. package/examples/jsm/postprocessing/TAARenderPass.js +78 -24
  212. package/examples/jsm/postprocessing/TexturePass.js +71 -8
  213. package/examples/jsm/postprocessing/UnrealBloomPass.js +113 -37
  214. package/examples/jsm/renderers/CSS2DRenderer.js +77 -1
  215. package/examples/jsm/renderers/CSS3DRenderer.js +99 -3
  216. package/examples/jsm/renderers/Projector.js +18 -2
  217. package/examples/jsm/renderers/SVGRenderer.js +124 -0
  218. package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +9 -5
  219. package/examples/jsm/shaders/AfterimageShader.js +6 -4
  220. package/examples/jsm/shaders/BasicShader.js +6 -2
  221. package/examples/jsm/shaders/BleachBypassShader.js +8 -4
  222. package/examples/jsm/shaders/BlendShader.js +6 -2
  223. package/examples/jsm/shaders/BokehShader.js +7 -4
  224. package/examples/jsm/shaders/BokehShader2.js +7 -3
  225. package/examples/jsm/shaders/BrightnessContrastShader.js +8 -5
  226. package/examples/jsm/shaders/ColorCorrectionShader.js +6 -2
  227. package/examples/jsm/shaders/ColorifyShader.js +6 -2
  228. package/examples/jsm/shaders/ConvolutionShader.js +7 -39
  229. package/examples/jsm/shaders/CopyShader.js +6 -2
  230. package/examples/jsm/shaders/DOFMipMapShader.js +8 -4
  231. package/examples/jsm/shaders/DepthLimitedBlurShader.js +7 -1
  232. package/examples/jsm/shaders/DigitalGlitch.js +7 -7
  233. package/examples/jsm/shaders/DotScreenShader.js +6 -4
  234. package/examples/jsm/shaders/ExposureShader.js +6 -2
  235. package/examples/jsm/shaders/FXAAShader.js +15 -7
  236. package/examples/jsm/shaders/FilmShader.js +10 -0
  237. package/examples/jsm/shaders/FocusShader.js +6 -4
  238. package/examples/jsm/shaders/FreiChenShader.js +7 -3
  239. package/examples/jsm/shaders/GTAOShader.js +33 -39
  240. package/examples/jsm/shaders/GammaCorrectionShader.js +8 -2
  241. package/examples/jsm/shaders/GodRaysShader.js +14 -5
  242. package/examples/jsm/shaders/HalftoneShader.js +11 -5
  243. package/examples/jsm/shaders/HorizontalBlurShader.js +9 -3
  244. package/examples/jsm/shaders/HorizontalTiltShiftShader.js +6 -2
  245. package/examples/jsm/shaders/HueSaturationShader.js +7 -3
  246. package/examples/jsm/shaders/KaleidoShader.js +8 -4
  247. package/examples/jsm/shaders/LuminosityHighPassShader.js +6 -5
  248. package/examples/jsm/shaders/LuminosityShader.js +6 -3
  249. package/examples/jsm/shaders/MirrorShader.js +7 -4
  250. package/examples/jsm/shaders/NormalMapShader.js +5 -3
  251. package/examples/jsm/shaders/OutputShader.js +11 -0
  252. package/examples/jsm/shaders/PoissonDenoiseShader.js +21 -15
  253. package/examples/jsm/shaders/RGBShiftShader.js +5 -1
  254. package/examples/jsm/shaders/SAOShader.js +8 -2
  255. package/examples/jsm/shaders/SMAAShader.js +23 -1
  256. package/examples/jsm/shaders/SSAOShader.js +23 -5
  257. package/examples/jsm/shaders/SSRShader.js +25 -1
  258. package/examples/jsm/shaders/SepiaShader.js +6 -4
  259. package/examples/jsm/shaders/SobelOperatorShader.js +5 -2
  260. package/examples/jsm/shaders/SubsurfaceScatteringShader.js +10 -8
  261. package/examples/jsm/shaders/TechnicolorShader.js +7 -4
  262. package/examples/jsm/shaders/ToonShader.js +29 -7
  263. package/examples/jsm/shaders/TriangleBlurShader.js +6 -4
  264. package/examples/jsm/shaders/UnpackDepthRGBAShader.js +6 -3
  265. package/examples/jsm/shaders/VelocityShader.js +6 -2
  266. package/examples/jsm/shaders/VerticalBlurShader.js +6 -2
  267. package/examples/jsm/shaders/VerticalTiltShiftShader.js +5 -1
  268. package/examples/jsm/shaders/VignetteShader.js +6 -4
  269. package/examples/jsm/shaders/VolumeShader.js +7 -1
  270. package/examples/jsm/shaders/WaterRefractionShader.js +8 -0
  271. package/examples/jsm/textures/FlakesTexture.js +12 -0
  272. package/examples/jsm/transpiler/Transpiler.js +31 -0
  273. package/examples/jsm/tsl/display/AfterImageNode.js +1 -1
  274. package/examples/jsm/tsl/display/BloomNode.js +1 -1
  275. package/examples/jsm/tsl/display/PixelationPassNode.js +4 -4
  276. package/examples/jsm/tsl/display/SSRNode.js +1 -1
  277. package/examples/jsm/tsl/lighting/TiledLightsNode.js +29 -3
  278. package/examples/jsm/tsl/math/Bayer.js +14 -1
  279. package/examples/jsm/tsl/utils/Raymarching.js +4 -2
  280. package/examples/jsm/utils/BufferGeometryUtils.js +88 -29
  281. package/examples/jsm/utils/CameraUtils.js +10 -7
  282. package/examples/jsm/utils/GeometryCompressionUtils.js +20 -30
  283. package/examples/jsm/utils/GeometryUtils.js +12 -13
  284. package/examples/jsm/utils/LDrawUtils.js +11 -4
  285. package/examples/jsm/utils/SceneOptimizer.js +66 -20
  286. package/examples/jsm/utils/SceneUtils.js +50 -3
  287. package/examples/jsm/utils/ShadowMapViewer.js +47 -24
  288. package/examples/jsm/utils/ShadowMapViewerGPU.js +47 -24
  289. package/examples/jsm/utils/SkeletonUtils.js +45 -0
  290. package/examples/jsm/utils/SortUtils.js +14 -5
  291. package/examples/jsm/utils/UVsDebug.js +9 -4
  292. package/examples/jsm/utils/WebGLTextureUtils.js +13 -0
  293. package/examples/jsm/utils/WebGPUTextureUtils.js +14 -0
  294. package/examples/jsm/utils/WorkerPool.js +65 -2
  295. package/examples/jsm/webxr/ARButton.js +18 -0
  296. package/examples/jsm/webxr/OculusHandModel.js +83 -0
  297. package/examples/jsm/webxr/OculusHandPointerModel.js +125 -0
  298. package/examples/jsm/webxr/Text2D.js +11 -0
  299. package/examples/jsm/webxr/VRButton.js +30 -0
  300. package/examples/jsm/webxr/XRButton.js +22 -0
  301. package/examples/jsm/webxr/XRControllerModelFactory.js +87 -3
  302. package/examples/jsm/webxr/XREstimatedLight.js +33 -3
  303. package/examples/jsm/webxr/XRHandMeshModel.js +35 -0
  304. package/examples/jsm/webxr/XRHandModelFactory.js +92 -0
  305. package/examples/jsm/webxr/XRHandPrimitiveModel.js +42 -0
  306. package/examples/jsm/webxr/XRPlanes.js +17 -0
  307. package/package.json +1 -1
  308. package/src/Three.TSL.js +3 -1
  309. package/src/animation/AnimationAction.js +262 -30
  310. package/src/animation/AnimationClip.js +141 -2
  311. package/src/animation/AnimationMixer.js +99 -15
  312. package/src/animation/AnimationObjectGroup.js +41 -18
  313. package/src/animation/AnimationUtils.js +168 -18
  314. package/src/animation/KeyframeTrack.js +144 -10
  315. package/src/animation/PropertyBinding.js +77 -3
  316. package/src/animation/PropertyMixer.js +72 -5
  317. package/src/animation/tracks/BooleanKeyframeTrack.js +33 -6
  318. package/src/animation/tracks/ColorKeyframeTrack.js +26 -5
  319. package/src/animation/tracks/NumberKeyframeTrack.js +26 -2
  320. package/src/animation/tracks/QuaternionKeyframeTrack.js +30 -1
  321. package/src/animation/tracks/StringKeyframeTrack.js +33 -2
  322. package/src/animation/tracks/VectorKeyframeTrack.js +26 -2
  323. package/src/audio/AudioAnalyser.js +1 -1
  324. package/src/audio/AudioListener.js +2 -2
  325. package/src/audio/PositionalAudio.js +5 -5
  326. package/src/constants.js +1432 -5
  327. package/src/core/BufferAttribute.js +413 -3
  328. package/src/core/BufferGeometry.js +337 -1
  329. package/src/core/Clock.js +60 -0
  330. package/src/core/GLBufferAttribute.js +99 -0
  331. package/src/core/InstancedBufferAttribute.js +29 -0
  332. package/src/core/InstancedBufferGeometry.js +20 -0
  333. package/src/core/InstancedInterleavedBuffer.js +26 -0
  334. package/src/core/InterleavedBuffer.js +137 -3
  335. package/src/core/InterleavedBufferAttribute.js +197 -0
  336. package/src/core/Layers.js +71 -10
  337. package/src/core/Object3D.js +23 -0
  338. package/src/core/Raycaster.js +134 -1
  339. package/src/core/RenderTarget.js +166 -7
  340. package/src/core/RenderTarget3D.js +25 -0
  341. package/src/core/RenderTargetArray.js +18 -0
  342. package/src/core/Uniform.js +29 -0
  343. package/src/core/UniformsGroup.js +84 -2
  344. package/src/extras/Controls.js +16 -1
  345. package/src/extras/Earcut.js +3 -781
  346. package/src/extras/ImageUtils.js +3 -2
  347. package/src/extras/PMREMGenerator.js +22 -17
  348. package/src/extras/core/Curve.js +1 -1
  349. package/src/extras/core/Path.js +1 -1
  350. package/src/extras/lib/earcut.js +685 -0
  351. package/src/geometries/ConeGeometry.js +2 -2
  352. package/src/geometries/CylinderGeometry.js +2 -2
  353. package/src/geometries/ExtrudeGeometry.js +71 -39
  354. package/src/geometries/LatheGeometry.js +1 -1
  355. package/src/lights/LightShadow.js +1 -1
  356. package/src/lights/webgpu/IESSpotLight.js +1 -1
  357. package/src/loaders/AnimationLoader.js +31 -0
  358. package/src/loaders/AudioLoader.js +31 -0
  359. package/src/loaders/BufferGeometryLoader.js +34 -0
  360. package/src/loaders/Cache.js +45 -0
  361. package/src/loaders/CompressedTextureLoader.js +36 -3
  362. package/src/loaders/CubeTextureLoader.js +45 -0
  363. package/src/loaders/DataTextureLoader.js +44 -3
  364. package/src/loaders/FileLoader.js +57 -1
  365. package/src/loaders/ImageBitmapLoader.js +57 -0
  366. package/src/loaders/ImageLoader.js +30 -0
  367. package/src/loaders/Loader.js +4 -6
  368. package/src/loaders/LoaderUtils.js +18 -36
  369. package/src/loaders/LoadingManager.js +142 -0
  370. package/src/loaders/MaterialLoader.js +57 -0
  371. package/src/loaders/ObjectLoader.js +58 -1
  372. package/src/loaders/TextureLoader.js +33 -0
  373. package/src/loaders/nodes/NodeLoader.js +6 -2
  374. package/src/loaders/nodes/NodeMaterialLoader.js +1 -1
  375. package/src/loaders/nodes/NodeObjectLoader.js +3 -3
  376. package/src/materials/LineBasicMaterial.js +74 -1
  377. package/src/materials/LineDashedMaterial.js +52 -0
  378. package/src/materials/Material.js +18 -3
  379. package/src/materials/MeshBasicMaterial.js +165 -0
  380. package/src/materials/MeshDepthMaterial.js +93 -0
  381. package/src/materials/MeshDistanceMaterial.js +76 -0
  382. package/src/materials/MeshLambertMaterial.js +273 -0
  383. package/src/materials/MeshMatcapMaterial.js +142 -0
  384. package/src/materials/MeshNormalMaterial.js +113 -0
  385. package/src/materials/MeshPhongMaterial.js +288 -0
  386. package/src/materials/MeshPhysicalMaterial.js +292 -1
  387. package/src/materials/MeshStandardMaterial.js +297 -0
  388. package/src/materials/MeshToonMaterial.js +218 -0
  389. package/src/materials/PointsMaterial.js +89 -0
  390. package/src/materials/RawShaderMaterial.js +25 -0
  391. package/src/materials/ShaderMaterial.js +215 -6
  392. package/src/materials/ShadowMaterial.js +54 -0
  393. package/src/materials/SpriteMaterial.js +82 -0
  394. package/src/materials/nodes/Line2NodeMaterial.js +1 -1
  395. package/src/materials/nodes/LineBasicNodeMaterial.js +2 -2
  396. package/src/materials/nodes/LineDashedNodeMaterial.js +2 -2
  397. package/src/materials/nodes/MeshBasicNodeMaterial.js +2 -2
  398. package/src/materials/nodes/MeshLambertNodeMaterial.js +2 -2
  399. package/src/materials/nodes/MeshMatcapNodeMaterial.js +2 -2
  400. package/src/materials/nodes/MeshNormalNodeMaterial.js +2 -2
  401. package/src/materials/nodes/MeshPhongNodeMaterial.js +2 -2
  402. package/src/materials/nodes/MeshPhysicalNodeMaterial.js +2 -2
  403. package/src/materials/nodes/MeshSSSNodeMaterial.js +1 -1
  404. package/src/materials/nodes/MeshStandardNodeMaterial.js +2 -2
  405. package/src/materials/nodes/MeshToonNodeMaterial.js +2 -2
  406. package/src/materials/nodes/NodeMaterial.js +7 -3
  407. package/src/materials/nodes/PointsNodeMaterial.js +1 -1
  408. package/src/materials/nodes/ShadowNodeMaterial.js +11 -2
  409. package/src/materials/nodes/SpriteNodeMaterial.js +1 -1
  410. package/src/materials/nodes/VolumeNodeMaterial.js +10 -1
  411. package/src/math/Color.js +1 -1
  412. package/src/math/MathUtils.js +223 -0
  413. package/src/nodes/Nodes.js +1 -0
  414. package/src/nodes/accessors/BatchNode.js +8 -8
  415. package/src/nodes/accessors/BuiltinNode.js +1 -1
  416. package/src/nodes/accessors/CubeTextureNode.js +1 -1
  417. package/src/nodes/accessors/InstanceNode.js +5 -5
  418. package/src/nodes/accessors/InstancedMeshNode.js +1 -1
  419. package/src/nodes/accessors/MorphNode.js +27 -23
  420. package/src/nodes/accessors/Normal.js +1 -1
  421. package/src/nodes/accessors/Object3DNode.js +12 -12
  422. package/src/nodes/accessors/ReferenceBaseNode.js +2 -2
  423. package/src/nodes/accessors/ReferenceNode.js +1 -1
  424. package/src/nodes/accessors/SkinningNode.js +46 -37
  425. package/src/nodes/accessors/StorageBufferNode.js +1 -1
  426. package/src/nodes/accessors/StorageTextureNode.js +3 -3
  427. package/src/nodes/accessors/Texture3DNode.js +1 -1
  428. package/src/nodes/accessors/TextureNode.js +25 -5
  429. package/src/nodes/accessors/TextureSizeNode.js +1 -1
  430. package/src/nodes/accessors/UniformArrayNode.js +2 -2
  431. package/src/nodes/code/CodeNode.js +4 -4
  432. package/src/nodes/code/ExpressionNode.js +4 -4
  433. package/src/nodes/code/FunctionCallNode.js +23 -3
  434. package/src/nodes/code/ScriptableNode.js +4 -4
  435. package/src/nodes/code/ScriptableValueNode.js +2 -2
  436. package/src/nodes/core/AssignNode.js +1 -1
  437. package/src/nodes/core/AttributeNode.js +1 -1
  438. package/src/nodes/core/BypassNode.js +1 -1
  439. package/src/nodes/core/CacheNode.js +1 -1
  440. package/src/nodes/core/ContextNode.js +1 -1
  441. package/src/nodes/core/InputNode.js +2 -2
  442. package/src/nodes/core/Node.js +14 -2
  443. package/src/nodes/core/NodeBuilder.js +86 -14
  444. package/src/nodes/core/StackNode.js +5 -5
  445. package/src/nodes/core/StructNode.js +1 -1
  446. package/src/nodes/core/StructTypeNode.js +2 -2
  447. package/src/nodes/core/VarNode.js +2 -8
  448. package/src/nodes/core/VaryingNode.js +3 -3
  449. package/src/nodes/display/BlendModes.js +4 -4
  450. package/src/nodes/display/BumpMapNode.js +1 -1
  451. package/src/nodes/display/NormalMapNode.js +1 -1
  452. package/src/nodes/display/PosterizeNode.js +1 -1
  453. package/src/nodes/display/ScreenNode.js +3 -3
  454. package/src/nodes/display/ViewportDepthNode.js +2 -2
  455. package/src/nodes/display/ViewportDepthTextureNode.js +2 -2
  456. package/src/nodes/display/ViewportSharedTextureNode.js +2 -2
  457. package/src/nodes/display/ViewportTextureNode.js +4 -4
  458. package/src/nodes/functions/ShadowMaskModel.js +4 -4
  459. package/src/nodes/functions/material/getParallaxCorrectNormal.js +6 -6
  460. package/src/nodes/geometry/RangeNode.js +1 -1
  461. package/src/nodes/gpgpu/AtomicFunctionNode.js +16 -40
  462. package/src/nodes/gpgpu/ComputeBuiltinNode.js +1 -1
  463. package/src/nodes/gpgpu/ComputeNode.js +30 -2
  464. package/src/nodes/lighting/AnalyticLightNode.js +9 -1
  465. package/src/nodes/lighting/LightsNode.js +3 -3
  466. package/src/nodes/lighting/ShadowNode.js +1 -1
  467. package/src/nodes/math/ConditionalNode.js +20 -3
  468. package/src/nodes/math/MathNode.js +83 -78
  469. package/src/nodes/math/OperatorNode.js +171 -82
  470. package/src/nodes/pmrem/PMREMNode.js +4 -4
  471. package/src/nodes/pmrem/PMREMUtils.js +2 -2
  472. package/src/nodes/tsl/TSLBase.js +2 -1
  473. package/src/nodes/tsl/TSLCore.js +115 -12
  474. package/src/nodes/utils/ArrayElementNode.js +3 -1
  475. package/src/nodes/utils/CubeMapNode.js +3 -3
  476. package/src/nodes/utils/DebugNode.js +70 -0
  477. package/src/nodes/utils/EquirectUVNode.js +2 -2
  478. package/src/nodes/utils/JoinNode.js +27 -2
  479. package/src/nodes/utils/LoopNode.js +58 -28
  480. package/src/nodes/utils/MaxMipLevelNode.js +1 -1
  481. package/src/nodes/utils/ReflectorNode.js +2 -2
  482. package/src/nodes/utils/RemapNode.js +6 -6
  483. package/src/nodes/utils/RotateNode.js +1 -1
  484. package/src/nodes/utils/SpriteSheetUVNode.js +3 -3
  485. package/src/nodes/utils/StorageArrayElementNode.js +1 -1
  486. package/src/nodes/utils/TriplanarTexturesNode.js +3 -3
  487. package/src/objects/BatchedMesh.js +4 -4
  488. package/src/objects/InstancedMesh.js +2 -2
  489. package/src/objects/LOD.js +1 -1
  490. package/src/objects/Skeleton.js +1 -1
  491. package/src/renderers/WebGL3DRenderTarget.js +25 -0
  492. package/src/renderers/WebGLArrayRenderTarget.js +25 -0
  493. package/src/renderers/WebGLCubeRenderTarget.js +39 -1
  494. package/src/renderers/WebGLRenderTarget.js +19 -0
  495. package/src/renderers/WebGLRenderer.js +617 -79
  496. package/src/renderers/common/Animation.js +2 -2
  497. package/src/renderers/common/Attributes.js +2 -2
  498. package/src/renderers/common/Backend.js +12 -3
  499. package/src/renderers/common/Background.js +1 -0
  500. package/src/renderers/common/Color4.js +1 -1
  501. package/src/renderers/common/CubeRenderTarget.js +13 -0
  502. package/src/renderers/common/PostProcessing.js +2 -0
  503. package/src/renderers/common/QuadMesh.js +2 -0
  504. package/src/renderers/common/RenderList.js +2 -2
  505. package/src/renderers/common/RenderObject.js +1 -1
  506. package/src/renderers/common/RenderObjects.js +2 -2
  507. package/src/renderers/common/Renderer.js +52 -31
  508. package/src/renderers/common/XRManager.js +333 -10
  509. package/src/renderers/common/extras/PMREMGenerator.js +6 -0
  510. package/src/renderers/common/nodes/NodeBuilderState.js +3 -3
  511. package/src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl.js +10 -1
  512. package/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js +8 -1
  513. package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.js +5 -1
  514. package/src/renderers/shaders/ShaderChunk/common.glsl.js +82 -0
  515. package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +22 -2
  516. package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +12 -1
  517. package/src/renderers/shaders/ShaderChunk/metalnessmap_fragment.glsl.js +8 -2
  518. package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +31 -11
  519. package/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js +5 -1
  520. package/src/renderers/shaders/ShaderChunk/normal_pars_fragment.glsl.js +1 -1
  521. package/src/renderers/shaders/ShaderChunk/normal_pars_vertex.glsl.js +1 -1
  522. package/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js +2 -1
  523. package/src/renderers/shaders/ShaderChunk/roughnessmap_fragment.glsl.js +12 -1
  524. package/src/renderers/shaders/ShaderChunk/triplanar_fragment.glsl.js +20 -0
  525. package/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.js +52 -7
  526. package/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.js +25 -6
  527. package/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.js +19 -7
  528. package/src/renderers/shaders/ShaderChunk.js +2 -0
  529. package/src/renderers/shaders/ShaderLib/linedashed.glsl.js +2 -0
  530. package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +1 -0
  531. package/src/renderers/shaders/UniformsLib.js +6 -5
  532. package/src/renderers/shaders/UniformsUtils.js +1 -3
  533. package/src/renderers/webgl/WebGLBackground.js +4 -2
  534. package/src/renderers/webgl/WebGLMaterials.js +12 -0
  535. package/src/renderers/webgl/WebGLProgram.js +25 -5
  536. package/src/renderers/webgl/WebGLPrograms.js +21 -7
  537. package/src/renderers/webgl/WebGLState.js +9 -9
  538. package/src/renderers/webgl-fallback/WebGLBackend.js +25 -26
  539. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +3 -12
  540. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +67 -19
  541. package/src/renderers/webgl-fallback/utils/WebGLUtils.js +1 -1
  542. package/src/renderers/webgpu/WebGPUBackend.js +128 -87
  543. package/src/renderers/webgpu/WebGPURenderer.Nodes.js +1 -11
  544. package/src/renderers/webgpu/WebGPURenderer.js +17 -11
  545. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +4 -4
  546. package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +5 -3
  547. package/src/renderers/webgpu/utils/WebGPUConstants.js +1 -1
  548. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +1 -1
  549. package/src/renderers/webxr/WebXRController.js +87 -2
  550. package/src/renderers/webxr/WebXRDepthSensing.js +49 -0
  551. package/src/renderers/webxr/WebXRManager.js +173 -1
  552. package/src/scenes/Scene.js +2 -1
  553. package/src/textures/CanvasTexture.js +28 -0
  554. package/src/textures/CompressedArrayTexture.js +57 -0
  555. package/src/textures/CompressedCubeTexture.js +29 -0
  556. package/src/textures/CompressedTexture.js +64 -6
  557. package/src/textures/CubeTexture.js +52 -4
  558. package/src/textures/Data3DTexture.js +77 -0
  559. package/src/textures/DataArrayTexture.js +93 -0
  560. package/src/textures/DataTexture.js +65 -0
  561. package/src/textures/DepthTexture.js +59 -9
  562. package/src/textures/FramebufferTexture.js +62 -0
  563. package/src/textures/Source.js +69 -0
  564. package/src/textures/Texture.js +5 -5
  565. package/src/textures/VideoFrameTexture.js +43 -6
  566. package/src/textures/VideoTexture.js +49 -4
  567. package/examples/jsm/geometries/ParametricGeometries.js +0 -254
@@ -3,8 +3,8 @@
3
3
  * Copyright 2010-2025 Three.js Authors
4
4
  * SPDX-License-Identifier: MIT
5
5
  */
6
- import { Color, Matrix3, Vector2, mergeUniforms, Vector3, CubeUVReflectionMapping, Mesh, BoxGeometry, ShaderMaterial, cloneUniforms, BackSide, ColorManagement, SRGBTransfer, PlaneGeometry, FrontSide, getUnlitUniformColorSpace, Euler, Matrix4, IntType, RGBAFormat, HalfFloatType, UnsignedByteType, FloatType, Plane, EquirectangularReflectionMapping, EquirectangularRefractionMapping, WebGLCubeRenderTarget, CubeReflectionMapping, CubeRefractionMapping, PerspectiveCamera, NoToneMapping, MeshBasicMaterial, BufferGeometry, BufferAttribute, WebGLRenderTarget, NoBlending, OrthographicCamera, LinearFilter, LinearSRGBColorSpace, warnOnce, arrayNeedsUint32, Uint32BufferAttribute, Uint16BufferAttribute, Vector4, DataArrayTexture, LessEqualCompare, Texture, DepthTexture, Data3DTexture, CubeTexture, GLSL3, CustomToneMapping, NeutralToneMapping, AgXToneMapping, ACESFilmicToneMapping, CineonToneMapping, ReinhardToneMapping, LinearToneMapping, PCFShadowMap, PCFSoftShadowMap, VSMShadowMap, LinearTransfer, AddOperation, MixOperation, MultiplyOperation, ObjectSpaceNormalMap, TangentSpaceNormalMap, NormalBlending, DoubleSide, UniformsUtils, Layers, Frustum, MeshDepthMaterial, RGBADepthPacking, MeshDistanceMaterial, NearestFilter, LessEqualDepth, AddEquation, SubtractEquation, ReverseSubtractEquation, ZeroFactor, OneFactor, SrcColorFactor, SrcAlphaFactor, SrcAlphaSaturateFactor, DstColorFactor, DstAlphaFactor, OneMinusSrcColorFactor, OneMinusSrcAlphaFactor, OneMinusDstColorFactor, OneMinusDstAlphaFactor, ConstantColorFactor, OneMinusConstantColorFactor, ConstantAlphaFactor, OneMinusConstantAlphaFactor, CustomBlending, MultiplyBlending, SubtractiveBlending, AdditiveBlending, CullFaceNone, CullFaceBack, CullFaceFront, NotEqualDepth, GreaterDepth, GreaterEqualDepth, EqualDepth, LessDepth, AlwaysDepth, NeverDepth, MinEquation, MaxEquation, RepeatWrapping, ClampToEdgeWrapping, MirroredRepeatWrapping, NearestMipmapNearestFilter, NearestMipmapLinearFilter, LinearMipmapNearestFilter, LinearMipmapLinearFilter, NeverCompare, AlwaysCompare, LessCompare, EqualCompare, GreaterEqualCompare, GreaterCompare, NotEqualCompare, NoColorSpace, DepthStencilFormat, getByteLength, UnsignedIntType, UnsignedInt248Type, UnsignedShortType, DepthFormat, createElementNS, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedInt5999Type, ByteType, ShortType, AlphaFormat, RGBFormat, LuminanceFormat, LuminanceAlphaFormat, RedFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, 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, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, EventDispatcher, ArrayCamera, WebXRController, RAD2DEG, createCanvasElement, SRGBColorSpace, REVISION, toNormalizedProjectionMatrix, toReversedProjectionMatrix, probeAsync, WebGLCoordinateSystem } from './three.core.js';
7
- export { AdditiveAnimationBlendMode, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BasicDepthPacking, BasicShadowMap, BatchedMesh, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxHelper, BufferGeometryLoader, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CircleGeometry, Clock, ColorKeyframeTrack, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, Controls, CubeCamera, CubeTextureLoader, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceFrontBack, Curve, CurvePath, CylinderGeometry, Cylindrical, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualStencilFunc, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, Fog, FogExp2, FramebufferTexture, GLBufferAttribute, GLSL1, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialLoader, MathUtils, Matrix2, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NeverStencilFunc, NormalAnimationBlendMode, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, OctahedronGeometry, Path, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RGBDepthPacking, RGBIntegerFormat, RGDepthPacking, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RenderTarget, RenderTarget3D, RenderTargetArray, ReplaceStencilOp, RingGeometry, Scene, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, TOUCH, TetrahedronGeometry, TextureLoader, TextureUtils, TimestampQuery, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGPUCoordinateSystem, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroSlopeEnding, ZeroStencilOp } from './three.core.js';
6
+ import { Color, Matrix3, Matrix4, Vector2, mergeUniforms, Vector3, CubeUVReflectionMapping, Mesh, BoxGeometry, ShaderMaterial, cloneUniforms, BackSide, ColorManagement, SRGBTransfer, PlaneGeometry, FrontSide, getUnlitUniformColorSpace, Euler, IntType, RGBAFormat, HalfFloatType, UnsignedByteType, FloatType, Plane, EquirectangularReflectionMapping, EquirectangularRefractionMapping, WebGLCubeRenderTarget, CubeReflectionMapping, CubeRefractionMapping, PerspectiveCamera, NoToneMapping, MeshBasicMaterial, BufferGeometry, BufferAttribute, WebGLRenderTarget, NoBlending, OrthographicCamera, LinearFilter, LinearSRGBColorSpace, warnOnce, arrayNeedsUint32, Uint32BufferAttribute, Uint16BufferAttribute, Vector4, DataArrayTexture, LessEqualCompare, Texture, DepthTexture, Data3DTexture, CubeTexture, TriPlanarMapping, CylindricalMapping, UVMapping, GLSL3, CustomToneMapping, NeutralToneMapping, AgXToneMapping, ACESFilmicToneMapping, CineonToneMapping, ReinhardToneMapping, LinearToneMapping, PCFShadowMap, PCFSoftShadowMap, VSMShadowMap, LinearTransfer, AddOperation, MixOperation, MultiplyOperation, ObjectSpaceNormalMap, TangentSpaceNormalMap, NormalBlending, DoubleSide, UniformsUtils, Layers, Frustum, MeshDepthMaterial, RGBADepthPacking, MeshDistanceMaterial, NearestFilter, LessEqualDepth, AddEquation, SubtractEquation, ReverseSubtractEquation, ZeroFactor, OneFactor, SrcColorFactor, SrcAlphaFactor, SrcAlphaSaturateFactor, DstColorFactor, DstAlphaFactor, OneMinusSrcColorFactor, OneMinusSrcAlphaFactor, OneMinusDstColorFactor, OneMinusDstAlphaFactor, ConstantColorFactor, OneMinusConstantColorFactor, ConstantAlphaFactor, OneMinusConstantAlphaFactor, CustomBlending, MultiplyBlending, SubtractiveBlending, AdditiveBlending, CullFaceNone, CullFaceBack, CullFaceFront, NotEqualDepth, GreaterDepth, GreaterEqualDepth, EqualDepth, LessDepth, AlwaysDepth, NeverDepth, MinEquation, MaxEquation, RepeatWrapping, ClampToEdgeWrapping, MirroredRepeatWrapping, NearestMipmapNearestFilter, NearestMipmapLinearFilter, LinearMipmapNearestFilter, LinearMipmapLinearFilter, NeverCompare, AlwaysCompare, LessCompare, EqualCompare, GreaterEqualCompare, GreaterCompare, NotEqualCompare, NoColorSpace, DepthStencilFormat, getByteLength, UnsignedIntType, UnsignedInt248Type, UnsignedShortType, DepthFormat, createElementNS, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedInt5999Type, ByteType, ShortType, AlphaFormat, RGBFormat, LuminanceFormat, LuminanceAlphaFormat, RedFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, 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, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, EventDispatcher, ArrayCamera, WebXRController, RAD2DEG, createCanvasElement, SRGBColorSpace, REVISION, toNormalizedProjectionMatrix, toReversedProjectionMatrix, probeAsync, WebGLCoordinateSystem } from './three.core.js';
7
+ export { AdditiveAnimationBlendMode, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BasicDepthPacking, BasicShadowMap, BatchedMesh, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxHelper, BufferGeometryLoader, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CircleGeometry, Clock, ColorKeyframeTrack, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, Controls, CubeCamera, CubeTextureLoader, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceFrontBack, Curve, CurvePath, CylinderGeometry, Cylindrical, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualStencilFunc, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, Fog, FogExp2, FramebufferTexture, GLBufferAttribute, GLSL1, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialLoader, MathUtils, Matrix2, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NeverStencilFunc, NormalAnimationBlendMode, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, OctahedronGeometry, Path, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RGBDepthPacking, RGBIntegerFormat, RGDepthPacking, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RenderTarget, RenderTarget3D, RenderTargetArray, ReplaceStencilOp, RingGeometry, Scene, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, TOUCH, TetrahedronGeometry, TextureLoader, TextureUtils, TimestampQuery, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGPUCoordinateSystem, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroSlopeEnding, ZeroStencilOp } from './three.core.js';
8
8
 
9
9
  function WebGLAnimation() {
10
10
 
@@ -293,7 +293,7 @@ var alphahash_fragment = "#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlpha
293
293
 
294
294
  var alphahash_pars_fragment = "#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif";
295
295
 
296
- var alphamap_fragment = "#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif";
296
+ var alphamap_fragment = "#ifdef USE_ALPHAMAP\n\t#ifdef USE_ALPHAMAP_TRIPLANAR\n\t\tdiffuseColor.a *= texture2DTriplanar( alphaMap, alphaMapTransform, triplanarCoords, triplanarWeights ).g;\n\t#else\n #if defined( USE_ALPHAMAP_CYLINDRICAL )\n vec2 vAlphaMapUv = ( alphaMapTransform * vec3( positionBasedUv, 1 ) ).xy;\n #endif\n\t\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n\t#endif\n#endif";
297
297
 
298
298
  var alphamap_pars_fragment = "#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif";
299
299
 
@@ -301,7 +301,7 @@ var alphatest_fragment = "#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdi
301
301
 
302
302
  var alphatest_pars_fragment = "#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif";
303
303
 
304
- var aomap_fragment = "#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif";
304
+ var aomap_fragment = "#ifdef USE_AOMAP\n #ifdef USE_AOMAP_TRIPLANAR\n\t\tfloat ambientOcclusion = ( texture2DTriplanar( aoMap, aoMapTransform, triplanarCoords, triplanarWeights ).r - 1.0 ) * aoMapIntensity + 1.0;\n #else\n #if defined( USE_AOMAP_CYLINDRICAL )\n vec2 vAoMapUv = ( aoMapTransform * vec3( positionBasedUv, 1 ) ).xy;\n #endif\n\t\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n #endif\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif";
305
305
 
306
306
  var aomap_pars_fragment = "#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif";
307
307
 
@@ -335,11 +335,11 @@ var color_pars_vertex = "#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\
335
335
 
336
336
  var color_vertex = "#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.xyz;\n#endif";
337
337
 
338
- var common = "#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated";
338
+ var common = "#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\n#if defined( USE_MAP_TRIPLANAR ) || \\\n defined( USE_ALPHAMAP_TRIPLANAR ) || \\\n defined( USE_NORMALMAP_TRIPLANAR ) || \\\n defined( USE_ROUGHNESSMAP_TRIPLANAR ) || \\\n defined( USE_AOMAP_TRIPLANAR ) || \\\n defined( USE_METALNESSMAP_TRIPLANAR ) || \\\n defined( USE_CLEARCOAT_NORMALMAP_TRIPLANAR )\n #define USE_TRIPLANAR\n#endif\n#if defined( USE_MAP_TRIPLANAR ) || \\\n defined( USE_ALPHAMAP_TRIPLANAR ) || \\\n defined( USE_ROUGHNESSMAP_TRIPLANAR ) || \\\n defined( USE_AOMAP_TRIPLANAR ) || \\\n defined( USE_METALNESSMAP_TRIPLANAR )\n vec4 texture2DTriplanar( sampler2D map, mat3 uvTransform, vec3 coords, vec3 weights ) {\n return weights.x * texture2D( map, (uvTransform * vec3(coords.zy, 1)).xy ) +\n weights.y * texture2D( map, (uvTransform * vec3(coords.xz, 1)).xy ) +\n weights.z * texture2D( map, (uvTransform * vec3(coords.xy, 1)).xy );\n \n }\n#endif\n#if defined( USE_NORMALMAP_TRIPLANAR ) || defined( USE_CLEARCOAT_NORMALMAP_TRIPLANAR )\n vec3 texture2DTriplanarNormal( sampler2D normalMap, mat3 uvTransform, vec2 normalMapScale, vec3 normal, vec3 coords, vec3 weights ) {\n \n vec2 uvX = coords.zy; vec2 uvY = coords.xz; vec2 uvZ = coords.xy; \n vec3 tnormalX = texture2D( normalMap, (uvTransform * vec3(uvX, 1)).xy ).xyz * 2.0 - 1.0;\n vec3 tnormalY = texture2D( normalMap, (uvTransform * vec3(uvY, 1)).xy ).xyz * 2.0 - 1.0;\n vec3 tnormalZ = texture2D( normalMap, (uvTransform * vec3(uvZ, 1)).xy ).xyz * 2.0 - 1.0;\n tnormalX.xy *= normalMapScale;\n tnormalY.xy *= normalMapScale;\n tnormalZ.xy *= normalMapScale;\n \n tnormalX = vec3(\n tnormalX.xy + normal.zy,\n abs(tnormalX.z) * normal.x\n );\n tnormalY = vec3(\n tnormalY.xy + normal.xz,\n abs(tnormalY.z) * normal.y\n );\n tnormalZ = vec3(\n tnormalZ.xy + normal.xy,\n abs(tnormalZ.z) * normal.z\n );\n \n return normalize(\n tnormalX.zyx * weights.x +\n tnormalY.xzy * weights.y +\n tnormalZ.xyz * weights.z\n );\n }\n#endif\n#if defined( USE_MAP_CYLINDRICAL ) || \\\n defined( USE_ALPHAMAP_CYLINDRICAL ) || \\\n defined( USE_NORMALMAP_CYLINDRICAL ) || \\\n defined( USE_ROUGHNESSMAP_CYLINDRICAL ) || \\\n defined( USE_AOMAP_CYLINDRICAL ) || \\\n defined( USE_METALNESSMAP_CYLINDRICAL ) || \\\n defined( USE_CLEARCOAT_NORMALMAP_CYLINDRICAL )\n #define USE_CYLINDRICAL\n#endif";
339
339
 
340
340
  var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif";
341
341
 
342
- var defaultnormal_vertex = "vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif";
342
+ var defaultnormal_vertex = "vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#if defined( USE_TANGENT_FROM_NORMAL ) || defined( USE_NORMALMAP_TRIPLANAR )\n mat3 tangentMatrix = mat3(1.0);\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n #endif\n #if defined( USE_TANGENT_FROM_NORMAL ) || defined( USE_NORMALMAP_TRIPLANAR )\n tangentMatrix = bm * tangentMatrix;\n #endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n #endif\n #if defined( USE_TANGENT_FROM_NORMAL ) || defined( USE_NORMALMAP_TRIPLANAR )\n tangentMatrix = im * tangentMatrix;\n #endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif\n#if defined( USE_TANGENT_FROM_NORMAL ) || defined( USE_NORMALMAP_TRIPLANAR )\n tangentMatrix = mat3( modelViewMatrix ) * tangentMatrix;\n#endif";
343
343
 
344
344
  var displacementmap_pars_vertex = "#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif";
345
345
 
@@ -409,7 +409,9 @@ var logdepthbuf_pars_vertex = "#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDept
409
409
 
410
410
  var logdepthbuf_vertex = "#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif";
411
411
 
412
- var map_fragment = "#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif";
412
+ var map_fragment = "#ifdef USE_MAP\n\t#ifdef USE_MAP_TRIPLANAR\n\t\tvec4 sampledDiffuseColor = texture2DTriplanar( map, mapTransform, triplanarCoords, triplanarWeights );\n\t#else\n #if defined( USE_MAP_CYLINDRICAL )\n vec2 vMapUv = ( mapTransform * vec3( positionBasedUv, 1 ) ).xy;\n #endif\n\t\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#endif\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif";
413
+
414
+ var triplanar_fragment = "#ifdef USE_TRIPLANAR\n\tvec3 triplanarWeights = pow(abs(mat3(texture3DMatrix) * vModelNormal), vec3(triplanarHardness, triplanarHardness, triplanarHardness));\n\ttriplanarWeights /= dot(triplanarWeights, vec3(1.0, 1.0, 1.0));\n\tvec3 triplanarCoords = vModelPosition.xyz;\n#endif\n#ifdef USE_CYLINDRICAL\n\tfloat positionBasedU1 = fract(atan(vModelPosition.z, vModelPosition.x) * RECIPROCAL_PI2);\n\tfloat positionBasedU2 = fract(positionBasedU1 + 0.5) - 0.5;\n vec2 positionBasedUv = vec2(fwidth(positionBasedU1) < fwidth(positionBasedU2) - 1e-3 ? positionBasedU1 : positionBasedU2, vModelPosition.y);\n#endif";
413
415
 
414
416
  var map_pars_fragment = "#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif";
415
417
 
@@ -417,7 +419,7 @@ var map_particle_fragment = "#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n
417
419
 
418
420
  var map_particle_pars_fragment = "#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif";
419
421
 
420
- var metalnessmap_fragment = "float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif";
422
+ var metalnessmap_fragment = "float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n #ifdef USE_METALNESSMAP_TRIPLANAR\n\t\tvec4 texelMetalness = texture2DTriplanar( metalnessMap, metalnessMapTransform, triplanarCoords, triplanarWeights );\n #else\n #if defined( USE_METALNESSMAP_CYLINDRICAL )\n vec2 vMetalnessMapUv = ( metalnessMapTransform * vec3( positionBasedUv, 1 ) ).xy;\n #endif\n\t\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n #endif\n\tmetalnessFactor *= texelMetalness.b;\n#endif";
421
423
 
422
424
  var metalnessmap_pars_fragment = "#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif";
423
425
 
@@ -431,21 +433,21 @@ var morphtarget_pars_vertex = "#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING
431
433
 
432
434
  var morphtarget_vertex = "#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif";
433
435
 
434
- var normal_fragment_begin = "float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;";
436
+ var normal_fragment_begin = "float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#if defined( USE_TANGENT )\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #elif defined( USE_NORMALMAP_UV )\n\t mat3 tbn = getTangentFrame( - vViewPosition, normal, vNormalMapUv );\n #elif defined( USE_NORMALMAP_CYLINDRICAL ) || defined( USE_CLEARCOAT_NORMALMAP_CYLINDRICAL ) || (defined( USE_ANISOTROPY ) && !defined( USE_UV1 ) || !defined( USE_UV2 ) && !defined( USE_UV3 ))\n \n #if defined( USE_NORMALMAP_CYLINDRICAL )\n vec2 vNormalMapUv = ( normalMapTransform * vec3( positionBasedUv, 1 ) ).xy;\n #endif\n #if defined( USE_CLEARCOAT_NORMALMAP_CYLINDRICAL )\n vec2 vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( positionBasedUv, 1 ) ).xy;\n #endif\n vec3 tangent = normalize(cross(normal, mat3(modelViewMatrix) * transpose(mat3(texture3DMatrix)) * vec3(0, 1, 0)));\n vec3 bitangent = cross(tangent, normal);\n \tmat3 tbn = mat3(tangent, bitangent, normal);\n \n\t#elif defined( USE_CLEARCOAT_NORMALMAP_UV )\n\t mat3 tbn = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#else\n\t mat3 tbn = getTangentFrame( - vViewPosition, normal, vUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #elif defined( USE_CLEARCOAT_NORMALMAP_CYLINDRICAL )\n vec3 tangent2 = normalize(cross(normal, mat3(modelViewMatrix) * transpose(mat3(texture3DMatrix)) * vec3(0, 1, 0)));\n vec3 bitangent2 = cross(tangent2, normal);\n \tmat3 tbn2 = mat3(tangent2, bitangent2, normal);\n\t#elif defined( USE_CLEARCOAT_NORMALMAP_UV )\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;";
435
437
 
436
- var normal_fragment_maps = "#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif";
438
+ var normal_fragment_maps = "#ifdef USE_NORMALMAP_TRIPLANAR\n\tnormal = normalize(normalMatrix * transpose(mat3(texture3DMatrix)) * texture2DTriplanarNormal( normalMap, normalMapTransform, normalScale, normalize(mat3(texture3DMatrix) * vModelNormal.xyz), triplanarCoords, triplanarWeights ));\n#elif defined( USE_NORMALMAP_OBJECTSPACE )\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif";
437
439
 
438
- var normal_pars_fragment = "#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif";
440
+ var normal_pars_fragment = "#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#if defined( USE_TANGENT )\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif";
439
441
 
440
- var normal_pars_vertex = "#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif";
442
+ var normal_pars_vertex = "#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#if defined( USE_TANGENT )\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif";
441
443
 
442
444
  var normal_vertex = "#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif";
443
445
 
444
- var normalmap_pars_fragment = "#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif";
446
+ var normalmap_pars_fragment = "#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\t\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif";
445
447
 
446
448
  var clearcoat_normal_fragment_begin = "#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif";
447
449
 
448
- var clearcoat_normal_fragment_maps = "#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif";
450
+ var clearcoat_normal_fragment_maps = "#ifdef USE_CLEARCOAT_NORMALMAP_TRIPLANAR\n\tnormal = normalize(normalMatrix * transpose(mat3(texture3DMatrix)) * texture2DTriplanarNormal( clearcoatNormalMap, clearcoatNormalMapTransform, clearcoatNormalScale, normalize(mat3(texture3DMatrix) * vModelNormal.xyz), triplanarCoords, triplanarWeights ));\n#elif defined( USE_CLEARCOAT_NORMALMAP )\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif";
449
451
 
450
452
  var clearcoat_pars_fragment = "#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif";
451
453
 
@@ -463,7 +465,7 @@ var dithering_fragment = "#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_F
463
465
 
464
466
  var dithering_pars_fragment = "#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif";
465
467
 
466
- var roughnessmap_fragment = "float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif";
468
+ var roughnessmap_fragment = "float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP_TRIPLANAR\n\tvec4 texelRoughness = texture2DTriplanar( roughnessMap, roughnessMapTransform, triplanarCoords, triplanarWeights );\n\troughnessFactor *= texelRoughness.g;\n#elif defined( USE_ROUGHNESSMAP )\n #if defined( USE_ROUGHNESSMAP_CYLINDRICAL )\n vec2 vRoughnessMapUv = ( roughnessMapTransform * vec3( positionBasedUv, 1 ) ).xy;\n #endif\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif";
467
469
 
468
470
  var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif";
469
471
 
@@ -495,11 +497,11 @@ var transmission_fragment = "#ifdef USE_TRANSMISSION\n\tmaterial.transmission =
495
497
 
496
498
  var transmission_pars_fragment = "#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t#else\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif";
497
499
 
498
- var uv_pars_fragment = "#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif";
500
+ var uv_pars_fragment = "#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#if defined( USE_TRIPLANAR )\nuniform float triplanarHardness;\n#endif\n#if defined( USE_TRIPLANAR ) || defined( USE_CYLINDRICAL )\n\tvarying vec3 vModelPosition;\n#endif\n#if defined( USE_TRIPLANAR ) || defined( USE_CYLINDRICAL ) || (defined(USE_ANISOTROPY) && !defined(USE_UV1) && !defined(USE_UV2) && !defined(USE_UV3))\n\tvarying vec3 vModelNormal;\n uniform mat4 texture3DMatrix;\n uniform mat4 invTexture3DMatrix;\n#endif\n#if defined( USE_MAP_CYLINDRICAL ) || defined( USE_MAP_TRIPLANAR )\n\tuniform mat3 mapTransform;\n#elif defined( USE_MAP_UV )\n\tvarying vec2 vMapUv;\n#endif\n#if defined( USE_ALPHAMAP_CYLINDRICAL ) || defined( USE_ALPHAMAP_TRIPLANAR )\n\tuniform mat3 alphaMapTransform;\n#elif defined( USE_ALPHAMAP_UV )\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#if defined( USE_AOMAP_CYLINDRICAL ) || defined( USE_AOMAP_TRIPLANAR )\n\tuniform mat3 aoMapTransform;\n#elif defined( USE_AOMAP_UV )\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#if defined( USE_NORMALMAP_CYLINDRICAL ) || defined( USE_NORMALMAP_TRIPLANAR )\n\tuniform mat3 normalMapTransform;\n#elif defined( USE_NORMALMAP_UV )\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#if defined( USE_METALNESSMAP_CYLINDRICAL ) || defined( USE_METALNESSMAP_TRIPLANAR )\n\tuniform mat3 metalnessMapTransform;\n#elif defined( USE_METALNESSMAP_UV )\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#if defined( USE_ROUGHNESSMAP_CYLINDRICAL ) || defined( USE_ROUGHNESSMAP_TRIPLANAR )\n\tuniform mat3 roughnessMapTransform;\n#elif defined( USE_ROUGHNESSMAP_UV )\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#if defined( USE_CLEARCOAT_NORMALMAP_CYLINDRICAL ) || defined( USE_CLEARCOAT_NORMALMAP_TRIPLANAR )\n\tuniform mat3 clearcoatNormalMapTransform;\n#elif defined( USE_CLEARCOAT_NORMALMAP_UV )\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif";
499
501
 
500
- var uv_pars_vertex = "#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif";
502
+ var uv_pars_vertex = "#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#if defined( USE_TRIPLANAR ) || defined( USE_CYLINDRICAL ) || ( defined(USE_ANISOTROPY) && !defined(USE_UV1) && !defined(USE_UV2) && !defined(USE_UV3) )\n\tuniform mat4 texture3DMatrix;\n#endif\n#if defined( USE_TRIPLANAR ) || defined( USE_CYLINDRICAL )\n\tvarying vec3 vModelPosition;\n#endif\n#if defined( USE_TRIPLANAR ) || ( defined(USE_ANISOTROPY) && !defined(USE_UV1) && !defined(USE_UV2) && !defined(USE_UV3) )\n\tvarying vec3 vModelNormal;\n#endif\n#if defined( USE_CYLINDRICAL )\n#endif\n#if defined( USE_MAP_UV )\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#if defined( USE_ALPHAMAP_UV )\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#if defined( USE_AOMAP_UV )\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#if defined( USE_NORMALMAP_UV )\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#if defined( USE_METALNESSMAP_UV )\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#if defined( USE_ROUGHNESSMAP_UV )\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif";
501
503
 
502
- var uv_vertex = "#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif";
504
+ var uv_vertex = "#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n #if defined( USE_UV1 ) || defined( USE_UV2 ) || defined( USE_UV3 )\n\t vUv = vec3( uv, 1 ).xy;\n #endif\n#endif\n#if defined( USE_TRIPLANAR ) || defined( USE_CYLINDRICAL )\n\tvModelPosition = (texture3DMatrix * vec4(position.xyz, 1)).xyz;\n#endif\n#if defined( USE_TRIPLANAR )\n\tvModelNormal = normal.xyz;\n#endif\n#if defined( USE_MAP_UV )\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#if defined( USE_ALPHAMAP_UV )\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#if defined( USE_AOMAP_UV )\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#if defined( USE_NORMALMAP_UV )\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#if defined( USE_METALNESSMAP_UV )\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#if defined( USE_ROUGHNESSMAP_UV )\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif";
503
505
 
504
506
  var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif";
505
507
 
@@ -527,7 +529,7 @@ const vertex$c = "varying vec3 vWorldDirection;\n#include <common>\nvoid main()
527
529
 
528
530
  const fragment$c = "uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";
529
531
 
530
- const vertex$b = "uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}";
532
+ const vertex$b = "uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}";
531
533
 
532
534
  const fragment$b = "uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}";
533
535
 
@@ -553,7 +555,7 @@ const fragment$6 = "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;
553
555
 
554
556
  const vertex$5 = "#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}";
555
557
 
556
- const fragment$5 = "#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
558
+ const fragment$5 = "#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <triplanar_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
557
559
 
558
560
  const vertex$4 = "#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
559
561
 
@@ -633,6 +635,7 @@ const ShaderChunk = {
633
635
  logdepthbuf_pars_vertex: logdepthbuf_pars_vertex,
634
636
  logdepthbuf_vertex: logdepthbuf_vertex,
635
637
  map_fragment: map_fragment,
638
+ triplanar_fragment: triplanar_fragment,
636
639
  map_pars_fragment: map_pars_fragment,
637
640
  map_particle_fragment: map_particle_fragment,
638
641
  map_particle_pars_fragment: map_particle_pars_fragment,
@@ -716,10 +719,7 @@ const ShaderChunk = {
716
719
  sprite_frag: fragment$1
717
720
  };
718
721
 
719
- /**
720
- * Uniforms library for shared webgl shaders
721
- */
722
-
722
+ // Uniforms library for shared webgl shaders
723
723
  const UniformsLib = {
724
724
 
725
725
  common: {
@@ -733,7 +733,10 @@ const UniformsLib = {
733
733
  alphaMap: { value: null },
734
734
  alphaMapTransform: { value: /*@__PURE__*/ new Matrix3() },
735
735
 
736
- alphaTest: { value: 0 }
736
+ alphaTest: { value: 0 },
737
+
738
+ texture3DMatrix: { value: /*@__PURE__*/ new Matrix4() },
739
+ triplanarHardness: { value: 16.0 }
737
740
 
738
741
  },
739
742
 
@@ -748,7 +751,7 @@ const UniformsLib = {
748
751
 
749
752
  envMap: { value: null },
750
753
  envMapRotation: { value: /*@__PURE__*/ new Matrix3() },
751
- flipEnvMap: { value: -1 },
754
+ flipEnvMap: { value: - 1 },
752
755
  reflectivity: { value: 1.0 }, // basic, lambert, phong
753
756
  ior: { value: 1.5 }, // physical
754
757
  refractionRatio: { value: 0.98 }, // basic, lambert, phong
@@ -1169,7 +1172,7 @@ const ShaderLib = {
1169
1172
 
1170
1173
  uniforms: {
1171
1174
  envMap: { value: null },
1172
- flipEnvMap: { value: -1 },
1175
+ flipEnvMap: { value: - 1 },
1173
1176
  backgroundBlurriness: { value: 0 },
1174
1177
  backgroundIntensity: { value: 1 },
1175
1178
  backgroundRotation: { value: /*@__PURE__*/ new Matrix3() }
@@ -1184,7 +1187,7 @@ const ShaderLib = {
1184
1187
 
1185
1188
  uniforms: {
1186
1189
  tCube: { value: null },
1187
- tFlip: { value: -1 },
1190
+ tFlip: { value: - 1 },
1188
1191
  opacity: { value: 1.0 }
1189
1192
  },
1190
1193
 
@@ -1387,7 +1390,8 @@ function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha,
1387
1390
  side: BackSide,
1388
1391
  depthTest: false,
1389
1392
  depthWrite: false,
1390
- fog: false
1393
+ fog: false,
1394
+ allowOverride: false
1391
1395
  } )
1392
1396
  );
1393
1397
 
@@ -1418,18 +1422,18 @@ function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha,
1418
1422
  _e1$1.copy( scene.backgroundRotation );
1419
1423
 
1420
1424
  // accommodate left-handed frame
1421
- _e1$1.x *= -1; _e1$1.y *= -1; _e1$1.z *= -1;
1425
+ _e1$1.x *= - 1; _e1$1.y *= - 1; _e1$1.z *= - 1;
1422
1426
 
1423
1427
  if ( background.isCubeTexture && background.isRenderTargetTexture === false ) {
1424
1428
 
1425
1429
  // environment maps which are not cube render targets or PMREMs follow a different convention
1426
- _e1$1.y *= -1;
1427
- _e1$1.z *= -1;
1430
+ _e1$1.y *= - 1;
1431
+ _e1$1.z *= - 1;
1428
1432
 
1429
1433
  }
1430
1434
 
1431
1435
  boxMesh.material.uniforms.envMap.value = background;
1432
- boxMesh.material.uniforms.flipEnvMap.value = ( background.isCubeTexture && background.isRenderTargetTexture === false ) ? -1 : 1;
1436
+ boxMesh.material.uniforms.flipEnvMap.value = ( background.isCubeTexture && background.isRenderTargetTexture === false ) ? - 1 : 1;
1433
1437
  boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;
1434
1438
  boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
1435
1439
  boxMesh.material.uniforms.backgroundRotation.value.setFromMatrix4( _m1$1.makeRotationFromEuler( _e1$1 ) );
@@ -1466,7 +1470,8 @@ function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha,
1466
1470
  side: FrontSide,
1467
1471
  depthTest: false,
1468
1472
  depthWrite: false,
1469
- fog: false
1473
+ fog: false,
1474
+ allowOverride: false
1470
1475
  } )
1471
1476
  );
1472
1477
 
@@ -2693,9 +2698,9 @@ const _axisDirections = [
2693
2698
  /*@__PURE__*/ new Vector3( INV_PHI, 0, PHI ),
2694
2699
  /*@__PURE__*/ new Vector3( 0, PHI, - INV_PHI ),
2695
2700
  /*@__PURE__*/ new Vector3( 0, PHI, INV_PHI ),
2696
- /*@__PURE__*/ new Vector3( -1, 1, -1 ),
2697
- /*@__PURE__*/ new Vector3( 1, 1, -1 ),
2698
- /*@__PURE__*/ new Vector3( -1, 1, 1 ),
2701
+ /*@__PURE__*/ new Vector3( - 1, 1, - 1 ),
2702
+ /*@__PURE__*/ new Vector3( 1, 1, - 1 ),
2703
+ /*@__PURE__*/ new Vector3( - 1, 1, 1 ),
2699
2704
  /*@__PURE__*/ new Vector3( 1, 1, 1 ) ];
2700
2705
 
2701
2706
  const _origin = /*@__PURE__*/ new Vector3();
@@ -2711,12 +2716,16 @@ const _origin = /*@__PURE__*/ new Vector3();
2711
2716
  * higher roughness levels. In this way we maintain resolution to smoothly
2712
2717
  * interpolate diffuse lighting while limiting sampling computation.
2713
2718
  *
2714
- * Paper: Fast, Accurate Image-Based Lighting
2715
- * https://drive.google.com/file/d/15y8r_UpKlU9SvV4ILb0C3qCPecS8pvLz/view
2719
+ * Paper: Fast, Accurate Image-Based Lighting:
2720
+ * {@link https://drive.google.com/file/d/15y8r_UpKlU9SvV4ILb0C3qCPecS8pvLz/view}
2716
2721
  */
2717
-
2718
2722
  class PMREMGenerator {
2719
2723
 
2724
+ /**
2725
+ * Constructs a new PMREM generator.
2726
+ *
2727
+ * @param {WebGLRenderer} renderer - The renderer.
2728
+ */
2720
2729
  constructor( renderer ) {
2721
2730
 
2722
2731
  this._renderer = renderer;
@@ -2742,12 +2751,14 @@ class PMREMGenerator {
2742
2751
  * in radians to be applied to the scene before PMREM generation. Optional near
2743
2752
  * and far planes ensure the scene is rendered in its entirety.
2744
2753
  *
2745
- * @param {Scene} scene
2746
- * @param {number} sigma
2747
- * @param {number} near
2748
- * @param {number} far
2749
- * @param {Object} [options={}]
2750
- * @return {WebGLRenderTarget}
2754
+ * @param {Scene} scene - The scene to be captured.
2755
+ * @param {number} [sigma=0] - The blur radius in radians.
2756
+ * @param {number} [near=0.1] - The near plane distance.
2757
+ * @param {number} [far=100] - The far plane distance.
2758
+ * @param {Object} [options={}] - The configuration options.
2759
+ * @param {number} [options.size=256] - The texture size of the PMREM.
2760
+ * @param {Vector3} [options.renderTarget=origin] - The position of the internal cube camera that renders the scene.
2761
+ * @return {WebGLRenderTarget} The resulting PMREM.
2751
2762
  */
2752
2763
  fromScene( scene, sigma = 0, near = 0.1, far = 100, options = {} ) {
2753
2764
 
@@ -2787,11 +2798,10 @@ class PMREMGenerator {
2787
2798
  * Generates a PMREM from an equirectangular texture, which can be either LDR
2788
2799
  * or HDR. The ideal input image size is 1k (1024 x 512),
2789
2800
  * as this matches best with the 256 x 256 cubemap output.
2790
- * The smallest supported equirectangular image size is 64 x 32.
2791
2801
  *
2792
- * @param {Texture} equirectangular
2793
- * @param {?WebGLRenderTarget} [renderTarget=null] - Optional render target.
2794
- * @return {WebGLRenderTarget}
2802
+ * @param {Texture} equirectangular - The equirectangular texture to be converted.
2803
+ * @param {?WebGLRenderTarget} [renderTarget=null] - The render target to use.
2804
+ * @return {WebGLRenderTarget} The resulting PMREM.
2795
2805
  */
2796
2806
  fromEquirectangular( equirectangular, renderTarget = null ) {
2797
2807
 
@@ -2803,11 +2813,10 @@ class PMREMGenerator {
2803
2813
  * Generates a PMREM from an cubemap texture, which can be either LDR
2804
2814
  * or HDR. The ideal input cube size is 256 x 256,
2805
2815
  * as this matches best with the 256 x 256 cubemap output.
2806
- * The smallest supported cube size is 16 x 16.
2807
2816
  *
2808
- * @param {Texture} cubemap
2809
- * @param {null} [renderTarget=null] - Optional render target.
2810
- * @return {WebGLRenderTarget}
2817
+ * @param {Texture} cubemap - The cubemap texture to be converted.
2818
+ * @param {?WebGLRenderTarget} [renderTarget=null] - The render target to use.
2819
+ * @return {WebGLRenderTarget} The resulting PMREM.
2811
2820
  */
2812
2821
  fromCubemap( cubemap, renderTarget = null ) {
2813
2822
 
@@ -2970,8 +2979,8 @@ class PMREMGenerator {
2970
2979
  const fov = 90;
2971
2980
  const aspect = 1;
2972
2981
  const cubeCamera = new PerspectiveCamera( fov, aspect, near, far );
2973
- const upSign = [ 1, -1, 1, 1, 1, 1 ];
2974
- const forwardSign = [ 1, 1, 1, -1, -1, -1 ];
2982
+ const upSign = [ 1, - 1, 1, 1, 1, 1 ];
2983
+ const forwardSign = [ 1, 1, 1, - 1, - 1, - 1 ];
2975
2984
  const renderer = this._renderer;
2976
2985
 
2977
2986
  const originalAutoClear = renderer.autoClear;
@@ -3074,7 +3083,7 @@ class PMREMGenerator {
3074
3083
 
3075
3084
  }
3076
3085
 
3077
- this._cubemapMaterial.uniforms.flipEnvMap.value = ( texture.isRenderTargetTexture === false ) ? -1 : 1;
3086
+ this._cubemapMaterial.uniforms.flipEnvMap.value = ( texture.isRenderTargetTexture === false ) ? - 1 : 1;
3078
3087
 
3079
3088
  } else {
3080
3089
 
@@ -3130,6 +3139,7 @@ class PMREMGenerator {
3130
3139
  * the poles) to approximate the orthogonally-separable blur. It is least
3131
3140
  * accurate at the poles, but still does a decent job.
3132
3141
  *
3142
+ * @private
3133
3143
  * @param {WebGLRenderTarget} cubeUVRenderTarget
3134
3144
  * @param {number} lodIn
3135
3145
  * @param {number} lodOut
@@ -3293,7 +3303,7 @@ function _createPlanes( lodMax ) {
3293
3303
  for ( let face = 0; face < cubeFaces; face ++ ) {
3294
3304
 
3295
3305
  const x = ( face % 3 ) * 2 / 3 - 1;
3296
- const y = face > 2 ? 0 : -1;
3306
+ const y = face > 2 ? 0 : - 1;
3297
3307
  const coordinates = [
3298
3308
  x, y, 0,
3299
3309
  x + 2 / 3, y, 0,
@@ -3492,7 +3502,7 @@ function _getCubemapMaterial() {
3492
3502
 
3493
3503
  uniforms: {
3494
3504
  'envMap': { value: null },
3495
- 'flipEnvMap': { value: -1 }
3505
+ 'flipEnvMap': { value: - 1 }
3496
3506
  },
3497
3507
 
3498
3508
  vertexShader: _getCommonVertexShader(),
@@ -6106,14 +6116,17 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
6106
6116
  parameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '',
6107
6117
 
6108
6118
  parameters.map ? '#define USE_MAP' : '',
6119
+ parameters.mapMode === TriPlanarMapping ? '#define USE_MAP_TRIPLANAR' : parameters.mapMode === CylindricalMapping ? '#define USE_MAP_CYLINDRICAL' : parameters.mapMode === UVMapping ? '#define USE_MAP_UV' : '',
6109
6120
  parameters.envMap ? '#define USE_ENVMAP' : '',
6110
6121
  parameters.envMap ? '#define ' + envMapModeDefine : '',
6111
6122
  parameters.lightMap ? '#define USE_LIGHTMAP' : '',
6112
6123
  parameters.aoMap ? '#define USE_AOMAP' : '',
6124
+ parameters.aoMapMode === TriPlanarMapping ? '#define USE_AOMAP_TRIPLANAR' : parameters.aoMapMode === CylindricalMapping ? '#define USE_AOMAP_CYLINDRICAL' : parameters.aoMapMode == UVMapping ? '#define USE_AOMAP_UV' : '',
6113
6125
  parameters.bumpMap ? '#define USE_BUMPMAP' : '',
6114
6126
  parameters.normalMap ? '#define USE_NORMALMAP' : '',
6115
- parameters.normalMapObjectSpace ? '#define USE_NORMALMAP_OBJECTSPACE' : '',
6116
- parameters.normalMapTangentSpace ? '#define USE_NORMALMAP_TANGENTSPACE' : '',
6127
+ parameters.normalMapMode === TriPlanarMapping ? '#define USE_NORMALMAP_TRIPLANAR' : parameters.normalMapMode === CylindricalMapping ? '#define USE_NORMALMAP_CYLINDRICAL' : parameters.normalMapMode === UVMapping ? '#define USE_NORMALMAP_UV' : '',
6128
+ parameters.normalMapObjectSpace && [UVMapping, CylindricalMapping].includes( parameters.normalMapMode ) ? '#define USE_NORMALMAP_OBJECTSPACE' : '',
6129
+ parameters.normalMapTangentSpace && [UVMapping, CylindricalMapping].includes( parameters.normalMapMode ) ? '#define USE_NORMALMAP_TANGENTSPACE' : '',
6117
6130
  parameters.displacementMap ? '#define USE_DISPLACEMENTMAP' : '',
6118
6131
  parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',
6119
6132
 
@@ -6123,6 +6136,9 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
6123
6136
  parameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',
6124
6137
  parameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',
6125
6138
  parameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',
6139
+ parameters.clearcoatNormalMapMode === TriPlanarMapping ? '#define USE_CLEARCOAT_NORMALMAP_TRIPLANAR'
6140
+ : parameters.clearcoatNormalMapMode === CylindricalMapping ? '#define USE_CLEARCOAT_NORMALMAP_CYLINDRICAL'
6141
+ : parameters.clearcoatNormalMapMode === UVMapping ? '#define USE_CLEARCOAT_NORMALMAP_UV' : '',
6126
6142
 
6127
6143
  parameters.iridescenceMap ? '#define USE_IRIDESCENCEMAP' : '',
6128
6144
  parameters.iridescenceThicknessMap ? '#define USE_IRIDESCENCE_THICKNESSMAP' : '',
@@ -6132,8 +6148,11 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
6132
6148
  parameters.specularIntensityMap ? '#define USE_SPECULAR_INTENSITYMAP' : '',
6133
6149
 
6134
6150
  parameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '',
6151
+ parameters.roughnessMapMode === TriPlanarMapping ? '#define USE_ROUGHNESSMAP_TRIPLANAR' : parameters.roughnessMapMode === CylindricalMapping ? '#define USE_ROUGHNESSMAP_CYLINDRICAL' : parameters.roughnessMapMode === UVMapping ? '#define USE_ROUGHNESSMAP_UV' : '',
6135
6152
  parameters.metalnessMap ? '#define USE_METALNESSMAP' : '',
6153
+ parameters.metalnessMapMode === TriPlanarMapping ? '#define USE_METALNESSMAP_TRIPLANAR' : parameters.metalnessMapMode === CylindricalMapping ? '#define USE_METALNESSMAP_CYLINDRICAL' : parameters.metalnessMapMode === UVMapping ? '#define USE_METALNESSMAP_UV' : '',
6136
6154
  parameters.alphaMap ? '#define USE_ALPHAMAP' : '',
6155
+ parameters.alphaMapMode === TriPlanarMapping ? '#define USE_ALPHAMAP_TRIPLANAR' : parameters.alphaMapMode === CylindricalMapping ? '#define USE_ALPHAMAP_CYLINDRICAL' : parameters.alphaMapMode === UVMapping ? '#define USE_ALPHAMAP_UV' : '',
6137
6156
  parameters.alphaHash ? '#define USE_ALPHAHASH' : '',
6138
6157
 
6139
6158
  parameters.transmission ? '#define USE_TRANSMISSION' : '',
@@ -6298,6 +6317,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
6298
6317
 
6299
6318
  parameters.alphaToCoverage ? '#define ALPHA_TO_COVERAGE' : '',
6300
6319
  parameters.map ? '#define USE_MAP' : '',
6320
+ parameters.mapMode === TriPlanarMapping ? '#define USE_MAP_TRIPLANAR' : parameters.mapMode === CylindricalMapping ? '#define USE_MAP_CYLINDRICAL' : parameters.mapMode === UVMapping ? '#define USE_MAP_UV' : '',
6301
6321
  parameters.matcap ? '#define USE_MATCAP' : '',
6302
6322
  parameters.envMap ? '#define USE_ENVMAP' : '',
6303
6323
  parameters.envMap ? '#define ' + envMapTypeDefine : '',
@@ -6308,10 +6328,12 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
6308
6328
  envMapCubeUVSize ? '#define CUBEUV_MAX_MIP ' + envMapCubeUVSize.maxMip + '.0' : '',
6309
6329
  parameters.lightMap ? '#define USE_LIGHTMAP' : '',
6310
6330
  parameters.aoMap ? '#define USE_AOMAP' : '',
6331
+ parameters.aoMapMode === TriPlanarMapping ? '#define USE_AOMAP_TRIPLANAR' : parameters.aoMapMode === CylindricalMapping ? '#define USE_AOMAP_CYLINDRICAL' : parameters.aoMapMode == UVMapping ? '#define USE_AOMAP_UV' : '',
6311
6332
  parameters.bumpMap ? '#define USE_BUMPMAP' : '',
6312
6333
  parameters.normalMap ? '#define USE_NORMALMAP' : '',
6313
- parameters.normalMapObjectSpace ? '#define USE_NORMALMAP_OBJECTSPACE' : '',
6314
- parameters.normalMapTangentSpace ? '#define USE_NORMALMAP_TANGENTSPACE' : '',
6334
+ parameters.normalMapMode === TriPlanarMapping ? '#define USE_NORMALMAP_TRIPLANAR' : parameters.normalMapMode === CylindricalMapping ? '#define USE_NORMALMAP_CYLINDRICAL' : parameters.normalMapMode === UVMapping ? '#define USE_NORMALMAP_UV' : '',
6335
+ parameters.normalMapObjectSpace && [UVMapping, CylindricalMapping].includes( parameters.normalMapMode ) ? '#define USE_NORMALMAP_OBJECTSPACE' : '',
6336
+ parameters.normalMapTangentSpace && [UVMapping, CylindricalMapping].includes( parameters.normalMapMode ) ? '#define USE_NORMALMAP_TANGENTSPACE' : '',
6315
6337
  parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',
6316
6338
 
6317
6339
  parameters.anisotropy ? '#define USE_ANISOTROPY' : '',
@@ -6321,6 +6343,9 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
6321
6343
  parameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',
6322
6344
  parameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',
6323
6345
  parameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',
6346
+ parameters.clearcoatNormalMapMode === TriPlanarMapping ? '#define USE_CLEARCOAT_NORMALMAP_TRIPLANAR'
6347
+ : parameters.clearcoatNormalMapMode === CylindricalMapping ? '#define USE_CLEARCOAT_NORMALMAP_CYLINDRICAL'
6348
+ : parameters.clearcoatNormalMapMode === UVMapping ? '#define USE_CLEARCOAT_NORMALMAP_UV' : '',
6324
6349
 
6325
6350
  parameters.dispersion ? '#define USE_DISPERSION' : '',
6326
6351
 
@@ -6333,9 +6358,12 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
6333
6358
  parameters.specularIntensityMap ? '#define USE_SPECULAR_INTENSITYMAP' : '',
6334
6359
 
6335
6360
  parameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '',
6361
+ parameters.roughnessMapMode === TriPlanarMapping ? '#define USE_ROUGHNESSMAP_TRIPLANAR' : parameters.roughnessMapMode === CylindricalMapping ? '#define USE_ROUGHNESSMAP_CYLINDRICAL' : parameters.roughnessMapMode === UVMapping ? '#define USE_ROUGHNESSMAP_UV' : '',
6336
6362
  parameters.metalnessMap ? '#define USE_METALNESSMAP' : '',
6363
+ parameters.metalnessMapMode === TriPlanarMapping ? '#define USE_METALNESSMAP_TRIPLANAR' : parameters.metalnessMapMode === CylindricalMapping ? '#define USE_METALNESSMAP_CYLINDRICAL' : parameters.metalnessMapMode === UVMapping ? '#define USE_METALNESSMAP_UV' : '',
6337
6364
 
6338
6365
  parameters.alphaMap ? '#define USE_ALPHAMAP' : '',
6366
+ parameters.alphaMapMode === TriPlanarMapping ? '#define USE_ALPHAMAP_TRIPLANAR' : parameters.alphaMapMode === CylindricalMapping ? '#define USE_ALPHAMAP_CYLINDRICAL' : parameters.alphaMapMode === UVMapping ? '#define USE_ALPHAMAP_UV' : '',
6339
6367
  parameters.alphaTest ? '#define USE_ALPHATEST' : '',
6340
6368
  parameters.alphaHash ? '#define USE_ALPHAHASH' : '',
6341
6369
 
@@ -6376,7 +6404,9 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
6376
6404
  parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
6377
6405
  parameters.reverseDepthBuffer ? '#define USE_REVERSEDEPTHBUF' : '',
6378
6406
 
6407
+ 'uniform mat4 modelViewMatrix;',
6379
6408
  'uniform mat4 viewMatrix;',
6409
+ 'uniform mat3 normalMatrix;',
6380
6410
  'uniform vec3 cameraPosition;',
6381
6411
  'uniform bool isOrthographic;',
6382
6412
 
@@ -7012,21 +7042,27 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
7012
7042
 
7013
7043
  //
7014
7044
 
7015
- mapUv: HAS_MAP && getChannel( material.map.channel ),
7016
- aoMapUv: HAS_AOMAP && getChannel( material.aoMap.channel ),
7045
+ mapUv: HAS_MAP && material.map.mapping === UVMapping && getChannel( material.map.channel ),
7046
+ mapMode: HAS_MAP && material.map.mapping,
7047
+ aoMapUv: HAS_AOMAP && material.aoMap.mapping === UVMapping && getChannel( material.aoMap.channel ),
7048
+ aoMapMode: HAS_AOMAP && material.aoMap.mapping,
7017
7049
  lightMapUv: HAS_LIGHTMAP && getChannel( material.lightMap.channel ),
7018
7050
  bumpMapUv: HAS_BUMPMAP && getChannel( material.bumpMap.channel ),
7019
- normalMapUv: HAS_NORMALMAP && getChannel( material.normalMap.channel ),
7051
+ normalMapUv: HAS_NORMALMAP && material.normalMap.mapping === UVMapping && getChannel( material.normalMap.channel ),
7052
+ normalMapMode: HAS_NORMALMAP && material.normalMap.mapping,
7020
7053
  displacementMapUv: HAS_DISPLACEMENTMAP && getChannel( material.displacementMap.channel ),
7021
7054
  emissiveMapUv: HAS_EMISSIVEMAP && getChannel( material.emissiveMap.channel ),
7022
7055
 
7023
- metalnessMapUv: HAS_METALNESSMAP && getChannel( material.metalnessMap.channel ),
7024
- roughnessMapUv: HAS_ROUGHNESSMAP && getChannel( material.roughnessMap.channel ),
7056
+ metalnessMapUv: HAS_METALNESSMAP && material.metalnessMap.mapping === UVMapping && getChannel( material.metalnessMap.channel ),
7057
+ metalnessMapMode: HAS_METALNESSMAP && material.metalnessMap.mapping,
7058
+ roughnessMapUv: HAS_ROUGHNESSMAP && material.roughnessMap.mapping === UVMapping && getChannel( material.roughnessMap.channel ),
7059
+ roughnessMapMode: HAS_ROUGHNESSMAP && material.roughnessMap.mapping,
7025
7060
 
7026
7061
  anisotropyMapUv: HAS_ANISOTROPYMAP && getChannel( material.anisotropyMap.channel ),
7027
7062
 
7028
7063
  clearcoatMapUv: HAS_CLEARCOATMAP && getChannel( material.clearcoatMap.channel ),
7029
7064
  clearcoatNormalMapUv: HAS_CLEARCOAT_NORMALMAP && getChannel( material.clearcoatNormalMap.channel ),
7065
+ clearcoatNormalMapMode: HAS_CLEARCOAT_NORMALMAP && material.clearcoatNormalMap.mapping,
7030
7066
  clearcoatRoughnessMapUv: HAS_CLEARCOAT_ROUGHNESSMAP && getChannel( material.clearcoatRoughnessMap.channel ),
7031
7067
 
7032
7068
  iridescenceMapUv: HAS_IRIDESCENCEMAP && getChannel( material.iridescenceMap.channel ),
@@ -7042,7 +7078,8 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
7042
7078
  transmissionMapUv: HAS_TRANSMISSIONMAP && getChannel( material.transmissionMap.channel ),
7043
7079
  thicknessMapUv: HAS_THICKNESSMAP && getChannel( material.thicknessMap.channel ),
7044
7080
 
7045
- alphaMapUv: HAS_ALPHAMAP && getChannel( material.alphaMap.channel ),
7081
+ alphaMapUv: HAS_ALPHAMAP && material.alphaMap.mapping === UVMapping && getChannel( material.alphaMap.channel ),
7082
+ alphaMapMode: HAS_ALPHAMAP && material.alphaMap.mapping,
7046
7083
 
7047
7084
  //
7048
7085
 
@@ -7174,19 +7211,26 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
7174
7211
  array.push( parameters.outputColorSpace );
7175
7212
  array.push( parameters.envMapMode );
7176
7213
  array.push( parameters.envMapCubeUVHeight );
7214
+ array.push( parameters.mapMode );
7177
7215
  array.push( parameters.mapUv );
7216
+ array.push( parameters.alphaMapMode );
7178
7217
  array.push( parameters.alphaMapUv );
7179
7218
  array.push( parameters.lightMapUv );
7180
7219
  array.push( parameters.aoMapUv );
7220
+ array.push( parameters.aoMapMode );
7181
7221
  array.push( parameters.bumpMapUv );
7182
7222
  array.push( parameters.normalMapUv );
7223
+ array.push( parameters.normalMapMode );
7183
7224
  array.push( parameters.displacementMapUv );
7184
7225
  array.push( parameters.emissiveMapUv );
7185
7226
  array.push( parameters.metalnessMapUv );
7227
+ array.push( parameters.metalnessMapMode );
7186
7228
  array.push( parameters.roughnessMapUv );
7229
+ array.push( parameters.roughnessMapMode );
7187
7230
  array.push( parameters.anisotropyMapUv );
7188
7231
  array.push( parameters.clearcoatMapUv );
7189
7232
  array.push( parameters.clearcoatNormalMapUv );
7233
+ array.push( parameters.clearcoatNormalMapMode);
7190
7234
  array.push( parameters.clearcoatRoughnessMapUv );
7191
7235
  array.push( parameters.iridescenceMapUv );
7192
7236
  array.push( parameters.iridescenceThicknessMapUv );
@@ -7866,18 +7910,18 @@ function WebGLLights( extensions ) {
7866
7910
  version: 0,
7867
7911
 
7868
7912
  hash: {
7869
- directionalLength: -1,
7870
- pointLength: -1,
7871
- spotLength: -1,
7872
- rectAreaLength: -1,
7873
- hemiLength: -1,
7874
-
7875
- numDirectionalShadows: -1,
7876
- numPointShadows: -1,
7877
- numSpotShadows: -1,
7878
- numSpotMaps: -1,
7879
-
7880
- numLightProbes: -1
7913
+ directionalLength: - 1,
7914
+ pointLength: - 1,
7915
+ spotLength: - 1,
7916
+ rectAreaLength: - 1,
7917
+ hemiLength: - 1,
7918
+
7919
+ numDirectionalShadows: - 1,
7920
+ numPointShadows: - 1,
7921
+ numSpotShadows: - 1,
7922
+ numSpotMaps: - 1,
7923
+
7924
+ numLightProbes: - 1
7881
7925
  },
7882
7926
 
7883
7927
  ambient: [ 0, 0, 0 ],
@@ -8418,7 +8462,7 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
8418
8462
  fullScreenTri.setAttribute(
8419
8463
  'position',
8420
8464
  new BufferAttribute(
8421
- new Float32Array( [ -1, -1, 0.5, 3, -1, 0.5, -1, 3, 0.5 ] ),
8465
+ new Float32Array( [ - 1, - 1, 0.5, 3, - 1, 0.5, - 1, 3, 0.5 ] ),
8422
8466
  3
8423
8467
  )
8424
8468
  );
@@ -8851,7 +8895,7 @@ function WebGLState( gl, extensions ) {
8851
8895
  locked = false;
8852
8896
 
8853
8897
  currentColorMask = null;
8854
- currentColorClear.set( -1, 0, 0, 0 ); // set to invalid state
8898
+ currentColorClear.set( - 1, 0, 0, 0 ); // set to invalid state
8855
8899
 
8856
8900
  }
8857
8901
 
@@ -8862,17 +8906,17 @@ function WebGLState( gl, extensions ) {
8862
8906
  function DepthBuffer() {
8863
8907
 
8864
8908
  let locked = false;
8865
- let reversed = false;
8866
8909
 
8910
+ let currentReversed = false;
8867
8911
  let currentDepthMask = null;
8868
8912
  let currentDepthFunc = null;
8869
8913
  let currentDepthClear = null;
8870
8914
 
8871
8915
  return {
8872
8916
 
8873
- setReversed: function ( value ) {
8917
+ setReversed: function ( reversed ) {
8874
8918
 
8875
- if ( reversed !== value ) {
8919
+ if ( currentReversed !== reversed ) {
8876
8920
 
8877
8921
  const ext = extensions.get( 'EXT_clip_control' );
8878
8922
 
@@ -8886,19 +8930,19 @@ function WebGLState( gl, extensions ) {
8886
8930
 
8887
8931
  }
8888
8932
 
8933
+ currentReversed = reversed;
8934
+
8889
8935
  const oldDepth = currentDepthClear;
8890
8936
  currentDepthClear = null;
8891
8937
  this.setClear( oldDepth );
8892
8938
 
8893
8939
  }
8894
8940
 
8895
- reversed = value;
8896
-
8897
8941
  },
8898
8942
 
8899
8943
  getReversed: function () {
8900
8944
 
8901
- return reversed;
8945
+ return currentReversed;
8902
8946
 
8903
8947
  },
8904
8948
 
@@ -8929,7 +8973,7 @@ function WebGLState( gl, extensions ) {
8929
8973
 
8930
8974
  setFunc: function ( depthFunc ) {
8931
8975
 
8932
- if ( reversed ) depthFunc = reversedFuncs[ depthFunc ];
8976
+ if ( currentReversed ) depthFunc = reversedFuncs[ depthFunc ];
8933
8977
 
8934
8978
  if ( currentDepthFunc !== depthFunc ) {
8935
8979
 
@@ -8997,7 +9041,7 @@ function WebGLState( gl, extensions ) {
8997
9041
 
8998
9042
  if ( currentDepthClear !== depth ) {
8999
9043
 
9000
- if ( reversed ) {
9044
+ if ( currentReversed ) {
9001
9045
 
9002
9046
  depth = 1 - depth;
9003
9047
 
@@ -9017,7 +9061,7 @@ function WebGLState( gl, extensions ) {
9017
9061
  currentDepthMask = null;
9018
9062
  currentDepthFunc = null;
9019
9063
  currentDepthClear = null;
9020
- reversed = false;
9064
+ currentReversed = false;
9021
9065
 
9022
9066
  }
9023
9067
 
@@ -9180,12 +9224,12 @@ function WebGLState( gl, extensions ) {
9180
9224
  let version = 0;
9181
9225
  const glVersion = gl.getParameter( gl.VERSION );
9182
9226
 
9183
- if ( glVersion.indexOf( 'WebGL' ) !== -1 ) {
9227
+ if ( glVersion.indexOf( 'WebGL' ) !== - 1 ) {
9184
9228
 
9185
9229
  version = parseFloat( /^WebGL (\d)/.exec( glVersion )[ 1 ] );
9186
9230
  lineWidthAvailable = ( version >= 1.0 );
9187
9231
 
9188
- } else if ( glVersion.indexOf( 'OpenGL ES' ) !== -1 ) {
9232
+ } else if ( glVersion.indexOf( 'OpenGL ES' ) !== - 1 ) {
9189
9233
 
9190
9234
  version = parseFloat( /^OpenGL ES (\d)/.exec( glVersion )[ 1 ] );
9191
9235
  lineWidthAvailable = ( version >= 2.0 );
@@ -12527,18 +12571,53 @@ void main() {
12527
12571
 
12528
12572
  }`;
12529
12573
 
12574
+ /**
12575
+ * A XR module that manages the access to the Depth Sensing API.
12576
+ */
12530
12577
  class WebXRDepthSensing {
12531
12578
 
12579
+ /**
12580
+ * Constructs a new depth sensing module.
12581
+ */
12532
12582
  constructor() {
12533
12583
 
12584
+ /**
12585
+ * A texture representing the depth of the user's environment.
12586
+ *
12587
+ * @type {?Texture}
12588
+ */
12534
12589
  this.texture = null;
12590
+
12591
+ /**
12592
+ * A plane mesh for visualizing the depth texture.
12593
+ *
12594
+ * @type {?Mesh}
12595
+ */
12535
12596
  this.mesh = null;
12536
12597
 
12598
+ /**
12599
+ * The depth near value.
12600
+ *
12601
+ * @type {number}
12602
+ */
12537
12603
  this.depthNear = 0;
12604
+
12605
+ /**
12606
+ * The depth near far.
12607
+ *
12608
+ * @type {number}
12609
+ */
12538
12610
  this.depthFar = 0;
12539
12611
 
12540
12612
  }
12541
12613
 
12614
+ /**
12615
+ * Inits the depth sensing module
12616
+ *
12617
+ * @param {WebGLRenderer} renderer - The renderer.
12618
+ * @param {XRWebGLDepthInformation} depthData - The XR depth data.
12619
+ * @param {XRRenderState} renderState - The XR render state.
12620
+ */
12542
12621
  init( renderer, depthData, renderState ) {
12543
12622
 
12544
12623
  if ( this.texture === null ) {
@@ -12561,6 +12640,12 @@ class WebXRDepthSensing {
12561
12640
 
12562
12641
  }
12563
12642
 
12643
+ /**
12644
+ * Returns a plane mesh that visualizes the depth texture.
12645
+ *
12646
+ * @param {ArrayCamera} cameraXR - The XR camera.
12647
+ * @return {?Mesh} The plane mesh.
12648
+ */
12564
12649
  getMesh( cameraXR ) {
12565
12650
 
12566
12651
  if ( this.texture !== null ) {
@@ -12588,6 +12673,9 @@ class WebXRDepthSensing {
12588
12673
 
12589
12674
  }
12590
12675
 
12676
+ /**
12677
+ * Resets the module
12678
+ */
12591
12679
  reset() {
12592
12680
 
12593
12681
  this.texture = null;
@@ -12595,6 +12683,11 @@ class WebXRDepthSensing {
12595
12683
 
12596
12684
  }
12597
12685
 
12686
+ /**
12687
+ * Returns a texture representing the depth of the user's environment.
12688
+ *
12689
+ * @return {?Texture} The depth texture.
12690
+ */
12598
12691
  getDepthTexture() {
12599
12692
 
12600
12693
  return this.texture;
@@ -12603,8 +12696,23 @@ class WebXRDepthSensing {
12603
12696
 
12604
12697
  }
12605
12698
 
12699
+ /**
12700
+ * This class represents an abstraction of the WebXR Device API and is
12701
+ * internally used by {@link WebGLRenderer}. `WebXRManager` also provides a public
12702
+ * interface that allows users to enable/disable XR and perform XR related
12703
+ * tasks like for instance retrieving controllers.
12704
+ *
12705
+ * @augments EventDispatcher
12706
+ * @hideconstructor
12707
+ */
12606
12708
  class WebXRManager extends EventDispatcher {
12607
12709
 
12710
+ /**
12711
+ * Constructs a new WebGL renderer.
12712
+ *
12713
+ * @param {WebGLRenderer} renderer - The renderer.
12714
+ * @param {WebGL2RenderingContext} gl - The rendering context.
12715
+ */
12608
12716
  constructor( renderer, gl ) {
12609
12717
 
12610
12718
  super();
@@ -12656,11 +12764,40 @@ class WebXRManager extends EventDispatcher {
12656
12764
 
12657
12765
  //
12658
12766
 
12767
+ /**
12768
+ * Whether the manager's XR camera should be automatically updated or not.
12769
+ *
12770
+ * @type {boolean}
12771
+ * @default true
12772
+ */
12659
12773
  this.cameraAutoUpdate = true;
12774
+
12775
+ /**
12776
+ * This flag notifies the renderer to be ready for XR rendering. Set it to `true`
12777
+ * if you are going to use XR in your app.
12778
+ *
12779
+ * @type {boolean}
12780
+ * @default false
12781
+ */
12660
12782
  this.enabled = false;
12661
12783
 
12784
+ /**
12785
+ * Whether XR presentation is active or not.
12786
+ *
12787
+ * @type {boolean}
12788
+ * @readonly
12789
+ * @default false
12790
+ */
12662
12791
  this.isPresenting = false;
12663
12792
 
12793
+ /**
12794
+ * Returns a group representing the `target ray` space of the XR controller.
12795
+ * Use this space for visualizing 3D objects that support the user in pointing
12796
+ * tasks like UI interaction.
12797
+ *
12798
+ * @param {number} index - The index of the controller.
12799
+ * @return {Group} A group representing the `target ray` space.
12800
+ */
12664
12801
  this.getController = function ( index ) {
12665
12802
 
12666
12803
  let controller = controllers[ index ];
@@ -12676,6 +12813,21 @@ class WebXRManager extends EventDispatcher {
12676
12813
 
12677
12814
  };
12678
12815
 
12816
+ /**
12817
+ * Returns a group representing the `grip` space of the XR controller.
12818
+ * Use this space for visualizing 3D objects that support the user in pointing
12819
+ * tasks like UI interaction.
12820
+ *
12821
+ * Note: If you want to show something in the user's hand AND offer a
12822
+ * pointing ray at the same time, you'll want to attached the handheld object
12823
+ * to the group returned by `getControllerGrip()` and the ray to the
12824
+ * group returned by `getController()`. The idea is to have two
12825
+ * different groups in two different coordinate spaces for the same WebXR
12826
+ * controller.
12827
+ *
12828
+ * @param {number} index - The index of the controller.
12829
+ * @return {Group} A group representing the `grip` space.
12830
+ */
12679
12831
  this.getControllerGrip = function ( index ) {
12680
12832
 
12681
12833
  let controller = controllers[ index ];
@@ -12691,6 +12843,14 @@ class WebXRManager extends EventDispatcher {
12691
12843
 
12692
12844
  };
12693
12845
 
12846
+ /**
12847
+ * Returns a group representing the `hand` space of the XR controller.
12848
+ * Use this space for visualizing 3D objects that support the user in pointing
12849
+ * tasks like UI interaction.
12850
+ *
12851
+ * @param {number} index - The index of the controller.
12852
+ * @return {Group} A group representing the `hand` space.
12853
+ */
12694
12854
  this.getHand = function ( index ) {
12695
12855
 
12696
12856
  let controller = controllers[ index ];
@@ -12712,7 +12872,7 @@ class WebXRManager extends EventDispatcher {
12712
12872
 
12713
12873
  const controllerIndex = controllerInputSources.indexOf( event.inputSource );
12714
12874
 
12715
- if ( controllerIndex === -1 ) {
12875
+ if ( controllerIndex === - 1 ) {
12716
12876
 
12717
12877
  return;
12718
12878
 
@@ -12780,6 +12940,13 @@ class WebXRManager extends EventDispatcher {
12780
12940
 
12781
12941
  }
12782
12942
 
12943
+ /**
12944
+ * Sets the framebuffer scale factor.
12945
+ *
12946
+ * This method can not be used during a XR session.
12947
+ *
12948
+ * @param {number} value - The framebuffer scale factor.
12949
+ */
12783
12950
  this.setFramebufferScaleFactor = function ( value ) {
12784
12951
 
12785
12952
  framebufferScaleFactor = value;
@@ -12792,6 +12959,15 @@ class WebXRManager extends EventDispatcher {
12792
12959
 
12793
12960
  };
12794
12961
 
12962
+ /**
12963
+ * Sets the reference space type. Can be used to configure a spatial relationship with the user's physical
12964
+ * environment. Depending on how the user moves in 3D space, setting an appropriate reference space can
12965
+ * improve tracking. Default is `local-floor`.
12966
+ *
12967
+ * This method can not be used during a XR session.
12968
+ *
12969
+ * @param {string} value - The reference space type.
12970
+ */
12795
12971
  this.setReferenceSpaceType = function ( value ) {
12796
12972
 
12797
12973
  referenceSpaceType = value;
@@ -12804,42 +12980,81 @@ class WebXRManager extends EventDispatcher {
12804
12980
 
12805
12981
  };
12806
12982
 
12983
+ /**
12984
+ * Returns the XR reference space.
12985
+ *
12986
+ * @return {XRReferenceSpace} The XR reference space.
12987
+ */
12807
12988
  this.getReferenceSpace = function () {
12808
12989
 
12809
12990
  return customReferenceSpace || referenceSpace;
12810
12991
 
12811
12992
  };
12812
12993
 
12994
+ /**
12995
+ * Sets a custom XR reference space.
12996
+ *
12997
+ * @param {XRReferenceSpace} space - The XR reference space.
12998
+ */
12813
12999
  this.setReferenceSpace = function ( space ) {
12814
13000
 
12815
13001
  customReferenceSpace = space;
12816
13002
 
12817
13003
  };
12818
13004
 
13005
+ /**
13006
+ * Returns the current base layer.
13007
+ *
13008
+ * @return {?(XRWebGLLayer|XRProjectionLayer)} The XR base layer.
13009
+ */
12819
13010
  this.getBaseLayer = function () {
12820
13011
 
12821
13012
  return glProjLayer !== null ? glProjLayer : glBaseLayer;
12822
13013
 
12823
13014
  };
12824
13015
 
13016
+ /**
13017
+ * Returns the current XR binding.
13018
+ *
13019
+ * @return {?XRWebGLBinding} The XR binding.
13020
+ */
12825
13021
  this.getBinding = function () {
12826
13022
 
12827
13023
  return glBinding;
12828
13024
 
12829
13025
  };
12830
13026
 
13027
+ /**
13028
+ * Returns the current XR frame.
13029
+ *
13030
+ * @return {?XRFrame} The XR frame. Returns `null` when used outside a XR session.
13031
+ */
12831
13032
  this.getFrame = function () {
12832
13033
 
12833
13034
  return xrFrame;
12834
13035
 
12835
13036
  };
12836
13037
 
13038
+ /**
13039
+ * Returns the current XR session.
13040
+ *
13041
+ * @return {?XRSession} The XR session. Returns `null` when used outside a XR session.
13042
+ */
12837
13043
  this.getSession = function () {
12838
13044
 
12839
13045
  return session;
12840
13046
 
12841
13047
  };
12842
13048
 
13049
+ /**
13050
+ * After a XR session has been requested usually with one of the `*Button` modules, it
13051
+ * is injected into the renderer with this method. This method triggers the start of
13052
+ * the actual XR rendering.
13053
+ *
13054
+ * @async
13055
+ * @param {XRSession} value - The XR session to set.
13056
+ * @return {Promise} A Promise that resolves when the session has been set.
13057
+ */
12843
13058
  this.setSession = async function ( value ) {
12844
13059
 
12845
13060
  session = value;
@@ -12964,6 +13179,11 @@ class WebXRManager extends EventDispatcher {
12964
13179
 
12965
13180
  };
12966
13181
 
13182
+ /**
13183
+ * Returns the environment blend mode from the current XR session.
13184
+ *
13185
+ * @return {'opaque'|'additive'|'alpha-blend'|undefined} The environment blend mode. Returns `undefined` when used outside of a XR session.
13186
+ */
12967
13187
  this.getEnvironmentBlendMode = function () {
12968
13188
 
12969
13189
  if ( session !== null ) {
@@ -12974,6 +13194,11 @@ class WebXRManager extends EventDispatcher {
12974
13194
 
12975
13195
  };
12976
13196
 
13197
+ /**
13198
+ * Returns the current depth texture computed via depth sensing.
13199
+ *
13200
+ * @return {?Texture} The depth texture.
13201
+ */
12977
13202
  this.getDepthTexture = function () {
12978
13203
 
12979
13204
  return depthSensing.getDepthTexture();
@@ -13006,7 +13231,7 @@ class WebXRManager extends EventDispatcher {
13006
13231
 
13007
13232
  let controllerIndex = controllerInputSources.indexOf( inputSource );
13008
13233
 
13009
- if ( controllerIndex === -1 ) {
13234
+ if ( controllerIndex === - 1 ) {
13010
13235
 
13011
13236
  // Assign input source a controller that currently has no input source
13012
13237
 
@@ -13030,7 +13255,7 @@ class WebXRManager extends EventDispatcher {
13030
13255
 
13031
13256
  // If all controllers do currently receive input we ignore new ones
13032
13257
 
13033
- if ( controllerIndex === -1 ) break;
13258
+ if ( controllerIndex === - 1 ) break;
13034
13259
 
13035
13260
  }
13036
13261
 
@@ -13097,7 +13322,7 @@ class WebXRManager extends EventDispatcher {
13097
13322
  camera.matrixWorldInverse.copy( camera.matrixWorld ).invert();
13098
13323
 
13099
13324
  // Check if the projection uses an infinite far plane.
13100
- if ( projL[ 10 ] === -1 ) {
13325
+ if ( projL[ 10 ] === - 1.0 ) {
13101
13326
 
13102
13327
  // Use the projection matrix from the left eye.
13103
13328
  // The camera offset is sufficient to include the view volumes
@@ -13140,6 +13365,15 @@ class WebXRManager extends EventDispatcher {
13140
13365
 
13141
13366
  }
13142
13367
 
13368
+ /**
13369
+ * Updates the state of the XR camera. Use this method on app level if you
13370
+ * set cameraAutoUpdate` to `false`. The method requires the non-XR
13371
+ * camera of the scene as a parameter. The passed in camera's transformation
13372
+ * is automatically adjusted to the position of the XR camera when calling
13373
+ * this method.
13374
+ *
13375
+ * @param {Camera} camera - The camera.
13376
+ */
13143
13377
  this.updateCamera = function ( camera ) {
13144
13378
 
13145
13379
  if ( session === null ) return;
@@ -13235,12 +13469,27 @@ class WebXRManager extends EventDispatcher {
13235
13469
 
13236
13470
  }
13237
13471
 
13472
+ /**
13473
+ * Returns an instance of {@link ArrayCamera} which represents the XR camera
13474
+ * of the active XR session. For each view it holds a separate camera object.
13475
+ *
13476
+ * The camera's `fov` is currently not used and does not reflect the fov of
13477
+ * the XR camera. If you need the fov on app level, you have to compute in
13478
+ * manually from the XR camera's projection matrices.
13479
+ *
13480
+ * @return {ArrayCamera} The XR camera.
13481
+ */
13238
13482
  this.getCamera = function () {
13239
13483
 
13240
13484
  return cameraXR;
13241
13485
 
13242
13486
  };
13243
13487
 
13488
+ /**
13489
+ * Returns the amount of foveation used by the XR compositor for the projection layer.
13490
+ *
13491
+ * @return {number} The amount of foveation.
13492
+ */
13244
13493
  this.getFoveation = function () {
13245
13494
 
13246
13495
  if ( glProjLayer === null && glBaseLayer === null ) {
@@ -13253,6 +13502,12 @@ class WebXRManager extends EventDispatcher {
13253
13502
 
13254
13503
  };
13255
13504
 
13505
+ /**
13506
+ * Sets the foveation value.
13507
+ *
13508
+ * @param {number} value - A number in the range `[0,1]` where `0` means no foveation (full resolution)
13509
+ * and `1` means maximum foveation (the edges render at lower resolution).
13510
+ */
13256
13511
  this.setFoveation = function ( value ) {
13257
13512
 
13258
13513
  // 0 = no foveation = full resolution
@@ -13274,12 +13529,22 @@ class WebXRManager extends EventDispatcher {
13274
13529
 
13275
13530
  };
13276
13531
 
13532
+ /**
13533
+ * Returns `true` if depth sensing is supported.
13534
+ *
13535
+ * @return {boolean} Whether depth sensing is supported or not.
13536
+ */
13277
13537
  this.hasDepthSensing = function () {
13278
13538
 
13279
13539
  return depthSensing.texture !== null;
13280
13540
 
13281
13541
  };
13282
13542
 
13543
+ /**
13544
+ * Returns the depth sensing mesh.
13545
+ *
13546
+ * @return {Mesh} The depth sensing mesh.
13547
+ */
13283
13548
  this.getDepthSensingMesh = function () {
13284
13549
 
13285
13550
  return depthSensing.getMesh( cameraXR );
@@ -13338,7 +13603,7 @@ class WebXRManager extends EventDispatcher {
13338
13603
  renderer.setRenderTargetTextures(
13339
13604
  newRenderTarget,
13340
13605
  glSubImage.colorTexture,
13341
- glProjLayer.ignoreDepthValues ? undefined : glSubImage.depthStencilTexture );
13606
+ glSubImage.depthStencilTexture );
13342
13607
 
13343
13608
  renderer.setRenderTarget( newRenderTarget );
13344
13609
 
@@ -13580,6 +13845,18 @@ function WebGLMaterials( renderer, properties ) {
13580
13845
 
13581
13846
  }
13582
13847
 
13848
+ if ( material.texture3DMatrix ) {
13849
+
13850
+ uniforms.texture3DMatrix.value.copy( material.texture3DMatrix );
13851
+
13852
+ }
13853
+
13854
+ if ( material.triplanarHardness ) {
13855
+
13856
+ uniforms.triplanarHardness.value = material.triplanarHardness;
13857
+
13858
+ }
13859
+
13583
13860
  if ( material.alphaMap ) {
13584
13861
 
13585
13862
  uniforms.alphaMap.value = material.alphaMap;
@@ -13598,7 +13875,7 @@ function WebGLMaterials( renderer, properties ) {
13598
13875
 
13599
13876
  if ( material.side === BackSide ) {
13600
13877
 
13601
- uniforms.bumpScale.value *= -1;
13878
+ uniforms.bumpScale.value *= - 1;
13602
13879
 
13603
13880
  }
13604
13881
 
@@ -13665,19 +13942,19 @@ function WebGLMaterials( renderer, properties ) {
13665
13942
  _e1.copy( envMapRotation );
13666
13943
 
13667
13944
  // accommodate left-handed frame
13668
- _e1.x *= -1; _e1.y *= -1; _e1.z *= -1;
13945
+ _e1.x *= - 1; _e1.y *= - 1; _e1.z *= - 1;
13669
13946
 
13670
13947
  if ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) {
13671
13948
 
13672
13949
  // environment maps which are not cube render targets or PMREMs follow a different convention
13673
- _e1.y *= -1;
13674
- _e1.z *= -1;
13950
+ _e1.y *= - 1;
13951
+ _e1.z *= - 1;
13675
13952
 
13676
13953
  }
13677
13954
 
13678
13955
  uniforms.envMapRotation.value.setFromMatrix4( _m1.makeRotationFromEuler( _e1 ) );
13679
13956
 
13680
- uniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? -1 : 1;
13957
+ uniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? - 1 : 1;
13681
13958
 
13682
13959
  uniforms.reflectivity.value = material.reflectivity;
13683
13960
  uniforms.ior.value = material.ior;
@@ -14100,7 +14377,7 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
14100
14377
 
14101
14378
  for ( let i = 0; i < maxBindingPoints; i ++ ) {
14102
14379
 
14103
- if ( allocatedBindingPoints.indexOf( i ) === -1 ) {
14380
+ if ( allocatedBindingPoints.indexOf( i ) === - 1 ) {
14104
14381
 
14105
14382
  allocatedBindingPoints.push( i );
14106
14383
  return i;
@@ -14417,8 +14694,18 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
14417
14694
 
14418
14695
  }
14419
14696
 
14697
+ /**
14698
+ * This renderer uses WebGL 2 to display scenes.
14699
+ *
14700
+ * WebGL 1 is not supported since `r163`.
14701
+ */
14420
14702
  class WebGLRenderer {
14421
14703
 
14704
+ /**
14705
+ * Constructs a new WebGL renderer.
14706
+ *
14707
+ * @param {WebGLRenderer~Options} [parameters] - The configuration parameter.
14708
+ */
14422
14709
  constructor( parameters = {} ) {
14423
14710
 
14424
14711
  const {
@@ -14435,6 +14722,13 @@ class WebGLRenderer {
14435
14722
  reverseDepthBuffer = false,
14436
14723
  } = parameters;
14437
14724
 
14725
+ /**
14726
+ * This flag can be used for type testing.
14727
+ *
14728
+ * @type {boolean}
14729
+ * @readonly
14730
+ * @default true
14731
+ */
14438
14732
  this.isWebGLRenderer = true;
14439
14733
 
14440
14734
  let _alpha;
@@ -14469,13 +14763,36 @@ class WebGLRenderer {
14469
14763
 
14470
14764
  // public properties
14471
14765
 
14766
+ /**
14767
+ * A canvas where the renderer draws its output.This is automatically created by the renderer
14768
+ * in the constructor (if not provided already); you just need to add it to your page like so:
14769
+ * ```js
14770
+ * document.body.appendChild( renderer.domElement );
14771
+ * ```
14772
+ *
14773
+ * @type {DOMElement}
14774
+ */
14472
14775
  this.domElement = canvas;
14473
14776
 
14474
- // Debug configuration container
14777
+ /**
14778
+ * A object with debug configuration settings.
14779
+ *
14780
+ * - `checkShaderErrors`: If it is `true`, defines whether material shader programs are
14781
+ * checked for errors during compilation and linkage process. It may be useful to disable
14782
+ * this check in production for performance gain. It is strongly recommended to keep these
14783
+ * checks enabled during development. If the shader does not compile and link - it will not
14784
+ * work and associated material will not render.
14785
+ * - `onShaderError(gl, program, glVertexShader,glFragmentShader)`: A callback function that
14786
+ * can be used for custom error reporting. The callback receives the WebGL context, an instance
14787
+ * of WebGLProgram as well two instances of WebGLShader representing the vertex and fragment shader.
14788
+ * Assigning a custom function disables the default error reporting.
14789
+ *
14790
+ * @type {Object}
14791
+ */
14475
14792
  this.debug = {
14476
14793
 
14477
14794
  /**
14478
- * Enables error checking and reporting when shader programs are being compiled
14795
+ * Enables error checking and reporting when shader programs are being compiled.
14479
14796
  * @type {boolean}
14480
14797
  */
14481
14798
  checkShaderErrors: true,
@@ -14488,29 +14805,105 @@ class WebGLRenderer {
14488
14805
 
14489
14806
  // clearing
14490
14807
 
14808
+ /**
14809
+ * Whether the renderer should automatically clear its output before rendering a frame or not.
14810
+ *
14811
+ * @type {boolean}
14812
+ * @default true
14813
+ */
14491
14814
  this.autoClear = true;
14815
+
14816
+ /**
14817
+ * If {@link WebGLRenderer#autoClear} set to `true`, whether the renderer should clear
14818
+ * the color buffer or not.
14819
+ *
14820
+ * @type {boolean}
14821
+ * @default true
14822
+ */
14492
14823
  this.autoClearColor = true;
14824
+
14825
+ /**
14826
+ * If {@link WebGLRenderer#autoClear} set to `true`, whether the renderer should clear
14827
+ * the depth buffer or not.
14828
+ *
14829
+ * @type {boolean}
14830
+ * @default true
14831
+ */
14493
14832
  this.autoClearDepth = true;
14833
+
14834
+ /**
14835
+ * If {@link WebGLRenderer#autoClear} set to `true`, whether the renderer should clear
14836
+ * the stencil buffer or not.
14837
+ *
14838
+ * @type {boolean}
14839
+ * @default true
14840
+ */
14494
14841
  this.autoClearStencil = true;
14495
14842
 
14496
14843
  // scene graph
14497
14844
 
14845
+ /**
14846
+ * Whether the renderer should sort objects or not.
14847
+ *
14848
+ * Note: Sorting is used to attempt to properly render objects that have some
14849
+ * degree of transparency. By definition, sorting objects may not work in all
14850
+ * cases. Depending on the needs of application, it may be necessary to turn
14851
+ * off sorting and use other methods to deal with transparency rendering e.g.
14852
+ * manually determining each object's rendering order.
14853
+ *
14854
+ * @type {boolean}
14855
+ * @default true
14856
+ */
14498
14857
  this.sortObjects = true;
14499
14858
 
14500
14859
  // user-defined clipping
14501
14860
 
14861
+ /**
14862
+ * User-defined clipping planes specified in world space. These planes apply globally.
14863
+ * Points in space whose dot product with the plane is negative are cut away.
14864
+ *
14865
+ * @type {Array<Plane>}
14866
+ */
14502
14867
  this.clippingPlanes = [];
14503
- this.localClippingEnabled = false;
14504
-
14505
- // physically based shading
14506
14868
 
14507
- this._outputColorSpace = SRGBColorSpace;
14869
+ /**
14870
+ * Whether the renderer respects object-level clipping planes or not.
14871
+ *
14872
+ * @type {boolean}
14873
+ * @default false
14874
+ */
14875
+ this.localClippingEnabled = false;
14508
14876
 
14509
14877
  // tone mapping
14510
14878
 
14879
+ /**
14880
+ * The tone mapping technique of the renderer.
14881
+ *
14882
+ * @type {(NoToneMapping|LinearToneMapping|ReinhardToneMapping|CineonToneMapping|ACESFilmicToneMapping|CustomToneMapping|AgXToneMapping|NeutralToneMapping)}
14883
+ * @default NoToneMapping
14884
+ */
14511
14885
  this.toneMapping = NoToneMapping;
14886
+
14887
+ /**
14888
+ * Exposure level of tone mapping.
14889
+ *
14890
+ * @type {number}
14891
+ * @default 1
14892
+ */
14512
14893
  this.toneMappingExposure = 1.0;
14513
14894
 
14895
+ // transmission
14896
+
14897
+ /**
14898
+ * The normalized resolution scale for the transmission render target, measured in percentage
14899
+ * of viewport dimensions. Lowering this value can result in significant performance improvements
14900
+ * when using {@link MeshPhysicalMaterial#transmission}.
14901
+ *
14902
+ * @type {number}
14903
+ * @default 1
14904
+ */
14905
+ this.transmissionResolutionScale = 1.0;
14906
+
14514
14907
  // internal properties
14515
14908
 
14516
14909
  const _this = this;
@@ -14519,10 +14912,12 @@ class WebGLRenderer {
14519
14912
 
14520
14913
  // internal state cache
14521
14914
 
14915
+ this._outputColorSpace = SRGBColorSpace;
14916
+
14522
14917
  let _currentActiveCubeFace = 0;
14523
14918
  let _currentActiveMipmapLevel = 0;
14524
14919
  let _currentRenderTarget = null;
14525
- let _currentMaterialId = -1;
14920
+ let _currentMaterialId = - 1;
14526
14921
 
14527
14922
  let _currentCamera = null;
14528
14923
 
@@ -14555,9 +14950,6 @@ class WebGLRenderer {
14555
14950
  let _clippingEnabled = false;
14556
14951
  let _localClippingEnabled = false;
14557
14952
 
14558
- // transmission render target scale
14559
- this.transmissionResolutionScale = 1.0;
14560
-
14561
14953
  // camera matrices cache
14562
14954
 
14563
14955
  const _currentProjectionMatrix = new Matrix4();
@@ -14686,12 +15078,79 @@ class WebGLRenderer {
14686
15078
 
14687
15079
  info.programs = programCache.programs;
14688
15080
 
15081
+ /**
15082
+ * Holds details about the capabilities of the current rendering context.
15083
+ *
15084
+ * @name WebGLRenderer#capabilities
15085
+ * @type {WebGLRenderer~Capabilities}
15086
+ */
14689
15087
  _this.capabilities = capabilities;
15088
+
15089
+ /**
15090
+ * Provides methods for retrieving and testing WebGL extensions.
15091
+ *
15092
+ * - `get(extensionName:string)`: Used to check whether a WebGL extension is supported
15093
+ * and return the extension object if available.
15094
+ * - `has(extensionName:string)`: returns `true` if the extension is supported.
15095
+ *
15096
+ * @name WebGLRenderer#extensions
15097
+ * @type {Object}
15098
+ */
14690
15099
  _this.extensions = extensions;
15100
+
15101
+ /**
15102
+ * Used to track properties of other objects like native WebGL objects.
15103
+ *
15104
+ * @name WebGLRenderer#properties
15105
+ * @type {Object}
15106
+ */
14691
15107
  _this.properties = properties;
15108
+
15109
+ /**
15110
+ * Manages the render lists of the renderer.
15111
+ *
15112
+ * @name WebGLRenderer#renderLists
15113
+ * @type {Object}
15114
+ */
14692
15115
  _this.renderLists = renderLists;
15116
+
15117
+
15118
+
15119
+ /**
15120
+ * Interface for managing shadows.
15121
+ *
15122
+ * @name WebGLRenderer#shadowMap
15123
+ * @type {WebGLRenderer~ShadowMap}
15124
+ */
14693
15125
  _this.shadowMap = shadowMap;
15126
+
15127
+ /**
15128
+ * Interface for managing the WebGL state.
15129
+ *
15130
+ * @name WebGLRenderer#state
15131
+ * @type {Object}
15132
+ */
14694
15133
  _this.state = state;
15134
+
15135
+ /**
15136
+ * Holds a series of statistical information about the GPU memory
15137
+ * and the rendering process. Useful for debugging and monitoring.
15138
+ *
15139
+ * By default these data are reset at each render call but when having
15140
+ * multiple render passes per frame (e.g. when using post processing) it can
15141
+ * be preferred to reset with a custom pattern. First, set `autoReset` to
15142
+ * `false`.
15143
+ * ```js
15144
+ * renderer.info.autoReset = false;
15145
+ * ```
15146
+ * Call `reset()` whenever you have finished to render a single frame.
15147
+ * ```js
15148
+ * renderer.info.reset();
15149
+ * ```
15150
+ *
15151
+ * @name WebGLRenderer#info
15152
+ * @type {WebGLRenderer~Info}
15153
+ */
14695
15154
  _this.info = info;
14696
15155
 
14697
15156
  }
@@ -14702,22 +15161,38 @@ class WebGLRenderer {
14702
15161
 
14703
15162
  const xr = new WebXRManager( _this, _gl );
14704
15163
 
15164
+ /**
15165
+ * A reference to the XR manager.
15166
+ *
15167
+ * @type {WebXRManager}
15168
+ */
14705
15169
  this.xr = xr;
14706
15170
 
14707
- // API
14708
-
15171
+ /**
15172
+ * Returns the rendering context.
15173
+ *
15174
+ * @return {WebGL2RenderingContext} The rendering context.
15175
+ */
14709
15176
  this.getContext = function () {
14710
15177
 
14711
15178
  return _gl;
14712
15179
 
14713
15180
  };
14714
15181
 
15182
+ /**
15183
+ * Returns the rendering context attributes.
15184
+ *
15185
+ * @return {WebGLContextAttributes} The rendering context attributes.
15186
+ */
14715
15187
  this.getContextAttributes = function () {
14716
15188
 
14717
15189
  return _gl.getContextAttributes();
14718
15190
 
14719
15191
  };
14720
15192
 
15193
+ /**
15194
+ * Simulates a loss of the WebGL context. This requires support for the `WEBGL_lose_context` extension.
15195
+ */
14721
15196
  this.forceContextLoss = function () {
14722
15197
 
14723
15198
  const extension = extensions.get( 'WEBGL_lose_context' );
@@ -14725,6 +15200,9 @@ class WebGLRenderer {
14725
15200
 
14726
15201
  };
14727
15202
 
15203
+ /**
15204
+ * Simulates a restore of the WebGL context. This requires support for the `WEBGL_lose_context` extension.
15205
+ */
14728
15206
  this.forceContextRestore = function () {
14729
15207
 
14730
15208
  const extension = extensions.get( 'WEBGL_lose_context' );
@@ -14732,12 +15210,22 @@ class WebGLRenderer {
14732
15210
 
14733
15211
  };
14734
15212
 
15213
+ /**
15214
+ * Returns the pixel ratio.
15215
+ *
15216
+ * @return {number} The pixel ratio.
15217
+ */
14735
15218
  this.getPixelRatio = function () {
14736
15219
 
14737
15220
  return _pixelRatio;
14738
15221
 
14739
15222
  };
14740
15223
 
15224
+ /**
15225
+ * Sets the given pixel ratio and resizes the canvas if necessary.
15226
+ *
15227
+ * @param {number} value - The pixel ratio.
15228
+ */
14741
15229
  this.setPixelRatio = function ( value ) {
14742
15230
 
14743
15231
  if ( value === undefined ) return;
@@ -14748,12 +15236,27 @@ class WebGLRenderer {
14748
15236
 
14749
15237
  };
14750
15238
 
15239
+ /**
15240
+ * Returns the renderer's size in logical pixels. This method does not honor the pixel ratio.
15241
+ *
15242
+ * @param {Vector2} target - The method writes the result in this target object.
15243
+ * @return {Vector2} The renderer's size in logical pixels.
15244
+ */
14751
15245
  this.getSize = function ( target ) {
14752
15246
 
14753
15247
  return target.set( _width, _height );
14754
15248
 
14755
15249
  };
14756
15250
 
15251
+ /**
15252
+ * Resizes the output canvas to (width, height) with device pixel ratio taken
15253
+ * into account, and also sets the viewport to fit that size, starting in (0,
15254
+ * 0). Setting `updateStyle` to false prevents any style changes to the output canvas.
15255
+ *
15256
+ * @param {number} width - The width in logical pixels.
15257
+ * @param {number} height - The height in logical pixels.
15258
+ * @param {boolean} [updateStyle=true] - Whether to update the `style` attribute of the canvas or not.
15259
+ */
14757
15260
  this.setSize = function ( width, height, updateStyle = true ) {
14758
15261
 
14759
15262
  if ( xr.isPresenting ) {
@@ -14780,12 +15283,31 @@ class WebGLRenderer {
14780
15283
 
14781
15284
  };
14782
15285
 
15286
+ /**
15287
+ * Returns the drawing buffer size in physical pixels. This method honors the pixel ratio.
15288
+ *
15289
+ * @param {Vector2} target - The method writes the result in this target object.
15290
+ * @return {Vector2} The drawing buffer size.
15291
+ */
14783
15292
  this.getDrawingBufferSize = function ( target ) {
14784
15293
 
14785
15294
  return target.set( _width * _pixelRatio, _height * _pixelRatio ).floor();
14786
15295
 
14787
15296
  };
14788
15297
 
15298
+ /**
15299
+ * This method allows to define the drawing buffer size by specifying
15300
+ * width, height and pixel ratio all at once. The size of the drawing
15301
+ * buffer is computed with this formula:
15302
+ * ```js
15303
+ * size.x = width * pixelRatio;
15304
+ * size.y = height * pixelRatio;
15305
+ * ```
15306
+ *
15307
+ * @param {number} width - The width in logical pixels.
15308
+ * @param {number} height - The height in logical pixels.
15309
+ * @param {number} pixelRatio - The pixel ratio.
15310
+ */
14789
15311
  this.setDrawingBufferSize = function ( width, height, pixelRatio ) {
14790
15312
 
14791
15313
  _width = width;
@@ -14800,18 +15322,39 @@ class WebGLRenderer {
14800
15322
 
14801
15323
  };
14802
15324
 
15325
+ /**
15326
+ * Returns the current viewport definition.
15327
+ *
15328
+ * @param {Vector2} target - The method writes the result in this target object.
15329
+ * @return {Vector2} The current viewport definition.
15330
+ */
14803
15331
  this.getCurrentViewport = function ( target ) {
14804
15332
 
14805
15333
  return target.copy( _currentViewport );
14806
15334
 
14807
15335
  };
14808
15336
 
15337
+ /**
15338
+ * Returns the viewport definition.
15339
+ *
15340
+ * @param {Vector4} target - The method writes the result in this target object.
15341
+ * @return {Vector4} The viewport definition.
15342
+ */
14809
15343
  this.getViewport = function ( target ) {
14810
15344
 
14811
15345
  return target.copy( _viewport );
14812
15346
 
14813
15347
  };
14814
15348
 
15349
+ /**
15350
+ * Sets the viewport to render from `(x, y)` to `(x + width, y + height)`.
15351
+ *
15352
+ * @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the viewport origin in logical pixel unit.
15353
+ * Or alternatively a four-component vector specifying all the parameters of the viewport.
15354
+ * @param {number} y - The vertical coordinate for the lower left corner of the viewport origin in logical pixel unit.
15355
+ * @param {number} width - The width of the viewport in logical pixel unit.
15356
+ * @param {number} height - The height of the viewport in logical pixel unit.
15357
+ */
14815
15358
  this.setViewport = function ( x, y, width, height ) {
14816
15359
 
14817
15360
  if ( x.isVector4 ) {
@@ -14828,12 +15371,27 @@ class WebGLRenderer {
14828
15371
 
14829
15372
  };
14830
15373
 
15374
+ /**
15375
+ * Returns the scissor region.
15376
+ *
15377
+ * @param {Vector4} target - The method writes the result in this target object.
15378
+ * @return {Vector4} The scissor region.
15379
+ */
14831
15380
  this.getScissor = function ( target ) {
14832
15381
 
14833
15382
  return target.copy( _scissor );
14834
15383
 
14835
15384
  };
14836
15385
 
15386
+ /**
15387
+ * Sets the scissor region to render from `(x, y)` to `(x + width, y + height)`.
15388
+ *
15389
+ * @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the scissor region origin in logical pixel unit.
15390
+ * Or alternatively a four-component vector specifying all the parameters of the scissor region.
15391
+ * @param {number} y - The vertical coordinate for the lower left corner of the scissor region origin in logical pixel unit.
15392
+ * @param {number} width - The width of the scissor region in logical pixel unit.
15393
+ * @param {number} height - The height of the scissor region in logical pixel unit.
15394
+ */
14837
15395
  this.setScissor = function ( x, y, width, height ) {
14838
15396
 
14839
15397
  if ( x.isVector4 ) {
@@ -14850,24 +15408,48 @@ class WebGLRenderer {
14850
15408
 
14851
15409
  };
14852
15410
 
15411
+ /**
15412
+ * Returns `true` if the scissor test is enabled.
15413
+ *
15414
+ * @return {boolean} Whether the scissor test is enabled or not.
15415
+ */
14853
15416
  this.getScissorTest = function () {
14854
15417
 
14855
15418
  return _scissorTest;
14856
15419
 
14857
15420
  };
14858
15421
 
15422
+ /**
15423
+ * Enable or disable the scissor test. When this is enabled, only the pixels
15424
+ * within the defined scissor area will be affected by further renderer
15425
+ * actions.
15426
+ *
15427
+ * @param {boolean} boolean - Whether the scissor test is enabled or not.
15428
+ */
14859
15429
  this.setScissorTest = function ( boolean ) {
14860
15430
 
14861
15431
  state.setScissorTest( _scissorTest = boolean );
14862
15432
 
14863
15433
  };
14864
15434
 
15435
+ /**
15436
+ * Sets a custom opaque sort function for the render lists. Pass `null`
15437
+ * to use the default `painterSortStable` function.
15438
+ *
15439
+ * @param {?Function} method - The opaque sort function.
15440
+ */
14865
15441
  this.setOpaqueSort = function ( method ) {
14866
15442
 
14867
15443
  _opaqueSort = method;
14868
15444
 
14869
15445
  };
14870
15446
 
15447
+ /**
15448
+ * Sets a custom transparent sort function for the render lists. Pass `null`
15449
+ * to use the default `reversePainterSortStable` function.
15450
+ *
15451
+ * @param {?Function} method - The opaque sort function.
15452
+ */
14871
15453
  this.setTransparentSort = function ( method ) {
14872
15454
 
14873
15455
  _transparentSort = method;
@@ -14876,30 +15458,60 @@ class WebGLRenderer {
14876
15458
 
14877
15459
  // Clearing
14878
15460
 
15461
+ /**
15462
+ * Returns the clear color.
15463
+ *
15464
+ * @param {Color} target - The method writes the result in this target object.
15465
+ * @return {Color} The clear color.
15466
+ */
14879
15467
  this.getClearColor = function ( target ) {
14880
15468
 
14881
15469
  return target.copy( background.getClearColor() );
14882
15470
 
14883
15471
  };
14884
15472
 
15473
+ /**
15474
+ * Sets the clear color and alpha.
15475
+ *
15476
+ * @param {Color} color - The clear color.
15477
+ * @param {number} [alpha=1] - The clear alpha.
15478
+ */
14885
15479
  this.setClearColor = function () {
14886
15480
 
14887
15481
  background.setClearColor( ...arguments );
14888
15482
 
14889
15483
  };
14890
15484
 
15485
+ /**
15486
+ * Returns the clear alpha. Ranges within `[0,1]`.
15487
+ *
15488
+ * @return {number} The clear alpha.
15489
+ */
14891
15490
  this.getClearAlpha = function () {
14892
15491
 
14893
15492
  return background.getClearAlpha();
14894
15493
 
14895
15494
  };
14896
15495
 
15496
+ /**
15497
+ * Sets the clear alpha.
15498
+ *
15499
+ * @param {number} alpha - The clear alpha.
15500
+ */
14897
15501
  this.setClearAlpha = function () {
14898
15502
 
14899
15503
  background.setClearAlpha( ...arguments );
14900
15504
 
14901
15505
  };
14902
15506
 
15507
+ /**
15508
+ * Tells the renderer to clear its color, depth or stencil drawing buffer(s).
15509
+ * This method initializes the buffers to the current clear color values.
15510
+ *
15511
+ * @param {boolean} [color=true] - Whether the color buffer should be cleared or not.
15512
+ * @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not.
15513
+ * @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not.
15514
+ */
14903
15515
  this.clear = function ( color = true, depth = true, stencil = true ) {
14904
15516
 
14905
15517
  let bits = 0;
@@ -14978,26 +15590,37 @@ class WebGLRenderer {
14978
15590
 
14979
15591
  };
14980
15592
 
15593
+ /**
15594
+ * Clears the color buffer. Equivalent to calling `renderer.clear( true, false, false )`.
15595
+ */
14981
15596
  this.clearColor = function () {
14982
15597
 
14983
15598
  this.clear( true, false, false );
14984
15599
 
14985
15600
  };
14986
15601
 
15602
+ /**
15603
+ * Clears the depth buffer. Equivalent to calling `renderer.clear( false, true, false )`.
15604
+ */
14987
15605
  this.clearDepth = function () {
14988
15606
 
14989
15607
  this.clear( false, true, false );
14990
15608
 
14991
15609
  };
14992
15610
 
15611
+ /**
15612
+ * Clears the stencil buffer. Equivalent to calling `renderer.clear( false, false, true )`.
15613
+ */
14993
15614
  this.clearStencil = function () {
14994
15615
 
14995
15616
  this.clear( false, false, true );
14996
15617
 
14997
15618
  };
14998
15619
 
14999
- //
15000
-
15620
+ /**
15621
+ * Frees the GPU-related resources allocated by this instance. Call this
15622
+ * method whenever this instance is no longer used in your app.
15623
+ */
15001
15624
  this.dispose = function () {
15002
15625
 
15003
15626
  canvas.removeEventListener( 'webglcontextlost', onContextLost, false );
@@ -15303,6 +15926,18 @@ class WebGLRenderer {
15303
15926
 
15304
15927
  }
15305
15928
 
15929
+ /**
15930
+ * Compiles all materials in the scene with the camera. This is useful to precompile shaders
15931
+ * before the first rendering. If you want to add a 3D object to an existing scene, use the third
15932
+ * optional parameter for applying the target scene.
15933
+ *
15934
+ * Note that the (target) scene's lighting and environment must be configured before calling this method.
15935
+ *
15936
+ * @param {Object3D} scene - The scene or another type of 3D object to precompile.
15937
+ * @param {Camera} camera - The camera.
15938
+ * @param {?Scene} [targetScene=null] - The target scene.
15939
+ * @return {?Set} The precompiled materials.
15940
+ */
15306
15941
  this.compile = function ( scene, camera, targetScene = null ) {
15307
15942
 
15308
15943
  if ( targetScene === null ) targetScene = scene;
@@ -15398,6 +16033,18 @@ class WebGLRenderer {
15398
16033
 
15399
16034
  // compileAsync
15400
16035
 
16036
+ /**
16037
+ * Asynchronous version of {@link WebGLRenderer#compile}.
16038
+ *
16039
+ * This method makes use of the `KHR_parallel_shader_compile` WebGL extension. Hence,
16040
+ * it is recommended to use this version of `compile()` whenever possible.
16041
+ *
16042
+ * @async
16043
+ * @param {Object3D} scene - The scene or another type of 3D object to precompile.
16044
+ * @param {Camera} camera - The camera.
16045
+ * @param {?Scene} [targetScene=null] - The target scene.
16046
+ * @return {Promise} A Promise that resolves when the given scene can be rendered without unnecessary stalling due to shader compilation.
16047
+ */
15401
16048
  this.compileAsync = function ( scene, camera, targetScene = null ) {
15402
16049
 
15403
16050
  const materials = this.compile( scene, camera, targetScene );
@@ -15499,6 +16146,20 @@ class WebGLRenderer {
15499
16146
 
15500
16147
  // Rendering
15501
16148
 
16149
+ /**
16150
+ * Renders the given scene (or other type of 3D object) using the given camera.
16151
+ *
16152
+ * The render is done to a previously specified render target set by calling {@link WebGLRenderer#setRenderTarget}
16153
+ * or to the canvas as usual.
16154
+ *
16155
+ * By default render buffers are cleared before rendering but you can prevent
16156
+ * this by setting the property `autoClear` to `false`. If you want to prevent
16157
+ * only certain buffers being cleared you can `autoClearColor`, `autoClearDepth`
16158
+ * or `autoClearStencil` to `false`. To force a clear, use {@link WebGLRenderer#clear}.
16159
+ *
16160
+ * @param {Object3D} scene - The scene to render.
16161
+ * @param {Camera} camera - The camera.
16162
+ */
15502
16163
  this.render = function ( scene, camera ) {
15503
16164
 
15504
16165
  if ( camera !== undefined && camera.isCamera !== true ) {
@@ -15654,7 +16315,7 @@ class WebGLRenderer {
15654
16315
  // _gl.finish();
15655
16316
 
15656
16317
  bindingStates.resetDefaultState();
15657
- _currentMaterialId = -1;
16318
+ _currentMaterialId = - 1;
15658
16319
  _currentCamera = null;
15659
16320
 
15660
16321
  renderStateStack.pop();
@@ -15957,8 +16618,14 @@ class WebGLRenderer {
15957
16618
 
15958
16619
  const object = renderItem.object;
15959
16620
  const geometry = renderItem.geometry;
15960
- const material = overrideMaterial === null ? renderItem.material : overrideMaterial;
15961
16621
  const group = renderItem.group;
16622
+ let material = renderItem.material;
16623
+
16624
+ if ( material.allowOverride === true && overrideMaterial !== null ) {
16625
+
16626
+ material = overrideMaterial;
16627
+
16628
+ }
15962
16629
 
15963
16630
  if ( object.layers.test( camera.layers ) ) {
15964
16631
 
@@ -16486,7 +17153,7 @@ class WebGLRenderer {
16486
17153
 
16487
17154
  m_uniforms.envMap.value = envMap;
16488
17155
 
16489
- m_uniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? -1 : 1;
17156
+ m_uniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? - 1 : 1;
16490
17157
 
16491
17158
  }
16492
17159
 
@@ -16595,18 +17262,34 @@ class WebGLRenderer {
16595
17262
 
16596
17263
  }
16597
17264
 
17265
+ /**
17266
+ * Returns the active cube face.
17267
+ *
17268
+ * @return {number} The active cube face.
17269
+ */
16598
17270
  this.getActiveCubeFace = function () {
16599
17271
 
16600
17272
  return _currentActiveCubeFace;
16601
17273
 
16602
17274
  };
16603
17275
 
17276
+ /**
17277
+ * Returns the active mipmap level.
17278
+ *
17279
+ * @return {number} The active mipmap level.
17280
+ */
16604
17281
  this.getActiveMipmapLevel = function () {
16605
17282
 
16606
17283
  return _currentActiveMipmapLevel;
16607
17284
 
16608
17285
  };
16609
17286
 
17287
+ /**
17288
+ * Returns the active render target.
17289
+ *
17290
+ * @return {?WebGLRenderTarget} The active render target. Returns `null` if no render target
17291
+ * is currently set.
17292
+ */
16610
17293
  this.getRenderTarget = function () {
16611
17294
 
16612
17295
  return _currentRenderTarget;
@@ -16615,26 +17298,21 @@ class WebGLRenderer {
16615
17298
 
16616
17299
  this.setRenderTargetTextures = function ( renderTarget, colorTexture, depthTexture ) {
16617
17300
 
16618
- properties.get( renderTarget.texture ).__webglTexture = colorTexture;
16619
- properties.get( renderTarget.depthTexture ).__webglTexture = depthTexture;
16620
-
16621
17301
  const renderTargetProperties = properties.get( renderTarget );
16622
- renderTargetProperties.__hasExternalTextures = true;
16623
17302
 
16624
- renderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined;
16625
-
16626
- if ( ! renderTargetProperties.__autoAllocateDepthBuffer ) {
17303
+ renderTargetProperties.__autoAllocateDepthBuffer = renderTarget.resolveDepthBuffer === false;
17304
+ if ( renderTargetProperties.__autoAllocateDepthBuffer === false ) {
16627
17305
 
16628
17306
  // The multisample_render_to_texture extension doesn't work properly if there
16629
17307
  // are midframe flushes and an external depth buffer. Disable use of the extension.
16630
- if ( extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) {
17308
+ renderTargetProperties.__useRenderToTexture = false;
16631
17309
 
16632
- console.warn( 'THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided' );
16633
- renderTargetProperties.__useRenderToTexture = false;
17310
+ }
16634
17311
 
16635
- }
17312
+ properties.get( renderTarget.texture ).__webglTexture = colorTexture;
17313
+ properties.get( renderTarget.depthTexture ).__webglTexture = renderTargetProperties.__autoAllocateDepthBuffer ? undefined : depthTexture;
16636
17314
 
16637
- }
17315
+ renderTargetProperties.__hasExternalTextures = true;
16638
17316
 
16639
17317
  };
16640
17318
 
@@ -16647,6 +17325,16 @@ class WebGLRenderer {
16647
17325
  };
16648
17326
 
16649
17327
  const _scratchFrameBuffer = _gl.createFramebuffer();
17328
+
17329
+ /**
17330
+ * Sets the active rendertarget.
17331
+ *
17332
+ * @param {?WebGLRenderTarget} renderTarget - The render target to set. When `null` is given,
17333
+ * the canvas is set as the active render target instead.
17334
+ * @param {number} [activeCubeFace=0] - The active cube face when using a cube render target.
17335
+ * Indicates the z layer to render in to when using 3D or array render targets.
17336
+ * @param {number} [activeMipmapLevel=0] - The active mipmap level.
17337
+ */
16650
17338
  this.setRenderTarget = function ( renderTarget, activeCubeFace = 0, activeMipmapLevel = 0 ) {
16651
17339
 
16652
17340
  _currentRenderTarget = renderTarget;
@@ -16795,10 +17483,21 @@ class WebGLRenderer {
16795
17483
 
16796
17484
  }
16797
17485
 
16798
- _currentMaterialId = -1; // reset current material to ensure correct uniform bindings
17486
+ _currentMaterialId = - 1; // reset current material to ensure correct uniform bindings
16799
17487
 
16800
17488
  };
16801
17489
 
17490
+ /**
17491
+ * Reads the pixel data from the given render target into the given buffer.
17492
+ *
17493
+ * @param {WebGLRenderTarget} renderTarget - The render target to read from.
17494
+ * @param {number} x - The `x` coordinate of the copy region's origin.
17495
+ * @param {number} y - The `y` coordinate of the copy region's origin.
17496
+ * @param {number} width - The width of the copy region.
17497
+ * @param {number} height - The height of the copy region.
17498
+ * @param {TypedArray} buffer - The result buffer.
17499
+ * @param {number} [activeCubeFaceIndex] - The active cube face index.
17500
+ */
16802
17501
  this.readRenderTargetPixels = function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex ) {
16803
17502
 
16804
17503
  if ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {
@@ -16861,6 +17560,21 @@ class WebGLRenderer {
16861
17560
 
16862
17561
  };
16863
17562
 
17563
+ /**
17564
+ * Asynchronous, non-blocking version of {@link WebGLRenderer#readRenderTargetPixels}.
17565
+ *
17566
+ * It is recommended to use this version of `readRenderTargetPixels()` whenever possible.
17567
+ *
17568
+ * @async
17569
+ * @param {WebGLRenderTarget} renderTarget - The render target to read from.
17570
+ * @param {number} x - The `x` coordinate of the copy region's origin.
17571
+ * @param {number} y - The `y` coordinate of the copy region's origin.
17572
+ * @param {number} width - The width of the copy region.
17573
+ * @param {number} height - The height of the copy region.
17574
+ * @param {TypedArray} buffer - The result buffer.
17575
+ * @param {number} [activeCubeFaceIndex] - The active cube face index.
17576
+ * @return {Promise<TypedArray>} A Promise that resolves when the read has been finished. The resolve provides the read data as a typed array.
17577
+ */
16864
17578
  this.readRenderTargetPixelsAsync = async function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex ) {
16865
17579
 
16866
17580
  if ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {
@@ -16878,27 +17592,27 @@ class WebGLRenderer {
16878
17592
 
16879
17593
  if ( framebuffer ) {
16880
17594
 
16881
- const texture = renderTarget.texture;
16882
- const textureFormat = texture.format;
16883
- const textureType = texture.type;
17595
+ // the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)
17596
+ if ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {
16884
17597
 
16885
- if ( ! capabilities.textureFormatReadable( textureFormat ) ) {
17598
+ // set the active frame buffer to the one we want to read
17599
+ state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
16886
17600
 
16887
- throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.' );
17601
+ const texture = renderTarget.texture;
17602
+ const textureFormat = texture.format;
17603
+ const textureType = texture.type;
16888
17604
 
16889
- }
17605
+ if ( ! capabilities.textureFormatReadable( textureFormat ) ) {
16890
17606
 
16891
- if ( ! capabilities.textureTypeReadable( textureType ) ) {
17607
+ throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.' );
16892
17608
 
16893
- throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.' );
17609
+ }
16894
17610
 
16895
- }
17611
+ if ( ! capabilities.textureTypeReadable( textureType ) ) {
16896
17612
 
16897
- // the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)
16898
- if ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {
17613
+ throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.' );
16899
17614
 
16900
- // set the active frame buffer to the one we want to read
16901
- state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
17615
+ }
16902
17616
 
16903
17617
  const glBuffer = _gl.createBuffer();
16904
17618
  _gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
@@ -16934,19 +17648,15 @@ class WebGLRenderer {
16934
17648
 
16935
17649
  };
16936
17650
 
17651
+ /**
17652
+ * Copies pixels from the current bound framebuffer into the given texture.
17653
+ *
17654
+ * @param {FramebufferTexture} texture - The texture.
17655
+ * @param {Vector2} position - The start position of the copy operation.
17656
+ * @param {number} [level=0] - The mip level. The default represents the base mip.
17657
+ */
16937
17658
  this.copyFramebufferToTexture = function ( texture, position = null, level = 0 ) {
16938
17659
 
16939
- // support previous signature with position first
16940
- if ( texture.isTexture !== true ) {
16941
-
16942
- // @deprecated, r165
16943
- warnOnce( 'WebGLRenderer: copyFramebufferToTexture function signature has changed.' );
16944
-
16945
- position = arguments[ 0 ] || null;
16946
- texture = arguments[ 1 ];
16947
-
16948
- }
16949
-
16950
17660
  const levelScale = Math.pow( 2, - level );
16951
17661
  const width = Math.floor( texture.image.width * levelScale );
16952
17662
  const height = Math.floor( texture.image.height * levelScale );
@@ -16964,21 +17674,21 @@ class WebGLRenderer {
16964
17674
 
16965
17675
  const _srcFramebuffer = _gl.createFramebuffer();
16966
17676
  const _dstFramebuffer = _gl.createFramebuffer();
16967
- this.copyTextureToTexture = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, srcLevel = 0, dstLevel = null ) {
16968
-
16969
- // support previous signature with dstPosition first
16970
- if ( srcTexture.isTexture !== true ) {
16971
17677
 
16972
- // @deprecated, r165
16973
- warnOnce( 'WebGLRenderer: copyTextureToTexture function signature has changed.' );
16974
-
16975
- dstPosition = arguments[ 0 ] || null;
16976
- srcTexture = arguments[ 1 ];
16977
- dstTexture = arguments[ 2 ];
16978
- dstLevel = arguments[ 3 ] || 0;
16979
- srcRegion = null;
16980
-
16981
- }
17678
+ /**
17679
+ * Copies data of the given source texture into a destination texture.
17680
+ *
17681
+ * When using render target textures as `srcTexture` and `dstTexture`, you must make sure both render targets are initialized
17682
+ * {@link WebGLRenderer#initRenderTarget}.
17683
+ *
17684
+ * @param {Texture} srcTexture - The source texture.
17685
+ * @param {Texture} dstTexture - The destination texture.
17686
+ * @param {Box2|Box3} [srcRegion=null] - A bounding box which describes the source region. Can be two or three-dimensional.
17687
+ * @param {Vector2|Vector3} [dstPosition=null] - A vector that represents the origin of the destination region. Can be two or three-dimensional.
17688
+ * @param {number} srcLevel - The source mipmap level to copy.
17689
+ * @param {number} dstLevel - The destination mipmap level.
17690
+ */
17691
+ this.copyTextureToTexture = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, srcLevel = 0, dstLevel = null ) {
16982
17692
 
16983
17693
  // support the previous signature with just a single dst mipmap level
16984
17694
  if ( dstLevel === null ) {
@@ -17232,20 +17942,6 @@ class WebGLRenderer {
17232
17942
 
17233
17943
  this.copyTextureToTexture3D = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, level = 0 ) {
17234
17944
 
17235
- // support previous signature with source box first
17236
- if ( srcTexture.isTexture !== true ) {
17237
-
17238
- // @deprecated, r165
17239
- warnOnce( 'WebGLRenderer: copyTextureToTexture3D function signature has changed.' );
17240
-
17241
- srcRegion = arguments[ 0 ] || null;
17242
- dstPosition = arguments[ 1 ] || null;
17243
- srcTexture = arguments[ 2 ];
17244
- dstTexture = arguments[ 3 ];
17245
- level = arguments[ 4 ] || 0;
17246
-
17247
- }
17248
-
17249
17945
  // @deprecated, r170
17250
17946
  warnOnce( 'WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.' );
17251
17947
 
@@ -17253,6 +17949,13 @@ class WebGLRenderer {
17253
17949
 
17254
17950
  };
17255
17951
 
17952
+ /**
17953
+ * Initializes the given WebGLRenderTarget memory. Useful for initializing a render target so data
17954
+ * can be copied into it using {@link WebGLRenderer#copyTextureToTexture} before it has been
17955
+ * rendered to.
17956
+ *
17957
+ * @param {WebGLRenderTarget} target - The render target.
17958
+ */
17256
17959
  this.initRenderTarget = function ( target ) {
17257
17960
 
17258
17961
  if ( properties.get( target ).__webglFramebuffer === undefined ) {
@@ -17263,6 +17966,12 @@ class WebGLRenderer {
17263
17966
 
17264
17967
  };
17265
17968
 
17969
+ /**
17970
+ * Initializes the given texture. Useful for preloading a texture rather than waiting until first
17971
+ * render (which can cause noticeable lags due to decode and GPU upload overhead).
17972
+ *
17973
+ * @param {Texture} texture - The texture.
17974
+ */
17266
17975
  this.initTexture = function ( texture ) {
17267
17976
 
17268
17977
  if ( texture.isCubeTexture ) {
@@ -17287,6 +17996,11 @@ class WebGLRenderer {
17287
17996
 
17288
17997
  };
17289
17998
 
17999
+ /**
18000
+ * Can be used to reset the internal WebGL state. This method is mostly
18001
+ * relevant for applications which share a single WebGL context across
18002
+ * multiple WebGL libraries.
18003
+ */
17290
18004
  this.resetState = function () {
17291
18005
 
17292
18006
  _currentActiveCubeFace = 0;
@@ -17306,12 +18020,27 @@ class WebGLRenderer {
17306
18020
 
17307
18021
  }
17308
18022
 
18023
+ /**
18024
+ * Defines the coordinate system of the renderer.
18025
+ *
18026
+ * In `WebGLRenderer`, the value is always `WebGLCoordinateSystem`.
18027
+ *
18028
+ * @type {WebGLCoordinateSystem|WebGPUCoordinateSystem}
18029
+ * @default WebGLCoordinateSystem
18030
+ * @readonly
18031
+ */
17309
18032
  get coordinateSystem() {
17310
18033
 
17311
18034
  return WebGLCoordinateSystem;
17312
18035
 
17313
18036
  }
17314
18037
 
18038
+ /**
18039
+ * Defines the output color space of the renderer.
18040
+ *
18041
+ * @type {SRGBColorSpace|LinearSRGBColorSpace}
18042
+ * @default SRGBColorSpace
18043
+ */
17315
18044
  get outputColorSpace() {
17316
18045
 
17317
18046
  return this._outputColorSpace;
@@ -17323,11 +18052,11 @@ class WebGLRenderer {
17323
18052
  this._outputColorSpace = colorSpace;
17324
18053
 
17325
18054
  const gl = this.getContext();
17326
- gl.drawingBufferColorspace = ColorManagement._getDrawingBufferColorSpace( colorSpace );
18055
+ gl.drawingBufferColorSpace = ColorManagement._getDrawingBufferColorSpace( colorSpace );
17327
18056
  gl.unpackColorSpace = ColorManagement._getUnpackColorSpace();
17328
18057
 
17329
18058
  }
17330
18059
 
17331
18060
  }
17332
18061
 
17333
- export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, ArrayCamera, BackSide, BoxGeometry, BufferAttribute, BufferGeometry, ByteType, CineonToneMapping, ClampToEdgeWrapping, Color, ColorManagement, ConstantAlphaFactor, ConstantColorFactor, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeUVReflectionMapping, CullFaceBack, CullFaceFront, CullFaceNone, CustomBlending, CustomToneMapping, Data3DTexture, DataArrayTexture, DepthFormat, DepthStencilFormat, DepthTexture, DoubleSide, DstAlphaFactor, DstColorFactor, EqualCompare, EqualDepth, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, FloatType, FrontSide, Frustum, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, HalfFloatType, IntType, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LinearFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, LuminanceAlphaFormat, LuminanceFormat, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NoBlending, NoColorSpace, NoToneMapping, NormalBlending, NotEqualCompare, NotEqualDepth, ObjectSpaceNormalMap, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, PerspectiveCamera, Plane, PlaneGeometry, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, 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_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RedFormat, RedIntegerFormat, ReinhardToneMapping, RepeatWrapping, ReverseSubtractEquation, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SRGBColorSpace, SRGBTransfer, ShaderChunk, ShaderLib, ShaderMaterial, ShortType, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, SubtractEquation, SubtractiveBlending, TangentSpaceNormalMap, Texture, Uint16BufferAttribute, Uint32BufferAttribute, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, WebGLCoordinateSystem, WebGLCubeRenderTarget, WebGLRenderTarget, WebGLRenderer, WebGLUtils, WebXRController, ZeroFactor, createCanvasElement };
18062
+ export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, ArrayCamera, BackSide, BoxGeometry, BufferAttribute, BufferGeometry, ByteType, CineonToneMapping, ClampToEdgeWrapping, Color, ColorManagement, ConstantAlphaFactor, ConstantColorFactor, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeUVReflectionMapping, CullFaceBack, CullFaceFront, CullFaceNone, CustomBlending, CustomToneMapping, CylindricalMapping, Data3DTexture, DataArrayTexture, DepthFormat, DepthStencilFormat, DepthTexture, DoubleSide, DstAlphaFactor, DstColorFactor, EqualCompare, EqualDepth, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, FloatType, FrontSide, Frustum, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, HalfFloatType, IntType, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LinearFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, LuminanceAlphaFormat, LuminanceFormat, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NoBlending, NoColorSpace, NoToneMapping, NormalBlending, NotEqualCompare, NotEqualDepth, ObjectSpaceNormalMap, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, PerspectiveCamera, Plane, PlaneGeometry, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, 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_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RedFormat, RedIntegerFormat, ReinhardToneMapping, RepeatWrapping, ReverseSubtractEquation, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SRGBColorSpace, SRGBTransfer, ShaderChunk, ShaderLib, ShaderMaterial, ShortType, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, SubtractEquation, SubtractiveBlending, TangentSpaceNormalMap, Texture, TriPlanarMapping, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, WebGLCoordinateSystem, WebGLCubeRenderTarget, WebGLRenderTarget, WebGLRenderer, WebGLUtils, WebXRController, ZeroFactor, createCanvasElement };