@plastic-software/three 0.183.4 → 0.184.1
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 +775 -287
- package/build/three.core.js +372 -110
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +428 -181
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +7 -1
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +2979 -1281
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +2942 -1281
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/Addons.js +11 -0
- package/examples/jsm/animation/CCDIKSolver.js +5 -1
- package/examples/jsm/controls/ArcballControls.js +4 -1
- package/examples/jsm/controls/DragControls.js +2 -2
- package/examples/jsm/controls/FirstPersonControls.js +58 -54
- package/examples/jsm/controls/FlyControls.js +4 -0
- package/examples/jsm/controls/OrbitControls.js +2 -2
- package/examples/jsm/controls/TrackballControls.js +2 -2
- package/examples/jsm/controls/TransformControls.js +34 -2
- package/examples/jsm/csm/CSMShadowNode.js +6 -2
- package/examples/jsm/exporters/GLTFExporter.js +21 -5
- package/examples/jsm/geometries/TextGeometry.js +18 -0
- package/examples/jsm/helpers/LightProbeGridHelper.js +221 -0
- package/examples/jsm/inspector/Extension.js +13 -0
- package/examples/jsm/inspector/Inspector.js +169 -114
- package/examples/jsm/inspector/RendererInspector.js +2 -2
- package/examples/jsm/inspector/extensions/extensions.json +6 -0
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.js +916 -0
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.js +281 -0
- package/examples/jsm/inspector/tabs/Memory.js +128 -0
- package/examples/jsm/inspector/tabs/Parameters.js +34 -2
- package/examples/jsm/inspector/tabs/Performance.js +2 -2
- package/examples/jsm/inspector/tabs/Settings.js +264 -0
- package/examples/jsm/inspector/tabs/Timeline.js +1611 -0
- package/examples/jsm/inspector/tabs/Viewer.js +105 -3
- package/examples/jsm/inspector/ui/Graph.js +2 -2
- package/examples/jsm/inspector/ui/List.js +1 -1
- package/examples/jsm/inspector/ui/Profiler.js +273 -176
- package/examples/jsm/inspector/ui/Style.js +64 -10
- package/examples/jsm/inspector/ui/Tab.js +39 -7
- package/examples/jsm/inspector/ui/Values.js +39 -2
- package/examples/jsm/inspector/ui/utils.js +13 -0
- package/examples/jsm/interaction/InteractionManager.js +226 -0
- package/examples/jsm/libs/meshopt_decoder.module.js +8 -8
- package/examples/jsm/lighting/DynamicLighting.js +82 -0
- package/examples/jsm/lighting/LightProbeGrid.js +651 -0
- package/examples/jsm/lines/LineMaterial.js +1 -1
- package/examples/jsm/loaders/EXRLoader.js +682 -43
- package/examples/jsm/loaders/FBXLoader.js +233 -33
- package/examples/jsm/loaders/GLTFLoader.js +24 -7
- package/examples/jsm/loaders/HDRLoader.js +1 -1
- package/examples/jsm/loaders/KTX2Loader.js +8 -2
- package/examples/jsm/loaders/LDrawLoader.js +39 -47
- package/examples/jsm/loaders/SVGLoader.js +1 -1
- package/examples/jsm/loaders/VTKLoader.js +5 -1
- package/examples/jsm/loaders/collada/ColladaComposer.js +101 -7
- package/examples/jsm/loaders/collada/ColladaParser.js +19 -4
- package/examples/jsm/loaders/usd/USDAParser.js +6 -0
- package/examples/jsm/loaders/usd/USDCParser.js +26 -0
- package/examples/jsm/loaders/usd/USDComposer.js +656 -103
- package/examples/jsm/misc/GPUComputationRenderer.js +2 -0
- package/examples/jsm/misc/RollerCoaster.js +42 -4
- package/examples/jsm/modifiers/TessellateModifier.js +1 -1
- package/examples/jsm/objects/Reflector.js +73 -25
- package/examples/jsm/objects/Sky.js +14 -2
- package/examples/jsm/objects/SkyMesh.js +23 -6
- package/examples/jsm/renderers/Projector.js +18 -38
- package/examples/jsm/renderers/SVGRenderer.js +6 -25
- package/examples/jsm/transpiler/GLSLDecoder.js +2 -2
- package/examples/jsm/tsl/WebGLNodesHandler.js +605 -0
- package/examples/jsm/tsl/display/AfterImageNode.js +10 -0
- package/examples/jsm/tsl/display/AnamorphicNode.js +11 -0
- package/examples/jsm/tsl/display/BilateralBlurNode.js +10 -0
- package/examples/jsm/tsl/display/ChromaticAberrationNode.js +3 -36
- package/examples/jsm/tsl/display/FSR1Node.js +477 -0
- package/examples/jsm/tsl/display/GTAONode.js +2 -1
- package/examples/jsm/tsl/display/GaussianBlurNode.js +10 -0
- package/examples/jsm/tsl/display/GodraysNode.js +2 -11
- package/examples/jsm/tsl/display/OutlineNode.js +66 -16
- package/examples/jsm/tsl/display/SSGINode.js +0 -4
- package/examples/jsm/tsl/display/SharpenNode.js +283 -0
- package/examples/jsm/tsl/display/TAAUNode.js +835 -0
- package/examples/jsm/tsl/display/TRAANode.js +48 -7
- package/examples/jsm/tsl/lighting/DynamicLightsNode.js +300 -0
- package/examples/jsm/tsl/lighting/data/AmbientLightDataNode.js +61 -0
- package/examples/jsm/tsl/lighting/data/DirectionalLightDataNode.js +111 -0
- package/examples/jsm/tsl/lighting/data/HemisphereLightDataNode.js +99 -0
- package/examples/jsm/tsl/lighting/data/PointLightDataNode.js +134 -0
- package/examples/jsm/tsl/lighting/data/SpotLightDataNode.js +161 -0
- package/examples/jsm/tsl/math/Bayer.js +13 -2
- package/examples/jsm/utils/BufferGeometryUtils.js +2 -3
- package/examples/jsm/utils/ColorUtils.js +76 -0
- package/examples/jsm/utils/SkeletonUtils.js +14 -8
- package/examples/jsm/webxr/XRHandMeshModel.js +36 -10
- package/examples/jsm/webxr/XRHandModelFactory.js +2 -1
- package/package.json +4 -4
- package/src/Three.Core.js +1 -0
- package/src/Three.TSL.js +6 -0
- package/src/Three.WebGPU.Nodes.js +3 -0
- package/src/Three.WebGPU.js +6 -0
- package/src/animation/AnimationAction.js +11 -1
- package/src/audio/AudioContext.js +2 -2
- package/src/constants.js +1 -1
- package/src/core/BufferAttribute.js +13 -1
- package/src/core/Clock.js +1 -1
- package/src/core/Object3D.js +1 -5
- package/src/core/RenderTarget.js +1 -0
- package/src/extras/curves/CatmullRomCurve3.js +3 -2
- package/src/loaders/AudioLoader.js +11 -1
- package/src/loaders/DataTextureLoader.js +6 -4
- package/src/loaders/FileLoader.js +1 -2
- package/src/loaders/ImageBitmapLoader.js +4 -6
- package/src/loaders/MaterialLoader.js +1 -1
- package/src/loaders/ObjectLoader.js +25 -4
- package/src/loaders/nodes/NodeObjectLoader.js +18 -0
- package/src/materials/MeshToonMaterial.js +1 -1
- package/src/materials/nodes/Line2NodeMaterial.js +27 -0
- package/src/materials/nodes/NodeMaterial.js +0 -27
- package/src/materials/nodes/manager/NodeMaterialObserver.js +188 -89
- package/src/math/Line3.js +3 -0
- package/src/math/Matrix2.js +13 -9
- package/src/math/Matrix3.js +13 -9
- package/src/math/Matrix4.js +13 -9
- package/src/math/Plane.js +4 -3
- package/src/math/Triangle.js +1 -1
- package/src/math/Vector2.js +11 -7
- package/src/math/Vector3.js +12 -8
- package/src/math/Vector4.js +13 -9
- package/src/nodes/Nodes.js +0 -1
- package/src/nodes/TSL.js +1 -1
- package/src/nodes/accessors/BufferAttributeNode.js +9 -3
- package/src/nodes/accessors/CubeTextureNode.js +7 -1
- package/src/nodes/accessors/MaterialProperties.js +2 -5
- package/src/nodes/accessors/Object3DNode.js +1 -1
- package/src/nodes/accessors/ReferenceBaseNode.js +2 -2
- package/src/nodes/accessors/ReferenceNode.js +4 -4
- package/src/nodes/accessors/SceneProperties.js +2 -8
- package/src/nodes/accessors/StorageBufferNode.js +10 -4
- package/src/nodes/accessors/StorageTextureNode.js +4 -9
- package/src/nodes/accessors/TextureNode.js +10 -2
- package/src/nodes/accessors/UniformArrayNode.js +2 -2
- package/src/nodes/code/FunctionCallNode.js +1 -1
- package/src/nodes/code/FunctionNode.js +1 -1
- package/src/nodes/core/ArrayNode.js +1 -1
- package/src/nodes/core/AssignNode.js +1 -1
- package/src/nodes/core/AttributeNode.js +1 -1
- package/src/nodes/core/BypassNode.js +1 -1
- package/src/nodes/core/ContextNode.js +1 -1
- package/src/nodes/core/IndexNode.js +2 -1
- package/src/nodes/core/InputNode.js +1 -1
- package/src/nodes/core/InspectorNode.js +1 -1
- package/src/nodes/core/IsolateNode.js +1 -1
- package/src/nodes/core/Node.js +83 -12
- package/src/nodes/core/NodeBuilder.js +117 -16
- package/src/nodes/core/NodeUtils.js +1 -1
- package/src/nodes/core/OutputStructNode.js +1 -1
- package/src/nodes/core/ParameterNode.js +1 -1
- package/src/nodes/core/StackNode.js +1 -1
- package/src/nodes/core/StructNode.js +1 -1
- package/src/nodes/core/StructTypeNode.js +1 -1
- package/src/nodes/core/SubBuildNode.js +1 -1
- package/src/nodes/core/UniformGroupNode.js +36 -6
- package/src/nodes/core/VarNode.js +1 -1
- package/src/nodes/core/VaryingNode.js +1 -1
- package/src/nodes/display/NormalMapNode.js +2 -2
- package/src/nodes/display/PassNode.js +27 -7
- package/src/nodes/display/RenderOutputNode.js +4 -4
- package/src/nodes/display/ScreenNode.js +1 -1
- package/src/nodes/display/ViewportDepthTextureNode.js +11 -15
- package/src/nodes/display/ViewportTextureNode.js +18 -7
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +2 -2
- package/src/nodes/geometry/RangeNode.js +1 -1
- package/src/nodes/gpgpu/AtomicFunctionNode.js +1 -1
- package/src/nodes/gpgpu/BarrierNode.js +9 -0
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +1 -1
- package/src/nodes/gpgpu/ComputeNode.js +69 -44
- package/src/nodes/gpgpu/SubgroupFunctionNode.js +1 -1
- package/src/nodes/lighting/LightsNode.js +6 -27
- package/src/nodes/lighting/ShadowNode.js +24 -2
- package/src/nodes/math/BitcastNode.js +1 -1
- package/src/nodes/math/ConditionalNode.js +1 -1
- package/src/nodes/math/MathNode.js +73 -1
- package/src/nodes/math/OperatorNode.js +1 -1
- package/src/nodes/math/PackFloatNode.js +1 -1
- package/src/nodes/math/UnpackFloatNode.js +1 -1
- package/src/nodes/tsl/TSLBase.js +1 -1
- package/src/nodes/tsl/TSLCore.js +21 -3
- package/src/nodes/utils/ArrayElementNode.js +1 -1
- package/src/nodes/utils/ConvertNode.js +1 -1
- package/src/nodes/utils/DebugNode.js +1 -1
- package/src/nodes/utils/EventNode.js +30 -0
- package/src/nodes/utils/FlipNode.js +1 -1
- package/src/nodes/utils/FunctionOverloadingNode.js +1 -1
- package/src/nodes/utils/JoinNode.js +1 -1
- package/src/nodes/utils/MemberNode.js +1 -1
- package/src/nodes/utils/Remap.js +48 -0
- package/src/nodes/utils/RotateNode.js +1 -1
- package/src/nodes/utils/SetNode.js +1 -1
- package/src/nodes/utils/SplitNode.js +1 -1
- package/src/objects/BatchedMesh.js +17 -2
- package/src/objects/InstancedMesh.js +19 -3
- package/src/objects/SkinnedMesh.js +26 -9
- package/src/renderers/WebGLRenderer.js +147 -48
- package/src/renderers/common/Animation.js +3 -3
- package/src/renderers/common/Attributes.js +15 -1
- package/src/renderers/common/Backend.js +0 -8
- package/src/renderers/common/Background.js +2 -2
- package/src/renderers/common/BindGroup.js +1 -8
- package/src/renderers/common/Bindings.js +2 -2
- package/src/renderers/common/ComputePipeline.js +1 -1
- package/src/renderers/common/CubeRenderTarget.js +1 -1
- package/src/renderers/common/Info.js +333 -4
- package/src/renderers/common/InspectorBase.js +6 -1
- package/src/renderers/common/Pipelines.js +36 -3
- package/src/renderers/common/ReadbackBuffer.js +78 -0
- package/src/renderers/common/RenderBundle.js +3 -1
- package/src/renderers/common/RenderBundles.js +5 -2
- package/src/renderers/common/RenderObject.js +2 -2
- package/src/renderers/common/RenderObjects.js +3 -3
- package/src/renderers/common/RenderPipeline.js +35 -6
- package/src/renderers/common/Renderer.js +232 -53
- package/src/renderers/common/Textures.js +72 -3
- package/src/renderers/common/UniformsGroup.js +1 -1
- package/src/renderers/common/XRManager.js +34 -27
- package/src/renderers/common/extras/PMREMGenerator.js +23 -15
- package/src/renderers/common/nodes/NodeBuilderState.js +1 -1
- package/src/renderers/common/nodes/NodeManager.js +230 -99
- package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +0 -1
- package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lightprobes_pars_fragment.glsl.js +80 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +2 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +1 -3
- package/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.js +0 -1
- package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +12 -2
- package/src/renderers/shaders/ShaderChunk.js +2 -0
- package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +1 -2
- package/src/renderers/shaders/ShaderLib.js +0 -1
- package/src/renderers/shaders/UniformsLib.js +7 -2
- package/src/renderers/shaders/UniformsUtils.js +27 -5
- package/src/renderers/webgl/WebGLAnimation.js +2 -1
- package/src/renderers/webgl/WebGLBackground.js +13 -13
- package/src/renderers/webgl/WebGLBufferRenderer.js +0 -32
- package/src/renderers/webgl/WebGLCapabilities.js +6 -0
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +0 -32
- package/src/renderers/webgl/WebGLMaterials.js +12 -13
- package/src/renderers/webgl/WebGLOutput.js +4 -1
- package/src/renderers/webgl/WebGLProgram.js +4 -0
- package/src/renderers/webgl/WebGLPrograms.js +21 -4
- package/src/renderers/webgl/WebGLRenderStates.js +13 -2
- package/src/renderers/webgl/WebGLState.js +43 -0
- package/src/renderers/webgl/WebGLTextures.js +129 -26
- package/src/renderers/webgl/WebGLUniformsGroups.js +19 -0
- package/src/renderers/webgl-fallback/WebGLBackend.js +106 -65
- package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +0 -41
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +29 -51
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +53 -19
- package/src/renderers/webgl-fallback/utils/WebGLCapabilities.js +25 -0
- package/src/renderers/webgl-fallback/utils/WebGLState.js +42 -1
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +63 -50
- package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +1 -1
- package/src/renderers/webgpu/WebGPUBackend.js +160 -146
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +55 -33
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +103 -17
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +1 -1
- package/src/renderers/webgpu/utils/WebGPUCapabilities.js +48 -0
- package/src/renderers/webgpu/utils/WebGPUConstants.js +8 -0
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +91 -17
- package/src/renderers/webgpu/utils/WebGPUUtils.js +18 -2
- package/src/renderers/webxr/WebXRController.js +12 -0
- package/src/textures/HTMLTexture.js +74 -0
- package/src/textures/Source.js +1 -1
- package/src/textures/Texture.js +13 -2
- package/src/utils.js +23 -1
- package/src/nodes/utils/RemapNode.js +0 -125
|
@@ -41,6 +41,15 @@ class AnimationAction {
|
|
|
41
41
|
|
|
42
42
|
const interpolant = tracks[ i ].createInterpolant( null );
|
|
43
43
|
interpolants[ i ] = interpolant;
|
|
44
|
+
|
|
45
|
+
// preserve interpolant settings (like tangent data from BezierInterpolant)
|
|
46
|
+
|
|
47
|
+
if ( interpolant.settings ) {
|
|
48
|
+
|
|
49
|
+
Object.assign( interpolantSettings, interpolant.settings );
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
44
53
|
interpolant.settings = interpolantSettings;
|
|
45
54
|
|
|
46
55
|
}
|
|
@@ -847,6 +856,7 @@ class AnimationAction {
|
|
|
847
856
|
|
|
848
857
|
} else {
|
|
849
858
|
|
|
859
|
+
this._loopCount = loopCount;
|
|
850
860
|
this.time = time;
|
|
851
861
|
|
|
852
862
|
}
|
|
@@ -894,7 +904,7 @@ class AnimationAction {
|
|
|
894
904
|
|
|
895
905
|
} else {
|
|
896
906
|
|
|
897
|
-
settings.endingEnd
|
|
907
|
+
settings.endingEnd = WrapAroundEnding;
|
|
898
908
|
|
|
899
909
|
}
|
|
900
910
|
|
|
@@ -10,7 +10,7 @@ class AudioContext {
|
|
|
10
10
|
/**
|
|
11
11
|
* Returns the global native audio context.
|
|
12
12
|
*
|
|
13
|
-
* @return {AudioContext} The native audio context.
|
|
13
|
+
* @return {Window.AudioContext} The native audio context.
|
|
14
14
|
*/
|
|
15
15
|
static getContext() {
|
|
16
16
|
|
|
@@ -27,7 +27,7 @@ class AudioContext {
|
|
|
27
27
|
/**
|
|
28
28
|
* Allows to set the global native audio context from outside.
|
|
29
29
|
*
|
|
30
|
-
* @param {AudioContext} value - The native context to set.
|
|
30
|
+
* @param {Window.AudioContext} value - The native context to set.
|
|
31
31
|
*/
|
|
32
32
|
static setContext( value ) {
|
|
33
33
|
|
package/src/constants.js
CHANGED
|
@@ -3,6 +3,7 @@ import { Vector2 } from '../math/Vector2.js';
|
|
|
3
3
|
import { denormalize, normalize } from '../math/MathUtils.js';
|
|
4
4
|
import { StaticDrawUsage, FloatType } from '../constants.js';
|
|
5
5
|
import { fromHalfFloat, toHalfFloat } from '../extras/DataUtils.js';
|
|
6
|
+
import { EventDispatcher } from './EventDispatcher.js';
|
|
6
7
|
|
|
7
8
|
const _vector = /*@__PURE__*/ new Vector3();
|
|
8
9
|
const _vector2 = /*@__PURE__*/ new Vector2();
|
|
@@ -17,7 +18,7 @@ let _id = 0;
|
|
|
17
18
|
* When working with vector-like data, the `fromBufferAttribute( attribute, index )`
|
|
18
19
|
* helper methods on vector and color class might be helpful. E.g. {@link Vector3#fromBufferAttribute}.
|
|
19
20
|
*/
|
|
20
|
-
class BufferAttribute {
|
|
21
|
+
class BufferAttribute extends EventDispatcher {
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* Constructs a new buffer attribute.
|
|
@@ -28,6 +29,8 @@ class BufferAttribute {
|
|
|
28
29
|
*/
|
|
29
30
|
constructor( array, itemSize, normalized = false ) {
|
|
30
31
|
|
|
32
|
+
super();
|
|
33
|
+
|
|
31
34
|
if ( Array.isArray( array ) ) {
|
|
32
35
|
|
|
33
36
|
throw new TypeError( 'THREE.BufferAttribute: array should be a Typed Array.' );
|
|
@@ -674,6 +677,15 @@ class BufferAttribute {
|
|
|
674
677
|
|
|
675
678
|
}
|
|
676
679
|
|
|
680
|
+
/**
|
|
681
|
+
* Disposes of the buffer attribute. Available only in {@link WebGPURenderer}.
|
|
682
|
+
*/
|
|
683
|
+
dispose() {
|
|
684
|
+
|
|
685
|
+
this.dispatchEvent( { type: 'dispose' } );
|
|
686
|
+
|
|
687
|
+
}
|
|
688
|
+
|
|
677
689
|
}
|
|
678
690
|
|
|
679
691
|
/**
|
package/src/core/Clock.js
CHANGED
|
@@ -58,7 +58,7 @@ class Clock {
|
|
|
58
58
|
*/
|
|
59
59
|
this.running = false;
|
|
60
60
|
|
|
61
|
-
warn( '
|
|
61
|
+
warn( 'Clock: This module has been deprecated. Please use THREE.Timer instead.' ); // @deprecated, r183
|
|
62
62
|
|
|
63
63
|
}
|
|
64
64
|
|
package/src/core/Object3D.js
CHANGED
|
@@ -1592,11 +1592,7 @@ class Object3D extends EventDispatcher {
|
|
|
1592
1592
|
this.quaternion.copy( source.quaternion );
|
|
1593
1593
|
this.scale.copy( source.scale );
|
|
1594
1594
|
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
this.pivot = source.pivot.clone();
|
|
1598
|
-
|
|
1599
|
-
}
|
|
1595
|
+
this.pivot = ( source.pivot !== null ) ? source.pivot.clone() : null;
|
|
1600
1596
|
|
|
1601
1597
|
this.matrix.copy( source.matrix );
|
|
1602
1598
|
this.matrixWorld.copy( source.matrixWorld );
|
package/src/core/RenderTarget.js
CHANGED
|
@@ -78,6 +78,7 @@ function CubicPoly() {
|
|
|
78
78
|
//
|
|
79
79
|
|
|
80
80
|
const tmp = /*@__PURE__*/ new Vector3();
|
|
81
|
+
const tmp2 = /*@__PURE__*/ new Vector3();
|
|
81
82
|
const px = /*@__PURE__*/ new CubicPoly();
|
|
82
83
|
const py = /*@__PURE__*/ new CubicPoly();
|
|
83
84
|
const pz = /*@__PURE__*/ new CubicPoly();
|
|
@@ -202,8 +203,8 @@ class CatmullRomCurve3 extends Curve {
|
|
|
202
203
|
} else {
|
|
203
204
|
|
|
204
205
|
// extrapolate first point
|
|
205
|
-
|
|
206
|
-
p0 =
|
|
206
|
+
tmp2.subVectors( points[ 0 ], points[ 1 ] ).add( points[ 0 ] );
|
|
207
|
+
p0 = tmp2;
|
|
207
208
|
|
|
208
209
|
}
|
|
209
210
|
|
|
@@ -60,11 +60,21 @@ class AudioLoader extends Loader {
|
|
|
60
60
|
const bufferCopy = buffer.slice( 0 );
|
|
61
61
|
|
|
62
62
|
const context = AudioContext.getContext();
|
|
63
|
+
|
|
64
|
+
const decodeUrl = url + '#decode';
|
|
65
|
+
scope.manager.itemStart( decodeUrl ); // prevent loading manager from completing too early, see #33378
|
|
66
|
+
|
|
63
67
|
context.decodeAudioData( bufferCopy, function ( audioBuffer ) {
|
|
64
68
|
|
|
65
69
|
onLoad( audioBuffer );
|
|
70
|
+
scope.manager.itemEnd( decodeUrl );
|
|
71
|
+
|
|
72
|
+
} ).catch( function ( e ) {
|
|
73
|
+
|
|
74
|
+
handleError( e );
|
|
75
|
+
scope.manager.itemEnd( decodeUrl );
|
|
66
76
|
|
|
67
|
-
} )
|
|
77
|
+
} );
|
|
68
78
|
|
|
69
79
|
} catch ( e ) {
|
|
70
80
|
|
|
@@ -2,6 +2,7 @@ import { LinearFilter, LinearMipmapLinearFilter, ClampToEdgeWrapping } from '../
|
|
|
2
2
|
import { FileLoader } from './FileLoader.js';
|
|
3
3
|
import { DataTexture } from '../textures/DataTexture.js';
|
|
4
4
|
import { Loader } from './Loader.js';
|
|
5
|
+
import { error } from '../utils.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Abstract base class for loading binary texture formats RGBE, EXR or TGA.
|
|
@@ -57,19 +58,20 @@ class DataTextureLoader extends Loader {
|
|
|
57
58
|
|
|
58
59
|
texData = scope.parse( buffer );
|
|
59
60
|
|
|
60
|
-
} catch (
|
|
61
|
+
} catch ( e ) {
|
|
61
62
|
|
|
62
63
|
if ( onError !== undefined ) {
|
|
63
64
|
|
|
64
|
-
onError(
|
|
65
|
+
onError( e );
|
|
65
66
|
|
|
66
67
|
} else {
|
|
67
68
|
|
|
68
|
-
error(
|
|
69
|
-
return;
|
|
69
|
+
error( e );
|
|
70
70
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
return;
|
|
74
|
+
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
if ( texData.image !== undefined ) {
|
|
@@ -74,7 +74,6 @@ class FileLoader extends Loader {
|
|
|
74
74
|
* @param {function(any)} onLoad - Executed when the loading process has been finished.
|
|
75
75
|
* @param {onProgressCallback} [onProgress] - Executed while the loading is in progress.
|
|
76
76
|
* @param {onErrorCallback} [onError] - Executed when errors occur.
|
|
77
|
-
* @return {any|undefined} The cached resource if available.
|
|
78
77
|
*/
|
|
79
78
|
load( url, onLoad, onProgress, onError ) {
|
|
80
79
|
|
|
@@ -98,7 +97,7 @@ class FileLoader extends Loader {
|
|
|
98
97
|
|
|
99
98
|
}, 0 );
|
|
100
99
|
|
|
101
|
-
return
|
|
100
|
+
return;
|
|
102
101
|
|
|
103
102
|
}
|
|
104
103
|
|
|
@@ -86,6 +86,9 @@ class ImageBitmapLoader extends Loader {
|
|
|
86
86
|
* Sets the given loader options. The structure of the object must match the `options` parameter of
|
|
87
87
|
* [createImageBitmap](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap).
|
|
88
88
|
*
|
|
89
|
+
* Note: When caching is enabled, the cache key is based on the URL only. Loading the same URL with
|
|
90
|
+
* different options will return the cached result of the first request.
|
|
91
|
+
*
|
|
89
92
|
* @param {Object} options - The loader options to set.
|
|
90
93
|
* @return {ImageBitmapLoader} A reference to this image bitmap loader.
|
|
91
94
|
*/
|
|
@@ -104,7 +107,6 @@ class ImageBitmapLoader extends Loader {
|
|
|
104
107
|
* @param {function(ImageBitmap)} onLoad - Executed when the loading process has been finished.
|
|
105
108
|
* @param {onProgressCallback} onProgress - Unsupported in this loader.
|
|
106
109
|
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
107
|
-
* @return {ImageBitmap|undefined} The image bitmap.
|
|
108
110
|
*/
|
|
109
111
|
load( url, onLoad, onProgress, onError ) {
|
|
110
112
|
|
|
@@ -142,8 +144,6 @@ class ImageBitmapLoader extends Loader {
|
|
|
142
144
|
|
|
143
145
|
scope.manager.itemEnd( url );
|
|
144
146
|
|
|
145
|
-
return imageBitmap;
|
|
146
|
-
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
} );
|
|
@@ -161,7 +161,7 @@ class ImageBitmapLoader extends Loader {
|
|
|
161
161
|
|
|
162
162
|
}, 0 );
|
|
163
163
|
|
|
164
|
-
return
|
|
164
|
+
return;
|
|
165
165
|
|
|
166
166
|
}
|
|
167
167
|
|
|
@@ -186,8 +186,6 @@ class ImageBitmapLoader extends Loader {
|
|
|
186
186
|
|
|
187
187
|
scope.manager.itemEnd( url );
|
|
188
188
|
|
|
189
|
-
return imageBitmap;
|
|
190
|
-
|
|
191
189
|
} ).catch( function ( e ) {
|
|
192
190
|
|
|
193
191
|
if ( onError ) onError( e );
|
|
@@ -67,6 +67,8 @@ import { Box3 } from '../math/Box3.js';
|
|
|
67
67
|
import { Sphere } from '../math/Sphere.js';
|
|
68
68
|
import { SphericalHarmonics3 } from '../math/SphericalHarmonics3.js';
|
|
69
69
|
|
|
70
|
+
const _customGeometries = {};
|
|
71
|
+
|
|
70
72
|
/**
|
|
71
73
|
* A loader for loading a JSON resource in the [JSON Object/Scene format](https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4).
|
|
72
74
|
* The files are internally loaded via {@link FileLoader}.
|
|
@@ -123,11 +125,11 @@ class ObjectLoader extends Loader {
|
|
|
123
125
|
|
|
124
126
|
json = JSON.parse( text );
|
|
125
127
|
|
|
126
|
-
} catch (
|
|
128
|
+
} catch ( e ) {
|
|
127
129
|
|
|
128
|
-
if ( onError !== undefined ) onError(
|
|
130
|
+
if ( onError !== undefined ) onError( e );
|
|
129
131
|
|
|
130
|
-
error( 'ObjectLoader: Can\'t parse ' + url + '.',
|
|
132
|
+
error( 'ObjectLoader: Can\'t parse ' + url + '.', e.message );
|
|
131
133
|
|
|
132
134
|
return;
|
|
133
135
|
|
|
@@ -277,6 +279,20 @@ class ObjectLoader extends Loader {
|
|
|
277
279
|
|
|
278
280
|
}
|
|
279
281
|
|
|
282
|
+
/**
|
|
283
|
+
* Registers the given geometry at the internal
|
|
284
|
+
* geometry library.
|
|
285
|
+
*
|
|
286
|
+
* @static
|
|
287
|
+
* @param {string} type - The geometry type.
|
|
288
|
+
* @param {BufferGeometry.constructor} geometryClass - The geometry class.
|
|
289
|
+
*/
|
|
290
|
+
static registerGeometry( type, geometryClass ) {
|
|
291
|
+
|
|
292
|
+
_customGeometries[ type ] = geometryClass;
|
|
293
|
+
|
|
294
|
+
}
|
|
295
|
+
|
|
280
296
|
// internals
|
|
281
297
|
|
|
282
298
|
parseShapes( json ) {
|
|
@@ -357,9 +373,13 @@ class ObjectLoader extends Loader {
|
|
|
357
373
|
|
|
358
374
|
geometry = Geometries[ data.type ].fromJSON( data, shapes );
|
|
359
375
|
|
|
376
|
+
} else if ( data.type in _customGeometries ) {
|
|
377
|
+
|
|
378
|
+
geometry = _customGeometries[ data.type ].fromJSON( data, shapes );
|
|
379
|
+
|
|
360
380
|
} else {
|
|
361
381
|
|
|
362
|
-
warn( `ObjectLoader:
|
|
382
|
+
warn( `ObjectLoader: Unknown geometry type "${ data.type }". Use .registerGeometry() before starting the deserialization process.` );
|
|
363
383
|
|
|
364
384
|
}
|
|
365
385
|
|
|
@@ -739,6 +759,7 @@ class ObjectLoader extends Loader {
|
|
|
739
759
|
if ( data.premultiplyAlpha !== undefined ) texture.premultiplyAlpha = data.premultiplyAlpha;
|
|
740
760
|
if ( data.unpackAlignment !== undefined ) texture.unpackAlignment = data.unpackAlignment;
|
|
741
761
|
if ( data.compareFunction !== undefined ) texture.compareFunction = data.compareFunction;
|
|
762
|
+
if ( data.normalized !== undefined ) texture.normalized = data.normalized;
|
|
742
763
|
|
|
743
764
|
if ( data.userData !== undefined ) texture.userData = data.userData;
|
|
744
765
|
|
|
@@ -89,6 +89,24 @@ class NodeObjectLoader extends ObjectLoader {
|
|
|
89
89
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Async version of {@link NodeObjectLoader#parse}.
|
|
94
|
+
*
|
|
95
|
+
* @param {Object} json - The JSON definition
|
|
96
|
+
* @return {Promise<Object3D>} A Promise that resolves with the parsed 3D object.
|
|
97
|
+
*/
|
|
98
|
+
async parseAsync( json ) {
|
|
99
|
+
|
|
100
|
+
this._nodesJSON = json.nodes;
|
|
101
|
+
|
|
102
|
+
const data = await super.parseAsync( json );
|
|
103
|
+
|
|
104
|
+
this._nodesJSON = null; // dispose
|
|
105
|
+
|
|
106
|
+
return data;
|
|
107
|
+
|
|
108
|
+
}
|
|
109
|
+
|
|
92
110
|
/**
|
|
93
111
|
* Parses the node objects from the given JSON and textures.
|
|
94
112
|
*
|
|
@@ -57,7 +57,7 @@ class MeshToonMaterial extends Material {
|
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
59
|
* Gradient map for toon shading. It's required to set
|
|
60
|
-
* {@link Texture#minFilter} and {@link Texture#magFilter} to {@
|
|
60
|
+
* {@link Texture#minFilter} and {@link Texture#magFilter} to {@link NearestFilter}
|
|
61
61
|
* when using this type of texture.
|
|
62
62
|
*
|
|
63
63
|
* @type {?Texture}
|
|
@@ -537,6 +537,33 @@ class Line2NodeMaterial extends NodeMaterial {
|
|
|
537
537
|
|
|
538
538
|
}
|
|
539
539
|
|
|
540
|
+
/**
|
|
541
|
+
* Copies the properties of the given material to this instance.
|
|
542
|
+
*
|
|
543
|
+
* @param {Line2NodeMaterial} source - The material to copy.
|
|
544
|
+
* @return {Line2NodeMaterial} A reference to this material.
|
|
545
|
+
*/
|
|
546
|
+
copy( source ) {
|
|
547
|
+
|
|
548
|
+
super.copy( source );
|
|
549
|
+
|
|
550
|
+
this.vertexColors = source.vertexColors;
|
|
551
|
+
this.dashOffset = source.dashOffset;
|
|
552
|
+
|
|
553
|
+
this.lineColorNode = source.lineColorNode;
|
|
554
|
+
this.offsetNode = source.offsetNode;
|
|
555
|
+
this.dashScaleNode = source.dashScaleNode;
|
|
556
|
+
this.dashSizeNode = source.dashSizeNode;
|
|
557
|
+
this.gapSizeNode = source.gapSizeNode;
|
|
558
|
+
|
|
559
|
+
this._useDash = source._useDash;
|
|
560
|
+
this._useAlphaToCoverage = source._useAlphaToCoverage;
|
|
561
|
+
this._useWorldUnits = source._useWorldUnits;
|
|
562
|
+
|
|
563
|
+
return this;
|
|
564
|
+
|
|
565
|
+
}
|
|
566
|
+
|
|
540
567
|
}
|
|
541
568
|
|
|
542
569
|
export default Line2NodeMaterial;
|
|
@@ -25,7 +25,6 @@ import { modelViewMatrix } from '../../nodes/accessors/ModelNode.js';
|
|
|
25
25
|
import { vertexColor } from '../../nodes/accessors/VertexColorNode.js';
|
|
26
26
|
import { premultiplyAlpha } from '../../nodes/display/BlendModes.js';
|
|
27
27
|
import { subBuild } from '../../nodes/core/SubBuildNode.js';
|
|
28
|
-
import { error } from '../../utils.js';
|
|
29
28
|
|
|
30
29
|
/**
|
|
31
30
|
* Base class for all node materials.
|
|
@@ -485,32 +484,6 @@ class NodeMaterial extends Material {
|
|
|
485
484
|
const renderer = builder.renderer;
|
|
486
485
|
const renderTarget = renderer.getRenderTarget();
|
|
487
486
|
|
|
488
|
-
// < CONTEXT >
|
|
489
|
-
|
|
490
|
-
if ( renderer.contextNode.isContextNode === true ) {
|
|
491
|
-
|
|
492
|
-
builder.context = { ...builder.context, ...renderer.contextNode.getFlowContextData() };
|
|
493
|
-
|
|
494
|
-
} else {
|
|
495
|
-
|
|
496
|
-
error( 'NodeMaterial: "renderer.contextNode" must be an instance of `context()`.' );
|
|
497
|
-
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
if ( this.contextNode !== null ) {
|
|
501
|
-
|
|
502
|
-
if ( this.contextNode.isContextNode === true ) {
|
|
503
|
-
|
|
504
|
-
builder.context = { ...builder.context, ...this.contextNode.getFlowContextData() };
|
|
505
|
-
|
|
506
|
-
} else {
|
|
507
|
-
|
|
508
|
-
error( 'NodeMaterial: "material.contextNode" must be an instance of `context()`.' );
|
|
509
|
-
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
}
|
|
513
|
-
|
|
514
487
|
// < VERTEX STAGE >
|
|
515
488
|
|
|
516
489
|
builder.addStack();
|