super-three 0.152.0 → 0.154.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 (339) hide show
  1. package/build/three.cjs +779 -557
  2. package/build/three.js +779 -557
  3. package/build/three.min.js +2 -1
  4. package/build/three.module.js +770 -539
  5. package/build/three.module.min.js +2 -1
  6. package/examples/jsm/cameras/CinematicCamera.js +1 -2
  7. package/examples/jsm/capabilities/WebGPU.js +15 -1
  8. package/examples/jsm/controls/ArcballControls.js +2 -1
  9. package/examples/jsm/controls/FlyControls.js +25 -9
  10. package/examples/jsm/controls/OrbitControls.js +5 -1
  11. package/examples/jsm/csm/CSM.js +1 -3
  12. package/examples/jsm/effects/AnaglyphEffect.js +6 -20
  13. package/examples/jsm/effects/OutlineEffect.js +1 -1
  14. package/examples/jsm/effects/ParallaxBarrierEffect.js +3 -0
  15. package/examples/jsm/environments/RoomEnvironment.js +6 -2
  16. package/examples/jsm/exporters/GLTFExporter.js +74 -2
  17. package/examples/jsm/exporters/USDZExporter.js +170 -129
  18. package/examples/jsm/helpers/ViewHelper.js +1 -1
  19. package/examples/jsm/lines/LineMaterial.js +1 -1
  20. package/examples/jsm/loaders/3DMLoader.js +1 -1
  21. package/examples/jsm/loaders/3MFLoader.js +5 -1
  22. package/examples/jsm/loaders/AMFLoader.js +5 -1
  23. package/examples/jsm/loaders/ColladaLoader.js +4 -1
  24. package/examples/jsm/loaders/DRACOLoader.js +2 -0
  25. package/examples/jsm/loaders/FBXLoader.js +9 -2
  26. package/examples/jsm/loaders/GLTFLoader.js +230 -94
  27. package/examples/jsm/loaders/KTX2Loader.js +106 -47
  28. package/examples/jsm/loaders/LDrawLoader.js +4 -7
  29. package/examples/jsm/loaders/MMDLoader.js +40 -13
  30. package/examples/jsm/loaders/PCDLoader.js +25 -10
  31. package/examples/jsm/loaders/PDBLoader.js +7 -2
  32. package/examples/jsm/loaders/PLYLoader.js +30 -8
  33. package/examples/jsm/loaders/STLLoader.js +8 -3
  34. package/examples/jsm/loaders/VRMLLoader.js +55 -7
  35. package/examples/jsm/loaders/VTKLoader.js +12 -4
  36. package/examples/jsm/loaders/XYZLoader.js +9 -3
  37. package/examples/jsm/materials/MeshGouraudMaterial.js +2 -2
  38. package/examples/jsm/math/Lut.js +5 -4
  39. package/examples/jsm/math/MeshSurfaceSampler.js +82 -37
  40. package/examples/jsm/misc/GPUComputationRenderer.js +1 -0
  41. package/examples/jsm/misc/VolumeSlice.js +3 -1
  42. package/examples/jsm/nodes/Nodes.js +22 -16
  43. package/examples/jsm/nodes/accessors/BufferAttributeNode.js +99 -0
  44. package/examples/jsm/nodes/accessors/BufferNode.js +2 -2
  45. package/examples/jsm/nodes/accessors/CameraNode.js +25 -4
  46. package/examples/jsm/nodes/accessors/ExtendedMaterialNode.js +7 -1
  47. package/examples/jsm/nodes/accessors/InstanceNode.js +29 -12
  48. package/examples/jsm/nodes/accessors/MaterialNode.js +55 -47
  49. package/examples/jsm/nodes/accessors/MaterialReferenceNode.js +2 -2
  50. package/examples/jsm/nodes/accessors/ModelNode.js +3 -1
  51. package/examples/jsm/nodes/accessors/ModelViewProjectionNode.js +4 -9
  52. package/examples/jsm/nodes/accessors/MorphNode.js +70 -0
  53. package/examples/jsm/nodes/accessors/NormalNode.js +3 -2
  54. package/examples/jsm/nodes/accessors/Object3DNode.js +10 -2
  55. package/examples/jsm/nodes/accessors/ReferenceNode.js +2 -2
  56. package/examples/jsm/nodes/accessors/SceneNode.js +46 -0
  57. package/examples/jsm/nodes/accessors/SkinningNode.js +43 -62
  58. package/examples/jsm/nodes/accessors/StorageBufferNode.js +2 -2
  59. package/examples/jsm/nodes/accessors/TangentNode.js +2 -2
  60. package/examples/jsm/nodes/accessors/TextureBicubicNode.js +94 -0
  61. package/examples/jsm/nodes/accessors/TextureNode.js +68 -6
  62. package/examples/jsm/nodes/accessors/TextureSizeNode.js +35 -0
  63. package/examples/jsm/nodes/accessors/UVNode.js +1 -1
  64. package/examples/jsm/nodes/code/CodeNode.js +3 -0
  65. package/examples/jsm/nodes/code/FunctionNode.js +25 -4
  66. package/examples/jsm/nodes/core/AttributeNode.js +1 -1
  67. package/examples/jsm/nodes/core/BypassNode.js +2 -2
  68. package/examples/jsm/nodes/core/ContextNode.js +2 -0
  69. package/examples/jsm/nodes/core/IndexNode.js +66 -0
  70. package/examples/jsm/nodes/core/LightingModel.js +2 -1
  71. package/examples/jsm/nodes/core/Node.js +13 -16
  72. package/examples/jsm/nodes/core/NodeAttribute.js +2 -1
  73. package/examples/jsm/nodes/core/NodeBuilder.js +86 -8
  74. package/examples/jsm/nodes/core/NodeUtils.js +10 -0
  75. package/examples/jsm/nodes/core/PropertyNode.js +6 -2
  76. package/examples/jsm/nodes/core/StackNode.js +8 -1
  77. package/examples/jsm/nodes/core/UniformNode.js +1 -1
  78. package/examples/jsm/nodes/core/VarNode.js +1 -3
  79. package/examples/jsm/nodes/display/BlendModeNode.js +9 -9
  80. package/examples/jsm/nodes/display/ColorAdjustmentNode.js +7 -7
  81. package/examples/jsm/nodes/display/ColorSpaceNode.js +50 -49
  82. package/examples/jsm/nodes/display/NormalMapNode.js +3 -3
  83. package/examples/jsm/nodes/display/ToneMappingNode.js +24 -15
  84. package/examples/jsm/nodes/display/ViewportDepthNode.js +69 -0
  85. package/examples/jsm/nodes/display/ViewportDepthTextureNode.js +34 -0
  86. package/examples/jsm/nodes/display/ViewportSharedTextureNode.js +7 -6
  87. package/examples/jsm/nodes/display/ViewportTextureNode.js +33 -19
  88. package/examples/jsm/nodes/functions/BSDF/BRDF_BlinnPhong.js +5 -5
  89. package/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js +10 -8
  90. package/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.js +2 -2
  91. package/examples/jsm/nodes/functions/BSDF/BRDF_Sheen.js +43 -0
  92. package/examples/jsm/nodes/functions/BSDF/DFGApprox.js +4 -4
  93. package/examples/jsm/nodes/functions/BSDF/D_GGX.js +2 -2
  94. package/examples/jsm/nodes/functions/BSDF/EnvironmentBRDF.js +13 -0
  95. package/examples/jsm/nodes/functions/BSDF/F_Schlick.js +2 -4
  96. package/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +2 -2
  97. package/examples/jsm/nodes/functions/PhongLightingModel.js +7 -7
  98. package/examples/jsm/nodes/functions/PhysicalLightingModel.js +132 -19
  99. package/examples/jsm/nodes/functions/material/getGeometryRoughness.js +2 -2
  100. package/examples/jsm/nodes/functions/material/getRoughness.js +3 -3
  101. package/examples/jsm/nodes/geometry/RangeNode.js +33 -51
  102. package/examples/jsm/nodes/lighting/AnalyticLightNode.js +6 -3
  103. package/examples/jsm/nodes/lighting/DirectionalLightNode.js +2 -2
  104. package/examples/jsm/nodes/lighting/EnvironmentNode.js +107 -62
  105. package/examples/jsm/nodes/lighting/HemisphereLightNode.js +2 -2
  106. package/examples/jsm/nodes/lighting/LightUtils.js +2 -2
  107. package/examples/jsm/nodes/lighting/LightingContextNode.js +17 -15
  108. package/examples/jsm/nodes/lighting/PointLightNode.js +3 -3
  109. package/examples/jsm/nodes/lighting/SpotLightNode.js +3 -3
  110. package/examples/jsm/nodes/materials/LineBasicNodeMaterial.js +0 -15
  111. package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +0 -15
  112. package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +0 -10
  113. package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +0 -9
  114. package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +41 -0
  115. package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +1 -14
  116. package/examples/jsm/nodes/materials/NodeMaterial.js +119 -29
  117. package/examples/jsm/nodes/materials/PointsNodeMaterial.js +0 -9
  118. package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +0 -7
  119. package/examples/jsm/nodes/materialx/lib/mx_hsv.js +3 -3
  120. package/examples/jsm/nodes/materialx/lib/mx_noise.js +14 -14
  121. package/examples/jsm/nodes/materialx/lib/mx_transform_color.js +4 -4
  122. package/examples/jsm/nodes/math/MathNode.js +6 -0
  123. package/examples/jsm/nodes/math/OperatorNode.js +1 -1
  124. package/examples/jsm/nodes/procedural/CheckerNode.js +3 -3
  125. package/examples/jsm/nodes/shadernode/ShaderNode.js +60 -33
  126. package/examples/jsm/nodes/utils/EquirectUVNode.js +2 -3
  127. package/examples/jsm/nodes/utils/LoopNode.js +186 -0
  128. package/examples/jsm/nodes/utils/TriplanarTexturesNode.js +1 -1
  129. package/examples/jsm/objects/GroundProjectedSkybox.js +1 -1
  130. package/examples/jsm/objects/Lensflare.js +3 -4
  131. package/examples/jsm/objects/MarchingCubes.js +5 -1
  132. package/examples/jsm/objects/Reflector.js +4 -1
  133. package/examples/jsm/objects/Refractor.js +1 -1
  134. package/examples/jsm/objects/Sky.js +1 -1
  135. package/examples/jsm/objects/Water.js +2 -1
  136. package/examples/jsm/objects/Water2.js +1 -1
  137. package/examples/jsm/offscreen/scene.js +1 -0
  138. package/examples/jsm/physics/RapierPhysics.js +93 -133
  139. package/examples/jsm/postprocessing/AfterimagePass.js +3 -0
  140. package/examples/jsm/postprocessing/BloomPass.js +7 -2
  141. package/examples/jsm/postprocessing/BokehPass.js +3 -2
  142. package/examples/jsm/postprocessing/DotScreenPass.js +1 -0
  143. package/examples/jsm/postprocessing/EffectComposer.js +4 -1
  144. package/examples/jsm/postprocessing/FilmPass.js +1 -0
  145. package/examples/jsm/postprocessing/OutlinePass.js +8 -9
  146. package/examples/jsm/postprocessing/OutputPass.js +72 -0
  147. package/examples/jsm/postprocessing/RenderPixelatedPass.js +4 -3
  148. package/examples/jsm/postprocessing/SAOPass.js +4 -2
  149. package/examples/jsm/postprocessing/SMAAPass.js +5 -2
  150. package/examples/jsm/postprocessing/SSAARenderPass.js +5 -13
  151. package/examples/jsm/postprocessing/SSAOPass.js +4 -2
  152. package/examples/jsm/postprocessing/SSRPass.js +3 -1
  153. package/examples/jsm/postprocessing/SavePass.js +5 -2
  154. package/examples/jsm/postprocessing/ShaderPass.js +1 -0
  155. package/examples/jsm/postprocessing/TAARenderPass.js +17 -4
  156. package/examples/jsm/postprocessing/TexturePass.js +2 -1
  157. package/examples/jsm/postprocessing/UnrealBloomPass.js +13 -13
  158. package/examples/jsm/renderers/{webgpu/WebGPUAnimation.js → common/Animation.js} +2 -2
  159. package/examples/jsm/renderers/common/Attributes.js +75 -0
  160. package/examples/jsm/renderers/common/Backend.js +162 -0
  161. package/examples/jsm/renderers/common/Background.js +134 -0
  162. package/examples/jsm/renderers/common/Binding.js +11 -0
  163. package/examples/jsm/renderers/common/Bindings.js +169 -0
  164. package/examples/jsm/renderers/common/Buffer.js +38 -0
  165. package/examples/jsm/renderers/{webgpu/WebGPUBufferUtils.js → common/BufferUtils.js} +2 -2
  166. package/examples/jsm/renderers/{webgpu/WebGPUWeakMap.js → common/ChainMap.js} +11 -5
  167. package/examples/jsm/renderers/common/ComputePipeline.js +17 -0
  168. package/examples/jsm/renderers/common/Constants.js +14 -0
  169. package/examples/jsm/renderers/common/CubeRenderTarget.js +65 -0
  170. package/examples/jsm/renderers/common/DataMap.js +54 -0
  171. package/examples/jsm/renderers/{webgpu/WebGPUGeometries.js → common/Geometries.js} +38 -37
  172. package/examples/jsm/renderers/{webgpu/WebGPUInfo.js → common/Info.js} +2 -3
  173. package/examples/jsm/renderers/common/Pipeline.js +13 -0
  174. package/examples/jsm/renderers/common/Pipelines.js +321 -0
  175. package/examples/jsm/renderers/common/ProgrammableStage.js +18 -0
  176. package/examples/jsm/renderers/common/RenderContext.js +37 -0
  177. package/examples/jsm/renderers/common/RenderContexts.js +38 -0
  178. package/examples/jsm/renderers/{webgpu/WebGPURenderLists.js → common/RenderList.js} +2 -39
  179. package/examples/jsm/renderers/common/RenderLists.js +38 -0
  180. package/examples/jsm/renderers/common/RenderObject.js +113 -0
  181. package/examples/jsm/renderers/common/RenderObjects.js +92 -0
  182. package/examples/jsm/renderers/common/RenderPipeline.js +16 -0
  183. package/examples/jsm/renderers/{webgpu/WebGPURenderTarget.js → common/RenderTarget.js} +2 -2
  184. package/examples/jsm/renderers/common/Renderer.js +864 -0
  185. package/examples/jsm/renderers/common/SampledTexture.js +80 -0
  186. package/examples/jsm/renderers/common/Sampler.js +18 -0
  187. package/examples/jsm/renderers/common/StorageBuffer.js +17 -0
  188. package/examples/jsm/renderers/common/Textures.js +206 -0
  189. package/examples/jsm/renderers/{webgpu/WebGPUUniform.js → common/Uniform.js} +13 -9
  190. package/examples/jsm/renderers/common/UniformBuffer.js +15 -0
  191. package/examples/jsm/renderers/{webgpu/WebGPUUniformsGroup.js → common/UniformsGroup.js} +13 -13
  192. package/examples/jsm/renderers/{webgpu/nodes/WebGPUNodes.js → common/nodes/NodeRender.js} +3 -3
  193. package/examples/jsm/renderers/{webgpu/nodes/WebGPUNodeSampledTexture.js → common/nodes/NodeSampledTexture.js} +4 -4
  194. package/examples/jsm/renderers/{webgpu/nodes/WebGPUNodeSampler.js → common/nodes/NodeSampler.js} +3 -3
  195. package/examples/jsm/renderers/{webgpu/nodes/WebGPUNodeUniform.js → common/nodes/NodeUniform.js} +1 -1
  196. package/examples/jsm/renderers/common/nodes/Nodes.js +319 -0
  197. package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +340 -0
  198. package/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js +23 -19
  199. package/examples/jsm/renderers/webgpu/WebGPUBackend.js +847 -0
  200. package/examples/jsm/renderers/webgpu/WebGPURenderer.js +15 -1131
  201. package/examples/jsm/renderers/webgpu/nodes/{WebGPUNodeBuilder.js → WGSLNodeBuilder.js} +75 -45
  202. package/examples/jsm/{nodes/parsers → renderers/webgpu/nodes}/WGSLNodeFunction.js +2 -2
  203. package/examples/jsm/{nodes/parsers → renderers/webgpu/nodes}/WGSLNodeParser.js +1 -1
  204. package/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +255 -0
  205. package/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +145 -0
  206. package/examples/jsm/renderers/webgpu/{constants.js → utils/WebGPUConstants.js} +6 -7
  207. package/examples/jsm/renderers/webgpu/{WebGPURenderPipeline.js → utils/WebGPUPipelineUtils.js} +154 -247
  208. package/examples/jsm/renderers/webgpu/{WebGPUTextureUtils.js → utils/WebGPUTextureMipmapUtils.js} +3 -25
  209. package/examples/jsm/renderers/webgpu/{WebGPUTextures.js → utils/WebGPUTextureUtils.js} +392 -505
  210. package/examples/jsm/renderers/webgpu/utils/WebGPUUtils.js +92 -0
  211. package/examples/jsm/shaders/BleachBypassShader.js +2 -0
  212. package/examples/jsm/shaders/BlendShader.js +1 -2
  213. package/examples/jsm/shaders/BokehShader2.js +3 -0
  214. package/examples/jsm/shaders/ColorifyShader.js +2 -0
  215. package/examples/jsm/shaders/ConvolutionShader.js +2 -0
  216. package/examples/jsm/shaders/CopyShader.js +4 -2
  217. package/examples/jsm/shaders/DotScreenShader.js +2 -0
  218. package/examples/jsm/shaders/ExposureShader.js +44 -0
  219. package/examples/jsm/shaders/FilmShader.js +2 -0
  220. package/examples/jsm/shaders/GammaCorrectionShader.js +2 -0
  221. package/examples/jsm/shaders/HorizontalBlurShader.js +2 -0
  222. package/examples/jsm/shaders/OutputShader.js +61 -0
  223. package/examples/jsm/shaders/RGBShiftShader.js +2 -0
  224. package/examples/jsm/shaders/SepiaShader.js +2 -0
  225. package/examples/jsm/shaders/ToonShader.js +13 -5
  226. package/examples/jsm/shaders/VerticalBlurShader.js +2 -0
  227. package/examples/jsm/shaders/VignetteShader.js +2 -0
  228. package/examples/jsm/shaders/WaterRefractionShader.js +5 -2
  229. package/examples/jsm/utils/BufferGeometryUtils.js +17 -1
  230. package/examples/jsm/utils/TextureUtils.js +86 -0
  231. package/examples/jsm/webxr/OculusHandPointerModel.js +34 -13
  232. package/examples/jsm/webxr/XRHandPrimitiveModel.js +1 -0
  233. package/examples/jsm/webxr/XRPlanes.js +100 -0
  234. package/package.json +3 -1
  235. package/src/Three.Legacy.js +0 -228
  236. package/src/audio/PositionalAudio.js +8 -0
  237. package/src/cameras/Camera.js +5 -0
  238. package/src/cameras/CubeCamera.js +76 -13
  239. package/src/cameras/OrthographicCamera.js +1 -1
  240. package/src/cameras/PerspectiveCamera.js +1 -1
  241. package/src/constants.js +13 -1
  242. package/src/core/BufferAttribute.js +3 -25
  243. package/src/core/BufferGeometry.js +1 -8
  244. package/src/core/Object3D.js +1 -1
  245. package/src/extras/core/Curve.js +1 -1
  246. package/src/loaders/CubeTextureLoader.js +2 -0
  247. package/src/loaders/Loader.js +2 -0
  248. package/src/loaders/MaterialLoader.js +5 -0
  249. package/src/loaders/ObjectLoader.js +1 -0
  250. package/src/materials/Material.js +13 -1
  251. package/src/materials/MeshPhysicalMaterial.js +32 -6
  252. package/src/math/Color.js +16 -11
  253. package/src/math/Frustum.js +16 -2
  254. package/src/math/MathUtils.js +16 -0
  255. package/src/math/Matrix3.js +26 -6
  256. package/src/math/Matrix4.js +74 -19
  257. package/src/objects/InstancedMesh.js +3 -0
  258. package/src/objects/Mesh.js +14 -10
  259. package/src/objects/Skeleton.js +1 -3
  260. package/src/objects/SkinnedMesh.js +36 -8
  261. package/src/renderers/WebGLRenderer.js +126 -21
  262. package/src/renderers/shaders/ShaderChunk/alphahash_fragment.glsl.js +7 -0
  263. package/src/renderers/shaders/ShaderChunk/alphahash_pars_fragment.glsl.js +68 -0
  264. package/src/renderers/shaders/ShaderChunk/begin_vertex.glsl.js +6 -0
  265. package/src/renderers/shaders/ShaderChunk/common.glsl.js +6 -0
  266. package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +26 -3
  267. package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +9 -1
  268. package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +26 -0
  269. package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +52 -2
  270. package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +10 -2
  271. package/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js +1 -1
  272. package/src/renderers/shaders/ShaderChunk/{output_fragment.glsl.js → opaque_fragment.glsl.js} +1 -2
  273. package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +1 -1
  274. package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +3 -3
  275. package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +10 -5
  276. package/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.js +6 -1
  277. package/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.js +7 -1
  278. package/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.js +6 -1
  279. package/src/renderers/shaders/ShaderChunk.js +10 -6
  280. package/src/renderers/shaders/ShaderLib/background.glsl.js +1 -1
  281. package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +1 -1
  282. package/src/renderers/shaders/ShaderLib/cube.glsl.js +1 -1
  283. package/src/renderers/shaders/ShaderLib/depth.glsl.js +2 -0
  284. package/src/renderers/shaders/ShaderLib/distanceRGBA.glsl.js +2 -0
  285. package/src/renderers/shaders/ShaderLib/equirect.glsl.js +1 -1
  286. package/src/renderers/shaders/ShaderLib/linedashed.glsl.js +2 -2
  287. package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +4 -2
  288. package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +4 -2
  289. package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +4 -2
  290. package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +4 -2
  291. package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +12 -2
  292. package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +4 -2
  293. package/src/renderers/shaders/ShaderLib/points.glsl.js +4 -2
  294. package/src/renderers/shaders/ShaderLib/shadow.glsl.js +1 -1
  295. package/src/renderers/shaders/ShaderLib/sprite.glsl.js +4 -2
  296. package/src/renderers/shaders/ShaderLib.js +4 -1
  297. package/src/renderers/shaders/UniformsLib.js +2 -0
  298. package/src/renderers/webgl/WebGLBindingStates.js +13 -5
  299. package/src/renderers/webgl/WebGLGeometries.js +12 -0
  300. package/src/renderers/webgl/WebGLInfo.js +0 -1
  301. package/src/renderers/webgl/WebGLMaterials.js +18 -0
  302. package/src/renderers/webgl/WebGLObjects.js +23 -3
  303. package/src/renderers/webgl/WebGLProgram.js +43 -5
  304. package/src/renderers/webgl/WebGLPrograms.js +19 -7
  305. package/src/renderers/webgl/WebGLTextures.js +19 -1
  306. package/src/renderers/webvr/WebVRManager.js +12 -0
  307. package/src/renderers/webxr/WebXRManager.js +39 -99
  308. package/src/scenes/Scene.js +0 -14
  309. package/src/textures/DepthTexture.js +22 -0
  310. package/src/textures/FramebufferTexture.js +1 -3
  311. package/src/textures/Source.js +4 -0
  312. package/src/textures/Texture.js +1 -1
  313. package/examples/jsm/exporters/ColladaExporter.js +0 -725
  314. package/examples/jsm/geometries/LightningStrike.js +0 -1017
  315. package/examples/jsm/loaders/PRWMLoader.js +0 -299
  316. package/examples/jsm/nodes/core/InstanceIndexNode.js +0 -26
  317. package/examples/jsm/objects/LightningStorm.js +0 -245
  318. package/examples/jsm/postprocessing/AdaptiveToneMappingPass.js +0 -361
  319. package/examples/jsm/renderers/webgpu/WebGPUAttributes.js +0 -197
  320. package/examples/jsm/renderers/webgpu/WebGPUBackground.js +0 -190
  321. package/examples/jsm/renderers/webgpu/WebGPUBinding.js +0 -22
  322. package/examples/jsm/renderers/webgpu/WebGPUBindings.js +0 -270
  323. package/examples/jsm/renderers/webgpu/WebGPUBuffer.js +0 -43
  324. package/examples/jsm/renderers/webgpu/WebGPUComputePipelines.js +0 -78
  325. package/examples/jsm/renderers/webgpu/WebGPUProgrammableStage.js +0 -22
  326. package/examples/jsm/renderers/webgpu/WebGPUProperties.js +0 -44
  327. package/examples/jsm/renderers/webgpu/WebGPURenderObject.js +0 -40
  328. package/examples/jsm/renderers/webgpu/WebGPURenderObjects.js +0 -50
  329. package/examples/jsm/renderers/webgpu/WebGPURenderPipelines.js +0 -274
  330. package/examples/jsm/renderers/webgpu/WebGPURenderStates.js +0 -54
  331. package/examples/jsm/renderers/webgpu/WebGPUSampledTexture.js +0 -75
  332. package/examples/jsm/renderers/webgpu/WebGPUSampler.js +0 -29
  333. package/examples/jsm/renderers/webgpu/WebGPUStorageBuffer.js +0 -20
  334. package/examples/jsm/renderers/webgpu/WebGPUTextureRenderer.js +0 -38
  335. package/examples/jsm/renderers/webgpu/WebGPUUniformBuffer.js +0 -18
  336. package/examples/jsm/renderers/webgpu/WebGPUUtils.js +0 -88
  337. package/examples/jsm/shaders/ToneMapShader.js +0 -73
  338. /package/src/renderers/shaders/ShaderChunk/{encodings_fragment.glsl.js → colorspace_fragment.glsl.js} +0 -0
  339. /package/src/renderers/shaders/ShaderChunk/{encodings_pars_fragment.glsl.js → colorspace_pars_fragment.glsl.js} +0 -0
@@ -1,7 +1,4 @@
1
- import {
2
- DoubleSide
3
- } from 'three';
4
-
1
+ import * as THREE from 'three';
5
2
  import * as fflate from '../libs/fflate.module.js';
6
3
 
7
4
  class USDZExporter {
@@ -12,7 +9,8 @@ class USDZExporter {
12
9
  ar: {
13
10
  anchoring: { type: 'plane' },
14
11
  planeAnchoring: { alignment: 'horizontal' }
15
- }
12
+ },
13
+ quickLookCompatible: false,
16
14
  }, options );
17
15
 
18
16
  const files = {};
@@ -37,7 +35,7 @@ class USDZExporter {
37
35
 
38
36
  if ( material.isMeshStandardMaterial ) {
39
37
 
40
- const geometryFileName = 'geometries/Geometry_' + geometry.id + '.usd';
38
+ const geometryFileName = 'geometries/Geometry_' + geometry.id + '.usda';
41
39
 
42
40
  if ( ! ( geometryFileName in files ) ) {
43
41
 
@@ -71,7 +69,7 @@ class USDZExporter {
71
69
 
72
70
  output += buildSceneEnd();
73
71
 
74
- output += buildMaterials( materials, textures );
72
+ output += buildMaterials( materials, textures, options.quickLookCompatible );
75
73
 
76
74
  files[ modelFileName ] = fflate.strToU8( output );
77
75
  output = null;
@@ -79,13 +77,11 @@ class USDZExporter {
79
77
  for ( const id in textures ) {
80
78
 
81
79
  const texture = textures[ id ];
82
- const color = id.split( '_' )[ 1 ];
83
- const isRGBA = texture.format === 1023;
84
80
 
85
- const canvas = imageToCanvas( texture.image, color, texture.flipY );
86
- const blob = await new Promise( resolve => canvas.toBlob( resolve, isRGBA ? 'image/png' : 'image/jpeg', 1 ) );
81
+ const canvas = imageToCanvas( texture.image, texture.flipY );
82
+ const blob = await new Promise( resolve => canvas.toBlob( resolve, 'image/png', 1 ) );
87
83
 
88
- files[ `textures/Texture_${ id }.${ isRGBA ? 'png' : 'jpg' }` ] = new Uint8Array( await blob.arrayBuffer() );
84
+ files[ `textures/Texture_${ id }.png` ] = new Uint8Array( await blob.arrayBuffer() );
89
85
 
90
86
  }
91
87
 
@@ -122,7 +118,7 @@ class USDZExporter {
122
118
 
123
119
  }
124
120
 
125
- function imageToCanvas( image, color, flipY ) {
121
+ function imageToCanvas( image, flipY ) {
126
122
 
127
123
  if ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||
128
124
  ( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||
@@ -137,6 +133,8 @@ function imageToCanvas( image, color, flipY ) {
137
133
 
138
134
  const context = canvas.getContext( '2d' );
139
135
 
136
+ // TODO: We should be able to do this in the UsdTransform2d?
137
+
140
138
  if ( flipY === true ) {
141
139
 
142
140
  context.translate( 0, canvas.height );
@@ -146,29 +144,6 @@ function imageToCanvas( image, color, flipY ) {
146
144
 
147
145
  context.drawImage( image, 0, 0, canvas.width, canvas.height );
148
146
 
149
- if ( color !== undefined ) {
150
-
151
- const hex = parseInt( color, 16 );
152
-
153
- const r = ( hex >> 16 & 255 ) / 255;
154
- const g = ( hex >> 8 & 255 ) / 255;
155
- const b = ( hex & 255 ) / 255;
156
-
157
- const imagedata = context.getImageData( 0, 0, canvas.width, canvas.height );
158
- const data = imagedata.data;
159
-
160
- for ( let i = 0; i < data.length; i += 4 ) {
161
-
162
- data[ i + 0 ] = data[ i + 0 ] * r;
163
- data[ i + 1 ] = data[ i + 1 ] * g;
164
- data[ i + 2 ] = data[ i + 2 ] * b;
165
-
166
- }
167
-
168
- context.putImageData( imagedata, 0, 0 );
169
-
170
- }
171
-
172
147
  return canvas;
173
148
 
174
149
  } else {
@@ -187,11 +162,11 @@ function buildHeader() {
187
162
 
188
163
  return `#usda 1.0
189
164
  (
190
- customLayerData = {
191
- string creator = "Three.js USDZExporter"
192
- }
193
- metersPerUnit = 1
194
- upAxis = "Y"
165
+ customLayerData = {
166
+ string creator = "Three.js USDZExporter"
167
+ }
168
+ metersPerUnit = 1
169
+ upAxis = "Y"
195
170
  )
196
171
 
197
172
  `;
@@ -202,20 +177,20 @@ function buildSceneStart( options ) {
202
177
 
203
178
  return `def Xform "Root"
204
179
  {
205
- def Scope "Scenes" (
206
- kind = "sceneLibrary"
207
- )
208
- {
209
- def Xform "Scene" (
210
- customData = {
211
- bool preliminary_collidesWithEnvironment = 0
212
- string sceneName = "Scene"
213
- }
214
- sceneName = "Scene"
215
- )
216
- {
217
- token preliminary:anchoring:type = "${options.ar.anchoring.type}"
218
- token preliminary:planeAnchoring:alignment = "${options.ar.planeAnchoring.alignment}"
180
+ def Scope "Scenes" (
181
+ kind = "sceneLibrary"
182
+ )
183
+ {
184
+ def Xform "Scene" (
185
+ customData = {
186
+ bool preliminary_collidesWithEnvironment = 0
187
+ string sceneName = "Scene"
188
+ }
189
+ sceneName = "Scene"
190
+ )
191
+ {
192
+ token preliminary:anchoring:type = "${options.ar.anchoring.type}"
193
+ token preliminary:planeAnchoring:alignment = "${options.ar.planeAnchoring.alignment}"
219
194
 
220
195
  `;
221
196
 
@@ -224,8 +199,8 @@ function buildSceneStart( options ) {
224
199
  function buildSceneEnd() {
225
200
 
226
201
  return `
227
- }
228
- }
202
+ }
203
+ }
229
204
  }
230
205
 
231
206
  `;
@@ -254,13 +229,14 @@ function buildXform( object, geometry, material ) {
254
229
  }
255
230
 
256
231
  return `def Xform "${ name }" (
257
- prepend references = @./geometries/Geometry_${ geometry.id }.usd@</Geometry>
232
+ prepend references = @./geometries/Geometry_${ geometry.id }.usda@</Geometry>
233
+ prepend apiSchemas = ["MaterialBindingAPI"]
258
234
  )
259
235
  {
260
- matrix4d xformOp:transform = ${ transform }
261
- uniform token[] xformOpOrder = ["xformOp:transform"]
236
+ matrix4d xformOp:transform = ${ transform }
237
+ uniform token[] xformOpOrder = ["xformOp:transform"]
262
238
 
263
- rel material:binding = </Materials/Material_${ material.id }>
239
+ rel material:binding = </Materials/Material_${ material.id }>
264
240
  }
265
241
 
266
242
  `;
@@ -289,7 +265,7 @@ function buildMeshObject( geometry ) {
289
265
  return `
290
266
  def "Geometry"
291
267
  {
292
- ${mesh}
268
+ ${mesh}
293
269
  }
294
270
  `;
295
271
 
@@ -302,19 +278,17 @@ function buildMesh( geometry ) {
302
278
  const count = attributes.position.count;
303
279
 
304
280
  return `
305
- def Mesh "${ name }"
306
- {
307
- int[] faceVertexCounts = [${ buildMeshVertexCount( geometry ) }]
308
- int[] faceVertexIndices = [${ buildMeshVertexIndices( geometry ) }]
309
- normal3f[] normals = [${ buildVector3Array( attributes.normal, count )}] (
310
- interpolation = "vertex"
311
- )
312
- point3f[] points = [${ buildVector3Array( attributes.position, count )}]
313
- float2[] primvars:st = [${ buildVector2Array( attributes.uv, count )}] (
314
- interpolation = "vertex"
315
- )
316
- uniform token subdivisionScheme = "none"
317
- }
281
+ def Mesh "${ name }"
282
+ {
283
+ int[] faceVertexCounts = [${ buildMeshVertexCount( geometry ) }]
284
+ int[] faceVertexIndices = [${ buildMeshVertexIndices( geometry ) }]
285
+ normal3f[] normals = [${ buildVector3Array( attributes.normal, count )}] (
286
+ interpolation = "vertex"
287
+ )
288
+ point3f[] points = [${ buildVector3Array( attributes.position, count )}]
289
+ ${ buildPrimvars( attributes, count ) }
290
+ uniform token subdivisionScheme = "none"
291
+ }
318
292
  `;
319
293
 
320
294
  }
@@ -405,9 +379,33 @@ function buildVector2Array( attribute, count ) {
405
379
 
406
380
  }
407
381
 
382
+ function buildPrimvars( attributes, count ) {
383
+
384
+ let string = '';
385
+
386
+ for ( let i = 0; i < 4; i ++ ) {
387
+
388
+ const id = ( i > 0 ? i : '' );
389
+ const attribute = attributes[ 'uv' + id ];
390
+
391
+ if ( attribute !== undefined ) {
392
+
393
+ string += `
394
+ texCoord2f[] primvars:st${ id } = [${ buildVector2Array( attribute, count )}] (
395
+ interpolation = "vertex"
396
+ )`;
397
+
398
+ }
399
+
400
+ }
401
+
402
+ return string;
403
+
404
+ }
405
+
408
406
  // Materials
409
407
 
410
- function buildMaterials( materials, textures ) {
408
+ function buildMaterials( materials, textures, quickLookCompatible = false ) {
411
409
 
412
410
  const array = [];
413
411
 
@@ -415,7 +413,7 @@ function buildMaterials( materials, textures ) {
415
413
 
416
414
  const material = materials[ uuid ];
417
415
 
418
- array.push( buildMaterial( material, textures ) );
416
+ array.push( buildMaterial( material, textures, quickLookCompatible ) );
419
417
 
420
418
  }
421
419
 
@@ -428,53 +426,99 @@ ${ array.join( '' ) }
428
426
 
429
427
  }
430
428
 
431
- function buildMaterial( material, textures ) {
429
+ function buildMaterial( material, textures, quickLookCompatible = false ) {
432
430
 
433
431
  // https://graphics.pixar.com/usd/docs/UsdPreviewSurface-Proposal.html
434
432
 
435
- const pad = ' ';
433
+ const pad = ' ';
436
434
  const inputs = [];
437
435
  const samplers = [];
438
436
 
439
437
  function buildTexture( texture, mapType, color ) {
440
438
 
441
- const id = texture.id + ( color ? '_' + color.getHexString() : '' );
442
- const isRGBA = texture.format === 1023;
439
+ const id = texture.source.id + '_' + texture.flipY;
443
440
 
444
441
  textures[ id ] = texture;
445
442
 
443
+ const uv = texture.channel > 0 ? 'st' + texture.channel : 'st';
444
+
445
+ const WRAPPINGS = {
446
+ 1000: 'repeat', // RepeatWrapping
447
+ 1001: 'clamp', // ClampToEdgeWrapping
448
+ 1002: 'mirror' // MirroredRepeatWrapping
449
+ };
450
+
451
+ const repeat = texture.repeat.clone();
452
+ const offset = texture.offset.clone();
453
+ const rotation = texture.rotation;
454
+
455
+ // rotation is around the wrong point. after rotation we need to shift offset again so that we're rotating around the right spot
456
+ const xRotationOffset = Math.sin( rotation );
457
+ const yRotationOffset = Math.cos( rotation );
458
+
459
+ // texture coordinates start in the opposite corner, need to correct
460
+ offset.y = 1 - offset.y - repeat.y;
461
+
462
+ // turns out QuickLook is buggy and interprets texture repeat inverted/applies operations in a different order.
463
+ // Apple Feedback: FB10036297 and FB11442287
464
+ if ( quickLookCompatible ) {
465
+
466
+ // This is NOT correct yet in QuickLook, but comes close for a range of models.
467
+ // It becomes more incorrect the bigger the offset is
468
+
469
+ offset.x = offset.x / repeat.x;
470
+ offset.y = offset.y / repeat.y;
471
+
472
+ offset.x += xRotationOffset / repeat.x;
473
+ offset.y += yRotationOffset - 1;
474
+
475
+ } else {
476
+
477
+ // results match glTF results exactly. verified correct in usdview.
478
+ offset.x += xRotationOffset * repeat.x;
479
+ offset.y += ( 1 - yRotationOffset ) * repeat.y;
480
+
481
+ }
482
+
446
483
  return `
447
- def Shader "Transform2d_${ mapType }" (
448
- sdrMetadata = {
449
- string role = "math"
450
- }
451
- )
452
- {
453
- uniform token info:id = "UsdTransform2d"
454
- float2 inputs:in.connect = </Materials/Material_${ material.id }/uvReader_st.outputs:result>
455
- float2 inputs:scale = ${ buildVector2( texture.repeat ) }
456
- float2 inputs:translation = ${ buildVector2( texture.offset ) }
457
- float2 outputs:result
458
- }
459
-
460
- def Shader "Texture_${ texture.id }_${ mapType }"
461
- {
462
- uniform token info:id = "UsdUVTexture"
463
- asset inputs:file = @textures/Texture_${ id }.${ isRGBA ? 'png' : 'jpg' }@
464
- float2 inputs:st.connect = </Materials/Material_${ material.id }/Transform2d_${ mapType }.outputs:result>
465
- token inputs:wrapS = "repeat"
466
- token inputs:wrapT = "repeat"
467
- float outputs:r
468
- float outputs:g
469
- float outputs:b
470
- float3 outputs:rgb
471
- ${ material.transparent || material.alphaTest > 0.0 ? 'float outputs:a' : '' }
472
- }`;
484
+ def Shader "PrimvarReader_${ mapType }"
485
+ {
486
+ uniform token info:id = "UsdPrimvarReader_float2"
487
+ float2 inputs:fallback = (0.0, 0.0)
488
+ token inputs:varname = "${ uv }"
489
+ float2 outputs:result
490
+ }
491
+
492
+ def Shader "Transform2d_${ mapType }"
493
+ {
494
+ uniform token info:id = "UsdTransform2d"
495
+ token inputs:in.connect = </Materials/Material_${ material.id }/PrimvarReader_${ mapType }.outputs:result>
496
+ float inputs:rotation = ${ ( rotation * ( 180 / Math.PI ) ).toFixed( PRECISION ) }
497
+ float2 inputs:scale = ${ buildVector2( repeat ) }
498
+ float2 inputs:translation = ${ buildVector2( offset ) }
499
+ float2 outputs:result
500
+ }
501
+
502
+ def Shader "Texture_${ texture.id }_${ mapType }"
503
+ {
504
+ uniform token info:id = "UsdUVTexture"
505
+ asset inputs:file = @textures/Texture_${ id }.png@
506
+ float2 inputs:st.connect = </Materials/Material_${ material.id }/Transform2d_${ mapType }.outputs:result>
507
+ ${ color !== undefined ? 'float4 inputs:scale = ' + buildColor4( color ) : '' }
508
+ token inputs:sourceColorSpace = "${ texture.colorSpace === THREE.NoColorSpace ? 'raw' : 'sRGB' }"
509
+ token inputs:wrapS = "${ WRAPPINGS[ texture.wrapS ] }"
510
+ token inputs:wrapT = "${ WRAPPINGS[ texture.wrapT ] }"
511
+ float outputs:r
512
+ float outputs:g
513
+ float outputs:b
514
+ float3 outputs:rgb
515
+ ${ material.transparent || material.alphaTest > 0.0 ? 'float outputs:a' : '' }
516
+ }`;
473
517
 
474
518
  }
475
519
 
476
520
 
477
- if ( material.side === DoubleSide ) {
521
+ if ( material.side === THREE.DoubleSide ) {
478
522
 
479
523
  console.warn( 'THREE.USDZExporter: USDZ does not support double sided materials', material );
480
524
 
@@ -577,30 +621,21 @@ function buildMaterial( material, textures ) {
577
621
  }
578
622
 
579
623
  return `
580
- def Material "Material_${ material.id }"
581
- {
582
- def Shader "PreviewSurface"
583
- {
584
- uniform token info:id = "UsdPreviewSurface"
624
+ def Material "Material_${ material.id }"
625
+ {
626
+ def Shader "PreviewSurface"
627
+ {
628
+ uniform token info:id = "UsdPreviewSurface"
585
629
  ${ inputs.join( '\n' ) }
586
- int inputs:useSpecularWorkflow = 0
587
- token outputs:surface
588
- }
589
-
590
- token outputs:surface.connect = </Materials/Material_${ material.id }/PreviewSurface.outputs:surface>
591
- token inputs:frame:stPrimvarName = "st"
630
+ int inputs:useSpecularWorkflow = 0
631
+ token outputs:surface
632
+ }
592
633
 
593
- def Shader "uvReader_st"
594
- {
595
- uniform token info:id = "UsdPrimvarReader_float2"
596
- token inputs:varname.connect = </Materials/Material_${ material.id }.inputs:frame:stPrimvarName>
597
- float2 inputs:fallback = (0.0, 0.0)
598
- float2 outputs:result
599
- }
634
+ token outputs:surface.connect = </Materials/Material_${ material.id }/PreviewSurface.outputs:surface>
600
635
 
601
636
  ${ samplers.join( '\n' ) }
602
637
 
603
- }
638
+ }
604
639
  `;
605
640
 
606
641
  }
@@ -611,6 +646,12 @@ function buildColor( color ) {
611
646
 
612
647
  }
613
648
 
649
+ function buildColor4( color ) {
650
+
651
+ return `(${ color.r }, ${ color.g }, ${ color.b }, 1.0)`;
652
+
653
+ }
654
+
614
655
  function buildVector2( vector ) {
615
656
 
616
657
  return `(${ vector.x }, ${ vector.y })`;
@@ -636,7 +677,7 @@ function buildCamera( camera ) {
636
677
  {
637
678
  matrix4d xformOp:transform = ${ transform }
638
679
  uniform token[] xformOpOrder = ["xformOp:transform"]
639
-
680
+
640
681
  float2 clippingRange = (${ camera.near.toPrecision( PRECISION ) }, ${ camera.far.toPrecision( PRECISION ) })
641
682
  float horizontalAperture = ${ ( ( Math.abs( camera.left ) + Math.abs( camera.right ) ) * 10 ).toPrecision( PRECISION ) }
642
683
  float verticalAperture = ${ ( ( Math.abs( camera.top ) + Math.abs( camera.bottom ) ) * 10 ).toPrecision( PRECISION ) }
@@ -651,7 +692,7 @@ function buildCamera( camera ) {
651
692
  {
652
693
  matrix4d xformOp:transform = ${ transform }
653
694
  uniform token[] xformOpOrder = ["xformOp:transform"]
654
-
695
+
655
696
  float2 clippingRange = (${ camera.near.toPrecision( PRECISION ) }, ${ camera.far.toPrecision( PRECISION ) })
656
697
  float focalLength = ${ camera.getFocalLength().toPrecision( PRECISION ) }
657
698
  float focusDistance = ${ camera.focus.toPrecision( PRECISION ) }
@@ -167,7 +167,7 @@ class ViewHelper extends Object3D {
167
167
  const rect = domElement.getBoundingClientRect();
168
168
  const offsetX = rect.left + ( domElement.offsetWidth - dim );
169
169
  const offsetY = rect.top + ( domElement.offsetHeight - dim );
170
- mouse.x = ( ( event.clientX - offsetX ) / ( rect.width - offsetX ) ) * 2 - 1;
170
+ mouse.x = ( ( event.clientX - offsetX ) / ( rect.right - offsetX ) ) * 2 - 1;
171
171
  mouse.y = - ( ( event.clientY - offsetY ) / ( rect.bottom - offsetY ) ) * 2 + 1;
172
172
 
173
173
  raycaster.setFromCamera( mouse, orthoCamera );
@@ -426,7 +426,7 @@ ShaderLib[ 'line' ] = {
426
426
  gl_FragColor = vec4( diffuseColor.rgb, alpha );
427
427
 
428
428
  #include <tonemapping_fragment>
429
- #include <encodings_fragment>
429
+ #include <colorspace_fragment>
430
430
  #include <fog_fragment>
431
431
  #include <premultiplied_alpha_fragment>
432
432
 
@@ -224,7 +224,7 @@ class Rhino3dmLoader extends Loader {
224
224
  return new MeshStandardMaterial( {
225
225
  color: new Color( 1, 1, 1 ),
226
226
  metalness: 0.8,
227
- name: 'default',
227
+ name: Loader.DEFAULT_MATERIAL_NAME,
228
228
  side: DoubleSide
229
229
  } );
230
230
 
@@ -1067,7 +1067,11 @@ class ThreeMFLoader extends Loader {
1067
1067
  geometry.setIndex( new BufferAttribute( meshData[ 'triangles' ], 1 ) );
1068
1068
  geometry.setAttribute( 'position', new BufferAttribute( meshData[ 'vertices' ], 3 ) );
1069
1069
 
1070
- const material = new MeshPhongMaterial( { color: 0xffffff, flatShading: true } );
1070
+ const material = new MeshPhongMaterial( {
1071
+ name: Loader.DEFAULT_MATERIAL_NAME,
1072
+ color: 0xffffff,
1073
+ flatShading: true
1074
+ } );
1071
1075
 
1072
1076
  const mesh = new Mesh( geometry, material );
1073
1077
 
@@ -432,7 +432,11 @@ class AMFLoader extends Loader {
432
432
  }
433
433
 
434
434
  const sceneObject = new Group();
435
- const defaultMaterial = new MeshPhongMaterial( { color: 0xaaaaff, flatShading: true } );
435
+ const defaultMaterial = new MeshPhongMaterial( {
436
+ name: Loader.DEFAULT_MATERIAL_NAME,
437
+ color: 0xaaaaff,
438
+ flatShading: true
439
+ } );
436
440
 
437
441
  sceneObject.name = amfName;
438
442
  sceneObject.userData.author = amfAuthor;
@@ -3710,7 +3710,10 @@ class ColladaLoader extends Loader {
3710
3710
 
3711
3711
  }
3712
3712
 
3713
- const fallbackMaterial = new MeshBasicMaterial( { color: 0xff00ff } );
3713
+ const fallbackMaterial = new MeshBasicMaterial( {
3714
+ name: Loader.DEFAULT_MATERIAL_NAME,
3715
+ color: 0xff00ff
3716
+ } );
3714
3717
 
3715
3718
  function resolveMaterialBinding( keys, instanceMaterials ) {
3716
3719
 
@@ -209,6 +209,8 @@ class DRACOLoader extends Loader {
209
209
 
210
210
  this._assignVertexColorSpace( attribute, result.vertexColorSpace );
211
211
 
212
+ attribute.normalized = ( array instanceof Float32Array ) === false;
213
+
212
214
  }
213
215
 
214
216
  geometry.setAttribute( name, attribute );
@@ -1270,7 +1270,10 @@ class FBXTreeParser {
1270
1270
 
1271
1271
  } else {
1272
1272
 
1273
- material = new MeshPhongMaterial( { color: 0xcccccc } );
1273
+ material = new MeshPhongMaterial( {
1274
+ name: Loader.DEFAULT_MATERIAL_NAME,
1275
+ color: 0xcccccc
1276
+ } );
1274
1277
  materials.push( material );
1275
1278
 
1276
1279
  }
@@ -1311,7 +1314,11 @@ class FBXTreeParser {
1311
1314
  }, null );
1312
1315
 
1313
1316
  // FBX does not list materials for Nurbs lines, so we'll just put our own in here.
1314
- const material = new LineBasicMaterial( { color: 0x3300ff, linewidth: 1 } );
1317
+ const material = new LineBasicMaterial( {
1318
+ name: Loader.DEFAULT_MATERIAL_NAME,
1319
+ color: 0x3300ff,
1320
+ linewidth: 1
1321
+ } );
1315
1322
  return new Line( geometry, material );
1316
1323
 
1317
1324
  }