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
|
@@ -1210,16 +1210,34 @@
|
|
|
1210
1210
|
|
|
1211
1211
|
}
|
|
1212
1212
|
|
|
1213
|
-
return
|
|
1213
|
+
return buffer.then( function ( res ) {
|
|
1214
1214
|
|
|
1215
1215
|
const byteOffset = extensionDef.byteOffset || 0;
|
|
1216
1216
|
const byteLength = extensionDef.byteLength || 0;
|
|
1217
1217
|
const count = extensionDef.count;
|
|
1218
1218
|
const stride = extensionDef.byteStride;
|
|
1219
|
-
const
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1219
|
+
const source = new Uint8Array( res, byteOffset, byteLength );
|
|
1220
|
+
|
|
1221
|
+
if ( decoder.decodeGltfBufferAsync ) {
|
|
1222
|
+
|
|
1223
|
+
return decoder.decodeGltfBufferAsync( count, stride, source, extensionDef.mode, extensionDef.filter ).then( function ( res ) {
|
|
1224
|
+
|
|
1225
|
+
return res.buffer;
|
|
1226
|
+
|
|
1227
|
+
} );
|
|
1228
|
+
|
|
1229
|
+
} else {
|
|
1230
|
+
|
|
1231
|
+
// Support for MeshoptDecoder 0.18 or earlier, without decodeGltfBufferAsync
|
|
1232
|
+
return decoder.ready.then( function () {
|
|
1233
|
+
|
|
1234
|
+
const result = new ArrayBuffer( count * stride );
|
|
1235
|
+
decoder.decodeGltfBuffer( new Uint8Array( result ), count, stride, source, extensionDef.mode, extensionDef.filter );
|
|
1236
|
+
return result;
|
|
1237
|
+
|
|
1238
|
+
} );
|
|
1239
|
+
|
|
1240
|
+
}
|
|
1223
1241
|
|
|
1224
1242
|
} );
|
|
1225
1243
|
|
|
@@ -1352,7 +1370,7 @@
|
|
|
1352
1370
|
|
|
1353
1371
|
const accessorDef = json.accessors[ primitive.attributes[ attributeName ] ];
|
|
1354
1372
|
const componentType = WEBGL_COMPONENT_TYPES[ accessorDef.componentType ];
|
|
1355
|
-
attributeTypeMap[ threeAttributeName ] = componentType;
|
|
1373
|
+
attributeTypeMap[ threeAttributeName ] = componentType.name;
|
|
1356
1374
|
attributeNormalizedMap[ threeAttributeName ] = accessorDef.normalized === true;
|
|
1357
1375
|
|
|
1358
1376
|
}
|
|
@@ -1733,44 +1751,44 @@
|
|
|
1733
1751
|
|
|
1734
1752
|
}
|
|
1735
1753
|
|
|
1736
|
-
|
|
1754
|
+
interpolate_( i1, t0, t, t1 ) {
|
|
1737
1755
|
|
|
1738
|
-
|
|
1756
|
+
const result = this.resultBuffer;
|
|
1757
|
+
const values = this.sampleValues;
|
|
1758
|
+
const stride = this.valueSize;
|
|
1759
|
+
const stride2 = stride * 2;
|
|
1760
|
+
const stride3 = stride * 3;
|
|
1761
|
+
const td = t1 - t0;
|
|
1762
|
+
const p = ( t - t0 ) / td;
|
|
1763
|
+
const pp = p * p;
|
|
1764
|
+
const ppp = pp * p;
|
|
1765
|
+
const offset1 = i1 * stride3;
|
|
1766
|
+
const offset0 = offset1 - stride3;
|
|
1767
|
+
const s2 = - 2 * ppp + 3 * pp;
|
|
1768
|
+
const s3 = ppp - pp;
|
|
1769
|
+
const s0 = 1 - s2;
|
|
1770
|
+
const s1 = s3 - pp + p; // Layout of keyframe output values for CUBICSPLINE animations:
|
|
1771
|
+
// [ inTangent_1, splineVertex_1, outTangent_1, inTangent_2, splineVertex_2, ... ]
|
|
1739
1772
|
|
|
1740
|
-
|
|
1741
|
-
const values = this.sampleValues;
|
|
1742
|
-
const stride = this.valueSize;
|
|
1743
|
-
const stride2 = stride * 2;
|
|
1744
|
-
const stride3 = stride * 3;
|
|
1745
|
-
const td = t1 - t0;
|
|
1746
|
-
const p = ( t - t0 ) / td;
|
|
1747
|
-
const pp = p * p;
|
|
1748
|
-
const ppp = pp * p;
|
|
1749
|
-
const offset1 = i1 * stride3;
|
|
1750
|
-
const offset0 = offset1 - stride3;
|
|
1751
|
-
const s2 = - 2 * ppp + 3 * pp;
|
|
1752
|
-
const s3 = ppp - pp;
|
|
1753
|
-
const s0 = 1 - s2;
|
|
1754
|
-
const s1 = s3 - pp + p; // Layout of keyframe output values for CUBICSPLINE animations:
|
|
1755
|
-
// [ inTangent_1, splineVertex_1, outTangent_1, inTangent_2, splineVertex_2, ... ]
|
|
1773
|
+
for ( let i = 0; i !== stride; i ++ ) {
|
|
1756
1774
|
|
|
1757
|
-
|
|
1775
|
+
const p0 = values[ offset0 + i + stride ]; // splineVertex_k
|
|
1758
1776
|
|
|
1759
|
-
|
|
1777
|
+
const m0 = values[ offset0 + i + stride2 ] * td; // outTangent_k * (t_k+1 - t_k)
|
|
1760
1778
|
|
|
1761
|
-
|
|
1779
|
+
const p1 = values[ offset1 + i + stride ]; // splineVertex_k+1
|
|
1762
1780
|
|
|
1763
|
-
|
|
1781
|
+
const m1 = values[ offset1 + i ] * td; // inTangent_k+1 * (t_k+1 - t_k)
|
|
1764
1782
|
|
|
1765
|
-
|
|
1783
|
+
result[ i ] = s0 * p0 + s1 * m0 + s2 * p1 + s3 * m1;
|
|
1766
1784
|
|
|
1767
|
-
|
|
1785
|
+
}
|
|
1768
1786
|
|
|
1769
|
-
|
|
1787
|
+
return result;
|
|
1770
1788
|
|
|
1771
|
-
|
|
1789
|
+
}
|
|
1772
1790
|
|
|
1773
|
-
}
|
|
1791
|
+
}
|
|
1774
1792
|
|
|
1775
1793
|
const _q = new THREE.Quaternion();
|
|
1776
1794
|
|
|
@@ -3451,8 +3469,7 @@
|
|
|
3451
3469
|
const channel = animationDef.channels[ i ];
|
|
3452
3470
|
const sampler = animationDef.samplers[ channel.sampler ];
|
|
3453
3471
|
const target = channel.target;
|
|
3454
|
-
const name = target.node
|
|
3455
|
-
|
|
3472
|
+
const name = target.node;
|
|
3456
3473
|
const input = animationDef.parameters !== undefined ? animationDef.parameters[ sampler.input ] : sampler.input;
|
|
3457
3474
|
const output = animationDef.parameters !== undefined ? animationDef.parameters[ sampler.output ] : sampler.output;
|
|
3458
3475
|
pendingNodes.push( this.getDependency( 'node', name ) );
|
|
@@ -3481,7 +3498,6 @@
|
|
|
3481
3498
|
const target = targets[ i ];
|
|
3482
3499
|
if ( node === undefined ) continue;
|
|
3483
3500
|
node.updateMatrix();
|
|
3484
|
-
node.matrixAutoUpdate = true;
|
|
3485
3501
|
let TypedKeyframeTrack;
|
|
3486
3502
|
|
|
3487
3503
|
switch ( PATH_PROPERTIES[ target.path ] ) {
|
|
@@ -12,17 +12,6 @@
|
|
|
12
12
|
|
|
13
13
|
load( urls, onLoad, onProgress, onError ) {
|
|
14
14
|
|
|
15
|
-
if ( ! Array.isArray( urls ) ) {
|
|
16
|
-
|
|
17
|
-
console.warn( 'THREE.HDRCubeTextureLoader signature has changed. Use .setDataType() instead.' );
|
|
18
|
-
this.setDataType( urls );
|
|
19
|
-
urls = onLoad;
|
|
20
|
-
onLoad = onProgress;
|
|
21
|
-
onProgress = onError;
|
|
22
|
-
onError = arguments[ 4 ];
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
15
|
const texture = new THREE.CubeTexture();
|
|
27
16
|
texture.type = this.type;
|
|
28
17
|
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
const FINISH_TYPE_METAL = 5; // State machine to search a subobject path.
|
|
11
11
|
// The LDraw standard establishes these various possible subfolders.
|
|
12
12
|
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
13
|
+
const FILE_LOCATION_TRY_PARTS = 0;
|
|
14
|
+
const FILE_LOCATION_TRY_P = 1;
|
|
15
|
+
const FILE_LOCATION_TRY_MODELS = 2;
|
|
16
|
+
const FILE_LOCATION_AS_IS = 3;
|
|
17
17
|
const FILE_LOCATION_TRY_RELATIVE = 4;
|
|
18
18
|
const FILE_LOCATION_TRY_ABSOLUTE = 5;
|
|
19
19
|
const FILE_LOCATION_NOT_FOUND = 6;
|
|
@@ -655,7 +655,9 @@
|
|
|
655
655
|
result.type = original.type;
|
|
656
656
|
result.category = original.category;
|
|
657
657
|
result.keywords = original.keywords;
|
|
658
|
+
result.author = original.author;
|
|
658
659
|
result.subobjects = original.subobjects;
|
|
660
|
+
result.fileName = original.fileName;
|
|
659
661
|
result.totalFaces = original.totalFaces;
|
|
660
662
|
result.startingConstructionStep = original.startingConstructionStep;
|
|
661
663
|
result.materials = original.materials;
|
|
@@ -667,7 +669,7 @@
|
|
|
667
669
|
async fetchData( fileName ) {
|
|
668
670
|
|
|
669
671
|
let triedLowerCase = false;
|
|
670
|
-
let locationState =
|
|
672
|
+
let locationState = FILE_LOCATION_TRY_PARTS;
|
|
671
673
|
|
|
672
674
|
while ( locationState !== FILE_LOCATION_NOT_FOUND ) {
|
|
673
675
|
|
|
@@ -711,7 +713,7 @@
|
|
|
711
713
|
fileName = fileName.toLowerCase();
|
|
712
714
|
subobjectURL = fileName;
|
|
713
715
|
triedLowerCase = true;
|
|
714
|
-
locationState =
|
|
716
|
+
locationState = FILE_LOCATION_TRY_PARTS;
|
|
715
717
|
|
|
716
718
|
}
|
|
717
719
|
|
|
@@ -761,6 +763,7 @@
|
|
|
761
763
|
let type = 'Model';
|
|
762
764
|
let category = null;
|
|
763
765
|
let keywords = null;
|
|
766
|
+
let author = null;
|
|
764
767
|
let totalFaces = 0; // split into lines
|
|
765
768
|
|
|
766
769
|
if ( text.indexOf( '\r\n' ) !== - 1 ) {
|
|
@@ -936,6 +939,10 @@
|
|
|
936
939
|
startingConstructionStep = true;
|
|
937
940
|
break;
|
|
938
941
|
|
|
942
|
+
case 'Author:':
|
|
943
|
+
author = lp.getToken();
|
|
944
|
+
break;
|
|
945
|
+
|
|
939
946
|
default:
|
|
940
947
|
// Other meta directives are not implemented
|
|
941
948
|
break;
|
|
@@ -1141,6 +1148,7 @@
|
|
|
1141
1148
|
type,
|
|
1142
1149
|
category,
|
|
1143
1150
|
keywords,
|
|
1151
|
+
author,
|
|
1144
1152
|
subobjects,
|
|
1145
1153
|
totalFaces,
|
|
1146
1154
|
startingConstructionStep,
|
|
@@ -1277,6 +1285,9 @@
|
|
|
1277
1285
|
const group = new THREE.Group();
|
|
1278
1286
|
group.userData.category = info.category;
|
|
1279
1287
|
group.userData.keywords = info.keywords;
|
|
1288
|
+
group.userData.author = info.author;
|
|
1289
|
+
group.userData.type = info.type;
|
|
1290
|
+
group.userData.fileName = info.fileName;
|
|
1280
1291
|
info.group = group;
|
|
1281
1292
|
const subobjectInfos = await Promise.all( promises );
|
|
1282
1293
|
|
|
@@ -1300,6 +1311,7 @@
|
|
|
1300
1311
|
subobjectGroup.userData.startingConstructionStep = subobject.startingConstructionStep;
|
|
1301
1312
|
subobjectGroup.name = subobject.fileName;
|
|
1302
1313
|
loader.applyMaterialsToMesh( subobjectGroup, subobject.colorCode, info.materials );
|
|
1314
|
+
subobjectGroup.userData.colorCode = subobject.colorCode;
|
|
1303
1315
|
group.add( subobjectGroup );
|
|
1304
1316
|
continue;
|
|
1305
1317
|
|
|
@@ -1388,6 +1400,7 @@
|
|
|
1388
1400
|
if ( subobject ) {
|
|
1389
1401
|
|
|
1390
1402
|
loader.applyMaterialsToMesh( group, subobject.colorCode, info.materials );
|
|
1403
|
+
group.userData.colorCode = subobject.colorCode;
|
|
1391
1404
|
|
|
1392
1405
|
}
|
|
1393
1406
|
|
|
@@ -1790,7 +1803,25 @@
|
|
|
1790
1803
|
|
|
1791
1804
|
this.smoothNormals = true; // The path to load parts from the LDraw parts library from.
|
|
1792
1805
|
|
|
1793
|
-
this.partsLibraryPath = '';
|
|
1806
|
+
this.partsLibraryPath = ''; // Material assigned to not available colors for meshes and edges
|
|
1807
|
+
|
|
1808
|
+
this.missingColorMaterial = new THREE.MeshStandardMaterial( {
|
|
1809
|
+
color: 0xFF00FF,
|
|
1810
|
+
roughness: 0.3,
|
|
1811
|
+
metalness: 0
|
|
1812
|
+
} );
|
|
1813
|
+
this.missingColorMaterial.name = 'Missing material';
|
|
1814
|
+
this.missingEdgeColorMaterial = new THREE.LineBasicMaterial( {
|
|
1815
|
+
color: 0xFF00FF
|
|
1816
|
+
} );
|
|
1817
|
+
this.missingEdgeColorMaterial.name = 'Missing material - Edge';
|
|
1818
|
+
this.missingConditionalEdgeColorMaterial = new LDrawConditionalLineMaterial( {
|
|
1819
|
+
fog: true,
|
|
1820
|
+
color: 0xFF00FF
|
|
1821
|
+
} );
|
|
1822
|
+
this.missingConditionalEdgeColorMaterial.name = 'Missing material - Conditional Edge';
|
|
1823
|
+
this.missingColorMaterial.userData.edgeMaterial = this.missingEdgeColorMaterial;
|
|
1824
|
+
this.missingEdgeColorMaterial.userData.conditionalEdgeMaterial = this.missingConditionalEdgeColorMaterial;
|
|
1794
1825
|
|
|
1795
1826
|
}
|
|
1796
1827
|
|
|
@@ -1842,6 +1873,7 @@
|
|
|
1842
1873
|
|
|
1843
1874
|
this.applyMaterialsToMesh( group, MAIN_COLOUR_CODE, this.materialLibrary, true );
|
|
1844
1875
|
this.computeConstructionSteps( group );
|
|
1876
|
+
group.userData.fileName = url;
|
|
1845
1877
|
onLoad( group );
|
|
1846
1878
|
|
|
1847
1879
|
} ).catch( onError );
|
|
@@ -1854,7 +1886,9 @@
|
|
|
1854
1886
|
|
|
1855
1887
|
this.partsCache.parseModel( text, this.materialLibrary ).then( group => {
|
|
1856
1888
|
|
|
1889
|
+
this.applyMaterialsToMesh( group, MAIN_COLOUR_CODE, this.materialLibrary, true );
|
|
1857
1890
|
this.computeConstructionSteps( group );
|
|
1891
|
+
group.userData.fileName = '';
|
|
1858
1892
|
onLoad( group );
|
|
1859
1893
|
|
|
1860
1894
|
} );
|
|
@@ -1984,8 +2018,10 @@
|
|
|
1984
2018
|
|
|
1985
2019
|
if ( material === null ) {
|
|
1986
2020
|
|
|
1987
|
-
// otherwise throw
|
|
1988
|
-
|
|
2021
|
+
// otherwise throw a warning if this is final opportunity to set the material
|
|
2022
|
+
console.warn( `LDrawLoader: Material properties for code ${colorCode} not available.` ); // And return the 'missing color' material
|
|
2023
|
+
|
|
2024
|
+
material = loader.missingColorMaterial;
|
|
1989
2025
|
|
|
1990
2026
|
}
|
|
1991
2027
|
|
|
@@ -2021,8 +2057,8 @@
|
|
|
2021
2057
|
|
|
2022
2058
|
getMainEdgeMaterial() {
|
|
2023
2059
|
|
|
2024
|
-
const
|
|
2025
|
-
return
|
|
2060
|
+
const mat = this.getMaterial( MAIN_EDGE_COLOUR_CODE );
|
|
2061
|
+
return mat ? mat.userData.edgeMaterial : null;
|
|
2026
2062
|
|
|
2027
2063
|
}
|
|
2028
2064
|
|
|
@@ -2061,110 +2097,111 @@
|
|
|
2061
2097
|
|
|
2062
2098
|
}
|
|
2063
2099
|
|
|
2064
|
-
|
|
2100
|
+
if ( ! parseLuminance( token ) ) {
|
|
2065
2101
|
|
|
2066
|
-
|
|
2067
|
-
code = lineParser.getToken();
|
|
2068
|
-
break;
|
|
2102
|
+
switch ( token.toUpperCase() ) {
|
|
2069
2103
|
|
|
2070
|
-
|
|
2071
|
-
|
|
2104
|
+
case 'CODE':
|
|
2105
|
+
code = lineParser.getToken();
|
|
2106
|
+
break;
|
|
2072
2107
|
|
|
2073
|
-
|
|
2108
|
+
case 'VALUE':
|
|
2109
|
+
color = lineParser.getToken();
|
|
2074
2110
|
|
|
2075
|
-
|
|
2111
|
+
if ( color.startsWith( '0x' ) ) {
|
|
2076
2112
|
|
|
2077
|
-
|
|
2113
|
+
color = '#' + color.substring( 2 );
|
|
2078
2114
|
|
|
2079
|
-
|
|
2115
|
+
} else if ( ! color.startsWith( '#' ) ) {
|
|
2080
2116
|
|
|
2081
|
-
|
|
2117
|
+
throw new Error( 'LDrawLoader: Invalid color while parsing material' + lineParser.getLineNumberString() + '.' );
|
|
2082
2118
|
|
|
2083
|
-
|
|
2119
|
+
}
|
|
2084
2120
|
|
|
2085
|
-
|
|
2086
|
-
edgeColor = lineParser.getToken();
|
|
2121
|
+
break;
|
|
2087
2122
|
|
|
2088
|
-
|
|
2123
|
+
case 'EDGE':
|
|
2124
|
+
edgeColor = lineParser.getToken();
|
|
2089
2125
|
|
|
2090
|
-
|
|
2126
|
+
if ( edgeColor.startsWith( '0x' ) ) {
|
|
2091
2127
|
|
|
2092
|
-
|
|
2128
|
+
edgeColor = '#' + edgeColor.substring( 2 );
|
|
2093
2129
|
|
|
2094
|
-
|
|
2095
|
-
edgeMaterial = this.getMaterial( edgeColor );
|
|
2130
|
+
} else if ( ! edgeColor.startsWith( '#' ) ) {
|
|
2096
2131
|
|
|
2097
|
-
|
|
2132
|
+
// Try to see if edge color is a color code
|
|
2133
|
+
edgeMaterial = this.getMaterial( edgeColor );
|
|
2098
2134
|
|
|
2099
|
-
|
|
2135
|
+
if ( ! edgeMaterial ) {
|
|
2100
2136
|
|
|
2101
|
-
|
|
2137
|
+
throw new Error( 'LDrawLoader: Invalid edge color while parsing material' + lineParser.getLineNumberString() + '.' );
|
|
2102
2138
|
|
|
2139
|
+
} // Get the edge material for this triangle material
|
|
2103
2140
|
|
|
2104
|
-
edgeMaterial = edgeMaterial.userData.edgeMaterial;
|
|
2105
2141
|
|
|
2106
|
-
|
|
2142
|
+
edgeMaterial = edgeMaterial.userData.edgeMaterial;
|
|
2107
2143
|
|
|
2108
|
-
|
|
2144
|
+
}
|
|
2109
2145
|
|
|
2110
|
-
|
|
2111
|
-
alpha = parseInt( lineParser.getToken() );
|
|
2146
|
+
break;
|
|
2112
2147
|
|
|
2113
|
-
|
|
2148
|
+
case 'ALPHA':
|
|
2149
|
+
alpha = parseInt( lineParser.getToken() );
|
|
2114
2150
|
|
|
2115
|
-
|
|
2151
|
+
if ( isNaN( alpha ) ) {
|
|
2116
2152
|
|
|
2117
|
-
|
|
2153
|
+
throw new Error( 'LDrawLoader: Invalid alpha value in material definition' + lineParser.getLineNumberString() + '.' );
|
|
2118
2154
|
|
|
2119
|
-
|
|
2155
|
+
}
|
|
2120
2156
|
|
|
2121
|
-
|
|
2157
|
+
alpha = Math.max( 0, Math.min( 1, alpha / 255 ) );
|
|
2122
2158
|
|
|
2123
|
-
|
|
2159
|
+
if ( alpha < 1 ) {
|
|
2124
2160
|
|
|
2125
|
-
|
|
2161
|
+
isTransparent = true;
|
|
2126
2162
|
|
|
2127
|
-
|
|
2163
|
+
}
|
|
2128
2164
|
|
|
2129
|
-
|
|
2130
|
-
luminance = parseInt( lineParser.getToken() );
|
|
2165
|
+
break;
|
|
2131
2166
|
|
|
2132
|
-
|
|
2167
|
+
case 'LUMINANCE':
|
|
2168
|
+
if ( ! parseLuminance( lineParser.getToken() ) ) {
|
|
2133
2169
|
|
|
2134
|
-
|
|
2170
|
+
throw new Error( 'LDrawLoader: Invalid luminance value in material definition' + LineParser.getLineNumberString() + '.' );
|
|
2135
2171
|
|
|
2136
|
-
|
|
2172
|
+
}
|
|
2137
2173
|
|
|
2138
|
-
|
|
2139
|
-
break;
|
|
2174
|
+
break;
|
|
2140
2175
|
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2176
|
+
case 'CHROME':
|
|
2177
|
+
finishType = FINISH_TYPE_CHROME;
|
|
2178
|
+
break;
|
|
2144
2179
|
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2180
|
+
case 'PEARLESCENT':
|
|
2181
|
+
finishType = FINISH_TYPE_PEARLESCENT;
|
|
2182
|
+
break;
|
|
2148
2183
|
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2184
|
+
case 'RUBBER':
|
|
2185
|
+
finishType = FINISH_TYPE_RUBBER;
|
|
2186
|
+
break;
|
|
2152
2187
|
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2188
|
+
case 'MATTE_METALLIC':
|
|
2189
|
+
finishType = FINISH_TYPE_MATTE_METALLIC;
|
|
2190
|
+
break;
|
|
2156
2191
|
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2192
|
+
case 'METAL':
|
|
2193
|
+
finishType = FINISH_TYPE_METAL;
|
|
2194
|
+
break;
|
|
2160
2195
|
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2196
|
+
case 'MATERIAL':
|
|
2197
|
+
// Not implemented
|
|
2198
|
+
lineParser.setToEnd();
|
|
2199
|
+
break;
|
|
2165
2200
|
|
|
2166
|
-
|
|
2167
|
-
|
|
2201
|
+
default:
|
|
2202
|
+
throw new Error( 'LDrawLoader: Unknown token "' + token + '" while parsing material' + lineParser.getLineNumberString() + '.' );
|
|
2203
|
+
|
|
2204
|
+
}
|
|
2168
2205
|
|
|
2169
2206
|
}
|
|
2170
2207
|
|
|
@@ -2268,6 +2305,8 @@
|
|
|
2268
2305
|
opacity: alpha
|
|
2269
2306
|
} );
|
|
2270
2307
|
edgeMaterial.userData.conditionalEdgeMaterial.color.convertSRGBToLinear();
|
|
2308
|
+
edgeMaterial.userData.conditionalEdgeMaterial.userData.code = code;
|
|
2309
|
+
edgeMaterial.userData.conditionalEdgeMaterial.name = name + ' - Conditional Edge';
|
|
2271
2310
|
|
|
2272
2311
|
}
|
|
2273
2312
|
|
|
@@ -2277,6 +2316,32 @@
|
|
|
2277
2316
|
this.addMaterial( material );
|
|
2278
2317
|
return material;
|
|
2279
2318
|
|
|
2319
|
+
function parseLuminance( token ) {
|
|
2320
|
+
|
|
2321
|
+
// Returns success
|
|
2322
|
+
let lum;
|
|
2323
|
+
|
|
2324
|
+
if ( token.startsWith( 'LUMINANCE' ) ) {
|
|
2325
|
+
|
|
2326
|
+
lum = parseInt( token.substring( 9 ) );
|
|
2327
|
+
|
|
2328
|
+
} else {
|
|
2329
|
+
|
|
2330
|
+
lum = parseInt( token );
|
|
2331
|
+
|
|
2332
|
+
}
|
|
2333
|
+
|
|
2334
|
+
if ( isNaN( lum ) ) {
|
|
2335
|
+
|
|
2336
|
+
return false;
|
|
2337
|
+
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2340
|
+
luminance = Math.max( 0, Math.min( 1, lum / 255 ) );
|
|
2341
|
+
return true;
|
|
2342
|
+
|
|
2343
|
+
}
|
|
2344
|
+
|
|
2280
2345
|
}
|
|
2281
2346
|
|
|
2282
2347
|
computeConstructionSteps( model ) {
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
const _material_use_pattern = /^usemtl /; // usemap map_name
|
|
8
8
|
|
|
9
9
|
const _map_use_pattern = /^usemap /;
|
|
10
|
+
const _face_vertex_data_separator_pattern = /\s+/;
|
|
10
11
|
|
|
11
12
|
const _vA = new THREE.Vector3();
|
|
12
13
|
|
|
@@ -438,26 +439,19 @@
|
|
|
438
439
|
}
|
|
439
440
|
|
|
440
441
|
const lines = text.split( '\n' );
|
|
441
|
-
let
|
|
442
|
-
lineFirstChar = '';
|
|
443
|
-
let lineLength = 0;
|
|
444
|
-
let result = []; // Faster to just trim left side of the line. Use if available.
|
|
445
|
-
|
|
446
|
-
const trimLeft = typeof ''.trimLeft === 'function';
|
|
442
|
+
let result = [];
|
|
447
443
|
|
|
448
444
|
for ( let i = 0, l = lines.length; i < l; i ++ ) {
|
|
449
445
|
|
|
450
|
-
line = lines[ i ];
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
if ( lineLength === 0 ) continue;
|
|
454
|
-
lineFirstChar = line.charAt( 0 ); // @todo invoke passed in handler if any
|
|
446
|
+
const line = lines[ i ].trimStart();
|
|
447
|
+
if ( line.length === 0 ) continue;
|
|
448
|
+
const lineFirstChar = line.charAt( 0 ); // @todo invoke passed in handler if any
|
|
455
449
|
|
|
456
450
|
if ( lineFirstChar === '#' ) continue;
|
|
457
451
|
|
|
458
452
|
if ( lineFirstChar === 'v' ) {
|
|
459
453
|
|
|
460
|
-
const data = line.split(
|
|
454
|
+
const data = line.split( _face_vertex_data_separator_pattern );
|
|
461
455
|
|
|
462
456
|
switch ( data[ 0 ] ) {
|
|
463
457
|
|
|
@@ -492,7 +486,7 @@
|
|
|
492
486
|
} else if ( lineFirstChar === 'f' ) {
|
|
493
487
|
|
|
494
488
|
const lineData = line.slice( 1 ).trim();
|
|
495
|
-
const vertexData = lineData.split(
|
|
489
|
+
const vertexData = lineData.split( _face_vertex_data_separator_pattern );
|
|
496
490
|
const faceVertices = []; // Parse the face vertex data into an easy to work with format
|
|
497
491
|
|
|
498
492
|
for ( let j = 0, jl = vertexData.length; j < jl; j ++ ) {
|