@plastic-software/three 0.178.0 → 0.180.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 (245) hide show
  1. package/README.md +1 -1
  2. package/build/three.cjs +950 -230
  3. package/build/three.core.js +754 -138
  4. package/build/three.core.min.js +1 -1
  5. package/build/three.module.js +197 -96
  6. package/build/three.module.min.js +1 -1
  7. package/build/three.tsl.js +99 -25
  8. package/build/three.tsl.min.js +1 -1
  9. package/build/three.webgpu.js +4586 -1499
  10. package/build/three.webgpu.min.js +1 -1
  11. package/build/three.webgpu.nodes.js +4544 -1499
  12. package/build/three.webgpu.nodes.min.js +1 -1
  13. package/examples/jsm/Addons.js +2 -3
  14. package/examples/jsm/capabilities/WebGPU.js +1 -1
  15. package/examples/jsm/controls/ArcballControls.js +7 -7
  16. package/examples/jsm/controls/DragControls.js +6 -56
  17. package/examples/jsm/controls/FirstPersonControls.js +2 -2
  18. package/examples/jsm/controls/PointerLockControls.js +0 -8
  19. package/examples/jsm/csm/CSMShadowNode.js +4 -4
  20. package/examples/jsm/environments/RoomEnvironment.js +8 -3
  21. package/examples/jsm/exporters/GLTFExporter.js +30 -22
  22. package/examples/jsm/exporters/KTX2Exporter.js +4 -2
  23. package/examples/jsm/exporters/PLYExporter.js +1 -1
  24. package/examples/jsm/exporters/USDZExporter.js +676 -299
  25. package/examples/jsm/geometries/RoundedBoxGeometry.js +47 -8
  26. package/examples/jsm/interactive/HTMLMesh.js +5 -3
  27. package/examples/jsm/libs/ktx-parse.module.js +1 -1
  28. package/examples/jsm/libs/meshopt_decoder.module.js +75 -58
  29. package/examples/jsm/lights/LightProbeGenerator.js +14 -3
  30. package/examples/jsm/lines/Line2.js +3 -3
  31. package/examples/jsm/lines/LineGeometry.js +1 -1
  32. package/examples/jsm/lines/LineSegments2.js +2 -2
  33. package/examples/jsm/lines/Wireframe.js +2 -2
  34. package/examples/jsm/lines/WireframeGeometry2.js +1 -1
  35. package/examples/jsm/lines/webgpu/LineSegments2.js +1 -1
  36. package/examples/jsm/lines/webgpu/Wireframe.js +1 -1
  37. package/examples/jsm/loaders/ColladaLoader.js +1 -1
  38. package/examples/jsm/loaders/EXRLoader.js +210 -22
  39. package/examples/jsm/loaders/FBXLoader.js +1 -1
  40. package/examples/jsm/loaders/GLTFLoader.js +9 -5
  41. package/examples/jsm/loaders/HDRCubeTextureLoader.js +5 -5
  42. package/examples/jsm/loaders/HDRLoader.js +486 -0
  43. package/examples/jsm/loaders/KTX2Loader.js +112 -32
  44. package/examples/jsm/loaders/MaterialXLoader.js +212 -30
  45. package/examples/jsm/loaders/RGBELoader.js +7 -473
  46. package/examples/jsm/loaders/TTFLoader.js +13 -1
  47. package/examples/jsm/loaders/USDLoader.js +219 -0
  48. package/examples/jsm/loaders/USDZLoader.js +4 -892
  49. package/examples/jsm/loaders/UltraHDRLoader.js +1 -1
  50. package/examples/jsm/loaders/lwo/IFFParser.js +1 -1
  51. package/examples/jsm/loaders/usd/USDAParser.js +741 -0
  52. package/examples/jsm/loaders/usd/USDCParser.js +17 -0
  53. package/examples/jsm/materials/WoodNodeMaterial.js +533 -0
  54. package/examples/jsm/math/ColorSpaces.js +19 -1
  55. package/examples/jsm/math/ConvexHull.js +2 -2
  56. package/examples/jsm/math/Lut.js +2 -2
  57. package/examples/jsm/misc/MD2CharacterComplex.js +1 -1
  58. package/examples/jsm/misc/ProgressiveLightMap.js +1 -1
  59. package/examples/jsm/misc/Volume.js +1 -1
  60. package/examples/jsm/objects/LensflareMesh.js +3 -3
  61. package/examples/jsm/objects/SkyMesh.js +2 -2
  62. package/examples/jsm/physics/RapierPhysics.js +14 -5
  63. package/examples/jsm/postprocessing/GTAOPass.js +10 -9
  64. package/examples/jsm/postprocessing/OutlinePass.js +17 -17
  65. package/examples/jsm/postprocessing/SSAOPass.js +10 -9
  66. package/examples/jsm/postprocessing/SSRPass.js +37 -8
  67. package/examples/jsm/shaders/UnpackDepthRGBAShader.js +11 -2
  68. package/examples/jsm/transpiler/GLSLDecoder.js +23 -20
  69. package/examples/jsm/transpiler/TSLEncoder.js +2 -10
  70. package/examples/jsm/transpiler/WGSLEncoder.js +24 -0
  71. package/examples/jsm/tsl/display/AnamorphicNode.js +27 -4
  72. package/examples/jsm/tsl/display/BloomNode.js +7 -6
  73. package/examples/jsm/tsl/display/ChromaticAberrationNode.js +2 -1
  74. package/examples/jsm/tsl/display/DepthOfFieldNode.js +439 -90
  75. package/examples/jsm/tsl/display/GTAONode.js +8 -0
  76. package/examples/jsm/tsl/display/GaussianBlurNode.js +51 -41
  77. package/examples/jsm/tsl/display/OutlineNode.js +2 -2
  78. package/examples/jsm/tsl/display/SSRNode.js +180 -65
  79. package/examples/jsm/tsl/display/{TRAAPassNode.js → TRAANode.js} +181 -172
  80. package/examples/jsm/tsl/display/boxBlur.js +64 -0
  81. package/examples/jsm/tsl/display/hashBlur.js +15 -18
  82. package/examples/jsm/tsl/lighting/TiledLightsNode.js +1 -1
  83. package/examples/jsm/utils/BufferGeometryUtils.js +1 -1
  84. package/examples/jsm/utils/ShadowMapViewerGPU.js +12 -5
  85. package/examples/jsm/webxr/OculusHandModel.js +1 -1
  86. package/package.json +1 -1
  87. package/src/Three.Core.js +2 -0
  88. package/src/Three.TSL.js +98 -24
  89. package/src/animation/AnimationClip.js +17 -2
  90. package/src/animation/KeyframeTrack.js +1 -1
  91. package/src/animation/tracks/BooleanKeyframeTrack.js +1 -1
  92. package/src/animation/tracks/StringKeyframeTrack.js +1 -1
  93. package/src/cameras/Camera.js +14 -0
  94. package/src/cameras/OrthographicCamera.js +1 -1
  95. package/src/cameras/PerspectiveCamera.js +1 -1
  96. package/src/constants.js +11 -3
  97. package/src/core/BufferGeometry.js +2 -2
  98. package/{examples/jsm/misc → src/core}/Timer.js +4 -42
  99. package/src/extras/PMREMGenerator.js +11 -0
  100. package/src/extras/TextureUtils.js +2 -1
  101. package/src/extras/lib/earcut.js +1 -1
  102. package/src/helpers/CameraHelper.js +41 -11
  103. package/src/helpers/SkeletonHelper.js +35 -6
  104. package/src/lights/LightShadow.js +21 -8
  105. package/src/lights/PointLightShadow.js +1 -1
  106. package/src/lights/webgpu/ProjectorLight.js +1 -1
  107. package/src/loaders/FileLoader.js +25 -2
  108. package/src/loaders/ImageBitmapLoader.js +23 -0
  109. package/src/loaders/Loader.js +14 -0
  110. package/src/loaders/LoadingManager.js +23 -0
  111. package/src/materials/Material.js +12 -0
  112. package/src/materials/MeshBasicMaterial.js +1 -1
  113. package/src/materials/MeshDistanceMaterial.js +1 -1
  114. package/src/materials/nodes/Line2NodeMaterial.js +0 -8
  115. package/src/materials/nodes/NodeMaterial.js +1 -1
  116. package/src/materials/nodes/PointsNodeMaterial.js +86 -28
  117. package/src/materials/nodes/SpriteNodeMaterial.js +3 -15
  118. package/src/materials/nodes/manager/NodeMaterialObserver.js +87 -2
  119. package/src/math/ColorManagement.js +7 -1
  120. package/src/math/Frustum.js +19 -8
  121. package/src/math/FrustumArray.js +10 -5
  122. package/src/math/Line3.js +129 -2
  123. package/src/math/Matrix4.js +48 -27
  124. package/src/math/Spherical.js +2 -2
  125. package/src/nodes/Nodes.js +4 -0
  126. package/src/nodes/TSL.js +4 -0
  127. package/src/nodes/accessors/BufferNode.js +1 -1
  128. package/src/nodes/accessors/Camera.js +142 -16
  129. package/src/nodes/accessors/ClippingNode.js +6 -5
  130. package/src/nodes/accessors/CubeTextureNode.js +2 -2
  131. package/src/nodes/accessors/InstanceNode.js +3 -1
  132. package/src/nodes/accessors/Normal.js +11 -11
  133. package/src/nodes/accessors/Object3DNode.js +1 -1
  134. package/src/nodes/accessors/ReferenceBaseNode.js +1 -1
  135. package/src/nodes/accessors/ReferenceNode.js +19 -4
  136. package/src/nodes/accessors/SceneNode.js +1 -1
  137. package/src/nodes/accessors/StorageTextureNode.js +1 -1
  138. package/src/nodes/accessors/Texture3DNode.js +13 -0
  139. package/src/nodes/accessors/TextureNode.js +83 -19
  140. package/src/nodes/code/FunctionCallNode.js +19 -0
  141. package/src/nodes/code/FunctionNode.js +23 -0
  142. package/src/nodes/core/ArrayNode.js +12 -0
  143. package/src/nodes/core/AssignNode.js +6 -2
  144. package/src/nodes/core/ContextNode.js +44 -1
  145. package/src/nodes/core/Node.js +30 -22
  146. package/src/nodes/core/NodeBuilder.js +71 -32
  147. package/src/nodes/core/NodeFrame.js +1 -1
  148. package/src/nodes/core/NodeUniform.js +1 -1
  149. package/src/nodes/core/NodeUtils.js +5 -3
  150. package/src/nodes/core/StackNode.js +71 -4
  151. package/src/nodes/core/StructNode.js +5 -5
  152. package/src/nodes/core/StructTypeNode.js +1 -0
  153. package/src/nodes/core/SubBuildNode.js +2 -2
  154. package/src/nodes/core/UniformNode.js +79 -14
  155. package/src/nodes/core/VarNode.js +83 -15
  156. package/src/nodes/display/FrontFacingNode.js +4 -8
  157. package/src/nodes/display/PassNode.js +148 -2
  158. package/src/nodes/display/ScreenNode.js +42 -13
  159. package/src/nodes/display/ViewportDepthTextureNode.js +16 -4
  160. package/src/nodes/display/ViewportSharedTextureNode.js +12 -0
  161. package/src/nodes/display/ViewportTextureNode.js +94 -4
  162. package/src/nodes/functions/PhysicalLightingModel.js +2 -2
  163. package/src/nodes/gpgpu/AtomicFunctionNode.js +1 -1
  164. package/src/nodes/gpgpu/ComputeNode.js +67 -23
  165. package/src/nodes/gpgpu/SubgroupFunctionNode.js +430 -0
  166. package/src/nodes/gpgpu/WorkgroupInfoNode.js +28 -3
  167. package/src/nodes/lighting/LightsNode.js +1 -1
  168. package/src/nodes/lighting/ProjectorLightNode.js +19 -6
  169. package/src/nodes/lighting/ShadowFilterNode.js +1 -1
  170. package/src/nodes/materialx/MaterialXNodes.js +131 -2
  171. package/src/nodes/materialx/lib/mx_noise.js +165 -1
  172. package/src/nodes/math/BitcastNode.js +156 -0
  173. package/src/nodes/math/ConditionalNode.js +19 -3
  174. package/src/nodes/math/MathNode.js +72 -60
  175. package/src/nodes/math/OperatorNode.js +26 -25
  176. package/src/nodes/tsl/TSLCore.js +477 -142
  177. package/src/nodes/utils/DebugNode.js +1 -1
  178. package/src/nodes/utils/EventNode.js +83 -0
  179. package/src/nodes/utils/JoinNode.js +3 -1
  180. package/src/nodes/utils/MemberNode.js +58 -7
  181. package/src/nodes/utils/RTTNode.js +10 -1
  182. package/src/nodes/utils/ReflectorNode.js +51 -7
  183. package/src/nodes/utils/SampleNode.js +12 -2
  184. package/src/nodes/utils/SplitNode.js +11 -0
  185. package/src/nodes/utils/Timer.js +0 -47
  186. package/src/objects/BatchedMesh.js +6 -4
  187. package/src/objects/LOD.js +1 -1
  188. package/src/objects/Sprite.js +2 -2
  189. package/src/renderers/WebGLRenderer.js +21 -31
  190. package/src/renderers/common/Attributes.js +1 -1
  191. package/src/renderers/common/Backend.js +19 -1
  192. package/src/renderers/common/Bindings.js +21 -18
  193. package/src/renderers/common/ChainMap.js +1 -1
  194. package/src/renderers/common/Color4.js +2 -2
  195. package/src/renderers/common/DataMap.js +1 -1
  196. package/src/renderers/common/Pipelines.js +1 -1
  197. package/src/renderers/common/PostProcessing.js +60 -5
  198. package/src/renderers/common/RenderContext.js +2 -2
  199. package/src/renderers/common/RenderObject.js +14 -2
  200. package/src/renderers/common/Renderer.js +55 -32
  201. package/src/renderers/common/SampledTexture.js +4 -72
  202. package/src/renderers/common/Sampler.js +91 -0
  203. package/src/renderers/common/Storage3DTexture.js +21 -0
  204. package/src/renderers/common/StorageArrayTexture.js +21 -0
  205. package/src/renderers/common/StorageTexture.js +19 -0
  206. package/src/renderers/common/Textures.js +52 -14
  207. package/src/renderers/common/TimestampQueryPool.js +3 -3
  208. package/src/renderers/common/XRManager.js +51 -17
  209. package/src/renderers/common/nodes/NodeBuilderState.js +1 -1
  210. package/src/renderers/common/nodes/NodeLibrary.js +5 -5
  211. package/src/renderers/common/nodes/NodeSampledTexture.js +0 -12
  212. package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +1 -1
  213. package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +1 -1
  214. package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +1 -1
  215. package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +1 -1
  216. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +21 -11
  217. package/src/renderers/shaders/ShaderLib/depth.glsl.js +11 -2
  218. package/src/renderers/webgl/WebGLCapabilities.js +2 -2
  219. package/src/renderers/webgl/WebGLMaterials.js +6 -6
  220. package/src/renderers/webgl/WebGLProgram.js +24 -18
  221. package/src/renderers/webgl/WebGLPrograms.js +4 -4
  222. package/src/renderers/webgl/WebGLShadowMap.js +11 -1
  223. package/src/renderers/webgl/WebGLTextures.js +20 -7
  224. package/src/renderers/webgl/WebGLUtils.js +3 -2
  225. package/src/renderers/webgl-fallback/WebGLBackend.js +207 -146
  226. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +112 -19
  227. package/src/renderers/webgl-fallback/utils/WebGLState.js +1 -1
  228. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +52 -3
  229. package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +9 -10
  230. package/src/renderers/webgl-fallback/utils/WebGLUtils.js +3 -2
  231. package/src/renderers/webgpu/WebGPUBackend.js +87 -44
  232. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +169 -99
  233. package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +35 -31
  234. package/src/renderers/webgpu/utils/WebGPUConstants.js +2 -2
  235. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +10 -19
  236. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +120 -84
  237. package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +3 -3
  238. package/src/renderers/webgpu/utils/WebGPUUtils.js +2 -17
  239. package/src/renderers/webxr/WebXRDepthSensing.js +6 -10
  240. package/src/renderers/webxr/WebXRManager.js +86 -11
  241. package/src/textures/ExternalTexture.js +56 -0
  242. package/src/textures/FramebufferTexture.js +2 -2
  243. package/src/textures/Source.js +12 -2
  244. package/src/textures/VideoTexture.js +27 -2
  245. package/examples/jsm/loaders/RGBMLoader.js +0 -1148
@@ -89,6 +89,7 @@ export * from './loaders/FBXLoader.js';
89
89
  export * from './loaders/FontLoader.js';
90
90
  export * from './loaders/GCodeLoader.js';
91
91
  export * from './loaders/GLTFLoader.js';
92
+ export * from './loaders/HDRLoader.js';
92
93
  export * from './loaders/HDRCubeTextureLoader.js';
93
94
  export * from './loaders/IESLoader.js';
94
95
  export * from './loaders/KMZLoader.js';
@@ -110,14 +111,13 @@ export * from './loaders/PLYLoader.js';
110
111
  export * from './loaders/PVRLoader.js';
111
112
  export * from './loaders/RGBELoader.js';
112
113
  export * from './loaders/UltraHDRLoader.js';
113
- export * from './loaders/RGBMLoader.js';
114
114
  export * from './loaders/STLLoader.js';
115
115
  export * from './loaders/SVGLoader.js';
116
116
  export * from './loaders/TDSLoader.js';
117
117
  export * from './loaders/TGALoader.js';
118
118
  export * from './loaders/TIFFLoader.js';
119
119
  export * from './loaders/TTFLoader.js';
120
- export * from './loaders/USDZLoader.js';
120
+ export * from './loaders/USDLoader.js';
121
121
  export * from './loaders/VOXLoader.js';
122
122
  export * from './loaders/VRMLLoader.js';
123
123
  export * from './loaders/VTKLoader.js';
@@ -146,7 +146,6 @@ export * from './misc/MorphAnimMesh.js';
146
146
  export * from './misc/MorphBlendMesh.js';
147
147
  export * from './misc/ProgressiveLightMap.js';
148
148
  export * from './misc/RollerCoaster.js';
149
- export * from './misc/Timer.js';
150
149
  export * from './misc/TubePainter.js';
151
150
  export * from './misc/Volume.js';
152
151
  export * from './misc/VolumeSlice.js';
@@ -2,7 +2,7 @@ let isAvailable = ( typeof navigator !== 'undefined' && navigator.gpu !== undefi
2
2
 
3
3
  if ( typeof window !== 'undefined' && isAvailable ) {
4
4
 
5
- isAvailable = await navigator.gpu.requestAdapter();
5
+ isAvailable = Boolean( await navigator.gpu.requestAdapter() );
6
6
 
7
7
  }
8
8
 
@@ -1315,7 +1315,7 @@ class ArcballControls extends Controls {
1315
1315
  *
1316
1316
  * @param {'PAN'|'ROTATE'|'ZOOM'|'FOV'} operation - The operation to be performed ('PAN', 'ROTATE', 'ZOOM', 'FOV').
1317
1317
  * @param {0|1|2|'WHEEL'} mouse - A mouse button (0, 1, 2) or 'WHEEL' for wheel notches.
1318
- * @param {'CTRL'|'SHIFT'|null} [key=null] - The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed.
1318
+ * @param {?('CTRL'|'SHIFT')} [key=null] - The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed.
1319
1319
  * @returns {boolean} `true` if the mouse action has been successfully added, `false` otherwise.
1320
1320
  */
1321
1321
  setMouseAction( operation, mouse, key = null ) {
@@ -1396,7 +1396,7 @@ class ArcballControls extends Controls {
1396
1396
  * Remove a mouse action by specifying its mouse/key combination.
1397
1397
  *
1398
1398
  * @param {0|1|2|'WHEEL'} mouse - A mouse button (0, 1, 2) or 'WHEEL' for wheel notches.
1399
- * @param {'CTRL'|'SHIFT'|null} key - The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed.
1399
+ * @param {?('CTRL'|'SHIFT')} key - The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed.
1400
1400
  * @returns {boolean} `true` if the operation has been successfully removed, `false` otherwise.
1401
1401
  */
1402
1402
  unsetMouseAction( mouse, key = null ) {
@@ -1421,8 +1421,8 @@ class ArcballControls extends Controls {
1421
1421
  *
1422
1422
  * @private
1423
1423
  * @param {0|1|2|'WHEEL'} mouse - Mouse button index (0, 1, 2) or 'WHEEL' for wheel notches.
1424
- * @param {'CTRL'|'SHIFT'|null} key - Keyboard modifier.
1425
- * @returns {'PAN'|'ROTATE'|'ZOOM'|'FOV'|null} The operation if it has been found, `null` otherwise.
1424
+ * @param {?('CTRL'|'SHIFT')} key - Keyboard modifier.
1425
+ * @returns {?('PAN'|'ROTATE'|'ZOOM'|'FOV')} The operation if it has been found, `null` otherwise.
1426
1426
  */
1427
1427
  getOpFromAction( mouse, key ) {
1428
1428
 
@@ -1463,7 +1463,7 @@ class ArcballControls extends Controls {
1463
1463
  *
1464
1464
  * @private
1465
1465
  * @param {0|1|2} mouse - Mouse button index (0, 1, 2)
1466
- * @param {'CTRL'|'SHIFT'|null} key - Keyboard modifier
1466
+ * @param {?('CTRL'|'SHIFT')} key - Keyboard modifier
1467
1467
  * @returns {?STATE} The FSA state obtained from the operation associated to mouse/keyboard combination.
1468
1468
  */
1469
1469
  getOpStateFromAction( mouse, key ) {
@@ -2509,8 +2509,8 @@ class ArcballControls extends Controls {
2509
2509
  * Sets values in transformation object.
2510
2510
  *
2511
2511
  * @private
2512
- * @param {Matrix4} [camera=null] - Transformation to be applied to the camera.
2513
- * @param {Matrix4} [gizmos=null] - Transformation to be applied to gizmos.
2512
+ * @param {?Matrix4} [camera=null] - Transformation to be applied to the camera.
2513
+ * @param {?Matrix4} [gizmos=null] - Transformation to be applied to gizmos.
2514
2514
  */
2515
2515
  setTransformationMatrices( camera = null, gizmos = null ) {
2516
2516
 
@@ -234,56 +234,6 @@ class DragControls extends Controls {
234
234
 
235
235
  }
236
236
 
237
- getRaycaster() {
238
-
239
- console.warn( 'THREE.DragControls: getRaycaster() has been deprecated. Use controls.raycaster instead.' ); // @deprecated r169
240
-
241
- return this.raycaster;
242
-
243
- }
244
-
245
- setObjects( objects ) {
246
-
247
- console.warn( 'THREE.DragControls: setObjects() has been deprecated. Use controls.objects instead.' ); // @deprecated r169
248
-
249
- this.objects = objects;
250
-
251
- }
252
-
253
- getObjects() {
254
-
255
- console.warn( 'THREE.DragControls: getObjects() has been deprecated. Use controls.objects instead.' ); // @deprecated r169
256
-
257
- return this.objects;
258
-
259
- }
260
-
261
- activate() {
262
-
263
- console.warn( 'THREE.DragControls: activate() has been renamed to connect().' ); // @deprecated r169
264
- this.connect();
265
-
266
- }
267
-
268
- deactivate() {
269
-
270
- console.warn( 'THREE.DragControls: deactivate() has been renamed to disconnect().' ); // @deprecated r169
271
- this.disconnect();
272
-
273
- }
274
-
275
- set mode( value ) {
276
-
277
- console.warn( 'THREE.DragControls: The .mode property has been removed. Define the type of transformation via the .mouseButtons or .touches properties.' ); // @deprecated r169
278
-
279
- }
280
-
281
- get mode() {
282
-
283
- console.warn( 'THREE.DragControls: The .mode property has been removed. Define the type of transformation via the .mouseButtons or .touches properties.' ); // @deprecated r169
284
-
285
- }
286
-
287
237
  }
288
238
 
289
239
  function onPointerMove( event ) {
@@ -305,6 +255,7 @@ function onPointerMove( event ) {
305
255
  if ( raycaster.ray.intersectPlane( _plane, _intersection ) ) {
306
256
 
307
257
  _selected.position.copy( _intersection.sub( _offset ).applyMatrix4( _inverseMatrix ) );
258
+ this.dispatchEvent( { type: 'drag', object: _selected } );
308
259
 
309
260
  }
310
261
 
@@ -313,11 +264,10 @@ function onPointerMove( event ) {
313
264
  _diff.subVectors( _pointer, _previousPointer ).multiplyScalar( this.rotateSpeed );
314
265
  _selected.rotateOnWorldAxis( _up, _diff.x );
315
266
  _selected.rotateOnWorldAxis( _right.normalize(), - _diff.y );
267
+ this.dispatchEvent( { type: 'drag', object: _selected } );
316
268
 
317
269
  }
318
270
 
319
- this.dispatchEvent( { type: 'drag', object: _selected } );
320
-
321
271
  _previousPointer.copy( _pointer );
322
272
 
323
273
  } else {
@@ -414,21 +364,21 @@ function onPointerDown( event ) {
414
364
 
415
365
  _inverseMatrix.copy( _selected.parent.matrixWorld ).invert();
416
366
  _offset.copy( _intersection ).sub( _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) );
367
+ domElement.style.cursor = 'move';
368
+ this.dispatchEvent( { type: 'dragstart', object: _selected } );
417
369
 
418
370
  } else if ( this.state === STATE.ROTATE ) {
419
371
 
420
372
  // the controls only support Y+ up
421
373
  _up.set( 0, 1, 0 ).applyQuaternion( camera.quaternion ).normalize();
422
374
  _right.set( 1, 0, 0 ).applyQuaternion( camera.quaternion ).normalize();
375
+ domElement.style.cursor = 'move';
376
+ this.dispatchEvent( { type: 'dragstart', object: _selected } );
423
377
 
424
378
  }
425
379
 
426
380
  }
427
381
 
428
- domElement.style.cursor = 'move';
429
-
430
- this.dispatchEvent( { type: 'dragstart', object: _selected } );
431
-
432
382
  }
433
383
 
434
384
  _previousPointer.copy( _pointer );
@@ -194,8 +194,8 @@ class FirstPersonControls extends Controls {
194
194
  window.removeEventListener( 'keydown', this._onKeyDown );
195
195
  window.removeEventListener( 'keyup', this._onKeyUp );
196
196
 
197
- this.domElement.removeEventListener( 'pointerdown', this._onPointerMove );
198
- this.domElement.removeEventListener( 'pointermove', this._onPointerDown );
197
+ this.domElement.removeEventListener( 'pointermove', this._onPointerMove );
198
+ this.domElement.removeEventListener( 'pointerdown', this._onPointerDown );
199
199
  this.domElement.removeEventListener( 'pointerup', this._onPointerUp );
200
200
  this.domElement.removeEventListener( 'contextmenu', this._onContextMenu );
201
201
 
@@ -141,14 +141,6 @@ class PointerLockControls extends Controls {
141
141
 
142
142
  }
143
143
 
144
- getObject() {
145
-
146
- console.warn( 'THREE.PointerLockControls: getObject() has been deprecated. Use controls.object instead.' ); // @deprecated r169
147
-
148
- return this.object;
149
-
150
- }
151
-
152
144
  /**
153
145
  * Returns the look direction of the camera.
154
146
  *
@@ -374,9 +374,9 @@ class CSMShadowNode extends ShadowBaseNode {
374
374
  _setupFade() {
375
375
 
376
376
  const cameraNear = reference( 'camera.near', 'float', this ).setGroup( renderGroup );
377
- const cascades = reference( '_cascades', 'vec2', this ).setGroup( renderGroup ).label( 'cascades' );
377
+ const cascades = reference( '_cascades', 'vec2', this ).setGroup( renderGroup ).setName( 'cascades' );
378
378
 
379
- const shadowFar = uniform( 'float' ).setGroup( renderGroup ).label( 'shadowFar' )
379
+ const shadowFar = uniform( 'float' ).setGroup( renderGroup ).setName( 'shadowFar' )
380
380
  .onRenderUpdate( () => Math.min( this.maxFar, this.camera.far ) );
381
381
 
382
382
  const linearDepth = viewZToOrthographicDepth( positionView.z, cameraNear, shadowFar ).toVar( 'linearDepth' );
@@ -456,9 +456,9 @@ class CSMShadowNode extends ShadowBaseNode {
456
456
  _setupStandard() {
457
457
 
458
458
  const cameraNear = reference( 'camera.near', 'float', this ).setGroup( renderGroup );
459
- const cascades = reference( '_cascades', 'vec2', this ).setGroup( renderGroup ).label( 'cascades' );
459
+ const cascades = reference( '_cascades', 'vec2', this ).setGroup( renderGroup ).setName( 'cascades' );
460
460
 
461
- const shadowFar = uniform( 'float' ).setGroup( renderGroup ).label( 'shadowFar' )
461
+ const shadowFar = uniform( 'float' ).setGroup( renderGroup ).setName( 'shadowFar' )
462
462
  .onRenderUpdate( () => Math.min( this.maxFar, this.camera.far ) );
463
463
 
464
464
  const linearDepth = viewZToOrthographicDepth( positionView.z, cameraNear, shadowFar ).toVar( 'linearDepth' );
@@ -3,7 +3,7 @@ import {
3
3
  BoxGeometry,
4
4
  InstancedMesh,
5
5
  Mesh,
6
- MeshBasicMaterial,
6
+ MeshLambertMaterial,
7
7
  MeshStandardMaterial,
8
8
  PointLight,
9
9
  Scene,
@@ -168,8 +168,13 @@ class RoomEnvironment extends Scene {
168
168
 
169
169
  function createAreaLightMaterial( intensity ) {
170
170
 
171
- const material = new MeshBasicMaterial();
172
- material.color.setScalar( intensity );
171
+ // create an emissive-only material. see #31348
172
+ const material = new MeshLambertMaterial( {
173
+ color: 0x000000,
174
+ emissive: 0xffffff,
175
+ emissiveIntensity: intensity
176
+ } );
177
+
173
178
  return material;
174
179
 
175
180
  }
@@ -543,32 +543,36 @@ function getCanvas() {
543
543
 
544
544
  function getToBlobPromise( canvas, mimeType ) {
545
545
 
546
- if ( canvas.toBlob !== undefined ) {
546
+ if ( typeof OffscreenCanvas !== 'undefined' && canvas instanceof OffscreenCanvas ) {
547
547
 
548
- return new Promise( ( resolve ) => canvas.toBlob( resolve, mimeType ) );
548
+ let quality;
549
549
 
550
- }
550
+ // Blink's implementation of convertToBlob seems to default to a quality level of 100%
551
+ // Use the Blink default quality levels of toBlob instead so that file sizes are comparable.
552
+ if ( mimeType === 'image/jpeg' ) {
551
553
 
552
- let quality;
554
+ quality = 0.92;
553
555
 
554
- // Blink's implementation of convertToBlob seems to default to a quality level of 100%
555
- // Use the Blink default quality levels of toBlob instead so that file sizes are comparable.
556
- if ( mimeType === 'image/jpeg' ) {
556
+ } else if ( mimeType === 'image/webp' ) {
557
557
 
558
- quality = 0.92;
558
+ quality = 0.8;
559
559
 
560
- } else if ( mimeType === 'image/webp' ) {
560
+ }
561
561
 
562
- quality = 0.8;
562
+ return canvas.convertToBlob( {
563
563
 
564
- }
564
+ type: mimeType,
565
+ quality: quality
565
566
 
566
- return canvas.convertToBlob( {
567
+ } );
567
568
 
568
- type: mimeType,
569
- quality: quality
569
+ } else {
570
570
 
571
- } );
571
+ // HTMLCanvasElement code path
572
+
573
+ return new Promise( ( resolve ) => canvas.toBlob( resolve, mimeType ) );
574
+
575
+ }
572
576
 
573
577
  }
574
578
 
@@ -757,7 +761,7 @@ class GLTFWriter {
757
761
  /**
758
762
  * Serializes a userData.
759
763
  *
760
- * @param {THREE.Object3D|THREE.Material} object
764
+ * @param {THREE.Object3D|THREE.Material|THREE.BufferGeometry|THREE.AnimationClip} object
761
765
  * @param {Object} objectDef
762
766
  */
763
767
  serializeUserData( object, objectDef ) {
@@ -1555,7 +1559,7 @@ class GLTFWriter {
1555
1559
  /**
1556
1560
  * Process material
1557
1561
  * @param {THREE.Material} material Material to process
1558
- * @return {Promise<number|null>} Index of the processed material in the "materials" array
1562
+ * @return {Promise<?number>} Index of the processed material in the "materials" array
1559
1563
  */
1560
1564
  async processMaterialAsync( material ) {
1561
1565
 
@@ -1731,7 +1735,7 @@ class GLTFWriter {
1731
1735
  /**
1732
1736
  * Process mesh
1733
1737
  * @param {THREE.Mesh} mesh Mesh to process
1734
- * @return {Promise<number|null>} Index of the processed mesh in the "meshes" array
1738
+ * @return {Promise<?number>} Index of the processed mesh in the "meshes" array
1735
1739
  */
1736
1740
  async processMeshAsync( mesh ) {
1737
1741
 
@@ -2185,7 +2189,7 @@ class GLTFWriter {
2185
2189
  *
2186
2190
  * @param {THREE.AnimationClip} clip
2187
2191
  * @param {THREE.Object3D} root
2188
- * @return {number|null}
2192
+ * @return {?number}
2189
2193
  */
2190
2194
  processAnimation( clip, root ) {
2191
2195
 
@@ -2279,11 +2283,15 @@ class GLTFWriter {
2279
2283
 
2280
2284
  }
2281
2285
 
2282
- json.animations.push( {
2286
+ const animationDef = {
2283
2287
  name: clip.name || 'clip_' + json.animations.length,
2284
2288
  samplers: samplers,
2285
2289
  channels: channels
2286
- } );
2290
+ };
2291
+
2292
+ this.serializeUserData( clip, animationDef );
2293
+
2294
+ json.animations.push( animationDef );
2287
2295
 
2288
2296
  return json.animations.length - 1;
2289
2297
 
@@ -2291,7 +2299,7 @@ class GLTFWriter {
2291
2299
 
2292
2300
  /**
2293
2301
  * @param {THREE.Object3D} object
2294
- * @return {number|null}
2302
+ * @return {?number}
2295
2303
  */
2296
2304
  processSkin( object ) {
2297
2305
 
@@ -17,8 +17,8 @@ import {
17
17
  } from 'three';
18
18
 
19
19
  import {
20
+ createDefaultContainer,
20
21
  write,
21
- KTX2Container,
22
22
  KHR_DF_CHANNEL_RGBSDA_ALPHA,
23
23
  KHR_DF_CHANNEL_RGBSDA_BLUE,
24
24
  KHR_DF_CHANNEL_RGBSDA_GREEN,
@@ -191,7 +191,7 @@ export class KTX2Exporter {
191
191
 
192
192
  const array = texture.image.data;
193
193
  const channelCount = getChannelCount( texture );
194
- const container = new KTX2Container();
194
+ const container = createDefaultContainer();
195
195
 
196
196
  container.vkFormat = VK_FORMAT_MAP[ texture.format ][ texture.type ][ texture.colorSpace ];
197
197
  container.typeSize = array.BYTES_PER_ELEMENT;
@@ -257,6 +257,8 @@ export class KTX2Exporter {
257
257
 
258
258
  //
259
259
 
260
+ container.levelCount = 1;
261
+
260
262
  container.levels = [ {
261
263
 
262
264
  levelData: new Uint8Array( array.buffer, array.byteOffset, array.byteLength ),
@@ -31,7 +31,7 @@ class PLYExporter {
31
31
  * @param {Object3D} object - The 3D object to export.
32
32
  * @param {PLYExporter~OnDone} onDone - A callback function that is executed when the export has finished.
33
33
  * @param {PLYExporter~Options} options - The export options.
34
- * @return {?string|ArrayBuffer} The exported PLY.
34
+ * @return {?(string|ArrayBuffer)} The exported PLY.
35
35
  */
36
36
  parse( object, onDone, options = {} ) {
37
37