super-three 0.163.0 → 0.165.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/build/three.cjs +1127 -452
- package/build/three.module.js +1127 -452
- package/build/three.module.min.js +2 -2
- package/examples/jsm/animation/CCDIKSolver.js +4 -2
- package/examples/jsm/controls/TransformControls.js +1 -1
- package/examples/jsm/environments/RoomEnvironment.js +1 -5
- package/examples/jsm/exporters/GLTFExporter.js +45 -1
- package/examples/jsm/exporters/USDZExporter.js +13 -5
- package/examples/jsm/helpers/ViewHelper.js +32 -67
- package/examples/jsm/libs/draco/README.md +2 -2
- package/examples/jsm/libs/tween.module.js +75 -64
- package/examples/jsm/lines/LineMaterial.js +1 -15
- package/examples/jsm/lines/LineSegments2.js +15 -0
- package/examples/jsm/lines/Wireframe.js +16 -1
- package/examples/jsm/loaders/DRACOLoader.js +1 -1
- package/examples/jsm/loaders/EXRLoader.js +283 -99
- package/examples/jsm/loaders/FBXLoader.js +24 -13
- package/examples/jsm/loaders/GLTFLoader.js +55 -0
- package/examples/jsm/loaders/KTX2Loader.js +3 -6
- package/examples/jsm/loaders/LDrawLoader.js +3 -2
- package/examples/jsm/loaders/MMDLoader.js +31 -12
- package/examples/jsm/loaders/VRMLLoader.js +1 -1
- package/examples/jsm/loaders/lwo/IFFParser.js +8 -5
- package/examples/jsm/materials/MeshGouraudMaterial.js +7 -1
- package/examples/jsm/math/Octree.js +26 -20
- package/examples/jsm/modifiers/CurveModifier.js +11 -9
- package/examples/jsm/nodes/Nodes.js +15 -13
- package/examples/jsm/nodes/accessors/AccessorsUtils.js +16 -1
- package/examples/jsm/nodes/accessors/BitangentNode.js +7 -83
- package/examples/jsm/nodes/accessors/BufferNode.js +6 -0
- package/examples/jsm/nodes/accessors/CameraNode.js +12 -119
- package/examples/jsm/nodes/accessors/ClippingNode.js +3 -2
- package/examples/jsm/nodes/accessors/MaterialNode.js +109 -3
- package/examples/jsm/nodes/accessors/ModelNode.js +3 -0
- package/examples/jsm/nodes/accessors/NormalNode.js +9 -101
- package/examples/jsm/nodes/accessors/PositionNode.js +6 -100
- package/examples/jsm/nodes/accessors/ReferenceNode.js +6 -0
- package/examples/jsm/nodes/accessors/ReflectVectorNode.js +2 -31
- package/examples/jsm/nodes/accessors/StorageBufferNode.js +9 -0
- package/examples/jsm/nodes/accessors/{TextureStoreNode.js → StorageTextureNode.js} +19 -6
- package/examples/jsm/nodes/accessors/TangentNode.js +11 -97
- package/examples/jsm/nodes/accessors/Texture3DNode.js +100 -0
- package/examples/jsm/nodes/accessors/TextureNode.js +21 -3
- package/examples/jsm/nodes/accessors/TextureSizeNode.js +1 -1
- package/examples/jsm/nodes/accessors/UVNode.js +2 -46
- package/examples/jsm/nodes/code/FunctionNode.js +0 -8
- package/examples/jsm/nodes/core/AttributeNode.js +15 -3
- package/examples/jsm/nodes/core/ContextNode.js +6 -0
- package/examples/jsm/nodes/core/Node.js +23 -2
- package/examples/jsm/nodes/core/NodeBuilder.js +25 -18
- package/examples/jsm/nodes/core/NodeKeywords.js +1 -1
- package/examples/jsm/nodes/core/OutputStructNode.js +3 -6
- package/examples/jsm/nodes/core/PropertyNode.js +11 -0
- package/examples/jsm/nodes/core/VaryingNode.js +40 -9
- package/examples/jsm/nodes/display/AfterImageNode.js +14 -2
- package/examples/jsm/nodes/display/BumpMapNode.js +7 -26
- package/examples/jsm/nodes/display/FrontFacingNode.js +13 -0
- package/examples/jsm/nodes/display/PassNode.js +3 -1
- package/examples/jsm/nodes/display/ViewportDepthNode.js +1 -1
- package/examples/jsm/nodes/display/ViewportNode.js +5 -3
- package/examples/jsm/nodes/display/ViewportTextureNode.js +4 -1
- package/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js +26 -7
- package/examples/jsm/nodes/functions/BSDF/D_GGX_Anisotropic.js +28 -0
- package/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +1 -3
- package/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +29 -0
- package/examples/jsm/nodes/functions/PhongLightingModel.js +1 -1
- package/examples/jsm/nodes/functions/PhysicalLightingModel.js +210 -12
- package/examples/jsm/nodes/functions/ShadowMaskModel.js +31 -0
- package/examples/jsm/nodes/functions/ToonLightingModel.js +49 -0
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +20 -5
- package/examples/jsm/nodes/lighting/DirectionalLightNode.js +2 -1
- package/examples/jsm/nodes/lighting/EnvironmentNode.js +11 -2
- package/examples/jsm/nodes/lighting/IrradianceNode.js +24 -0
- package/examples/jsm/nodes/lighting/LightsNode.js +28 -1
- package/examples/jsm/nodes/lighting/PointLightNode.js +2 -1
- package/examples/jsm/nodes/lighting/SpotLightNode.js +2 -1
- package/examples/jsm/nodes/materials/Line2NodeMaterial.js +11 -7
- package/examples/jsm/nodes/materials/Materials.js +4 -0
- package/examples/jsm/nodes/materials/MeshMatcapNodeMaterial.js +52 -0
- package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +0 -2
- package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +2 -2
- package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +94 -6
- package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +11 -4
- package/examples/jsm/nodes/materials/MeshToonNodeMaterial.js +34 -0
- package/examples/jsm/nodes/materials/NodeMaterial.js +43 -45
- package/examples/jsm/nodes/materials/ShadowNodeMaterial.js +34 -0
- package/examples/jsm/nodes/materials/VolumeNodeMaterial.js +106 -0
- package/examples/jsm/nodes/math/HashNode.js +2 -2
- package/examples/jsm/nodes/pmrem/PMREMUtils.js +1 -1
- package/examples/jsm/nodes/shadernode/ShaderNode.js +57 -41
- package/examples/jsm/nodes/utils/ArrayElementNode.js +1 -1
- package/examples/jsm/nodes/utils/MatcapUVNode.js +1 -1
- package/examples/jsm/nodes/utils/TimerNode.js +1 -1
- package/examples/jsm/objects/Lensflare.js +2 -2
- package/examples/jsm/physics/JoltPhysics.js +281 -0
- package/examples/jsm/postprocessing/RenderPass.js +1 -1
- package/examples/jsm/postprocessing/RenderTransitionPass.js +193 -0
- package/examples/jsm/renderers/CSS2DRenderer.js +25 -5
- package/examples/jsm/renderers/CSS3DRenderer.js +24 -3
- package/examples/jsm/renderers/common/Attributes.js +2 -0
- package/examples/jsm/renderers/common/Background.js +3 -3
- package/examples/jsm/renderers/common/Bindings.js +17 -0
- package/examples/jsm/renderers/common/ChainMap.js +18 -48
- package/examples/jsm/renderers/common/ClippingContext.js +5 -5
- package/examples/jsm/renderers/common/Pipelines.js +2 -2
- package/examples/jsm/renderers/common/RenderBundle.js +18 -0
- package/examples/jsm/renderers/common/RenderBundles.js +38 -0
- package/examples/jsm/renderers/common/RenderList.js +10 -1
- package/examples/jsm/renderers/common/RenderObject.js +49 -1
- package/examples/jsm/renderers/common/Renderer.js +268 -25
- package/examples/jsm/renderers/common/Textures.js +1 -1
- package/examples/jsm/renderers/common/Uniform.js +1 -1
- package/examples/jsm/renderers/common/extras/PMREMGenerator.js +13 -17
- package/examples/jsm/renderers/common/nodes/NodeSampledTexture.js +18 -4
- package/examples/jsm/renderers/common/nodes/NodeSampler.js +6 -0
- package/examples/jsm/renderers/common/nodes/Nodes.js +31 -47
- package/examples/jsm/renderers/webgl/WebGLBackend.js +7 -21
- package/examples/jsm/renderers/webgl/WebGLBufferRenderer.js +5 -1
- package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +23 -5
- package/examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js +114 -13
- package/examples/jsm/renderers/webgl/utils/WebGLUtils.js +3 -21
- package/examples/jsm/renderers/webgpu/WebGPUBackend.js +80 -46
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +85 -12
- package/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +4 -1
- package/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +10 -1
- package/examples/jsm/renderers/webgpu/utils/WebGPUConstants.js +6 -0
- package/examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js +62 -19
- package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +62 -3
- package/examples/jsm/transpiler/GLSLDecoder.js +1 -1
- package/examples/jsm/transpiler/ShaderToyDecoder.js +1 -1
- package/examples/jsm/utils/BufferGeometryUtils.js +18 -16
- package/examples/jsm/utils/GPUStatsPanel.js +2 -0
- package/examples/jsm/utils/SceneUtils.js +60 -1
- package/examples/jsm/utils/SortUtils.js +8 -5
- package/examples/jsm/webxr/OculusHandModel.js +3 -2
- package/examples/jsm/webxr/XRHandModelFactory.js +4 -2
- package/package.json +3 -2
- package/src/animation/tracks/BooleanKeyframeTrack.js +10 -1
- package/src/animation/tracks/QuaternionKeyframeTrack.js +1 -2
- package/src/animation/tracks/StringKeyframeTrack.js +10 -1
- package/src/constants.js +1 -1
- package/src/core/Object3D.js +2 -0
- package/src/core/Raycaster.js +6 -2
- package/src/core/RenderTarget.js +8 -0
- package/src/extras/PMREMGenerator.js +12 -11
- package/src/loaders/FileLoader.js +5 -1
- package/src/loaders/LoaderUtils.js +3 -1
- package/src/loaders/MaterialLoader.js +1 -0
- package/src/loaders/ObjectLoader.js +1 -0
- package/src/materials/Material.js +2 -0
- package/src/materials/MeshPhysicalMaterial.js +20 -0
- package/src/objects/BatchedMesh.js +114 -1
- package/src/objects/Line.js +66 -43
- package/src/renderers/WebGLRenderer.js +371 -109
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +15 -0
- package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +9 -1
- package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +8 -22
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +1 -0
- package/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js +3 -14
- package/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.js +10 -31
- package/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js +3 -23
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +17 -9
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +47 -13
- package/src/renderers/shaders/ShaderChunk.js +0 -2
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +4 -0
- package/src/renderers/shaders/ShaderLib.js +1 -0
- package/src/renderers/webgl/WebGLBackground.js +24 -3
- package/src/renderers/webgl/WebGLBufferRenderer.js +36 -0
- package/src/renderers/webgl/WebGLCapabilities.js +33 -1
- package/src/renderers/webgl/WebGLExtensions.js +3 -1
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +36 -0
- package/src/renderers/webgl/WebGLLights.js +9 -12
- package/src/renderers/webgl/WebGLMaterials.js +7 -5
- package/src/renderers/webgl/WebGLMorphtargets.js +1 -2
- package/src/renderers/webgl/WebGLProgram.js +5 -36
- package/src/renderers/webgl/WebGLPrograms.js +19 -14
- package/src/renderers/webgl/WebGLRenderStates.js +8 -4
- package/src/renderers/webgl/WebGLShadowMap.js +25 -25
- package/src/renderers/webgl/WebGLTextures.js +206 -129
- package/src/renderers/webgl/WebGLUtils.js +3 -21
- package/src/renderers/webxr/WebXRDepthSensing.js +3 -3
- package/src/renderers/webxr/WebXRManager.js +8 -6
- package/src/textures/CompressedArrayTexture.js +14 -0
- package/src/textures/DataArrayTexture.js +14 -0
- package/src/textures/DepthTexture.js +1 -3
- package/src/utils.js +30 -1
- package/examples/jsm/renderers/webgl-legacy/nodes/GLSL1NodeBuilder.js +0 -318
- package/examples/jsm/renderers/webgl-legacy/nodes/SlotNode.js +0 -26
- package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodeBuilder.js +0 -792
- package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodes.js +0 -51
- package/src/renderers/shaders/ShaderChunk/lightmap_fragment.glsl.js +0 -10
|
@@ -213,11 +213,12 @@ class CCDIKSolver {
|
|
|
213
213
|
/**
|
|
214
214
|
* Creates Helper
|
|
215
215
|
*
|
|
216
|
+
* @param {number} sphereSize
|
|
216
217
|
* @return {CCDIKHelper}
|
|
217
218
|
*/
|
|
218
|
-
createHelper() {
|
|
219
|
+
createHelper( sphereSize ) {
|
|
219
220
|
|
|
220
|
-
return new CCDIKHelper( this.mesh, this.iks );
|
|
221
|
+
return new CCDIKHelper( this.mesh, this.iks, sphereSize );
|
|
221
222
|
|
|
222
223
|
}
|
|
223
224
|
|
|
@@ -280,6 +281,7 @@ function setPositionOfBoneToAttributeArray( array, index, bone, matrixWorldInv )
|
|
|
280
281
|
*
|
|
281
282
|
* @param {SkinnedMesh} mesh
|
|
282
283
|
* @param {Array<Object>} iks
|
|
284
|
+
* @param {number} sphereSize
|
|
283
285
|
*/
|
|
284
286
|
class CCDIKHelper extends Object3D {
|
|
285
287
|
|
|
@@ -32,7 +32,7 @@ const _unit = {
|
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
const _changeEvent = { type: 'change' };
|
|
35
|
-
const _mouseDownEvent = { type: 'mouseDown' };
|
|
35
|
+
const _mouseDownEvent = { type: 'mouseDown', mode: null };
|
|
36
36
|
const _mouseUpEvent = { type: 'mouseUp', mode: null };
|
|
37
37
|
const _objectChangeEvent = { type: 'objectChange' };
|
|
38
38
|
|
|
@@ -24,11 +24,7 @@ class RoomEnvironment extends Scene {
|
|
|
24
24
|
const roomMaterial = new MeshStandardMaterial( { side: BackSide } );
|
|
25
25
|
const boxMaterial = new MeshStandardMaterial();
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if ( renderer !== null && renderer._useLegacyLights === false ) intensity = 900;
|
|
30
|
-
|
|
31
|
-
const mainLight = new PointLight( 0xffffff, intensity, 28, 2 );
|
|
27
|
+
const mainLight = new PointLight( 0xffffff, 900, 28, 2 );
|
|
32
28
|
mainLight.position.set( 0.418, 16.199, 0.300 );
|
|
33
29
|
this.add( mainLight );
|
|
34
30
|
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
CompressedTexture,
|
|
25
25
|
Vector3,
|
|
26
26
|
Quaternion,
|
|
27
|
+
REVISION
|
|
27
28
|
} from 'three';
|
|
28
29
|
import { decompress } from './../utils/TextureUtils.js';
|
|
29
30
|
|
|
@@ -111,6 +112,12 @@ class GLTFExporter {
|
|
|
111
112
|
|
|
112
113
|
} );
|
|
113
114
|
|
|
115
|
+
this.register( function ( writer ) {
|
|
116
|
+
|
|
117
|
+
return new GLTFMaterialsDispersionExtension( writer );
|
|
118
|
+
|
|
119
|
+
} );
|
|
120
|
+
|
|
114
121
|
this.register( function ( writer ) {
|
|
115
122
|
|
|
116
123
|
return new GLTFMaterialsIridescenceExtension( writer );
|
|
@@ -496,7 +503,7 @@ class GLTFWriter {
|
|
|
496
503
|
this.json = {
|
|
497
504
|
asset: {
|
|
498
505
|
version: '2.0',
|
|
499
|
-
generator: 'THREE.GLTFExporter'
|
|
506
|
+
generator: 'THREE.GLTFExporter r' + REVISION
|
|
500
507
|
}
|
|
501
508
|
};
|
|
502
509
|
|
|
@@ -2633,6 +2640,9 @@ class GLTFMaterialsClearcoatExtension {
|
|
|
2633
2640
|
index: writer.processTexture( material.clearcoatNormalMap ),
|
|
2634
2641
|
texCoord: material.clearcoatNormalMap.channel
|
|
2635
2642
|
};
|
|
2643
|
+
|
|
2644
|
+
if ( material.clearcoatNormalScale.x !== 1 ) clearcoatNormalMapDef.scale = material.clearcoatNormalScale.x;
|
|
2645
|
+
|
|
2636
2646
|
writer.applyTextureTransform( clearcoatNormalMapDef, material.clearcoatNormalMap );
|
|
2637
2647
|
extensionDef.clearcoatNormalTexture = clearcoatNormalMapDef;
|
|
2638
2648
|
|
|
@@ -2648,6 +2658,40 @@ class GLTFMaterialsClearcoatExtension {
|
|
|
2648
2658
|
|
|
2649
2659
|
}
|
|
2650
2660
|
|
|
2661
|
+
/**
|
|
2662
|
+
* Materials dispersion Extension
|
|
2663
|
+
*
|
|
2664
|
+
* Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_dispersion
|
|
2665
|
+
*/
|
|
2666
|
+
class GLTFMaterialsDispersionExtension {
|
|
2667
|
+
|
|
2668
|
+
constructor( writer ) {
|
|
2669
|
+
|
|
2670
|
+
this.writer = writer;
|
|
2671
|
+
this.name = 'KHR_materials_dispersion';
|
|
2672
|
+
|
|
2673
|
+
}
|
|
2674
|
+
|
|
2675
|
+
writeMaterial( material, materialDef ) {
|
|
2676
|
+
|
|
2677
|
+
if ( ! material.isMeshPhysicalMaterial || material.dispersion === 0 ) return;
|
|
2678
|
+
|
|
2679
|
+
const writer = this.writer;
|
|
2680
|
+
const extensionsUsed = writer.extensionsUsed;
|
|
2681
|
+
|
|
2682
|
+
const extensionDef = {};
|
|
2683
|
+
|
|
2684
|
+
extensionDef.dispersion = material.dispersion;
|
|
2685
|
+
|
|
2686
|
+
materialDef.extensions = materialDef.extensions || {};
|
|
2687
|
+
materialDef.extensions[ this.name ] = extensionDef;
|
|
2688
|
+
|
|
2689
|
+
extensionsUsed[ this.name ] = true;
|
|
2690
|
+
|
|
2691
|
+
}
|
|
2692
|
+
|
|
2693
|
+
}
|
|
2694
|
+
|
|
2651
2695
|
/**
|
|
2652
2696
|
* Iridescence Materials Extension
|
|
2653
2697
|
*
|
|
@@ -12,13 +12,20 @@ import { decompress } from './../utils/TextureUtils.js';
|
|
|
12
12
|
|
|
13
13
|
class USDZExporter {
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
parse( scene, onDone, onError, options ) {
|
|
16
|
+
|
|
17
|
+
this.parseAsync( scene, options ).then( onDone ).catch( onError );
|
|
18
|
+
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async parseAsync( scene, options = {} ) {
|
|
16
22
|
|
|
17
23
|
options = Object.assign( {
|
|
18
24
|
ar: {
|
|
19
25
|
anchoring: { type: 'plane' },
|
|
20
26
|
planeAnchoring: { alignment: 'horizontal' }
|
|
21
27
|
},
|
|
28
|
+
includeAnchoringProperties: true,
|
|
22
29
|
quickLookCompatible: false,
|
|
23
30
|
maxTextureSize: 1024,
|
|
24
31
|
}, options );
|
|
@@ -192,6 +199,10 @@ function buildHeader() {
|
|
|
192
199
|
|
|
193
200
|
function buildSceneStart( options ) {
|
|
194
201
|
|
|
202
|
+
const alignment = options.includeAnchoringProperties === true ? `
|
|
203
|
+
token preliminary:anchoring:type = "${options.ar.anchoring.type}"
|
|
204
|
+
token preliminary:planeAnchoring:alignment = "${options.ar.planeAnchoring.alignment}"
|
|
205
|
+
` : '';
|
|
195
206
|
return `def Xform "Root"
|
|
196
207
|
{
|
|
197
208
|
def Scope "Scenes" (
|
|
@@ -205,10 +216,7 @@ function buildSceneStart( options ) {
|
|
|
205
216
|
}
|
|
206
217
|
sceneName = "Scene"
|
|
207
218
|
)
|
|
208
|
-
{
|
|
209
|
-
token preliminary:anchoring:type = "${options.ar.anchoring.type}"
|
|
210
|
-
token preliminary:planeAnchoring:alignment = "${options.ar.planeAnchoring.alignment}"
|
|
211
|
-
|
|
219
|
+
{${alignment}
|
|
212
220
|
`;
|
|
213
221
|
|
|
214
222
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
CylinderGeometry,
|
|
3
3
|
CanvasTexture,
|
|
4
4
|
Color,
|
|
5
5
|
Euler,
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
Raycaster,
|
|
12
12
|
Sprite,
|
|
13
13
|
SpriteMaterial,
|
|
14
|
+
SRGBColorSpace,
|
|
14
15
|
Vector2,
|
|
15
16
|
Vector3,
|
|
16
17
|
Vector4
|
|
@@ -27,9 +28,10 @@ class ViewHelper extends Object3D {
|
|
|
27
28
|
this.animating = false;
|
|
28
29
|
this.center = new Vector3();
|
|
29
30
|
|
|
30
|
-
const color1 = new Color( '#
|
|
31
|
-
const color2 = new Color( '#
|
|
32
|
-
const color3 = new Color( '#
|
|
31
|
+
const color1 = new Color( '#ff4466' );
|
|
32
|
+
const color2 = new Color( '#88ff44' );
|
|
33
|
+
const color3 = new Color( '#4488ff' );
|
|
34
|
+
const color4 = new Color( '#000000' );
|
|
33
35
|
|
|
34
36
|
const interactiveObjects = [];
|
|
35
37
|
const raycaster = new Raycaster();
|
|
@@ -39,7 +41,7 @@ class ViewHelper extends Object3D {
|
|
|
39
41
|
const orthoCamera = new OrthographicCamera( - 2, 2, 2, - 2, 0, 4 );
|
|
40
42
|
orthoCamera.position.set( 0, 0, 2 );
|
|
41
43
|
|
|
42
|
-
const geometry = new
|
|
44
|
+
const geometry = new CylinderGeometry( 0.04, 0.04, 0.8, 5 ).rotateZ( - Math.PI / 2 ).translate( 0.4, 0, 0 );
|
|
43
45
|
|
|
44
46
|
const xAxis = new Mesh( geometry, getAxisMaterial( color1 ) );
|
|
45
47
|
const yAxis = new Mesh( geometry, getAxisMaterial( color2 ) );
|
|
@@ -52,28 +54,35 @@ class ViewHelper extends Object3D {
|
|
|
52
54
|
this.add( zAxis );
|
|
53
55
|
this.add( yAxis );
|
|
54
56
|
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
negYAxisHelper
|
|
65
|
-
const negZAxisHelper = new Sprite(
|
|
66
|
-
negZAxisHelper.userData.type = 'negZ';
|
|
57
|
+
const spriteMaterial1 = getSpriteMaterial( color1 );
|
|
58
|
+
const spriteMaterial2 = getSpriteMaterial( color2 );
|
|
59
|
+
const spriteMaterial3 = getSpriteMaterial( color3 );
|
|
60
|
+
const spriteMaterial4 = getSpriteMaterial( color4 );
|
|
61
|
+
|
|
62
|
+
const posXAxisHelper = new Sprite( spriteMaterial1 );
|
|
63
|
+
const posYAxisHelper = new Sprite( spriteMaterial2 );
|
|
64
|
+
const posZAxisHelper = new Sprite( spriteMaterial3 );
|
|
65
|
+
const negXAxisHelper = new Sprite( spriteMaterial4 );
|
|
66
|
+
const negYAxisHelper = new Sprite( spriteMaterial4 );
|
|
67
|
+
const negZAxisHelper = new Sprite( spriteMaterial4 );
|
|
67
68
|
|
|
68
69
|
posXAxisHelper.position.x = 1;
|
|
69
70
|
posYAxisHelper.position.y = 1;
|
|
70
71
|
posZAxisHelper.position.z = 1;
|
|
71
72
|
negXAxisHelper.position.x = - 1;
|
|
72
|
-
negXAxisHelper.scale.setScalar( 0.8 );
|
|
73
73
|
negYAxisHelper.position.y = - 1;
|
|
74
|
-
negYAxisHelper.scale.setScalar( 0.8 );
|
|
75
74
|
negZAxisHelper.position.z = - 1;
|
|
76
|
-
|
|
75
|
+
|
|
76
|
+
negXAxisHelper.material.opacity = 0.2;
|
|
77
|
+
negYAxisHelper.material.opacity = 0.2;
|
|
78
|
+
negZAxisHelper.material.opacity = 0.2;
|
|
79
|
+
|
|
80
|
+
posXAxisHelper.userData.type = 'posX';
|
|
81
|
+
posYAxisHelper.userData.type = 'posY';
|
|
82
|
+
posZAxisHelper.userData.type = 'posZ';
|
|
83
|
+
negXAxisHelper.userData.type = 'negX';
|
|
84
|
+
negYAxisHelper.userData.type = 'negY';
|
|
85
|
+
negZAxisHelper.userData.type = 'negZ';
|
|
77
86
|
|
|
78
87
|
this.add( posXAxisHelper );
|
|
79
88
|
this.add( posYAxisHelper );
|
|
@@ -101,42 +110,6 @@ class ViewHelper extends Object3D {
|
|
|
101
110
|
point.set( 0, 0, 1 );
|
|
102
111
|
point.applyQuaternion( camera.quaternion );
|
|
103
112
|
|
|
104
|
-
if ( point.x >= 0 ) {
|
|
105
|
-
|
|
106
|
-
posXAxisHelper.material.opacity = 1;
|
|
107
|
-
negXAxisHelper.material.opacity = 0.5;
|
|
108
|
-
|
|
109
|
-
} else {
|
|
110
|
-
|
|
111
|
-
posXAxisHelper.material.opacity = 0.5;
|
|
112
|
-
negXAxisHelper.material.opacity = 1;
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if ( point.y >= 0 ) {
|
|
117
|
-
|
|
118
|
-
posYAxisHelper.material.opacity = 1;
|
|
119
|
-
negYAxisHelper.material.opacity = 0.5;
|
|
120
|
-
|
|
121
|
-
} else {
|
|
122
|
-
|
|
123
|
-
posYAxisHelper.material.opacity = 0.5;
|
|
124
|
-
negYAxisHelper.material.opacity = 1;
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if ( point.z >= 0 ) {
|
|
129
|
-
|
|
130
|
-
posZAxisHelper.material.opacity = 1;
|
|
131
|
-
negZAxisHelper.material.opacity = 0.5;
|
|
132
|
-
|
|
133
|
-
} else {
|
|
134
|
-
|
|
135
|
-
posZAxisHelper.material.opacity = 0.5;
|
|
136
|
-
negZAxisHelper.material.opacity = 1;
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
|
|
140
113
|
//
|
|
141
114
|
|
|
142
115
|
const x = domElement.offsetWidth - dim;
|
|
@@ -298,7 +271,7 @@ class ViewHelper extends Object3D {
|
|
|
298
271
|
|
|
299
272
|
}
|
|
300
273
|
|
|
301
|
-
function getSpriteMaterial( color
|
|
274
|
+
function getSpriteMaterial( color ) {
|
|
302
275
|
|
|
303
276
|
const canvas = document.createElement( 'canvas' );
|
|
304
277
|
canvas.width = 64;
|
|
@@ -306,21 +279,13 @@ class ViewHelper extends Object3D {
|
|
|
306
279
|
|
|
307
280
|
const context = canvas.getContext( '2d' );
|
|
308
281
|
context.beginPath();
|
|
309
|
-
context.arc( 32, 32,
|
|
282
|
+
context.arc( 32, 32, 14, 0, 2 * Math.PI );
|
|
310
283
|
context.closePath();
|
|
311
284
|
context.fillStyle = color.getStyle();
|
|
312
285
|
context.fill();
|
|
313
286
|
|
|
314
|
-
if ( text !== null ) {
|
|
315
|
-
|
|
316
|
-
context.font = '24px Arial';
|
|
317
|
-
context.textAlign = 'center';
|
|
318
|
-
context.fillStyle = '#000000';
|
|
319
|
-
context.fillText( text, 32, 41 );
|
|
320
|
-
|
|
321
|
-
}
|
|
322
|
-
|
|
323
287
|
const texture = new CanvasTexture( canvas );
|
|
288
|
+
texture.colorSpace = SRGBColorSpace;
|
|
324
289
|
|
|
325
290
|
return new SpriteMaterial( { map: texture, toneMapped: false } );
|
|
326
291
|
|
|
@@ -17,10 +17,10 @@ Each file is provided in two variations:
|
|
|
17
17
|
* **Default:** Latest stable builds, tracking the project's [master branch](https://github.com/google/draco).
|
|
18
18
|
* **glTF:** Builds targeted by the [glTF mesh compression extension](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression), tracking the [corresponding Draco branch](https://github.com/google/draco/tree/gltf_2.0_draco_extension).
|
|
19
19
|
|
|
20
|
-
Either variation may be used with `
|
|
20
|
+
Either variation may be used with `DRACOLoader`:
|
|
21
21
|
|
|
22
22
|
```js
|
|
23
|
-
var dracoLoader = new
|
|
23
|
+
var dracoLoader = new DRACOLoader();
|
|
24
24
|
dracoLoader.setDecoderPath('path/to/decoders/');
|
|
25
25
|
dracoLoader.setDecoderConfig({type: 'js'}); // (Optional) Override detection of WASM support.
|
|
26
26
|
```
|
|
@@ -7,13 +7,13 @@ var Easing = Object.freeze({
|
|
|
7
7
|
return amount;
|
|
8
8
|
},
|
|
9
9
|
In: function (amount) {
|
|
10
|
-
return
|
|
10
|
+
return amount;
|
|
11
11
|
},
|
|
12
12
|
Out: function (amount) {
|
|
13
|
-
return
|
|
13
|
+
return amount;
|
|
14
14
|
},
|
|
15
15
|
InOut: function (amount) {
|
|
16
|
-
return
|
|
16
|
+
return amount;
|
|
17
17
|
},
|
|
18
18
|
}),
|
|
19
19
|
Quadratic: Object.freeze({
|
|
@@ -676,13 +676,11 @@ var Tween = /** @class */ (function () {
|
|
|
676
676
|
* it is still playing, just paused).
|
|
677
677
|
*/
|
|
678
678
|
Tween.prototype.update = function (time, autoStart) {
|
|
679
|
-
var _this = this;
|
|
680
679
|
var _a;
|
|
681
680
|
if (time === void 0) { time = now(); }
|
|
682
681
|
if (autoStart === void 0) { autoStart = true; }
|
|
683
682
|
if (this._isPaused)
|
|
684
683
|
return true;
|
|
685
|
-
var property;
|
|
686
684
|
var endTime = this._startTime + this._duration;
|
|
687
685
|
if (!this._goToEnd && !this._isPlaying) {
|
|
688
686
|
if (time > endTime)
|
|
@@ -709,72 +707,85 @@ var Tween = /** @class */ (function () {
|
|
|
709
707
|
var elapsedTime = time - this._startTime;
|
|
710
708
|
var durationAndDelay = this._duration + ((_a = this._repeatDelayTime) !== null && _a !== void 0 ? _a : this._delayTime);
|
|
711
709
|
var totalTime = this._duration + this._repeat * durationAndDelay;
|
|
712
|
-
var
|
|
713
|
-
if (_this._duration === 0)
|
|
714
|
-
return 1;
|
|
715
|
-
if (elapsedTime > totalTime) {
|
|
716
|
-
return 1;
|
|
717
|
-
}
|
|
718
|
-
var timesRepeated = Math.trunc(elapsedTime / durationAndDelay);
|
|
719
|
-
var timeIntoCurrentRepeat = elapsedTime - timesRepeated * durationAndDelay;
|
|
720
|
-
// TODO use %?
|
|
721
|
-
// const timeIntoCurrentRepeat = elapsedTime % durationAndDelay
|
|
722
|
-
var portion = Math.min(timeIntoCurrentRepeat / _this._duration, 1);
|
|
723
|
-
if (portion === 0 && elapsedTime === _this._duration) {
|
|
724
|
-
return 1;
|
|
725
|
-
}
|
|
726
|
-
return portion;
|
|
727
|
-
};
|
|
728
|
-
var elapsed = calculateElapsedPortion();
|
|
710
|
+
var elapsed = this._calculateElapsedPortion(elapsedTime, durationAndDelay, totalTime);
|
|
729
711
|
var value = this._easingFunction(elapsed);
|
|
730
|
-
|
|
712
|
+
var status = this._calculateCompletionStatus(elapsedTime, durationAndDelay);
|
|
713
|
+
if (status === 'repeat') {
|
|
714
|
+
// the current update is happening after the instant the tween repeated
|
|
715
|
+
this._processRepetition(elapsedTime, durationAndDelay);
|
|
716
|
+
}
|
|
731
717
|
this._updateProperties(this._object, this._valuesStart, this._valuesEnd, value);
|
|
718
|
+
if (status === 'about-to-repeat') {
|
|
719
|
+
// the current update is happening at the exact instant the tween is going to repeat
|
|
720
|
+
// the values should match the end of the tween, not the beginning,
|
|
721
|
+
// that's why _processRepetition happens after _updateProperties
|
|
722
|
+
this._processRepetition(elapsedTime, durationAndDelay);
|
|
723
|
+
}
|
|
732
724
|
if (this._onUpdateCallback) {
|
|
733
725
|
this._onUpdateCallback(this._object, elapsed);
|
|
734
726
|
}
|
|
735
|
-
if (
|
|
736
|
-
if (this.
|
|
737
|
-
|
|
738
|
-
if (isFinite(this._repeat)) {
|
|
739
|
-
this._repeat -= completeCount;
|
|
740
|
-
}
|
|
741
|
-
// Reassign starting values, restart by making startTime = now
|
|
742
|
-
for (property in this._valuesStartRepeat) {
|
|
743
|
-
if (!this._yoyo && typeof this._valuesEnd[property] === 'string') {
|
|
744
|
-
this._valuesStartRepeat[property] =
|
|
745
|
-
// eslint-disable-next-line
|
|
746
|
-
// @ts-ignore FIXME?
|
|
747
|
-
this._valuesStartRepeat[property] + parseFloat(this._valuesEnd[property]);
|
|
748
|
-
}
|
|
749
|
-
if (this._yoyo) {
|
|
750
|
-
this._swapEndStartRepeatValues(property);
|
|
751
|
-
}
|
|
752
|
-
this._valuesStart[property] = this._valuesStartRepeat[property];
|
|
753
|
-
}
|
|
754
|
-
if (this._yoyo) {
|
|
755
|
-
this._reversed = !this._reversed;
|
|
756
|
-
}
|
|
757
|
-
this._startTime += durationAndDelay * completeCount;
|
|
758
|
-
if (this._onRepeatCallback) {
|
|
759
|
-
this._onRepeatCallback(this._object);
|
|
760
|
-
}
|
|
761
|
-
this._onEveryStartCallbackFired = false;
|
|
762
|
-
return true;
|
|
727
|
+
if (status === 'repeat' || status === 'about-to-repeat') {
|
|
728
|
+
if (this._onRepeatCallback) {
|
|
729
|
+
this._onRepeatCallback(this._object);
|
|
763
730
|
}
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
731
|
+
this._onEveryStartCallbackFired = false;
|
|
732
|
+
}
|
|
733
|
+
else if (status === 'completed') {
|
|
734
|
+
this._isPlaying = false;
|
|
735
|
+
if (this._onCompleteCallback) {
|
|
736
|
+
this._onCompleteCallback(this._object);
|
|
737
|
+
}
|
|
738
|
+
for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
|
|
739
|
+
// Make the chained tweens start exactly at the time they should,
|
|
740
|
+
// even if the `update()` method was called way past the duration of the tween
|
|
741
|
+
this._chainedTweens[i].start(this._startTime + this._duration, false);
|
|
775
742
|
}
|
|
776
743
|
}
|
|
777
|
-
return
|
|
744
|
+
return status !== 'completed';
|
|
745
|
+
};
|
|
746
|
+
Tween.prototype._calculateElapsedPortion = function (elapsedTime, durationAndDelay, totalTime) {
|
|
747
|
+
if (this._duration === 0 || elapsedTime > totalTime) {
|
|
748
|
+
return 1;
|
|
749
|
+
}
|
|
750
|
+
var timeIntoCurrentRepeat = elapsedTime % durationAndDelay;
|
|
751
|
+
var portion = Math.min(timeIntoCurrentRepeat / this._duration, 1);
|
|
752
|
+
if (portion === 0 && elapsedTime !== 0 && elapsedTime % this._duration === 0) {
|
|
753
|
+
return 1;
|
|
754
|
+
}
|
|
755
|
+
return portion;
|
|
756
|
+
};
|
|
757
|
+
Tween.prototype._calculateCompletionStatus = function (elapsedTime, durationAndDelay) {
|
|
758
|
+
if (this._duration !== 0 && elapsedTime < this._duration) {
|
|
759
|
+
return 'playing';
|
|
760
|
+
}
|
|
761
|
+
if (this._repeat <= 0) {
|
|
762
|
+
return 'completed';
|
|
763
|
+
}
|
|
764
|
+
if (elapsedTime === this._duration) {
|
|
765
|
+
return 'about-to-repeat';
|
|
766
|
+
}
|
|
767
|
+
return 'repeat';
|
|
768
|
+
};
|
|
769
|
+
Tween.prototype._processRepetition = function (elapsedTime, durationAndDelay) {
|
|
770
|
+
var completeCount = Math.min(Math.trunc((elapsedTime - this._duration) / durationAndDelay) + 1, this._repeat);
|
|
771
|
+
if (isFinite(this._repeat)) {
|
|
772
|
+
this._repeat -= completeCount;
|
|
773
|
+
}
|
|
774
|
+
// Reassign starting values, restart by making startTime = now
|
|
775
|
+
for (var property in this._valuesStartRepeat) {
|
|
776
|
+
var valueEnd = this._valuesEnd[property];
|
|
777
|
+
if (!this._yoyo && typeof valueEnd === 'string') {
|
|
778
|
+
this._valuesStartRepeat[property] = this._valuesStartRepeat[property] + parseFloat(valueEnd);
|
|
779
|
+
}
|
|
780
|
+
if (this._yoyo) {
|
|
781
|
+
this._swapEndStartRepeatValues(property);
|
|
782
|
+
}
|
|
783
|
+
this._valuesStart[property] = this._valuesStartRepeat[property];
|
|
784
|
+
}
|
|
785
|
+
if (this._yoyo) {
|
|
786
|
+
this._reversed = !this._reversed;
|
|
787
|
+
}
|
|
788
|
+
this._startTime += durationAndDelay * completeCount;
|
|
778
789
|
};
|
|
779
790
|
Tween.prototype._updateProperties = function (_object, _valuesStart, _valuesEnd, value) {
|
|
780
791
|
for (var property in _valuesEnd) {
|
|
@@ -830,7 +841,7 @@ var Tween = /** @class */ (function () {
|
|
|
830
841
|
return Tween;
|
|
831
842
|
}());
|
|
832
843
|
|
|
833
|
-
var VERSION = '23.1.
|
|
844
|
+
var VERSION = '23.1.2';
|
|
834
845
|
|
|
835
846
|
/**
|
|
836
847
|
* Tween.js - Licensed under the MIT license
|
|
@@ -1,25 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* parameters = {
|
|
3
|
-
* color: <hex>,
|
|
4
|
-
* linewidth: <float>,
|
|
5
|
-
* dashed: <boolean>,
|
|
6
|
-
* dashScale: <float>,
|
|
7
|
-
* dashSize: <float>,
|
|
8
|
-
* dashOffset: <float>,
|
|
9
|
-
* gapSize: <float>,
|
|
10
|
-
* resolution: <Vector2>, // to be set by renderer
|
|
11
|
-
* }
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
1
|
import {
|
|
15
2
|
ShaderLib,
|
|
16
3
|
ShaderMaterial,
|
|
17
4
|
UniformsLib,
|
|
18
5
|
UniformsUtils,
|
|
19
|
-
Vector2
|
|
6
|
+
Vector2,
|
|
20
7
|
} from 'three';
|
|
21
8
|
|
|
22
|
-
|
|
23
9
|
UniformsLib.line = {
|
|
24
10
|
|
|
25
11
|
worldUnits: { value: 1 },
|
|
@@ -13,6 +13,8 @@ import {
|
|
|
13
13
|
import { LineSegmentsGeometry } from '../lines/LineSegmentsGeometry.js';
|
|
14
14
|
import { LineMaterial } from '../lines/LineMaterial.js';
|
|
15
15
|
|
|
16
|
+
const _viewport = new Vector4();
|
|
17
|
+
|
|
16
18
|
const _start = new Vector3();
|
|
17
19
|
const _end = new Vector3();
|
|
18
20
|
|
|
@@ -356,6 +358,19 @@ class LineSegments2 extends Mesh {
|
|
|
356
358
|
|
|
357
359
|
}
|
|
358
360
|
|
|
361
|
+
onBeforeRender( renderer ) {
|
|
362
|
+
|
|
363
|
+
const uniforms = this.material.uniforms;
|
|
364
|
+
|
|
365
|
+
if ( uniforms && uniforms.resolution ) {
|
|
366
|
+
|
|
367
|
+
renderer.getViewport( _viewport );
|
|
368
|
+
this.material.uniforms.resolution.value.set( _viewport.z, _viewport.w );
|
|
369
|
+
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
}
|
|
373
|
+
|
|
359
374
|
}
|
|
360
375
|
|
|
361
376
|
export { LineSegments2 };
|
|
@@ -2,13 +2,15 @@ import {
|
|
|
2
2
|
InstancedInterleavedBuffer,
|
|
3
3
|
InterleavedBufferAttribute,
|
|
4
4
|
Mesh,
|
|
5
|
-
Vector3
|
|
5
|
+
Vector3,
|
|
6
|
+
Vector4
|
|
6
7
|
} from 'three';
|
|
7
8
|
import { LineSegmentsGeometry } from '../lines/LineSegmentsGeometry.js';
|
|
8
9
|
import { LineMaterial } from '../lines/LineMaterial.js';
|
|
9
10
|
|
|
10
11
|
const _start = new Vector3();
|
|
11
12
|
const _end = new Vector3();
|
|
13
|
+
const _viewport = new Vector4();
|
|
12
14
|
|
|
13
15
|
class Wireframe extends Mesh {
|
|
14
16
|
|
|
@@ -51,6 +53,19 @@ class Wireframe extends Mesh {
|
|
|
51
53
|
|
|
52
54
|
}
|
|
53
55
|
|
|
56
|
+
onBeforeRender( renderer ) {
|
|
57
|
+
|
|
58
|
+
const uniforms = this.material.uniforms;
|
|
59
|
+
|
|
60
|
+
if ( uniforms && uniforms.resolution ) {
|
|
61
|
+
|
|
62
|
+
renderer.getViewport( _viewport );
|
|
63
|
+
this.material.uniforms.resolution.value.set( _viewport.z, _viewport.w );
|
|
64
|
+
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
54
69
|
}
|
|
55
70
|
|
|
56
71
|
export { Wireframe };
|
|
@@ -85,7 +85,7 @@ class DRACOLoader extends Loader {
|
|
|
85
85
|
|
|
86
86
|
parse( buffer, onLoad, onError = ()=>{} ) {
|
|
87
87
|
|
|
88
|
-
this.decodeDracoFile( buffer, onLoad, null, null, SRGBColorSpace ).catch( onError );
|
|
88
|
+
this.decodeDracoFile( buffer, onLoad, null, null, SRGBColorSpace, onError ).catch( onError );
|
|
89
89
|
|
|
90
90
|
}
|
|
91
91
|
|