super-three 0.172.0 → 0.173.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.
- package/LICENSE +1 -1
- package/build/three.cjs +439 -380
- package/build/three.core.js +413 -41
- package/build/three.core.min.js +2 -2
- package/build/three.module.js +28 -344
- package/build/three.module.min.js +2 -2
- package/build/three.tsl.js +11 -3
- package/build/three.tsl.min.js +2 -2
- package/build/three.webgpu.js +7550 -1798
- package/build/three.webgpu.min.js +2 -2
- package/build/three.webgpu.nodes.js +7551 -1798
- package/build/three.webgpu.nodes.min.js +2 -2
- package/examples/jsm/animation/CCDIKSolver.js +6 -5
- package/examples/jsm/capabilities/WebGPU.js +1 -1
- package/examples/jsm/controls/ArcballControls.js +23 -21
- package/examples/jsm/exporters/GLTFExporter.js +26 -25
- package/examples/jsm/geometries/TextGeometry.js +1 -12
- package/examples/jsm/interactive/InteractiveGroup.js +108 -51
- package/examples/jsm/libs/demuxer_mp4.js +109 -0
- package/examples/jsm/loaders/GCodeLoader.js +3 -1
- package/examples/jsm/loaders/GLTFLoader.js +0 -2
- package/examples/jsm/loaders/TDSLoader.js +0 -1
- package/examples/jsm/materials/MeshGouraudMaterial.js +2 -0
- package/examples/jsm/misc/GPUComputationRenderer.js +6 -7
- package/examples/jsm/misc/ProgressiveLightMap.js +4 -3
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +4 -3
- package/examples/jsm/misc/Volume.js +7 -5
- package/examples/jsm/misc/VolumeSlice.js +5 -3
- package/examples/jsm/objects/WaterMesh.js +25 -20
- package/examples/jsm/physics/JoltPhysics.js +7 -7
- package/examples/jsm/physics/RapierPhysics.js +4 -4
- package/examples/jsm/postprocessing/OutputPass.js +2 -0
- package/examples/jsm/shaders/OutputShader.js +5 -1
- package/examples/jsm/transpiler/GLSLDecoder.js +2 -2
- package/examples/jsm/transpiler/TSLEncoder.js +2 -0
- package/package.json +1 -1
- package/src/Three.Core.js +2 -0
- package/src/Three.TSL.js +9 -1
- package/src/cameras/ArrayCamera.js +1 -0
- package/src/constants.js +6 -1
- package/src/core/BufferAttribute.js +4 -0
- package/src/core/EventDispatcher.js +8 -6
- package/src/extras/ImageUtils.js +1 -11
- package/src/loaders/nodes/NodeObjectLoader.js +1 -1
- package/src/materials/nodes/MeshBasicNodeMaterial.js +1 -1
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +1 -1
- package/src/materials/nodes/NodeMaterial.js +5 -5
- package/src/materials/nodes/NodeMaterials.js +0 -1
- package/src/materials/nodes/PointsNodeMaterial.js +109 -7
- package/src/materials/nodes/SpriteNodeMaterial.js +1 -1
- package/src/materials/nodes/VolumeNodeMaterial.js +3 -3
- package/src/materials/nodes/manager/NodeMaterialObserver.js +8 -0
- package/src/nodes/Nodes.js +4 -0
- package/src/nodes/TSL.js +4 -0
- package/src/nodes/accessors/Arrays.js +30 -8
- package/src/nodes/accessors/BatchNode.js +3 -3
- package/src/nodes/accessors/BufferAttributeNode.js +1 -1
- package/src/nodes/accessors/Camera.js +64 -3
- package/src/nodes/accessors/InstanceNode.js +1 -1
- package/src/nodes/accessors/MaterialNode.js +9 -9
- package/src/nodes/accessors/ModelViewProjectionNode.js +1 -1
- package/src/nodes/accessors/Normal.js +6 -2
- package/src/nodes/accessors/Object3DNode.js +0 -1
- package/src/nodes/accessors/Position.js +6 -6
- package/src/nodes/accessors/ReferenceBaseNode.js +2 -4
- package/src/nodes/accessors/ReferenceNode.js +2 -3
- package/src/nodes/accessors/StorageBufferNode.js +42 -5
- package/src/nodes/accessors/Tangent.js +2 -2
- package/src/nodes/accessors/Texture3DNode.js +1 -1
- package/src/nodes/accessors/TextureNode.js +12 -5
- package/src/nodes/accessors/UniformArrayNode.js +9 -3
- package/src/nodes/accessors/VelocityNode.js +0 -2
- package/src/nodes/code/ScriptableNode.js +3 -3
- package/src/nodes/core/ArrayNode.js +125 -0
- package/src/nodes/core/ConstNode.js +8 -0
- package/src/nodes/core/Node.js +14 -1
- package/src/nodes/core/NodeBuilder.js +229 -19
- package/src/nodes/core/NodeUtils.js +11 -1
- package/src/nodes/core/NodeVar.js +17 -1
- package/src/nodes/core/OutputStructNode.js +19 -9
- package/src/nodes/core/StackNode.js +20 -1
- package/src/nodes/core/StructNode.js +121 -0
- package/src/nodes/core/StructType.js +13 -0
- package/src/nodes/core/StructTypeNode.js +82 -21
- package/src/nodes/core/TempNode.js +1 -1
- package/src/nodes/core/VarNode.js +94 -7
- package/src/nodes/core/VaryingNode.js +19 -3
- package/src/nodes/display/BlendModes.js +88 -1
- package/src/nodes/display/BumpMapNode.js +6 -6
- package/src/nodes/display/NormalMapNode.js +6 -6
- package/src/nodes/display/PassNode.js +3 -1
- package/src/nodes/display/ScreenNode.js +9 -0
- package/src/nodes/fog/Fog.js +17 -0
- package/src/nodes/gpgpu/AtomicFunctionNode.js +20 -4
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +8 -0
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +1 -1
- package/src/nodes/lighting/ShadowNode.js +1 -1
- package/src/nodes/math/ConditionalNode.js +8 -1
- package/src/nodes/math/MathNode.js +14 -1
- package/src/nodes/math/OperatorNode.js +96 -18
- package/src/nodes/pmrem/PMREMUtils.js +1 -1
- package/src/nodes/shapes/Shapes.js +33 -0
- package/src/nodes/tsl/TSLBase.js +1 -0
- package/src/nodes/tsl/TSLCore.js +22 -2
- package/src/nodes/utils/ArrayElementNode.js +1 -1
- package/src/nodes/utils/LoopNode.js +8 -1
- package/src/nodes/utils/MemberNode.js +68 -0
- package/src/nodes/utils/StorageArrayElementNode.js +14 -0
- package/src/nodes/utils/Timer.js +21 -0
- package/src/objects/BatchedMesh.js +1 -1
- package/src/objects/Line.js +6 -6
- package/src/renderers/WebGLRenderer.js +7 -0
- package/src/renderers/common/Animation.js +23 -1
- package/src/renderers/common/Backend.js +58 -15
- package/src/renderers/common/Background.js +14 -0
- package/src/renderers/common/Binding.js +1 -1
- package/src/renderers/common/BufferUtils.js +1 -1
- package/src/renderers/common/BundleGroup.js +1 -1
- package/src/renderers/common/ChainMap.js +9 -7
- package/src/renderers/common/ClippingContext.js +1 -1
- package/src/renderers/common/Color4.js +7 -3
- package/src/renderers/common/Geometries.js +2 -23
- package/src/renderers/common/Info.js +1 -45
- package/src/renderers/common/Lighting.js +8 -6
- package/src/renderers/common/Pipelines.js +3 -3
- package/src/renderers/common/PostProcessing.js +24 -8
- package/src/renderers/common/QuadMesh.js +1 -1
- package/src/renderers/common/RenderBundles.js +9 -3
- package/src/renderers/common/RenderContext.js +37 -3
- package/src/renderers/common/RenderContexts.js +30 -17
- package/src/renderers/common/RenderList.js +2 -2
- package/src/renderers/common/RenderLists.js +9 -3
- package/src/renderers/common/RenderObject.js +76 -17
- package/src/renderers/common/RenderObjects.js +9 -7
- package/src/renderers/common/Renderer.js +86 -67
- package/src/renderers/common/SampledTexture.js +0 -1
- package/src/renderers/common/StorageBufferAttribute.js +1 -1
- package/src/renderers/common/StorageInstancedBufferAttribute.js +1 -1
- package/src/renderers/common/StorageTexture.js +1 -1
- package/src/renderers/common/Textures.js +14 -7
- package/src/renderers/common/TimestampQueryPool.js +39 -0
- package/src/renderers/common/Uniform.js +37 -1
- package/src/renderers/common/UniformsGroup.js +2 -0
- package/src/renderers/common/XRManager.js +1193 -0
- package/src/renderers/common/XRRenderTarget.js +74 -0
- package/src/renderers/common/extras/PMREMGenerator.js +53 -8
- package/src/renderers/common/nodes/NodeBuilderState.js +4 -4
- package/src/renderers/common/nodes/NodeLibrary.js +5 -5
- package/src/renderers/common/nodes/NodeSampledTexture.js +0 -1
- package/src/renderers/common/nodes/NodeUniform.js +54 -2
- package/src/renderers/common/nodes/Nodes.js +25 -18
- package/src/renderers/webgl/WebGLBackground.js +4 -0
- package/src/renderers/webgl-fallback/WebGLBackend.js +295 -110
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +347 -17
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +57 -0
- package/src/renderers/webgl-fallback/utils/WebGLCapabilities.js +28 -0
- package/src/renderers/webgl-fallback/utils/WebGLExtensions.js +45 -0
- package/src/renderers/webgl-fallback/utils/WebGLState.js +323 -11
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +167 -21
- package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +359 -0
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +43 -0
- package/src/renderers/webgpu/WebGPUBackend.js +132 -149
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +6 -4
- package/src/renderers/webgpu/WebGPURenderer.js +5 -4
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +615 -41
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +85 -6
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +85 -0
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +102 -3
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +98 -1
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +257 -9
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +274 -0
- package/src/renderers/webgpu/utils/WebGPUUtils.js +86 -4
- package/src/renderers/webxr/WebXRManager.js +13 -2
- package/src/textures/VideoFrameTexture.js +35 -0
- package/examples/jsm/geometries/InstancedPointsGeometry.js +0 -176
- package/examples/jsm/objects/InstancedPoints.js +0 -19
- package/src/materials/nodes/InstancedPointsNodeMaterial.js +0 -209
- package/src/nodes/accessors/InstancedPointsMaterialNode.js +0 -37
|
@@ -2,6 +2,14 @@ import { IntType } from '../../../constants.js';
|
|
|
2
2
|
|
|
3
3
|
let _id = 0;
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* This module is internally used in context of compute shaders.
|
|
7
|
+
* This type of shader is not natively supported in WebGL 2 and
|
|
8
|
+
* thus implemented via Transform Feedback. `DualAttributeData`
|
|
9
|
+
* manages the related data.
|
|
10
|
+
*
|
|
11
|
+
* @private
|
|
12
|
+
*/
|
|
5
13
|
class DualAttributeData {
|
|
6
14
|
|
|
7
15
|
constructor( attributeData, dualBuffer ) {
|
|
@@ -46,14 +54,35 @@ class DualAttributeData {
|
|
|
46
54
|
|
|
47
55
|
}
|
|
48
56
|
|
|
57
|
+
/**
|
|
58
|
+
* A WebGL 2 backend utility module for managing shader attributes.
|
|
59
|
+
*
|
|
60
|
+
* @private
|
|
61
|
+
*/
|
|
49
62
|
class WebGLAttributeUtils {
|
|
50
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Constructs a new utility object.
|
|
66
|
+
*
|
|
67
|
+
* @param {WebGLBackend} backend - The WebGL 2 backend.
|
|
68
|
+
*/
|
|
51
69
|
constructor( backend ) {
|
|
52
70
|
|
|
71
|
+
/**
|
|
72
|
+
* A reference to the WebGL 2 backend.
|
|
73
|
+
*
|
|
74
|
+
* @type {WebGLBackend}
|
|
75
|
+
*/
|
|
53
76
|
this.backend = backend;
|
|
54
77
|
|
|
55
78
|
}
|
|
56
79
|
|
|
80
|
+
/**
|
|
81
|
+
* Creates the GPU buffer for the given buffer attribute.
|
|
82
|
+
*
|
|
83
|
+
* @param {BufferAttribute} attribute - The buffer attribute.
|
|
84
|
+
* @param {GLenum } bufferType - A flag that indicates the buffer type and thus binding point target.
|
|
85
|
+
*/
|
|
57
86
|
createAttribute( attribute, bufferType ) {
|
|
58
87
|
|
|
59
88
|
const backend = this.backend;
|
|
@@ -151,6 +180,11 @@ class WebGLAttributeUtils {
|
|
|
151
180
|
|
|
152
181
|
}
|
|
153
182
|
|
|
183
|
+
/**
|
|
184
|
+
* Updates the GPU buffer of the given buffer attribute.
|
|
185
|
+
*
|
|
186
|
+
* @param {BufferAttribute} attribute - The buffer attribute.
|
|
187
|
+
*/
|
|
154
188
|
updateAttribute( attribute ) {
|
|
155
189
|
|
|
156
190
|
const backend = this.backend;
|
|
@@ -190,6 +224,11 @@ class WebGLAttributeUtils {
|
|
|
190
224
|
|
|
191
225
|
}
|
|
192
226
|
|
|
227
|
+
/**
|
|
228
|
+
* Destroys the GPU buffer of the given buffer attribute.
|
|
229
|
+
*
|
|
230
|
+
* @param {BufferAttribute} attribute - The buffer attribute.
|
|
231
|
+
*/
|
|
193
232
|
destroyAttribute( attribute ) {
|
|
194
233
|
|
|
195
234
|
const backend = this.backend;
|
|
@@ -209,6 +248,14 @@ class WebGLAttributeUtils {
|
|
|
209
248
|
|
|
210
249
|
}
|
|
211
250
|
|
|
251
|
+
/**
|
|
252
|
+
* This method performs a readback operation by moving buffer data from
|
|
253
|
+
* a storage buffer attribute from the GPU to the CPU.
|
|
254
|
+
*
|
|
255
|
+
* @async
|
|
256
|
+
* @param {StorageBufferAttribute} attribute - The storage buffer attribute.
|
|
257
|
+
* @return {Promise<ArrayBuffer>} A promise that resolves with the buffer data when the data are ready.
|
|
258
|
+
*/
|
|
212
259
|
async getArrayBufferAsync( attribute ) {
|
|
213
260
|
|
|
214
261
|
const backend = this.backend;
|
|
@@ -247,6 +294,16 @@ class WebGLAttributeUtils {
|
|
|
247
294
|
|
|
248
295
|
}
|
|
249
296
|
|
|
297
|
+
/**
|
|
298
|
+
* Creates a WebGL buffer with the given data.
|
|
299
|
+
*
|
|
300
|
+
* @private
|
|
301
|
+
* @param {WebGL2RenderingContext} gl - The rendering context.
|
|
302
|
+
* @param {GLenum } bufferType - A flag that indicates the buffer type and thus binding point target.
|
|
303
|
+
* @param {TypedArray} array - The array of the buffer attribute.
|
|
304
|
+
* @param {GLenum} usage - The usage.
|
|
305
|
+
* @return {WebGLBuffer} The WebGL buffer.
|
|
306
|
+
*/
|
|
250
307
|
_createBuffer( gl, bufferType, array, usage ) {
|
|
251
308
|
|
|
252
309
|
const bufferGPU = gl.createBuffer();
|
|
@@ -1,13 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A WebGL 2 backend utility module for managing the device's capabilities.
|
|
3
|
+
*
|
|
4
|
+
* @private
|
|
5
|
+
*/
|
|
1
6
|
class WebGLCapabilities {
|
|
2
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Constructs a new utility object.
|
|
10
|
+
*
|
|
11
|
+
* @param {WebGLBackend} backend - The WebGL 2 backend.
|
|
12
|
+
*/
|
|
3
13
|
constructor( backend ) {
|
|
4
14
|
|
|
15
|
+
/**
|
|
16
|
+
* A reference to the WebGL 2 backend.
|
|
17
|
+
*
|
|
18
|
+
* @type {WebGLBackend}
|
|
19
|
+
*/
|
|
5
20
|
this.backend = backend;
|
|
6
21
|
|
|
22
|
+
/**
|
|
23
|
+
* This value holds the cached max anisotropy value.
|
|
24
|
+
*
|
|
25
|
+
* @type {Number?}
|
|
26
|
+
* @default null
|
|
27
|
+
*/
|
|
7
28
|
this.maxAnisotropy = null;
|
|
8
29
|
|
|
9
30
|
}
|
|
10
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Returns the maximum anisotropy texture filtering value. This value
|
|
34
|
+
* depends on the device and is reported by the `EXT_texture_filter_anisotropic`
|
|
35
|
+
* WebGL extension.
|
|
36
|
+
*
|
|
37
|
+
* @return {Number} The maximum anisotropy texture filtering value.
|
|
38
|
+
*/
|
|
11
39
|
getMaxAnisotropy() {
|
|
12
40
|
|
|
13
41
|
if ( this.maxAnisotropy !== null ) return this.maxAnisotropy;
|
|
@@ -1,16 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A WebGL 2 backend utility module for managing extensions.
|
|
3
|
+
*
|
|
4
|
+
* @private
|
|
5
|
+
*/
|
|
1
6
|
class WebGLExtensions {
|
|
2
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Constructs a new utility object.
|
|
10
|
+
*
|
|
11
|
+
* @param {WebGLBackend} backend - The WebGL 2 backend.
|
|
12
|
+
*/
|
|
3
13
|
constructor( backend ) {
|
|
4
14
|
|
|
15
|
+
/**
|
|
16
|
+
* A reference to the WebGL 2 backend.
|
|
17
|
+
*
|
|
18
|
+
* @type {WebGLBackend}
|
|
19
|
+
*/
|
|
5
20
|
this.backend = backend;
|
|
6
21
|
|
|
22
|
+
/**
|
|
23
|
+
* A reference to the rendering context.
|
|
24
|
+
*
|
|
25
|
+
* @type {WebGL2RenderingContext}
|
|
26
|
+
*/
|
|
7
27
|
this.gl = this.backend.gl;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* A list with all the supported WebGL extensions.
|
|
31
|
+
*
|
|
32
|
+
* @type {Array<String>}
|
|
33
|
+
*/
|
|
8
34
|
this.availableExtensions = this.gl.getSupportedExtensions();
|
|
9
35
|
|
|
36
|
+
/**
|
|
37
|
+
* A dictionary with requested WebGL extensions.
|
|
38
|
+
* The key is the name of the extension, the value
|
|
39
|
+
* the requested extension object.
|
|
40
|
+
*
|
|
41
|
+
* @type {Object<String,Object>}
|
|
42
|
+
*/
|
|
10
43
|
this.extensions = {};
|
|
11
44
|
|
|
12
45
|
}
|
|
13
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Returns the extension object for the given extension name.
|
|
49
|
+
*
|
|
50
|
+
* @param {String} name - The extension name.
|
|
51
|
+
* @return {Object} The extension object.
|
|
52
|
+
*/
|
|
14
53
|
get( name ) {
|
|
15
54
|
|
|
16
55
|
let extension = this.extensions[ name ];
|
|
@@ -27,6 +66,12 @@ class WebGLExtensions {
|
|
|
27
66
|
|
|
28
67
|
}
|
|
29
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Returns `true` if the requested extension is available.
|
|
71
|
+
*
|
|
72
|
+
* @param {String} name - The extension name.
|
|
73
|
+
* @return {Boolean} Whether the given extension is available or not.
|
|
74
|
+
*/
|
|
30
75
|
has( name ) {
|
|
31
76
|
|
|
32
77
|
return this.availableExtensions.includes( name );
|