super-three 0.133.4 → 0.136.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 (409) hide show
  1. package/LICENSE +1 -1
  2. package/build/three.js +2285 -1983
  3. package/build/three.min.js +1 -1
  4. package/build/three.module.js +5983 -5358
  5. package/examples/fonts/open-sans/open-sans-v15-cyrillic-ext_greek_greek-ext_cyrillic_latin_latin-ext_vietnamese-regular.woff +0 -0
  6. package/examples/fonts/open-sans/open-sans-v15-cyrillic-ext_greek_greek-ext_cyrillic_latin_latin-ext_vietnamese-regular.woff2 +0 -0
  7. package/examples/fonts/open-sans/open-sans.css +9 -0
  8. package/examples/fonts/tabler-icons/fonts/tabler-icons.eot +0 -0
  9. package/examples/fonts/tabler-icons/fonts/tabler-icons.svg +3966 -0
  10. package/examples/fonts/tabler-icons/fonts/tabler-icons.ttf +0 -0
  11. package/examples/fonts/tabler-icons/fonts/tabler-icons.woff +0 -0
  12. package/examples/fonts/tabler-icons/fonts/tabler-icons.woff2 +0 -0
  13. package/examples/fonts/tabler-icons/tabler-icons.min.css +4 -0
  14. package/examples/js/animation/CCDIKSolver.js +0 -1
  15. package/examples/js/animation/MMDPhysics.js +2 -4
  16. package/examples/js/cameras/CinematicCamera.js +2 -7
  17. package/examples/js/controls/ArcballControls.js +99 -72
  18. package/examples/js/controls/DragControls.js +7 -0
  19. package/examples/js/controls/OrbitControls.js +5 -36
  20. package/examples/js/controls/TrackballControls.js +3 -2
  21. package/examples/js/controls/TransformControls.js +24 -1
  22. package/examples/js/csm/CSM.js +2 -2
  23. package/examples/js/csm/CSMFrustum.js +133 -0
  24. package/examples/js/curves/CurveExtras.js +0 -2
  25. package/examples/js/effects/AsciiEffect.js +2 -9
  26. package/examples/js/exporters/GLTFExporter.js +148 -64
  27. package/examples/js/exporters/MMDExporter.js +1 -1
  28. package/examples/js/exporters/USDZExporter.js +45 -26
  29. package/examples/js/geometries/ConvexGeometry.js +1 -1
  30. package/examples/js/geometries/TeapotGeometry.js +0 -1
  31. package/examples/js/interactive/SelectionBox.js +2 -0
  32. package/examples/js/interactive/SelectionHelper.js +22 -7
  33. package/examples/js/lights/RectAreaLightUniformsLib.js +4 -0
  34. package/examples/js/lines/LineMaterial.js +58 -20
  35. package/examples/js/lines/LineSegments2.js +29 -24
  36. package/examples/js/loaders/3DMLoader.js +24 -11
  37. package/examples/js/loaders/3MFLoader.js +2 -2
  38. package/examples/js/loaders/AMFLoader.js +0 -2
  39. package/examples/js/loaders/BasisTextureLoader.js +1 -0
  40. package/examples/js/loaders/ColladaLoader.js +61 -4
  41. package/examples/js/loaders/EXRLoader.js +201 -272
  42. package/examples/js/loaders/FBXLoader.js +4 -5
  43. package/examples/js/loaders/GLTFLoader.js +98 -35
  44. package/examples/js/loaders/HDRCubeTextureLoader.js +0 -10
  45. package/examples/js/loaders/KTX2Loader.js +23 -2
  46. package/examples/js/loaders/KTXLoader.js +1 -1
  47. package/examples/js/loaders/LDrawLoader.js +1169 -901
  48. package/examples/js/loaders/LUT3dlLoader.js +19 -10
  49. package/examples/js/loaders/LUTCubeLoader.js +5 -4
  50. package/examples/js/loaders/LWOLoader.js +8 -6
  51. package/examples/js/loaders/LogLuvLoader.js +766 -0
  52. package/examples/js/loaders/MMDLoader.js +0 -1
  53. package/examples/js/loaders/NRRDLoader.js +9 -2
  54. package/examples/js/loaders/OBJLoader.js +0 -2
  55. package/examples/js/loaders/PLYLoader.js +33 -8
  56. package/examples/js/loaders/RGBELoader.js +8 -22
  57. package/examples/js/loaders/RGBMLoader.js +56 -6
  58. package/examples/js/loaders/SVGLoader.js +12 -6
  59. package/examples/js/loaders/TDSLoader.js +237 -271
  60. package/examples/js/loaders/VOXLoader.js +1 -0
  61. package/examples/js/loaders/VRMLLoader.js +11 -22
  62. package/examples/js/loaders/lwo/LWO2Parser.js +1 -0
  63. package/examples/js/loaders/lwo/LWO3Parser.js +4 -2
  64. package/examples/js/math/ConvexHull.js +7 -13
  65. package/examples/js/math/ImprovedNoise.js +1 -1
  66. package/examples/js/misc/GPUComputationRenderer.js +3 -1
  67. package/examples/js/misc/Volume.js +2 -2
  68. package/examples/js/modifiers/CurveModifier.js +8 -7
  69. package/examples/js/modifiers/EdgeSplitModifier.js +1 -1
  70. package/examples/js/modifiers/SimplifyModifier.js +1 -1
  71. package/examples/js/objects/Lensflare.js +2 -10
  72. package/examples/js/objects/MarchingCubes.js +42 -128
  73. package/examples/js/objects/Reflector.js +8 -13
  74. package/examples/js/objects/ReflectorForSSRPass.js +0 -10
  75. package/examples/js/objects/Refractor.js +8 -13
  76. package/examples/js/objects/Sky.js +1 -1
  77. package/examples/js/objects/Water.js +3 -15
  78. package/examples/js/objects/Water2.js +4 -7
  79. package/examples/js/postprocessing/GlitchPass.js +6 -5
  80. package/examples/js/postprocessing/SMAAPass.js +2 -9
  81. package/examples/js/postprocessing/SSAOPass.js +10 -21
  82. package/examples/js/postprocessing/SavePass.js +1 -5
  83. package/examples/js/renderers/CSS2DRenderer.js +4 -4
  84. package/examples/js/renderers/CSS3DRenderer.js +4 -4
  85. package/examples/js/shaders/ConvolutionShader.js +0 -1
  86. package/examples/js/shaders/DigitalGlitch.js +3 -3
  87. package/examples/js/shaders/FXAAShader.js +1 -1
  88. package/examples/js/shaders/FilmShader.js +1 -1
  89. package/examples/js/shaders/GammaCorrectionShader.js +1 -1
  90. package/examples/js/shaders/HorizontalBlurShader.js +1 -2
  91. package/examples/js/shaders/MMDToonShader.js +0 -1
  92. package/examples/js/shaders/SSAOShader.js +1 -1
  93. package/examples/js/shaders/SSRShader.js +1 -1
  94. package/examples/js/shaders/SSRrShader.js +1 -1
  95. package/examples/js/shaders/VerticalBlurShader.js +1 -2
  96. package/examples/js/utils/GeometryUtils.js +1 -1
  97. package/examples/jsm/animation/CCDIKSolver.js +0 -1
  98. package/examples/jsm/animation/MMDPhysics.js +1 -3
  99. package/examples/jsm/cameras/CinematicCamera.js +2 -5
  100. package/examples/jsm/{WebGL.js → capabilities/WebGL.js} +2 -2
  101. package/examples/jsm/{renderers/webgpu → capabilities}/WebGPU.js +1 -1
  102. package/examples/jsm/controls/ArcballControls.js +80 -77
  103. package/examples/jsm/controls/DragControls.js +7 -0
  104. package/examples/jsm/controls/OrbitControls.js +9 -51
  105. package/examples/jsm/controls/TrackballControls.js +1 -1
  106. package/examples/jsm/controls/TransformControls.js +24 -1
  107. package/examples/jsm/csm/CSM.js +3 -3
  108. package/examples/jsm/csm/{Frustum.js → CSMFrustum.js} +3 -3
  109. package/examples/jsm/curves/CurveExtras.js +0 -2
  110. package/examples/jsm/effects/AsciiEffect.js +2 -9
  111. package/examples/jsm/exporters/GLTFExporter.js +169 -99
  112. package/examples/jsm/exporters/MMDExporter.js +1 -1
  113. package/examples/jsm/exporters/USDZExporter.js +47 -26
  114. package/examples/jsm/geometries/ConvexGeometry.js +1 -1
  115. package/examples/jsm/geometries/TeapotGeometry.js +0 -1
  116. package/examples/jsm/interactive/SelectionBox.js +1 -0
  117. package/examples/jsm/interactive/SelectionHelper.js +19 -7
  118. package/examples/jsm/libs/flow.module.js +3338 -0
  119. package/examples/jsm/libs/lil-gui.module.min.js +8 -0
  120. package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
  121. package/examples/jsm/lights/RectAreaLightUniformsLib.js +7 -0
  122. package/examples/jsm/lines/LineMaterial.js +59 -23
  123. package/examples/jsm/lines/LineSegments2.js +22 -18
  124. package/examples/jsm/loaders/3DMLoader.js +18 -12
  125. package/examples/jsm/loaders/3MFLoader.js +2 -2
  126. package/examples/jsm/loaders/AMFLoader.js +0 -2
  127. package/examples/jsm/loaders/BasisTextureLoader.js +7 -0
  128. package/examples/jsm/loaders/ColladaLoader.js +61 -4
  129. package/examples/jsm/loaders/EXRLoader.js +200 -306
  130. package/examples/jsm/loaders/FBXLoader.js +4 -5
  131. package/examples/jsm/loaders/GLTFLoader.js +102 -40
  132. package/examples/jsm/loaders/HDRCubeTextureLoader.js +1 -17
  133. package/examples/jsm/loaders/KTX2Loader.js +30 -2
  134. package/examples/jsm/loaders/KTXLoader.js +1 -1
  135. package/examples/jsm/loaders/LDrawLoader.js +1159 -898
  136. package/examples/jsm/loaders/LUT3dlLoader.js +19 -12
  137. package/examples/jsm/loaders/LUTCubeLoader.js +5 -5
  138. package/examples/jsm/loaders/LWOLoader.js +8 -6
  139. package/examples/jsm/loaders/LogLuvLoader.js +606 -0
  140. package/examples/jsm/loaders/MMDLoader.js +0 -1
  141. package/examples/jsm/loaders/NRRDLoader.js +10 -2
  142. package/examples/jsm/loaders/OBJLoader.js +0 -2
  143. package/examples/jsm/loaders/PLYLoader.js +34 -8
  144. package/examples/jsm/loaders/RGBELoader.js +7 -28
  145. package/examples/jsm/loaders/RGBMLoader.js +62 -8
  146. package/examples/jsm/loaders/SVGLoader.js +15 -7
  147. package/examples/jsm/loaders/TDSLoader.js +236 -275
  148. package/examples/jsm/loaders/VOXLoader.js +1 -0
  149. package/examples/jsm/loaders/VRMLLoader.js +11 -23
  150. package/examples/jsm/loaders/lwo/LWO2Parser.js +1 -0
  151. package/examples/jsm/loaders/lwo/LWO3Parser.js +2 -2
  152. package/examples/jsm/math/ConvexHull.js +7 -13
  153. package/examples/jsm/math/ImprovedNoise.js +1 -1
  154. package/examples/jsm/misc/GPUComputationRenderer.js +3 -1
  155. package/examples/jsm/misc/Volume.js +2 -2
  156. package/examples/jsm/modifiers/CurveModifier.js +9 -8
  157. package/examples/jsm/modifiers/EdgeSplitModifier.js +1 -1
  158. package/examples/jsm/modifiers/SimplifyModifier.js +1 -1
  159. package/examples/jsm/node-editor/NodeEditor.js +455 -0
  160. package/examples/jsm/node-editor/accessors/NormalEditor.js +30 -0
  161. package/examples/jsm/node-editor/accessors/PositionEditor.js +30 -0
  162. package/examples/jsm/node-editor/accessors/UVEditor.js +26 -0
  163. package/examples/jsm/node-editor/display/BlendEditor.js +43 -0
  164. package/examples/jsm/node-editor/examples/animate-uv.json +1 -0
  165. package/examples/jsm/node-editor/examples/fake-top-light.json +1 -0
  166. package/examples/jsm/node-editor/examples/oscillator-color.json +1 -0
  167. package/examples/jsm/node-editor/examples/rim.json +1 -0
  168. package/examples/jsm/node-editor/inputs/ColorEditor.js +91 -0
  169. package/examples/jsm/node-editor/inputs/FloatEditor.js +24 -0
  170. package/examples/jsm/node-editor/inputs/SliderEditor.js +68 -0
  171. package/examples/jsm/node-editor/inputs/Vector2Editor.js +28 -0
  172. package/examples/jsm/node-editor/inputs/Vector3Editor.js +30 -0
  173. package/examples/jsm/node-editor/inputs/Vector4Editor.js +37 -0
  174. package/examples/jsm/node-editor/materials/StandardMaterialEditor.js +108 -0
  175. package/examples/jsm/node-editor/math/DotEditor.js +36 -0
  176. package/examples/jsm/node-editor/math/InvertEditor.js +38 -0
  177. package/examples/jsm/node-editor/math/LimiterEditor.js +48 -0
  178. package/examples/jsm/node-editor/math/NormalizeEditor.js +26 -0
  179. package/examples/jsm/node-editor/math/OperatorEditor.js +50 -0
  180. package/examples/jsm/node-editor/math/PowerEditor.js +34 -0
  181. package/examples/jsm/node-editor/math/TrigonometryEditor.js +39 -0
  182. package/examples/jsm/node-editor/procedural/CheckerEditor.js +26 -0
  183. package/examples/jsm/node-editor/utils/OscillatorEditor.js +42 -0
  184. package/examples/jsm/node-editor/utils/TimerEditor.js +57 -0
  185. package/examples/jsm/nodes/core/NodeBuilder.js +2 -2
  186. package/examples/jsm/nodes/materials/StandardNodeMaterial.js +1 -1
  187. package/examples/jsm/nodes/materials/nodes/StandardNode.js +7 -6
  188. package/examples/jsm/nodes/math/MathNode.js +12 -0
  189. package/examples/jsm/nodes/misc/BumpMapNode.js +1 -1
  190. package/examples/jsm/nodes/misc/TextureCubeUVNode.js +1 -4
  191. package/examples/jsm/nodes/utils/ColorSpaceNode.js +5 -177
  192. package/examples/jsm/objects/Lensflare.js +5 -16
  193. package/examples/jsm/objects/MarchingCubes.js +46 -152
  194. package/examples/jsm/objects/Reflector.js +8 -16
  195. package/examples/jsm/objects/ReflectorForSSRPass.js +0 -12
  196. package/examples/jsm/objects/Refractor.js +8 -16
  197. package/examples/jsm/objects/Sky.js +1 -1
  198. package/examples/jsm/objects/Water.js +3 -18
  199. package/examples/jsm/objects/Water2.js +4 -8
  200. package/examples/jsm/postprocessing/AdaptiveToneMappingPass.js +1 -1
  201. package/examples/jsm/postprocessing/AfterimagePass.js +1 -1
  202. package/examples/jsm/postprocessing/BloomPass.js +1 -1
  203. package/examples/jsm/postprocessing/BokehPass.js +1 -1
  204. package/examples/jsm/postprocessing/ClearPass.js +1 -1
  205. package/examples/jsm/postprocessing/CubeTexturePass.js +1 -1
  206. package/examples/jsm/postprocessing/DotScreenPass.js +1 -1
  207. package/examples/jsm/postprocessing/EffectComposer.js +3 -3
  208. package/examples/jsm/postprocessing/FilmPass.js +1 -1
  209. package/examples/jsm/postprocessing/GlitchPass.js +10 -7
  210. package/examples/jsm/postprocessing/HalftonePass.js +1 -1
  211. package/examples/jsm/postprocessing/MaskPass.js +1 -1
  212. package/examples/jsm/postprocessing/OutlinePass.js +1 -1
  213. package/examples/jsm/postprocessing/RenderPass.js +1 -1
  214. package/examples/jsm/postprocessing/SAOPass.js +2 -2
  215. package/examples/jsm/postprocessing/SMAAPass.js +3 -12
  216. package/examples/jsm/postprocessing/SSAARenderPass.js +1 -1
  217. package/examples/jsm/postprocessing/SSAOPass.js +15 -26
  218. package/examples/jsm/postprocessing/SSRPass.js +1 -1
  219. package/examples/jsm/postprocessing/SSRrPass.js +1 -1
  220. package/examples/jsm/postprocessing/SavePass.js +2 -4
  221. package/examples/jsm/postprocessing/ShaderPass.js +1 -1
  222. package/examples/jsm/postprocessing/TAARenderPass.js +1 -1
  223. package/examples/jsm/postprocessing/TexturePass.js +1 -1
  224. package/examples/jsm/postprocessing/UnrealBloomPass.js +1 -1
  225. package/examples/jsm/renderers/CSS2DRenderer.js +5 -4
  226. package/examples/jsm/renderers/CSS3DRenderer.js +5 -4
  227. package/examples/jsm/renderers/nodes/Nodes.js +17 -13
  228. package/examples/jsm/renderers/nodes/ShaderNode.js +229 -49
  229. package/examples/jsm/renderers/nodes/accessors/MaterialNode.js +6 -6
  230. package/examples/jsm/renderers/nodes/accessors/ModelViewProjectionNode.js +5 -5
  231. package/examples/jsm/renderers/nodes/accessors/NormalNode.js +14 -3
  232. package/examples/jsm/renderers/nodes/accessors/PointUVNode.js +3 -3
  233. package/examples/jsm/renderers/nodes/accessors/PositionNode.js +15 -5
  234. package/examples/jsm/renderers/nodes/accessors/SkinningNode.js +107 -0
  235. package/examples/jsm/renderers/nodes/accessors/UVNode.js +7 -5
  236. package/examples/jsm/renderers/nodes/core/ArrayInputNode.js +3 -3
  237. package/examples/jsm/renderers/nodes/core/AttributeNode.js +6 -0
  238. package/examples/jsm/renderers/nodes/core/BypassNode.js +38 -0
  239. package/examples/jsm/renderers/nodes/core/CodeNode.js +3 -3
  240. package/examples/jsm/renderers/nodes/core/ContextNode.js +4 -19
  241. package/examples/jsm/renderers/nodes/core/ExpressionNode.js +13 -2
  242. package/examples/jsm/renderers/nodes/core/FunctionNode.js +19 -132
  243. package/examples/jsm/renderers/nodes/core/InputNode.js +13 -3
  244. package/examples/jsm/renderers/nodes/core/Node.js +32 -10
  245. package/examples/jsm/renderers/nodes/core/NodeBuilder.js +146 -128
  246. package/examples/jsm/renderers/nodes/core/NodeFunction.js +22 -0
  247. package/examples/jsm/renderers/nodes/core/NodeFunctionInput.js +4 -4
  248. package/examples/jsm/renderers/nodes/core/NodeKeywords.js +18 -179
  249. package/examples/jsm/renderers/nodes/core/NodeParser.js +11 -0
  250. package/examples/jsm/renderers/nodes/core/NodeVar.js +2 -2
  251. package/examples/jsm/renderers/nodes/core/PropertyNode.js +14 -2
  252. package/examples/jsm/renderers/nodes/core/TempNode.js +10 -13
  253. package/examples/jsm/renderers/nodes/core/VarNode.js +12 -7
  254. package/examples/jsm/renderers/nodes/core/VaryNode.js +23 -8
  255. package/examples/jsm/renderers/nodes/core/constants.js +2 -0
  256. package/examples/jsm/renderers/nodes/display/ColorSpaceNode.js +43 -63
  257. package/examples/jsm/renderers/nodes/display/NormalMapNode.js +21 -22
  258. package/examples/jsm/renderers/nodes/functions/BSDFs.js +64 -101
  259. package/examples/jsm/renderers/nodes/functions/PhysicalMaterialFunctions.js +27 -0
  260. package/examples/jsm/renderers/nodes/inputs/BufferNode.js +25 -0
  261. package/examples/jsm/renderers/nodes/inputs/IntNode.js +17 -0
  262. package/examples/jsm/renderers/nodes/inputs/TextureNode.js +13 -10
  263. package/examples/jsm/renderers/nodes/lights/LightContextNode.js +20 -14
  264. package/examples/jsm/renderers/nodes/lights/LightNode.js +32 -36
  265. package/examples/jsm/renderers/nodes/math/CondNode.js +60 -0
  266. package/examples/jsm/renderers/nodes/math/MathNode.js +91 -37
  267. package/examples/jsm/renderers/nodes/math/OperatorNode.js +124 -31
  268. package/examples/jsm/renderers/nodes/parsers/GLSLNodeFunction.js +137 -0
  269. package/examples/jsm/renderers/nodes/parsers/GLSLNodeParser.js +14 -0
  270. package/examples/jsm/renderers/nodes/parsers/WGSLNodeFunction.js +89 -0
  271. package/examples/jsm/renderers/nodes/parsers/WGSLNodeParser.js +14 -0
  272. package/examples/jsm/renderers/nodes/procedural/CheckerNode.js +7 -9
  273. package/examples/jsm/renderers/nodes/utils/ArrayElementNode.js +31 -0
  274. package/examples/jsm/renderers/nodes/utils/ConvertNode.js +33 -0
  275. package/examples/jsm/renderers/nodes/utils/JoinNode.js +7 -7
  276. package/examples/jsm/renderers/nodes/utils/OscNode.js +58 -0
  277. package/examples/jsm/renderers/nodes/utils/SplitNode.js +18 -8
  278. package/examples/jsm/renderers/nodes/utils/SpriteSheetUVNode.js +7 -7
  279. package/examples/jsm/renderers/nodes/utils/TimerNode.js +1 -1
  280. package/examples/jsm/renderers/webgl/nodes/SlotNode.js +22 -0
  281. package/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js +192 -95
  282. package/examples/jsm/renderers/webgl/nodes/WebGLNodes.js +2 -2
  283. package/examples/jsm/renderers/webgl/nodes/WebGLPhysicalContextNode.js +2 -2
  284. package/examples/jsm/renderers/webgpu/WebGPUBackground.js +1 -1
  285. package/examples/jsm/renderers/webgpu/WebGPUBindings.js +10 -9
  286. package/examples/jsm/renderers/webgpu/WebGPUComputePipelines.js +2 -4
  287. package/examples/jsm/renderers/webgpu/WebGPUObjects.js +1 -1
  288. package/examples/jsm/renderers/webgpu/WebGPUProgrammableStage.js +2 -4
  289. package/examples/jsm/renderers/webgpu/WebGPURenderPipeline.js +15 -23
  290. package/examples/jsm/renderers/webgpu/WebGPURenderPipelines.js +44 -65
  291. package/examples/jsm/renderers/webgpu/WebGPURenderer.js +13 -31
  292. package/examples/jsm/renderers/webgpu/WebGPUTextureUtils.js +61 -28
  293. package/examples/jsm/renderers/webgpu/WebGPUTextures.js +35 -29
  294. package/examples/jsm/renderers/webgpu/constants.js +2 -2
  295. package/examples/jsm/renderers/webgpu/nodes/WebGPUNodeBuilder.js +459 -95
  296. package/examples/jsm/renderers/webgpu/nodes/WebGPUNodes.js +1 -1
  297. package/examples/jsm/shaders/ConvolutionShader.js +0 -1
  298. package/examples/jsm/shaders/DigitalGlitch.js +3 -3
  299. package/examples/jsm/shaders/FXAAShader.js +1 -1
  300. package/examples/jsm/shaders/FilmShader.js +1 -1
  301. package/examples/jsm/shaders/GammaCorrectionShader.js +1 -1
  302. package/examples/jsm/shaders/HorizontalBlurShader.js +1 -2
  303. package/examples/jsm/shaders/MMDToonShader.js +0 -1
  304. package/examples/jsm/shaders/SSAOShader.js +1 -1
  305. package/examples/jsm/shaders/SSRShader.js +1 -1
  306. package/examples/jsm/shaders/SSRrShader.js +1 -1
  307. package/examples/jsm/shaders/VerticalBlurShader.js +1 -2
  308. package/examples/jsm/utils/GeometryUtils.js +1 -1
  309. package/examples/jsm/utils/LDrawUtils.js +195 -0
  310. package/examples/jsm/utils/WorkerPool.js +11 -11
  311. package/examples/jsm/webxr/OculusHandPointerModel.js +6 -6
  312. package/examples/jsm/webxr/VRButton.js +24 -0
  313. package/examples/jsm/webxr/XREstimatedLight.js +2 -0
  314. package/package.json +27 -18
  315. package/src/Three.Legacy.js +18 -0
  316. package/src/Three.js +1 -3
  317. package/src/animation/AnimationMixer.js +1 -0
  318. package/src/cameras/CubeCamera.js +2 -0
  319. package/src/cameras/StereoCamera.js +8 -7
  320. package/src/constants.js +3 -23
  321. package/src/core/Layers.js +7 -1
  322. package/src/core/Object3D.js +3 -1
  323. package/src/extras/ImageUtils.js +63 -0
  324. package/src/extras/PMREMGenerator.js +49 -185
  325. package/src/extras/core/Interpolations.js +1 -1
  326. package/src/geometries/LatheGeometry.js +70 -47
  327. package/src/helpers/CameraHelper.js +1 -1
  328. package/src/loaders/FileLoader.js +98 -144
  329. package/src/loaders/ImageLoader.js +9 -4
  330. package/src/loaders/LoaderUtils.js +26 -0
  331. package/src/loaders/MaterialLoader.js +8 -5
  332. package/src/loaders/ObjectLoader.js +2 -0
  333. package/src/materials/Material.js +8 -8
  334. package/src/materials/MeshPhysicalMaterial.js +20 -14
  335. package/src/math/Color.js +1 -39
  336. package/src/math/MathUtils.js +5 -16
  337. package/src/math/Quaternion.js +1 -1
  338. package/src/math/Ray.js +2 -2
  339. package/src/math/Sphere.js +10 -1
  340. package/src/objects/Skeleton.js +1 -0
  341. package/src/renderers/WebGLCubeRenderTarget.js +0 -2
  342. package/src/renderers/WebGLMultisampleRenderTarget.js +7 -1
  343. package/src/renderers/WebGLRenderer.js +106 -199
  344. package/src/renderers/shaders/ShaderChunk/bsdfs.glsl.js +2 -2
  345. package/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js +1 -1
  346. package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +2 -24
  347. package/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.js +0 -2
  348. package/src/renderers/shaders/ShaderChunk/encodings_pars_fragment.glsl.js +0 -78
  349. package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +0 -1
  350. package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +0 -2
  351. package/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.js +1 -1
  352. package/src/renderers/shaders/ShaderChunk/lightmap_fragment.glsl.js +1 -1
  353. package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +1 -1
  354. package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +19 -6
  355. package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +28 -2
  356. package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +10 -3
  357. package/src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl.js +1 -2
  358. package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +1 -1
  359. package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
  360. package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +9 -8
  361. package/src/renderers/shaders/ShaderLib/background.glsl.js +1 -3
  362. package/src/renderers/shaders/ShaderLib/equirect.glsl.js +1 -3
  363. package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +1 -1
  364. package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +1 -2
  365. package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +23 -5
  366. package/src/renderers/shaders/ShaderLib/vsm.glsl.js +2 -1
  367. package/src/renderers/shaders/ShaderLib.js +8 -6
  368. package/src/renderers/shaders/UniformsLib.js +1 -2
  369. package/src/renderers/webgl/WebGLCapabilities.js +0 -2
  370. package/src/renderers/webgl/WebGLCubeMaps.js +0 -4
  371. package/src/renderers/webgl/WebGLCubeUVMaps.js +29 -16
  372. package/src/renderers/webgl/WebGLExtensions.js +1 -0
  373. package/src/renderers/webgl/WebGLMaterials.js +27 -15
  374. package/src/renderers/webgl/WebGLMorphtargets.js +13 -0
  375. package/src/renderers/webgl/WebGLProgram.js +12 -37
  376. package/src/renderers/webgl/WebGLPrograms.js +192 -70
  377. package/src/renderers/webgl/WebGLRenderLists.js +4 -14
  378. package/src/renderers/webgl/WebGLShaderCache.js +120 -0
  379. package/src/renderers/webgl/WebGLShadowMap.js +14 -5
  380. package/src/renderers/webgl/WebGLState.js +157 -17
  381. package/src/renderers/webgl/WebGLTextures.js +442 -83
  382. package/src/renderers/webgl/WebGLUniforms.js +45 -1
  383. package/src/renderers/webgl/WebGLUtils.js +86 -28
  384. package/src/renderers/webxr/WebXRManager.js +77 -109
  385. package/src/scenes/Scene.js +1 -1
  386. package/src/textures/DataTexture.js +0 -2
  387. package/src/textures/DataTexture2DArray.js +0 -2
  388. package/src/textures/DataTexture3D.js +0 -2
  389. package/src/textures/FramebufferTexture.js +25 -0
  390. package/src/textures/Texture.js +8 -1
  391. package/src/textures/VideoTexture.js +1 -3
  392. package/examples/js/WebGL.js +0 -90
  393. package/examples/js/controls/DeviceOrientationControls.js +0 -147
  394. package/examples/js/libs/dat.gui.min.js +0 -14
  395. package/examples/js/utils/RoughnessMipmapper.js +0 -278
  396. package/examples/jsm/controls/DeviceOrientationControls.js +0 -153
  397. package/examples/jsm/libs/dat.gui.module.js +0 -3575
  398. package/examples/jsm/libs/glslang.js +0 -78
  399. package/examples/jsm/libs/glslang.wasm +0 -0
  400. package/examples/jsm/renderers/nodes/consts/MathConsts.js +0 -7
  401. package/examples/jsm/renderers/nodes/core/ConstNode.js +0 -39
  402. package/examples/jsm/renderers/nodes/core/NodeSlot.js +0 -13
  403. package/examples/jsm/renderers/nodes/core/StructNode.js +0 -80
  404. package/examples/jsm/renderers/nodes/core/StructVarNode.js +0 -75
  405. package/examples/jsm/renderers/nodes/functions/EncodingFunctions.js +0 -99
  406. package/examples/jsm/renderers/nodes/functions/MathFunctions.js +0 -47
  407. package/examples/jsm/renderers/webgpu/nodes/ShaderLib.js +0 -152
  408. package/examples/jsm/utils/RoughnessMipmapper.js +0 -300
  409. package/src/extras/objects/ImmediateRenderObject.js +0 -31
@@ -4,6 +4,7 @@ import { PerspectiveCamera } from './PerspectiveCamera.js';
4
4
 
5
5
  const _eyeRight = /*@__PURE__*/ new Matrix4();
6
6
  const _eyeLeft = /*@__PURE__*/ new Matrix4();
7
+ const _projectionMatrix = /*@__PURE__*/ new Matrix4();
7
8
 
8
9
  class StereoCamera {
9
10
 
@@ -56,7 +57,7 @@ class StereoCamera {
56
57
  // Off-axis stereoscopic effect based on
57
58
  // http://paulbourke.net/stereographics/stereorender/
58
59
 
59
- const projectionMatrix = camera.projectionMatrix.clone();
60
+ _projectionMatrix.copy( camera.projectionMatrix );
60
61
  const eyeSepHalf = cache.eyeSep / 2;
61
62
  const eyeSepOnProjection = eyeSepHalf * cache.near / cache.focus;
62
63
  const ymax = ( cache.near * Math.tan( MathUtils.DEG2RAD * cache.fov * 0.5 ) ) / cache.zoom;
@@ -72,20 +73,20 @@ class StereoCamera {
72
73
  xmin = - ymax * cache.aspect + eyeSepOnProjection;
73
74
  xmax = ymax * cache.aspect + eyeSepOnProjection;
74
75
 
75
- projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );
76
- projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );
76
+ _projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );
77
+ _projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );
77
78
 
78
- this.cameraL.projectionMatrix.copy( projectionMatrix );
79
+ this.cameraL.projectionMatrix.copy( _projectionMatrix );
79
80
 
80
81
  // for right eye
81
82
 
82
83
  xmin = - ymax * cache.aspect - eyeSepOnProjection;
83
84
  xmax = ymax * cache.aspect - eyeSepOnProjection;
84
85
 
85
- projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );
86
- projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );
86
+ _projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );
87
+ _projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );
87
88
 
88
- this.cameraR.projectionMatrix.copy( projectionMatrix );
89
+ this.cameraR.projectionMatrix.copy( _projectionMatrix );
89
90
 
90
91
  }
91
92
 
package/src/constants.js CHANGED
@@ -1,4 +1,4 @@
1
- export const REVISION = '133';
1
+ export const REVISION = '137dev';
2
2
  export const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
3
3
  export const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
4
4
  export const CullFaceNone = 0;
@@ -87,11 +87,9 @@ export const UnsignedShort5551Type = 1018;
87
87
  export const UnsignedShort565Type = 1019;
88
88
  export const UnsignedInt248Type = 1020;
89
89
  export const AlphaFormat = 1021;
90
- export const RGBFormat = 1022;
91
90
  export const RGBAFormat = 1023;
92
91
  export const LuminanceFormat = 1024;
93
92
  export const LuminanceAlphaFormat = 1025;
94
- export const RGBEFormat = RGBAFormat;
95
93
  export const DepthFormat = 1026;
96
94
  export const DepthStencilFormat = 1027;
97
95
  export const RedFormat = 1028;
@@ -127,20 +125,6 @@ export const RGBA_ASTC_10x10_Format = 37819;
127
125
  export const RGBA_ASTC_12x10_Format = 37820;
128
126
  export const RGBA_ASTC_12x12_Format = 37821;
129
127
  export const RGBA_BPTC_Format = 36492;
130
- export const SRGB8_ALPHA8_ASTC_4x4_Format = 37840;
131
- export const SRGB8_ALPHA8_ASTC_5x4_Format = 37841;
132
- export const SRGB8_ALPHA8_ASTC_5x5_Format = 37842;
133
- export const SRGB8_ALPHA8_ASTC_6x5_Format = 37843;
134
- export const SRGB8_ALPHA8_ASTC_6x6_Format = 37844;
135
- export const SRGB8_ALPHA8_ASTC_8x5_Format = 37845;
136
- export const SRGB8_ALPHA8_ASTC_8x6_Format = 37846;
137
- export const SRGB8_ALPHA8_ASTC_8x8_Format = 37847;
138
- export const SRGB8_ALPHA8_ASTC_10x5_Format = 37848;
139
- export const SRGB8_ALPHA8_ASTC_10x6_Format = 37849;
140
- export const SRGB8_ALPHA8_ASTC_10x8_Format = 37850;
141
- export const SRGB8_ALPHA8_ASTC_10x10_Format = 37851;
142
- export const SRGB8_ALPHA8_ASTC_12x10_Format = 37852;
143
- export const SRGB8_ALPHA8_ASTC_12x12_Format = 37853;
144
128
  export const LoopOnce = 2200;
145
129
  export const LoopRepeat = 2201;
146
130
  export const LoopPingPong = 2202;
@@ -157,12 +141,6 @@ export const TriangleStripDrawMode = 1;
157
141
  export const TriangleFanDrawMode = 2;
158
142
  export const LinearEncoding = 3000;
159
143
  export const sRGBEncoding = 3001;
160
- export const GammaEncoding = 3007;
161
- export const RGBEEncoding = 3002;
162
- export const LogLuvEncoding = 3003;
163
- export const RGBM7Encoding = 3004;
164
- export const RGBM16Encoding = 3005;
165
- export const RGBDEncoding = 3006;
166
144
  export const BasicDepthPacking = 3200;
167
145
  export const RGBADepthPacking = 3201;
168
146
  export const TangentSpaceNormalMap = 0;
@@ -198,3 +176,5 @@ export const StreamCopyUsage = 35042;
198
176
 
199
177
  export const GLSL1 = '100';
200
178
  export const GLSL3 = '300 es';
179
+
180
+ export const _SRGBAFormat = 1035; // fallback for WebGL 1
@@ -8,7 +8,7 @@ class Layers {
8
8
 
9
9
  set( channel ) {
10
10
 
11
- this.mask = 1 << channel | 0;
11
+ this.mask = ( 1 << channel | 0 ) >>> 0;
12
12
 
13
13
  }
14
14
 
@@ -48,6 +48,12 @@ class Layers {
48
48
 
49
49
  }
50
50
 
51
+ isEnabled( channel ) {
52
+
53
+ return ( this.mask & ( 1 << channel | 0 ) ) !== 0;
54
+
55
+ }
56
+
51
57
  }
52
58
 
53
59
 
@@ -405,6 +405,8 @@ class Object3D extends EventDispatcher {
405
405
 
406
406
  // adds object as a child of this, while maintaining the object's world transform
407
407
 
408
+ // Note: This method does not support scene graphs having non-uniformly-scaled nodes(s)
409
+
408
410
  this.updateWorldMatrix( true, false );
409
411
 
410
412
  _m1.copy( this.matrixWorld ).invert();
@@ -498,7 +500,7 @@ class Object3D extends EventDispatcher {
498
500
 
499
501
  }
500
502
 
501
- raycast() {}
503
+ raycast( /* raycaster, intersects */ ) {}
502
504
 
503
505
  traverse( callback ) {
504
506
 
@@ -1,4 +1,5 @@
1
1
  import { createElementNS } from '../utils.js';
2
+ import { SRGBToLinear } from '../math/Color.js';
2
3
 
3
4
  let _canvas;
4
5
 
@@ -61,6 +62,68 @@ class ImageUtils {
61
62
 
62
63
  }
63
64
 
65
+ static sRGBToLinear( image ) {
66
+
67
+ if ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||
68
+ ( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||
69
+ ( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {
70
+
71
+ const canvas = createElementNS( 'canvas' );
72
+
73
+ canvas.width = image.width;
74
+ canvas.height = image.height;
75
+
76
+ const context = canvas.getContext( '2d' );
77
+ context.drawImage( image, 0, 0, image.width, image.height );
78
+
79
+ const imageData = context.getImageData( 0, 0, image.width, image.height );
80
+ const data = imageData.data;
81
+
82
+ for ( let i = 0; i < data.length; i ++ ) {
83
+
84
+ data[ i ] = SRGBToLinear( data[ i ] / 255 ) * 255;
85
+
86
+ }
87
+
88
+ context.putImageData( imageData, 0, 0 );
89
+
90
+ return canvas;
91
+
92
+ } else if ( image.data ) {
93
+
94
+ const data = image.data.slice( 0 );
95
+
96
+ for ( let i = 0; i < data.length; i ++ ) {
97
+
98
+ if ( data instanceof Uint8Array || data instanceof Uint8ClampedArray ) {
99
+
100
+ data[ i ] = Math.floor( SRGBToLinear( data[ i ] / 255 ) * 255 );
101
+
102
+ } else {
103
+
104
+ // assuming float
105
+
106
+ data[ i ] = SRGBToLinear( data[ i ] );
107
+
108
+ }
109
+
110
+ }
111
+
112
+ return {
113
+ data: data,
114
+ width: image.width,
115
+ height: image.height
116
+ };
117
+
118
+ } else {
119
+
120
+ console.warn( 'THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.' );
121
+ return image;
122
+
123
+ }
124
+
125
+ }
126
+
64
127
  }
65
128
 
66
129
  export { ImageUtils };
@@ -1,18 +1,13 @@
1
1
  import {
2
+ CubeReflectionMapping,
3
+ CubeRefractionMapping,
2
4
  CubeUVReflectionMapping,
3
- GammaEncoding,
4
5
  LinearEncoding,
6
+ LinearFilter,
5
7
  NoToneMapping,
6
- NearestFilter,
7
8
  NoBlending,
8
- RGBDEncoding,
9
- RGBEEncoding,
10
- RGBEFormat,
11
9
  RGBAFormat,
12
- RGBM16Encoding,
13
- RGBM7Encoding,
14
- UnsignedByteType,
15
- sRGBEncoding
10
+ HalfFloatType
16
11
  } from '../constants.js';
17
12
 
18
13
  import { BufferAttribute } from '../core/BufferAttribute.js';
@@ -45,16 +40,6 @@ const TOTAL_LODS = LOD_MAX - LOD_MIN + 1 + EXTRA_LOD_SIGMA.length;
45
40
  // samples and exit early, but not recompile the shader.
46
41
  const MAX_SAMPLES = 20;
47
42
 
48
- const ENCODINGS = {
49
- [ LinearEncoding ]: 0,
50
- [ sRGBEncoding ]: 1,
51
- [ RGBEEncoding ]: 2,
52
- [ RGBM7Encoding ]: 3,
53
- [ RGBM16Encoding ]: 4,
54
- [ RGBDEncoding ]: 5,
55
- [ GammaEncoding ]: 6
56
- };
57
-
58
43
  const _flatCamera = /*@__PURE__*/ new OrthographicCamera();
59
44
  const { _lodPlanes, _sizeLods, _sigmas } = /*@__PURE__*/ _createPlanes();
60
45
  const _clearColor = /*@__PURE__*/ new Color();
@@ -136,23 +121,23 @@ class PMREMGenerator {
136
121
 
137
122
  /**
138
123
  * Generates a PMREM from an equirectangular texture, which can be either LDR
139
- * (RGBFormat) or HDR (RGBEFormat). The ideal input image size is 1k (1024 x 512),
124
+ * or HDR. The ideal input image size is 1k (1024 x 512),
140
125
  * as this matches best with the 256 x 256 cubemap output.
141
126
  */
142
- fromEquirectangular( equirectangular ) {
127
+ fromEquirectangular( equirectangular, renderTarget = null ) {
143
128
 
144
- return this._fromTexture( equirectangular );
129
+ return this._fromTexture( equirectangular, renderTarget );
145
130
 
146
131
  }
147
132
 
148
133
  /**
149
134
  * Generates a PMREM from an cubemap texture, which can be either LDR
150
- * (RGBFormat) or HDR (RGBEFormat). The ideal input cube size is 256 x 256,
135
+ * or HDR. The ideal input cube size is 256 x 256,
151
136
  * as this matches best with the 256 x 256 cubemap output.
152
137
  */
153
- fromCubemap( cubemap ) {
138
+ fromCubemap( cubemap, renderTarget = null ) {
154
139
 
155
- return this._fromTexture( cubemap );
140
+ return this._fromTexture( cubemap, renderTarget );
156
141
 
157
142
  }
158
143
 
@@ -195,6 +180,8 @@ class PMREMGenerator {
195
180
 
196
181
  this._blurMaterial.dispose();
197
182
 
183
+ if ( this._pingPongRenderTarget !== null ) this._pingPongRenderTarget.dispose();
184
+
198
185
  if ( this._cubemapShader !== null ) this._cubemapShader.dispose();
199
186
  if ( this._equirectShader !== null ) this._equirectShader.dispose();
200
187
 
@@ -210,17 +197,16 @@ class PMREMGenerator {
210
197
 
211
198
  _cleanup( outputTarget ) {
212
199
 
213
- this._pingPongRenderTarget.dispose();
214
200
  this._renderer.setRenderTarget( _oldTarget );
215
201
  outputTarget.scissorTest = false;
216
202
  _setViewport( outputTarget, 0, 0, outputTarget.width, outputTarget.height );
217
203
 
218
204
  }
219
205
 
220
- _fromTexture( texture ) {
206
+ _fromTexture( texture, renderTarget ) {
221
207
 
222
208
  _oldTarget = this._renderer.getRenderTarget();
223
- const cubeUVRenderTarget = this._allocateTargets( texture );
209
+ const cubeUVRenderTarget = renderTarget || this._allocateTargets( texture );
224
210
  this._textureToCubeUV( texture, cubeUVRenderTarget );
225
211
  this._applyPMREM( cubeUVRenderTarget );
226
212
  this._cleanup( cubeUVRenderTarget );
@@ -232,18 +218,24 @@ class PMREMGenerator {
232
218
  _allocateTargets( texture ) { // warning: null texture is valid
233
219
 
234
220
  const params = {
235
- magFilter: NearestFilter,
236
- minFilter: NearestFilter,
221
+ magFilter: LinearFilter,
222
+ minFilter: LinearFilter,
237
223
  generateMipmaps: false,
238
- type: UnsignedByteType,
239
- format: RGBEFormat,
240
- encoding: _isLDR( texture ) ? texture.encoding : RGBEEncoding,
224
+ type: HalfFloatType,
225
+ format: RGBAFormat,
226
+ encoding: LinearEncoding,
241
227
  depthBuffer: false
242
228
  };
243
229
 
244
230
  const cubeUVRenderTarget = _createRenderTarget( params );
245
231
  cubeUVRenderTarget.depthBuffer = texture ? false : true;
246
- this._pingPongRenderTarget = _createRenderTarget( params );
232
+
233
+ if ( this._pingPongRenderTarget === null ) {
234
+
235
+ this._pingPongRenderTarget = _createRenderTarget( params );
236
+
237
+ }
238
+
247
239
  return cubeUVRenderTarget;
248
240
 
249
241
  }
@@ -265,12 +257,10 @@ class PMREMGenerator {
265
257
  const renderer = this._renderer;
266
258
 
267
259
  const originalAutoClear = renderer.autoClear;
268
- const outputEncoding = renderer.outputEncoding;
269
260
  const toneMapping = renderer.toneMapping;
270
261
  renderer.getClearColor( _clearColor );
271
262
 
272
263
  renderer.toneMapping = NoToneMapping;
273
- renderer.outputEncoding = LinearEncoding;
274
264
  renderer.autoClear = false;
275
265
 
276
266
  const backgroundMaterial = new MeshBasicMaterial( {
@@ -305,12 +295,12 @@ class PMREMGenerator {
305
295
  for ( let i = 0; i < 6; i ++ ) {
306
296
 
307
297
  const col = i % 3;
308
- if ( col == 0 ) {
298
+ if ( col === 0 ) {
309
299
 
310
300
  cubeCamera.up.set( 0, upSign[ i ], 0 );
311
301
  cubeCamera.lookAt( forwardSign[ i ], 0, 0 );
312
302
 
313
- } else if ( col == 1 ) {
303
+ } else if ( col === 1 ) {
314
304
 
315
305
  cubeCamera.up.set( 0, 0, upSign[ i ] );
316
306
  cubeCamera.lookAt( 0, forwardSign[ i ], 0 );
@@ -340,41 +330,30 @@ class PMREMGenerator {
340
330
  backgroundBox.material.dispose();
341
331
 
342
332
  renderer.toneMapping = toneMapping;
343
- renderer.outputEncoding = outputEncoding;
344
333
  renderer.autoClear = originalAutoClear;
345
334
  scene.background = background;
346
335
 
347
336
  }
348
337
 
349
- _setEncoding( uniform, texture ) {
350
-
351
- if ( this._renderer.capabilities.isWebGL2 === true && texture.format === RGBAFormat && texture.type === UnsignedByteType && texture.encoding === sRGBEncoding ) {
352
-
353
- uniform.value = ENCODINGS[ LinearEncoding ];
354
-
355
- } else {
356
-
357
- uniform.value = ENCODINGS[ texture.encoding ];
358
-
359
- }
360
-
361
- }
362
-
363
338
  _textureToCubeUV( texture, cubeUVRenderTarget ) {
364
339
 
365
340
  const renderer = this._renderer;
366
341
 
367
- if ( texture.isCubeTexture ) {
342
+ const isCubeTexture = ( texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping );
368
343
 
369
- if ( this._cubemapShader == null ) {
344
+ if ( isCubeTexture ) {
345
+
346
+ if ( this._cubemapShader === null ) {
370
347
 
371
348
  this._cubemapShader = _getCubemapShader();
372
349
 
373
350
  }
374
351
 
352
+ this._cubemapShader.uniforms.flipEnvMap.value = ( texture.isRenderTargetTexture === false ) ? - 1 : 1;
353
+
375
354
  } else {
376
355
 
377
- if ( this._equirectShader == null ) {
356
+ if ( this._equirectShader === null ) {
378
357
 
379
358
  this._equirectShader = _getEquirectShader();
380
359
 
@@ -382,22 +361,19 @@ class PMREMGenerator {
382
361
 
383
362
  }
384
363
 
385
- const material = texture.isCubeTexture ? this._cubemapShader : this._equirectShader;
364
+ const material = isCubeTexture ? this._cubemapShader : this._equirectShader;
386
365
  const mesh = new Mesh( _lodPlanes[ 0 ], material );
387
366
 
388
367
  const uniforms = material.uniforms;
389
368
 
390
369
  uniforms[ 'envMap' ].value = texture;
391
370
 
392
- if ( ! texture.isCubeTexture ) {
371
+ if ( ! isCubeTexture ) {
393
372
 
394
373
  uniforms[ 'texelSize' ].value.set( 1.0 / texture.image.width, 1.0 / texture.image.height );
395
374
 
396
375
  }
397
376
 
398
- this._setEncoding( uniforms[ 'inputEncoding' ], texture );
399
- this._setEncoding( uniforms[ 'outputEncoding' ], cubeUVRenderTarget.texture );
400
-
401
377
  _setViewport( cubeUVRenderTarget, 0, 0, 3 * SIZE_MAX, 2 * SIZE_MAX );
402
378
 
403
379
  renderer.setRenderTarget( cubeUVRenderTarget );
@@ -496,7 +472,7 @@ class PMREMGenerator {
496
472
  const weight = Math.exp( - x * x / 2 );
497
473
  weights.push( weight );
498
474
 
499
- if ( i == 0 ) {
475
+ if ( i === 0 ) {
500
476
 
501
477
  sum += weight;
502
478
 
@@ -528,9 +504,6 @@ class PMREMGenerator {
528
504
  blurUniforms[ 'dTheta' ].value = radiansPerPixel;
529
505
  blurUniforms[ 'mipInt' ].value = LOD_MAX - lodIn;
530
506
 
531
- this._setEncoding( blurUniforms[ 'inputEncoding' ], targetIn.texture );
532
- this._setEncoding( blurUniforms[ 'outputEncoding' ], targetIn.texture );
533
-
534
507
  const outputSize = _sizeLods[ lodOut ];
535
508
  const x = 3 * Math.max( 0, SIZE_MAX - 2 * outputSize );
536
509
  const y = ( lodOut === 0 ? 0 : 2 * SIZE_MAX ) + 2 * outputSize * ( lodOut > LOD_MAX - LOD_MIN ? lodOut - LOD_MAX + LOD_MIN : 0 );
@@ -543,14 +516,6 @@ class PMREMGenerator {
543
516
 
544
517
  }
545
518
 
546
- function _isLDR( texture ) {
547
-
548
- if ( texture === undefined || texture.type !== UnsignedByteType ) return false;
549
-
550
- return texture.encoding === LinearEncoding || texture.encoding === sRGBEncoding || texture.encoding === GammaEncoding;
551
-
552
- }
553
-
554
519
  function _createPlanes() {
555
520
 
556
521
  const _lodPlanes = [];
@@ -569,7 +534,7 @@ function _createPlanes() {
569
534
 
570
535
  sigma = EXTRA_LOD_SIGMA[ i - LOD_MAX + LOD_MIN - 1 ];
571
536
 
572
- } else if ( i == 0 ) {
537
+ } else if ( i === 0 ) {
573
538
 
574
539
  sigma = 0;
575
540
 
@@ -663,9 +628,7 @@ function _getBlurShader( maxSamples ) {
663
628
  'latitudinal': { value: false },
664
629
  'dTheta': { value: 0 },
665
630
  'mipInt': { value: 0 },
666
- 'poleAxis': { value: poleAxis },
667
- 'inputEncoding': { value: ENCODINGS[ LinearEncoding ] },
668
- 'outputEncoding': { value: ENCODINGS[ LinearEncoding ] }
631
+ 'poleAxis': { value: poleAxis }
669
632
  },
670
633
 
671
634
  vertexShader: _getCommonVertexShader(),
@@ -685,8 +648,6 @@ function _getBlurShader( maxSamples ) {
685
648
  uniform float mipInt;
686
649
  uniform vec3 poleAxis;
687
650
 
688
- ${ _getEncodings() }
689
-
690
651
  #define ENVMAP_TYPE_CUBE_UV
691
652
  #include <cube_uv_reflection_fragment>
692
653
 
@@ -731,8 +692,6 @@ function _getBlurShader( maxSamples ) {
731
692
 
732
693
  }
733
694
 
734
- gl_FragColor = linearToOutputTexel( gl_FragColor );
735
-
736
695
  }
737
696
  `,
738
697
 
@@ -755,9 +714,7 @@ function _getEquirectShader() {
755
714
 
756
715
  uniforms: {
757
716
  'envMap': { value: null },
758
- 'texelSize': { value: texelSize },
759
- 'inputEncoding': { value: ENCODINGS[ LinearEncoding ] },
760
- 'outputEncoding': { value: ENCODINGS[ LinearEncoding ] }
717
+ 'texelSize': { value: texelSize }
761
718
  },
762
719
 
763
720
  vertexShader: _getCommonVertexShader(),
@@ -772,8 +729,6 @@ function _getEquirectShader() {
772
729
  uniform sampler2D envMap;
773
730
  uniform vec2 texelSize;
774
731
 
775
- ${ _getEncodings() }
776
-
777
732
  #include <common>
778
733
 
779
734
  void main() {
@@ -785,20 +740,18 @@ function _getEquirectShader() {
785
740
 
786
741
  vec2 f = fract( uv / texelSize - 0.5 );
787
742
  uv -= f * texelSize;
788
- vec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
743
+ vec3 tl = texture2D ( envMap, uv ).rgb;
789
744
  uv.x += texelSize.x;
790
- vec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
745
+ vec3 tr = texture2D ( envMap, uv ).rgb;
791
746
  uv.y += texelSize.y;
792
- vec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
747
+ vec3 br = texture2D ( envMap, uv ).rgb;
793
748
  uv.x -= texelSize.x;
794
- vec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
749
+ vec3 bl = texture2D ( envMap, uv ).rgb;
795
750
 
796
751
  vec3 tm = mix( tl, tr, f.x );
797
752
  vec3 bm = mix( bl, br, f.x );
798
753
  gl_FragColor.rgb = mix( tm, bm, f.y );
799
754
 
800
- gl_FragColor = linearToOutputTexel( gl_FragColor );
801
-
802
755
  }
803
756
  `,
804
757
 
@@ -820,8 +773,7 @@ function _getCubemapShader() {
820
773
 
821
774
  uniforms: {
822
775
  'envMap': { value: null },
823
- 'inputEncoding': { value: ENCODINGS[ LinearEncoding ] },
824
- 'outputEncoding': { value: ENCODINGS[ LinearEncoding ] }
776
+ 'flipEnvMap': { value: - 1 }
825
777
  },
826
778
 
827
779
  vertexShader: _getCommonVertexShader(),
@@ -831,17 +783,15 @@ function _getCubemapShader() {
831
783
  precision mediump float;
832
784
  precision mediump int;
833
785
 
786
+ uniform float flipEnvMap;
787
+
834
788
  varying vec3 vOutputDirection;
835
789
 
836
790
  uniform samplerCube envMap;
837
791
 
838
- ${ _getEncodings() }
839
-
840
792
  void main() {
841
793
 
842
- gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
843
- gl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;
844
- gl_FragColor = linearToOutputTexel( gl_FragColor );
794
+ gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
845
795
 
846
796
  }
847
797
  `,
@@ -919,90 +869,4 @@ function _getCommonVertexShader() {
919
869
 
920
870
  }
921
871
 
922
- function _getEncodings() {
923
-
924
- return /* glsl */`
925
-
926
- uniform int inputEncoding;
927
- uniform int outputEncoding;
928
-
929
- #include <encodings_pars_fragment>
930
-
931
- vec4 inputTexelToLinear( vec4 value ) {
932
-
933
- if ( inputEncoding == 0 ) {
934
-
935
- return value;
936
-
937
- } else if ( inputEncoding == 1 ) {
938
-
939
- return sRGBToLinear( value );
940
-
941
- } else if ( inputEncoding == 2 ) {
942
-
943
- return RGBEToLinear( value );
944
-
945
- } else if ( inputEncoding == 3 ) {
946
-
947
- return RGBMToLinear( value, 7.0 );
948
-
949
- } else if ( inputEncoding == 4 ) {
950
-
951
- return RGBMToLinear( value, 16.0 );
952
-
953
- } else if ( inputEncoding == 5 ) {
954
-
955
- return RGBDToLinear( value, 256.0 );
956
-
957
- } else {
958
-
959
- return GammaToLinear( value, 2.2 );
960
-
961
- }
962
-
963
- }
964
-
965
- vec4 linearToOutputTexel( vec4 value ) {
966
-
967
- if ( outputEncoding == 0 ) {
968
-
969
- return value;
970
-
971
- } else if ( outputEncoding == 1 ) {
972
-
973
- return LinearTosRGB( value );
974
-
975
- } else if ( outputEncoding == 2 ) {
976
-
977
- return LinearToRGBE( value );
978
-
979
- } else if ( outputEncoding == 3 ) {
980
-
981
- return LinearToRGBM( value, 7.0 );
982
-
983
- } else if ( outputEncoding == 4 ) {
984
-
985
- return LinearToRGBM( value, 16.0 );
986
-
987
- } else if ( outputEncoding == 5 ) {
988
-
989
- return LinearToRGBD( value, 256.0 );
990
-
991
- } else {
992
-
993
- return LinearToGamma( value, 2.2 );
994
-
995
- }
996
-
997
- }
998
-
999
- vec4 envMapTexelToLinear( vec4 color ) {
1000
-
1001
- return inputTexelToLinear( color );
1002
-
1003
- }
1004
- `;
1005
-
1006
- }
1007
-
1008
872
  export { PMREMGenerator };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Bezier Curves formulas obtained from
3
- * http://en.wikipedia.org/wiki/Bézier_curve
3
+ * https://en.wikipedia.org/wiki/B%C3%A9zier_curve
4
4
  */
5
5
 
6
6
  function CatmullRom( t, p0, p1, p2, p3 ) {