super-three 0.184.0 → 0.185.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (366) hide show
  1. package/build/three.cjs +1260 -927
  2. package/build/three.core.js +1104 -829
  3. package/build/three.core.min.js +1 -1
  4. package/build/three.module.js +156 -98
  5. package/build/three.module.min.js +1 -1
  6. package/build/three.tsl.js +11 -4
  7. package/build/three.tsl.min.js +1 -1
  8. package/build/three.webgpu.js +7538 -3367
  9. package/build/three.webgpu.min.js +1 -1
  10. package/build/three.webgpu.nodes.js +7538 -3366
  11. package/build/three.webgpu.nodes.min.js +1 -1
  12. package/examples/jsm/Addons.js +3 -0
  13. package/examples/jsm/controls/ArcballControls.js +6 -2
  14. package/examples/jsm/controls/FirstPersonControls.js +79 -42
  15. package/examples/jsm/controls/TransformControls.js +68 -15
  16. package/examples/jsm/csm/CSMFrustum.js +31 -6
  17. package/examples/jsm/csm/CSMShadowNode.js +4 -1
  18. package/examples/jsm/effects/AsciiEffect.js +14 -1
  19. package/examples/jsm/exporters/DRACOExporter.js +27 -6
  20. package/examples/jsm/exporters/GLTFExporter.js +114 -12
  21. package/examples/jsm/exporters/PLYExporter.js +286 -73
  22. package/examples/jsm/exporters/USDZExporter.js +347 -112
  23. package/examples/jsm/generators/CityGenerator.js +346 -0
  24. package/examples/jsm/generators/ForestGenerator.js +347 -0
  25. package/examples/jsm/generators/TerrainGenerator.js +504 -0
  26. package/examples/jsm/generators/TreeGenerator.js +377 -0
  27. package/examples/jsm/generators/city/SidewalkGenerator.js +253 -0
  28. package/examples/jsm/generators/city/SkyscraperGenerator.js +1357 -0
  29. package/examples/jsm/geometries/LoftGeometry.js +355 -0
  30. package/examples/jsm/helpers/LightProbeGridHelper.js +1 -1
  31. package/examples/jsm/helpers/LightProbeHelper.js +5 -4
  32. package/examples/jsm/helpers/ViewHelper.js +16 -6
  33. package/examples/jsm/inspector/Inspector.js +53 -15
  34. package/examples/jsm/inspector/RendererInspector.js +152 -36
  35. package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.js +1 -1
  36. package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.js +1 -1
  37. package/examples/jsm/inspector/tabs/Console.js +200 -18
  38. package/examples/jsm/inspector/tabs/Memory.js +8 -0
  39. package/examples/jsm/inspector/tabs/Parameters.js +64 -4
  40. package/examples/jsm/inspector/tabs/Performance.js +21 -6
  41. package/examples/jsm/inspector/tabs/Settings.js +51 -9
  42. package/examples/jsm/inspector/tabs/Timeline.js +178 -93
  43. package/examples/jsm/inspector/tabs/Viewer.js +628 -16
  44. package/examples/jsm/inspector/ui/Graph.js +162 -25
  45. package/examples/jsm/inspector/ui/Item.js +92 -13
  46. package/examples/jsm/inspector/ui/List.js +1 -1
  47. package/examples/jsm/inspector/ui/Profiler.js +90 -45
  48. package/examples/jsm/inspector/ui/Style.js +1788 -1401
  49. package/examples/jsm/inspector/ui/Tab.js +5 -3
  50. package/examples/jsm/inspector/ui/Values.js +71 -6
  51. package/examples/jsm/inspector/ui/utils.js +130 -10
  52. package/examples/jsm/libs/basis/README.md +0 -1
  53. package/examples/jsm/libs/demuxer_mp4.js +3 -3
  54. package/examples/jsm/libs/draco/README.md +0 -1
  55. package/examples/jsm/libs/meshopt_clusterizer.module.js +421 -0
  56. package/examples/jsm/libs/meshopt_simplifier.module.js +627 -0
  57. package/examples/jsm/libs/mikktspace.module.js +34 -9
  58. package/examples/jsm/lighting/ClusteredLighting.js +55 -0
  59. package/examples/jsm/lighting/LightProbeGrid.js +106 -76
  60. package/examples/jsm/lines/LineMaterial.js +38 -15
  61. package/examples/jsm/lines/LineSegments2.js +8 -0
  62. package/examples/jsm/lines/webgpu/LineSegments2.js +8 -0
  63. package/examples/jsm/loaders/3DMLoader.js +1 -1
  64. package/examples/jsm/loaders/DRACOLoader.js +46 -13
  65. package/examples/jsm/loaders/EXRLoader.js +27 -55
  66. package/examples/jsm/loaders/HDRLoader.js +6 -28
  67. package/examples/jsm/loaders/KTX2Loader.js +31 -12
  68. package/examples/jsm/loaders/LDrawLoader.js +8 -8
  69. package/examples/jsm/loaders/LUT3dlLoader.js +2 -2
  70. package/examples/jsm/loaders/LUTCubeLoader.js +2 -2
  71. package/examples/jsm/loaders/LWOLoader.js +4 -0
  72. package/examples/jsm/loaders/LottieLoader.js +1 -1
  73. package/examples/jsm/loaders/MaterialXLoader.js +31 -9
  74. package/examples/jsm/loaders/NRRDLoader.js +3 -3
  75. package/examples/jsm/loaders/PCDLoader.js +7 -7
  76. package/examples/jsm/loaders/PLYLoader.js +218 -55
  77. package/examples/jsm/loaders/SVGLoader.js +547 -495
  78. package/examples/jsm/loaders/TTFLoader.js +1 -1
  79. package/examples/jsm/loaders/USDLoader.js +33 -9
  80. package/examples/jsm/loaders/VRMLLoader.js +1 -1
  81. package/examples/jsm/loaders/usd/USDAParser.js +93 -20
  82. package/examples/jsm/loaders/usd/USDCParser.js +1 -1
  83. package/examples/jsm/loaders/usd/USDComposer.js +52 -19
  84. package/examples/jsm/misc/TileCreasedNormalsPlugin.js +270 -0
  85. package/examples/jsm/misc/Volume.js +2 -2
  86. package/examples/jsm/objects/GroundedSkybox.js +1 -1
  87. package/examples/jsm/objects/Reflector.js +2 -3
  88. package/examples/jsm/objects/Water2Mesh.js +1 -1
  89. package/examples/jsm/physics/AmmoPhysics.js +15 -8
  90. package/examples/jsm/physics/RapierPhysics.js +27 -2
  91. package/examples/jsm/shaders/VolumeShader.js +31 -44
  92. package/examples/jsm/transpiler/GLSLDecoder.js +6 -6
  93. package/examples/jsm/transpiler/Linker.js +1 -1
  94. package/examples/jsm/tsl/display/BloomNode.js +59 -19
  95. package/examples/jsm/tsl/display/DepthOfFieldNode.js +2 -2
  96. package/examples/jsm/tsl/display/FXAANode.js +11 -12
  97. package/examples/jsm/tsl/display/GTAONode.js +34 -13
  98. package/examples/jsm/tsl/display/GodraysNode.js +1 -1
  99. package/examples/jsm/tsl/display/ImportanceSampledEnvironment.js +560 -0
  100. package/examples/jsm/tsl/display/PixelationPassNode.js +2 -2
  101. package/examples/jsm/tsl/display/RecurrentDenoiseNode.js +912 -0
  102. package/examples/jsm/tsl/display/SSAAPassNode.js +13 -25
  103. package/examples/jsm/tsl/display/SSGINode.js +89 -39
  104. package/examples/jsm/tsl/display/SSRNode.js +829 -132
  105. package/examples/jsm/tsl/display/SSSNode.js +2 -2
  106. package/examples/jsm/tsl/display/TemporalReprojectNode.js +1023 -0
  107. package/examples/jsm/tsl/lighting/ClusteredLightsNode.js +622 -0
  108. package/examples/jsm/tsl/lighting/DynamicLightsNode.js +1 -1
  109. package/examples/jsm/tsl/math/curlNoise.js +107 -0
  110. package/examples/jsm/tsl/shadows/TileShadowNode.js +1 -1
  111. package/examples/jsm/tsl/shadows/TileShadowNodeHelper.js +3 -3
  112. package/examples/jsm/tsl/utils/GroundedSkybox.js +62 -0
  113. package/examples/jsm/tsl/utils/RNoise.js +51 -0
  114. package/examples/jsm/tsl/utils/SpecularHelpers.js +325 -0
  115. package/examples/jsm/utils/BufferGeometryUtils.js +126 -59
  116. package/examples/jsm/utils/GeometryCompressionUtils.js +1 -1
  117. package/examples/jsm/utils/SceneOptimizer.js +1 -1
  118. package/examples/jsm/webxr/ARButton.js +1 -1
  119. package/examples/jsm/webxr/WebGLXRFallback.js +89 -0
  120. package/examples/jsm/webxr/XRControllerModelFactory.js +2 -2
  121. package/package.json +7 -7
  122. package/src/Three.TSL.js +10 -3
  123. package/src/Three.WebGPU.js +4 -0
  124. package/src/animation/AnimationAction.js +15 -11
  125. package/src/animation/AnimationClip.js +0 -139
  126. package/src/animation/KeyframeTrack.js +2 -2
  127. package/src/animation/PropertyBinding.js +2 -2
  128. package/src/cameras/Camera.js +2 -2
  129. package/src/cameras/StereoCamera.js +5 -2
  130. package/src/constants.js +1 -1
  131. package/src/core/BufferGeometry.js +29 -7
  132. package/src/core/Object3D.js +17 -7
  133. package/src/core/Raycaster.js +1 -1
  134. package/src/core/RenderTarget.js +15 -2
  135. package/src/extras/PMREMGenerator.js +6 -4
  136. package/src/extras/TextureUtils.js +1 -1
  137. package/src/extras/core/ShapePath.js +149 -160
  138. package/src/geometries/SphereGeometry.js +8 -3
  139. package/src/helpers/DirectionalLightHelper.js +2 -0
  140. package/src/helpers/HemisphereLightHelper.js +2 -0
  141. package/src/helpers/PointLightHelper.js +2 -0
  142. package/src/helpers/SpotLightHelper.js +1 -1
  143. package/src/loaders/DataTextureLoader.js +69 -38
  144. package/src/loaders/LoadingManager.js +5 -0
  145. package/src/loaders/MaterialLoader.js +36 -266
  146. package/src/loaders/ObjectLoader.js +3 -1
  147. package/src/materials/LineBasicMaterial.js +4 -0
  148. package/src/materials/Material.js +196 -1
  149. package/src/materials/MeshBasicMaterial.js +24 -0
  150. package/src/materials/MeshDepthMaterial.js +10 -0
  151. package/src/materials/MeshDistanceMaterial.js +10 -0
  152. package/src/materials/MeshLambertMaterial.js +40 -1
  153. package/src/materials/MeshMatcapMaterial.js +25 -1
  154. package/src/materials/MeshNormalMaterial.js +9 -1
  155. package/src/materials/MeshPhongMaterial.js +40 -1
  156. package/src/materials/MeshPhysicalMaterial.js +38 -0
  157. package/src/materials/MeshStandardMaterial.js +42 -1
  158. package/src/materials/MeshToonMaterial.js +34 -1
  159. package/src/materials/PointsMaterial.js +7 -0
  160. package/src/materials/ShaderMaterial.js +86 -0
  161. package/src/materials/SpriteMaterial.js +7 -0
  162. package/src/materials/nodes/Line2NodeMaterial.js +378 -322
  163. package/src/materials/nodes/MeshBasicNodeMaterial.js +2 -2
  164. package/src/materials/nodes/MeshNormalNodeMaterial.js +2 -2
  165. package/src/materials/nodes/MeshPhongNodeMaterial.js +0 -9
  166. package/src/materials/nodes/MeshPhysicalNodeMaterial.js +0 -30
  167. package/src/materials/nodes/MeshSSSNodeMaterial.js +0 -13
  168. package/src/materials/nodes/MeshStandardNodeMaterial.js +0 -11
  169. package/src/materials/nodes/NodeMaterial.js +115 -71
  170. package/src/materials/nodes/SpriteNodeMaterial.js +0 -10
  171. package/src/materials/nodes/manager/NodeMaterialObserver.js +49 -20
  172. package/src/math/Box3.js +5 -0
  173. package/src/math/FrustumArray.js +103 -133
  174. package/src/math/Interpolant.js +1 -1
  175. package/src/math/MathUtils.js +2 -2
  176. package/src/math/Matrix3.js +11 -0
  177. package/src/math/Matrix4.js +28 -3
  178. package/src/math/Vector2.js +2 -2
  179. package/src/math/Vector3.js +2 -2
  180. package/src/math/Vector4.js +2 -2
  181. package/src/math/interpolants/BezierInterpolant.js +4 -6
  182. package/src/nodes/Nodes.js +2 -5
  183. package/src/nodes/TSL.js +8 -6
  184. package/src/nodes/accessors/Arrays.js +4 -4
  185. package/src/nodes/accessors/Batch.js +108 -0
  186. package/src/nodes/accessors/Bitangent.js +2 -2
  187. package/src/nodes/accessors/BufferAttributeNode.js +13 -2
  188. package/src/nodes/accessors/Camera.js +7 -7
  189. package/src/nodes/accessors/ClippingNode.js +1 -1
  190. package/src/nodes/accessors/Instance.js +264 -0
  191. package/src/nodes/accessors/MaterialNode.js +18 -2
  192. package/src/nodes/accessors/MaterialProperties.js +4 -3
  193. package/src/nodes/accessors/{MorphNode.js → Morph.js} +99 -112
  194. package/src/nodes/accessors/Normal.js +13 -13
  195. package/src/nodes/accessors/Position.js +5 -1
  196. package/src/nodes/accessors/ReferenceNode.js +1 -0
  197. package/src/nodes/accessors/ReflectVector.js +3 -3
  198. package/src/nodes/accessors/SceneProperties.js +1 -1
  199. package/src/nodes/accessors/Skinning.js +263 -0
  200. package/src/nodes/accessors/StorageBufferNode.js +2 -2
  201. package/src/nodes/accessors/StorageTexture3DNode.js +100 -0
  202. package/src/nodes/accessors/StorageTextureNode.js +39 -7
  203. package/src/nodes/accessors/Tangent.js +4 -4
  204. package/src/nodes/accessors/TextureNode.js +60 -5
  205. package/src/nodes/code/FunctionNode.js +2 -16
  206. package/src/nodes/core/MRTNode.js +7 -2
  207. package/src/nodes/core/Node.js +39 -2
  208. package/src/nodes/core/NodeBuilder.js +201 -41
  209. package/src/nodes/core/NodeUtils.js +13 -13
  210. package/src/nodes/core/OutputStructNode.js +1 -1
  211. package/src/nodes/core/OverrideContextNode.js +153 -0
  212. package/src/nodes/core/PropertyNode.js +51 -5
  213. package/src/nodes/core/StackNode.js +56 -34
  214. package/src/nodes/core/StructNode.js +4 -6
  215. package/src/nodes/core/StructTypeNode.js +6 -6
  216. package/src/nodes/core/VarNode.js +8 -0
  217. package/src/nodes/core/VaryingNode.js +12 -2
  218. package/src/nodes/display/BlendModes.js +1 -41
  219. package/src/nodes/display/BumpMapNode.js +6 -1
  220. package/src/nodes/display/ColorAdjustment.js +10 -9
  221. package/src/nodes/display/FrontFacingNode.js +38 -9
  222. package/src/nodes/display/NormalMapNode.js +2 -2
  223. package/src/nodes/display/PassNode.js +35 -43
  224. package/src/nodes/display/PremultiplyAlphaFunctions.js +39 -0
  225. package/src/nodes/display/RenderOutputNode.js +12 -3
  226. package/src/nodes/functions/VolumetricLightingModel.js +40 -7
  227. package/src/nodes/gpgpu/WorkgroupInfoNode.js +1 -1
  228. package/src/nodes/lighting/EnvironmentNode.js +2 -2
  229. package/src/nodes/lighting/IESSpotLightNode.js +40 -2
  230. package/src/nodes/lighting/LightingContextNode.js +10 -2
  231. package/src/nodes/lighting/LightsNode.js +90 -37
  232. package/src/nodes/lighting/PointShadowNode.js +6 -1
  233. package/src/nodes/lighting/ShadowFilterNode.js +21 -52
  234. package/src/nodes/lighting/ShadowNode.js +34 -14
  235. package/src/nodes/materialx/lib/mx_noise.js +2 -2
  236. package/src/nodes/math/ConditionalNode.js +3 -3
  237. package/src/nodes/math/MathNode.js +39 -11
  238. package/src/nodes/math/OperatorNode.js +23 -23
  239. package/src/nodes/parsers/GLSLNodeFunction.js +1 -1
  240. package/src/nodes/pmrem/PMREMNode.js +33 -2
  241. package/src/nodes/tsl/TSLCore.js +63 -18
  242. package/src/nodes/utils/EquirectUV.js +30 -5
  243. package/src/nodes/utils/FunctionOverloadingNode.js +1 -1
  244. package/src/nodes/utils/Packing.js +35 -4
  245. package/src/nodes/utils/RTTNode.js +40 -24
  246. package/src/nodes/utils/ReflectorNode.js +1 -0
  247. package/src/nodes/utils/StorageArrayElementNode.js +1 -1
  248. package/src/objects/BatchedMesh.js +22 -14
  249. package/src/objects/InstancedMesh.js +0 -11
  250. package/src/objects/Skeleton.js +0 -9
  251. package/src/renderers/WebGLRenderer.js +19 -15
  252. package/src/renderers/common/Backend.js +49 -5
  253. package/src/renderers/common/Bindings.js +114 -45
  254. package/src/renderers/common/Buffer.js +9 -0
  255. package/src/renderers/common/ClippingContext.js +10 -2
  256. package/src/renderers/common/Info.js +63 -22
  257. package/src/renderers/common/Lighting.js +53 -5
  258. package/src/renderers/common/RenderList.js +41 -4
  259. package/src/renderers/common/RenderObject.js +73 -13
  260. package/src/renderers/common/Renderer.js +281 -108
  261. package/src/renderers/common/Sampler.js +16 -48
  262. package/src/renderers/common/Textures.js +32 -5
  263. package/src/renderers/common/TimestampQueryPool.js +1 -1
  264. package/src/renderers/common/UniformsGroup.js +31 -9
  265. package/src/renderers/common/XRManager.js +340 -22
  266. package/src/renderers/common/extras/PMREMGenerator.js +15 -38
  267. package/src/renderers/common/nodes/NodeBuilderState.js +9 -1
  268. package/src/renderers/common/nodes/NodeLibrary.js +4 -4
  269. package/src/renderers/common/nodes/NodeManager.js +63 -14
  270. package/src/renderers/common/nodes/NodeUniformBuffer.js +13 -0
  271. package/src/renderers/shaders/ShaderChunk/common.glsl.js +13 -4
  272. package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +0 -6
  273. package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +1 -1
  274. package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +2 -2
  275. package/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.js +1 -1
  276. package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +1 -1
  277. package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +1 -1
  278. package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +2 -2
  279. package/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.js +6 -0
  280. package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +1 -1
  281. package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
  282. package/src/renderers/shaders/ShaderLib/distance.glsl.js +1 -1
  283. package/src/renderers/webgl/WebGLOutput.js +2 -1
  284. package/src/renderers/webgl/WebGLProgram.js +5 -4
  285. package/src/renderers/webgl/WebGLPrograms.js +12 -5
  286. package/src/renderers/webgl/WebGLRenderLists.js +9 -1
  287. package/src/renderers/webgl/WebGLShaderCache.js +5 -11
  288. package/src/renderers/webgl/WebGLTextures.js +20 -7
  289. package/src/renderers/webgl/WebGLUniformsGroups.js +66 -38
  290. package/src/renderers/webgl-fallback/WebGLBackend.js +84 -25
  291. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +138 -8
  292. package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +1 -1
  293. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +52 -22
  294. package/src/renderers/webgl-fallback/utils/WebGLUtils.js +4 -2
  295. package/src/renderers/webgpu/WebGPUBackend.js +480 -169
  296. package/src/renderers/webgpu/descriptors/GPUBindGroupDescriptor.js +48 -0
  297. package/src/renderers/webgpu/descriptors/GPUBufferDescriptor.js +57 -0
  298. package/src/renderers/webgpu/descriptors/GPUCommandEncoderDescriptor.js +30 -0
  299. package/src/renderers/webgpu/descriptors/GPUComputePassDescriptor.js +38 -0
  300. package/src/renderers/webgpu/descriptors/GPUComputePipelineDescriptor.js +48 -0
  301. package/src/renderers/webgpu/descriptors/GPUCopyExternalImageDestInfo.js +47 -0
  302. package/src/renderers/webgpu/descriptors/GPUCopyExternalImageSourceInfo.js +50 -0
  303. package/src/renderers/webgpu/descriptors/GPUExtent3D.js +51 -0
  304. package/src/renderers/webgpu/descriptors/GPUPipelineLayoutDescriptor.js +39 -0
  305. package/src/renderers/webgpu/descriptors/GPUQuerySetDescriptor.js +47 -0
  306. package/src/renderers/webgpu/descriptors/GPURenderBundleEncoderDescriptor.js +74 -0
  307. package/src/renderers/webgpu/descriptors/GPURenderPassColorAttachment.js +72 -0
  308. package/src/renderers/webgpu/descriptors/GPURenderPassDepthStencilAttachment.js +99 -0
  309. package/src/renderers/webgpu/descriptors/GPURenderPassDescriptor.js +72 -0
  310. package/src/renderers/webgpu/descriptors/GPURenderPassTimestampWrites.js +49 -0
  311. package/src/renderers/webgpu/descriptors/GPURenderPipelineDescriptor.js +130 -0
  312. package/src/renderers/webgpu/descriptors/GPUSamplerDescriptor.js +119 -0
  313. package/src/renderers/webgpu/descriptors/GPUShaderModuleDescriptor.js +46 -0
  314. package/src/renderers/webgpu/descriptors/GPUTexelCopyBufferInfo.js +57 -0
  315. package/src/renderers/webgpu/descriptors/GPUTexelCopyBufferLayout.js +48 -0
  316. package/src/renderers/webgpu/descriptors/GPUTexelCopyTextureInfo.js +61 -0
  317. package/src/renderers/webgpu/descriptors/GPUTextureDescriptor.js +99 -0
  318. package/src/renderers/webgpu/descriptors/GPUTextureViewDescriptor.js +108 -0
  319. package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +0 -1
  320. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +164 -7
  321. package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +1 -1
  322. package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +98 -38
  323. package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +72 -68
  324. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +164 -69
  325. package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +158 -95
  326. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +297 -141
  327. package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +33 -18
  328. package/src/renderers/webgpu/utils/WebGPUUtils.js +38 -3
  329. package/src/textures/DepthTexture.js +1 -1
  330. package/src/textures/ExternalTexture.js +0 -3
  331. package/examples/fonts/LICENSE +0 -13
  332. package/examples/fonts/MPLUSRounded1c/MPLUSRounded1c-Regular.typeface.json.zip +0 -0
  333. package/examples/fonts/MPLUSRounded1c/OFL.txt +0 -91
  334. package/examples/fonts/README.md +0 -11
  335. package/examples/fonts/droid/NOTICE +0 -190
  336. package/examples/fonts/droid/README.txt +0 -18
  337. package/examples/fonts/droid/droid_sans_bold.typeface.json +0 -1
  338. package/examples/fonts/droid/droid_sans_mono_regular.typeface.json +0 -1
  339. package/examples/fonts/droid/droid_sans_regular.typeface.json +0 -1
  340. package/examples/fonts/droid/droid_serif_bold.typeface.json +0 -1
  341. package/examples/fonts/droid/droid_serif_regular.typeface.json +0 -1
  342. package/examples/fonts/gentilis_bold.typeface.json +0 -1
  343. package/examples/fonts/gentilis_regular.typeface.json +0 -1
  344. package/examples/fonts/helvetiker_bold.typeface.json +0 -1
  345. package/examples/fonts/helvetiker_regular.typeface.json +0 -1
  346. package/examples/fonts/optimer_bold.typeface.json +0 -1
  347. package/examples/fonts/optimer_regular.typeface.json +0 -1
  348. package/examples/fonts/ttf/README.md +0 -9
  349. package/examples/fonts/ttf/kenpixel.ttf +0 -0
  350. package/examples/jsm/inspector/extensions/extensions.json +0 -6
  351. package/examples/jsm/libs/ammo.wasm.js +0 -822
  352. package/examples/jsm/libs/ammo.wasm.wasm +0 -0
  353. package/examples/jsm/libs/draco/draco_encoder.js +0 -33
  354. package/examples/jsm/libs/draco/gltf/draco_encoder.js +0 -33
  355. package/examples/jsm/libs/lottie_canvas.module.js +0 -14849
  356. package/examples/jsm/libs/opentype.module.js +0 -14506
  357. package/examples/jsm/libs/rhino3dm/rhino3dm.js +0 -21
  358. package/examples/jsm/libs/rhino3dm/rhino3dm.module.js +0 -16
  359. package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
  360. package/examples/jsm/lighting/TiledLighting.js +0 -42
  361. package/examples/jsm/tsl/display/AnamorphicNode.js +0 -293
  362. package/examples/jsm/tsl/lighting/TiledLightsNode.js +0 -442
  363. package/src/nodes/accessors/BatchNode.js +0 -163
  364. package/src/nodes/accessors/InstanceNode.js +0 -349
  365. package/src/nodes/accessors/InstancedMeshNode.js +0 -50
  366. package/src/nodes/accessors/SkinningNode.js +0 -328
@@ -1,9 +1,3 @@
1
- import { Color } from '../math/Color.js';
2
- import { Vector2 } from '../math/Vector2.js';
3
- import { Vector3 } from '../math/Vector3.js';
4
- import { Vector4 } from '../math/Vector4.js';
5
- import { Matrix3 } from '../math/Matrix3.js';
6
- import { Matrix4 } from '../math/Matrix4.js';
7
1
  import { FileLoader } from './FileLoader.js';
8
2
  import { Loader } from './Loader.js';
9
3
  import {
@@ -26,7 +20,9 @@ import {
26
20
  LineBasicMaterial,
27
21
  Material,
28
22
  } from '../materials/Materials.js';
29
- import { error, warn } from '../utils.js';
23
+ import { error, warnOnce } from '../utils.js';
24
+
25
+ const _customMaterials = {};
30
26
 
31
27
  /**
32
28
  * Class for loading materials. The files are internally
@@ -110,265 +106,9 @@ class MaterialLoader extends Loader {
110
106
  */
111
107
  parse( json ) {
112
108
 
113
- const textures = this.textures;
114
-
115
- function getTexture( name ) {
116
-
117
- if ( textures[ name ] === undefined ) {
118
-
119
- warn( 'MaterialLoader: Undefined texture', name );
120
-
121
- }
122
-
123
- return textures[ name ];
124
-
125
- }
126
-
127
109
  const material = this.createMaterialFromType( json.type );
128
110
 
129
- if ( json.uuid !== undefined ) material.uuid = json.uuid;
130
- if ( json.name !== undefined ) material.name = json.name;
131
- if ( json.color !== undefined && material.color !== undefined ) material.color.setHex( json.color );
132
- if ( json.roughness !== undefined ) material.roughness = json.roughness;
133
- if ( json.metalness !== undefined ) material.metalness = json.metalness;
134
- if ( json.sheen !== undefined ) material.sheen = json.sheen;
135
- if ( json.sheenColor !== undefined ) material.sheenColor = new Color().setHex( json.sheenColor );
136
- if ( json.sheenRoughness !== undefined ) material.sheenRoughness = json.sheenRoughness;
137
- if ( json.emissive !== undefined && material.emissive !== undefined ) material.emissive.setHex( json.emissive );
138
- if ( json.specular !== undefined && material.specular !== undefined ) material.specular.setHex( json.specular );
139
- if ( json.specularIntensity !== undefined ) material.specularIntensity = json.specularIntensity;
140
- if ( json.specularColor !== undefined && material.specularColor !== undefined ) material.specularColor.setHex( json.specularColor );
141
- if ( json.shininess !== undefined ) material.shininess = json.shininess;
142
- if ( json.clearcoat !== undefined ) material.clearcoat = json.clearcoat;
143
- if ( json.clearcoatRoughness !== undefined ) material.clearcoatRoughness = json.clearcoatRoughness;
144
- if ( json.dispersion !== undefined ) material.dispersion = json.dispersion;
145
- if ( json.iridescence !== undefined ) material.iridescence = json.iridescence;
146
- if ( json.iridescenceIOR !== undefined ) material.iridescenceIOR = json.iridescenceIOR;
147
- if ( json.iridescenceThicknessRange !== undefined ) material.iridescenceThicknessRange = json.iridescenceThicknessRange;
148
- if ( json.transmission !== undefined ) material.transmission = json.transmission;
149
- if ( json.thickness !== undefined ) material.thickness = json.thickness;
150
- if ( json.attenuationDistance !== undefined ) material.attenuationDistance = json.attenuationDistance;
151
- if ( json.attenuationColor !== undefined && material.attenuationColor !== undefined ) material.attenuationColor.setHex( json.attenuationColor );
152
- if ( json.anisotropy !== undefined ) material.anisotropy = json.anisotropy;
153
- if ( json.anisotropyRotation !== undefined ) material.anisotropyRotation = json.anisotropyRotation;
154
- if ( json.fog !== undefined ) material.fog = json.fog;
155
- if ( json.flatShading !== undefined ) material.flatShading = json.flatShading;
156
- if ( json.blending !== undefined ) material.blending = json.blending;
157
- if ( json.combine !== undefined ) material.combine = json.combine;
158
- if ( json.side !== undefined ) material.side = json.side;
159
- if ( json.shadowSide !== undefined ) material.shadowSide = json.shadowSide;
160
- if ( json.opacity !== undefined ) material.opacity = json.opacity;
161
- if ( json.transparent !== undefined ) material.transparent = json.transparent;
162
- if ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest;
163
- if ( json.alphaHash !== undefined ) material.alphaHash = json.alphaHash;
164
- if ( json.depthFunc !== undefined ) material.depthFunc = json.depthFunc;
165
- if ( json.depthTest !== undefined ) material.depthTest = json.depthTest;
166
- if ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite;
167
- if ( json.colorWrite !== undefined ) material.colorWrite = json.colorWrite;
168
- if ( json.blendSrc !== undefined ) material.blendSrc = json.blendSrc;
169
- if ( json.blendDst !== undefined ) material.blendDst = json.blendDst;
170
- if ( json.blendEquation !== undefined ) material.blendEquation = json.blendEquation;
171
- if ( json.blendSrcAlpha !== undefined ) material.blendSrcAlpha = json.blendSrcAlpha;
172
- if ( json.blendDstAlpha !== undefined ) material.blendDstAlpha = json.blendDstAlpha;
173
- if ( json.blendEquationAlpha !== undefined ) material.blendEquationAlpha = json.blendEquationAlpha;
174
- if ( json.blendColor !== undefined && material.blendColor !== undefined ) material.blendColor.setHex( json.blendColor );
175
- if ( json.blendAlpha !== undefined ) material.blendAlpha = json.blendAlpha;
176
- if ( json.stencilWriteMask !== undefined ) material.stencilWriteMask = json.stencilWriteMask;
177
- if ( json.stencilFunc !== undefined ) material.stencilFunc = json.stencilFunc;
178
- if ( json.stencilRef !== undefined ) material.stencilRef = json.stencilRef;
179
- if ( json.stencilFuncMask !== undefined ) material.stencilFuncMask = json.stencilFuncMask;
180
- if ( json.stencilFail !== undefined ) material.stencilFail = json.stencilFail;
181
- if ( json.stencilZFail !== undefined ) material.stencilZFail = json.stencilZFail;
182
- if ( json.stencilZPass !== undefined ) material.stencilZPass = json.stencilZPass;
183
- if ( json.stencilWrite !== undefined ) material.stencilWrite = json.stencilWrite;
184
-
185
- if ( json.wireframe !== undefined ) material.wireframe = json.wireframe;
186
- if ( json.wireframeLinewidth !== undefined ) material.wireframeLinewidth = json.wireframeLinewidth;
187
- if ( json.wireframeLinecap !== undefined ) material.wireframeLinecap = json.wireframeLinecap;
188
- if ( json.wireframeLinejoin !== undefined ) material.wireframeLinejoin = json.wireframeLinejoin;
189
-
190
- if ( json.rotation !== undefined ) material.rotation = json.rotation;
191
-
192
- if ( json.linewidth !== undefined ) material.linewidth = json.linewidth;
193
- if ( json.dashSize !== undefined ) material.dashSize = json.dashSize;
194
- if ( json.gapSize !== undefined ) material.gapSize = json.gapSize;
195
- if ( json.scale !== undefined ) material.scale = json.scale;
196
-
197
- if ( json.polygonOffset !== undefined ) material.polygonOffset = json.polygonOffset;
198
- if ( json.polygonOffsetFactor !== undefined ) material.polygonOffsetFactor = json.polygonOffsetFactor;
199
- if ( json.polygonOffsetUnits !== undefined ) material.polygonOffsetUnits = json.polygonOffsetUnits;
200
-
201
- if ( json.dithering !== undefined ) material.dithering = json.dithering;
202
-
203
- if ( json.alphaToCoverage !== undefined ) material.alphaToCoverage = json.alphaToCoverage;
204
- if ( json.premultipliedAlpha !== undefined ) material.premultipliedAlpha = json.premultipliedAlpha;
205
- if ( json.forceSinglePass !== undefined ) material.forceSinglePass = json.forceSinglePass;
206
- if ( json.allowOverride !== undefined ) material.allowOverride = json.allowOverride;
207
-
208
- if ( json.visible !== undefined ) material.visible = json.visible;
209
-
210
- if ( json.toneMapped !== undefined ) material.toneMapped = json.toneMapped;
211
-
212
- if ( json.userData !== undefined ) material.userData = json.userData;
213
-
214
- if ( json.vertexColors !== undefined ) {
215
-
216
- if ( typeof json.vertexColors === 'number' ) {
217
-
218
- material.vertexColors = json.vertexColors > 0;
219
-
220
- } else {
221
-
222
- material.vertexColors = json.vertexColors;
223
-
224
- }
225
-
226
- }
227
-
228
- // Shader Material
229
-
230
- if ( json.uniforms !== undefined ) {
231
-
232
- for ( const name in json.uniforms ) {
233
-
234
- const uniform = json.uniforms[ name ];
235
-
236
- material.uniforms[ name ] = {};
237
-
238
- switch ( uniform.type ) {
239
-
240
- case 't':
241
- material.uniforms[ name ].value = getTexture( uniform.value );
242
- break;
243
-
244
- case 'c':
245
- material.uniforms[ name ].value = new Color().setHex( uniform.value );
246
- break;
247
-
248
- case 'v2':
249
- material.uniforms[ name ].value = new Vector2().fromArray( uniform.value );
250
- break;
251
-
252
- case 'v3':
253
- material.uniforms[ name ].value = new Vector3().fromArray( uniform.value );
254
- break;
255
-
256
- case 'v4':
257
- material.uniforms[ name ].value = new Vector4().fromArray( uniform.value );
258
- break;
259
-
260
- case 'm3':
261
- material.uniforms[ name ].value = new Matrix3().fromArray( uniform.value );
262
- break;
263
-
264
- case 'm4':
265
- material.uniforms[ name ].value = new Matrix4().fromArray( uniform.value );
266
- break;
267
-
268
- default:
269
- material.uniforms[ name ].value = uniform.value;
270
-
271
- }
272
-
273
- }
274
-
275
- }
276
-
277
- if ( json.defines !== undefined ) material.defines = json.defines;
278
- if ( json.vertexShader !== undefined ) material.vertexShader = json.vertexShader;
279
- if ( json.fragmentShader !== undefined ) material.fragmentShader = json.fragmentShader;
280
- if ( json.glslVersion !== undefined ) material.glslVersion = json.glslVersion;
281
-
282
- if ( json.extensions !== undefined ) {
283
-
284
- for ( const key in json.extensions ) {
285
-
286
- material.extensions[ key ] = json.extensions[ key ];
287
-
288
- }
289
-
290
- }
291
-
292
- if ( json.lights !== undefined ) material.lights = json.lights;
293
- if ( json.clipping !== undefined ) material.clipping = json.clipping;
294
-
295
- // for PointsMaterial
296
-
297
- if ( json.size !== undefined ) material.size = json.size;
298
- if ( json.sizeAttenuation !== undefined ) material.sizeAttenuation = json.sizeAttenuation;
299
-
300
- // maps
301
-
302
- if ( json.map !== undefined ) material.map = getTexture( json.map );
303
- if ( json.matcap !== undefined ) material.matcap = getTexture( json.matcap );
304
-
305
- if ( json.alphaMap !== undefined ) material.alphaMap = getTexture( json.alphaMap );
306
-
307
- if ( json.bumpMap !== undefined ) material.bumpMap = getTexture( json.bumpMap );
308
- if ( json.bumpScale !== undefined ) material.bumpScale = json.bumpScale;
309
-
310
- if ( json.normalMap !== undefined ) material.normalMap = getTexture( json.normalMap );
311
- if ( json.normalMapType !== undefined ) material.normalMapType = json.normalMapType;
312
- if ( json.normalScale !== undefined ) {
313
-
314
- let normalScale = json.normalScale;
315
-
316
- if ( Array.isArray( normalScale ) === false ) {
317
-
318
- // Blender exporter used to export a scalar. See #7459
319
-
320
- normalScale = [ normalScale, normalScale ];
321
-
322
- }
323
-
324
- material.normalScale = new Vector2().fromArray( normalScale );
325
-
326
- }
327
-
328
- if ( json.displacementMap !== undefined ) material.displacementMap = getTexture( json.displacementMap );
329
- if ( json.displacementScale !== undefined ) material.displacementScale = json.displacementScale;
330
- if ( json.displacementBias !== undefined ) material.displacementBias = json.displacementBias;
331
-
332
- if ( json.roughnessMap !== undefined ) material.roughnessMap = getTexture( json.roughnessMap );
333
- if ( json.metalnessMap !== undefined ) material.metalnessMap = getTexture( json.metalnessMap );
334
-
335
- if ( json.emissiveMap !== undefined ) material.emissiveMap = getTexture( json.emissiveMap );
336
- if ( json.emissiveIntensity !== undefined ) material.emissiveIntensity = json.emissiveIntensity;
337
-
338
- if ( json.specularMap !== undefined ) material.specularMap = getTexture( json.specularMap );
339
- if ( json.specularIntensityMap !== undefined ) material.specularIntensityMap = getTexture( json.specularIntensityMap );
340
- if ( json.specularColorMap !== undefined ) material.specularColorMap = getTexture( json.specularColorMap );
341
-
342
- if ( json.envMap !== undefined ) material.envMap = getTexture( json.envMap );
343
- if ( json.envMapRotation !== undefined ) material.envMapRotation.fromArray( json.envMapRotation );
344
- if ( json.envMapIntensity !== undefined ) material.envMapIntensity = json.envMapIntensity;
345
-
346
- if ( json.reflectivity !== undefined ) material.reflectivity = json.reflectivity;
347
- if ( json.refractionRatio !== undefined ) material.refractionRatio = json.refractionRatio;
348
-
349
- if ( json.lightMap !== undefined ) material.lightMap = getTexture( json.lightMap );
350
- if ( json.lightMapIntensity !== undefined ) material.lightMapIntensity = json.lightMapIntensity;
351
-
352
- if ( json.aoMap !== undefined ) material.aoMap = getTexture( json.aoMap );
353
- if ( json.aoMapIntensity !== undefined ) material.aoMapIntensity = json.aoMapIntensity;
354
-
355
- if ( json.gradientMap !== undefined ) material.gradientMap = getTexture( json.gradientMap );
356
-
357
- if ( json.clearcoatMap !== undefined ) material.clearcoatMap = getTexture( json.clearcoatMap );
358
- if ( json.clearcoatRoughnessMap !== undefined ) material.clearcoatRoughnessMap = getTexture( json.clearcoatRoughnessMap );
359
- if ( json.clearcoatNormalMap !== undefined ) material.clearcoatNormalMap = getTexture( json.clearcoatNormalMap );
360
- if ( json.clearcoatNormalScale !== undefined ) material.clearcoatNormalScale = new Vector2().fromArray( json.clearcoatNormalScale );
361
-
362
- if ( json.iridescenceMap !== undefined ) material.iridescenceMap = getTexture( json.iridescenceMap );
363
- if ( json.iridescenceThicknessMap !== undefined ) material.iridescenceThicknessMap = getTexture( json.iridescenceThicknessMap );
364
-
365
- if ( json.transmissionMap !== undefined ) material.transmissionMap = getTexture( json.transmissionMap );
366
- if ( json.thicknessMap !== undefined ) material.thicknessMap = getTexture( json.thicknessMap );
367
-
368
- if ( json.anisotropyMap !== undefined ) material.anisotropyMap = getTexture( json.anisotropyMap );
369
-
370
- if ( json.sheenColorMap !== undefined ) material.sheenColorMap = getTexture( json.sheenColorMap );
371
- if ( json.sheenRoughnessMap !== undefined ) material.sheenRoughnessMap = getTexture( json.sheenRoughnessMap );
111
+ material.fromJSON( json, this.textures );
372
112
 
373
113
  return material;
374
114
 
@@ -427,10 +167,40 @@ class MaterialLoader extends Loader {
427
167
  MeshMatcapMaterial,
428
168
  LineDashedMaterial,
429
169
  LineBasicMaterial,
430
- Material
170
+ Material,
171
+ ... _customMaterials
431
172
  };
432
173
 
433
- return new materialLib[ type ]();
174
+ const MaterialType = materialLib[ type ];
175
+
176
+ let materialInstance;
177
+
178
+ if ( MaterialType === undefined ) {
179
+
180
+ warnOnce( `MaterialLoader: Unknown material type "${ type }". Use .registerMaterial() before starting the deserialization process.` );
181
+ materialInstance = new Material();
182
+
183
+ } else {
184
+
185
+ materialInstance = new MaterialType();
186
+
187
+ }
188
+
189
+ return materialInstance;
190
+
191
+ }
192
+
193
+ /**
194
+ * Registers the given material at the internal
195
+ * material library.
196
+ *
197
+ * @static
198
+ * @param {string} type - The material type.
199
+ * @param {Material.constructor} materialClass - The material class.
200
+ */
201
+ static registerMaterial( type, materialClass ) {
202
+
203
+ _customMaterials[ type ] = materialClass;
434
204
 
435
205
  }
436
206
 
@@ -180,7 +180,7 @@ class ObjectLoader extends Loader {
180
180
 
181
181
  } catch ( e ) {
182
182
 
183
- throw new Error( 'ObjectLoader: Can\'t parse ' + url + '. ' + e.message );
183
+ throw new Error( 'THREE.ObjectLoader: Can\'t parse ' + url + '. ' + e.message );
184
184
 
185
185
  }
186
186
 
@@ -474,6 +474,8 @@ class ObjectLoader extends Loader {
474
474
 
475
475
  function loadImage( url ) {
476
476
 
477
+ url = scope.manager.resolveURL( url );
478
+
477
479
  scope.manager.itemStart( url );
478
480
 
479
481
  return loader.load( url, function () {
@@ -50,6 +50,10 @@ class LineBasicMaterial extends Material {
50
50
  * Sets the color of the lines using data from a texture. The texture map
51
51
  * color is modulated by the diffuse `color`.
52
52
  *
53
+ * `map` represents color data, and the texture must be assigned a
54
+ * {@link Texture#colorSpace}. Most `map` textures set
55
+ * `texture.colorSpace = SRGBColorSpace`.
56
+ *
53
57
  * @type {?Texture}
54
58
  * @default null
55
59
  */
@@ -3,6 +3,7 @@ import { EventDispatcher } from '../core/EventDispatcher.js';
3
3
  import { FrontSide, NormalBlending, LessEqualDepth, AddEquation, OneMinusSrcAlphaFactor, SrcAlphaFactor, AlwaysStencilFunc, KeepStencilOp } from '../constants.js';
4
4
  import { generateUUID } from '../math/MathUtils.js';
5
5
  import { warn } from '../utils.js';
6
+ import { Vector2 } from '../math/Vector2.js';
6
7
 
7
8
  let _materialId = 0;
8
9
 
@@ -580,7 +581,11 @@ class Material extends EventDispatcher {
580
581
 
581
582
  currentValue.set( newValue );
582
583
 
583
- } else if ( ( currentValue && currentValue.isVector3 ) && ( newValue && newValue.isVector3 ) ) {
584
+ } else if (
585
+ ( ( currentValue && currentValue.isVector2 ) && ( newValue && newValue.isVector2 ) ) ||
586
+ ( ( currentValue && currentValue.isEuler ) && ( newValue && newValue.isEuler ) ) ||
587
+ ( ( currentValue && currentValue.isVector3 ) && ( newValue && newValue.isVector3 ) )
588
+ ) {
584
589
 
585
590
  currentValue.copy( newValue );
586
591
 
@@ -881,6 +886,196 @@ class Material extends EventDispatcher {
881
886
 
882
887
  }
883
888
 
889
+ /**
890
+ * Deserializes the material from the given JSON.
891
+ *
892
+ * @param {Object} json - The JSON holding the serialized material.
893
+ * @param {Object<string,Texture>} textures - A dictionary holding textures referenced by the material.
894
+ * @return {Material} A reference to this material.
895
+ */
896
+ fromJSON( json, textures ) {
897
+
898
+ if ( json.uuid !== undefined ) this.uuid = json.uuid;
899
+ if ( json.name !== undefined ) this.name = json.name;
900
+ if ( json.color !== undefined && this.color !== undefined ) this.color.setHex( json.color );
901
+ if ( json.roughness !== undefined ) this.roughness = json.roughness;
902
+ if ( json.metalness !== undefined ) this.metalness = json.metalness;
903
+ if ( json.sheen !== undefined ) this.sheen = json.sheen;
904
+ if ( json.sheenColor !== undefined ) this.sheenColor = new Color().setHex( json.sheenColor );
905
+ if ( json.sheenRoughness !== undefined ) this.sheenRoughness = json.sheenRoughness;
906
+ if ( json.emissive !== undefined && this.emissive !== undefined ) this.emissive.setHex( json.emissive );
907
+ if ( json.specular !== undefined && this.specular !== undefined ) this.specular.setHex( json.specular );
908
+ if ( json.specularIntensity !== undefined ) this.specularIntensity = json.specularIntensity;
909
+ if ( json.specularColor !== undefined && this.specularColor !== undefined ) this.specularColor.setHex( json.specularColor );
910
+ if ( json.shininess !== undefined ) this.shininess = json.shininess;
911
+ if ( json.clearcoat !== undefined ) this.clearcoat = json.clearcoat;
912
+ if ( json.clearcoatRoughness !== undefined ) this.clearcoatRoughness = json.clearcoatRoughness;
913
+ if ( json.dispersion !== undefined ) this.dispersion = json.dispersion;
914
+ if ( json.iridescence !== undefined ) this.iridescence = json.iridescence;
915
+ if ( json.iridescenceIOR !== undefined ) this.iridescenceIOR = json.iridescenceIOR;
916
+ if ( json.iridescenceThicknessRange !== undefined ) this.iridescenceThicknessRange = json.iridescenceThicknessRange;
917
+ if ( json.transmission !== undefined ) this.transmission = json.transmission;
918
+ if ( json.thickness !== undefined ) this.thickness = json.thickness;
919
+ if ( json.attenuationDistance !== undefined ) this.attenuationDistance = json.attenuationDistance;
920
+ if ( json.attenuationColor !== undefined && this.attenuationColor !== undefined ) this.attenuationColor.setHex( json.attenuationColor );
921
+ if ( json.anisotropy !== undefined ) this.anisotropy = json.anisotropy;
922
+ if ( json.anisotropyRotation !== undefined ) this.anisotropyRotation = json.anisotropyRotation;
923
+ if ( json.fog !== undefined ) this.fog = json.fog;
924
+ if ( json.flatShading !== undefined ) this.flatShading = json.flatShading;
925
+ if ( json.blending !== undefined ) this.blending = json.blending;
926
+ if ( json.combine !== undefined ) this.combine = json.combine;
927
+ if ( json.side !== undefined ) this.side = json.side;
928
+ if ( json.shadowSide !== undefined ) this.shadowSide = json.shadowSide;
929
+ if ( json.opacity !== undefined ) this.opacity = json.opacity;
930
+ if ( json.transparent !== undefined ) this.transparent = json.transparent;
931
+ if ( json.alphaTest !== undefined ) this.alphaTest = json.alphaTest;
932
+ if ( json.alphaHash !== undefined ) this.alphaHash = json.alphaHash;
933
+ if ( json.depthFunc !== undefined ) this.depthFunc = json.depthFunc;
934
+ if ( json.depthTest !== undefined ) this.depthTest = json.depthTest;
935
+ if ( json.depthWrite !== undefined ) this.depthWrite = json.depthWrite;
936
+ if ( json.colorWrite !== undefined ) this.colorWrite = json.colorWrite;
937
+ if ( json.blendSrc !== undefined ) this.blendSrc = json.blendSrc;
938
+ if ( json.blendDst !== undefined ) this.blendDst = json.blendDst;
939
+ if ( json.blendEquation !== undefined ) this.blendEquation = json.blendEquation;
940
+ if ( json.blendSrcAlpha !== undefined ) this.blendSrcAlpha = json.blendSrcAlpha;
941
+ if ( json.blendDstAlpha !== undefined ) this.blendDstAlpha = json.blendDstAlpha;
942
+ if ( json.blendEquationAlpha !== undefined ) this.blendEquationAlpha = json.blendEquationAlpha;
943
+ if ( json.blendColor !== undefined && this.blendColor !== undefined ) this.blendColor.setHex( json.blendColor );
944
+ if ( json.blendAlpha !== undefined ) this.blendAlpha = json.blendAlpha;
945
+ if ( json.stencilWriteMask !== undefined ) this.stencilWriteMask = json.stencilWriteMask;
946
+ if ( json.stencilFunc !== undefined ) this.stencilFunc = json.stencilFunc;
947
+ if ( json.stencilRef !== undefined ) this.stencilRef = json.stencilRef;
948
+ if ( json.stencilFuncMask !== undefined ) this.stencilFuncMask = json.stencilFuncMask;
949
+ if ( json.stencilFail !== undefined ) this.stencilFail = json.stencilFail;
950
+ if ( json.stencilZFail !== undefined ) this.stencilZFail = json.stencilZFail;
951
+ if ( json.stencilZPass !== undefined ) this.stencilZPass = json.stencilZPass;
952
+ if ( json.stencilWrite !== undefined ) this.stencilWrite = json.stencilWrite;
953
+
954
+ if ( json.wireframe !== undefined ) this.wireframe = json.wireframe;
955
+ if ( json.wireframeLinewidth !== undefined ) this.wireframeLinewidth = json.wireframeLinewidth;
956
+ if ( json.wireframeLinecap !== undefined ) this.wireframeLinecap = json.wireframeLinecap;
957
+ if ( json.wireframeLinejoin !== undefined ) this.wireframeLinejoin = json.wireframeLinejoin;
958
+
959
+ if ( json.rotation !== undefined ) this.rotation = json.rotation;
960
+
961
+ if ( json.linewidth !== undefined ) this.linewidth = json.linewidth;
962
+ if ( json.dashSize !== undefined ) this.dashSize = json.dashSize;
963
+ if ( json.gapSize !== undefined ) this.gapSize = json.gapSize;
964
+ if ( json.scale !== undefined ) this.scale = json.scale;
965
+
966
+ if ( json.polygonOffset !== undefined ) this.polygonOffset = json.polygonOffset;
967
+ if ( json.polygonOffsetFactor !== undefined ) this.polygonOffsetFactor = json.polygonOffsetFactor;
968
+ if ( json.polygonOffsetUnits !== undefined ) this.polygonOffsetUnits = json.polygonOffsetUnits;
969
+
970
+ if ( json.dithering !== undefined ) this.dithering = json.dithering;
971
+
972
+ if ( json.alphaToCoverage !== undefined ) this.alphaToCoverage = json.alphaToCoverage;
973
+ if ( json.premultipliedAlpha !== undefined ) this.premultipliedAlpha = json.premultipliedAlpha;
974
+ if ( json.forceSinglePass !== undefined ) this.forceSinglePass = json.forceSinglePass;
975
+ if ( json.allowOverride !== undefined ) this.allowOverride = json.allowOverride;
976
+
977
+ if ( json.visible !== undefined ) this.visible = json.visible;
978
+
979
+ if ( json.toneMapped !== undefined ) this.toneMapped = json.toneMapped;
980
+
981
+ if ( json.userData !== undefined ) this.userData = json.userData;
982
+
983
+ if ( json.vertexColors !== undefined ) {
984
+
985
+ if ( typeof json.vertexColors === 'number' ) {
986
+
987
+ this.vertexColors = json.vertexColors > 0;
988
+
989
+ } else {
990
+
991
+ this.vertexColors = json.vertexColors;
992
+
993
+ }
994
+
995
+ }
996
+
997
+ // for PointsMaterial
998
+
999
+ if ( json.size !== undefined ) this.size = json.size;
1000
+ if ( json.sizeAttenuation !== undefined ) this.sizeAttenuation = json.sizeAttenuation;
1001
+
1002
+ // maps
1003
+
1004
+ if ( json.map !== undefined ) this.map = textures[ json.map ] || null;
1005
+ if ( json.matcap !== undefined ) this.matcap = textures[ json.matcap ] || null;
1006
+
1007
+ if ( json.alphaMap !== undefined ) this.alphaMap = textures[ json.alphaMap ] || null;
1008
+
1009
+ if ( json.bumpMap !== undefined ) this.bumpMap = textures[ json.bumpMap ] || null;
1010
+ if ( json.bumpScale !== undefined ) this.bumpScale = json.bumpScale;
1011
+
1012
+ if ( json.normalMap !== undefined ) this.normalMap = textures[ json.normalMap ] || null;
1013
+ if ( json.normalMapType !== undefined ) this.normalMapType = json.normalMapType;
1014
+ if ( json.normalScale !== undefined ) {
1015
+
1016
+ let normalScale = json.normalScale;
1017
+
1018
+ if ( Array.isArray( normalScale ) === false ) {
1019
+
1020
+ // Blender exporter used to export a scalar. See #7459
1021
+
1022
+ normalScale = [ normalScale, normalScale ];
1023
+
1024
+ }
1025
+
1026
+ this.normalScale = new Vector2().fromArray( normalScale );
1027
+
1028
+ }
1029
+
1030
+ if ( json.displacementMap !== undefined ) this.displacementMap = textures[ json.displacementMap ] || null;
1031
+ if ( json.displacementScale !== undefined ) this.displacementScale = json.displacementScale;
1032
+ if ( json.displacementBias !== undefined ) this.displacementBias = json.displacementBias;
1033
+
1034
+ if ( json.roughnessMap !== undefined ) this.roughnessMap = textures[ json.roughnessMap ] || null;
1035
+ if ( json.metalnessMap !== undefined ) this.metalnessMap = textures[ json.metalnessMap ] || null;
1036
+
1037
+ if ( json.emissiveMap !== undefined ) this.emissiveMap = textures[ json.emissiveMap ] || null;
1038
+ if ( json.emissiveIntensity !== undefined ) this.emissiveIntensity = json.emissiveIntensity;
1039
+
1040
+ if ( json.specularMap !== undefined ) this.specularMap = textures[ json.specularMap ] || null;
1041
+ if ( json.specularIntensityMap !== undefined ) this.specularIntensityMap = textures[ json.specularIntensityMap ] || null;
1042
+ if ( json.specularColorMap !== undefined ) this.specularColorMap = textures[ json.specularColorMap ] || null;
1043
+
1044
+ if ( json.envMap !== undefined ) this.envMap = textures[ json.envMap ] || null;
1045
+ if ( json.envMapRotation !== undefined ) this.envMapRotation.fromArray( json.envMapRotation );
1046
+ if ( json.envMapIntensity !== undefined ) this.envMapIntensity = json.envMapIntensity;
1047
+
1048
+ if ( json.reflectivity !== undefined ) this.reflectivity = json.reflectivity;
1049
+ if ( json.refractionRatio !== undefined ) this.refractionRatio = json.refractionRatio;
1050
+
1051
+ if ( json.lightMap !== undefined ) this.lightMap = textures[ json.lightMap ] || null;
1052
+ if ( json.lightMapIntensity !== undefined ) this.lightMapIntensity = json.lightMapIntensity;
1053
+
1054
+ if ( json.aoMap !== undefined ) this.aoMap = textures[ json.aoMap ] || null;
1055
+ if ( json.aoMapIntensity !== undefined ) this.aoMapIntensity = json.aoMapIntensity;
1056
+
1057
+ if ( json.gradientMap !== undefined ) this.gradientMap = textures[ json.gradientMap ] || null;
1058
+
1059
+ if ( json.clearcoatMap !== undefined ) this.clearcoatMap = textures[ json.clearcoatMap ] || null;
1060
+ if ( json.clearcoatRoughnessMap !== undefined ) this.clearcoatRoughnessMap = textures[ json.clearcoatRoughnessMap ] || null;
1061
+ if ( json.clearcoatNormalMap !== undefined ) this.clearcoatNormalMap = textures[ json.clearcoatNormalMap ] || null;
1062
+ if ( json.clearcoatNormalScale !== undefined ) this.clearcoatNormalScale = new Vector2().fromArray( json.clearcoatNormalScale );
1063
+
1064
+ if ( json.iridescenceMap !== undefined ) this.iridescenceMap = textures[ json.iridescenceMap ] || null;
1065
+ if ( json.iridescenceThicknessMap !== undefined ) this.iridescenceThicknessMap = textures[ json.iridescenceThicknessMap ] || null;
1066
+
1067
+ if ( json.transmissionMap !== undefined ) this.transmissionMap = textures[ json.transmissionMap ] || null;
1068
+ if ( json.thicknessMap !== undefined ) this.thicknessMap = textures[ json.thicknessMap ] || null;
1069
+
1070
+ if ( json.anisotropyMap !== undefined ) this.anisotropyMap = textures[ json.anisotropyMap ] || null;
1071
+
1072
+ if ( json.sheenColorMap !== undefined ) this.sheenColorMap = textures[ json.sheenColorMap ] || null;
1073
+ if ( json.sheenRoughnessMap !== undefined ) this.sheenRoughnessMap = textures[ json.sheenRoughnessMap ] || null;
1074
+
1075
+ return this;
1076
+
1077
+ }
1078
+
884
1079
  /**
885
1080
  * Returns a new material with copied values from this instance.
886
1081
  *
@@ -50,6 +50,10 @@ class MeshBasicMaterial extends Material {
50
50
  * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
51
51
  * color is modulated by the diffuse `color`.
52
52
  *
53
+ * `map` represents color data, and the texture must be assigned a
54
+ * {@link Texture#colorSpace}. Most `map` textures set
55
+ * `texture.colorSpace = SRGBColorSpace`.
56
+ *
53
57
  * @type {?Texture}
54
58
  * @default null
55
59
  */
@@ -58,6 +62,11 @@ class MeshBasicMaterial extends Material {
58
62
  /**
59
63
  * The light map. Requires a second set of UVs.
60
64
  *
65
+ * `lightMap` represents pre-baked illuminance data, and the texture must be assigned
66
+ * a {@link Texture#colorSpace}. Most `lightMap` textures set
67
+ * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
68
+ * such as `.exr` or `.hdr`.
69
+ *
61
70
  * @type {?Texture}
62
71
  * @default null
63
72
  */
@@ -75,6 +84,9 @@ class MeshBasicMaterial extends Material {
75
84
  * The red channel of this texture is used as the ambient occlusion map.
76
85
  * Requires a second set of UVs.
77
86
  *
87
+ * `aoMap` represents non-color data. Any texture assigned must have
88
+ * `texture.colorSpace = NoColorSpace` (default).
89
+ *
78
90
  * @type {?Texture}
79
91
  * @default null
80
92
  */
@@ -93,6 +105,10 @@ class MeshBasicMaterial extends Material {
93
105
  /**
94
106
  * Specular map used by the material.
95
107
  *
108
+ * `specularMap` represents color data, and the texture must be assigned a
109
+ * {@link Texture#colorSpace}. Most `specularMap` textures set
110
+ * `texture.colorSpace = SRGBColorSpace`.
111
+ *
96
112
  * @type {?Texture}
97
113
  * @default null
98
114
  */
@@ -108,6 +124,9 @@ class MeshBasicMaterial extends Material {
108
124
  * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
109
125
  * luminance/alpha textures will also still work as expected.
110
126
  *
127
+ * `alphaMap` represents non-color data. Any texture assigned must have
128
+ * `texture.colorSpace = NoColorSpace` (default).
129
+ *
111
130
  * @type {?Texture}
112
131
  * @default null
113
132
  */
@@ -116,6 +135,11 @@ class MeshBasicMaterial extends Material {
116
135
  /**
117
136
  * The environment map.
118
137
  *
138
+ * `envMap` represents luminance data, and the texture must be assigned
139
+ * a {@link Texture#colorSpace}. Most `envMap` textures set
140
+ * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
141
+ * such as `.exr` or `.hdr`.
142
+ *
119
143
  * @type {?Texture}
120
144
  * @default null
121
145
  */
@@ -46,6 +46,10 @@ class MeshDepthMaterial extends Material {
46
46
  * The color map. May optionally include an alpha channel, typically combined
47
47
  * with {@link Material#transparent} or {@link Material#alphaTest}.
48
48
  *
49
+ * `map` represents color data, and the texture must be assigned a
50
+ * {@link Texture#colorSpace}. Most `map` textures set
51
+ * `texture.colorSpace = SRGBColorSpace`.
52
+ *
49
53
  * @type {?Texture}
50
54
  * @default null
51
55
  */
@@ -61,6 +65,9 @@ class MeshDepthMaterial extends Material {
61
65
  * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
62
66
  * luminance/alpha textures will also still work as expected.
63
67
  *
68
+ * `alphaMap` represents non-color data. Any texture assigned must have
69
+ * `texture.colorSpace = NoColorSpace` (default).
70
+ *
64
71
  * @type {?Texture}
65
72
  * @default null
66
73
  */
@@ -74,6 +81,9 @@ class MeshDepthMaterial extends Material {
74
81
  * of each pixel (white being the highest) is mapped against, and
75
82
  * repositions, the vertices of the mesh.
76
83
  *
84
+ * `displacementMap` represents non-color data. Any texture assigned must have
85
+ * `texture.colorSpace = NoColorSpace` (default).
86
+ *
77
87
  * @type {?Texture}
78
88
  * @default null
79
89
  */