@plastic-software/three 0.178.0 → 0.179.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/README.md +1 -1
- package/build/three.cjs +856 -196
- package/build/three.core.js +647 -123
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +211 -76
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +70 -21
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +1796 -557
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +1754 -557
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/Addons.js +1 -2
- package/examples/jsm/capabilities/WebGPU.js +1 -1
- package/examples/jsm/csm/CSMShadowNode.js +4 -4
- package/examples/jsm/environments/RoomEnvironment.js +8 -3
- package/examples/jsm/exporters/USDZExporter.js +676 -299
- package/examples/jsm/geometries/RoundedBoxGeometry.js +47 -8
- package/examples/jsm/interactive/HTMLMesh.js +5 -3
- package/examples/jsm/libs/meshopt_decoder.module.js +75 -58
- package/examples/jsm/lights/LightProbeGenerator.js +14 -3
- package/examples/jsm/loaders/EXRLoader.js +210 -22
- package/examples/jsm/loaders/FBXLoader.js +1 -1
- package/examples/jsm/loaders/MaterialXLoader.js +212 -30
- package/examples/jsm/loaders/TTFLoader.js +13 -1
- package/examples/jsm/loaders/USDLoader.js +219 -0
- package/examples/jsm/loaders/USDZLoader.js +4 -892
- package/examples/jsm/loaders/usd/USDAParser.js +741 -0
- package/examples/jsm/loaders/usd/USDCParser.js +17 -0
- package/examples/jsm/objects/LensflareMesh.js +3 -3
- package/examples/jsm/objects/SkyMesh.js +2 -2
- package/examples/jsm/physics/RapierPhysics.js +14 -5
- package/examples/jsm/postprocessing/GTAOPass.js +10 -9
- package/examples/jsm/postprocessing/OutlinePass.js +17 -17
- package/examples/jsm/postprocessing/SSAOPass.js +10 -9
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +11 -2
- package/examples/jsm/transpiler/GLSLDecoder.js +2 -2
- package/examples/jsm/tsl/display/BloomNode.js +8 -7
- package/examples/jsm/tsl/display/GaussianBlurNode.js +6 -8
- package/examples/jsm/tsl/display/{TRAAPassNode.js → TRAANode.js} +181 -172
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +1 -1
- package/package.json +1 -1
- package/src/Three.Core.js +1 -0
- package/src/Three.TSL.js +69 -20
- package/src/animation/KeyframeTrack.js +1 -1
- package/src/animation/tracks/BooleanKeyframeTrack.js +1 -1
- package/src/animation/tracks/StringKeyframeTrack.js +1 -1
- package/src/cameras/Camera.js +14 -0
- package/src/cameras/OrthographicCamera.js +1 -1
- package/src/cameras/PerspectiveCamera.js +1 -1
- package/src/constants.js +1 -1
- package/{examples/jsm/misc → src/core}/Timer.js +4 -42
- package/src/extras/PMREMGenerator.js +11 -0
- package/src/helpers/CameraHelper.js +41 -11
- package/src/helpers/SkeletonHelper.js +35 -6
- package/src/lights/LightShadow.js +21 -8
- package/src/lights/PointLightShadow.js +1 -1
- package/src/loaders/FileLoader.js +25 -2
- package/src/loaders/ImageBitmapLoader.js +23 -0
- package/src/loaders/Loader.js +14 -0
- package/src/loaders/LoadingManager.js +23 -0
- package/src/materials/MeshBasicMaterial.js +1 -1
- package/src/materials/nodes/Line2NodeMaterial.js +0 -8
- package/src/materials/nodes/NodeMaterial.js +1 -1
- package/src/materials/nodes/PointsNodeMaterial.js +5 -0
- package/src/materials/nodes/manager/NodeMaterialObserver.js +87 -2
- package/src/math/Frustum.js +19 -8
- package/src/math/FrustumArray.js +10 -5
- package/src/math/Line3.js +129 -2
- package/src/math/Matrix4.js +48 -27
- package/src/math/Spherical.js +2 -2
- package/src/nodes/Nodes.js +1 -0
- package/src/nodes/TSL.js +1 -0
- package/src/nodes/accessors/Camera.js +12 -12
- package/src/nodes/accessors/Normal.js +11 -11
- package/src/nodes/accessors/ReferenceNode.js +18 -3
- package/src/nodes/accessors/SceneNode.js +1 -1
- package/src/nodes/accessors/StorageTextureNode.js +1 -1
- package/src/nodes/accessors/TextureNode.js +12 -0
- package/src/nodes/core/ArrayNode.js +12 -0
- package/src/nodes/core/AssignNode.js +3 -0
- package/src/nodes/core/ContextNode.js +20 -1
- package/src/nodes/core/Node.js +14 -2
- package/src/nodes/core/NodeBuilder.js +25 -20
- package/src/nodes/core/NodeUtils.js +4 -1
- package/src/nodes/core/StackNode.js +42 -0
- package/src/nodes/core/UniformNode.js +63 -5
- package/src/nodes/core/VarNode.js +91 -2
- package/src/nodes/display/PassNode.js +148 -2
- package/src/nodes/display/ViewportTextureNode.js +67 -7
- package/src/nodes/functions/PhysicalLightingModel.js +2 -2
- package/src/nodes/gpgpu/AtomicFunctionNode.js +1 -1
- package/src/nodes/gpgpu/ComputeNode.js +67 -23
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +28 -3
- package/src/nodes/lighting/ProjectorLightNode.js +19 -6
- package/src/nodes/lighting/ShadowFilterNode.js +1 -1
- package/src/nodes/materialx/MaterialXNodes.js +131 -2
- package/src/nodes/materialx/lib/mx_noise.js +165 -1
- package/src/nodes/math/ConditionalNode.js +1 -1
- package/src/nodes/math/MathNode.js +78 -54
- package/src/nodes/math/OperatorNode.js +22 -22
- package/src/nodes/tsl/TSLCore.js +64 -9
- package/src/nodes/utils/DebugNode.js +1 -1
- package/src/nodes/utils/EventNode.js +83 -0
- package/src/nodes/utils/RTTNode.js +9 -0
- package/src/objects/BatchedMesh.js +4 -2
- package/src/renderers/WebGLRenderer.js +21 -22
- package/src/renderers/common/Bindings.js +19 -18
- package/src/renderers/common/Color4.js +2 -2
- package/src/renderers/common/PostProcessing.js +60 -5
- package/src/renderers/common/Renderer.js +18 -15
- package/src/renderers/common/SampledTexture.js +3 -71
- package/src/renderers/common/Sampler.js +79 -0
- package/src/renderers/common/Storage3DTexture.js +21 -0
- package/src/renderers/common/StorageArrayTexture.js +21 -0
- package/src/renderers/common/StorageTexture.js +19 -0
- package/src/renderers/common/Textures.js +19 -3
- package/src/renderers/common/XRManager.js +26 -8
- package/src/renderers/common/nodes/NodeSampledTexture.js +0 -12
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +20 -2
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +11 -2
- package/src/renderers/webgl/WebGLCapabilities.js +2 -2
- package/src/renderers/webgl/WebGLMaterials.js +6 -6
- package/src/renderers/webgl/WebGLProgram.js +22 -16
- package/src/renderers/webgl/WebGLPrograms.js +4 -4
- package/src/renderers/webgl/WebGLShadowMap.js +11 -1
- package/src/renderers/webgl/WebGLTextures.js +19 -7
- package/src/renderers/webgl-fallback/WebGLBackend.js +22 -12
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +2 -2
- package/src/renderers/webgpu/WebGPUBackend.js +54 -15
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +53 -73
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +35 -31
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +1 -1
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +11 -64
- package/src/renderers/webgpu/utils/WebGPUUtils.js +2 -17
- package/src/renderers/webxr/WebXRDepthSensing.js +6 -10
- package/src/renderers/webxr/WebXRManager.js +68 -8
- package/src/textures/ExternalTexture.js +45 -0
- package/src/textures/FramebufferTexture.js +2 -2
- package/src/textures/Source.js +11 -1
- package/src/textures/VideoTexture.js +30 -2
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Texture } from './Texture.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents a texture created externally from the renderer context.
|
|
5
|
+
*
|
|
6
|
+
* This may be a texture from a protected media stream, device camera feed,
|
|
7
|
+
* or other data feeds like a depth sensor.
|
|
8
|
+
*
|
|
9
|
+
* Note that this class is only supported in {@link WebGLRenderer} right now.
|
|
10
|
+
*
|
|
11
|
+
* @augments Texture
|
|
12
|
+
*/
|
|
13
|
+
class ExternalTexture extends Texture {
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new raw texture.
|
|
17
|
+
*
|
|
18
|
+
* @param {?WebGLTexture} [sourceTexture=null] - The external texture.
|
|
19
|
+
*/
|
|
20
|
+
constructor( sourceTexture = null ) {
|
|
21
|
+
|
|
22
|
+
super();
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The external source texture.
|
|
26
|
+
*
|
|
27
|
+
* @type {?WebGLTexture}
|
|
28
|
+
* @default null
|
|
29
|
+
*/
|
|
30
|
+
this.sourceTexture = sourceTexture;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* This flag can be used for type testing.
|
|
34
|
+
*
|
|
35
|
+
* @type {boolean}
|
|
36
|
+
* @readonly
|
|
37
|
+
* @default true
|
|
38
|
+
*/
|
|
39
|
+
this.isExternalTexture = true;
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { ExternalTexture };
|
|
@@ -30,8 +30,8 @@ class FramebufferTexture extends Texture {
|
|
|
30
30
|
/**
|
|
31
31
|
* Constructs a new framebuffer texture.
|
|
32
32
|
*
|
|
33
|
-
* @param {number} width - The width of the texture.
|
|
34
|
-
* @param {number} height - The height of the texture.
|
|
33
|
+
* @param {number} [width] - The width of the texture.
|
|
34
|
+
* @param {number} [height] - The height of the texture.
|
|
35
35
|
*/
|
|
36
36
|
constructor( width, height ) {
|
|
37
37
|
|
package/src/textures/Source.js
CHANGED
|
@@ -73,13 +73,23 @@ class Source {
|
|
|
73
73
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
/**
|
|
77
|
+
* Returns the dimensions of the source into the given target vector.
|
|
78
|
+
*
|
|
79
|
+
* @param {(Vector2|Vector3)} target - The target object the result is written into.
|
|
80
|
+
* @return {(Vector2|Vector3)} The dimensions of the source.
|
|
81
|
+
*/
|
|
76
82
|
getSize( target ) {
|
|
77
83
|
|
|
78
84
|
const data = this.data;
|
|
79
85
|
|
|
80
86
|
if ( data instanceof HTMLVideoElement ) {
|
|
81
87
|
|
|
82
|
-
target.set( data.videoWidth, data.videoHeight );
|
|
88
|
+
target.set( data.videoWidth, data.videoHeight, 0 );
|
|
89
|
+
|
|
90
|
+
} else if ( data instanceof VideoFrame ) {
|
|
91
|
+
|
|
92
|
+
target.set( data.displayHeight, data.displayWidth, 0 );
|
|
83
93
|
|
|
84
94
|
} else if ( data !== null ) {
|
|
85
95
|
|
|
@@ -10,6 +10,9 @@ import { Texture } from './Texture.js';
|
|
|
10
10
|
* const texture = new THREE.VideoTexture( video );
|
|
11
11
|
* ```
|
|
12
12
|
*
|
|
13
|
+
* Note: When using video textures with {@link WebGPURenderer}, {@link Texture#colorSpace} must be
|
|
14
|
+
* set to THREE.SRGBColorSpace.
|
|
15
|
+
*
|
|
13
16
|
* Note: After the initial use of a texture, its dimensions, format, and type
|
|
14
17
|
* cannot be changed. Instead, call {@link Texture#dispose} on the texture and instantiate a new one.
|
|
15
18
|
*
|
|
@@ -53,18 +56,28 @@ class VideoTexture extends Texture {
|
|
|
53
56
|
*/
|
|
54
57
|
this.generateMipmaps = false;
|
|
55
58
|
|
|
59
|
+
/**
|
|
60
|
+
* The video frame request callback identifier, which is a positive integer.
|
|
61
|
+
*
|
|
62
|
+
* Value of 0 represents no scheduled rVFC.
|
|
63
|
+
*
|
|
64
|
+
* @private
|
|
65
|
+
* @type {number}
|
|
66
|
+
*/
|
|
67
|
+
this._requestVideoFrameCallbackId = 0;
|
|
68
|
+
|
|
56
69
|
const scope = this;
|
|
57
70
|
|
|
58
71
|
function updateVideo() {
|
|
59
72
|
|
|
60
73
|
scope.needsUpdate = true;
|
|
61
|
-
video.requestVideoFrameCallback( updateVideo );
|
|
74
|
+
scope._requestVideoFrameCallbackId = video.requestVideoFrameCallback( updateVideo );
|
|
62
75
|
|
|
63
76
|
}
|
|
64
77
|
|
|
65
78
|
if ( 'requestVideoFrameCallback' in video ) {
|
|
66
79
|
|
|
67
|
-
video.requestVideoFrameCallback( updateVideo );
|
|
80
|
+
this._requestVideoFrameCallbackId = video.requestVideoFrameCallback( updateVideo );
|
|
68
81
|
|
|
69
82
|
}
|
|
70
83
|
|
|
@@ -95,6 +108,21 @@ class VideoTexture extends Texture {
|
|
|
95
108
|
|
|
96
109
|
}
|
|
97
110
|
|
|
111
|
+
/**
|
|
112
|
+
* @override
|
|
113
|
+
*/
|
|
114
|
+
dispose() {
|
|
115
|
+
|
|
116
|
+
if ( this._requestVideoFrameCallbackId !== 0 ) {
|
|
117
|
+
|
|
118
|
+
this.source.data.cancelVideoFrameCallback( this._requestVideoFrameCallbackId );
|
|
119
|
+
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
super.dispose();
|
|
123
|
+
|
|
124
|
+
}
|
|
125
|
+
|
|
98
126
|
}
|
|
99
127
|
|
|
100
128
|
export { VideoTexture };
|