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
|
@@ -14,11 +14,13 @@ import {
|
|
|
14
14
|
* Gcode files are composed by commands used by machines to create objects.
|
|
15
15
|
*
|
|
16
16
|
* @class GCodeLoader
|
|
17
|
-
* @param {Manager} manager Loading manager.
|
|
18
17
|
*/
|
|
19
18
|
|
|
20
19
|
class GCodeLoader extends Loader {
|
|
21
20
|
|
|
21
|
+
/**
|
|
22
|
+
* @param {Manager} manager Loading manager.
|
|
23
|
+
*/
|
|
22
24
|
constructor( manager ) {
|
|
23
25
|
|
|
24
26
|
super( manager );
|
|
@@ -600,8 +600,6 @@ class GLTFLightsExtension {
|
|
|
600
600
|
// here, because node-level parsing will only override position if explicitly specified.
|
|
601
601
|
lightNode.position.set( 0, 0, 0 );
|
|
602
602
|
|
|
603
|
-
lightNode.decay = 2;
|
|
604
|
-
|
|
605
603
|
assignExtrasToUserData( lightNode, lightDef );
|
|
606
604
|
|
|
607
605
|
if ( lightDef.intensity !== undefined ) lightNode.intensity = lightDef.intensity;
|
|
@@ -319,6 +319,8 @@ class MeshGouraudMaterial extends ShaderMaterial {
|
|
|
319
319
|
|
|
320
320
|
super();
|
|
321
321
|
|
|
322
|
+
console.warn( 'THREE.MeshGouraudMaterial: MeshGouraudMaterial has been deprecated and will be removed with r183. Use THREE.MeshLambertMaterial instead.' ); // @deprecated r173
|
|
323
|
+
|
|
322
324
|
this.isMeshGouraudMaterial = true;
|
|
323
325
|
|
|
324
326
|
this.type = 'MeshGouraudMaterial';
|
|
@@ -99,16 +99,15 @@ import { FullScreenQuad } from '../postprocessing/Pass.js';
|
|
|
99
99
|
* // And compute each frame, before rendering to screen:
|
|
100
100
|
* gpuCompute.doRenderTarget( myFilter1, myRenderTarget );
|
|
101
101
|
* gpuCompute.doRenderTarget( myFilter2, outputRenderTarget );
|
|
102
|
-
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* @param {int} sizeX Computation problem size is always 2d: sizeX * sizeY elements.
|
|
106
|
-
* @param {int} sizeY Computation problem size is always 2d: sizeX * sizeY elements.
|
|
107
|
-
* @param {WebGLRenderer} renderer The renderer
|
|
108
|
-
*/
|
|
102
|
+
*/
|
|
109
103
|
|
|
110
104
|
class GPUComputationRenderer {
|
|
111
105
|
|
|
106
|
+
/**
|
|
107
|
+
* @param {Number} sizeX Computation problem size is always 2d: sizeX * sizeY elements.
|
|
108
|
+
* @param {Number} sizeY Computation problem size is always 2d: sizeX * sizeY elements.
|
|
109
|
+
* @param {WebGLRenderer} renderer The renderer
|
|
110
|
+
*/
|
|
112
111
|
constructor( sizeX, sizeY, renderer ) {
|
|
113
112
|
|
|
114
113
|
this.variables = [];
|
|
@@ -13,12 +13,13 @@ import { potpack } from '../libs/potpack.module.js';
|
|
|
13
13
|
* This should begin accumulating lightmaps which apply to
|
|
14
14
|
* your objects, so you can start jittering lighting to achieve
|
|
15
15
|
* the texture-space effect you're looking for.
|
|
16
|
-
*
|
|
17
|
-
* @param {WebGLRenderer} renderer An instance of WebGLRenderer.
|
|
18
|
-
* @param {number} res The side-long dimension of you total lightmap.
|
|
19
16
|
*/
|
|
20
17
|
class ProgressiveLightMap {
|
|
21
18
|
|
|
19
|
+
/**
|
|
20
|
+
* @param {WebGLRenderer} renderer An instance of WebGLRenderer.
|
|
21
|
+
* @param {number} [res=1024] The side-long dimension of you total lightmap.
|
|
22
|
+
*/
|
|
22
23
|
constructor( renderer, res = 1024 ) {
|
|
23
24
|
|
|
24
25
|
this.renderer = renderer;
|
|
@@ -15,12 +15,13 @@ import { potpack } from '../libs/potpack.module.js';
|
|
|
15
15
|
* This should begin accumulating lightmaps which apply to
|
|
16
16
|
* your objects, so you can start jittering lighting to achieve
|
|
17
17
|
* the texture-space effect you're looking for.
|
|
18
|
-
*
|
|
19
|
-
* @param {WebGPURenderer} renderer An instance of WebGPURenderer.
|
|
20
|
-
* @param {number} resolution The side-long dimension of you total lightmap.
|
|
21
18
|
*/
|
|
22
19
|
class ProgressiveLightMap {
|
|
23
20
|
|
|
21
|
+
/**
|
|
22
|
+
* @param {WebGPURenderer} renderer An instance of WebGPURenderer.
|
|
23
|
+
* @param {number} [resolution=1024] The side-long dimension of you total lightmap.
|
|
24
|
+
*/
|
|
24
25
|
constructor( renderer, resolution = 1024 ) {
|
|
25
26
|
|
|
26
27
|
this.renderer = renderer;
|
|
@@ -11,14 +11,16 @@ import { VolumeSlice } from '../misc/VolumeSlice.js';
|
|
|
11
11
|
* For now it only handles 3 dimensional data.
|
|
12
12
|
* See the webgl_loader_nrrd.html example and the loaderNRRD.js file to see how to use this class.
|
|
13
13
|
* @class
|
|
14
|
-
* @param {number} xLength Width of the volume
|
|
15
|
-
* @param {number} yLength Length of the volume
|
|
16
|
-
* @param {number} zLength Depth of the volume
|
|
17
|
-
* @param {string} type The type of data (uint8, uint16, ...)
|
|
18
|
-
* @param {ArrayBuffer} arrayBuffer The buffer with volume data
|
|
19
14
|
*/
|
|
20
15
|
class Volume {
|
|
21
16
|
|
|
17
|
+
/**
|
|
18
|
+
* @param {number} xLength Width of the volume
|
|
19
|
+
* @param {number} yLength Length of the volume
|
|
20
|
+
* @param {number} zLength Depth of the volume
|
|
21
|
+
* @param {string} type The type of data (uint8, uint16, ...)
|
|
22
|
+
* @param {ArrayBuffer} arrayBuffer The buffer with volume data
|
|
23
|
+
*/
|
|
22
24
|
constructor( xLength, yLength, zLength, type, arrayBuffer ) {
|
|
23
25
|
|
|
24
26
|
if ( xLength !== undefined ) {
|
|
@@ -12,13 +12,15 @@ import {
|
|
|
12
12
|
/**
|
|
13
13
|
* This class has been made to hold a slice of a volume data
|
|
14
14
|
* @class
|
|
15
|
-
* @param {Volume} volume The associated volume
|
|
16
|
-
* @param {number} [index=0] The index of the slice
|
|
17
|
-
* @param {string} [axis='z'] For now only 'x', 'y' or 'z' but later it will change to a normal vector
|
|
18
15
|
* @see Volume
|
|
19
16
|
*/
|
|
20
17
|
class VolumeSlice {
|
|
21
18
|
|
|
19
|
+
/**
|
|
20
|
+
* @param {Volume} volume The associated volume
|
|
21
|
+
* @param {number} [index=0] The index of the slice
|
|
22
|
+
* @param {string} [axis='z'] For now only 'x', 'y' or 'z' but later it will change to a normal vector
|
|
23
|
+
*/
|
|
22
24
|
constructor( volume, index, axis ) {
|
|
23
25
|
|
|
24
26
|
const slice = this;
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
Color,
|
|
3
3
|
Mesh,
|
|
4
4
|
Vector3,
|
|
5
|
-
|
|
5
|
+
MeshLambertNodeMaterial
|
|
6
6
|
} from 'three/webgpu';
|
|
7
7
|
|
|
8
|
-
import { Fn, add, cameraPosition, div, normalize, positionWorld, sub, time, texture, vec2, vec3,
|
|
8
|
+
import { Fn, add, cameraPosition, div, normalize, positionWorld, sub, time, texture, vec2, vec3, max, dot, reflect, pow, length, float, uniform, reflector, mul, mix, diffuseColor } from 'three/tsl';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Work based on :
|
|
@@ -18,7 +18,7 @@ class WaterMesh extends Mesh {
|
|
|
18
18
|
|
|
19
19
|
constructor( geometry, options ) {
|
|
20
20
|
|
|
21
|
-
const material = new
|
|
21
|
+
const material = new MeshLambertNodeMaterial();
|
|
22
22
|
|
|
23
23
|
super( geometry, material );
|
|
24
24
|
|
|
@@ -26,7 +26,7 @@ class WaterMesh extends Mesh {
|
|
|
26
26
|
|
|
27
27
|
this.resolution = options.resolution !== undefined ? options.resolution : 0.5;
|
|
28
28
|
|
|
29
|
-
//
|
|
29
|
+
// Uniforms
|
|
30
30
|
|
|
31
31
|
this.waterNormals = texture( options.waterNormals );
|
|
32
32
|
this.alpha = uniform( options.alpha !== undefined ? options.alpha : 1.0 );
|
|
@@ -58,25 +58,32 @@ class WaterMesh extends Mesh {
|
|
|
58
58
|
|
|
59
59
|
} );
|
|
60
60
|
|
|
61
|
-
const
|
|
61
|
+
const noise = getNoise( positionWorld.xz.mul( this.size ) );
|
|
62
|
+
const surfaceNormal = normalize( noise.xzy.mul( 1.5, 1.0, 1.5 ) );
|
|
62
63
|
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
const worldToEye = cameraPosition.sub( positionWorld );
|
|
65
|
+
const eyeDirection = normalize( worldToEye );
|
|
65
66
|
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
const reflection = normalize( reflect( this.sunDirection.negate(), surfaceNormal ) );
|
|
68
|
+
const direction = max( 0.0, dot( eyeDirection, reflection ) );
|
|
69
|
+
const specularLight = pow( direction, 100 ).mul( this.sunColor ).mul( 2.0 );
|
|
70
|
+
const diffuseLight = max( dot( this.sunDirection, surfaceNormal ), 0.0 ).mul( this.sunColor ).mul( 0.5 );
|
|
68
71
|
|
|
69
|
-
|
|
70
|
-
const eyeDirection = normalize( worldToEye );
|
|
72
|
+
const distance = length( worldToEye );
|
|
71
73
|
|
|
72
|
-
|
|
73
|
-
const direction = max( 0.0, dot( eyeDirection, reflection ) );
|
|
74
|
-
specularLight.addAssign( pow( direction, 100 ).mul( this.sunColor ).mul( 2.0 ) );
|
|
75
|
-
diffuseLight.addAssign( max( dot( this.sunDirection, surfaceNormal ), 0.0 ).mul( this.sunColor ).mul( 0.5 ) );
|
|
74
|
+
const distortion = surfaceNormal.xz.mul( float( 0.001 ).add( float( 1.0 ).div( distance ) ) ).mul( this.distortionScale );
|
|
76
75
|
|
|
77
|
-
|
|
76
|
+
// Material
|
|
78
77
|
|
|
79
|
-
|
|
78
|
+
material.transparent = true;
|
|
79
|
+
|
|
80
|
+
material.opacityNode = this.alpha;
|
|
81
|
+
|
|
82
|
+
material.shadowPositionNode = positionWorld.add( distortion );
|
|
83
|
+
|
|
84
|
+
material.setupOutgoingLight = () => diffuseColor.rgb; // backwards compatibility
|
|
85
|
+
|
|
86
|
+
material.colorNode = Fn( () => {
|
|
80
87
|
|
|
81
88
|
const mirrorSampler = reflector();
|
|
82
89
|
mirrorSampler.uvNode = mirrorSampler.uvNode.add( distortion );
|
|
@@ -90,12 +97,10 @@ class WaterMesh extends Mesh {
|
|
|
90
97
|
const scatter = max( 0.0, dot( surfaceNormal, eyeDirection ) ).mul( this.waterColor );
|
|
91
98
|
const albedo = mix( this.sunColor.mul( diffuseLight ).mul( 0.3 ).add( scatter ), mirrorSampler.rgb.mul( specularLight ).add( mirrorSampler.rgb.mul( 0.9 ) ).add( vec3( 0.1 ) ), reflectance );
|
|
92
99
|
|
|
93
|
-
return
|
|
100
|
+
return albedo;
|
|
94
101
|
|
|
95
102
|
} )();
|
|
96
103
|
|
|
97
|
-
material.fragmentNode = fragmentNode;
|
|
98
|
-
|
|
99
104
|
}
|
|
100
105
|
|
|
101
106
|
}
|
|
@@ -39,7 +39,7 @@ const NUM_OBJECT_LAYERS = 2;
|
|
|
39
39
|
|
|
40
40
|
function setupCollisionFiltering( settings ) {
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
const objectFilter = new Jolt.ObjectLayerPairFilterTable( NUM_OBJECT_LAYERS );
|
|
43
43
|
objectFilter.EnableCollision( LAYER_NON_MOVING, LAYER_MOVING );
|
|
44
44
|
objectFilter.EnableCollision( LAYER_MOVING, LAYER_MOVING );
|
|
45
45
|
|
|
@@ -47,7 +47,7 @@ function setupCollisionFiltering( settings ) {
|
|
|
47
47
|
const BP_LAYER_MOVING = new Jolt.BroadPhaseLayer( 1 );
|
|
48
48
|
const NUM_BROAD_PHASE_LAYERS = 2;
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
const bpInterface = new Jolt.BroadPhaseLayerInterfaceTable( NUM_OBJECT_LAYERS, NUM_BROAD_PHASE_LAYERS );
|
|
51
51
|
bpInterface.MapObjectToBroadPhaseLayer( LAYER_NON_MOVING, BP_LAYER_NON_MOVING );
|
|
52
52
|
bpInterface.MapObjectToBroadPhaseLayer( LAYER_MOVING, BP_LAYER_MOVING );
|
|
53
53
|
|
|
@@ -55,7 +55,7 @@ function setupCollisionFiltering( settings ) {
|
|
|
55
55
|
settings.mBroadPhaseLayerInterface = bpInterface;
|
|
56
56
|
settings.mObjectVsBroadPhaseLayerFilter = new Jolt.ObjectVsBroadPhaseLayerFilterTable( settings.mBroadPhaseLayerInterface, NUM_BROAD_PHASE_LAYERS, settings.mObjectLayerPairFilter, NUM_OBJECT_LAYERS );
|
|
57
57
|
|
|
58
|
-
}
|
|
58
|
+
}
|
|
59
59
|
|
|
60
60
|
async function JoltPhysics() {
|
|
61
61
|
|
|
@@ -111,8 +111,8 @@ async function JoltPhysics() {
|
|
|
111
111
|
if ( shape === null ) return;
|
|
112
112
|
|
|
113
113
|
const body = mesh.isInstancedMesh
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
? createInstancedBody( mesh, mass, restitution, shape )
|
|
115
|
+
: createBody( mesh.position, mesh.quaternion, mass, restitution, shape );
|
|
116
116
|
|
|
117
117
|
if ( mass > 0 ) {
|
|
118
118
|
|
|
@@ -175,8 +175,8 @@ async function JoltPhysics() {
|
|
|
175
175
|
|
|
176
176
|
const physics = mesh.userData.physics;
|
|
177
177
|
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
const shape = body.GetShape();
|
|
179
|
+
const body2 = createBody( position, { x: 0, y: 0, z: 0, w: 1 }, physics.mass, physics.restitution, shape );
|
|
180
180
|
|
|
181
181
|
bodies[ index ] = body2;
|
|
182
182
|
|
|
@@ -43,8 +43,8 @@ function getShape( geometry ) {
|
|
|
43
43
|
|
|
44
44
|
// if the buffer is non-indexed, generate an index buffer
|
|
45
45
|
const indices = geometry.getIndex() === null
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
? Uint32Array.from( Array( parseInt( vertices.length / 3 ) ).keys() )
|
|
47
|
+
: geometry.getIndex().array;
|
|
48
48
|
|
|
49
49
|
return RAPIER.ColliderDesc.trimesh( vertices, indices );
|
|
50
50
|
|
|
@@ -105,8 +105,8 @@ async function RapierPhysics() {
|
|
|
105
105
|
shape.setRestitution( restitution );
|
|
106
106
|
|
|
107
107
|
const body = mesh.isInstancedMesh
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
? createInstancedBody( mesh, mass, shape )
|
|
109
|
+
: createBody( mesh.position, mesh.quaternion, mass, shape );
|
|
110
110
|
|
|
111
111
|
if ( mass > 0 ) {
|
|
112
112
|
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
AgXToneMapping,
|
|
9
9
|
ACESFilmicToneMapping,
|
|
10
10
|
NeutralToneMapping,
|
|
11
|
+
CustomToneMapping,
|
|
11
12
|
SRGBTransfer
|
|
12
13
|
} from 'three';
|
|
13
14
|
import { Pass, FullScreenQuad } from './Pass.js';
|
|
@@ -63,6 +64,7 @@ class OutputPass extends Pass {
|
|
|
63
64
|
else if ( this._toneMapping === ACESFilmicToneMapping ) this.material.defines.ACES_FILMIC_TONE_MAPPING = '';
|
|
64
65
|
else if ( this._toneMapping === AgXToneMapping ) this.material.defines.AGX_TONE_MAPPING = '';
|
|
65
66
|
else if ( this._toneMapping === NeutralToneMapping ) this.material.defines.NEUTRAL_TONE_MAPPING = '';
|
|
67
|
+
else if ( this._toneMapping === CustomToneMapping ) this.material.defines.CUSTOM_TONE_MAPPING = '';
|
|
66
68
|
|
|
67
69
|
this.material.needsUpdate = true;
|
|
68
70
|
|
|
@@ -28,7 +28,7 @@ const OutputShader = {
|
|
|
28
28
|
}`,
|
|
29
29
|
|
|
30
30
|
fragmentShader: /* glsl */`
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
precision highp float;
|
|
33
33
|
|
|
34
34
|
uniform sampler2D tDiffuse;
|
|
@@ -68,6 +68,10 @@ const OutputShader = {
|
|
|
68
68
|
|
|
69
69
|
gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
|
|
70
70
|
|
|
71
|
+
#elif defined( CUSTOM_TONE_MAPPING )
|
|
72
|
+
|
|
73
|
+
gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
|
|
74
|
+
|
|
71
75
|
#endif
|
|
72
76
|
|
|
73
77
|
// color space
|
|
@@ -461,11 +461,11 @@ class GLSLDecoder {
|
|
|
461
461
|
const isHex = /^(0x)/.test( firstToken.str );
|
|
462
462
|
|
|
463
463
|
if ( isHex ) type = 'int';
|
|
464
|
-
else if ( /u$/.test( firstToken.str ) ) type = 'uint';
|
|
464
|
+
else if ( /u$|U$/.test( firstToken.str ) ) type = 'uint';
|
|
465
465
|
else if ( /f|e|\./.test( firstToken.str ) ) type = 'float';
|
|
466
466
|
else type = 'int';
|
|
467
467
|
|
|
468
|
-
let str = firstToken.str.replace( /u|i$/, '' );
|
|
468
|
+
let str = firstToken.str.replace( /u|U|i$/, '' );
|
|
469
469
|
|
|
470
470
|
if ( isHex === false ) {
|
|
471
471
|
|
package/package.json
CHANGED
package/src/Three.Core.js
CHANGED
|
@@ -4,6 +4,7 @@ export { WebGLArrayRenderTarget } from './renderers/WebGLArrayRenderTarget.js';
|
|
|
4
4
|
export { WebGL3DRenderTarget } from './renderers/WebGL3DRenderTarget.js';
|
|
5
5
|
export { WebGLCubeRenderTarget } from './renderers/WebGLCubeRenderTarget.js';
|
|
6
6
|
export { WebGLRenderTarget } from './renderers/WebGLRenderTarget.js';
|
|
7
|
+
export { WebXRController } from './renderers/webxr/WebXRController.js';
|
|
7
8
|
export { FogExp2 } from './scenes/FogExp2.js';
|
|
8
9
|
export { Fog } from './scenes/Fog.js';
|
|
9
10
|
export { Scene } from './scenes/Scene.js';
|
|
@@ -21,6 +22,7 @@ export { Line } from './objects/Line.js';
|
|
|
21
22
|
export { Points } from './objects/Points.js';
|
|
22
23
|
export { Group } from './objects/Group.js';
|
|
23
24
|
export { VideoTexture } from './textures/VideoTexture.js';
|
|
25
|
+
export { VideoFrameTexture } from './textures/VideoFrameTexture.js';
|
|
24
26
|
export { FramebufferTexture } from './textures/FramebufferTexture.js';
|
|
25
27
|
export { Source } from './textures/Source.js';
|
|
26
28
|
export { DataTexture } from './textures/DataTexture.js';
|
package/src/Three.TSL.js
CHANGED
|
@@ -43,6 +43,7 @@ export const anisotropyB = TSL.anisotropyB;
|
|
|
43
43
|
export const anisotropyT = TSL.anisotropyT;
|
|
44
44
|
export const any = TSL.any;
|
|
45
45
|
export const append = TSL.append;
|
|
46
|
+
export const array = TSL.array;
|
|
46
47
|
export const arrayBuffer = TSL.arrayBuffer;
|
|
47
48
|
export const asin = TSL.asin;
|
|
48
49
|
export const assign = TSL.assign;
|
|
@@ -57,6 +58,7 @@ export const atomicOr = TSL.atomicOr;
|
|
|
57
58
|
export const atomicStore = TSL.atomicStore;
|
|
58
59
|
export const atomicSub = TSL.atomicSub;
|
|
59
60
|
export const atomicXor = TSL.atomicXor;
|
|
61
|
+
export const atomicLoad = TSL.atomicLoad;
|
|
60
62
|
export const attenuationColor = TSL.attenuationColor;
|
|
61
63
|
export const attenuationDistance = TSL.attenuationDistance;
|
|
62
64
|
export const attribute = TSL.attribute;
|
|
@@ -93,6 +95,7 @@ export const bypass = TSL.bypass;
|
|
|
93
95
|
export const cache = TSL.cache;
|
|
94
96
|
export const call = TSL.call;
|
|
95
97
|
export const cameraFar = TSL.cameraFar;
|
|
98
|
+
export const cameraIndex = TSL.cameraIndex;
|
|
96
99
|
export const cameraNear = TSL.cameraNear;
|
|
97
100
|
export const cameraNormalMatrix = TSL.cameraNormalMatrix;
|
|
98
101
|
export const cameraPosition = TSL.cameraPosition;
|
|
@@ -114,6 +117,7 @@ export const colorSpaceToWorking = TSL.colorSpaceToWorking;
|
|
|
114
117
|
export const colorToDirection = TSL.colorToDirection;
|
|
115
118
|
export const compute = TSL.compute;
|
|
116
119
|
export const cond = TSL.cond;
|
|
120
|
+
export const Const = TSL.Const;
|
|
117
121
|
export const context = TSL.context;
|
|
118
122
|
export const convert = TSL.convert;
|
|
119
123
|
export const convertColorSpace = TSL.convertColorSpace;
|
|
@@ -219,6 +223,7 @@ export const lights = TSL.lights;
|
|
|
219
223
|
export const linearDepth = TSL.linearDepth;
|
|
220
224
|
export const linearToneMapping = TSL.linearToneMapping;
|
|
221
225
|
export const localId = TSL.localId;
|
|
226
|
+
export const globalId = TSL.globalId;
|
|
222
227
|
export const log = TSL.log;
|
|
223
228
|
export const log2 = TSL.log2;
|
|
224
229
|
export const logarithmicDepthToViewZ = TSL.logarithmicDepthToViewZ;
|
|
@@ -254,7 +259,7 @@ export const materialLineWidth = TSL.materialLineWidth;
|
|
|
254
259
|
export const materialMetalness = TSL.materialMetalness;
|
|
255
260
|
export const materialNormal = TSL.materialNormal;
|
|
256
261
|
export const materialOpacity = TSL.materialOpacity;
|
|
257
|
-
export const
|
|
262
|
+
export const materialPointSize = TSL.materialPointSize;
|
|
258
263
|
export const materialReference = TSL.materialReference;
|
|
259
264
|
export const materialReflectivity = TSL.materialReflectivity;
|
|
260
265
|
export const materialRefractionRatio = TSL.materialRefractionRatio;
|
|
@@ -413,6 +418,7 @@ export const shaderStages = TSL.shaderStages;
|
|
|
413
418
|
export const shadow = TSL.shadow;
|
|
414
419
|
export const shadowPositionWorld = TSL.shadowPositionWorld;
|
|
415
420
|
export const sharedUniformGroup = TSL.sharedUniformGroup;
|
|
421
|
+
export const shapeCircle = TSL.shapeCircle;
|
|
416
422
|
export const sheen = TSL.sheen;
|
|
417
423
|
export const sheenRoughness = TSL.sheenRoughness;
|
|
418
424
|
export const shiftLeft = TSL.shiftLeft;
|
|
@@ -438,6 +444,7 @@ export const storageBarrier = TSL.storageBarrier;
|
|
|
438
444
|
export const storageObject = TSL.storageObject;
|
|
439
445
|
export const storageTexture = TSL.storageTexture;
|
|
440
446
|
export const string = TSL.string;
|
|
447
|
+
export const struct = TSL.struct;
|
|
441
448
|
export const sub = TSL.sub;
|
|
442
449
|
export const subgroupIndex = TSL.subgroupIndex;
|
|
443
450
|
export const subgroupSize = TSL.subgroupSize;
|
|
@@ -496,6 +503,7 @@ export const uv = TSL.uv;
|
|
|
496
503
|
export const uvec2 = TSL.uvec2;
|
|
497
504
|
export const uvec3 = TSL.uvec3;
|
|
498
505
|
export const uvec4 = TSL.uvec4;
|
|
506
|
+
export const Var = TSL.Var;
|
|
499
507
|
export const varying = TSL.varying;
|
|
500
508
|
export const varyingProperty = TSL.varyingProperty;
|
|
501
509
|
export const vec2 = TSL.vec2;
|
package/src/constants.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const REVISION = '
|
|
1
|
+
export const REVISION = '173';
|
|
2
2
|
|
|
3
3
|
export const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
|
|
4
4
|
export const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
|
|
@@ -209,3 +209,8 @@ export const GLSL3 = '300 es';
|
|
|
209
209
|
|
|
210
210
|
export const WebGLCoordinateSystem = 2000;
|
|
211
211
|
export const WebGPUCoordinateSystem = 2001;
|
|
212
|
+
|
|
213
|
+
export const TimestampQuery = {
|
|
214
|
+
COMPUTE: 'compute',
|
|
215
|
+
RENDER: 'render'
|
|
216
|
+
};
|
|
@@ -7,6 +7,8 @@ import { fromHalfFloat, toHalfFloat } from '../extras/DataUtils.js';
|
|
|
7
7
|
const _vector = /*@__PURE__*/ new Vector3();
|
|
8
8
|
const _vector2 = /*@__PURE__*/ new Vector2();
|
|
9
9
|
|
|
10
|
+
let _id = 0;
|
|
11
|
+
|
|
10
12
|
class BufferAttribute {
|
|
11
13
|
|
|
12
14
|
constructor( array, itemSize, normalized = false ) {
|
|
@@ -19,6 +21,8 @@ class BufferAttribute {
|
|
|
19
21
|
|
|
20
22
|
this.isBufferAttribute = true;
|
|
21
23
|
|
|
24
|
+
Object.defineProperty( this, 'id', { value: _id ++ } );
|
|
25
|
+
|
|
22
26
|
this.name = '';
|
|
23
27
|
|
|
24
28
|
this.array = array;
|
|
@@ -26,19 +26,20 @@ class EventDispatcher {
|
|
|
26
26
|
|
|
27
27
|
hasEventListener( type, listener ) {
|
|
28
28
|
|
|
29
|
-
if ( this._listeners === undefined ) return false;
|
|
30
|
-
|
|
31
29
|
const listeners = this._listeners;
|
|
32
30
|
|
|
31
|
+
if ( listeners === undefined ) return false;
|
|
32
|
+
|
|
33
33
|
return listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1;
|
|
34
34
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
removeEventListener( type, listener ) {
|
|
38
38
|
|
|
39
|
-
if ( this._listeners === undefined ) return;
|
|
40
|
-
|
|
41
39
|
const listeners = this._listeners;
|
|
40
|
+
|
|
41
|
+
if ( listeners === undefined ) return;
|
|
42
|
+
|
|
42
43
|
const listenerArray = listeners[ type ];
|
|
43
44
|
|
|
44
45
|
if ( listenerArray !== undefined ) {
|
|
@@ -57,9 +58,10 @@ class EventDispatcher {
|
|
|
57
58
|
|
|
58
59
|
dispatchEvent( event ) {
|
|
59
60
|
|
|
60
|
-
if ( this._listeners === undefined ) return;
|
|
61
|
-
|
|
62
61
|
const listeners = this._listeners;
|
|
62
|
+
|
|
63
|
+
if ( listeners === undefined ) return;
|
|
64
|
+
|
|
63
65
|
const listenerArray = listeners[ event.type ];
|
|
64
66
|
|
|
65
67
|
if ( listenerArray !== undefined ) {
|
package/src/extras/ImageUtils.js
CHANGED
|
@@ -48,17 +48,7 @@ class ImageUtils {
|
|
|
48
48
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
console.warn( 'THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons', image );
|
|
54
|
-
|
|
55
|
-
return canvas.toDataURL( 'image/jpeg', 0.6 );
|
|
56
|
-
|
|
57
|
-
} else {
|
|
58
|
-
|
|
59
|
-
return canvas.toDataURL( 'image/png' );
|
|
60
|
-
|
|
61
|
-
}
|
|
51
|
+
return canvas.toDataURL( 'image/png' );
|
|
62
52
|
|
|
63
53
|
}
|
|
64
54
|
|
|
@@ -85,7 +85,7 @@ class MeshBasicNodeMaterial extends NodeMaterial {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
|
-
* This method must be
|
|
88
|
+
* This method must be overwritten since light maps are evaluated
|
|
89
89
|
* with a special scaling factor for basic materials.
|
|
90
90
|
*
|
|
91
91
|
* @param {NodeBuilder} builder - The current node builder.
|
|
@@ -468,7 +468,7 @@ class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
|
|
|
468
468
|
/**
|
|
469
469
|
* Setups the clearcoat normal node.
|
|
470
470
|
*
|
|
471
|
-
* @return {Node<vec3>} The clearcoat
|
|
471
|
+
* @return {Node<vec3>} The clearcoat normal.
|
|
472
472
|
*/
|
|
473
473
|
setupClearcoatNormal() {
|
|
474
474
|
|
|
@@ -198,7 +198,7 @@ class NodeMaterial extends Material {
|
|
|
198
198
|
* material.transparent = true;
|
|
199
199
|
*
|
|
200
200
|
* // everything behind the object will be monochromatic
|
|
201
|
-
* material.backdropNode = viewportSharedTexture().rgb
|
|
201
|
+
* material.backdropNode = saturation( viewportSharedTexture().rgb, 0 );
|
|
202
202
|
* ```
|
|
203
203
|
*
|
|
204
204
|
* Backdrop computations are part of the lighting so only lit materials can use this property.
|
|
@@ -249,7 +249,7 @@ class NodeMaterial extends Material {
|
|
|
249
249
|
/**
|
|
250
250
|
* This node property is intended for logic which modifies geometry data once or per animation step.
|
|
251
251
|
* Apps usually place such logic randomly in initialization routines or in the animation loop.
|
|
252
|
-
* `geometryNode` is intended as a dedicated API so there is an intended spot where
|
|
252
|
+
* `geometryNode` is intended as a dedicated API so there is an intended spot where geometry modifications
|
|
253
253
|
* can be implemented.
|
|
254
254
|
*
|
|
255
255
|
* The idea is to assign a `Fn` definition that holds the geometry modification logic. A typical example
|
|
@@ -521,9 +521,9 @@ class NodeMaterial extends Material {
|
|
|
521
521
|
|
|
522
522
|
builder.addFlow( 'fragment', builder.removeStack() );
|
|
523
523
|
|
|
524
|
-
// <
|
|
524
|
+
// < OBSERVER >
|
|
525
525
|
|
|
526
|
-
builder.
|
|
526
|
+
builder.observer = this.setupObserver( builder );
|
|
527
527
|
|
|
528
528
|
}
|
|
529
529
|
|
|
@@ -636,7 +636,7 @@ class NodeMaterial extends Material {
|
|
|
636
636
|
|
|
637
637
|
/**
|
|
638
638
|
* Setups the position node in view space. This method exists
|
|
639
|
-
* so derived node materials can
|
|
639
|
+
* so derived node materials can modify the implementation e.g. sprite materials.
|
|
640
640
|
*
|
|
641
641
|
* @param {NodeBuilder} builder - The current node builder.
|
|
642
642
|
* @return {Node<vec3>} The position in view space.
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
export { default as NodeMaterialObserver } from './manager/NodeMaterialObserver.js';
|
|
4
4
|
|
|
5
5
|
export { default as NodeMaterial } from './NodeMaterial.js';
|
|
6
|
-
export { default as InstancedPointsNodeMaterial } from './InstancedPointsNodeMaterial.js';
|
|
7
6
|
export { default as LineBasicNodeMaterial } from './LineBasicNodeMaterial.js';
|
|
8
7
|
export { default as LineDashedNodeMaterial } from './LineDashedNodeMaterial.js';
|
|
9
8
|
export { default as Line2NodeMaterial } from './Line2NodeMaterial.js';
|