super-three 0.135.0 → 0.136.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 +527 -332
- package/build/three.min.js +1 -1
- package/build/three.module.js +752 -370
- package/examples/fonts/tabler-icons/fonts/tabler-icons.svg +3966 -0
- package/examples/js/animation/CCDIKSolver.js +0 -1
- package/examples/js/animation/MMDPhysics.js +1 -3
- package/examples/js/controls/ArcballControls.js +38 -52
- package/examples/js/controls/TransformControls.js +24 -1
- package/examples/js/curves/CurveExtras.js +0 -2
- package/examples/js/effects/AsciiEffect.js +2 -9
- package/examples/js/exporters/GLTFExporter.js +1 -1
- package/examples/js/geometries/TeapotGeometry.js +0 -1
- package/examples/js/interactive/SelectionBox.js +2 -0
- package/examples/js/interactive/SelectionHelper.js +22 -7
- package/examples/js/lights/RectAreaLightUniformsLib.js +4 -0
- package/examples/js/loaders/AMFLoader.js +0 -2
- package/examples/js/loaders/ColladaLoader.js +1 -2
- package/examples/js/loaders/EXRLoader.js +185 -262
- package/examples/js/loaders/FBXLoader.js +3 -4
- package/examples/js/loaders/GLTFLoader.js +2 -2
- package/examples/js/loaders/HDRCubeTextureLoader.js +0 -8
- package/examples/js/loaders/KTX2Loader.js +11 -2
- package/examples/js/loaders/KTXLoader.js +1 -1
- package/examples/js/loaders/LDrawLoader.js +26 -30
- package/examples/js/loaders/LUT3dlLoader.js +2 -0
- package/examples/js/loaders/LUTCubeLoader.js +2 -0
- package/examples/js/loaders/MMDLoader.js +0 -1
- package/examples/js/loaders/NRRDLoader.js +9 -2
- package/examples/js/loaders/OBJLoader.js +0 -2
- package/examples/js/loaders/PLYLoader.js +1 -1
- package/examples/js/loaders/RGBELoader.js +0 -15
- package/examples/js/loaders/RGBMLoader.js +55 -5
- package/examples/js/loaders/SVGLoader.js +2 -2
- package/examples/js/loaders/VOXLoader.js +1 -0
- package/examples/js/loaders/VRMLLoader.js +2 -1
- package/examples/js/math/ImprovedNoise.js +1 -1
- package/examples/js/misc/GPUComputationRenderer.js +3 -1
- package/examples/js/objects/Lensflare.js +2 -10
- package/examples/js/objects/Reflector.js +7 -0
- package/examples/js/objects/Refractor.js +7 -0
- package/examples/js/objects/Sky.js +1 -1
- package/examples/js/objects/Water.js +2 -2
- package/examples/js/objects/Water2.js +4 -7
- package/examples/js/postprocessing/GlitchPass.js +3 -1
- package/examples/js/postprocessing/SSAOPass.js +1 -0
- package/examples/js/shaders/ConvolutionShader.js +0 -1
- package/examples/js/shaders/FXAAShader.js +1 -1
- package/examples/js/shaders/FilmShader.js +1 -1
- package/examples/js/shaders/GammaCorrectionShader.js +1 -1
- package/examples/js/shaders/HorizontalBlurShader.js +1 -2
- package/examples/js/shaders/SSRShader.js +1 -1
- package/examples/js/shaders/SSRrShader.js +1 -1
- package/examples/js/shaders/VerticalBlurShader.js +1 -2
- package/examples/js/utils/GeometryUtils.js +1 -1
- package/examples/js/utils/RoughnessMipmapper.js +18 -29
- package/examples/jsm/animation/CCDIKSolver.js +0 -1
- package/examples/jsm/animation/MMDPhysics.js +0 -2
- package/examples/jsm/controls/ArcballControls.js +27 -56
- package/examples/jsm/controls/TransformControls.js +24 -1
- package/examples/jsm/curves/CurveExtras.js +0 -2
- package/examples/jsm/effects/AsciiEffect.js +2 -9
- package/examples/jsm/exporters/GLTFExporter.js +1 -1
- package/examples/jsm/geometries/TeapotGeometry.js +0 -1
- package/examples/jsm/interactive/SelectionBox.js +1 -0
- package/examples/jsm/interactive/SelectionHelper.js +19 -7
- package/examples/jsm/libs/flow.module.js +256 -136
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +7 -0
- package/examples/jsm/loaders/AMFLoader.js +0 -2
- package/examples/jsm/loaders/ColladaLoader.js +1 -2
- package/examples/jsm/loaders/EXRLoader.js +184 -293
- package/examples/jsm/loaders/FBXLoader.js +3 -4
- package/examples/jsm/loaders/GLTFLoader.js +2 -2
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +1 -14
- package/examples/jsm/loaders/KTX2Loader.js +13 -4
- package/examples/jsm/loaders/KTXLoader.js +1 -1
- package/examples/jsm/loaders/LDrawLoader.js +23 -24
- package/examples/jsm/loaders/LUT3dlLoader.js +2 -0
- package/examples/jsm/loaders/LUTCubeLoader.js +2 -0
- package/examples/jsm/loaders/MMDLoader.js +0 -1
- package/examples/jsm/loaders/NRRDLoader.js +10 -2
- package/examples/jsm/loaders/OBJLoader.js +0 -2
- package/examples/jsm/loaders/PLYLoader.js +1 -1
- package/examples/jsm/loaders/RGBELoader.js +0 -20
- package/examples/jsm/loaders/RGBMLoader.js +61 -7
- package/examples/jsm/loaders/SVGLoader.js +2 -2
- package/examples/jsm/loaders/TDSLoader.js +30 -9
- package/examples/jsm/loaders/VOXLoader.js +1 -0
- package/examples/jsm/loaders/VRMLLoader.js +2 -1
- package/examples/jsm/math/ImprovedNoise.js +1 -1
- package/examples/jsm/misc/GPUComputationRenderer.js +3 -1
- package/examples/jsm/node-editor/NodeEditor.js +23 -22
- package/examples/jsm/node-editor/examples/rim.json +1 -1
- package/examples/jsm/node-editor/materials/StandardMaterialEditor.js +48 -9
- package/examples/jsm/node-editor/utils/OscillatorEditor.js +1 -1
- package/examples/jsm/nodes/core/NodeBuilder.js +2 -2
- package/examples/jsm/nodes/materials/nodes/StandardNode.js +1 -0
- package/examples/jsm/nodes/math/MathNode.js +12 -0
- package/examples/jsm/nodes/misc/BumpMapNode.js +1 -1
- package/examples/jsm/nodes/misc/TextureCubeUVNode.js +1 -4
- package/examples/jsm/nodes/utils/ColorSpaceNode.js +1 -116
- package/examples/jsm/objects/Lensflare.js +3 -14
- package/examples/jsm/objects/Reflector.js +7 -0
- package/examples/jsm/objects/Refractor.js +7 -0
- package/examples/jsm/objects/Sky.js +1 -1
- package/examples/jsm/objects/Water.js +2 -2
- package/examples/jsm/objects/Water2.js +4 -8
- package/examples/jsm/postprocessing/GlitchPass.js +3 -1
- package/examples/jsm/postprocessing/SAOPass.js +1 -1
- package/examples/jsm/postprocessing/SSAOPass.js +1 -0
- package/examples/jsm/renderers/nodes/Nodes.js +1 -0
- package/examples/jsm/renderers/nodes/ShaderNode.js +7 -6
- package/examples/jsm/renderers/nodes/core/InputNode.js +1 -1
- package/examples/jsm/renderers/nodes/core/NodeBuilder.js +1 -1
- package/examples/jsm/renderers/nodes/display/ColorSpaceNode.js +26 -31
- package/examples/jsm/renderers/nodes/functions/BSDFs.js +2 -2
- package/examples/jsm/renderers/nodes/functions/PhysicalMaterialFunctions.js +27 -0
- package/examples/jsm/renderers/nodes/inputs/TextureNode.js +1 -1
- package/examples/jsm/renderers/nodes/math/MathNode.js +5 -3
- package/examples/jsm/renderers/nodes/math/OperatorNode.js +2 -2
- package/examples/jsm/renderers/nodes/utils/TimerNode.js +1 -1
- package/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js +14 -14
- package/examples/jsm/renderers/webgpu/WebGPUBindings.js +7 -6
- package/examples/jsm/renderers/webgpu/WebGPURenderPipeline.js +1 -1
- package/examples/jsm/renderers/webgpu/WebGPURenderPipelines.js +42 -61
- package/examples/jsm/renderers/webgpu/WebGPURenderer.js +2 -2
- package/examples/jsm/renderers/webgpu/WebGPUTextureUtils.js +0 -1
- package/examples/jsm/renderers/webgpu/nodes/WebGPUNodeBuilder.js +30 -4
- package/examples/jsm/shaders/ConvolutionShader.js +0 -1
- package/examples/jsm/shaders/FXAAShader.js +1 -1
- package/examples/jsm/shaders/FilmShader.js +1 -1
- package/examples/jsm/shaders/GammaCorrectionShader.js +1 -1
- package/examples/jsm/shaders/HorizontalBlurShader.js +1 -2
- package/examples/jsm/shaders/SSRShader.js +1 -1
- package/examples/jsm/shaders/SSRrShader.js +1 -1
- package/examples/jsm/shaders/VerticalBlurShader.js +1 -2
- package/examples/jsm/utils/GeometryUtils.js +1 -1
- package/examples/jsm/utils/RoughnessMipmapper.js +19 -32
- package/examples/jsm/utils/WorkerPool.js +11 -11
- package/package.json +15 -9
- package/src/Three.Legacy.js +12 -0
- package/src/Three.js +1 -2
- package/src/constants.js +1 -7
- package/src/core/Object3D.js +1 -1
- package/src/extras/PMREMGenerator.js +19 -110
- package/src/extras/core/Interpolations.js +1 -1
- package/src/geometries/LatheGeometry.js +70 -47
- package/src/helpers/CameraHelper.js +1 -1
- package/src/loaders/FileLoader.js +23 -6
- package/src/math/Color.js +0 -38
- package/src/math/Ray.js +2 -2
- package/src/math/Sphere.js +10 -1
- package/src/objects/Skeleton.js +1 -0
- package/src/renderers/WebGLRenderer.js +23 -16
- package/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +2 -24
- package/src/renderers/shaders/ShaderChunk/encodings_pars_fragment.glsl.js +0 -47
- package/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +27 -1
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +10 -0
- package/src/renderers/webgl/WebGLCapabilities.js +0 -2
- package/src/renderers/webgl/WebGLMorphtargets.js +1 -0
- package/src/renderers/webgl/WebGLProgram.js +2 -19
- package/src/renderers/webgl/WebGLPrograms.js +191 -35
- package/src/renderers/webgl/WebGLRenderLists.js +4 -14
- package/src/renderers/webgl/WebGLShaderCache.js +120 -0
- package/src/renderers/webgl/WebGLState.js +45 -0
- package/src/renderers/webgl/WebGLTextures.js +195 -26
- package/src/renderers/webxr/WebXRManager.js +10 -3
- package/src/scenes/Scene.js +1 -1
- package/src/textures/DataTexture.js +0 -2
- package/src/textures/DataTexture2DArray.js +0 -2
- package/src/textures/DataTexture3D.js +0 -2
- package/src/textures/FramebufferTexture.js +25 -0
- package/src/utils.js +1 -37
|
@@ -55,34 +55,23 @@
|
|
|
55
55
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
material.roughnessMap.offset.copy( roughnessMap.offset );
|
|
77
|
-
material.roughnessMap.repeat.copy( roughnessMap.repeat );
|
|
78
|
-
material.roughnessMap.center.copy( roughnessMap.center );
|
|
79
|
-
material.roughnessMap.rotation = roughnessMap.rotation;
|
|
80
|
-
material.roughnessMap.image = roughnessMap.image;
|
|
81
|
-
material.roughnessMap.matrixAutoUpdate = roughnessMap.matrixAutoUpdate;
|
|
82
|
-
material.roughnessMap.matrix.copy( roughnessMap.matrix );
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
|
|
58
|
+
const newRoughnessTexture = new THREE.FramebufferTexture( width, height, roughnessMap.format );
|
|
59
|
+
newRoughnessTexture.wrapS = roughnessMap.wrapS;
|
|
60
|
+
newRoughnessTexture.wrapT = roughnessMap.wrapT;
|
|
61
|
+
newRoughnessTexture.minFilter = roughnessMap.minFilter;
|
|
62
|
+
newRoughnessTexture.magFilter = roughnessMap.magFilter;
|
|
63
|
+
material.roughnessMap = newRoughnessTexture;
|
|
64
|
+
if ( material.metalnessMap == roughnessMap ) material.metalnessMap = material.roughnessMap;
|
|
65
|
+
if ( material.aoMap == roughnessMap ) material.aoMap = material.roughnessMap; // Copy UV transform parameters
|
|
66
|
+
|
|
67
|
+
material.roughnessMap.offset.copy( roughnessMap.offset );
|
|
68
|
+
material.roughnessMap.repeat.copy( roughnessMap.repeat );
|
|
69
|
+
material.roughnessMap.center.copy( roughnessMap.center );
|
|
70
|
+
material.roughnessMap.rotation = roughnessMap.rotation;
|
|
71
|
+
material.roughnessMap.image = roughnessMap.image; // required for USDZExporter, see #22741
|
|
72
|
+
|
|
73
|
+
material.roughnessMap.matrixAutoUpdate = roughnessMap.matrixAutoUpdate;
|
|
74
|
+
material.roughnessMap.matrix.copy( roughnessMap.matrix );
|
|
86
75
|
_mipmapMaterial.uniforms.roughnessMap.value = roughnessMap;
|
|
87
76
|
_mipmapMaterial.uniforms.normalMap.value = normalMap;
|
|
88
77
|
const position = new THREE.Vector2( 0, 0 );
|
|
@@ -110,7 +99,7 @@
|
|
|
110
99
|
|
|
111
100
|
}
|
|
112
101
|
|
|
113
|
-
|
|
102
|
+
roughnessMap.dispose();
|
|
114
103
|
|
|
115
104
|
_renderer.setRenderTarget( oldTarget );
|
|
116
105
|
|
|
@@ -149,7 +149,6 @@ class CCDIKSolver {
|
|
|
149
149
|
angle = math.acos( angle );
|
|
150
150
|
|
|
151
151
|
// skip if changing angle is too small to prevent vibration of bone
|
|
152
|
-
// Refer to http://www20.atpages.jp/katwat/three.js_r58/examples/mytest37/mmd.three.js
|
|
153
152
|
if ( angle < 1e-5 ) continue;
|
|
154
153
|
|
|
155
154
|
if ( ik.minAngle !== undefined && angle < ik.minAngle ) {
|
|
@@ -1203,7 +1203,6 @@ class Constraint {
|
|
|
1203
1203
|
|
|
1204
1204
|
for ( let i = 0; i < 6; i ++ ) {
|
|
1205
1205
|
|
|
1206
|
-
// this parameter is from http://www20.atpages.jp/katwat/three.js_r58/examples/mytest37/mmd.three.js
|
|
1207
1206
|
constraint.setParam( 2, 0.475, i );
|
|
1208
1207
|
|
|
1209
1208
|
}
|
|
@@ -1368,7 +1367,6 @@ class MMDPhysicsHelper extends Object3D {
|
|
|
1368
1367
|
|
|
1369
1368
|
}
|
|
1370
1369
|
|
|
1371
|
-
// copy from http://www20.atpages.jp/katwat/three.js_r58/examples/mytest37/mytest37.js?ver=20160815
|
|
1372
1370
|
function createCapsuleGeometry( radius, cylinderHeight, segmentsRadius, segmentsHeight ) {
|
|
1373
1371
|
|
|
1374
1372
|
var geometry = new CylinderGeometry( radius, radius, cylinderHeight, segmentsRadius, segmentsHeight, true );
|
|
@@ -67,7 +67,9 @@ const _endEvent = { type: 'end' };
|
|
|
67
67
|
const _raycaster = new Raycaster();
|
|
68
68
|
const _offset = new Vector3();
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
const _gizmoMatrixStateTemp = new Matrix4();
|
|
71
|
+
const _cameraMatrixStateTemp = new Matrix4();
|
|
72
|
+
const _scalePointTemp = new Vector3();
|
|
71
73
|
/**
|
|
72
74
|
*
|
|
73
75
|
* @param {Camera} camera Virtual camera used in the scene
|
|
@@ -82,7 +84,8 @@ class ArcballControls extends EventDispatcher {
|
|
|
82
84
|
this.camera = null;
|
|
83
85
|
this.domElement = domElement;
|
|
84
86
|
this.scene = scene;
|
|
85
|
-
this.target = new Vector3(
|
|
87
|
+
this.target = new Vector3();
|
|
88
|
+
this._currentTarget = new Vector3();
|
|
86
89
|
this.radiusFactor = 0.67;
|
|
87
90
|
|
|
88
91
|
this.mouseActions = [];
|
|
@@ -232,7 +235,6 @@ class ArcballControls extends EventDispatcher {
|
|
|
232
235
|
this.domElement.addEventListener( 'pointerdown', this.onPointerDown );
|
|
233
236
|
this.domElement.addEventListener( 'pointercancel', this.onPointerCancel );
|
|
234
237
|
|
|
235
|
-
window.addEventListener( 'keydown', this.onKeyDown );
|
|
236
238
|
window.addEventListener( 'resize', this.onWindowResize );
|
|
237
239
|
|
|
238
240
|
}
|
|
@@ -774,28 +776,6 @@ class ArcballControls extends EventDispatcher {
|
|
|
774
776
|
|
|
775
777
|
};
|
|
776
778
|
|
|
777
|
-
onKeyDown = ( event ) => {
|
|
778
|
-
|
|
779
|
-
if ( event.key == 'c' ) {
|
|
780
|
-
|
|
781
|
-
if ( event.ctrlKey || event.metaKey ) {
|
|
782
|
-
|
|
783
|
-
this.copyState();
|
|
784
|
-
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
} else if ( event.key == 'v' ) {
|
|
788
|
-
|
|
789
|
-
if ( event.ctrlKey || event.metaKey ) {
|
|
790
|
-
|
|
791
|
-
this.pasteState();
|
|
792
|
-
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
};
|
|
798
|
-
|
|
799
779
|
onSinglePanStart = ( event, operation ) => {
|
|
800
780
|
|
|
801
781
|
if ( this.enabled ) {
|
|
@@ -2006,11 +1986,11 @@ class ArcballControls extends EventDispatcher {
|
|
|
2006
1986
|
_offset.copy( point ).sub( this._gizmos.position ).multiplyScalar( amount );
|
|
2007
1987
|
this._translationMatrix.makeTranslation( _offset.x, _offset.y, _offset.z );
|
|
2008
1988
|
|
|
2009
|
-
|
|
1989
|
+
_gizmoMatrixStateTemp.copy( this._gizmoMatrixState );
|
|
2010
1990
|
this._gizmoMatrixState.premultiply( this._translationMatrix );
|
|
2011
1991
|
this._gizmoMatrixState.decompose( this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale );
|
|
2012
1992
|
|
|
2013
|
-
|
|
1993
|
+
_cameraMatrixStateTemp.copy( this._cameraMatrixState );
|
|
2014
1994
|
this._cameraMatrixState.premultiply( this._translationMatrix );
|
|
2015
1995
|
this._cameraMatrixState.decompose( this.camera.position, this.camera.quaternion, this.camera.scale );
|
|
2016
1996
|
|
|
@@ -2021,8 +2001,8 @@ class ArcballControls extends EventDispatcher {
|
|
|
2021
2001
|
|
|
2022
2002
|
}
|
|
2023
2003
|
|
|
2024
|
-
this._gizmoMatrixState.copy(
|
|
2025
|
-
this._cameraMatrixState.copy(
|
|
2004
|
+
this._gizmoMatrixState.copy( _gizmoMatrixStateTemp );
|
|
2005
|
+
this._cameraMatrixState.copy( _cameraMatrixStateTemp );
|
|
2026
2006
|
|
|
2027
2007
|
};
|
|
2028
2008
|
|
|
@@ -2098,7 +2078,6 @@ class ArcballControls extends EventDispatcher {
|
|
|
2098
2078
|
window.removeEventListener( 'pointerup', this.onPointerUp );
|
|
2099
2079
|
|
|
2100
2080
|
window.removeEventListener( 'resize', this.onWindowResize );
|
|
2101
|
-
window.removeEventListener( 'keydown', this.onKeyDown );
|
|
2102
2081
|
|
|
2103
2082
|
if ( this.scene !== null ) this.scene.remove( this._gizmos );
|
|
2104
2083
|
this.disposeGrid();
|
|
@@ -2623,7 +2602,7 @@ class ArcballControls extends EventDispatcher {
|
|
|
2623
2602
|
*/
|
|
2624
2603
|
scale = ( size, point, scaleGizmos = true ) => {
|
|
2625
2604
|
|
|
2626
|
-
|
|
2605
|
+
_scalePointTemp.copy( point );
|
|
2627
2606
|
let sizeInverse = 1 / size;
|
|
2628
2607
|
|
|
2629
2608
|
if ( this.camera.isOrthographicCamera ) {
|
|
@@ -2658,12 +2637,12 @@ class ArcballControls extends EventDispatcher {
|
|
|
2658
2637
|
|
|
2659
2638
|
|
|
2660
2639
|
//move camera and gizmos to obtain pinch effect
|
|
2661
|
-
|
|
2640
|
+
_scalePointTemp.sub( this._v3_1 );
|
|
2662
2641
|
|
|
2663
|
-
const amount =
|
|
2664
|
-
|
|
2642
|
+
const amount = _scalePointTemp.clone().multiplyScalar( sizeInverse );
|
|
2643
|
+
_scalePointTemp.sub( amount );
|
|
2665
2644
|
|
|
2666
|
-
this._m4_1.makeTranslation(
|
|
2645
|
+
this._m4_1.makeTranslation( _scalePointTemp.x, _scalePointTemp.y, _scalePointTemp.z );
|
|
2667
2646
|
this._m4_2.premultiply( this._m4_1 );
|
|
2668
2647
|
|
|
2669
2648
|
this.setTransformationMatrices( this._m4_1, this._m4_2 );
|
|
@@ -2675,7 +2654,7 @@ class ArcballControls extends EventDispatcher {
|
|
|
2675
2654
|
this._v3_2.setFromMatrixPosition( this._gizmoMatrixState );
|
|
2676
2655
|
|
|
2677
2656
|
//move camera
|
|
2678
|
-
let distance = this._v3_1.distanceTo(
|
|
2657
|
+
let distance = this._v3_1.distanceTo( _scalePointTemp );
|
|
2679
2658
|
let amount = distance - ( distance * sizeInverse );
|
|
2680
2659
|
|
|
2681
2660
|
//check min and max distance
|
|
@@ -2692,7 +2671,7 @@ class ArcballControls extends EventDispatcher {
|
|
|
2692
2671
|
|
|
2693
2672
|
}
|
|
2694
2673
|
|
|
2695
|
-
_offset.copy(
|
|
2674
|
+
_offset.copy( _scalePointTemp ).sub( this._v3_1 ).normalize().multiplyScalar( amount );
|
|
2696
2675
|
|
|
2697
2676
|
this._m4_1.makeTranslation( _offset.x, _offset.y, _offset.z );
|
|
2698
2677
|
|
|
@@ -2702,9 +2681,9 @@ class ArcballControls extends EventDispatcher {
|
|
|
2702
2681
|
//scale gizmos so they appear in the same spot having the same dimension
|
|
2703
2682
|
const pos = this._v3_2;
|
|
2704
2683
|
|
|
2705
|
-
distance = pos.distanceTo(
|
|
2684
|
+
distance = pos.distanceTo( _scalePointTemp );
|
|
2706
2685
|
amount = distance - ( distance * sizeInverse );
|
|
2707
|
-
_offset.copy(
|
|
2686
|
+
_offset.copy( _scalePointTemp ).sub( this._v3_2 ).normalize().multiplyScalar( amount );
|
|
2708
2687
|
|
|
2709
2688
|
this._translationMatrix.makeTranslation( pos.x, pos.y, pos.z );
|
|
2710
2689
|
this._scaleMatrix.makeScale( sizeInverse, sizeInverse, sizeInverse );
|
|
@@ -2745,23 +2724,6 @@ class ArcballControls extends EventDispatcher {
|
|
|
2745
2724
|
|
|
2746
2725
|
};
|
|
2747
2726
|
|
|
2748
|
-
/**
|
|
2749
|
-
* Set the trackball's center point
|
|
2750
|
-
* @param {Number} x X coordinate
|
|
2751
|
-
* @param {Number} y Y coordinate
|
|
2752
|
-
* @param {Number} z Z coordinate
|
|
2753
|
-
*/
|
|
2754
|
-
setTarget = ( x, y, z ) => {
|
|
2755
|
-
|
|
2756
|
-
this.target.set( x, y, z );
|
|
2757
|
-
this._gizmos.position.set( x, y, z ); //for correct radius calculation
|
|
2758
|
-
this._tbRadius = this.calculateTbRadius( this.camera );
|
|
2759
|
-
|
|
2760
|
-
this.makeGizmos( this.target, this._tbRadius );
|
|
2761
|
-
this.camera.lookAt( this.target );
|
|
2762
|
-
|
|
2763
|
-
};
|
|
2764
|
-
|
|
2765
2727
|
/**
|
|
2766
2728
|
* Set values in transformation object
|
|
2767
2729
|
* @param {Matrix4} camera Transformation to be applied to the camera
|
|
@@ -3123,6 +3085,15 @@ class ArcballControls extends EventDispatcher {
|
|
|
3123
3085
|
|
|
3124
3086
|
const EPS = 0.000001;
|
|
3125
3087
|
|
|
3088
|
+
if ( this.target.equals( this._currentTarget ) === false ) {
|
|
3089
|
+
|
|
3090
|
+
this._gizmos.position.copy( this.target ); //for correct radius calculation
|
|
3091
|
+
this._tbRadius = this.calculateTbRadius( this.camera );
|
|
3092
|
+
this.makeGizmos( this.target, this._tbRadius );
|
|
3093
|
+
this._currentTarget.copy( this.target );
|
|
3094
|
+
|
|
3095
|
+
}
|
|
3096
|
+
|
|
3126
3097
|
//check min/max parameters
|
|
3127
3098
|
if ( this.camera.isOrthographicCamera ) {
|
|
3128
3099
|
|
|
@@ -564,6 +564,25 @@ class TransformControls extends Object3D {
|
|
|
564
564
|
|
|
565
565
|
}
|
|
566
566
|
|
|
567
|
+
reset() {
|
|
568
|
+
|
|
569
|
+
if ( ! this.enabled ) return;
|
|
570
|
+
|
|
571
|
+
if ( this.dragging ) {
|
|
572
|
+
|
|
573
|
+
this.object.position.copy( this._positionStart );
|
|
574
|
+
this.object.quaternion.copy( this._quaternionStart );
|
|
575
|
+
this.object.scale.copy( this._scaleStart );
|
|
576
|
+
|
|
577
|
+
this.dispatchEvent( _changeEvent );
|
|
578
|
+
this.dispatchEvent( _objectChangeEvent );
|
|
579
|
+
|
|
580
|
+
this.pointStart.copy( this.pointEnd );
|
|
581
|
+
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
}
|
|
585
|
+
|
|
567
586
|
getRaycaster() {
|
|
568
587
|
|
|
569
588
|
return _raycaster;
|
|
@@ -669,7 +688,11 @@ function onPointerDown( event ) {
|
|
|
669
688
|
|
|
670
689
|
if ( ! this.enabled ) return;
|
|
671
690
|
|
|
672
|
-
|
|
691
|
+
if ( ! document.pointerLockElement ) {
|
|
692
|
+
|
|
693
|
+
this.domElement.setPointerCapture( event.pointerId );
|
|
694
|
+
|
|
695
|
+
}
|
|
673
696
|
|
|
674
697
|
this.domElement.addEventListener( 'pointermove', this._onPointerMove );
|
|
675
698
|
|
|
@@ -8,9 +8,7 @@ import {
|
|
|
8
8
|
*
|
|
9
9
|
* Formulas collected from various sources
|
|
10
10
|
* http://mathworld.wolfram.com/HeartCurve.html
|
|
11
|
-
* http://mathdl.maa.org/images/upload_library/23/stemkoski/knots/page6.html
|
|
12
11
|
* http://en.wikipedia.org/wiki/Viviani%27s_curve
|
|
13
|
-
* http://mathdl.maa.org/images/upload_library/23/stemkoski/knots/page4.html
|
|
14
12
|
* http://www.mi.sanu.ac.rs/vismath/taylorapril2011/Taylor.pdf
|
|
15
13
|
* https://prideout.net/blog/old/blog/index.html@p=44.html
|
|
16
14
|
*/
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Ascii generation is based on
|
|
3
|
-
* Maybe more about this later with a blog post at http://lab4games.net/zz85/blog
|
|
2
|
+
* Ascii generation is based on https://github.com/hassadee/jsascii/blob/master/jsascii.js
|
|
4
3
|
*
|
|
5
4
|
* 16 April 2012 - @blurspline
|
|
6
5
|
*/
|
|
@@ -57,13 +56,7 @@ class AsciiEffect {
|
|
|
57
56
|
this.domElement = domElement;
|
|
58
57
|
|
|
59
58
|
|
|
60
|
-
// Throw in ascii library from
|
|
61
|
-
|
|
62
|
-
/*
|
|
63
|
-
* jsAscii 0.1
|
|
64
|
-
* Copyright (c) 2008 Jacob Seidelin, jseidelin@nihilogic.dk, http://blog.nihilogic.dk/
|
|
65
|
-
* MIT License [http://www.nihilogic.dk/licenses/mit-license.txt]
|
|
66
|
-
*/
|
|
59
|
+
// Throw in ascii library from https://github.com/hassadee/jsascii/blob/master/jsascii.js (MIT License)
|
|
67
60
|
|
|
68
61
|
function initAsciiSize() {
|
|
69
62
|
|
|
@@ -2199,7 +2199,7 @@ class GLTFMaterialsUnlitExtension {
|
|
|
2199
2199
|
/**
|
|
2200
2200
|
* Specular-Glossiness Extension
|
|
2201
2201
|
*
|
|
2202
|
-
* Specification: https://github.com/KhronosGroup/glTF/tree/
|
|
2202
|
+
* Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Archived/KHR_materials_pbrSpecularGlossiness
|
|
2203
2203
|
*/
|
|
2204
2204
|
class GLTFMaterialsPBRSpecularGlossiness {
|
|
2205
2205
|
|
|
@@ -48,7 +48,6 @@ import {
|
|
|
48
48
|
*
|
|
49
49
|
* Code converted from my ancient SPD software, http://tog.acm.org/resources/SPD/
|
|
50
50
|
* Created for the Udacity course "Interactive Rendering", http://bit.ly/ericity
|
|
51
|
-
* Lesson: https://www.udacity.com/course/viewer#!/c-cs291/l-68866048/m-106482448
|
|
52
51
|
* YouTube video on teapot history: https://www.youtube.com/watch?v=DxMfblPzFNc
|
|
53
52
|
*
|
|
54
53
|
* See https://en.wikipedia.org/wiki/Utah_teapot for the history of the teapot
|
|
@@ -18,14 +18,14 @@ class SelectionHelper {
|
|
|
18
18
|
|
|
19
19
|
this.isDown = false;
|
|
20
20
|
|
|
21
|
-
this.
|
|
21
|
+
this.onPointerDown = function ( event ) {
|
|
22
22
|
|
|
23
23
|
this.isDown = true;
|
|
24
24
|
this.onSelectStart( event );
|
|
25
25
|
|
|
26
|
-
}.bind( this )
|
|
26
|
+
}.bind( this );
|
|
27
27
|
|
|
28
|
-
this.
|
|
28
|
+
this.onPointerMove = function ( event ) {
|
|
29
29
|
|
|
30
30
|
if ( this.isDown ) {
|
|
31
31
|
|
|
@@ -33,14 +33,26 @@ class SelectionHelper {
|
|
|
33
33
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
}.bind( this )
|
|
36
|
+
}.bind( this );
|
|
37
37
|
|
|
38
|
-
this.
|
|
38
|
+
this.onPointerUp = function ( ) {
|
|
39
39
|
|
|
40
40
|
this.isDown = false;
|
|
41
|
-
this.onSelectOver(
|
|
41
|
+
this.onSelectOver();
|
|
42
42
|
|
|
43
|
-
}.bind( this )
|
|
43
|
+
}.bind( this );
|
|
44
|
+
|
|
45
|
+
this.renderer.domElement.addEventListener( 'pointerdown', this.onPointerDown );
|
|
46
|
+
this.renderer.domElement.addEventListener( 'pointermove', this.onPointerMove );
|
|
47
|
+
this.renderer.domElement.addEventListener( 'pointerup', this.onPointerUp );
|
|
48
|
+
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
dispose() {
|
|
52
|
+
|
|
53
|
+
this.renderer.domElement.removeEventListener( 'pointerdown', this.onPointerDown );
|
|
54
|
+
this.renderer.domElement.removeEventListener( 'pointermove', this.onPointerMove );
|
|
55
|
+
this.renderer.domElement.removeEventListener( 'pointerup', this.onPointerUp );
|
|
44
56
|
|
|
45
57
|
}
|
|
46
58
|
|