super-three 0.158.0 → 0.160.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/build/three.cjs +1719 -379
- package/build/three.js +1719 -379
- package/build/three.min.js +1 -1
- package/build/three.module.js +1718 -380
- package/build/three.module.min.js +1 -1
- package/examples/jsm/Addons.js +2 -1
- package/examples/jsm/controls/OrbitControls.js +50 -40
- package/examples/jsm/csm/CSMShader.js +52 -47
- package/examples/jsm/exporters/GLTFExporter.js +79 -1
- package/examples/jsm/exporters/USDZExporter.js +27 -19
- package/examples/jsm/helpers/TextureHelper.js +237 -0
- package/examples/jsm/interactive/HTMLMesh.js +9 -2
- package/examples/jsm/lines/LineMaterial.js +16 -33
- package/examples/jsm/loaders/ColladaLoader.js +0 -6
- package/examples/jsm/loaders/DRACOLoader.js +4 -3
- package/examples/jsm/loaders/FBXLoader.js +294 -124
- package/examples/jsm/loaders/GLTFLoader.js +71 -3
- package/examples/jsm/loaders/MaterialXLoader.js +73 -54
- package/examples/jsm/loaders/NRRDLoader.js +0 -13
- package/examples/jsm/loaders/SVGLoader.js +4 -4
- package/examples/jsm/loaders/USDZLoader.js +3 -17
- package/examples/jsm/math/Octree.js +15 -4
- package/examples/jsm/misc/Timer.js +119 -0
- package/examples/jsm/misc/TubePainter.js +3 -6
- package/examples/jsm/modifiers/CurveModifier.js +20 -2
- package/examples/jsm/nodes/Nodes.js +11 -7
- package/examples/jsm/nodes/accessors/CameraNode.js +18 -2
- package/examples/jsm/nodes/accessors/CubeTextureNode.js +5 -73
- package/examples/jsm/nodes/accessors/MaterialReferenceNode.js +11 -2
- package/examples/jsm/nodes/accessors/ModelNode.js +1 -1
- package/examples/jsm/nodes/accessors/ModelViewProjectionNode.js +12 -3
- package/examples/jsm/nodes/accessors/MorphNode.js +191 -16
- package/examples/jsm/nodes/accessors/ReferenceNode.js +25 -1
- package/examples/jsm/nodes/accessors/TextureNode.js +122 -36
- package/examples/jsm/nodes/code/CodeNode.js +3 -3
- package/examples/jsm/nodes/core/AttributeNode.js +7 -1
- package/examples/jsm/nodes/core/CacheNode.js +4 -1
- package/examples/jsm/nodes/core/ConstNode.js +1 -1
- package/examples/jsm/nodes/core/Node.js +6 -3
- package/examples/jsm/nodes/core/NodeBuilder.js +84 -27
- package/examples/jsm/nodes/core/NodeFrame.js +10 -8
- package/examples/jsm/nodes/core/NodeUniform.js +12 -0
- package/examples/jsm/nodes/core/NodeUtils.js +3 -7
- package/examples/jsm/nodes/core/OutputStructNode.js +3 -3
- package/examples/jsm/nodes/core/PropertyNode.js +17 -2
- package/examples/jsm/nodes/core/StructTypeNode.js +4 -4
- package/examples/jsm/nodes/core/UniformGroup.js +13 -0
- package/examples/jsm/nodes/core/UniformGroupNode.js +36 -0
- package/examples/jsm/nodes/core/UniformNode.js +17 -0
- package/examples/jsm/nodes/core/VarNode.js +2 -0
- package/examples/jsm/nodes/core/VaryingNode.js +1 -7
- package/examples/jsm/nodes/display/BumpMapNode.js +1 -1
- package/examples/jsm/nodes/display/ColorAdjustmentNode.js +6 -10
- package/examples/jsm/nodes/display/GaussianBlurNode.js +170 -0
- package/examples/jsm/nodes/display/PassNode.js +182 -0
- package/examples/jsm/nodes/display/ViewportDepthNode.js +31 -3
- package/examples/jsm/nodes/display/ViewportDepthTextureNode.js +2 -2
- package/examples/jsm/nodes/display/ViewportNode.js +5 -8
- package/examples/jsm/nodes/functions/PhysicalLightingModel.js +1 -1
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +52 -17
- package/examples/jsm/nodes/lighting/EnvironmentNode.js +8 -12
- package/examples/jsm/nodes/lighting/LightsNode.js +34 -32
- package/examples/jsm/nodes/materials/InstancedPointsNodeMaterial.js +1 -1
- package/examples/jsm/nodes/materials/Line2NodeMaterial.js +12 -12
- package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +1 -0
- package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +1 -1
- package/examples/jsm/nodes/materials/NodeMaterial.js +66 -41
- package/examples/jsm/nodes/materials/PointsNodeMaterial.js +0 -10
- package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +0 -7
- package/examples/jsm/nodes/materialx/MaterialXNodes.js +10 -10
- package/examples/jsm/nodes/materialx/lib/mx_hsv.js +128 -54
- package/examples/jsm/nodes/materialx/lib/mx_noise.js +1430 -618
- package/examples/jsm/nodes/materialx/lib/mx_transform_color.js +24 -14
- package/examples/jsm/nodes/math/MathNode.js +2 -0
- package/examples/jsm/nodes/math/OperatorNode.js +19 -6
- package/examples/jsm/nodes/shadernode/ShaderNode.js +32 -3
- package/examples/jsm/nodes/utils/FunctionOverloadingNode.js +95 -0
- package/examples/jsm/nodes/utils/RemapNode.js +2 -2
- package/examples/jsm/nodes/utils/SplitNode.js +8 -2
- package/examples/jsm/nodes/utils/TriplanarTexturesNode.js +3 -3
- package/examples/jsm/objects/QuadMesh.js +60 -0
- package/examples/jsm/postprocessing/GTAOPass.js +572 -0
- package/examples/jsm/postprocessing/OutputPass.js +2 -0
- package/examples/jsm/renderers/common/Animation.js +10 -21
- package/examples/jsm/renderers/common/Backend.js +19 -3
- package/examples/jsm/renderers/common/Background.js +20 -22
- package/examples/jsm/renderers/common/Bindings.js +30 -21
- package/examples/jsm/renderers/common/ChainMap.js +3 -3
- package/examples/jsm/renderers/common/Color4.js +37 -0
- package/examples/jsm/renderers/common/Geometries.js +4 -4
- package/examples/jsm/renderers/common/Info.js +12 -2
- package/examples/jsm/renderers/common/Pipelines.js +3 -51
- package/examples/jsm/renderers/common/PostProcessing.js +25 -0
- package/examples/jsm/renderers/common/RenderContext.js +1 -1
- package/examples/jsm/renderers/common/RenderContexts.js +1 -1
- package/examples/jsm/renderers/common/RenderObject.js +13 -1
- package/examples/jsm/renderers/common/RenderObjects.js +4 -2
- package/examples/jsm/renderers/common/Renderer.js +137 -37
- package/examples/jsm/renderers/common/StorageTexture.js +1 -0
- package/examples/jsm/renderers/common/Textures.js +4 -1
- package/examples/jsm/renderers/common/nodes/NodeBuilderState.js +10 -2
- package/examples/jsm/renderers/common/nodes/NodeUniformsGroup.js +44 -0
- package/examples/jsm/renderers/common/nodes/Nodes.js +74 -7
- package/examples/jsm/renderers/webgl/WebGLBackend.js +91 -33
- package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +100 -31
- package/examples/jsm/renderers/webgl/utils/WebGLAttributeUtils.js +57 -5
- package/examples/jsm/renderers/webgl/utils/WebGLCapabilities.js +36 -0
- package/examples/jsm/renderers/webgl/utils/WebGLExtensions.js +11 -1
- package/examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js +71 -2
- package/examples/jsm/renderers/webgl/utils/WebGLUtils.js +42 -0
- package/examples/jsm/renderers/webgl-legacy/nodes/SlotNode.js +1 -1
- package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodeBuilder.js +33 -3
- package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodes.js +4 -14
- package/examples/jsm/renderers/webgpu/WebGPUBackend.js +186 -137
- package/examples/jsm/renderers/webgpu/WebGPURenderer.js +1 -1
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +209 -90
- package/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +15 -10
- package/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +11 -3
- package/examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js +2 -3
- package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +88 -6
- package/examples/jsm/shaders/FXAAShader.js +133 -133
- package/examples/jsm/shaders/GTAOShader.js +424 -0
- package/examples/jsm/shaders/OutputShader.js +4 -0
- package/examples/jsm/shaders/PoissonDenoiseShader.js +226 -0
- package/examples/jsm/shaders/SAOShader.js +2 -3
- package/examples/jsm/shaders/SSAOShader.js +2 -3
- package/examples/jsm/transpiler/AST.js +40 -1
- package/examples/jsm/transpiler/GLSLDecoder.js +50 -8
- package/examples/jsm/transpiler/ShaderToyDecoder.js +4 -4
- package/examples/jsm/transpiler/TSLEncoder.js +124 -20
- package/examples/jsm/utils/SortUtils.js +158 -0
- package/examples/jsm/utils/TextureUtils.js +33 -21
- package/examples/jsm/webxr/ARButton.js +14 -0
- package/examples/jsm/webxr/VRButton.js +23 -8
- package/examples/jsm/webxr/XRButton.js +25 -11
- package/package.json +5 -6
- package/src/Three.js +1 -0
- package/src/constants.js +2 -1
- package/src/core/BufferAttribute.js +21 -2
- package/src/core/InterleavedBuffer.js +21 -1
- package/src/core/Object3D.js +60 -12
- package/src/core/UniformsGroup.js +7 -1
- package/src/extras/curves/LineCurve3.js +4 -0
- package/src/loaders/AudioLoader.js +1 -1
- package/src/loaders/BufferGeometryLoader.js +0 -7
- package/src/loaders/ImageBitmapLoader.js +25 -1
- package/src/loaders/ObjectLoader.js +49 -0
- package/src/materials/ShaderMaterial.js +2 -1
- package/src/math/ColorManagement.js +0 -16
- package/src/math/Quaternion.js +5 -4
- package/src/math/Sphere.js +2 -0
- package/src/math/Triangle.js +17 -5
- package/src/objects/BatchedMesh.js +1020 -0
- package/src/objects/Skeleton.js +1 -3
- package/src/renderers/WebGL3DRenderTarget.js +2 -2
- package/src/renderers/WebGLArrayRenderTarget.js +2 -2
- package/src/renderers/WebGLRenderer.js +23 -18
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +19 -0
- package/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +0 -5
- package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +31 -4
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +9 -4
- package/src/renderers/shaders/ShaderChunk/project_vertex.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl.js +9 -17
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +84 -0
- package/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk.js +4 -0
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/distanceRGBA.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +3 -0
- package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/shadow.glsl.js +3 -0
- package/src/renderers/webgl/WebGLAttributes.js +39 -5
- package/src/renderers/webgl/WebGLBufferRenderer.js +31 -0
- package/src/renderers/webgl/WebGLCubeMaps.js +1 -1
- package/src/renderers/webgl/WebGLExtensions.js +1 -0
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +31 -0
- package/src/renderers/webgl/WebGLLights.js +11 -2
- package/src/renderers/webgl/WebGLProgram.js +20 -1
- package/src/renderers/webgl/WebGLPrograms.js +5 -0
- package/src/renderers/webgl/WebGLShadowMap.js +35 -0
- package/src/renderers/webgl/WebGLTextures.js +7 -11
- package/src/renderers/webgl/WebGLUniforms.js +11 -1
- package/src/renderers/webgl/WebGLUniformsGroups.js +72 -93
- package/src/renderers/webxr/WebXRManager.js +16 -0
- package/examples/jsm/objects/BatchedMesh.js +0 -586
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
PerspectiveCamera,
|
|
7
7
|
Scene,
|
|
8
8
|
WebGLRenderer,
|
|
9
|
-
|
|
9
|
+
CanvasTexture,
|
|
10
10
|
SRGBColorSpace
|
|
11
11
|
} from 'three';
|
|
12
12
|
|
|
@@ -21,24 +21,24 @@ export function decompress( texture, maxTextureSize = Infinity, renderer = null
|
|
|
21
21
|
if ( ! fullscreenQuadMaterial ) fullscreenQuadMaterial = new ShaderMaterial( {
|
|
22
22
|
uniforms: { blitTexture: new Uniform( texture ) },
|
|
23
23
|
vertexShader: `
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
varying vec2 vUv;
|
|
25
|
+
void main(){
|
|
26
|
+
vUv = uv;
|
|
27
|
+
gl_Position = vec4(position.xy * 1.0,0.,.999999);
|
|
28
|
+
}`,
|
|
29
29
|
fragmentShader: `
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
30
|
+
uniform sampler2D blitTexture;
|
|
31
|
+
varying vec2 vUv;
|
|
32
|
+
|
|
33
|
+
void main(){
|
|
34
|
+
gl_FragColor = vec4(vUv.xy, 0, 1);
|
|
35
|
+
|
|
36
|
+
#ifdef IS_SRGB
|
|
37
|
+
gl_FragColor = LinearTosRGB( texture2D( blitTexture, vUv) );
|
|
38
|
+
#else
|
|
39
|
+
gl_FragColor = texture2D( blitTexture, vUv);
|
|
40
|
+
#endif
|
|
41
|
+
}`
|
|
42
42
|
} );
|
|
43
43
|
|
|
44
44
|
fullscreenQuadMaterial.uniforms.blitTexture.value = texture;
|
|
@@ -56,17 +56,28 @@ export function decompress( texture, maxTextureSize = Infinity, renderer = null
|
|
|
56
56
|
const _scene = new Scene();
|
|
57
57
|
_scene.add( fullscreenQuad );
|
|
58
58
|
|
|
59
|
-
if (
|
|
59
|
+
if ( renderer === null ) {
|
|
60
60
|
|
|
61
61
|
renderer = _renderer = new WebGLRenderer( { antialias: false } );
|
|
62
62
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
const width = Math.min( texture.image.width, maxTextureSize );
|
|
66
|
+
const height = Math.min( texture.image.height, maxTextureSize );
|
|
67
|
+
|
|
68
|
+
renderer.setSize( width, height );
|
|
66
69
|
renderer.clear();
|
|
67
70
|
renderer.render( _scene, _camera );
|
|
68
71
|
|
|
69
|
-
const
|
|
72
|
+
const canvas = document.createElement( 'canvas' );
|
|
73
|
+
const context = canvas.getContext( '2d' );
|
|
74
|
+
|
|
75
|
+
canvas.width = width;
|
|
76
|
+
canvas.height = height;
|
|
77
|
+
|
|
78
|
+
context.drawImage( renderer.domElement, 0, 0, width, height );
|
|
79
|
+
|
|
80
|
+
const readableTexture = new CanvasTexture( canvas );
|
|
70
81
|
|
|
71
82
|
readableTexture.minFilter = texture.minFilter;
|
|
72
83
|
readableTexture.magFilter = texture.magFilter;
|
|
@@ -76,6 +87,7 @@ export function decompress( texture, maxTextureSize = Infinity, renderer = null
|
|
|
76
87
|
|
|
77
88
|
if ( _renderer ) {
|
|
78
89
|
|
|
90
|
+
_renderer.forceContextLoss();
|
|
79
91
|
_renderer.dispose();
|
|
80
92
|
_renderer = null;
|
|
81
93
|
|
|
@@ -104,10 +104,24 @@ class ARButton {
|
|
|
104
104
|
|
|
105
105
|
currentSession.end();
|
|
106
106
|
|
|
107
|
+
if ( navigator.xr.offerSession !== undefined ) {
|
|
108
|
+
|
|
109
|
+
navigator.xr.offerSession( 'immersive-ar', sessionInit )
|
|
110
|
+
.then( onSessionStarted );
|
|
111
|
+
|
|
112
|
+
}
|
|
113
|
+
|
|
107
114
|
}
|
|
108
115
|
|
|
109
116
|
};
|
|
110
117
|
|
|
118
|
+
if ( navigator.xr.offerSession !== undefined ) {
|
|
119
|
+
|
|
120
|
+
navigator.xr.offerSession( 'immersive-ar', sessionInit )
|
|
121
|
+
.then( onSessionStarted );
|
|
122
|
+
|
|
123
|
+
}
|
|
124
|
+
|
|
111
125
|
}
|
|
112
126
|
|
|
113
127
|
function disableButton() {
|
|
@@ -39,6 +39,15 @@ class VRButton {
|
|
|
39
39
|
|
|
40
40
|
button.textContent = 'ENTER VR';
|
|
41
41
|
|
|
42
|
+
// WebXR's requestReferenceSpace only works if the corresponding feature
|
|
43
|
+
// was requested at session creation time. For simplicity, just ask for
|
|
44
|
+
// the interesting ones as optional features, but be aware that the
|
|
45
|
+
// requestReferenceSpace call will fail if it turns out to be unavailable.
|
|
46
|
+
// ('local' is always available for immersive sessions and doesn't need to
|
|
47
|
+
// be requested separately.)
|
|
48
|
+
|
|
49
|
+
const sessionInit = { optionalFeatures: [ 'local-floor', 'bounded-floor', 'hand-tracking', 'layers' ] };
|
|
50
|
+
|
|
42
51
|
button.onmouseenter = function () {
|
|
43
52
|
|
|
44
53
|
button.style.opacity = '1.0';
|
|
@@ -55,24 +64,30 @@ class VRButton {
|
|
|
55
64
|
|
|
56
65
|
if ( currentSession === null ) {
|
|
57
66
|
|
|
58
|
-
// WebXR's requestReferenceSpace only works if the corresponding feature
|
|
59
|
-
// was requested at session creation time. For simplicity, just ask for
|
|
60
|
-
// the interesting ones as optional features, but be aware that the
|
|
61
|
-
// requestReferenceSpace call will fail if it turns out to be unavailable.
|
|
62
|
-
// ('local' is always available for immersive sessions and doesn't need to
|
|
63
|
-
// be requested separately.)
|
|
64
|
-
|
|
65
|
-
const sessionInit = { optionalFeatures: [ 'local-floor', 'bounded-floor', 'hand-tracking', 'layers' ] };
|
|
66
67
|
navigator.xr.requestSession( 'immersive-vr', sessionInit ).then( onSessionStarted );
|
|
67
68
|
|
|
68
69
|
} else {
|
|
69
70
|
|
|
70
71
|
currentSession.end();
|
|
71
72
|
|
|
73
|
+
if ( navigator.xr.offerSession !== undefined ) {
|
|
74
|
+
|
|
75
|
+
navigator.xr.offerSession( 'immersive-vr', sessionInit )
|
|
76
|
+
.then( onSessionStarted );
|
|
77
|
+
|
|
78
|
+
}
|
|
79
|
+
|
|
72
80
|
}
|
|
73
81
|
|
|
74
82
|
};
|
|
75
83
|
|
|
84
|
+
if ( navigator.xr.offerSession !== undefined ) {
|
|
85
|
+
|
|
86
|
+
navigator.xr.offerSession( 'immersive-vr', sessionInit )
|
|
87
|
+
.then( onSessionStarted );
|
|
88
|
+
|
|
89
|
+
}
|
|
90
|
+
|
|
76
91
|
}
|
|
77
92
|
|
|
78
93
|
function disableButton() {
|
|
@@ -40,6 +40,17 @@ class XRButton {
|
|
|
40
40
|
|
|
41
41
|
button.textContent = 'START XR';
|
|
42
42
|
|
|
43
|
+
const sessionOptions = {
|
|
44
|
+
...sessionInit,
|
|
45
|
+
optionalFeatures: [
|
|
46
|
+
'local-floor',
|
|
47
|
+
'bounded-floor',
|
|
48
|
+
'hand-tracking',
|
|
49
|
+
'layers',
|
|
50
|
+
...( sessionInit.optionalFeatures || [] )
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
|
|
43
54
|
button.onmouseenter = function () {
|
|
44
55
|
|
|
45
56
|
button.style.opacity = '1.0';
|
|
@@ -56,17 +67,6 @@ class XRButton {
|
|
|
56
67
|
|
|
57
68
|
if ( currentSession === null ) {
|
|
58
69
|
|
|
59
|
-
const sessionOptions = {
|
|
60
|
-
...sessionInit,
|
|
61
|
-
optionalFeatures: [
|
|
62
|
-
'local-floor',
|
|
63
|
-
'bounded-floor',
|
|
64
|
-
'hand-tracking',
|
|
65
|
-
'layers',
|
|
66
|
-
...( sessionInit.optionalFeatures || [] )
|
|
67
|
-
],
|
|
68
|
-
};
|
|
69
|
-
|
|
70
70
|
navigator.xr.requestSession( mode, sessionOptions )
|
|
71
71
|
.then( onSessionStarted );
|
|
72
72
|
|
|
@@ -74,10 +74,24 @@ class XRButton {
|
|
|
74
74
|
|
|
75
75
|
currentSession.end();
|
|
76
76
|
|
|
77
|
+
if ( navigator.xr.offerSession !== undefined ) {
|
|
78
|
+
|
|
79
|
+
navigator.xr.offerSession( mode, sessionOptions )
|
|
80
|
+
.then( onSessionStarted );
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
|
|
77
84
|
}
|
|
78
85
|
|
|
79
86
|
};
|
|
80
87
|
|
|
88
|
+
if ( navigator.xr.offerSession !== undefined ) {
|
|
89
|
+
|
|
90
|
+
navigator.xr.offerSession( mode, sessionOptions )
|
|
91
|
+
.then( onSessionStarted );
|
|
92
|
+
|
|
93
|
+
}
|
|
94
|
+
|
|
81
95
|
}
|
|
82
96
|
|
|
83
97
|
function disableButton() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "super-three",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.160.0",
|
|
4
4
|
"description": "JavaScript 3D library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./build/three.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"type": "git",
|
|
22
22
|
"url": "supermedium/three.js"
|
|
23
23
|
},
|
|
24
|
-
"sideEffects":
|
|
24
|
+
"sideEffects": ["./examples/jsm/nodes/**/*"],
|
|
25
25
|
"files": [
|
|
26
26
|
"build",
|
|
27
27
|
"examples/jsm",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"test": "npm run lint && npm run test-unit",
|
|
45
45
|
"build": "rollup -c utils/build/rollup.config.js",
|
|
46
46
|
"build-module": "rollup -c utils/build/rollup.config.js --configOnlyModule",
|
|
47
|
-
"dev": "concurrently --names \"ROLLUP,HTTP\" -c \"bgBlue.bold,bgGreen.bold\" \"rollup -c utils/build/rollup.config.js -w -m inline\" \"servez -p 8080
|
|
47
|
+
"dev": "concurrently --names \"ROLLUP,HTTP\" -c \"bgBlue.bold,bgGreen.bold\" \"rollup -c utils/build/rollup.config.js -w -m inline\" \"servez -p 8080\"",
|
|
48
48
|
"lint-core": "eslint src",
|
|
49
49
|
"lint-addons": "eslint examples/jsm --ext .js --ignore-pattern libs --ignore-pattern ifc",
|
|
50
50
|
"lint-examples": "eslint examples --ext .html",
|
|
@@ -86,7 +86,6 @@
|
|
|
86
86
|
},
|
|
87
87
|
"homepage": "https://threejs.org/",
|
|
88
88
|
"devDependencies": {
|
|
89
|
-
"@puppeteer/browsers": "^1.4.1",
|
|
90
89
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
91
90
|
"@rollup/plugin-terser": "^0.4.0",
|
|
92
91
|
"chalk": "^5.2.0",
|
|
@@ -101,9 +100,9 @@
|
|
|
101
100
|
"jimp": "^0.22.7",
|
|
102
101
|
"magic-string": "^0.30.0",
|
|
103
102
|
"pixelmatch": "^5.3.0",
|
|
104
|
-
"puppeteer
|
|
103
|
+
"puppeteer": "^21.5.1",
|
|
105
104
|
"qunit": "^2.19.4",
|
|
106
|
-
"rollup": "^
|
|
105
|
+
"rollup": "^4.6.0",
|
|
107
106
|
"rollup-plugin-filesize": "^10.0.0",
|
|
108
107
|
"rollup-plugin-visualizer": "^5.9.0",
|
|
109
108
|
"servez": "^2.0.0"
|
package/src/Three.js
CHANGED
|
@@ -21,6 +21,7 @@ export { Skeleton } from './objects/Skeleton.js';
|
|
|
21
21
|
export { Bone } from './objects/Bone.js';
|
|
22
22
|
export { Mesh } from './objects/Mesh.js';
|
|
23
23
|
export { InstancedMesh } from './objects/InstancedMesh.js';
|
|
24
|
+
export { BatchedMesh } from './objects/BatchedMesh.js';
|
|
24
25
|
export { LineSegments } from './objects/LineSegments.js';
|
|
25
26
|
export { LineLoop } from './objects/LineLoop.js';
|
|
26
27
|
export { Line } from './objects/Line.js';
|
package/src/constants.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const REVISION = '
|
|
1
|
+
export const REVISION = '160';
|
|
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 };
|
|
@@ -57,6 +57,7 @@ export const ReinhardToneMapping = 2;
|
|
|
57
57
|
export const CineonToneMapping = 3;
|
|
58
58
|
export const ACESFilmicToneMapping = 4;
|
|
59
59
|
export const CustomToneMapping = 5;
|
|
60
|
+
export const AgXToneMapping = 6;
|
|
60
61
|
export const AttachedBindMode = 'attached';
|
|
61
62
|
export const DetachedBindMode = 'detached';
|
|
62
63
|
|
|
@@ -27,7 +27,8 @@ class BufferAttribute {
|
|
|
27
27
|
this.normalized = normalized;
|
|
28
28
|
|
|
29
29
|
this.usage = StaticDrawUsage;
|
|
30
|
-
this.
|
|
30
|
+
this._updateRange = { offset: 0, count: - 1 };
|
|
31
|
+
this.updateRanges = [];
|
|
31
32
|
this.gpuType = FloatType;
|
|
32
33
|
|
|
33
34
|
this.version = 0;
|
|
@@ -42,6 +43,13 @@ class BufferAttribute {
|
|
|
42
43
|
|
|
43
44
|
}
|
|
44
45
|
|
|
46
|
+
get updateRange() {
|
|
47
|
+
|
|
48
|
+
console.warn( 'THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159
|
|
49
|
+
return this._updateRange;
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
45
53
|
setUsage( value ) {
|
|
46
54
|
|
|
47
55
|
this.usage = value;
|
|
@@ -50,6 +58,18 @@ class BufferAttribute {
|
|
|
50
58
|
|
|
51
59
|
}
|
|
52
60
|
|
|
61
|
+
addUpdateRange( start, count ) {
|
|
62
|
+
|
|
63
|
+
this.updateRanges.push( { start, count } );
|
|
64
|
+
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
clearUpdateRanges() {
|
|
68
|
+
|
|
69
|
+
this.updateRanges.length = 0;
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
|
|
53
73
|
copy( source ) {
|
|
54
74
|
|
|
55
75
|
this.name = source.name;
|
|
@@ -360,7 +380,6 @@ class BufferAttribute {
|
|
|
360
380
|
|
|
361
381
|
if ( this.name !== '' ) data.name = this.name;
|
|
362
382
|
if ( this.usage !== StaticDrawUsage ) data.usage = this.usage;
|
|
363
|
-
if ( this.updateRange.offset !== 0 || this.updateRange.count !== - 1 ) data.updateRange = this.updateRange;
|
|
364
383
|
|
|
365
384
|
return data;
|
|
366
385
|
|
|
@@ -12,7 +12,8 @@ class InterleavedBuffer {
|
|
|
12
12
|
this.count = array !== undefined ? array.length / stride : 0;
|
|
13
13
|
|
|
14
14
|
this.usage = StaticDrawUsage;
|
|
15
|
-
this.
|
|
15
|
+
this._updateRange = { offset: 0, count: - 1 };
|
|
16
|
+
this.updateRanges = [];
|
|
16
17
|
|
|
17
18
|
this.version = 0;
|
|
18
19
|
|
|
@@ -28,6 +29,13 @@ class InterleavedBuffer {
|
|
|
28
29
|
|
|
29
30
|
}
|
|
30
31
|
|
|
32
|
+
get updateRange() {
|
|
33
|
+
|
|
34
|
+
console.warn( 'THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159
|
|
35
|
+
return this._updateRange;
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
|
|
31
39
|
setUsage( value ) {
|
|
32
40
|
|
|
33
41
|
this.usage = value;
|
|
@@ -36,6 +44,18 @@ class InterleavedBuffer {
|
|
|
36
44
|
|
|
37
45
|
}
|
|
38
46
|
|
|
47
|
+
addUpdateRange( start, count ) {
|
|
48
|
+
|
|
49
|
+
this.updateRanges.push( { start, count } );
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
clearUpdateRanges() {
|
|
54
|
+
|
|
55
|
+
this.updateRanges.length = 0;
|
|
56
|
+
|
|
57
|
+
}
|
|
58
|
+
|
|
39
59
|
copy( source ) {
|
|
40
60
|
|
|
41
61
|
this.array = new source.array.constructor( source.array );
|
package/src/core/Object3D.js
CHANGED
|
@@ -98,9 +98,9 @@ class Object3D extends EventDispatcher {
|
|
|
98
98
|
this.matrixWorld = new Matrix4();
|
|
99
99
|
|
|
100
100
|
this.matrixAutoUpdate = Object3D.DEFAULT_MATRIX_AUTO_UPDATE;
|
|
101
|
-
this.matrixWorldNeedsUpdate = false;
|
|
102
101
|
|
|
103
102
|
this.matrixWorldAutoUpdate = Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE; // checked by the renderer
|
|
103
|
+
this.matrixWorldNeedsUpdate = false;
|
|
104
104
|
|
|
105
105
|
this.layers = new Layers();
|
|
106
106
|
this.visible = true;
|
|
@@ -117,6 +117,10 @@ class Object3D extends EventDispatcher {
|
|
|
117
117
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
+
onBeforeShadow( /* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */ ) {}
|
|
121
|
+
|
|
122
|
+
onAfterShadow( /* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */ ) {}
|
|
123
|
+
|
|
120
124
|
onBeforeRender( /* renderer, scene, camera, geometry, material, group */ ) {}
|
|
121
125
|
|
|
122
126
|
onAfterRender( /* renderer, scene, camera, geometry, material, group */ ) {}
|
|
@@ -457,21 +461,15 @@ class Object3D extends EventDispatcher {
|
|
|
457
461
|
|
|
458
462
|
}
|
|
459
463
|
|
|
460
|
-
getObjectsByProperty( name, value ) {
|
|
461
|
-
|
|
462
|
-
let result = [];
|
|
464
|
+
getObjectsByProperty( name, value, result = [] ) {
|
|
463
465
|
|
|
464
466
|
if ( this[ name ] === value ) result.push( this );
|
|
465
467
|
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
const childResult = this.children[ i ].getObjectsByProperty( name, value );
|
|
469
|
-
|
|
470
|
-
if ( childResult.length > 0 ) {
|
|
468
|
+
const children = this.children;
|
|
471
469
|
|
|
472
|
-
|
|
470
|
+
for ( let i = 0, l = children.length; i < l; i ++ ) {
|
|
473
471
|
|
|
474
|
-
|
|
472
|
+
children[ i ].getObjectsByProperty( name, value, result );
|
|
475
473
|
|
|
476
474
|
}
|
|
477
475
|
|
|
@@ -719,6 +717,56 @@ class Object3D extends EventDispatcher {
|
|
|
719
717
|
|
|
720
718
|
}
|
|
721
719
|
|
|
720
|
+
if ( this.isBatchedMesh ) {
|
|
721
|
+
|
|
722
|
+
object.type = 'BatchedMesh';
|
|
723
|
+
object.perObjectFrustumCulled = this.perObjectFrustumCulled;
|
|
724
|
+
object.sortObjects = this.sortObjects;
|
|
725
|
+
|
|
726
|
+
object.drawRanges = this._drawRanges;
|
|
727
|
+
object.reservedRanges = this._reservedRanges;
|
|
728
|
+
|
|
729
|
+
object.visibility = this._visibility;
|
|
730
|
+
object.active = this._active;
|
|
731
|
+
object.bounds = this._bounds.map( bound => ( {
|
|
732
|
+
boxInitialized: bound.boxInitialized,
|
|
733
|
+
boxMin: bound.box.min.toArray(),
|
|
734
|
+
boxMax: bound.box.max.toArray(),
|
|
735
|
+
|
|
736
|
+
sphereInitialized: bound.sphereInitialized,
|
|
737
|
+
sphereRadius: bound.sphere.radius,
|
|
738
|
+
sphereCenter: bound.sphere.center.toArray()
|
|
739
|
+
} ) );
|
|
740
|
+
|
|
741
|
+
object.maxGeometryCount = this._maxGeometryCount;
|
|
742
|
+
object.maxVertexCount = this._maxVertexCount;
|
|
743
|
+
object.maxIndexCount = this._maxIndexCount;
|
|
744
|
+
|
|
745
|
+
object.geometryInitialized = this._geometryInitialized;
|
|
746
|
+
object.geometryCount = this._geometryCount;
|
|
747
|
+
|
|
748
|
+
object.matricesTexture = this._matricesTexture.toJSON( meta );
|
|
749
|
+
|
|
750
|
+
if ( this.boundingSphere !== null ) {
|
|
751
|
+
|
|
752
|
+
object.boundingSphere = {
|
|
753
|
+
center: object.boundingSphere.center.toArray(),
|
|
754
|
+
radius: object.boundingSphere.radius
|
|
755
|
+
};
|
|
756
|
+
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
if ( this.boundingBox !== null ) {
|
|
760
|
+
|
|
761
|
+
object.boundingBox = {
|
|
762
|
+
min: object.boundingBox.min.toArray(),
|
|
763
|
+
max: object.boundingBox.max.toArray()
|
|
764
|
+
};
|
|
765
|
+
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
}
|
|
769
|
+
|
|
722
770
|
//
|
|
723
771
|
|
|
724
772
|
function serialize( library, element ) {
|
|
@@ -919,9 +967,9 @@ class Object3D extends EventDispatcher {
|
|
|
919
967
|
this.matrixWorld.copy( source.matrixWorld );
|
|
920
968
|
|
|
921
969
|
this.matrixAutoUpdate = source.matrixAutoUpdate;
|
|
922
|
-
this.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;
|
|
923
970
|
|
|
924
971
|
this.matrixWorldAutoUpdate = source.matrixWorldAutoUpdate;
|
|
972
|
+
this.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;
|
|
925
973
|
|
|
926
974
|
this.layers.mask = source.layers.mask;
|
|
927
975
|
this.visible = source.visible;
|
|
@@ -73,7 +73,13 @@ class UniformsGroup extends EventDispatcher {
|
|
|
73
73
|
|
|
74
74
|
for ( let i = 0, l = uniformsSource.length; i < l; i ++ ) {
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
const uniforms = Array.isArray( uniformsSource[ i ] ) ? uniformsSource[ i ] : [ uniformsSource[ i ] ];
|
|
77
|
+
|
|
78
|
+
for ( let j = 0; j < uniforms.length; j ++ ) {
|
|
79
|
+
|
|
80
|
+
this.uniforms.push( uniforms[ j ].clone() );
|
|
81
|
+
|
|
82
|
+
}
|
|
77
83
|
|
|
78
84
|
}
|
|
79
85
|
|
|
@@ -15,6 +15,7 @@ class LineCurve3 extends Curve {
|
|
|
15
15
|
this.v2 = v2;
|
|
16
16
|
|
|
17
17
|
}
|
|
18
|
+
|
|
18
19
|
getPoint( t, optionalTarget = new Vector3() ) {
|
|
19
20
|
|
|
20
21
|
const point = optionalTarget;
|
|
@@ -33,6 +34,7 @@ class LineCurve3 extends Curve {
|
|
|
33
34
|
return point;
|
|
34
35
|
|
|
35
36
|
}
|
|
37
|
+
|
|
36
38
|
// Line curve is linear, so we can overwrite default getPointAt
|
|
37
39
|
getPointAt( u, optionalTarget ) {
|
|
38
40
|
|
|
@@ -62,6 +64,7 @@ class LineCurve3 extends Curve {
|
|
|
62
64
|
return this;
|
|
63
65
|
|
|
64
66
|
}
|
|
67
|
+
|
|
65
68
|
toJSON() {
|
|
66
69
|
|
|
67
70
|
const data = super.toJSON();
|
|
@@ -72,6 +75,7 @@ class LineCurve3 extends Curve {
|
|
|
72
75
|
return data;
|
|
73
76
|
|
|
74
77
|
}
|
|
78
|
+
|
|
75
79
|
fromJSON( json ) {
|
|
76
80
|
|
|
77
81
|
super.fromJSON( json );
|
|
@@ -125,13 +125,6 @@ class BufferGeometryLoader extends Loader {
|
|
|
125
125
|
if ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;
|
|
126
126
|
if ( attribute.usage !== undefined ) bufferAttribute.setUsage( attribute.usage );
|
|
127
127
|
|
|
128
|
-
if ( attribute.updateRange !== undefined ) {
|
|
129
|
-
|
|
130
|
-
bufferAttribute.updateRange.offset = attribute.updateRange.offset;
|
|
131
|
-
bufferAttribute.updateRange.count = attribute.updateRange.count;
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
|
|
135
128
|
geometry.setAttribute( key, bufferAttribute );
|
|
136
129
|
|
|
137
130
|
}
|
|
@@ -49,6 +49,25 @@ class ImageBitmapLoader extends Loader {
|
|
|
49
49
|
|
|
50
50
|
scope.manager.itemStart( url );
|
|
51
51
|
|
|
52
|
+
// If cached is a promise, wait for it to resolve
|
|
53
|
+
if ( cached.then ) {
|
|
54
|
+
|
|
55
|
+
cached.then( imageBitmap => {
|
|
56
|
+
|
|
57
|
+
if ( onLoad ) onLoad( imageBitmap );
|
|
58
|
+
|
|
59
|
+
scope.manager.itemEnd( url );
|
|
60
|
+
|
|
61
|
+
} ).catch( e => {
|
|
62
|
+
|
|
63
|
+
if ( onError ) onError( e );
|
|
64
|
+
|
|
65
|
+
} );
|
|
66
|
+
return;
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// If cached is not a promise (i.e., it's already an imageBitmap)
|
|
52
71
|
setTimeout( function () {
|
|
53
72
|
|
|
54
73
|
if ( onLoad ) onLoad( cached );
|
|
@@ -65,7 +84,7 @@ class ImageBitmapLoader extends Loader {
|
|
|
65
84
|
fetchOptions.credentials = ( this.crossOrigin === 'anonymous' ) ? 'same-origin' : 'include';
|
|
66
85
|
fetchOptions.headers = this.requestHeader;
|
|
67
86
|
|
|
68
|
-
fetch( url, fetchOptions ).then( function ( res ) {
|
|
87
|
+
const promise = fetch( url, fetchOptions ).then( function ( res ) {
|
|
69
88
|
|
|
70
89
|
return res.blob();
|
|
71
90
|
|
|
@@ -81,15 +100,20 @@ class ImageBitmapLoader extends Loader {
|
|
|
81
100
|
|
|
82
101
|
scope.manager.itemEnd( url );
|
|
83
102
|
|
|
103
|
+
return imageBitmap;
|
|
104
|
+
|
|
84
105
|
} ).catch( function ( e ) {
|
|
85
106
|
|
|
86
107
|
if ( onError ) onError( e );
|
|
87
108
|
|
|
109
|
+
Cache.remove( url );
|
|
110
|
+
|
|
88
111
|
scope.manager.itemError( url );
|
|
89
112
|
scope.manager.itemEnd( url );
|
|
90
113
|
|
|
91
114
|
} );
|
|
92
115
|
|
|
116
|
+
Cache.add( url, promise );
|
|
93
117
|
scope.manager.itemStart( url );
|
|
94
118
|
|
|
95
119
|
}
|