super-three 0.133.5 → 0.135.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.js +617 -536
- package/build/three.min.js +1 -1
- package/build/three.module.js +760 -613
- package/examples/fonts/open-sans/open-sans-v15-cyrillic-ext_greek_greek-ext_cyrillic_latin_latin-ext_vietnamese-regular.woff +0 -0
- package/examples/fonts/open-sans/open-sans-v15-cyrillic-ext_greek_greek-ext_cyrillic_latin_latin-ext_vietnamese-regular.woff2 +0 -0
- package/examples/fonts/open-sans/open-sans.css +9 -0
- package/examples/fonts/tabler-icons/fonts/tabler-icons.eot +0 -0
- package/examples/fonts/tabler-icons/fonts/tabler-icons.ttf +0 -0
- package/examples/fonts/tabler-icons/fonts/tabler-icons.woff +0 -0
- package/examples/fonts/tabler-icons/fonts/tabler-icons.woff2 +0 -0
- package/examples/fonts/tabler-icons/tabler-icons.min.css +4 -0
- package/examples/js/controls/ArcballControls.js +68 -27
- package/examples/js/controls/DragControls.js +7 -0
- package/examples/js/controls/OrbitControls.js +5 -36
- package/examples/js/controls/TrackballControls.js +3 -2
- package/examples/js/csm/CSM.js +2 -2
- package/examples/js/csm/CSMFrustum.js +133 -0
- package/examples/js/exporters/GLTFExporter.js +147 -63
- package/examples/js/exporters/USDZExporter.js +45 -26
- package/examples/js/lines/LineMaterial.js +58 -20
- package/examples/js/lines/LineSegments2.js +29 -24
- package/examples/js/loaders/3DMLoader.js +24 -11
- package/examples/js/loaders/3MFLoader.js +2 -2
- package/examples/js/loaders/ColladaLoader.js +61 -3
- package/examples/js/loaders/FBXLoader.js +1 -1
- package/examples/js/loaders/GLTFLoader.js +94 -31
- package/examples/js/loaders/KTX2Loader.js +12 -0
- package/examples/js/loaders/LWOLoader.js +8 -6
- package/examples/js/loaders/LogLuvLoader.js +766 -0
- package/examples/js/loaders/PLYLoader.js +32 -7
- package/examples/js/loaders/RGBELoader.js +2 -1
- package/examples/js/loaders/SVGLoader.js +7 -3
- package/examples/js/loaders/TDSLoader.js +237 -271
- package/examples/js/loaders/lwo/LWO2Parser.js +1 -0
- package/examples/js/loaders/lwo/LWO3Parser.js +4 -2
- package/examples/js/objects/MarchingCubes.js +42 -128
- package/examples/js/renderers/CSS2DRenderer.js +4 -4
- package/examples/js/renderers/CSS3DRenderer.js +4 -4
- package/examples/js/utils/RoughnessMipmapper.js +1 -0
- package/examples/jsm/controls/ArcballControls.js +61 -29
- package/examples/jsm/controls/DragControls.js +7 -0
- package/examples/jsm/controls/OrbitControls.js +9 -51
- package/examples/jsm/controls/TrackballControls.js +1 -1
- package/examples/jsm/csm/CSM.js +3 -3
- package/examples/jsm/csm/{Frustum.js → CSMFrustum.js} +3 -3
- package/examples/jsm/exporters/GLTFExporter.js +160 -74
- package/examples/jsm/exporters/USDZExporter.js +47 -26
- package/examples/jsm/libs/flow.module.js +3218 -0
- package/examples/jsm/libs/lil-gui.module.min.js +8 -0
- package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
- package/examples/jsm/lines/LineMaterial.js +59 -23
- package/examples/jsm/lines/LineSegments2.js +22 -18
- package/examples/jsm/loaders/3DMLoader.js +18 -12
- package/examples/jsm/loaders/3MFLoader.js +2 -2
- package/examples/jsm/loaders/ColladaLoader.js +61 -3
- package/examples/jsm/loaders/FBXLoader.js +1 -1
- package/examples/jsm/loaders/GLTFLoader.js +99 -35
- package/examples/jsm/loaders/KTX2Loader.js +19 -0
- package/examples/jsm/loaders/LWOLoader.js +8 -6
- package/examples/jsm/loaders/LogLuvLoader.js +606 -0
- package/examples/jsm/loaders/PLYLoader.js +33 -7
- package/examples/jsm/loaders/SVGLoader.js +7 -4
- package/examples/jsm/loaders/TDSLoader.js +225 -285
- package/examples/jsm/loaders/lwo/LWO2Parser.js +1 -0
- package/examples/jsm/loaders/lwo/LWO3Parser.js +2 -2
- package/examples/jsm/node-editor/NodeEditor.js +455 -0
- package/examples/jsm/node-editor/accessors/NormalEditor.js +30 -0
- package/examples/jsm/node-editor/accessors/PositionEditor.js +30 -0
- package/examples/jsm/node-editor/accessors/UVEditor.js +26 -0
- package/examples/jsm/node-editor/display/BlendEditor.js +43 -0
- package/examples/jsm/node-editor/examples/animate-uv.json +1 -0
- package/examples/jsm/node-editor/examples/fake-top-light.json +1 -0
- package/examples/jsm/node-editor/examples/oscillator-color.json +1 -0
- package/examples/jsm/node-editor/examples/rim.json +1 -0
- package/examples/jsm/node-editor/inputs/ColorEditor.js +91 -0
- package/examples/jsm/node-editor/inputs/FloatEditor.js +24 -0
- package/examples/jsm/node-editor/inputs/SliderEditor.js +68 -0
- package/examples/jsm/node-editor/inputs/Vector2Editor.js +28 -0
- package/examples/jsm/node-editor/inputs/Vector3Editor.js +30 -0
- package/examples/jsm/node-editor/inputs/Vector4Editor.js +37 -0
- package/examples/jsm/node-editor/materials/StandardMaterialEditor.js +69 -0
- package/examples/jsm/node-editor/math/DotEditor.js +36 -0
- package/examples/jsm/node-editor/math/InvertEditor.js +38 -0
- package/examples/jsm/node-editor/math/LimiterEditor.js +48 -0
- package/examples/jsm/node-editor/math/NormalizeEditor.js +26 -0
- package/examples/jsm/node-editor/math/OperatorEditor.js +50 -0
- package/examples/jsm/node-editor/math/PowerEditor.js +34 -0
- package/examples/jsm/node-editor/math/TrigonometryEditor.js +39 -0
- package/examples/jsm/node-editor/procedural/CheckerEditor.js +26 -0
- package/examples/jsm/node-editor/utils/OscillatorEditor.js +42 -0
- package/examples/jsm/node-editor/utils/TimerEditor.js +57 -0
- package/examples/jsm/nodes/materials/StandardNodeMaterial.js +1 -1
- package/examples/jsm/nodes/materials/nodes/StandardNode.js +6 -6
- package/examples/jsm/nodes/utils/ColorSpaceNode.js +1 -49
- package/examples/jsm/objects/MarchingCubes.js +46 -152
- package/examples/jsm/postprocessing/AdaptiveToneMappingPass.js +1 -1
- package/examples/jsm/postprocessing/AfterimagePass.js +1 -1
- package/examples/jsm/postprocessing/BloomPass.js +1 -1
- package/examples/jsm/postprocessing/BokehPass.js +1 -1
- package/examples/jsm/postprocessing/ClearPass.js +1 -1
- package/examples/jsm/postprocessing/CubeTexturePass.js +1 -1
- package/examples/jsm/postprocessing/DotScreenPass.js +1 -1
- package/examples/jsm/postprocessing/EffectComposer.js +3 -3
- package/examples/jsm/postprocessing/FilmPass.js +1 -1
- package/examples/jsm/postprocessing/GlitchPass.js +1 -1
- package/examples/jsm/postprocessing/HalftonePass.js +1 -1
- package/examples/jsm/postprocessing/MaskPass.js +1 -1
- package/examples/jsm/postprocessing/OutlinePass.js +1 -1
- package/examples/jsm/postprocessing/RenderPass.js +1 -1
- package/examples/jsm/postprocessing/SAOPass.js +1 -1
- package/examples/jsm/postprocessing/SMAAPass.js +1 -1
- package/examples/jsm/postprocessing/SSAARenderPass.js +1 -1
- package/examples/jsm/postprocessing/SSAOPass.js +1 -1
- package/examples/jsm/postprocessing/SSRPass.js +1 -1
- package/examples/jsm/postprocessing/SSRrPass.js +1 -1
- package/examples/jsm/postprocessing/SavePass.js +1 -1
- package/examples/jsm/postprocessing/ShaderPass.js +1 -1
- package/examples/jsm/postprocessing/TAARenderPass.js +1 -1
- package/examples/jsm/postprocessing/TexturePass.js +1 -1
- package/examples/jsm/postprocessing/UnrealBloomPass.js +1 -1
- package/examples/jsm/renderers/CSS2DRenderer.js +5 -4
- package/examples/jsm/renderers/CSS3DRenderer.js +5 -4
- package/examples/jsm/renderers/nodes/Nodes.js +14 -13
- package/examples/jsm/renderers/nodes/ShaderNode.js +193 -41
- package/examples/jsm/renderers/nodes/accessors/MaterialNode.js +6 -6
- package/examples/jsm/renderers/nodes/accessors/ModelViewProjectionNode.js +5 -5
- package/examples/jsm/renderers/nodes/accessors/NormalNode.js +14 -3
- package/examples/jsm/renderers/nodes/accessors/PointUVNode.js +3 -3
- package/examples/jsm/renderers/nodes/accessors/PositionNode.js +15 -5
- package/examples/jsm/renderers/nodes/accessors/SkinningNode.js +107 -0
- package/examples/jsm/renderers/nodes/accessors/UVNode.js +7 -5
- package/examples/jsm/renderers/nodes/core/ArrayInputNode.js +3 -3
- package/examples/jsm/renderers/nodes/core/AttributeNode.js +6 -0
- package/examples/jsm/renderers/nodes/core/BypassNode.js +38 -0
- package/examples/jsm/renderers/nodes/core/CodeNode.js +3 -3
- package/examples/jsm/renderers/nodes/core/ContextNode.js +4 -19
- package/examples/jsm/renderers/nodes/core/ExpressionNode.js +13 -2
- package/examples/jsm/renderers/nodes/core/FunctionNode.js +19 -132
- package/examples/jsm/renderers/nodes/core/InputNode.js +13 -3
- package/examples/jsm/renderers/nodes/core/Node.js +32 -10
- package/examples/jsm/renderers/nodes/core/NodeBuilder.js +146 -128
- package/examples/jsm/renderers/nodes/core/NodeFunction.js +22 -0
- package/examples/jsm/renderers/nodes/core/NodeFunctionInput.js +4 -4
- package/examples/jsm/renderers/nodes/core/NodeKeywords.js +18 -179
- package/examples/jsm/renderers/nodes/core/NodeParser.js +11 -0
- package/examples/jsm/renderers/nodes/core/NodeVar.js +2 -2
- package/examples/jsm/renderers/nodes/core/PropertyNode.js +14 -2
- package/examples/jsm/renderers/nodes/core/TempNode.js +10 -13
- package/examples/jsm/renderers/nodes/core/VarNode.js +12 -7
- package/examples/jsm/renderers/nodes/core/VaryNode.js +23 -8
- package/examples/jsm/renderers/nodes/core/constants.js +2 -0
- package/examples/jsm/renderers/nodes/display/ColorSpaceNode.js +47 -25
- package/examples/jsm/renderers/nodes/display/NormalMapNode.js +21 -22
- package/examples/jsm/renderers/nodes/functions/BSDFs.js +64 -101
- package/examples/jsm/renderers/nodes/inputs/BufferNode.js +25 -0
- package/examples/jsm/renderers/nodes/inputs/IntNode.js +17 -0
- package/examples/jsm/renderers/nodes/inputs/TextureNode.js +10 -2
- package/examples/jsm/renderers/nodes/lights/LightContextNode.js +20 -14
- package/examples/jsm/renderers/nodes/lights/LightNode.js +32 -36
- package/examples/jsm/renderers/nodes/math/CondNode.js +60 -0
- package/examples/jsm/renderers/nodes/math/MathNode.js +87 -36
- package/examples/jsm/renderers/nodes/math/OperatorNode.js +124 -31
- package/examples/jsm/renderers/nodes/parsers/GLSLNodeFunction.js +137 -0
- package/examples/jsm/renderers/nodes/parsers/GLSLNodeParser.js +14 -0
- package/examples/jsm/renderers/nodes/parsers/WGSLNodeFunction.js +89 -0
- package/examples/jsm/renderers/nodes/parsers/WGSLNodeParser.js +14 -0
- package/examples/jsm/renderers/nodes/procedural/CheckerNode.js +7 -9
- package/examples/jsm/renderers/nodes/utils/ArrayElementNode.js +31 -0
- package/examples/jsm/renderers/nodes/utils/ConvertNode.js +33 -0
- package/examples/jsm/renderers/nodes/utils/JoinNode.js +7 -7
- package/examples/jsm/renderers/nodes/utils/OscNode.js +58 -0
- package/examples/jsm/renderers/nodes/utils/SplitNode.js +18 -8
- package/examples/jsm/renderers/nodes/utils/SpriteSheetUVNode.js +7 -7
- package/examples/jsm/renderers/webgl/nodes/SlotNode.js +22 -0
- package/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js +191 -94
- package/examples/jsm/renderers/webgl/nodes/WebGLNodes.js +2 -2
- package/examples/jsm/renderers/webgl/nodes/WebGLPhysicalContextNode.js +2 -2
- package/examples/jsm/renderers/webgpu/WebGPUBackground.js +1 -1
- package/examples/jsm/renderers/webgpu/WebGPUBindings.js +3 -3
- package/examples/jsm/renderers/webgpu/WebGPUComputePipelines.js +2 -4
- package/examples/jsm/renderers/webgpu/WebGPUProgrammableStage.js +2 -4
- package/examples/jsm/renderers/webgpu/WebGPURenderPipeline.js +15 -23
- package/examples/jsm/renderers/webgpu/WebGPURenderPipelines.js +3 -5
- package/examples/jsm/renderers/webgpu/WebGPURenderer.js +11 -27
- package/examples/jsm/renderers/webgpu/WebGPUTextureUtils.js +62 -28
- package/examples/jsm/renderers/webgpu/WebGPUTextures.js +34 -27
- package/examples/jsm/renderers/webgpu/constants.js +2 -2
- package/examples/jsm/renderers/webgpu/nodes/WebGPUNodeBuilder.js +430 -98
- package/examples/jsm/renderers/webgpu/nodes/WebGPUNodes.js +1 -1
- package/examples/jsm/utils/RoughnessMipmapper.js +1 -0
- package/examples/jsm/webxr/OculusHandPointerModel.js +6 -6
- package/package.json +10 -10
- package/src/Three.Legacy.js +6 -0
- package/src/Three.js +0 -1
- package/src/cameras/StereoCamera.js +8 -7
- package/src/constants.js +1 -2
- package/src/core/Layers.js +7 -1
- package/src/core/Object3D.js +2 -0
- package/src/extras/PMREMGenerator.js +11 -6
- package/src/loaders/FileLoader.js +89 -152
- package/src/loaders/ImageLoader.js +9 -4
- package/src/loaders/LoaderUtils.js +26 -0
- package/src/loaders/MaterialLoader.js +7 -4
- package/src/loaders/ObjectLoader.js +2 -0
- package/src/materials/Material.js +4 -4
- package/src/materials/MeshPhysicalMaterial.js +20 -14
- package/src/math/MathUtils.js +5 -16
- package/src/renderers/WebGLMultisampleRenderTarget.js +7 -1
- package/src/renderers/WebGLRenderer.js +83 -117
- package/src/renderers/shaders/ShaderChunk/bsdfs.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/encodings_pars_fragment.glsl.js +0 -27
- package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +0 -1
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +19 -6
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +13 -5
- package/src/renderers/shaders/ShaderLib/vsm.glsl.js +2 -1
- package/src/renderers/shaders/ShaderLib.js +6 -4
- package/src/renderers/shaders/UniformsLib.js +1 -2
- package/src/renderers/webgl/WebGLExtensions.js +1 -0
- package/src/renderers/webgl/WebGLMaterials.js +27 -15
- package/src/renderers/webgl/WebGLProgram.js +10 -6
- package/src/renderers/webgl/WebGLPrograms.js +17 -12
- package/src/renderers/webgl/WebGLShadowMap.js +14 -5
- package/src/renderers/webgl/WebGLState.js +31 -17
- package/src/renderers/webgl/WebGLTextures.js +188 -51
- package/src/renderers/webgl/WebGLUniforms.js +45 -1
- package/src/renderers/webxr/WebXRManager.js +68 -107
- package/src/textures/Texture.js +6 -0
- package/src/utils.js +37 -1
- package/examples/js/controls/DeviceOrientationControls.js +0 -147
- package/examples/js/libs/dat.gui.min.js +0 -14
- package/examples/jsm/controls/DeviceOrientationControls.js +0 -153
- package/examples/jsm/libs/dat.gui.module.js +0 -3575
- package/examples/jsm/libs/glslang.js +0 -78
- package/examples/jsm/libs/glslang.wasm +0 -0
- package/examples/jsm/renderers/nodes/consts/MathConsts.js +0 -7
- package/examples/jsm/renderers/nodes/core/ConstNode.js +0 -39
- package/examples/jsm/renderers/nodes/core/NodeSlot.js +0 -13
- package/examples/jsm/renderers/nodes/core/StructNode.js +0 -80
- package/examples/jsm/renderers/nodes/core/StructVarNode.js +0 -75
- package/examples/jsm/renderers/nodes/functions/EncodingFunctions.js +0 -99
- package/examples/jsm/renderers/nodes/functions/MathFunctions.js +0 -47
- package/examples/jsm/renderers/webgpu/nodes/ShaderLib.js +0 -152
- package/src/extras/objects/ImmediateRenderObject.js +0 -31
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* dashed: <boolean>,
|
|
8
8
|
* dashScale: <float>,
|
|
9
9
|
* dashSize: <float>,
|
|
10
|
+
* dashOffset: <float>,
|
|
10
11
|
* gapSize: <float>,
|
|
11
12
|
* resolution: <Vector2>, // to be set by renderer
|
|
12
13
|
* }
|
|
@@ -21,6 +22,9 @@
|
|
|
21
22
|
resolution: {
|
|
22
23
|
value: new THREE.Vector2( 1, 1 )
|
|
23
24
|
},
|
|
25
|
+
dashOffset: {
|
|
26
|
+
value: 0
|
|
27
|
+
},
|
|
24
28
|
dashScale: {
|
|
25
29
|
value: 1
|
|
26
30
|
},
|
|
@@ -52,10 +56,23 @@
|
|
|
52
56
|
attribute vec3 instanceColorStart;
|
|
53
57
|
attribute vec3 instanceColorEnd;
|
|
54
58
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
#ifdef WORLD_UNITS
|
|
60
|
+
|
|
61
|
+
varying vec4 worldPos;
|
|
62
|
+
varying vec3 worldStart;
|
|
63
|
+
varying vec3 worldEnd;
|
|
64
|
+
|
|
65
|
+
#ifdef USE_DASH
|
|
66
|
+
|
|
67
|
+
varying vec2 vUv;
|
|
68
|
+
|
|
69
|
+
#endif
|
|
70
|
+
|
|
71
|
+
#else
|
|
72
|
+
|
|
73
|
+
varying vec2 vUv;
|
|
74
|
+
|
|
75
|
+
#endif
|
|
59
76
|
|
|
60
77
|
#ifdef USE_DASH
|
|
61
78
|
|
|
@@ -92,19 +109,26 @@
|
|
|
92
109
|
#ifdef USE_DASH
|
|
93
110
|
|
|
94
111
|
vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
|
|
112
|
+
vUv = uv;
|
|
95
113
|
|
|
96
114
|
#endif
|
|
97
115
|
|
|
98
116
|
float aspect = resolution.x / resolution.y;
|
|
99
117
|
|
|
100
|
-
vUv = uv;
|
|
101
|
-
|
|
102
118
|
// camera space
|
|
103
119
|
vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
|
|
104
120
|
vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
|
|
105
121
|
|
|
106
|
-
|
|
107
|
-
|
|
122
|
+
#ifdef WORLD_UNITS
|
|
123
|
+
|
|
124
|
+
worldStart = start.xyz;
|
|
125
|
+
worldEnd = end.xyz;
|
|
126
|
+
|
|
127
|
+
#else
|
|
128
|
+
|
|
129
|
+
vUv = uv;
|
|
130
|
+
|
|
131
|
+
#endif
|
|
108
132
|
|
|
109
133
|
// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
|
|
110
134
|
// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
|
|
@@ -254,15 +278,31 @@
|
|
|
254
278
|
|
|
255
279
|
#ifdef USE_DASH
|
|
256
280
|
|
|
281
|
+
uniform float dashOffset;
|
|
257
282
|
uniform float dashSize;
|
|
258
283
|
uniform float gapSize;
|
|
259
284
|
|
|
260
285
|
#endif
|
|
261
286
|
|
|
262
287
|
varying float vLineDistance;
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
288
|
+
|
|
289
|
+
#ifdef WORLD_UNITS
|
|
290
|
+
|
|
291
|
+
varying vec4 worldPos;
|
|
292
|
+
varying vec3 worldStart;
|
|
293
|
+
varying vec3 worldEnd;
|
|
294
|
+
|
|
295
|
+
#ifdef USE_DASH
|
|
296
|
+
|
|
297
|
+
varying vec2 vUv;
|
|
298
|
+
|
|
299
|
+
#endif
|
|
300
|
+
|
|
301
|
+
#else
|
|
302
|
+
|
|
303
|
+
varying vec2 vUv;
|
|
304
|
+
|
|
305
|
+
#endif
|
|
266
306
|
|
|
267
307
|
#include <common>
|
|
268
308
|
#include <color_pars_fragment>
|
|
@@ -270,8 +310,6 @@
|
|
|
270
310
|
#include <logdepthbuf_pars_fragment>
|
|
271
311
|
#include <clipping_planes_pars_fragment>
|
|
272
312
|
|
|
273
|
-
varying vec2 vUv;
|
|
274
|
-
|
|
275
313
|
vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
|
|
276
314
|
|
|
277
315
|
float mua;
|
|
@@ -309,7 +347,7 @@
|
|
|
309
347
|
|
|
310
348
|
if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
|
|
311
349
|
|
|
312
|
-
if ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
|
|
350
|
+
if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
|
|
313
351
|
|
|
314
352
|
#endif
|
|
315
353
|
|
|
@@ -330,7 +368,7 @@
|
|
|
330
368
|
|
|
331
369
|
#ifndef USE_DASH
|
|
332
370
|
|
|
333
|
-
#ifdef
|
|
371
|
+
#ifdef USE_ALPHA_TO_COVERAGE
|
|
334
372
|
|
|
335
373
|
float dnorm = fwidth( norm );
|
|
336
374
|
alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
|
|
@@ -349,7 +387,7 @@
|
|
|
349
387
|
|
|
350
388
|
#else
|
|
351
389
|
|
|
352
|
-
#ifdef
|
|
390
|
+
#ifdef USE_ALPHA_TO_COVERAGE
|
|
353
391
|
|
|
354
392
|
// artifacts appear on some hardware if a derivative is taken within a conditional
|
|
355
393
|
float a = vUv.x;
|
|
@@ -566,12 +604,12 @@
|
|
|
566
604
|
enumerable: true,
|
|
567
605
|
get: function () {
|
|
568
606
|
|
|
569
|
-
return Boolean( '
|
|
607
|
+
return Boolean( 'USE_ALPHA_TO_COVERAGE' in this.defines );
|
|
570
608
|
|
|
571
609
|
},
|
|
572
610
|
set: function ( value ) {
|
|
573
611
|
|
|
574
|
-
if ( Boolean( value ) !== Boolean( '
|
|
612
|
+
if ( Boolean( value ) !== Boolean( 'USE_ALPHA_TO_COVERAGE' in this.defines ) ) {
|
|
575
613
|
|
|
576
614
|
this.needsUpdate = true;
|
|
577
615
|
|
|
@@ -579,12 +617,12 @@
|
|
|
579
617
|
|
|
580
618
|
if ( value === true ) {
|
|
581
619
|
|
|
582
|
-
this.defines.
|
|
620
|
+
this.defines.USE_ALPHA_TO_COVERAGE = '';
|
|
583
621
|
this.extensions.derivatives = true;
|
|
584
622
|
|
|
585
623
|
} else {
|
|
586
624
|
|
|
587
|
-
delete this.defines.
|
|
625
|
+
delete this.defines.USE_ALPHA_TO_COVERAGE;
|
|
588
626
|
this.extensions.derivatives = false;
|
|
589
627
|
|
|
590
628
|
}
|
|
@@ -22,7 +22,29 @@
|
|
|
22
22
|
|
|
23
23
|
const _sphere = new THREE.Sphere();
|
|
24
24
|
|
|
25
|
-
const _clipToWorldVector = new THREE.Vector4();
|
|
25
|
+
const _clipToWorldVector = new THREE.Vector4(); // Returns the margin required to expand by in world space given the distance from the camera,
|
|
26
|
+
// line width, resolution, and camera projection
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
function getWorldSpaceHalfWidth( camera, distance, lineWidth, resolution ) {
|
|
30
|
+
|
|
31
|
+
// transform into clip space, adjust the x and y values by the pixel width offset, then
|
|
32
|
+
// transform back into world space to get world offset. Note clip space is [-1, 1] so full
|
|
33
|
+
// width does not need to be halved.
|
|
34
|
+
_clipToWorldVector.set( 0, 0, - distance, 1.0 ).applyMatrix4( camera.projectionMatrix );
|
|
35
|
+
|
|
36
|
+
_clipToWorldVector.multiplyScalar( 1.0 / _clipToWorldVector.w );
|
|
37
|
+
|
|
38
|
+
_clipToWorldVector.x = lineWidth / resolution.width;
|
|
39
|
+
_clipToWorldVector.y = lineWidth / resolution.height;
|
|
40
|
+
|
|
41
|
+
_clipToWorldVector.applyMatrix4( camera.projectionMatrixInverse );
|
|
42
|
+
|
|
43
|
+
_clipToWorldVector.multiplyScalar( 1.0 / _clipToWorldVector.w );
|
|
44
|
+
|
|
45
|
+
return Math.abs( Math.max( _clipToWorldVector.x, _clipToWorldVector.y ) );
|
|
46
|
+
|
|
47
|
+
}
|
|
26
48
|
|
|
27
49
|
class LineSegments2 extends THREE.Mesh {
|
|
28
50
|
|
|
@@ -84,10 +106,7 @@
|
|
|
84
106
|
const instanceStart = geometry.attributes.instanceStart;
|
|
85
107
|
const instanceEnd = geometry.attributes.instanceEnd; // camera forward is negative
|
|
86
108
|
|
|
87
|
-
const near = - camera.near; //
|
|
88
|
-
// width in clip space
|
|
89
|
-
|
|
90
|
-
const ssMaxWidth = 2.0 * Math.max( lineWidth / resolution.width, lineWidth / resolution.height ); //
|
|
109
|
+
const near = - camera.near; //
|
|
91
110
|
// check if we intersect the sphere bounds
|
|
92
111
|
|
|
93
112
|
if ( geometry.boundingSphere === null ) {
|
|
@@ -98,16 +117,9 @@
|
|
|
98
117
|
|
|
99
118
|
_sphere.copy( geometry.boundingSphere ).applyMatrix4( matrixWorld );
|
|
100
119
|
|
|
101
|
-
const distanceToSphere = Math.max( camera.near, _sphere.distanceToPoint( ray.origin ) ); //
|
|
102
|
-
|
|
103
|
-
_clipToWorldVector.set( 0, 0, - distanceToSphere, 1.0 ).applyMatrix4( camera.projectionMatrix );
|
|
104
|
-
|
|
105
|
-
_clipToWorldVector.multiplyScalar( 1.0 / _clipToWorldVector.w );
|
|
106
|
-
|
|
107
|
-
_clipToWorldVector.applyMatrix4( camera.projectionMatrixInverse ); // increase the sphere bounds by the worst case line screen space width
|
|
108
|
-
|
|
120
|
+
const distanceToSphere = Math.max( camera.near, _sphere.distanceToPoint( ray.origin ) ); // increase the sphere bounds by the worst case line screen space width
|
|
109
121
|
|
|
110
|
-
const sphereMargin =
|
|
122
|
+
const sphereMargin = getWorldSpaceHalfWidth( camera, distanceToSphere, lineWidth, resolution );
|
|
111
123
|
_sphere.radius += sphereMargin;
|
|
112
124
|
|
|
113
125
|
if ( raycaster.ray.intersectsSphere( _sphere ) === false ) {
|
|
@@ -126,16 +138,9 @@
|
|
|
126
138
|
|
|
127
139
|
_box.copy( geometry.boundingBox ).applyMatrix4( matrixWorld );
|
|
128
140
|
|
|
129
|
-
const distanceToBox = Math.max( camera.near, _box.distanceToPoint( ray.origin ) ); //
|
|
130
|
-
|
|
131
|
-
_clipToWorldVector.set( 0, 0, - distanceToBox, 1.0 ).applyMatrix4( camera.projectionMatrix );
|
|
132
|
-
|
|
133
|
-
_clipToWorldVector.multiplyScalar( 1.0 / _clipToWorldVector.w );
|
|
134
|
-
|
|
135
|
-
_clipToWorldVector.applyMatrix4( camera.projectionMatrixInverse ); // increase the sphere bounds by the worst case line screen space width
|
|
136
|
-
|
|
141
|
+
const distanceToBox = Math.max( camera.near, _box.distanceToPoint( ray.origin ) ); // increase the box bounds by the worst case line screen space width
|
|
137
142
|
|
|
138
|
-
const boxMargin =
|
|
143
|
+
const boxMargin = getWorldSpaceHalfWidth( camera, distanceToBox, lineWidth, resolution );
|
|
139
144
|
_box.max.x += boxMargin;
|
|
140
145
|
_box.max.y += boxMargin;
|
|
141
146
|
_box.max.z += boxMargin;
|
|
@@ -276,7 +281,7 @@
|
|
|
276
281
|
|
|
277
282
|
}
|
|
278
283
|
|
|
279
|
-
LineSegments2.prototype.
|
|
284
|
+
LineSegments2.prototype.isLineSegments2 = true;
|
|
280
285
|
|
|
281
286
|
THREE.LineSegments2 = LineSegments2;
|
|
282
287
|
|
|
@@ -231,6 +231,10 @@
|
|
|
231
231
|
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
+
map.wrapS = texture.wrapU === 0 ? THREE.RepeatWrapping : THREE.ClampToEdgeWrapping;
|
|
235
|
+
map.wrapT = texture.wrapV === 0 ? THREE.RepeatWrapping : THREE.ClampToEdgeWrapping;
|
|
236
|
+
map.repeat.set( texture.repeat[ 0 ], texture.repeat[ 1 ] );
|
|
237
|
+
|
|
234
238
|
}
|
|
235
239
|
|
|
236
240
|
}
|
|
@@ -778,7 +782,8 @@
|
|
|
778
782
|
const layers = [];
|
|
779
783
|
const views = [];
|
|
780
784
|
const namedViews = [];
|
|
781
|
-
const groups = [];
|
|
785
|
+
const groups = [];
|
|
786
|
+
const strings = []; //Handle objects
|
|
782
787
|
|
|
783
788
|
const objs = doc.objects();
|
|
784
789
|
const cnt = objs.count;
|
|
@@ -840,6 +845,13 @@
|
|
|
840
845
|
type: textureType
|
|
841
846
|
};
|
|
842
847
|
const image = doc.getEmbeddedFileAsBase64( _texture.fileName );
|
|
848
|
+
texture.wrapU = _texture.wrapU;
|
|
849
|
+
texture.wrapV = _texture.wrapV;
|
|
850
|
+
texture.wrapW = _texture.wrapW;
|
|
851
|
+
|
|
852
|
+
const uvw = _texture.uvwTransform.toFloatArray( true );
|
|
853
|
+
|
|
854
|
+
texture.repeat = [ uvw[ 0 ], uvw[ 5 ] ];
|
|
843
855
|
|
|
844
856
|
if ( image ) {
|
|
845
857
|
|
|
@@ -959,18 +971,18 @@
|
|
|
959
971
|
// console.log( `Dimstyle Count: ${doc.dimstyles().count()}` );
|
|
960
972
|
// Handle bitmaps
|
|
961
973
|
// console.log( `Bitmap Count: ${doc.bitmaps().count()}` );
|
|
962
|
-
// Handle strings
|
|
974
|
+
// Handle strings
|
|
963
975
|
// console.log( `Document Strings Count: ${doc.strings().count()}` );
|
|
976
|
+
// Note: doc.strings().documentUserTextCount() counts any doc.strings defined in a section
|
|
977
|
+
//console.log( `Document User Text Count: ${doc.strings().documentUserTextCount()}` );
|
|
978
|
+
|
|
979
|
+
const strings_count = doc.strings().count();
|
|
964
980
|
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
strings.push( string );
|
|
971
|
-
_string.delete();
|
|
972
|
-
}
|
|
973
|
-
*/
|
|
981
|
+
for ( let i = 0; i < strings_count; i ++ ) {
|
|
982
|
+
|
|
983
|
+
strings.push( doc.strings().get( i ) );
|
|
984
|
+
|
|
985
|
+
}
|
|
974
986
|
|
|
975
987
|
doc.delete();
|
|
976
988
|
return {
|
|
@@ -980,6 +992,7 @@
|
|
|
980
992
|
views,
|
|
981
993
|
namedViews,
|
|
982
994
|
groups,
|
|
995
|
+
strings,
|
|
983
996
|
settings
|
|
984
997
|
};
|
|
985
998
|
|
|
@@ -968,7 +968,7 @@
|
|
|
968
968
|
geometry.setIndex( new THREE.BufferAttribute( meshData[ 'triangles' ], 1 ) );
|
|
969
969
|
geometry.setAttribute( 'position', new THREE.BufferAttribute( meshData[ 'vertices' ], 3 ) );
|
|
970
970
|
const material = new THREE.MeshPhongMaterial( {
|
|
971
|
-
color:
|
|
971
|
+
color: 0xffffff,
|
|
972
972
|
flatShading: true
|
|
973
973
|
} );
|
|
974
974
|
const mesh = new THREE.Mesh( geometry, material );
|
|
@@ -1299,7 +1299,7 @@
|
|
|
1299
1299
|
for ( let i = 0; i < buildData.length; i ++ ) {
|
|
1300
1300
|
|
|
1301
1301
|
const buildItem = buildData[ i ];
|
|
1302
|
-
const object3D = objects[ buildItem[ 'objectId' ] ]; // apply transform
|
|
1302
|
+
const object3D = objects[ buildItem[ 'objectId' ] ].clone(); // apply transform
|
|
1303
1303
|
|
|
1304
1304
|
const transform = buildItem[ 'transform' ];
|
|
1305
1305
|
|
|
@@ -1110,6 +1110,10 @@
|
|
|
1110
1110
|
data.parameters = parseEffectParameters( child );
|
|
1111
1111
|
break;
|
|
1112
1112
|
|
|
1113
|
+
case 'extra':
|
|
1114
|
+
data.extra = parseEffectExtra( child );
|
|
1115
|
+
break;
|
|
1116
|
+
|
|
1113
1117
|
}
|
|
1114
1118
|
|
|
1115
1119
|
}
|
|
@@ -1267,6 +1271,10 @@
|
|
|
1267
1271
|
|
|
1268
1272
|
break;
|
|
1269
1273
|
|
|
1274
|
+
case 'bump':
|
|
1275
|
+
data[ child.nodeName ] = parseEffectExtraTechniqueBump( child );
|
|
1276
|
+
break;
|
|
1277
|
+
|
|
1270
1278
|
}
|
|
1271
1279
|
|
|
1272
1280
|
}
|
|
@@ -1311,6 +1319,37 @@
|
|
|
1311
1319
|
data[ child.nodeName ] = parseInt( child.textContent );
|
|
1312
1320
|
break;
|
|
1313
1321
|
|
|
1322
|
+
case 'bump':
|
|
1323
|
+
data[ child.nodeName ] = parseEffectExtraTechniqueBump( child );
|
|
1324
|
+
break;
|
|
1325
|
+
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
return data;
|
|
1331
|
+
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
function parseEffectExtraTechniqueBump( xml ) {
|
|
1335
|
+
|
|
1336
|
+
var data = {};
|
|
1337
|
+
|
|
1338
|
+
for ( var i = 0, l = xml.childNodes.length; i < l; i ++ ) {
|
|
1339
|
+
|
|
1340
|
+
var child = xml.childNodes[ i ];
|
|
1341
|
+
if ( child.nodeType !== 1 ) continue;
|
|
1342
|
+
|
|
1343
|
+
switch ( child.nodeName ) {
|
|
1344
|
+
|
|
1345
|
+
case 'texture':
|
|
1346
|
+
data[ child.nodeName ] = {
|
|
1347
|
+
id: child.getAttribute( 'texture' ),
|
|
1348
|
+
texcoord: child.getAttribute( 'texcoord' ),
|
|
1349
|
+
extra: parseEffectParameterTexture( child )
|
|
1350
|
+
};
|
|
1351
|
+
break;
|
|
1352
|
+
|
|
1314
1353
|
}
|
|
1315
1354
|
|
|
1316
1355
|
}
|
|
@@ -1383,7 +1422,6 @@
|
|
|
1383
1422
|
|
|
1384
1423
|
const effect = getEffect( data.url );
|
|
1385
1424
|
const technique = effect.profile.technique;
|
|
1386
|
-
const extra = effect.profile.extra;
|
|
1387
1425
|
let material;
|
|
1388
1426
|
|
|
1389
1427
|
switch ( technique.type ) {
|
|
@@ -1559,6 +1597,7 @@
|
|
|
1559
1597
|
break;
|
|
1560
1598
|
|
|
1561
1599
|
default:
|
|
1600
|
+
material.opacity = 1 - transparency.float;
|
|
1562
1601
|
console.warn( 'THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.', transparent.opaque );
|
|
1563
1602
|
|
|
1564
1603
|
}
|
|
@@ -1570,9 +1609,28 @@
|
|
|
1570
1609
|
} //
|
|
1571
1610
|
|
|
1572
1611
|
|
|
1573
|
-
if ( extra !== undefined && extra.technique !== undefined
|
|
1612
|
+
if ( technique.extra !== undefined && technique.extra.technique !== undefined ) {
|
|
1613
|
+
|
|
1614
|
+
const techniques = technique.extra.technique;
|
|
1574
1615
|
|
|
1575
|
-
|
|
1616
|
+
for ( const k in techniques ) {
|
|
1617
|
+
|
|
1618
|
+
const v = techniques[ k ];
|
|
1619
|
+
|
|
1620
|
+
switch ( k ) {
|
|
1621
|
+
|
|
1622
|
+
case 'double_sided':
|
|
1623
|
+
material.side = v === 1 ? THREE.DoubleSide : THREE.FrontSide;
|
|
1624
|
+
break;
|
|
1625
|
+
|
|
1626
|
+
case 'bump':
|
|
1627
|
+
material.normalMap = getTexture( v.texture );
|
|
1628
|
+
material.normalScale = new THREE.Vector2( 1, 1 );
|
|
1629
|
+
break;
|
|
1630
|
+
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
}
|
|
1576
1634
|
|
|
1577
1635
|
}
|
|
1578
1636
|
|
|
@@ -1310,7 +1310,7 @@
|
|
|
1310
1310
|
|
|
1311
1311
|
for ( const nodeID in BindPoseNode ) {
|
|
1312
1312
|
|
|
1313
|
-
if ( BindPoseNode[ nodeID ].attrType === 'BindPose' ) {
|
|
1313
|
+
if ( BindPoseNode[ nodeID ].attrType === 'BindPose' && BindPoseNode[ nodeID ].NbPoseNodes > 0 ) {
|
|
1314
1314
|
|
|
1315
1315
|
const poseNodes = BindPoseNode[ nodeID ].PoseNode;
|
|
1316
1316
|
|
|
@@ -23,6 +23,11 @@
|
|
|
23
23
|
|
|
24
24
|
return new GLTFTextureWebPExtension( parser );
|
|
25
25
|
|
|
26
|
+
} );
|
|
27
|
+
this.register( function ( parser ) {
|
|
28
|
+
|
|
29
|
+
return new GLTFMaterialsSheenExtension( parser );
|
|
30
|
+
|
|
26
31
|
} );
|
|
27
32
|
this.register( function ( parser ) {
|
|
28
33
|
|
|
@@ -291,6 +296,17 @@
|
|
|
291
296
|
|
|
292
297
|
}
|
|
293
298
|
|
|
299
|
+
parseAsync( data, path ) {
|
|
300
|
+
|
|
301
|
+
const scope = this;
|
|
302
|
+
return new Promise( function ( resolve, reject ) {
|
|
303
|
+
|
|
304
|
+
scope.parse( data, path, resolve, reject );
|
|
305
|
+
|
|
306
|
+
} );
|
|
307
|
+
|
|
308
|
+
}
|
|
309
|
+
|
|
294
310
|
}
|
|
295
311
|
/* GLTFREGISTRY */
|
|
296
312
|
|
|
@@ -336,6 +352,7 @@
|
|
|
336
352
|
KHR_MATERIALS_CLEARCOAT: 'KHR_materials_clearcoat',
|
|
337
353
|
KHR_MATERIALS_IOR: 'KHR_materials_ior',
|
|
338
354
|
KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: 'KHR_materials_pbrSpecularGlossiness',
|
|
355
|
+
KHR_MATERIALS_SHEEN: 'KHR_materials_sheen',
|
|
339
356
|
KHR_MATERIALS_SPECULAR: 'KHR_materials_specular',
|
|
340
357
|
KHR_MATERIALS_TRANSMISSION: 'KHR_materials_transmission',
|
|
341
358
|
KHR_MATERIALS_UNLIT: 'KHR_materials_unlit',
|
|
@@ -592,6 +609,77 @@
|
|
|
592
609
|
|
|
593
610
|
}
|
|
594
611
|
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* Sheen Materials Extension
|
|
615
|
+
*
|
|
616
|
+
* Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_sheen
|
|
617
|
+
*/
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
class GLTFMaterialsSheenExtension {
|
|
621
|
+
|
|
622
|
+
constructor( parser ) {
|
|
623
|
+
|
|
624
|
+
this.parser = parser;
|
|
625
|
+
this.name = EXTENSIONS.KHR_MATERIALS_SHEEN;
|
|
626
|
+
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
getMaterialType( materialIndex ) {
|
|
630
|
+
|
|
631
|
+
const parser = this.parser;
|
|
632
|
+
const materialDef = parser.json.materials[ materialIndex ];
|
|
633
|
+
if ( ! materialDef.extensions || ! materialDef.extensions[ this.name ] ) return null;
|
|
634
|
+
return THREE.MeshPhysicalMaterial;
|
|
635
|
+
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
extendMaterialParams( materialIndex, materialParams ) {
|
|
639
|
+
|
|
640
|
+
const parser = this.parser;
|
|
641
|
+
const materialDef = parser.json.materials[ materialIndex ];
|
|
642
|
+
|
|
643
|
+
if ( ! materialDef.extensions || ! materialDef.extensions[ this.name ] ) {
|
|
644
|
+
|
|
645
|
+
return Promise.resolve();
|
|
646
|
+
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
const pending = [];
|
|
650
|
+
materialParams.sheenColor = new THREE.Color( 0, 0, 0 );
|
|
651
|
+
materialParams.sheenRoughness = 0;
|
|
652
|
+
materialParams.sheen = 1;
|
|
653
|
+
const extension = materialDef.extensions[ this.name ];
|
|
654
|
+
|
|
655
|
+
if ( extension.sheenColorFactor !== undefined ) {
|
|
656
|
+
|
|
657
|
+
materialParams.sheenColor.fromArray( extension.sheenColorFactor );
|
|
658
|
+
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
if ( extension.sheenRoughnessFactor !== undefined ) {
|
|
662
|
+
|
|
663
|
+
materialParams.sheenRoughness = extension.sheenRoughnessFactor;
|
|
664
|
+
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
if ( extension.sheenColorTexture !== undefined ) {
|
|
668
|
+
|
|
669
|
+
pending.push( parser.assignTexture( materialParams, 'sheenColorMap', extension.sheenColorTexture ) );
|
|
670
|
+
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
if ( extension.sheenRoughnessTexture !== undefined ) {
|
|
674
|
+
|
|
675
|
+
pending.push( parser.assignTexture( materialParams, 'sheenRoughnessMap', extension.sheenRoughnessTexture ) );
|
|
676
|
+
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
return Promise.all( pending );
|
|
680
|
+
|
|
681
|
+
}
|
|
682
|
+
|
|
595
683
|
}
|
|
596
684
|
/**
|
|
597
685
|
* Transmission Materials Extension
|
|
@@ -698,7 +786,7 @@
|
|
|
698
786
|
|
|
699
787
|
materialParams.attenuationDistance = extension.attenuationDistance || 0;
|
|
700
788
|
const colorArray = extension.attenuationColor || [ 1, 1, 1 ];
|
|
701
|
-
materialParams.
|
|
789
|
+
materialParams.attenuationColor = new THREE.Color( colorArray[ 0 ], colorArray[ 1 ], colorArray[ 2 ] );
|
|
702
790
|
return Promise.all( pending );
|
|
703
791
|
|
|
704
792
|
}
|
|
@@ -794,11 +882,11 @@
|
|
|
794
882
|
}
|
|
795
883
|
|
|
796
884
|
const colorArray = extension.specularColorFactor || [ 1, 1, 1 ];
|
|
797
|
-
materialParams.
|
|
885
|
+
materialParams.specularColor = new THREE.Color( colorArray[ 0 ], colorArray[ 1 ], colorArray[ 2 ] );
|
|
798
886
|
|
|
799
887
|
if ( extension.specularColorTexture !== undefined ) {
|
|
800
888
|
|
|
801
|
-
pending.push( parser.assignTexture( materialParams, '
|
|
889
|
+
pending.push( parser.assignTexture( materialParams, 'specularColorMap', extension.specularColorTexture ).then( function ( texture ) {
|
|
802
890
|
|
|
803
891
|
texture.encoding = THREE.sRGBEncoding;
|
|
804
892
|
|
|
@@ -1658,34 +1746,10 @@
|
|
|
1658
1746
|
MASK: 'MASK',
|
|
1659
1747
|
BLEND: 'BLEND'
|
|
1660
1748
|
};
|
|
1661
|
-
/* UTILITY FUNCTIONS */
|
|
1662
|
-
|
|
1663
|
-
function resolveURL( url, path ) {
|
|
1664
|
-
|
|
1665
|
-
// Invalid URL
|
|
1666
|
-
if ( typeof url !== 'string' || url === '' ) return ''; // Host Relative URL
|
|
1667
|
-
|
|
1668
|
-
if ( /^https?:\/\//i.test( path ) && /^\//.test( url ) ) {
|
|
1669
|
-
|
|
1670
|
-
path = path.replace( /(^https?:\/\/[^\/]+).*/i, '$1' );
|
|
1671
|
-
|
|
1672
|
-
} // Absolute URL http://,https://,//
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
if ( /^(https?:)?\/\//i.test( url ) ) return url; // Data URI
|
|
1676
|
-
|
|
1677
|
-
if ( /^data:.*,.*$/i.test( url ) ) return url; // Blob URL
|
|
1678
|
-
|
|
1679
|
-
if ( /^blob:.*$/i.test( url ) ) return url; // Relative URL
|
|
1680
|
-
|
|
1681
|
-
return path + url;
|
|
1682
|
-
|
|
1683
|
-
}
|
|
1684
1749
|
/**
|
|
1685
1750
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#default-material
|
|
1686
1751
|
*/
|
|
1687
1752
|
|
|
1688
|
-
|
|
1689
1753
|
function createDefaultMaterial( cache ) {
|
|
1690
1754
|
|
|
1691
1755
|
if ( cache[ 'DefaultMaterial' ] === undefined ) {
|
|
@@ -2312,7 +2376,7 @@
|
|
|
2312
2376
|
const options = this.options;
|
|
2313
2377
|
return new Promise( function ( resolve, reject ) {
|
|
2314
2378
|
|
|
2315
|
-
loader.load( resolveURL( bufferDef.uri, options.path ), resolve, undefined, function () {
|
|
2379
|
+
loader.load( THREE.LoaderUtils.resolveURL( bufferDef.uri, options.path ), resolve, undefined, function () {
|
|
2316
2380
|
|
|
2317
2381
|
reject( new Error( 'THREE.GLTFLoader: Failed to load buffer "' + bufferDef.uri + '".' ) );
|
|
2318
2382
|
|
|
@@ -2547,7 +2611,7 @@
|
|
|
2547
2611
|
|
|
2548
2612
|
}
|
|
2549
2613
|
|
|
2550
|
-
loader.load( resolveURL( sourceURI, options.path ), onLoad, undefined, reject );
|
|
2614
|
+
loader.load( THREE.LoaderUtils.resolveURL( sourceURI, options.path ), onLoad, undefined, reject );
|
|
2551
2615
|
|
|
2552
2616
|
} );
|
|
2553
2617
|
|
|
@@ -3255,10 +3319,9 @@
|
|
|
3255
3319
|
|
|
3256
3320
|
if ( PATH_PROPERTIES[ target.path ] === PATH_PROPERTIES.weights ) {
|
|
3257
3321
|
|
|
3258
|
-
// Node may be a THREE.Group (glTF mesh with several primitives) or a THREE.Mesh.
|
|
3259
3322
|
node.traverse( function ( object ) {
|
|
3260
3323
|
|
|
3261
|
-
if ( object.
|
|
3324
|
+
if ( object.morphTargetInfluences ) {
|
|
3262
3325
|
|
|
3263
3326
|
targetNames.push( object.name ? object.name : object.uuid );
|
|
3264
3327
|
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
|
|
18
18
|
const _taskCache = new WeakMap();
|
|
19
19
|
|
|
20
|
+
let _activeLoaders = 0;
|
|
21
|
+
|
|
20
22
|
class KTX2Loader extends THREE.Loader {
|
|
21
23
|
|
|
22
24
|
constructor( manager ) {
|
|
@@ -109,6 +111,15 @@
|
|
|
109
111
|
|
|
110
112
|
} );
|
|
111
113
|
|
|
114
|
+
if ( _activeLoaders > 0 ) {
|
|
115
|
+
|
|
116
|
+
// Each instance loads a transcoder and allocates workers, increasing network and memory cost.
|
|
117
|
+
console.warn( 'THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues.' + ' Use a single KTX2Loader instance, or call .dispose() on old instances.' );
|
|
118
|
+
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
_activeLoaders ++;
|
|
122
|
+
|
|
112
123
|
}
|
|
113
124
|
|
|
114
125
|
return this.transcoderPending;
|
|
@@ -207,6 +218,7 @@
|
|
|
207
218
|
|
|
208
219
|
URL.revokeObjectURL( this.workerSourceURL );
|
|
209
220
|
this.workerPool.dispose();
|
|
221
|
+
_activeLoaders --;
|
|
210
222
|
return this;
|
|
211
223
|
|
|
212
224
|
}
|