super-three 0.141.0 → 0.144.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 +8 -8
- package/build/three.cjs +1558 -1034
- package/build/three.js +1558 -1034
- package/build/three.min.js +1 -1
- package/build/three.module.js +2012 -1243
- package/examples/js/animation/MMDPhysics.js +1 -16
- package/examples/js/controls/ArcballControls.js +16 -3
- package/examples/js/controls/FirstPersonControls.js +0 -7
- package/examples/js/controls/FlyControls.js +0 -8
- package/examples/js/controls/OrbitControls.js +0 -4
- package/examples/js/controls/PointerLockControls.js +0 -8
- package/examples/js/controls/TrackballControls.js +0 -2
- package/examples/js/controls/TransformControls.js +20 -16
- package/examples/js/effects/AnaglyphEffect.js +2 -2
- package/examples/js/effects/OutlineEffect.js +4 -24
- package/examples/js/effects/ParallaxBarrierEffect.js +2 -2
- package/examples/js/effects/PeppersGhostEffect.js +2 -2
- package/examples/js/effects/StereoEffect.js +2 -2
- package/examples/js/environments/RoomEnvironment.js +22 -0
- package/examples/js/exporters/ColladaExporter.js +4 -13
- package/examples/js/exporters/DRACOExporter.js +0 -12
- package/examples/js/exporters/GLTFExporter.js +28 -29
- package/examples/js/exporters/OBJExporter.js +2 -23
- package/examples/js/exporters/PLYExporter.js +12 -24
- package/examples/js/exporters/STLExporter.js +0 -7
- package/examples/js/exporters/USDZExporter.js +6 -0
- package/examples/js/geometries/ConvexGeometry.js +1 -1
- package/examples/js/geometries/ParametricGeometry.js +1 -8
- package/examples/js/interactive/SelectionHelper.js +2 -0
- package/examples/js/libs/ktx-parse.umd.js +1 -0
- package/examples/js/libs/meshopt_decoder.js +98 -32
- package/examples/js/loaders/ColladaLoader.js +1 -0
- package/examples/js/loaders/DRACOLoader.js +2 -25
- package/examples/js/loaders/EXRLoader.js +2 -13
- package/examples/js/loaders/FBXLoader.js +10 -3
- package/examples/js/loaders/FontLoader.js +3 -16
- package/examples/js/loaders/GLTFLoader.js +52 -36
- package/examples/js/loaders/HDRCubeTextureLoader.js +0 -11
- package/examples/js/loaders/LDrawLoader.js +139 -74
- package/examples/js/loaders/OBJLoader.js +7 -13
- package/examples/js/loaders/PCDLoader.js +59 -14
- package/examples/js/loaders/PLYLoader.js +3 -3
- package/examples/js/loaders/SVGLoader.js +4 -3
- package/examples/js/loaders/TIFFLoader.js +31 -0
- package/examples/js/loaders/VRMLLoader.js +33 -24
- package/examples/js/loaders/VTKLoader.js +1 -1
- package/examples/js/loaders/lwo/LWO2Parser.js +8 -7
- package/examples/js/loaders/lwo/LWO3Parser.js +8 -7
- package/examples/js/materials/MeshGouraudMaterial.js +385 -0
- package/examples/js/math/ColorConverter.js +0 -50
- package/examples/js/misc/GPUComputationRenderer.js +23 -0
- package/examples/js/misc/Volume.js +198 -190
- package/examples/js/misc/VolumeSlice.js +90 -88
- package/examples/js/modifiers/SimplifyModifier.js +1 -1
- package/examples/js/objects/GroundProjectedEnv.js +193 -0
- package/examples/js/objects/Reflector.js +9 -2
- package/examples/js/objects/ReflectorForSSRPass.js +3 -4
- package/examples/js/objects/Refractor.js +10 -4
- package/examples/js/objects/ShadowMesh.js +5 -1
- package/examples/js/postprocessing/OutlinePass.js +5 -3
- package/examples/js/renderers/CSS2DRenderer.js +2 -2
- package/examples/js/renderers/CSS3DRenderer.js +2 -2
- package/examples/js/renderers/Projector.js +2 -23
- package/examples/js/shaders/LuminosityShader.js +1 -1
- package/examples/js/shaders/MMDToonShader.js +6 -2
- package/examples/js/shaders/ToneMapShader.js +1 -1
- package/examples/js/utils/BufferGeometryUtils.js +1 -1
- package/examples/js/utils/GeometryUtils.js +2 -18
- package/examples/js/utils/PackedPhongMaterial.js +1 -1
- package/examples/js/utils/SceneUtils.js +0 -16
- package/examples/jsm/animation/MMDPhysics.js +3 -22
- package/examples/jsm/controls/ArcballControls.js +17 -2
- package/examples/jsm/controls/FirstPersonControls.js +0 -7
- package/examples/jsm/controls/FlyControls.js +0 -7
- package/examples/jsm/controls/OrbitControls.js +0 -5
- package/examples/jsm/controls/PointerLockControls.js +0 -7
- package/examples/jsm/controls/TrackballControls.js +0 -3
- package/examples/jsm/controls/TransformControls.js +18 -16
- package/examples/jsm/effects/AnaglyphEffect.js +2 -2
- package/examples/jsm/effects/OutlineEffect.js +4 -25
- package/examples/jsm/effects/ParallaxBarrierEffect.js +2 -2
- package/examples/jsm/effects/PeppersGhostEffect.js +2 -2
- package/examples/jsm/effects/StereoEffect.js +2 -2
- package/examples/jsm/environments/RoomEnvironment.js +23 -0
- package/examples/jsm/exporters/ColladaExporter.js +4 -13
- package/examples/jsm/exporters/DRACOExporter.js +0 -13
- package/examples/jsm/exporters/GLTFExporter.js +29 -31
- package/examples/jsm/exporters/KTX2Exporter.js +29 -29
- package/examples/jsm/exporters/OBJExporter.js +0 -18
- package/examples/jsm/exporters/PLYExporter.js +14 -22
- package/examples/jsm/exporters/STLExporter.js +1 -9
- package/examples/jsm/exporters/USDZExporter.js +14 -3
- package/examples/jsm/geometries/ConvexGeometry.js +1 -1
- package/examples/jsm/geometries/ParametricGeometry.js +0 -6
- package/examples/jsm/interactive/HTMLMesh.js +9 -9
- package/examples/jsm/interactive/SelectionHelper.js +5 -3
- package/examples/jsm/libs/meshopt_decoder.module.js +97 -32
- package/examples/jsm/libs/utif.module.js +1579 -0
- package/examples/jsm/libs/zstddec.module.js +1 -0
- package/examples/jsm/loaders/ColladaLoader.js +1 -0
- package/examples/jsm/loaders/DRACOLoader.js +2 -28
- package/examples/jsm/loaders/EXRLoader.js +3 -13
- package/examples/jsm/loaders/FBXLoader.js +10 -3
- package/examples/jsm/loaders/FontLoader.js +3 -16
- package/examples/jsm/loaders/GLTFLoader.js +52 -36
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +0 -13
- package/examples/jsm/loaders/KTX2Loader.js +192 -30
- package/examples/jsm/loaders/LDrawLoader.js +135 -74
- package/examples/jsm/loaders/OBJLoader.js +6 -14
- package/examples/jsm/loaders/PCDLoader.js +59 -13
- package/examples/jsm/loaders/PLYLoader.js +3 -3
- package/examples/jsm/loaders/RGBELoader.js +1 -1
- package/examples/jsm/loaders/SVGLoader.js +4 -3
- package/examples/jsm/loaders/TIFFLoader.js +36 -0
- package/examples/jsm/loaders/USDZLoader.js +393 -0
- package/examples/jsm/loaders/VRMLLoader.js +23 -25
- package/examples/jsm/loaders/VTKLoader.js +1 -1
- package/examples/jsm/loaders/lwo/LWO2Parser.js +6 -8
- package/examples/jsm/loaders/lwo/LWO3Parser.js +6 -8
- package/examples/jsm/materials/MeshGouraudMaterial.js +423 -0
- package/examples/jsm/math/ColorConverter.js +1 -49
- package/examples/jsm/misc/GPUComputationRenderer.js +43 -0
- package/examples/jsm/misc/Volume.js +169 -171
- package/examples/jsm/misc/VolumeSlice.js +78 -80
- package/examples/jsm/modifiers/SimplifyModifier.js +1 -1
- package/examples/jsm/node-editor/accessors/MatcapUVEditor.js +1 -1
- package/examples/jsm/node-editor/accessors/NormalEditor.js +1 -1
- package/examples/jsm/node-editor/accessors/PositionEditor.js +1 -1
- package/examples/jsm/node-editor/accessors/UVEditor.js +1 -1
- package/examples/jsm/node-editor/display/BlendEditor.js +1 -1
- package/examples/jsm/node-editor/display/NormalMapEditor.js +1 -1
- package/examples/jsm/node-editor/inputs/ColorEditor.js +1 -1
- package/examples/jsm/node-editor/inputs/FloatEditor.js +1 -1
- package/examples/jsm/node-editor/inputs/SliderEditor.js +1 -1
- package/examples/jsm/node-editor/inputs/TextureEditor.js +1 -1
- package/examples/jsm/node-editor/inputs/Vector2Editor.js +1 -1
- package/examples/jsm/node-editor/inputs/Vector3Editor.js +1 -1
- package/examples/jsm/node-editor/inputs/Vector4Editor.js +1 -1
- package/examples/jsm/node-editor/materials/BasicMaterialEditor.js +1 -1
- package/examples/jsm/node-editor/materials/PointsMaterialEditor.js +1 -1
- package/examples/jsm/node-editor/materials/StandardMaterialEditor.js +1 -1
- package/examples/jsm/node-editor/math/AngleEditor.js +1 -1
- package/examples/jsm/node-editor/math/DotEditor.js +1 -1
- package/examples/jsm/node-editor/math/InvertEditor.js +1 -1
- package/examples/jsm/node-editor/math/LimiterEditor.js +1 -1
- package/examples/jsm/node-editor/math/NormalizeEditor.js +1 -1
- package/examples/jsm/node-editor/math/OperatorEditor.js +1 -1
- package/examples/jsm/node-editor/math/PowerEditor.js +1 -1
- package/examples/jsm/node-editor/math/TrigonometryEditor.js +1 -1
- package/examples/jsm/node-editor/procedural/CheckerEditor.js +1 -1
- package/examples/jsm/node-editor/utils/JoinEditor.js +1 -1
- package/examples/jsm/node-editor/utils/OscillatorEditor.js +1 -1
- package/examples/jsm/node-editor/utils/PreviewEditor.js +3 -3
- package/examples/jsm/node-editor/utils/SplitEditor.js +1 -1
- package/examples/jsm/node-editor/utils/TimerEditor.js +1 -1
- package/examples/jsm/nodes/Nodes.js +43 -13
- package/examples/jsm/nodes/accessors/CubeTextureNode.js +9 -5
- package/examples/jsm/nodes/accessors/NormalNode.js +4 -4
- package/examples/jsm/nodes/accessors/PositionNode.js +5 -5
- package/examples/jsm/nodes/accessors/ReflectVectorNode.js +31 -0
- package/examples/jsm/nodes/core/AttributeNode.js +3 -3
- package/examples/jsm/nodes/core/CodeNode.js +3 -3
- package/examples/jsm/nodes/core/FunctionCallNode.js +20 -5
- package/examples/jsm/nodes/core/FunctionNode.js +2 -2
- package/examples/jsm/nodes/core/Node.js +14 -12
- package/examples/jsm/nodes/core/NodeBuilder.js +12 -12
- package/examples/jsm/nodes/core/NodeUtils.js +23 -1
- package/examples/jsm/nodes/core/{NodeVary.js → NodeVarying.js} +3 -3
- package/examples/jsm/nodes/core/{VaryNode.js → VaryingNode.js} +7 -7
- package/examples/jsm/nodes/display/ColorAdjustmentNode.js +94 -0
- package/examples/jsm/nodes/geometry/RangeNode.js +109 -0
- package/examples/jsm/nodes/gpgpu/ComputeNode.js +2 -0
- package/examples/jsm/nodes/lighting/EnvironmentNode.js +8 -7
- package/examples/jsm/nodes/lighting/LightingContextNode.js +4 -4
- package/examples/jsm/nodes/loaders/NodeLoader.js +2 -2
- package/examples/jsm/nodes/loaders/NodeMaterialLoader.js +31 -0
- package/examples/jsm/nodes/materials/Materials.js +13 -25
- package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +70 -0
- package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +4 -7
- package/examples/jsm/nodes/materials/NodeMaterial.js +2 -2
- package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +28 -17
- package/examples/jsm/nodes/materialx/Disclaimer.md +199 -0
- package/examples/jsm/nodes/materialx/functions/lib/mx_hsv.js +56 -0
- package/examples/jsm/nodes/materialx/functions/lib/mx_noise.js +607 -0
- package/examples/jsm/nodes/math/MathNode.js +2 -12
- package/examples/jsm/nodes/parsers/GLSLNodeFunction.js +21 -6
- package/examples/jsm/nodes/procedural/CheckerNode.js +2 -2
- package/examples/jsm/nodes/shadernode/ShaderNode.js +5 -5
- package/examples/jsm/nodes/shadernode/ShaderNodeBaseElements.js +8 -5
- package/examples/jsm/nodes/shadernode/ShaderNodeElements.js +20 -6
- package/examples/jsm/nodes/utils/ConvertNode.js +8 -3
- package/examples/jsm/nodes/utils/JoinNode.js +7 -7
- package/examples/jsm/nodes/utils/MaxMipLevelNode.js +2 -1
- package/examples/jsm/nodes/utils/RotateUVNode.js +32 -0
- package/examples/jsm/nodes/utils/SplitNode.js +21 -5
- package/examples/jsm/nodes/utils/TimerNode.js +2 -2
- package/examples/jsm/objects/GroundProjectedEnv.js +186 -0
- package/examples/jsm/objects/Reflector.js +12 -5
- package/examples/jsm/objects/ReflectorForSSRPass.js +3 -5
- package/examples/jsm/objects/Refractor.js +12 -6
- package/examples/jsm/objects/ShadowMesh.js +8 -2
- package/examples/jsm/postprocessing/OutlinePass.js +5 -3
- package/examples/jsm/renderers/CSS2DRenderer.js +2 -2
- package/examples/jsm/renderers/CSS3DRenderer.js +2 -2
- package/examples/jsm/renderers/Projector.js +2 -24
- package/examples/jsm/renderers/webgl/nodes/SlotNode.js +9 -5
- package/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js +329 -218
- package/examples/jsm/renderers/webgl/nodes/WebGLNodes.js +7 -3
- package/examples/jsm/renderers/webgpu/WebGPUBackground.js +39 -3
- package/examples/jsm/renderers/webgpu/WebGPUComputePipelines.js +6 -0
- package/examples/jsm/renderers/webgpu/WebGPUGeometries.js +6 -0
- package/examples/jsm/renderers/webgpu/WebGPUObjects.js +1 -1
- package/examples/jsm/renderers/webgpu/WebGPURenderPipeline.js +17 -19
- package/examples/jsm/renderers/webgpu/WebGPURenderPipelines.js +16 -14
- package/examples/jsm/renderers/webgpu/WebGPURenderStates.js +2 -2
- package/examples/jsm/renderers/webgpu/WebGPURenderer.js +66 -81
- package/examples/jsm/renderers/webgpu/WebGPUTextureUtils.js +5 -3
- package/examples/jsm/renderers/webgpu/WebGPUTextures.js +2 -2
- package/examples/jsm/renderers/webgpu/WebGPUUtils.js +81 -0
- package/examples/jsm/renderers/webgpu/nodes/WebGPUNodeBuilder.js +25 -30
- package/examples/jsm/renderers/webgpu/nodes/WebGPUNodes.js +1 -1
- package/examples/jsm/shaders/LuminosityShader.js +1 -1
- package/examples/jsm/shaders/MMDToonShader.js +2 -2
- package/examples/jsm/shaders/ToneMapShader.js +1 -1
- package/examples/jsm/utils/BufferGeometryUtils.js +2 -1
- package/examples/jsm/utils/GeometryUtils.js +17 -25
- package/examples/jsm/utils/PackedPhongMaterial.js +0 -1
- package/examples/jsm/utils/SceneUtils.js +1 -21
- package/examples/jsm/webxr/OculusHandPointerModel.js +6 -1
- package/examples/jsm/webxr/VRButton.js +1 -7
- package/package.json +18 -14
- package/src/Three.Legacy.js +262 -36
- package/src/Three.js +3 -2
- package/src/animation/AnimationAction.js +6 -5
- package/src/animation/AnimationClip.js +1 -1
- package/src/animation/AnimationMixer.js +1 -1
- package/src/animation/AnimationUtils.js +204 -199
- package/src/animation/KeyframeTrack.js +1 -1
- package/src/animation/PropertyBinding.js +24 -5
- package/src/cameras/CubeCamera.js +0 -7
- package/src/constants.js +2 -4
- package/src/core/BufferAttribute.js +81 -111
- package/src/core/BufferGeometry.js +3 -41
- package/src/core/InstancedBufferAttribute.js +0 -10
- package/src/core/InterleavedBuffer.js +1 -1
- package/src/core/InterleavedBufferAttribute.js +56 -7
- package/src/core/Object3D.js +22 -5
- package/src/core/Uniform.js +0 -7
- package/src/core/UniformsGroup.js +92 -0
- package/src/extras/DataUtils.js +104 -88
- package/src/extras/core/Path.js +1 -0
- package/src/extras/core/ShapePath.js +1 -4
- package/src/extras/curves/CatmullRomCurve3.js +4 -2
- package/src/geometries/BoxGeometry.js +1 -1
- package/src/geometries/CapsuleGeometry.js +1 -1
- package/src/geometries/CircleGeometry.js +1 -1
- package/src/geometries/ConeGeometry.js +1 -1
- package/src/geometries/CylinderGeometry.js +2 -1
- package/src/geometries/DodecahedronGeometry.js +1 -1
- package/src/geometries/EdgesGeometry.js +5 -4
- package/src/geometries/ExtrudeGeometry.js +2 -11
- package/src/geometries/IcosahedronGeometry.js +1 -1
- package/src/geometries/LatheGeometry.js +2 -2
- package/src/geometries/OctahedronGeometry.js +1 -1
- package/src/geometries/PlaneGeometry.js +2 -1
- package/src/geometries/PolyhedronGeometry.js +1 -1
- package/src/geometries/RingGeometry.js +1 -1
- package/src/geometries/ShapeGeometry.js +2 -1
- package/src/geometries/SphereGeometry.js +2 -1
- package/src/geometries/TetrahedronGeometry.js +1 -1
- package/src/geometries/TorusGeometry.js +2 -1
- package/src/geometries/TorusKnotGeometry.js +2 -1
- package/src/geometries/TubeGeometry.js +2 -1
- package/src/geometries/WireframeGeometry.js +1 -0
- package/src/helpers/CameraHelper.js +97 -38
- package/src/helpers/DirectionalLightHelper.js +1 -0
- package/src/helpers/HemisphereLightHelper.js +1 -0
- package/src/helpers/PlaneHelper.js +6 -9
- package/src/helpers/PolarGridHelper.js +18 -14
- package/src/helpers/SpotLightHelper.js +1 -0
- package/src/lights/SpotLight.js +2 -0
- package/src/loaders/FileLoader.js +12 -1
- package/src/loaders/LoadingManager.js +1 -1
- package/src/loaders/MaterialLoader.js +49 -7
- package/src/loaders/ObjectLoader.js +4 -41
- package/src/materials/Material.js +1 -33
- package/src/materials/Materials.js +0 -27
- package/src/materials/MeshLambertMaterial.js +28 -1
- package/src/materials/ShaderMaterial.js +3 -7
- package/src/math/Color.js +3 -13
- package/src/math/MathUtils.js +1 -7
- package/src/math/Matrix3.js +1 -7
- package/src/math/Matrix4.js +3 -27
- package/src/math/Quaternion.js +1 -21
- package/src/math/Vector2.js +4 -24
- package/src/math/Vector3.js +7 -46
- package/src/math/Vector4.js +4 -24
- package/src/renderers/WebGLRenderer.js +84 -8
- package/src/renderers/shaders/ShaderChunk/bsdfs.glsl.js +12 -12
- package/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js +3 -5
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +6 -5
- package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +24 -24
- package/src/renderers/shaders/ShaderChunk/envmap_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/envmap_pars_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.js +2 -1
- package/src/renderers/shaders/ShaderChunk/iridescence_fragment.glsl.js +113 -99
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +34 -12
- package/src/renderers/shaders/ShaderChunk/lights_lambert_fragment.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.js +30 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +3 -1
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +13 -1
- package/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js +2 -4
- package/src/renderers/shaders/ShaderChunk/output_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +18 -7
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +8 -3
- package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +9 -6
- package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +14 -10
- package/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk.js +4 -2
- package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +0 -1
- package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +22 -50
- package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +0 -1
- package/src/renderers/shaders/ShaderLib.js +31 -31
- package/src/renderers/shaders/UniformsLib.js +12 -11
- package/src/renderers/shaders/UniformsUtils.js +14 -0
- package/src/renderers/webgl/WebGLBackground.js +2 -2
- package/src/renderers/webgl/WebGLLights.js +37 -13
- package/src/renderers/webgl/WebGLMorphtargets.js +0 -20
- package/src/renderers/webgl/WebGLProgram.js +6 -11
- package/src/renderers/webgl/WebGLPrograms.js +30 -26
- package/src/renderers/webgl/WebGLRenderLists.js +5 -4
- package/src/renderers/webgl/WebGLRenderStates.js +5 -4
- package/src/renderers/webgl/WebGLShaderCache.js +9 -6
- package/src/renderers/webgl/WebGLShadowMap.js +10 -15
- package/src/renderers/webgl/WebGLState.js +47 -0
- package/src/renderers/webgl/WebGLUniforms.js +4 -4
- package/src/renderers/webgl/WebGLUniformsGroups.js +372 -0
- package/src/renderers/webgl/WebGLUtils.js +2 -0
- package/src/renderers/webvr/WebVRManager.js +42 -9
- package/src/renderers/webvr/WebVRUtils.js +1 -1
- package/src/renderers/webxr/WebXRController.js +45 -37
- package/src/renderers/webxr/WebXRManager.js +58 -33
- package/src/scenes/Scene.js +16 -3
- package/src/textures/Source.js +1 -1
- package/src/utils.js +1 -1
- package/examples/js/controls/experimental/CameraControls.js +0 -1048
- package/examples/js/loaders/KTX2Loader.js +0 -558
- package/examples/jsm/controls/experimental/CameraControls.js +0 -1248
- package/examples/jsm/nodes/accessors/ReflectNode.js +0 -70
- package/examples/jsm/package.json +0 -3
- package/examples/jsm/renderers/webgl/nodes/WebGLPhysicalContextNode.js +0 -45
- package/src/renderers/shaders/ShaderChunk/lights_lambert_vertex.glsl.js +0 -122
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
DoubleSide,
|
|
5
5
|
InterpolateDiscrete,
|
|
6
6
|
InterpolateLinear,
|
|
7
|
+
LinearEncoding,
|
|
7
8
|
LinearFilter,
|
|
8
9
|
LinearMipmapLinearFilter,
|
|
9
10
|
LinearMipmapNearestFilter,
|
|
@@ -18,10 +19,10 @@ import {
|
|
|
18
19
|
RepeatWrapping,
|
|
19
20
|
Scene,
|
|
20
21
|
Source,
|
|
22
|
+
sRGBEncoding,
|
|
21
23
|
Vector3
|
|
22
24
|
} from 'three';
|
|
23
25
|
|
|
24
|
-
|
|
25
26
|
class GLTFExporter {
|
|
26
27
|
|
|
27
28
|
constructor() {
|
|
@@ -105,14 +106,6 @@ class GLTFExporter {
|
|
|
105
106
|
*/
|
|
106
107
|
parse( input, onDone, onError, options ) {
|
|
107
108
|
|
|
108
|
-
if ( typeof onError === 'object' ) {
|
|
109
|
-
|
|
110
|
-
console.warn( 'THREE.GLTFExporter: parse() expects options as the fourth argument now.' );
|
|
111
|
-
|
|
112
|
-
options = onError;
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
109
|
const writer = new GLTFWriter();
|
|
117
110
|
const plugins = [];
|
|
118
111
|
|
|
@@ -343,27 +336,15 @@ function getPaddedArrayBuffer( arrayBuffer, paddingByte = 0 ) {
|
|
|
343
336
|
|
|
344
337
|
}
|
|
345
338
|
|
|
346
|
-
let cachedCanvas = null;
|
|
347
|
-
|
|
348
339
|
function getCanvas() {
|
|
349
340
|
|
|
350
|
-
if ( cachedCanvas ) {
|
|
351
|
-
|
|
352
|
-
return cachedCanvas;
|
|
353
|
-
|
|
354
|
-
}
|
|
355
|
-
|
|
356
341
|
if ( typeof document === 'undefined' && typeof OffscreenCanvas !== 'undefined' ) {
|
|
357
342
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
} else {
|
|
361
|
-
|
|
362
|
-
cachedCanvas = document.createElement( 'canvas' );
|
|
343
|
+
return new OffscreenCanvas( 1, 1 );
|
|
363
344
|
|
|
364
345
|
}
|
|
365
346
|
|
|
366
|
-
return
|
|
347
|
+
return document.createElement( 'canvas' );
|
|
367
348
|
|
|
368
349
|
}
|
|
369
350
|
|
|
@@ -744,6 +725,26 @@ class GLTFWriter {
|
|
|
744
725
|
|
|
745
726
|
if ( metalnessMap === roughnessMap ) return metalnessMap;
|
|
746
727
|
|
|
728
|
+
function getEncodingConversion( map ) {
|
|
729
|
+
|
|
730
|
+
if ( map.encoding === sRGBEncoding ) {
|
|
731
|
+
|
|
732
|
+
return function SRGBToLinear( c ) {
|
|
733
|
+
|
|
734
|
+
return ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );
|
|
735
|
+
|
|
736
|
+
};
|
|
737
|
+
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
return function LinearToLinear( c ) {
|
|
741
|
+
|
|
742
|
+
return c;
|
|
743
|
+
|
|
744
|
+
};
|
|
745
|
+
|
|
746
|
+
}
|
|
747
|
+
|
|
747
748
|
console.warn( 'THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures.' );
|
|
748
749
|
|
|
749
750
|
const metalness = metalnessMap?.image;
|
|
@@ -766,11 +767,12 @@ class GLTFWriter {
|
|
|
766
767
|
|
|
767
768
|
context.drawImage( metalness, 0, 0, width, height );
|
|
768
769
|
|
|
770
|
+
const convert = getEncodingConversion( metalnessMap );
|
|
769
771
|
const data = context.getImageData( 0, 0, width, height ).data;
|
|
770
772
|
|
|
771
773
|
for ( let i = 2; i < data.length; i += 4 ) {
|
|
772
774
|
|
|
773
|
-
composite.data[ i ] = data[ i ];
|
|
775
|
+
composite.data[ i ] = convert( data[ i ] / 256 ) * 256;
|
|
774
776
|
|
|
775
777
|
}
|
|
776
778
|
|
|
@@ -780,11 +782,12 @@ class GLTFWriter {
|
|
|
780
782
|
|
|
781
783
|
context.drawImage( roughness, 0, 0, width, height );
|
|
782
784
|
|
|
785
|
+
const convert = getEncodingConversion( roughnessMap );
|
|
783
786
|
const data = context.getImageData( 0, 0, width, height ).data;
|
|
784
787
|
|
|
785
788
|
for ( let i = 1; i < data.length; i += 4 ) {
|
|
786
789
|
|
|
787
|
-
composite.data[ i ] = data[ i ];
|
|
790
|
+
composite.data[ i ] = convert( data[ i ] / 256 ) * 256;
|
|
788
791
|
|
|
789
792
|
}
|
|
790
793
|
|
|
@@ -799,6 +802,7 @@ class GLTFWriter {
|
|
|
799
802
|
const texture = reference.clone();
|
|
800
803
|
|
|
801
804
|
texture.source = new Source( canvas );
|
|
805
|
+
texture.encoding = LinearEncoding;
|
|
802
806
|
|
|
803
807
|
return texture;
|
|
804
808
|
|
|
@@ -1482,12 +1486,6 @@ class GLTFWriter {
|
|
|
1482
1486
|
|
|
1483
1487
|
}
|
|
1484
1488
|
|
|
1485
|
-
if ( geometry.isBufferGeometry !== true ) {
|
|
1486
|
-
|
|
1487
|
-
throw new Error( 'THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry.' );
|
|
1488
|
-
|
|
1489
|
-
}
|
|
1490
|
-
|
|
1491
1489
|
const meshDef = {};
|
|
1492
1490
|
const attributes = {};
|
|
1493
1491
|
const primitives = [];
|
|
@@ -39,46 +39,46 @@ import {
|
|
|
39
39
|
VK_FORMAT_R8G8_UNORM,
|
|
40
40
|
VK_FORMAT_R8G8B8A8_SRGB,
|
|
41
41
|
VK_FORMAT_R8G8B8A8_UNORM,
|
|
42
|
-
|
|
42
|
+
} from '../libs/ktx-parse.module.js';
|
|
43
43
|
|
|
44
44
|
const VK_FORMAT_MAP = {
|
|
45
45
|
|
|
46
|
-
[RGBAFormat]: {
|
|
47
|
-
[FloatType]: {
|
|
48
|
-
[LinearEncoding]: VK_FORMAT_R32G32B32A32_SFLOAT,
|
|
46
|
+
[ RGBAFormat ]: {
|
|
47
|
+
[ FloatType ]: {
|
|
48
|
+
[ LinearEncoding ]: VK_FORMAT_R32G32B32A32_SFLOAT,
|
|
49
49
|
},
|
|
50
|
-
[HalfFloatType]: {
|
|
51
|
-
[LinearEncoding]: VK_FORMAT_R16G16B16A16_SFLOAT,
|
|
50
|
+
[ HalfFloatType ]: {
|
|
51
|
+
[ LinearEncoding ]: VK_FORMAT_R16G16B16A16_SFLOAT,
|
|
52
52
|
},
|
|
53
|
-
[UnsignedByteType]: {
|
|
54
|
-
[LinearEncoding]: VK_FORMAT_R8G8B8A8_UNORM,
|
|
55
|
-
[sRGBEncoding]: VK_FORMAT_R8G8B8A8_SRGB,
|
|
53
|
+
[ UnsignedByteType ]: {
|
|
54
|
+
[ LinearEncoding ]: VK_FORMAT_R8G8B8A8_UNORM,
|
|
55
|
+
[ sRGBEncoding ]: VK_FORMAT_R8G8B8A8_SRGB,
|
|
56
56
|
},
|
|
57
57
|
},
|
|
58
58
|
|
|
59
|
-
[RGFormat]: {
|
|
60
|
-
[FloatType]: {
|
|
61
|
-
[LinearEncoding]: VK_FORMAT_R32G32_SFLOAT,
|
|
59
|
+
[ RGFormat ]: {
|
|
60
|
+
[ FloatType ]: {
|
|
61
|
+
[ LinearEncoding ]: VK_FORMAT_R32G32_SFLOAT,
|
|
62
62
|
},
|
|
63
|
-
[HalfFloatType]: {
|
|
64
|
-
[LinearEncoding]: VK_FORMAT_R16G16_SFLOAT,
|
|
63
|
+
[ HalfFloatType ]: {
|
|
64
|
+
[ LinearEncoding ]: VK_FORMAT_R16G16_SFLOAT,
|
|
65
65
|
},
|
|
66
|
-
[UnsignedByteType]: {
|
|
67
|
-
[LinearEncoding]: VK_FORMAT_R8G8_UNORM,
|
|
68
|
-
[sRGBEncoding]: VK_FORMAT_R8G8_SRGB,
|
|
66
|
+
[ UnsignedByteType ]: {
|
|
67
|
+
[ LinearEncoding ]: VK_FORMAT_R8G8_UNORM,
|
|
68
|
+
[ sRGBEncoding ]: VK_FORMAT_R8G8_SRGB,
|
|
69
69
|
},
|
|
70
70
|
},
|
|
71
71
|
|
|
72
|
-
[RedFormat]: {
|
|
73
|
-
[FloatType]: {
|
|
74
|
-
[LinearEncoding]: VK_FORMAT_R32_SFLOAT,
|
|
72
|
+
[ RedFormat ]: {
|
|
73
|
+
[ FloatType ]: {
|
|
74
|
+
[ LinearEncoding ]: VK_FORMAT_R32_SFLOAT,
|
|
75
75
|
},
|
|
76
|
-
[HalfFloatType]: {
|
|
77
|
-
[LinearEncoding]: VK_FORMAT_R16_SFLOAT,
|
|
76
|
+
[ HalfFloatType ]: {
|
|
77
|
+
[ LinearEncoding ]: VK_FORMAT_R16_SFLOAT,
|
|
78
78
|
},
|
|
79
|
-
[UnsignedByteType]: {
|
|
80
|
-
[LinearEncoding]: VK_FORMAT_R8_SRGB,
|
|
81
|
-
[sRGBEncoding]: VK_FORMAT_R8_UNORM,
|
|
79
|
+
[ UnsignedByteType ]: {
|
|
80
|
+
[ LinearEncoding ]: VK_FORMAT_R8_SRGB,
|
|
81
|
+
[ sRGBEncoding ]: VK_FORMAT_R8_UNORM,
|
|
82
82
|
},
|
|
83
83
|
},
|
|
84
84
|
|
|
@@ -195,8 +195,8 @@ export class KTX2Exporter {
|
|
|
195
195
|
channelType: channelType,
|
|
196
196
|
bitOffset: i * array.BYTES_PER_ELEMENT,
|
|
197
197
|
bitLength: array.BYTES_PER_ELEMENT * 8 - 1,
|
|
198
|
-
samplePosition: [0, 0, 0, 0],
|
|
199
|
-
sampleLower: texture.type === UnsignedByteType ? 0 : -1,
|
|
198
|
+
samplePosition: [ 0, 0, 0, 0 ],
|
|
199
|
+
sampleLower: texture.type === UnsignedByteType ? 0 : - 1,
|
|
200
200
|
sampleUpper: texture.type === UnsignedByteType ? 255 : 1,
|
|
201
201
|
|
|
202
202
|
} );
|
|
@@ -214,7 +214,7 @@ export class KTX2Exporter {
|
|
|
214
214
|
|
|
215
215
|
//
|
|
216
216
|
|
|
217
|
-
container.keyValue['KTXwriter'] = `three.js ${ REVISION }`;
|
|
217
|
+
container.keyValue[ 'KTXwriter' ] = `three.js ${ REVISION }`;
|
|
218
218
|
|
|
219
219
|
//
|
|
220
220
|
|
|
@@ -250,7 +250,7 @@ function toDataTexture( renderer, rtt ) {
|
|
|
250
250
|
|
|
251
251
|
renderer.readRenderTargetPixels( rtt, 0, 0, rtt.width, rtt.height, view );
|
|
252
252
|
|
|
253
|
-
return new DataTexture( view, rtt.width,
|
|
253
|
+
return new DataTexture( view, rtt.width, rtt.height, rtt.texture.format, rtt.texture.type );
|
|
254
254
|
|
|
255
255
|
}
|
|
256
256
|
|
|
@@ -32,12 +32,6 @@ class OBJExporter {
|
|
|
32
32
|
|
|
33
33
|
const normalMatrixWorld = new Matrix3();
|
|
34
34
|
|
|
35
|
-
if ( geometry.isBufferGeometry !== true ) {
|
|
36
|
-
|
|
37
|
-
throw new Error( 'THREE.OBJExporter: Geometry is not of type THREE.BufferGeometry.' );
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
35
|
// shortcuts
|
|
42
36
|
const vertices = geometry.getAttribute( 'position' );
|
|
43
37
|
const normals = geometry.getAttribute( 'normal' );
|
|
@@ -159,12 +153,6 @@ class OBJExporter {
|
|
|
159
153
|
const geometry = line.geometry;
|
|
160
154
|
const type = line.type;
|
|
161
155
|
|
|
162
|
-
if ( geometry.isBufferGeometry !== true ) {
|
|
163
|
-
|
|
164
|
-
throw new Error( 'THREE.OBJExporter: Geometry is not of type THREE.BufferGeometry.' );
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
|
|
168
156
|
// shortcuts
|
|
169
157
|
const vertices = geometry.getAttribute( 'position' );
|
|
170
158
|
|
|
@@ -222,12 +210,6 @@ class OBJExporter {
|
|
|
222
210
|
|
|
223
211
|
const geometry = points.geometry;
|
|
224
212
|
|
|
225
|
-
if ( geometry.isBufferGeometry !== true ) {
|
|
226
|
-
|
|
227
|
-
throw new Error( 'THREE.OBJExporter: Geometry is not of type THREE.BufferGeometry.' );
|
|
228
|
-
|
|
229
|
-
}
|
|
230
|
-
|
|
231
213
|
const vertices = geometry.getAttribute( 'position' );
|
|
232
214
|
const colors = geometry.getAttribute( 'color' );
|
|
233
215
|
|
|
@@ -21,30 +21,16 @@ class PLYExporter {
|
|
|
21
21
|
|
|
22
22
|
parse( object, onDone, options ) {
|
|
23
23
|
|
|
24
|
-
if ( onDone && typeof onDone === 'object' ) {
|
|
25
|
-
|
|
26
|
-
console.warn( 'THREE.PLYExporter: The options parameter is now the third argument to the "parse" function. See the documentation for the new API.' );
|
|
27
|
-
options = onDone;
|
|
28
|
-
onDone = undefined;
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
24
|
// Iterate over the valid meshes in the object
|
|
33
25
|
function traverseMeshes( cb ) {
|
|
34
26
|
|
|
35
27
|
object.traverse( function ( child ) {
|
|
36
28
|
|
|
37
|
-
if ( child.isMesh === true ) {
|
|
29
|
+
if ( child.isMesh === true || child.isPoints ) {
|
|
38
30
|
|
|
39
31
|
const mesh = child;
|
|
40
32
|
const geometry = mesh.geometry;
|
|
41
33
|
|
|
42
|
-
if ( geometry.isBufferGeometry !== true ) {
|
|
43
|
-
|
|
44
|
-
throw new Error( 'THREE.PLYExporter: Geometry is not of type THREE.BufferGeometry.' );
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
34
|
if ( geometry.hasAttribute( 'position' ) === true ) {
|
|
49
35
|
|
|
50
36
|
cb( mesh, geometry );
|
|
@@ -67,6 +53,7 @@ class PLYExporter {
|
|
|
67
53
|
options = Object.assign( defaultOptions, options );
|
|
68
54
|
|
|
69
55
|
const excludeAttributes = options.excludeAttributes;
|
|
56
|
+
let includeIndices = true;
|
|
70
57
|
let includeNormals = false;
|
|
71
58
|
let includeColors = false;
|
|
72
59
|
let includeUVs = false;
|
|
@@ -75,6 +62,7 @@ class PLYExporter {
|
|
|
75
62
|
// and cache the BufferGeometry
|
|
76
63
|
let vertexCount = 0;
|
|
77
64
|
let faceCount = 0;
|
|
65
|
+
|
|
78
66
|
object.traverse( function ( child ) {
|
|
79
67
|
|
|
80
68
|
if ( child.isMesh === true ) {
|
|
@@ -82,12 +70,6 @@ class PLYExporter {
|
|
|
82
70
|
const mesh = child;
|
|
83
71
|
const geometry = mesh.geometry;
|
|
84
72
|
|
|
85
|
-
if ( geometry.isBufferGeometry !== true ) {
|
|
86
|
-
|
|
87
|
-
throw new Error( 'THREE.PLYExporter: Geometry is not of type THREE.BufferGeometry.' );
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
73
|
const vertices = geometry.getAttribute( 'position' );
|
|
92
74
|
const normals = geometry.getAttribute( 'normal' );
|
|
93
75
|
const uvs = geometry.getAttribute( 'uv' );
|
|
@@ -109,12 +91,22 @@ class PLYExporter {
|
|
|
109
91
|
|
|
110
92
|
if ( colors !== undefined ) includeColors = true;
|
|
111
93
|
|
|
94
|
+
} else if ( child.isPoints ) {
|
|
95
|
+
|
|
96
|
+
const mesh = child;
|
|
97
|
+
const geometry = mesh.geometry;
|
|
98
|
+
|
|
99
|
+
const vertices = geometry.getAttribute( 'position' );
|
|
100
|
+
vertexCount += vertices.count;
|
|
101
|
+
|
|
102
|
+
includeIndices = false;
|
|
103
|
+
|
|
112
104
|
}
|
|
113
105
|
|
|
114
106
|
} );
|
|
115
107
|
|
|
116
108
|
const tempColor = new Color();
|
|
117
|
-
|
|
109
|
+
includeIndices = includeIndices && excludeAttributes.indexOf( 'index' ) === - 1;
|
|
118
110
|
includeNormals = includeNormals && excludeAttributes.indexOf( 'normal' ) === - 1;
|
|
119
111
|
includeColors = includeColors && excludeAttributes.indexOf( 'color' ) === - 1;
|
|
120
112
|
includeUVs = includeUVs && excludeAttributes.indexOf( 'uv' ) === - 1;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Vector3
|
|
3
|
-
} from 'three';
|
|
1
|
+
import { Vector3 } from 'three';
|
|
4
2
|
|
|
5
3
|
/**
|
|
6
4
|
* Usage:
|
|
@@ -28,12 +26,6 @@ class STLExporter {
|
|
|
28
26
|
|
|
29
27
|
const geometry = object.geometry;
|
|
30
28
|
|
|
31
|
-
if ( geometry.isBufferGeometry !== true ) {
|
|
32
|
-
|
|
33
|
-
throw new Error( 'THREE.STLExporter: Geometry is not of type THREE.BufferGeometry.' );
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
29
|
const index = geometry.index;
|
|
38
30
|
const positionAttribute = geometry.getAttribute( 'position' );
|
|
39
31
|
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DoubleSide
|
|
3
|
+
} from 'three';
|
|
4
|
+
|
|
1
5
|
import * as fflate from '../libs/fflate.module.js';
|
|
2
6
|
|
|
3
7
|
class USDZExporter {
|
|
@@ -19,10 +23,10 @@ class USDZExporter {
|
|
|
19
23
|
|
|
20
24
|
if ( object.isMesh ) {
|
|
21
25
|
|
|
22
|
-
|
|
26
|
+
const geometry = object.geometry;
|
|
27
|
+
const material = object.material;
|
|
23
28
|
|
|
24
|
-
|
|
25
|
-
const material = object.material;
|
|
29
|
+
if ( material.isMeshStandardMaterial ) {
|
|
26
30
|
|
|
27
31
|
const geometryFileName = 'geometries/Geometry_' + geometry.id + '.usd';
|
|
28
32
|
|
|
@@ -407,6 +411,13 @@ function buildMaterial( material, textures ) {
|
|
|
407
411
|
|
|
408
412
|
}
|
|
409
413
|
|
|
414
|
+
|
|
415
|
+
if ( material.side === DoubleSide ) {
|
|
416
|
+
|
|
417
|
+
console.warn( 'THREE.USDZExporter: USDZ does not support double sided materials', material );
|
|
418
|
+
|
|
419
|
+
}
|
|
420
|
+
|
|
410
421
|
if ( material.map !== null ) {
|
|
411
422
|
|
|
412
423
|
inputs.push( `${ pad }color3f inputs:diffuseColor.connect = </Materials/Material_${ material.id }/Texture_${ material.map.id }_diffuse.outputs:rgb>` );
|
|
@@ -17,7 +17,7 @@ class ConvexGeometry extends BufferGeometry {
|
|
|
17
17
|
|
|
18
18
|
if ( ConvexHull === undefined ) {
|
|
19
19
|
|
|
20
|
-
console.error( 'THREE.
|
|
20
|
+
console.error( 'THREE.ConvexGeometry: ConvexGeometry relies on ConvexHull' );
|
|
21
21
|
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -37,12 +37,6 @@ class ParametricGeometry extends BufferGeometry {
|
|
|
37
37
|
const p0 = new Vector3(), p1 = new Vector3();
|
|
38
38
|
const pu = new Vector3(), pv = new Vector3();
|
|
39
39
|
|
|
40
|
-
if ( func.length < 3 ) {
|
|
41
|
-
|
|
42
|
-
console.error( 'THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.' );
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
40
|
// generate vertices, normals and uvs
|
|
47
41
|
|
|
48
42
|
const sliceCount = slices + 1;
|
|
@@ -203,7 +203,7 @@ function html2canvas( element ) {
|
|
|
203
203
|
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
function buildRectPath(x, y, w, h, r) {
|
|
206
|
+
function buildRectPath( x, y, w, h, r ) {
|
|
207
207
|
|
|
208
208
|
if ( w < 2 * r ) r = w / 2;
|
|
209
209
|
if ( h < 2 * r ) r = h / 2;
|
|
@@ -356,7 +356,7 @@ function html2canvas( element ) {
|
|
|
356
356
|
const luminance = Math.sqrt( 0.299 * ( color.r ** 2 ) + 0.587 * ( color.g ** 2 ) + 0.114 * ( color.b ** 2 ) );
|
|
357
357
|
const accentTextColor = luminance < 0.5 ? 'white' : '#111111';
|
|
358
358
|
|
|
359
|
-
if ( element.type
|
|
359
|
+
if ( element.type === 'radio' ) {
|
|
360
360
|
|
|
361
361
|
buildRectPath( x, y, width, height, height );
|
|
362
362
|
|
|
@@ -380,7 +380,7 @@ function html2canvas( element ) {
|
|
|
380
380
|
|
|
381
381
|
}
|
|
382
382
|
|
|
383
|
-
if ( element.type
|
|
383
|
+
if ( element.type === 'checkbox' ) {
|
|
384
384
|
|
|
385
385
|
buildRectPath( x, y, width, height, 2 );
|
|
386
386
|
|
|
@@ -395,7 +395,7 @@ function html2canvas( element ) {
|
|
|
395
395
|
const currentTextAlign = context.textAlign;
|
|
396
396
|
|
|
397
397
|
context.textAlign = 'center';
|
|
398
|
-
|
|
398
|
+
|
|
399
399
|
const properties = {
|
|
400
400
|
color: accentTextColor,
|
|
401
401
|
fontFamily: style.fontFamily,
|
|
@@ -411,10 +411,10 @@ function html2canvas( element ) {
|
|
|
411
411
|
|
|
412
412
|
}
|
|
413
413
|
|
|
414
|
-
if ( element.type
|
|
414
|
+
if ( element.type === 'range' ) {
|
|
415
415
|
|
|
416
|
-
const [min,max,value] = ['min','max','value'].map(property => parseFloat(element[property]));
|
|
417
|
-
const position = ((value-min)/(max-min)) * (width - height);
|
|
416
|
+
const [ min, max, value ] = [ 'min', 'max', 'value' ].map( property => parseFloat( element[ property ] ) );
|
|
417
|
+
const position = ( ( value - min ) / ( max - min ) ) * ( width - height );
|
|
418
418
|
|
|
419
419
|
buildRectPath( x, y + ( height / 4 ), width, height / 2, height / 4 );
|
|
420
420
|
context.fillStyle = accentTextColor;
|
|
@@ -423,7 +423,7 @@ function html2canvas( element ) {
|
|
|
423
423
|
context.fill();
|
|
424
424
|
context.stroke();
|
|
425
425
|
|
|
426
|
-
buildRectPath( x, y + ( height / 4 ),position + ( height / 2 ), height / 2, height / 4 );
|
|
426
|
+
buildRectPath( x, y + ( height / 4 ), position + ( height / 2 ), height / 2, height / 4 );
|
|
427
427
|
context.fillStyle = accentColor;
|
|
428
428
|
context.fill();
|
|
429
429
|
|
|
@@ -522,7 +522,7 @@ function htmlevent( element, event, x, y ) {
|
|
|
522
522
|
|
|
523
523
|
element.dispatchEvent( new MouseEvent( event, mouseEventInit ) );
|
|
524
524
|
|
|
525
|
-
if ( element instanceof HTMLInputElement && element.type
|
|
525
|
+
if ( element instanceof HTMLInputElement && element.type === 'range' && ( event === 'mousedown' || event === 'click' ) ) {
|
|
526
526
|
|
|
527
527
|
const [ min, max ] = [ 'min', 'max' ].map( property => parseFloat( element[ property ] ) );
|
|
528
528
|
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Vector2
|
|
3
|
-
} from 'three';
|
|
1
|
+
import { Vector2 } from 'three';
|
|
4
2
|
|
|
5
3
|
class SelectionHelper {
|
|
6
4
|
|
|
@@ -58,6 +56,8 @@ class SelectionHelper {
|
|
|
58
56
|
|
|
59
57
|
onSelectStart( event ) {
|
|
60
58
|
|
|
59
|
+
this.element.style.display = 'none';
|
|
60
|
+
|
|
61
61
|
this.renderer.domElement.parentElement.appendChild( this.element );
|
|
62
62
|
|
|
63
63
|
this.element.style.left = event.clientX + 'px';
|
|
@@ -72,6 +72,8 @@ class SelectionHelper {
|
|
|
72
72
|
|
|
73
73
|
onSelectMove( event ) {
|
|
74
74
|
|
|
75
|
+
this.element.style.display = 'block';
|
|
76
|
+
|
|
75
77
|
this.pointBottomRight.x = Math.max( this.startPoint.x, event.clientX );
|
|
76
78
|
this.pointBottomRight.y = Math.max( this.startPoint.y, event.clientY );
|
|
77
79
|
this.pointTopLeft.x = Math.min( this.startPoint.x, event.clientX );
|