super-three 0.133.2 → 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 +619 -538
- package/build/three.min.js +1 -1
- package/build/three.module.js +763 -616
- 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 +71 -110
- 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
|
@@ -4,18 +4,19 @@
|
|
|
4
4
|
* Port of http://webglsamples.org/blob/blob.html
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
class MarchingCubes extends THREE.
|
|
7
|
+
class MarchingCubes extends THREE.Mesh {
|
|
8
8
|
|
|
9
|
-
constructor( resolution, material, enableUvs, enableColors ) {
|
|
9
|
+
constructor( resolution, material, enableUvs = false, enableColors = false, maxPolyCount = 10000 ) {
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
const geometry = new THREE.BufferGeometry();
|
|
12
|
+
super( geometry, material );
|
|
12
13
|
const scope = this; // temp buffers used in polygonize
|
|
13
14
|
|
|
14
15
|
const vlist = new Float32Array( 12 * 3 );
|
|
15
16
|
const nlist = new Float32Array( 12 * 3 );
|
|
16
17
|
const clist = new Float32Array( 12 * 3 );
|
|
17
|
-
this.enableUvs = enableUvs
|
|
18
|
-
this.enableColors = enableColors
|
|
18
|
+
this.enableUvs = enableUvs;
|
|
19
|
+
this.enableColors = enableColors; // functions have to be object properties
|
|
19
20
|
// prototype functions kill performance
|
|
20
21
|
// (tested and it was 4x slower !!!)
|
|
21
22
|
|
|
@@ -35,27 +36,34 @@
|
|
|
35
36
|
this.zd = this.size2;
|
|
36
37
|
this.field = new Float32Array( this.size3 );
|
|
37
38
|
this.normal_cache = new Float32Array( this.size3 * 3 );
|
|
38
|
-
this.palette = new Float32Array( this.size3 * 3 ); //
|
|
39
|
-
|
|
40
|
-
this.maxCount = 4096; // TODO: find the fastest size for this buffer
|
|
39
|
+
this.palette = new Float32Array( this.size3 * 3 ); //
|
|
41
40
|
|
|
42
41
|
this.count = 0;
|
|
43
|
-
|
|
44
|
-
this.
|
|
45
|
-
this.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
this.normalArray = new Float32Array(
|
|
42
|
+
const maxVertexCount = maxPolyCount * 3;
|
|
43
|
+
this.positionArray = new Float32Array( maxVertexCount * 3 );
|
|
44
|
+
const positionAttribute = new THREE.BufferAttribute( this.positionArray, 3 );
|
|
45
|
+
positionAttribute.setUsage( THREE.DynamicDrawUsage );
|
|
46
|
+
geometry.setAttribute( 'position', positionAttribute );
|
|
47
|
+
this.normalArray = new Float32Array( maxVertexCount * 3 );
|
|
48
|
+
const normalAttribute = new THREE.BufferAttribute( this.normalArray, 3 );
|
|
49
|
+
normalAttribute.setUsage( THREE.DynamicDrawUsage );
|
|
50
|
+
geometry.setAttribute( 'normal', normalAttribute );
|
|
49
51
|
|
|
50
52
|
if ( this.enableUvs ) {
|
|
51
53
|
|
|
52
|
-
this.uvArray = new Float32Array(
|
|
54
|
+
this.uvArray = new Float32Array( maxVertexCount * 2 );
|
|
55
|
+
const uvAttribute = new THREE.BufferAttribute( this.uvArray, 2 );
|
|
56
|
+
uvAttribute.setUsage( THREE.DynamicDrawUsage );
|
|
57
|
+
geometry.setAttribute( 'uv', uvAttribute );
|
|
53
58
|
|
|
54
59
|
}
|
|
55
60
|
|
|
56
61
|
if ( this.enableColors ) {
|
|
57
62
|
|
|
58
|
-
this.colorArray = new Float32Array(
|
|
63
|
+
this.colorArray = new Float32Array( maxVertexCount * 3 );
|
|
64
|
+
const colorAttribute = new THREE.BufferAttribute( this.colorArray, 3 );
|
|
65
|
+
colorAttribute.setUsage( THREE.DynamicDrawUsage );
|
|
66
|
+
geometry.setAttribute( 'color', colorAttribute );
|
|
59
67
|
|
|
60
68
|
}
|
|
61
69
|
|
|
@@ -136,7 +144,7 @@
|
|
|
136
144
|
// (this is where most of time is spent - it's inner work of O(n3) loop )
|
|
137
145
|
|
|
138
146
|
|
|
139
|
-
function polygonize( fx, fy, fz, q, isol
|
|
147
|
+
function polygonize( fx, fy, fz, q, isol ) {
|
|
140
148
|
|
|
141
149
|
// cache indices
|
|
142
150
|
const q1 = q + 1,
|
|
@@ -282,7 +290,7 @@
|
|
|
282
290
|
o1 = cubeindex + i;
|
|
283
291
|
o2 = o1 + 1;
|
|
284
292
|
o3 = o1 + 2;
|
|
285
|
-
posnormtriv( vlist, nlist, clist, 3 * triTable[ o1 ], 3 * triTable[ o2 ], 3 * triTable[ o3 ]
|
|
293
|
+
posnormtriv( vlist, nlist, clist, 3 * triTable[ o1 ], 3 * triTable[ o2 ], 3 * triTable[ o3 ] );
|
|
286
294
|
i += 3;
|
|
287
295
|
numtris ++;
|
|
288
296
|
|
|
@@ -290,12 +298,9 @@
|
|
|
290
298
|
|
|
291
299
|
return numtris;
|
|
292
300
|
|
|
293
|
-
}
|
|
294
|
-
// Immediate render mode simulator
|
|
295
|
-
/////////////////////////////////////
|
|
296
|
-
|
|
301
|
+
}
|
|
297
302
|
|
|
298
|
-
function posnormtriv( pos, norm, colors, o1, o2, o3
|
|
303
|
+
function posnormtriv( pos, norm, colors, o1, o2, o3 ) {
|
|
299
304
|
|
|
300
305
|
const c = scope.count * 3; // positions
|
|
301
306
|
|
|
@@ -368,67 +373,7 @@
|
|
|
368
373
|
|
|
369
374
|
scope.count += 3;
|
|
370
375
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
scope.hasPositions = true;
|
|
374
|
-
scope.hasNormals = true;
|
|
375
|
-
|
|
376
|
-
if ( scope.enableUvs ) {
|
|
377
|
-
|
|
378
|
-
scope.hasUvs = true;
|
|
379
|
-
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
if ( scope.enableColors ) {
|
|
383
|
-
|
|
384
|
-
scope.hasColors = true;
|
|
385
|
-
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
renderCallback( scope );
|
|
389
|
-
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
this.begin = function () {
|
|
395
|
-
|
|
396
|
-
this.count = 0;
|
|
397
|
-
this.hasPositions = false;
|
|
398
|
-
this.hasNormals = false;
|
|
399
|
-
this.hasUvs = false;
|
|
400
|
-
this.hasColors = false;
|
|
401
|
-
|
|
402
|
-
};
|
|
403
|
-
|
|
404
|
-
this.end = function ( renderCallback ) {
|
|
405
|
-
|
|
406
|
-
if ( this.count === 0 ) return;
|
|
407
|
-
|
|
408
|
-
for ( let i = this.count * 3; i < this.positionArray.length; i ++ ) {
|
|
409
|
-
|
|
410
|
-
this.positionArray[ i ] = 0.0;
|
|
411
|
-
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
this.hasPositions = true;
|
|
415
|
-
this.hasNormals = true;
|
|
416
|
-
|
|
417
|
-
if ( this.enableUvs && this.material.map ) {
|
|
418
|
-
|
|
419
|
-
this.hasUvs = true;
|
|
420
|
-
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
if ( this.enableColors && this.material.vertexColors !== THREE.NoColors ) {
|
|
424
|
-
|
|
425
|
-
this.hasColors = true;
|
|
426
|
-
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
renderCallback( this );
|
|
430
|
-
|
|
431
|
-
}; /////////////////////////////////////
|
|
376
|
+
} /////////////////////////////////////
|
|
432
377
|
// Metaballs
|
|
433
378
|
/////////////////////////////////////
|
|
434
379
|
// Adds a reciprocal ball (nice and blobby) that, to be fast, fades to zero after
|
|
@@ -729,9 +674,9 @@
|
|
|
729
674
|
|
|
730
675
|
};
|
|
731
676
|
|
|
732
|
-
this.
|
|
677
|
+
this.onBeforeRender = function () {
|
|
733
678
|
|
|
734
|
-
this.
|
|
679
|
+
this.count = 0; // Triangulate. Yeah, this is slow.
|
|
735
680
|
|
|
736
681
|
const smin2 = this.size - 2;
|
|
737
682
|
|
|
@@ -750,59 +695,28 @@
|
|
|
750
695
|
const fx = ( x - this.halfsize ) / this.halfsize; //+ 1
|
|
751
696
|
|
|
752
697
|
const q = y_offset + x;
|
|
753
|
-
polygonize( fx, fy, fz, q, this.isolation
|
|
698
|
+
polygonize( fx, fy, fz, q, this.isolation );
|
|
754
699
|
|
|
755
700
|
}
|
|
756
701
|
|
|
757
702
|
}
|
|
758
703
|
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
this.end( renderCallback );
|
|
762
|
-
|
|
763
|
-
};
|
|
764
|
-
|
|
765
|
-
this.generateGeometry = function () {
|
|
766
|
-
|
|
767
|
-
console.warn( 'THREE.MarchingCubes: generateGeometry() now returns THREE.BufferGeometry' );
|
|
768
|
-
return this.generateBufferGeometry();
|
|
704
|
+
} // reset unneeded data
|
|
769
705
|
|
|
770
|
-
};
|
|
771
|
-
|
|
772
|
-
function concatenate( a, b, length ) {
|
|
773
706
|
|
|
774
|
-
|
|
775
|
-
result.set( a, 0 );
|
|
776
|
-
result.set( b.slice( 0, length ), a.length );
|
|
777
|
-
return result;
|
|
778
|
-
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
this.generateBufferGeometry = function () {
|
|
707
|
+
for ( let i = this.count * 3; i < this.positionArray.length; i ++ ) {
|
|
782
708
|
|
|
783
|
-
|
|
784
|
-
let posArray = new Float32Array();
|
|
785
|
-
let normArray = new Float32Array();
|
|
786
|
-
let colorArray = new Float32Array();
|
|
787
|
-
let uvArray = new Float32Array();
|
|
788
|
-
const scope = this;
|
|
709
|
+
this.positionArray[ i ] = 0.0;
|
|
789
710
|
|
|
790
|
-
|
|
711
|
+
} // update geometry data
|
|
791
712
|
|
|
792
|
-
if ( scope.hasPositions ) posArray = concatenate( posArray, object.positionArray, object.count * 3 );
|
|
793
|
-
if ( scope.hasNormals ) normArray = concatenate( normArray, object.normalArray, object.count * 3 );
|
|
794
|
-
if ( scope.hasColors ) colorArray = concatenate( colorArray, object.colorArray, object.count * 3 );
|
|
795
|
-
if ( scope.hasUvs ) uvArray = concatenate( uvArray, object.uvArray, object.count * 2 );
|
|
796
|
-
object.count = 0;
|
|
797
713
|
|
|
798
|
-
|
|
714
|
+
geometry.getAttribute( 'position' ).needsUpdate = true;
|
|
715
|
+
geometry.getAttribute( 'normal' ).needsUpdate = true;
|
|
716
|
+
if ( this.enableUvs ) geometry.getAttribute( 'uv' ).needsUpdate = true;
|
|
717
|
+
if ( this.enableColors ) geometry.getAttribute( 'color' ).needsUpdate = true; // safety check
|
|
799
718
|
|
|
800
|
-
this.
|
|
801
|
-
if ( this.hasPositions ) geo.setAttribute( 'position', new THREE.BufferAttribute( posArray, 3 ) );
|
|
802
|
-
if ( this.hasNormals ) geo.setAttribute( 'normal', new THREE.BufferAttribute( normArray, 3 ) );
|
|
803
|
-
if ( this.hasColors ) geo.setAttribute( 'color', new THREE.BufferAttribute( colorArray, 3 ) );
|
|
804
|
-
if ( this.hasUvs ) geo.setAttribute( 'uv', new THREE.BufferAttribute( uvArray, 2 ) );
|
|
805
|
-
return geo;
|
|
719
|
+
if ( this.count / 3 > maxPolyCount ) console.warn( 'THREE.MarchingCubes: Geometry buffers too small for rendering. Please create an instance with a higher poly count.' );
|
|
806
720
|
|
|
807
721
|
};
|
|
808
722
|
|
|
@@ -816,7 +730,7 @@
|
|
|
816
730
|
// Marching cubes lookup tables
|
|
817
731
|
/////////////////////////////////////
|
|
818
732
|
// These tables are straight from Paul Bourke's page:
|
|
819
|
-
// http://
|
|
733
|
+
// http://paulbourke.net/geometry/polygonise/
|
|
820
734
|
// who in turn got them from Cory Gene Bloyd.
|
|
821
735
|
|
|
822
736
|
const edgeTable = new Int32Array( [ 0x0, 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c, 0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00, 0x190, 0x99, 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c, 0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90, 0x230, 0x339, 0x33, 0x13a, 0x636, 0x73f, 0x435, 0x53c, 0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30, 0x3a0, 0x2a9, 0x1a3, 0xaa, 0x7a6, 0x6af, 0x5a5, 0x4ac, 0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0, 0x460, 0x569, 0x663, 0x76a, 0x66, 0x16f, 0x265, 0x36c, 0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60, 0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0xff, 0x3f5, 0x2fc, 0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0, 0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55, 0x15c, 0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950, 0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc, 0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0, 0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc, 0xcc, 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0, 0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c, 0x15c, 0x55, 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650, 0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc, 0x2fc, 0x3f5, 0xff, 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0, 0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c, 0x36c, 0x265, 0x16f, 0x66, 0x76a, 0x663, 0x569, 0x460, 0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac, 0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa, 0x1a3, 0x2a9, 0x3a0, 0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c, 0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33, 0x339, 0x230, 0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c, 0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99, 0x190, 0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c, 0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0 ] );
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
class CSS2DObject extends THREE.Object3D {
|
|
4
4
|
|
|
5
|
-
constructor( element ) {
|
|
5
|
+
constructor( element = document.createElement( 'div' ) ) {
|
|
6
6
|
|
|
7
7
|
super();
|
|
8
|
-
this.element = element
|
|
8
|
+
this.element = element;
|
|
9
9
|
this.element.style.position = 'absolute';
|
|
10
10
|
this.element.style.userSelect = 'none';
|
|
11
11
|
this.element.setAttribute( 'draggable', false );
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
|
|
50
50
|
class CSS2DRenderer {
|
|
51
51
|
|
|
52
|
-
constructor() {
|
|
52
|
+
constructor( parameters = {} ) {
|
|
53
53
|
|
|
54
54
|
const _this = this;
|
|
55
55
|
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
const cache = {
|
|
61
61
|
objects: new WeakMap()
|
|
62
62
|
};
|
|
63
|
-
const domElement = document.createElement( 'div' );
|
|
63
|
+
const domElement = parameters.element !== undefined ? parameters.element : document.createElement( 'div' );
|
|
64
64
|
domElement.style.overflow = 'hidden';
|
|
65
65
|
this.domElement = domElement;
|
|
66
66
|
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
|
|
13
13
|
class CSS3DObject extends THREE.Object3D {
|
|
14
14
|
|
|
15
|
-
constructor( element ) {
|
|
15
|
+
constructor( element = document.createElement( 'div' ) ) {
|
|
16
16
|
|
|
17
17
|
super();
|
|
18
|
-
this.element = element
|
|
18
|
+
this.element = element;
|
|
19
19
|
this.element.style.position = 'absolute';
|
|
20
20
|
this.element.style.pointerEvents = 'auto';
|
|
21
21
|
this.element.style.userSelect = 'none';
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
|
|
76
76
|
class CSS3DRenderer {
|
|
77
77
|
|
|
78
|
-
constructor() {
|
|
78
|
+
constructor( parameters = {} ) {
|
|
79
79
|
|
|
80
80
|
const _this = this;
|
|
81
81
|
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
},
|
|
91
91
|
objects: new WeakMap()
|
|
92
92
|
};
|
|
93
|
-
const domElement = document.createElement( 'div' );
|
|
93
|
+
const domElement = parameters.element !== undefined ? parameters.element : document.createElement( 'div' );
|
|
94
94
|
domElement.style.overflow = 'hidden';
|
|
95
95
|
this.domElement = domElement;
|
|
96
96
|
const cameraElement = document.createElement( 'div' );
|
|
@@ -77,6 +77,7 @@
|
|
|
77
77
|
material.roughnessMap.repeat.copy( roughnessMap.repeat );
|
|
78
78
|
material.roughnessMap.center.copy( roughnessMap.center );
|
|
79
79
|
material.roughnessMap.rotation = roughnessMap.rotation;
|
|
80
|
+
material.roughnessMap.image = roughnessMap.image;
|
|
80
81
|
material.roughnessMap.matrixAutoUpdate = roughnessMap.matrixAutoUpdate;
|
|
81
82
|
material.roughnessMap.matrix.copy( roughnessMap.matrix );
|
|
82
83
|
|
|
@@ -6,14 +6,14 @@ import {
|
|
|
6
6
|
LineBasicMaterial,
|
|
7
7
|
Raycaster,
|
|
8
8
|
Group,
|
|
9
|
-
Object3D,
|
|
10
9
|
Box3,
|
|
11
10
|
Sphere,
|
|
12
11
|
Quaternion,
|
|
13
12
|
Vector2,
|
|
14
13
|
Vector3,
|
|
15
14
|
Matrix4,
|
|
16
|
-
MathUtils
|
|
15
|
+
MathUtils,
|
|
16
|
+
EventDispatcher
|
|
17
17
|
} from 'three';
|
|
18
18
|
|
|
19
19
|
//trackball state
|
|
@@ -64,6 +64,9 @@ const _changeEvent = { type: 'change' };
|
|
|
64
64
|
const _startEvent = { type: 'start' };
|
|
65
65
|
const _endEvent = { type: 'end' };
|
|
66
66
|
|
|
67
|
+
const _raycaster = new Raycaster();
|
|
68
|
+
const _offset = new Vector3();
|
|
69
|
+
|
|
67
70
|
|
|
68
71
|
/**
|
|
69
72
|
*
|
|
@@ -71,7 +74,7 @@ const _endEvent = { type: 'end' };
|
|
|
71
74
|
* @param {HTMLElement} domElement Renderer's dom element
|
|
72
75
|
* @param {Scene} scene The scene to be rendered
|
|
73
76
|
*/
|
|
74
|
-
class ArcballControls extends
|
|
77
|
+
class ArcballControls extends EventDispatcher {
|
|
75
78
|
|
|
76
79
|
constructor( camera, domElement, scene = null ) {
|
|
77
80
|
|
|
@@ -79,6 +82,8 @@ class ArcballControls extends Object3D {
|
|
|
79
82
|
this.camera = null;
|
|
80
83
|
this.domElement = domElement;
|
|
81
84
|
this.scene = scene;
|
|
85
|
+
this.target = new Vector3( 0, 0, 0 );
|
|
86
|
+
this.radiusFactor = 0.67;
|
|
82
87
|
|
|
83
88
|
this.mouseActions = [];
|
|
84
89
|
this._mouseOp = null;
|
|
@@ -204,7 +209,6 @@ class ArcballControls extends Object3D {
|
|
|
204
209
|
this.maxZoom = Infinity;
|
|
205
210
|
|
|
206
211
|
//trackball parameters
|
|
207
|
-
this._tbCenter = new Vector3( 0, 0, 0 );
|
|
208
212
|
this._tbRadius = 1;
|
|
209
213
|
|
|
210
214
|
//FSA
|
|
@@ -1130,8 +1134,8 @@ class ArcballControls extends Object3D {
|
|
|
1130
1134
|
this.applyTransformMatrix( this.scale( size, this._v3_2, false ) );
|
|
1131
1135
|
|
|
1132
1136
|
//adjusting distance
|
|
1133
|
-
|
|
1134
|
-
this._m4_1.makeTranslation(
|
|
1137
|
+
_offset.copy( this._gizmos.position ).sub( this.camera.position ).normalize().multiplyScalar( newDistance / x );
|
|
1138
|
+
this._m4_1.makeTranslation( _offset.x, _offset.y, _offset.z );
|
|
1135
1139
|
|
|
1136
1140
|
}
|
|
1137
1141
|
|
|
@@ -1540,8 +1544,8 @@ class ArcballControls extends Object3D {
|
|
|
1540
1544
|
this.applyTransformMatrix( this.scale( size, this._v3_2, false ) );
|
|
1541
1545
|
|
|
1542
1546
|
//adjusting distance
|
|
1543
|
-
|
|
1544
|
-
this._m4_1.makeTranslation(
|
|
1547
|
+
_offset.copy( this._gizmos.position ).sub( this.camera.position ).normalize().multiplyScalar( newDistance / x );
|
|
1548
|
+
this._m4_1.makeTranslation( _offset.x, _offset.y, _offset.z );
|
|
1545
1549
|
|
|
1546
1550
|
this.dispatchEvent( _changeEvent );
|
|
1547
1551
|
|
|
@@ -1974,18 +1978,17 @@ class ArcballControls extends Object3D {
|
|
|
1974
1978
|
*/
|
|
1975
1979
|
calculateTbRadius = ( camera ) => {
|
|
1976
1980
|
|
|
1977
|
-
const factor = 0.67;
|
|
1978
1981
|
const distance = camera.position.distanceTo( this._gizmos.position );
|
|
1979
1982
|
|
|
1980
1983
|
if ( camera.type == 'PerspectiveCamera' ) {
|
|
1981
1984
|
|
|
1982
1985
|
const halfFovV = MathUtils.DEG2RAD * camera.fov * 0.5; //vertical fov/2 in radians
|
|
1983
1986
|
const halfFovH = Math.atan( ( camera.aspect ) * Math.tan( halfFovV ) ); //horizontal fov/2 in radians
|
|
1984
|
-
return Math.tan( Math.min( halfFovV, halfFovH ) ) * distance *
|
|
1987
|
+
return Math.tan( Math.min( halfFovV, halfFovH ) ) * distance * this.radiusFactor;
|
|
1985
1988
|
|
|
1986
1989
|
} else if ( camera.type == 'OrthographicCamera' ) {
|
|
1987
1990
|
|
|
1988
|
-
return Math.min( camera.top, camera.right ) *
|
|
1991
|
+
return Math.min( camera.top, camera.right ) * this.radiusFactor;
|
|
1989
1992
|
|
|
1990
1993
|
}
|
|
1991
1994
|
|
|
@@ -1999,11 +2002,9 @@ class ArcballControls extends Object3D {
|
|
|
1999
2002
|
*/
|
|
2000
2003
|
focus = ( point, size, amount = 1 ) => {
|
|
2001
2004
|
|
|
2002
|
-
const focusPoint = point.clone();
|
|
2003
|
-
|
|
2004
2005
|
//move center of camera (along with gizmos) towards point of interest
|
|
2005
|
-
|
|
2006
|
-
this._translationMatrix.makeTranslation(
|
|
2006
|
+
_offset.copy( point ).sub( this._gizmos.position ).multiplyScalar( amount );
|
|
2007
|
+
this._translationMatrix.makeTranslation( _offset.x, _offset.y, _offset.z );
|
|
2007
2008
|
|
|
2008
2009
|
const gizmoStateTemp = this._gizmoMatrixState.clone();
|
|
2009
2010
|
this._gizmoMatrixState.premultiply( this._translationMatrix );
|
|
@@ -2097,9 +2098,9 @@ class ArcballControls extends Object3D {
|
|
|
2097
2098
|
window.removeEventListener( 'pointerup', this.onPointerUp );
|
|
2098
2099
|
|
|
2099
2100
|
window.removeEventListener( 'resize', this.onWindowResize );
|
|
2100
|
-
window.
|
|
2101
|
+
window.removeEventListener( 'keydown', this.onKeyDown );
|
|
2101
2102
|
|
|
2102
|
-
this.scene.remove( this._gizmos );
|
|
2103
|
+
if ( this.scene !== null ) this.scene.remove( this._gizmos );
|
|
2103
2104
|
this.disposeGrid();
|
|
2104
2105
|
|
|
2105
2106
|
};
|
|
@@ -2193,7 +2194,7 @@ class ArcballControls extends Object3D {
|
|
|
2193
2194
|
*/
|
|
2194
2195
|
setCamera = ( camera ) => {
|
|
2195
2196
|
|
|
2196
|
-
camera.lookAt( this.
|
|
2197
|
+
camera.lookAt( this.target );
|
|
2197
2198
|
camera.updateMatrix();
|
|
2198
2199
|
|
|
2199
2200
|
//setting state
|
|
@@ -2211,11 +2212,11 @@ class ArcballControls extends Object3D {
|
|
|
2211
2212
|
this._zoomState = this._zoom0;
|
|
2212
2213
|
|
|
2213
2214
|
this._initialNear = camera.near;
|
|
2214
|
-
this._nearPos0 = camera.position.distanceTo( this.
|
|
2215
|
+
this._nearPos0 = camera.position.distanceTo( this.target ) - camera.near;
|
|
2215
2216
|
this._nearPos = this._initialNear;
|
|
2216
2217
|
|
|
2217
2218
|
this._initialFar = camera.far;
|
|
2218
|
-
this._farPos0 = camera.position.distanceTo( this.
|
|
2219
|
+
this._farPos0 = camera.position.distanceTo( this.target ) - camera.far;
|
|
2219
2220
|
this._farPos = this._initialFar;
|
|
2220
2221
|
|
|
2221
2222
|
this._up0.copy( camera.up );
|
|
@@ -2226,7 +2227,7 @@ class ArcballControls extends Object3D {
|
|
|
2226
2227
|
|
|
2227
2228
|
//making gizmos
|
|
2228
2229
|
this._tbRadius = this.calculateTbRadius( camera );
|
|
2229
|
-
this.makeGizmos( this.
|
|
2230
|
+
this.makeGizmos( this.target, this._tbRadius );
|
|
2230
2231
|
|
|
2231
2232
|
};
|
|
2232
2233
|
|
|
@@ -2241,6 +2242,30 @@ class ArcballControls extends Object3D {
|
|
|
2241
2242
|
|
|
2242
2243
|
}
|
|
2243
2244
|
|
|
2245
|
+
/**
|
|
2246
|
+
* Set gizmos radius factor and redraws gizmos
|
|
2247
|
+
* @param {Float} value Value of radius factor
|
|
2248
|
+
*/
|
|
2249
|
+
setTbRadius( value ) {
|
|
2250
|
+
|
|
2251
|
+
this.radiusFactor = value;
|
|
2252
|
+
this._tbRadius = this.calculateTbRadius( this.camera );
|
|
2253
|
+
|
|
2254
|
+
const curve = new EllipseCurve( 0, 0, this._tbRadius, this._tbRadius );
|
|
2255
|
+
const points = curve.getPoints( this._curvePts );
|
|
2256
|
+
const curveGeometry = new BufferGeometry().setFromPoints( points );
|
|
2257
|
+
|
|
2258
|
+
|
|
2259
|
+
for ( const gizmo in this._gizmos.children ) {
|
|
2260
|
+
|
|
2261
|
+
this._gizmos.children[ gizmo ].geometry = curveGeometry;
|
|
2262
|
+
|
|
2263
|
+
}
|
|
2264
|
+
|
|
2265
|
+
this.dispatchEvent( _changeEvent );
|
|
2266
|
+
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2244
2269
|
/**
|
|
2245
2270
|
* Creates the rotation gizmos matching trackball center and radius
|
|
2246
2271
|
* @param {Vector3} tbCenter The trackball center
|
|
@@ -2667,9 +2692,9 @@ class ArcballControls extends Object3D {
|
|
|
2667
2692
|
|
|
2668
2693
|
}
|
|
2669
2694
|
|
|
2670
|
-
|
|
2695
|
+
_offset.copy( scalePoint ).sub( this._v3_1 ).normalize().multiplyScalar( amount );
|
|
2671
2696
|
|
|
2672
|
-
this._m4_1.makeTranslation(
|
|
2697
|
+
this._m4_1.makeTranslation( _offset.x, _offset.y, _offset.z );
|
|
2673
2698
|
|
|
2674
2699
|
|
|
2675
2700
|
if ( scaleGizmos ) {
|
|
@@ -2679,12 +2704,12 @@ class ArcballControls extends Object3D {
|
|
|
2679
2704
|
|
|
2680
2705
|
distance = pos.distanceTo( scalePoint );
|
|
2681
2706
|
amount = distance - ( distance * sizeInverse );
|
|
2682
|
-
|
|
2707
|
+
_offset.copy( scalePoint ).sub( this._v3_2 ).normalize().multiplyScalar( amount );
|
|
2683
2708
|
|
|
2684
2709
|
this._translationMatrix.makeTranslation( pos.x, pos.y, pos.z );
|
|
2685
2710
|
this._scaleMatrix.makeScale( sizeInverse, sizeInverse, sizeInverse );
|
|
2686
2711
|
|
|
2687
|
-
this._m4_2.makeTranslation(
|
|
2712
|
+
this._m4_2.makeTranslation( _offset.x, _offset.y, _offset.z ).multiply( this._translationMatrix );
|
|
2688
2713
|
this._m4_2.multiply( this._scaleMatrix );
|
|
2689
2714
|
|
|
2690
2715
|
this._translationMatrix.makeTranslation( - pos.x, - pos.y, - pos.z );
|
|
@@ -2728,12 +2753,12 @@ class ArcballControls extends Object3D {
|
|
|
2728
2753
|
*/
|
|
2729
2754
|
setTarget = ( x, y, z ) => {
|
|
2730
2755
|
|
|
2731
|
-
this.
|
|
2756
|
+
this.target.set( x, y, z );
|
|
2732
2757
|
this._gizmos.position.set( x, y, z ); //for correct radius calculation
|
|
2733
2758
|
this._tbRadius = this.calculateTbRadius( this.camera );
|
|
2734
2759
|
|
|
2735
|
-
this.makeGizmos( this.
|
|
2736
|
-
this.camera.lookAt( this.
|
|
2760
|
+
this.makeGizmos( this.target, this._tbRadius );
|
|
2761
|
+
this.camera.lookAt( this.target );
|
|
2737
2762
|
|
|
2738
2763
|
};
|
|
2739
2764
|
|
|
@@ -2809,6 +2834,13 @@ class ArcballControls extends Object3D {
|
|
|
2809
2834
|
};
|
|
2810
2835
|
|
|
2811
2836
|
|
|
2837
|
+
getRaycaster() {
|
|
2838
|
+
|
|
2839
|
+
return _raycaster;
|
|
2840
|
+
|
|
2841
|
+
}
|
|
2842
|
+
|
|
2843
|
+
|
|
2812
2844
|
/**
|
|
2813
2845
|
* Unproject the cursor on the 3D object surface
|
|
2814
2846
|
* @param {Vector2} cursor Cursor coordinates in NDC
|
|
@@ -2817,7 +2849,7 @@ class ArcballControls extends Object3D {
|
|
|
2817
2849
|
*/
|
|
2818
2850
|
unprojectOnObj = ( cursor, camera ) => {
|
|
2819
2851
|
|
|
2820
|
-
const raycaster =
|
|
2852
|
+
const raycaster = this.getRaycaster();
|
|
2821
2853
|
raycaster.near = camera.near;
|
|
2822
2854
|
raycaster.far = camera.far;
|
|
2823
2855
|
raycaster.setFromCamera( cursor, camera );
|
|
@@ -64,6 +64,12 @@ class DragControls extends EventDispatcher {
|
|
|
64
64
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
function getRaycaster() {
|
|
68
|
+
|
|
69
|
+
return _raycaster;
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
|
|
67
73
|
function onPointerMove( event ) {
|
|
68
74
|
|
|
69
75
|
if ( scope.enabled === false ) return;
|
|
@@ -205,6 +211,7 @@ class DragControls extends EventDispatcher {
|
|
|
205
211
|
this.deactivate = deactivate;
|
|
206
212
|
this.dispose = dispose;
|
|
207
213
|
this.getObjects = getObjects;
|
|
214
|
+
this.getRaycaster = getRaycaster;
|
|
208
215
|
|
|
209
216
|
}
|
|
210
217
|
|