super-three 0.160.1 → 0.162.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 (225) hide show
  1. package/LICENSE +1 -1
  2. package/build/three.cjs +867 -499
  3. package/build/three.module.js +867 -496
  4. package/build/three.module.min.js +1 -1
  5. package/examples/jsm/Addons.js +5 -1
  6. package/examples/jsm/capabilities/WebGPU.js +13 -9
  7. package/examples/jsm/controls/DragControls.js +91 -30
  8. package/examples/jsm/controls/OrbitControls.js +130 -15
  9. package/examples/jsm/controls/TransformControls.js +6 -6
  10. package/examples/jsm/curves/NURBSUtils.js +59 -4
  11. package/examples/jsm/curves/NURBSVolume.js +62 -0
  12. package/examples/jsm/exporters/GLTFExporter.js +11 -1
  13. package/examples/jsm/exporters/USDZExporter.js +8 -7
  14. package/examples/jsm/helpers/TextureHelper.js +3 -3
  15. package/examples/jsm/interactive/InteractiveGroup.js +15 -25
  16. package/examples/jsm/libs/rhino3dm/rhino3dm.js +1 -8723
  17. package/examples/jsm/libs/rhino3dm/rhino3dm.module.js +1 -8734
  18. package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
  19. package/examples/jsm/libs/tween.module.js +32 -14
  20. package/examples/jsm/loaders/3DMLoader.js +57 -64
  21. package/examples/jsm/loaders/DDSLoader.js +1 -0
  22. package/examples/jsm/loaders/KTX2Loader.js +20 -5
  23. package/examples/jsm/loaders/LUT3dlLoader.js +78 -46
  24. package/examples/jsm/loaders/LUTCubeLoader.js +81 -67
  25. package/examples/jsm/loaders/LUTImageLoader.js +3 -2
  26. package/examples/jsm/loaders/MaterialXLoader.js +115 -16
  27. package/examples/jsm/loaders/SVGLoader.js +4 -3
  28. package/examples/jsm/loaders/VOXLoader.js +9 -2
  29. package/examples/jsm/loaders/VRMLLoader.js +7 -3
  30. package/examples/jsm/materials/MeshPostProcessingMaterial.js +144 -0
  31. package/examples/jsm/misc/ProgressiveLightMap.js +1 -0
  32. package/examples/jsm/misc/Timer.js +13 -4
  33. package/examples/jsm/nodes/Nodes.js +24 -11
  34. package/examples/jsm/nodes/accessors/AccessorsUtils.js +10 -0
  35. package/examples/jsm/nodes/accessors/BufferAttributeNode.js +5 -3
  36. package/examples/jsm/nodes/accessors/CameraNode.js +9 -4
  37. package/examples/jsm/nodes/accessors/ClippingNode.js +144 -0
  38. package/examples/jsm/nodes/accessors/CubeTextureNode.js +12 -1
  39. package/examples/jsm/nodes/accessors/MaterialNode.js +2 -2
  40. package/examples/jsm/nodes/accessors/MaterialReferenceNode.js +2 -12
  41. package/examples/jsm/nodes/accessors/MorphNode.js +8 -8
  42. package/examples/jsm/nodes/accessors/ReferenceNode.js +87 -29
  43. package/examples/jsm/nodes/accessors/SkinningNode.js +31 -10
  44. package/examples/jsm/nodes/accessors/StorageBufferNode.js +45 -0
  45. package/examples/jsm/nodes/accessors/TangentNode.js +8 -2
  46. package/examples/jsm/nodes/accessors/TextureNode.js +1 -1
  47. package/examples/jsm/nodes/accessors/TextureStoreNode.js +56 -3
  48. package/examples/jsm/nodes/accessors/UniformsNode.js +140 -0
  49. package/examples/jsm/nodes/accessors/VertexColorNode.js +70 -0
  50. package/examples/jsm/nodes/code/CodeNode.js +6 -0
  51. package/examples/jsm/nodes/core/AssignNode.js +68 -12
  52. package/examples/jsm/nodes/core/AttributeNode.js +1 -1
  53. package/examples/jsm/nodes/core/Node.js +14 -4
  54. package/examples/jsm/nodes/core/NodeBuilder.js +26 -27
  55. package/examples/jsm/nodes/core/NodeFrame.js +18 -10
  56. package/examples/jsm/nodes/core/TempNode.js +1 -1
  57. package/examples/jsm/nodes/core/constants.js +1 -0
  58. package/examples/jsm/nodes/display/AfterImageNode.js +148 -0
  59. package/examples/jsm/nodes/display/AnamorphicNode.js +148 -0
  60. package/examples/jsm/nodes/display/BlendModeNode.js +30 -1
  61. package/examples/jsm/nodes/display/ColorAdjustmentNode.js +3 -0
  62. package/examples/jsm/nodes/display/GaussianBlurNode.js +33 -13
  63. package/examples/jsm/nodes/display/NormalMapNode.js +3 -5
  64. package/examples/jsm/nodes/display/PassNode.js +3 -2
  65. package/examples/jsm/nodes/display/ToneMappingNode.js +46 -3
  66. package/examples/jsm/nodes/display/ViewportDepthTextureNode.js +1 -4
  67. package/examples/jsm/nodes/display/ViewportNode.js +0 -2
  68. package/examples/jsm/nodes/display/ViewportSharedTextureNode.js +4 -4
  69. package/examples/jsm/nodes/fog/FogNode.js +2 -1
  70. package/examples/jsm/nodes/lighting/AmbientLightNode.js +1 -1
  71. package/examples/jsm/nodes/lighting/AnalyticLightNode.js +13 -5
  72. package/examples/jsm/nodes/lighting/LightingContextNode.js +1 -1
  73. package/examples/jsm/nodes/lighting/LightsNode.js +1 -1
  74. package/examples/jsm/nodes/materials/Line2NodeMaterial.js +18 -30
  75. package/examples/jsm/nodes/materials/Materials.js +1 -0
  76. package/examples/jsm/nodes/materials/MeshSSSNodeMaterial.js +84 -0
  77. package/examples/jsm/nodes/materials/NodeMaterial.js +43 -10
  78. package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +1 -7
  79. package/examples/jsm/nodes/math/CondNode.js +42 -7
  80. package/examples/jsm/nodes/math/MathNode.js +32 -2
  81. package/examples/jsm/nodes/math/MathUtils.js +15 -0
  82. package/examples/jsm/nodes/math/OperatorNode.js +13 -5
  83. package/examples/jsm/nodes/math/TriNoise3D.js +71 -0
  84. package/examples/jsm/nodes/shadernode/ShaderNode.js +10 -1
  85. package/examples/jsm/nodes/utils/JoinNode.js +2 -2
  86. package/examples/jsm/nodes/utils/LoopNode.js +5 -3
  87. package/examples/jsm/nodes/utils/ReflectorNode.js +227 -0
  88. package/examples/jsm/nodes/utils/RotateNode.js +68 -0
  89. package/examples/jsm/nodes/utils/RotateUVNode.js +1 -9
  90. package/examples/jsm/nodes/utils/SplitNode.js +4 -4
  91. package/examples/jsm/nodes/utils/StorageArrayElementNode.js +91 -0
  92. package/examples/jsm/objects/GroundedSkybox.js +50 -0
  93. package/examples/jsm/objects/QuadMesh.js +8 -2
  94. package/examples/jsm/objects/Water2.js +8 -8
  95. package/examples/jsm/postprocessing/GTAOPass.js +11 -1
  96. package/examples/jsm/postprocessing/OutputPass.js +2 -0
  97. package/examples/jsm/renderers/common/Backend.js +14 -0
  98. package/examples/jsm/renderers/common/Background.js +2 -2
  99. package/examples/jsm/renderers/common/Bindings.js +1 -1
  100. package/examples/jsm/renderers/common/ClippingContext.js +165 -0
  101. package/examples/jsm/renderers/common/DataMap.js +1 -1
  102. package/examples/jsm/renderers/common/Info.js +25 -1
  103. package/examples/jsm/renderers/common/Pipelines.js +8 -8
  104. package/examples/jsm/renderers/common/PostProcessing.js +2 -2
  105. package/examples/jsm/renderers/common/ProgrammableStage.js +3 -1
  106. package/examples/jsm/renderers/common/RenderContext.js +2 -0
  107. package/examples/jsm/renderers/common/RenderContexts.js +2 -13
  108. package/examples/jsm/renderers/common/RenderObject.js +46 -1
  109. package/examples/jsm/renderers/common/RenderObjects.js +3 -1
  110. package/examples/jsm/renderers/common/Renderer.js +290 -17
  111. package/examples/jsm/renderers/common/StorageBufferAttribute.js +17 -0
  112. package/examples/jsm/renderers/common/StorageInstancedBufferAttribute.js +17 -0
  113. package/examples/jsm/renderers/common/Textures.js +28 -18
  114. package/examples/jsm/renderers/common/UniformsGroup.js +6 -4
  115. package/examples/jsm/renderers/common/nodes/NodeBuilderState.js +2 -1
  116. package/examples/jsm/renderers/common/nodes/NodeStorageBuffer.js +23 -0
  117. package/examples/jsm/renderers/common/nodes/NodeUniformBuffer.js +23 -0
  118. package/examples/jsm/renderers/common/nodes/Nodes.js +5 -2
  119. package/examples/jsm/renderers/webgl/WebGLBackend.js +653 -272
  120. package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +171 -39
  121. package/examples/jsm/renderers/webgl/utils/WebGLAttributeUtils.js +95 -8
  122. package/examples/jsm/renderers/webgl/utils/WebGLConstants.js +11 -0
  123. package/examples/jsm/renderers/webgl/utils/WebGLState.js +197 -0
  124. package/examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js +424 -11
  125. package/examples/jsm/renderers/webgl/utils/WebGLUtils.js +3 -2
  126. package/examples/jsm/renderers/webgl-legacy/nodes/GLSL1NodeBuilder.js +1 -21
  127. package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodeBuilder.js +2 -2
  128. package/examples/jsm/renderers/webgpu/WebGPUBackend.js +300 -112
  129. package/examples/jsm/renderers/webgpu/WebGPURenderer.js +7 -2
  130. package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +71 -79
  131. package/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +15 -1
  132. package/examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js +38 -4
  133. package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +87 -14
  134. package/examples/jsm/shaders/OutputShader.js +4 -0
  135. package/examples/jsm/transpiler/AST.js +1 -1
  136. package/examples/jsm/transpiler/GLSLDecoder.js +1 -1
  137. package/examples/jsm/transpiler/ShaderToyDecoder.js +1 -1
  138. package/examples/jsm/transpiler/TSLEncoder.js +1 -1
  139. package/examples/jsm/utils/BufferGeometryUtils.js +23 -27
  140. package/examples/jsm/utils/SkeletonUtils.js +14 -3
  141. package/examples/jsm/utils/SortUtils.js +2 -0
  142. package/examples/jsm/webxr/ARButton.js +12 -2
  143. package/examples/jsm/webxr/VRButton.js +25 -7
  144. package/examples/jsm/webxr/XRButton.js +12 -3
  145. package/examples/jsm/webxr/XRControllerModelFactory.js +14 -1
  146. package/examples/jsm/webxr/XRHandMeshModel.js +3 -1
  147. package/package.json +5 -4
  148. package/src/Three.Legacy.js +20 -0
  149. package/src/Three.js +0 -1
  150. package/src/audio/Audio.js +1 -3
  151. package/src/cameras/PerspectiveCamera.js +35 -0
  152. package/src/constants.js +2 -6
  153. package/src/core/BufferAttribute.js +2 -12
  154. package/src/core/BufferGeometry.js +23 -29
  155. package/src/core/InterleavedBuffer.js +2 -1
  156. package/src/core/InterleavedBufferAttribute.js +20 -0
  157. package/src/core/Object3D.js +11 -0
  158. package/src/core/Raycaster.js +18 -4
  159. package/src/core/RenderTarget.js +44 -21
  160. package/src/extras/PMREMGenerator.js +2 -0
  161. package/src/extras/curves/EllipseCurve.js +2 -2
  162. package/src/helpers/SpotLightHelper.js +18 -1
  163. package/src/loaders/DataTextureLoader.js +0 -4
  164. package/src/loaders/MaterialLoader.js +1 -0
  165. package/src/loaders/ObjectLoader.js +2 -1
  166. package/src/materials/Material.js +2 -1
  167. package/src/materials/MeshBasicMaterial.js +3 -0
  168. package/src/materials/MeshLambertMaterial.js +3 -0
  169. package/src/materials/MeshPhongMaterial.js +3 -0
  170. package/src/materials/MeshStandardMaterial.js +3 -0
  171. package/src/materials/ShaderMaterial.js +2 -1
  172. package/src/math/Quaternion.js +13 -12
  173. package/src/math/Triangle.js +0 -30
  174. package/src/math/Vector3.js +7 -7
  175. package/src/objects/BatchedMesh.js +6 -7
  176. package/src/objects/InstancedMesh.js +53 -0
  177. package/src/objects/Mesh.js +0 -1
  178. package/src/objects/SkinnedMesh.js +0 -8
  179. package/src/renderers/WebGLCubeRenderTarget.js +1 -10
  180. package/src/renderers/WebGLRenderer.js +20 -23
  181. package/src/renderers/shaders/ShaderChunk/alphatest_fragment.glsl.js +9 -0
  182. package/src/renderers/shaders/ShaderChunk/clipping_planes_fragment.glsl.js +56 -11
  183. package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +1 -0
  184. package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +1 -1
  185. package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +2 -2
  186. package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +1 -1
  187. package/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.js +14 -0
  188. package/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.js +11 -2
  189. package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +38 -7
  190. package/src/renderers/shaders/ShaderChunk.js +2 -0
  191. package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +3 -2
  192. package/src/renderers/shaders/ShaderLib/depth.glsl.js +3 -2
  193. package/src/renderers/shaders/ShaderLib/distanceRGBA.glsl.js +3 -2
  194. package/src/renderers/shaders/ShaderLib/linedashed.glsl.js +2 -1
  195. package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +2 -2
  196. package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +2 -1
  197. package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +2 -2
  198. package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +4 -1
  199. package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +2 -1
  200. package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +2 -1
  201. package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +2 -1
  202. package/src/renderers/shaders/ShaderLib/points.glsl.js +2 -1
  203. package/src/renderers/shaders/ShaderLib/shadow.glsl.js +1 -0
  204. package/src/renderers/shaders/ShaderLib/sprite.glsl.js +1 -1
  205. package/src/renderers/shaders/ShaderLib.js +2 -1
  206. package/src/renderers/shaders/UniformsLib.js +1 -0
  207. package/src/renderers/webgl/WebGLAttributes.js +2 -2
  208. package/src/renderers/webgl/WebGLBackground.js +18 -0
  209. package/src/renderers/webgl/WebGLCubeMaps.js +1 -1
  210. package/src/renderers/webgl/WebGLMaterials.js +24 -1
  211. package/src/renderers/webgl/WebGLMorphtargets.js +15 -8
  212. package/src/renderers/webgl/WebGLProgram.js +42 -4
  213. package/src/renderers/webgl/WebGLPrograms.js +38 -27
  214. package/src/renderers/webgl/WebGLState.js +11 -21
  215. package/src/renderers/webgl/WebGLTextures.js +170 -66
  216. package/src/renderers/webxr/WebXRDepthSensing.js +105 -0
  217. package/src/renderers/webxr/WebXRManager.js +46 -0
  218. package/src/scenes/Scene.js +8 -0
  219. package/src/textures/Source.js +1 -0
  220. package/src/textures/Texture.js +1 -29
  221. package/build/three.js +0 -54519
  222. package/build/three.min.js +0 -7
  223. package/examples/jsm/nodes/core/ArrayUniformNode.js +0 -26
  224. package/examples/jsm/objects/GroundProjectedSkybox.js +0 -172
  225. package/src/renderers/WebGLMultipleRenderTargets.js +0 -82
@@ -1,9 +1,8 @@
1
1
  import { EventDispatcher } from './EventDispatcher.js';
2
2
  import { Texture } from '../textures/Texture.js';
3
- import { LinearFilter, NoColorSpace, SRGBColorSpace, sRGBEncoding } from '../constants.js';
3
+ import { LinearFilter } from '../constants.js';
4
4
  import { Vector4 } from '../math/Vector4.js';
5
5
  import { Source } from '../textures/Source.js';
6
- import { warnOnce } from '../utils.js';
7
6
 
8
7
  /*
9
8
  In options, we can specify:
@@ -29,14 +28,6 @@ class RenderTarget extends EventDispatcher {
29
28
 
30
29
  const image = { width: width, height: height, depth: 1 };
31
30
 
32
- if ( options.encoding !== undefined ) {
33
-
34
- // @deprecated, r152
35
- warnOnce( 'THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace.' );
36
- options.colorSpace = options.encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;
37
-
38
- }
39
-
40
31
  options = Object.assign( {
41
32
  generateMipmaps: false,
42
33
  internalFormat: null,
@@ -44,15 +35,25 @@ class RenderTarget extends EventDispatcher {
44
35
  depthBuffer: true,
45
36
  stencilBuffer: false,
46
37
  depthTexture: null,
47
- samples: 0
38
+ samples: 0,
39
+ count: 1
48
40
  }, options );
49
41
 
50
- this.texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );
51
- this.texture.isRenderTargetTexture = true;
42
+ const texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );
43
+
44
+ texture.flipY = false;
45
+ texture.generateMipmaps = options.generateMipmaps;
46
+ texture.internalFormat = options.internalFormat;
47
+
48
+ this.textures = [];
52
49
 
53
- this.texture.flipY = false;
54
- this.texture.generateMipmaps = options.generateMipmaps;
55
- this.texture.internalFormat = options.internalFormat;
50
+ const count = options.count;
51
+ for ( let i = 0; i < count; i ++ ) {
52
+
53
+ this.textures[ i ] = texture.clone();
54
+ this.textures[ i ].isRenderTargetTexture = true;
55
+
56
+ }
56
57
 
57
58
  this.depthBuffer = options.depthBuffer;
58
59
  this.stencilBuffer = options.stencilBuffer;
@@ -63,6 +64,18 @@ class RenderTarget extends EventDispatcher {
63
64
 
64
65
  }
65
66
 
67
+ get texture() {
68
+
69
+ return this.textures[ 0 ];
70
+
71
+ }
72
+
73
+ set texture( value ) {
74
+
75
+ this.textures[ 0 ] = value;
76
+
77
+ }
78
+
66
79
  setSize( width, height, depth = 1 ) {
67
80
 
68
81
  if ( this.width !== width || this.height !== height || this.depth !== depth ) {
@@ -71,9 +84,13 @@ class RenderTarget extends EventDispatcher {
71
84
  this.height = height;
72
85
  this.depth = depth;
73
86
 
74
- this.texture.image.width = width;
75
- this.texture.image.height = height;
76
- this.texture.image.depth = depth;
87
+ for ( let i = 0, il = this.textures.length; i < il; i ++ ) {
88
+
89
+ this.textures[ i ].image.width = width;
90
+ this.textures[ i ].image.height = height;
91
+ this.textures[ i ].image.depth = depth;
92
+
93
+ }
77
94
 
78
95
  this.dispose();
79
96
 
@@ -101,8 +118,14 @@ class RenderTarget extends EventDispatcher {
101
118
 
102
119
  this.viewport.copy( source.viewport );
103
120
 
104
- this.texture = source.texture.clone();
105
- this.texture.isRenderTargetTexture = true;
121
+ this.textures.length = 0;
122
+
123
+ for ( let i = 0, il = source.textures.length; i < il; i ++ ) {
124
+
125
+ this.textures[ i ] = source.textures[ i ].clone();
126
+ this.textures[ i ].isRenderTargetTexture = true;
127
+
128
+ }
106
129
 
107
130
  // ensure image object is not shared, see #20328
108
131
 
@@ -132,6 +132,7 @@ class PMREMGenerator {
132
132
  * Generates a PMREM from an equirectangular texture, which can be either LDR
133
133
  * or HDR. The ideal input image size is 1k (1024 x 512),
134
134
  * as this matches best with the 256 x 256 cubemap output.
135
+ * The smallest supported equirectangular image size is 64 x 32.
135
136
  */
136
137
  fromEquirectangular( equirectangular, renderTarget = null ) {
137
138
 
@@ -143,6 +144,7 @@ class PMREMGenerator {
143
144
  * Generates a PMREM from an cubemap texture, which can be either LDR
144
145
  * or HDR. The ideal input cube size is 256 x 256,
145
146
  * as this matches best with the 256 x 256 cubemap output.
147
+ * The smallest supported cube size is 16 x 16.
146
148
  */
147
149
  fromCubemap( cubemap, renderTarget = null ) {
148
150
 
@@ -26,9 +26,9 @@ class EllipseCurve extends Curve {
26
26
 
27
27
  }
28
28
 
29
- getPoint( t, optionalTarget ) {
29
+ getPoint( t, optionalTarget = new Vector2() ) {
30
30
 
31
- const point = optionalTarget || new Vector2();
31
+ const point = optionalTarget;
32
32
 
33
33
  const twoPi = Math.PI * 2;
34
34
  let deltaAngle = this.aEndAngle - this.aStartAngle;
@@ -15,7 +15,6 @@ class SpotLightHelper extends Object3D {
15
15
 
16
16
  this.light = light;
17
17
 
18
- this.matrix = light.matrixWorld;
19
18
  this.matrixAutoUpdate = false;
20
19
 
21
20
  this.color = color;
@@ -67,6 +66,24 @@ class SpotLightHelper extends Object3D {
67
66
  this.light.updateWorldMatrix( true, false );
68
67
  this.light.target.updateWorldMatrix( true, false );
69
68
 
69
+ // update the local matrix based on the parent and light target transforms
70
+ if ( this.parent ) {
71
+
72
+ this.parent.updateWorldMatrix( true );
73
+
74
+ this.matrix
75
+ .copy( this.parent.matrixWorld )
76
+ .invert()
77
+ .multiply( this.light.matrixWorld );
78
+
79
+ } else {
80
+
81
+ this.matrix.copy( this.light.matrixWorld );
82
+
83
+ }
84
+
85
+ this.matrixWorld.copy( this.light.matrixWorld );
86
+
70
87
  const coneLength = this.light.distance ? this.light.distance : 1000;
71
88
  const coneWidth = coneLength * Math.tan( this.light.angle );
72
89
 
@@ -75,10 +75,6 @@ class DataTextureLoader extends Loader {
75
75
 
76
76
  texture.colorSpace = texData.colorSpace;
77
77
 
78
- } else if ( texData.encoding !== undefined ) { // @deprecated, r152
79
-
80
- texture.encoding = texData.encoding;
81
-
82
78
  }
83
79
 
84
80
  if ( texData.flipY !== undefined ) {
@@ -300,6 +300,7 @@ class MaterialLoader extends Loader {
300
300
  if ( json.specularColorMap !== undefined ) material.specularColorMap = getTexture( json.specularColorMap );
301
301
 
302
302
  if ( json.envMap !== undefined ) material.envMap = getTexture( json.envMap );
303
+ if ( json.envMapRotation !== undefined ) material.envMapRotation.fromArray( json.envMapRotation );
303
304
  if ( json.envMapIntensity !== undefined ) material.envMapIntensity = json.envMapIntensity;
304
305
 
305
306
  if ( json.reflectivity !== undefined ) material.reflectivity = json.reflectivity;
@@ -674,7 +674,6 @@ class ObjectLoader extends Loader {
674
674
  if ( data.internalFormat !== undefined ) texture.internalFormat = data.internalFormat;
675
675
  if ( data.type !== undefined ) texture.type = data.type;
676
676
  if ( data.colorSpace !== undefined ) texture.colorSpace = data.colorSpace;
677
- if ( data.encoding !== undefined ) texture.encoding = data.encoding; // @deprecated, r152
678
677
 
679
678
  if ( data.minFilter !== undefined ) texture.minFilter = parseConstant( data.minFilter, TEXTURE_FILTER );
680
679
  if ( data.magFilter !== undefined ) texture.magFilter = parseConstant( data.magFilter, TEXTURE_FILTER );
@@ -813,6 +812,8 @@ class ObjectLoader extends Loader {
813
812
 
814
813
  if ( data.backgroundBlurriness !== undefined ) object.backgroundBlurriness = data.backgroundBlurriness;
815
814
  if ( data.backgroundIntensity !== undefined ) object.backgroundIntensity = data.backgroundIntensity;
815
+ if ( data.backgroundRotation !== undefined ) object.backgroundRotation.fromArray( data.backgroundRotation );
816
+ if ( data.environmentRotation !== undefined ) object.environmentRotation.fromArray( data.environmentRotation );
816
817
 
817
818
  break;
818
819
 
@@ -190,7 +190,7 @@ class Material extends EventDispatcher {
190
190
  if ( this.sheenColor && this.sheenColor.isColor ) data.sheenColor = this.sheenColor.getHex();
191
191
  if ( this.sheenRoughness !== undefined ) data.sheenRoughness = this.sheenRoughness;
192
192
  if ( this.emissive && this.emissive.isColor ) data.emissive = this.emissive.getHex();
193
- if ( this.emissiveIntensity && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity;
193
+ if ( this.emissiveIntensity !== undefined && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity;
194
194
 
195
195
  if ( this.specular && this.specular.isColor ) data.specular = this.specular.getHex();
196
196
  if ( this.specularIntensity !== undefined ) data.specularIntensity = this.specularIntensity;
@@ -300,6 +300,7 @@ class Material extends EventDispatcher {
300
300
 
301
301
  }
302
302
 
303
+ if ( this.envMapRotation !== undefined ) data.envMapRotation = this.envMapRotation.toArray();
303
304
  if ( this.envMapIntensity !== undefined ) data.envMapIntensity = this.envMapIntensity;
304
305
  if ( this.reflectivity !== undefined ) data.reflectivity = this.reflectivity;
305
306
  if ( this.refractionRatio !== undefined ) data.refractionRatio = this.refractionRatio;
@@ -1,6 +1,7 @@
1
1
  import { Material } from './Material.js';
2
2
  import { MultiplyOperation } from '../constants.js';
3
3
  import { Color } from '../math/Color.js';
4
+ import { Euler } from '../math/Euler.js';
4
5
 
5
6
  class MeshBasicMaterial extends Material {
6
7
 
@@ -27,6 +28,7 @@ class MeshBasicMaterial extends Material {
27
28
  this.alphaMap = null;
28
29
 
29
30
  this.envMap = null;
31
+ this.envMapRotation = new Euler();
30
32
  this.combine = MultiplyOperation;
31
33
  this.reflectivity = 1;
32
34
  this.refractionRatio = 0.98;
@@ -61,6 +63,7 @@ class MeshBasicMaterial extends Material {
61
63
  this.alphaMap = source.alphaMap;
62
64
 
63
65
  this.envMap = source.envMap;
66
+ this.envMapRotation.copy( source.envMapRotation );
64
67
  this.combine = source.combine;
65
68
  this.reflectivity = source.reflectivity;
66
69
  this.refractionRatio = source.refractionRatio;
@@ -2,6 +2,7 @@ import { MultiplyOperation, TangentSpaceNormalMap } from '../constants.js';
2
2
  import { Material } from './Material.js';
3
3
  import { Vector2 } from '../math/Vector2.js';
4
4
  import { Color } from '../math/Color.js';
5
+ import { Euler } from '../math/Euler.js';
5
6
 
6
7
  class MeshLambertMaterial extends Material {
7
8
 
@@ -43,6 +44,7 @@ class MeshLambertMaterial extends Material {
43
44
  this.alphaMap = null;
44
45
 
45
46
  this.envMap = null;
47
+ this.envMapRotation = new Euler();
46
48
  this.combine = MultiplyOperation;
47
49
  this.reflectivity = 1;
48
50
  this.refractionRatio = 0.98;
@@ -94,6 +96,7 @@ class MeshLambertMaterial extends Material {
94
96
  this.alphaMap = source.alphaMap;
95
97
 
96
98
  this.envMap = source.envMap;
99
+ this.envMapRotation.copy( source.envMapRotation );
97
100
  this.combine = source.combine;
98
101
  this.reflectivity = source.reflectivity;
99
102
  this.refractionRatio = source.refractionRatio;
@@ -2,6 +2,7 @@ import { MultiplyOperation, TangentSpaceNormalMap } from '../constants.js';
2
2
  import { Material } from './Material.js';
3
3
  import { Vector2 } from '../math/Vector2.js';
4
4
  import { Color } from '../math/Color.js';
5
+ import { Euler } from '../math/Euler.js';
5
6
 
6
7
  class MeshPhongMaterial extends Material {
7
8
 
@@ -45,6 +46,7 @@ class MeshPhongMaterial extends Material {
45
46
  this.alphaMap = null;
46
47
 
47
48
  this.envMap = null;
49
+ this.envMapRotation = new Euler();
48
50
  this.combine = MultiplyOperation;
49
51
  this.reflectivity = 1;
50
52
  this.refractionRatio = 0.98;
@@ -98,6 +100,7 @@ class MeshPhongMaterial extends Material {
98
100
  this.alphaMap = source.alphaMap;
99
101
 
100
102
  this.envMap = source.envMap;
103
+ this.envMapRotation.copy( source.envMapRotation );
101
104
  this.combine = source.combine;
102
105
  this.reflectivity = source.reflectivity;
103
106
  this.refractionRatio = source.refractionRatio;
@@ -2,6 +2,7 @@ import { TangentSpaceNormalMap } from '../constants.js';
2
2
  import { Material } from './Material.js';
3
3
  import { Vector2 } from '../math/Vector2.js';
4
4
  import { Color } from '../math/Color.js';
5
+ import { Euler } from '../math/Euler.js';
5
6
 
6
7
  class MeshStandardMaterial extends Material {
7
8
 
@@ -49,6 +50,7 @@ class MeshStandardMaterial extends Material {
49
50
  this.alphaMap = null;
50
51
 
51
52
  this.envMap = null;
53
+ this.envMapRotation = new Euler();
52
54
  this.envMapIntensity = 1.0;
53
55
 
54
56
  this.wireframe = false;
@@ -104,6 +106,7 @@ class MeshStandardMaterial extends Material {
104
106
  this.alphaMap = source.alphaMap;
105
107
 
106
108
  this.envMap = source.envMap;
109
+ this.envMapRotation.copy( source.envMapRotation );
107
110
  this.envMapIntensity = source.envMapIntensity;
108
111
 
109
112
  this.wireframe = source.wireframe;
@@ -37,7 +37,8 @@ class ShaderMaterial extends Material {
37
37
  fragDepth: false, // set to use fragment depth values
38
38
  drawBuffers: false, // set to use draw buffers
39
39
  shaderTextureLOD: false, // set to use shader texture LOD
40
- clipCullDistance: false // set to use vertex shader clipping
40
+ clipCullDistance: false, // set to use vertex shader clipping
41
+ multiDraw: false // set to use vertex shader multi_draw / enable gl_DrawID
41
42
  };
42
43
 
43
44
  // When rendered geometry doesn't include these attributes but the material does,
@@ -591,23 +591,24 @@ class Quaternion {
591
591
 
592
592
  random() {
593
593
 
594
- // Derived from http://planning.cs.uiuc.edu/node198.html
595
- // Note, this source uses w, x, y, z ordering,
596
- // so we swap the order below.
594
+ // sets this quaternion to a uniform random unit quaternnion
597
595
 
598
- const u1 = Math.random();
599
- const sqrt1u1 = Math.sqrt( 1 - u1 );
600
- const sqrtu1 = Math.sqrt( u1 );
596
+ // Ken Shoemake
597
+ // Uniform random rotations
598
+ // D. Kirk, editor, Graphics Gems III, pages 124-132. Academic Press, New York, 1992.
601
599
 
602
- const u2 = 2 * Math.PI * Math.random();
600
+ const theta1 = 2 * Math.PI * Math.random();
601
+ const theta2 = 2 * Math.PI * Math.random();
603
602
 
604
- const u3 = 2 * Math.PI * Math.random();
603
+ const x0 = Math.random();
604
+ const r1 = Math.sqrt( 1 - x0 );
605
+ const r2 = Math.sqrt( x0 );
605
606
 
606
607
  return this.set(
607
- sqrt1u1 * Math.cos( u2 ),
608
- sqrtu1 * Math.sin( u3 ),
609
- sqrtu1 * Math.cos( u3 ),
610
- sqrt1u1 * Math.sin( u2 ),
608
+ r1 * Math.sin( theta1 ),
609
+ r1 * Math.cos( theta1 ),
610
+ r2 * Math.sin( theta2 ),
611
+ r2 * Math.cos( theta2 ),
611
612
  );
612
613
 
613
614
  }
@@ -12,8 +12,6 @@ const _vap = /*@__PURE__*/ new Vector3();
12
12
  const _vbp = /*@__PURE__*/ new Vector3();
13
13
  const _vcp = /*@__PURE__*/ new Vector3();
14
14
 
15
- let warnedGetUV = false;
16
-
17
15
  class Triangle {
18
16
 
19
17
  constructor( a = new Vector3(), b = new Vector3(), c = new Vector3() ) {
@@ -87,20 +85,6 @@ class Triangle {
87
85
 
88
86
  }
89
87
 
90
- static getUV( point, p1, p2, p3, uv1, uv2, uv3, target ) { // @deprecated, r151
91
-
92
- if ( warnedGetUV === false ) {
93
-
94
- console.warn( 'THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().' );
95
-
96
- warnedGetUV = true;
97
-
98
- }
99
-
100
- return this.getInterpolation( point, p1, p2, p3, uv1, uv2, uv3, target );
101
-
102
- }
103
-
104
88
  static getInterpolation( point, p1, p2, p3, v1, v2, v3, target ) {
105
89
 
106
90
  if ( this.getBarycoord( point, p1, p2, p3, _v3 ) === null ) {
@@ -211,20 +195,6 @@ class Triangle {
211
195
 
212
196
  }
213
197
 
214
- getUV( point, uv1, uv2, uv3, target ) { // @deprecated, r151
215
-
216
- if ( warnedGetUV === false ) {
217
-
218
- console.warn( 'THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().' );
219
-
220
- warnedGetUV = true;
221
-
222
- }
223
-
224
- return Triangle.getInterpolation( point, this.a, this.b, this.c, uv1, uv2, uv3, target );
225
-
226
- }
227
-
228
198
  getInterpolation( point, v1, v2, v3, target ) {
229
199
 
230
200
  return Triangle.getInterpolation( point, this.a, this.b, this.c, v1, v2, v3, target );
@@ -694,15 +694,15 @@ class Vector3 {
694
694
 
695
695
  randomDirection() {
696
696
 
697
- // Derived from https://mathworld.wolfram.com/SpherePointPicking.html
697
+ // https://mathworld.wolfram.com/SpherePointPicking.html
698
698
 
699
- const u = ( Math.random() - 0.5 ) * 2;
700
- const t = Math.random() * Math.PI * 2;
701
- const f = Math.sqrt( 1 - u ** 2 );
699
+ const theta = Math.random() * Math.PI * 2;
700
+ const u = Math.random() * 2 - 1;
701
+ const c = Math.sqrt( 1 - u * u );
702
702
 
703
- this.x = f * Math.cos( t );
704
- this.y = f * Math.sin( t );
705
- this.z = u;
703
+ this.x = c * Math.cos( theta );
704
+ this.y = u;
705
+ this.z = c * Math.sin( theta );
706
706
 
707
707
  return this;
708
708
 
@@ -8,8 +8,6 @@ import { RGBAFormat } from '../constants.js';
8
8
  import { Box3 } from '../math/Box3.js';
9
9
  import { Sphere } from '../math/Sphere.js';
10
10
  import { Frustum } from '../math/Frustum.js';
11
- import { WebGLCoordinateSystem } from '../constants.js';
12
- import { WebGPUCoordinateSystem } from '../constants.js';
13
11
  import { Vector3 } from '../math/Vector3.js';
14
12
 
15
13
  function sortOpaque( a, b ) {
@@ -600,7 +598,7 @@ class BatchedMesh extends Mesh {
600
598
  const active = this._active;
601
599
  if ( active[ id ] === false ) {
602
600
 
603
- return this;
601
+ return null;
604
602
 
605
603
  }
606
604
 
@@ -643,7 +641,7 @@ class BatchedMesh extends Mesh {
643
641
  const active = this._active;
644
642
  if ( active[ id ] === false ) {
645
643
 
646
- return this;
644
+ return null;
647
645
 
648
646
  }
649
647
 
@@ -894,6 +892,7 @@ class BatchedMesh extends Mesh {
894
892
  const index = geometry.getIndex();
895
893
  const bytesPerElement = index === null ? 1 : index.array.BYTES_PER_ELEMENT;
896
894
 
895
+ const active = this._active;
897
896
  const visibility = this._visibility;
898
897
  const multiDrawStarts = this._multiDrawStarts;
899
898
  const multiDrawCounts = this._multiDrawCounts;
@@ -908,7 +907,7 @@ class BatchedMesh extends Mesh {
908
907
  .multiply( this.matrixWorld );
909
908
  _frustum.setFromProjectionMatrix(
910
909
  _projScreenMatrix,
911
- renderer.isWebGPURenderer ? WebGPUCoordinateSystem : WebGLCoordinateSystem
910
+ renderer.coordinateSystem
912
911
  );
913
912
 
914
913
  }
@@ -922,7 +921,7 @@ class BatchedMesh extends Mesh {
922
921
 
923
922
  for ( let i = 0, l = visibility.length; i < l; i ++ ) {
924
923
 
925
- if ( visibility[ i ] ) {
924
+ if ( visibility[ i ] && active[ i ] ) {
926
925
 
927
926
  // get the bounds in world space
928
927
  this.getMatrixAt( i, _matrix );
@@ -976,7 +975,7 @@ class BatchedMesh extends Mesh {
976
975
 
977
976
  for ( let i = 0, l = visibility.length; i < l; i ++ ) {
978
977
 
979
- if ( visibility[ i ] ) {
978
+ if ( visibility[ i ] && active[ i ] ) {
980
979
 
981
980
  // determine whether the batched geometry is within the frustum
982
981
  let culled = false;
@@ -3,6 +3,8 @@ import { Mesh } from './Mesh.js';
3
3
  import { Box3 } from '../math/Box3.js';
4
4
  import { Matrix4 } from '../math/Matrix4.js';
5
5
  import { Sphere } from '../math/Sphere.js';
6
+ import { DataTexture } from '../textures/DataTexture.js';
7
+ import { FloatType, RedFormat } from '../constants.js';
6
8
 
7
9
  const _instanceLocalMatrix = /*@__PURE__*/ new Matrix4();
8
10
  const _instanceWorldMatrix = /*@__PURE__*/ new Matrix4();
@@ -24,6 +26,7 @@ class InstancedMesh extends Mesh {
24
26
 
25
27
  this.instanceMatrix = new InstancedBufferAttribute( new Float32Array( count * 16 ), 16 );
26
28
  this.instanceColor = null;
29
+ this.morphTexture = null;
27
30
 
28
31
  this.count = count;
29
32
 
@@ -129,6 +132,24 @@ class InstancedMesh extends Mesh {
129
132
 
130
133
  }
131
134
 
135
+ getMorphAt( index, object ) {
136
+
137
+ const objectInfluences = object.morphTargetInfluences;
138
+
139
+ const array = this.morphTexture.source.data.data;
140
+
141
+ const len = objectInfluences.length + 1; // All influences + the baseInfluenceSum
142
+
143
+ const dataIndex = index * len + 1; // Skip the baseInfluenceSum at the beginning
144
+
145
+ for ( let i = 0; i < objectInfluences.length; i ++ ) {
146
+
147
+ objectInfluences[ i ] = array[ dataIndex + i ];
148
+
149
+ }
150
+
151
+ }
152
+
132
153
  raycast( raycaster, intersects ) {
133
154
 
134
155
  const matrixWorld = this.matrixWorld;
@@ -199,6 +220,38 @@ class InstancedMesh extends Mesh {
199
220
 
200
221
  }
201
222
 
223
+ setMorphAt( index, object ) {
224
+
225
+ const objectInfluences = object.morphTargetInfluences;
226
+
227
+ const len = objectInfluences.length + 1; // morphBaseInfluence + all influences
228
+
229
+ if ( this.morphTexture === null ) {
230
+
231
+ this.morphTexture = new DataTexture( new Float32Array( len * this.count ), len, this.count, RedFormat, FloatType );
232
+
233
+ }
234
+
235
+ const array = this.morphTexture.source.data.data;
236
+
237
+ let morphInfluencesSum = 0;
238
+
239
+ for ( let i = 0; i < objectInfluences.length; i ++ ) {
240
+
241
+ morphInfluencesSum += objectInfluences[ i ];
242
+
243
+ }
244
+
245
+ const morphBaseInfluence = this.geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;
246
+
247
+ const dataIndex = len * index;
248
+
249
+ array[ dataIndex ] = morphBaseInfluence;
250
+
251
+ array.set( objectInfluences, dataIndex + 1 );
252
+
253
+ }
254
+
202
255
  updateMorphTargets() {
203
256
 
204
257
  }
@@ -388,7 +388,6 @@ function checkGeometryIntersection( object, material, raycaster, ray, uv, uv1, n
388
388
  _uvC.fromBufferAttribute( uv1, c );
389
389
 
390
390
  intersection.uv1 = Triangle.getInterpolation( _intersectionPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2() );
391
- intersection.uv2 = intersection.uv1; // @deprecated, r152
392
391
 
393
392
  }
394
393
 
@@ -252,14 +252,6 @@ class SkinnedMesh extends Mesh {
252
252
 
253
253
  }
254
254
 
255
- boneTransform( index, vector ) { // @deprecated, r151
256
-
257
- console.warn( 'THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151.' );
258
- return this.applyBoneTransform( index, vector );
259
-
260
- }
261
-
262
-
263
255
  }
264
256
 
265
257
  export { SkinnedMesh };
@@ -1,4 +1,4 @@
1
- import { BackSide, LinearFilter, LinearMipmapLinearFilter, NoBlending, NoColorSpace, SRGBColorSpace, sRGBEncoding } from '../constants.js';
1
+ import { BackSide, LinearFilter, LinearMipmapLinearFilter, NoBlending } from '../constants.js';
2
2
  import { Mesh } from '../objects/Mesh.js';
3
3
  import { BoxGeometry } from '../geometries/BoxGeometry.js';
4
4
  import { ShaderMaterial } from '../materials/ShaderMaterial.js';
@@ -6,7 +6,6 @@ import { cloneUniforms } from './shaders/UniformsUtils.js';
6
6
  import { WebGLRenderTarget } from './WebGLRenderTarget.js';
7
7
  import { CubeCamera } from '../cameras/CubeCamera.js';
8
8
  import { CubeTexture } from '../textures/CubeTexture.js';
9
- import { warnOnce } from '../utils.js';
10
9
 
11
10
  class WebGLCubeRenderTarget extends WebGLRenderTarget {
12
11
 
@@ -19,14 +18,6 @@ class WebGLCubeRenderTarget extends WebGLRenderTarget {
19
18
  const image = { width: size, height: size, depth: 1 };
20
19
  const images = [ image, image, image, image, image, image ];
21
20
 
22
- if ( options.encoding !== undefined ) {
23
-
24
- // @deprecated, r152
25
- warnOnce( 'THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace.' );
26
- options.colorSpace = options.encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;
27
-
28
- }
29
-
30
21
  this.texture = new CubeTexture( images, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );
31
22
 
32
23
  // By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)