super-three 0.152.0 → 0.154.1
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.cjs +778 -557
- package/build/three.js +778 -557
- package/build/three.min.js +1 -1
- package/build/three.module.js +769 -539
- package/build/three.module.min.js +1 -1
- package/examples/jsm/cameras/CinematicCamera.js +1 -2
- package/examples/jsm/capabilities/WebGPU.js +15 -1
- package/examples/jsm/controls/ArcballControls.js +2 -1
- package/examples/jsm/controls/FlyControls.js +25 -9
- package/examples/jsm/controls/OrbitControls.js +5 -1
- package/examples/jsm/csm/CSM.js +1 -3
- package/examples/jsm/effects/AnaglyphEffect.js +6 -20
- package/examples/jsm/effects/OutlineEffect.js +1 -1
- package/examples/jsm/effects/ParallaxBarrierEffect.js +3 -0
- package/examples/jsm/environments/RoomEnvironment.js +6 -2
- package/examples/jsm/exporters/GLTFExporter.js +74 -2
- package/examples/jsm/exporters/USDZExporter.js +170 -129
- package/examples/jsm/helpers/ViewHelper.js +1 -1
- package/examples/jsm/lines/LineMaterial.js +1 -1
- package/examples/jsm/loaders/3DMLoader.js +1 -1
- package/examples/jsm/loaders/3MFLoader.js +5 -1
- package/examples/jsm/loaders/AMFLoader.js +5 -1
- package/examples/jsm/loaders/ColladaLoader.js +4 -1
- package/examples/jsm/loaders/DRACOLoader.js +2 -0
- package/examples/jsm/loaders/FBXLoader.js +9 -2
- package/examples/jsm/loaders/GLTFLoader.js +230 -94
- package/examples/jsm/loaders/KTX2Loader.js +106 -47
- package/examples/jsm/loaders/LDrawLoader.js +4 -7
- package/examples/jsm/loaders/MMDLoader.js +40 -13
- package/examples/jsm/loaders/PCDLoader.js +25 -10
- package/examples/jsm/loaders/PDBLoader.js +7 -2
- package/examples/jsm/loaders/PLYLoader.js +30 -8
- package/examples/jsm/loaders/STLLoader.js +8 -3
- package/examples/jsm/loaders/VRMLLoader.js +55 -7
- package/examples/jsm/loaders/VTKLoader.js +12 -4
- package/examples/jsm/loaders/XYZLoader.js +9 -3
- package/examples/jsm/materials/MeshGouraudMaterial.js +2 -2
- package/examples/jsm/math/Lut.js +5 -4
- package/examples/jsm/math/MeshSurfaceSampler.js +82 -37
- package/examples/jsm/misc/GPUComputationRenderer.js +1 -0
- package/examples/jsm/misc/VolumeSlice.js +3 -1
- package/examples/jsm/nodes/Nodes.js +22 -16
- package/examples/jsm/nodes/accessors/BufferAttributeNode.js +99 -0
- package/examples/jsm/nodes/accessors/BufferNode.js +2 -2
- package/examples/jsm/nodes/accessors/CameraNode.js +25 -4
- package/examples/jsm/nodes/accessors/ExtendedMaterialNode.js +7 -1
- package/examples/jsm/nodes/accessors/InstanceNode.js +29 -12
- package/examples/jsm/nodes/accessors/MaterialNode.js +55 -47
- package/examples/jsm/nodes/accessors/MaterialReferenceNode.js +2 -2
- package/examples/jsm/nodes/accessors/ModelNode.js +3 -1
- package/examples/jsm/nodes/accessors/ModelViewProjectionNode.js +4 -9
- package/examples/jsm/nodes/accessors/MorphNode.js +70 -0
- package/examples/jsm/nodes/accessors/NormalNode.js +3 -2
- package/examples/jsm/nodes/accessors/Object3DNode.js +10 -2
- package/examples/jsm/nodes/accessors/ReferenceNode.js +2 -2
- package/examples/jsm/nodes/accessors/SceneNode.js +46 -0
- package/examples/jsm/nodes/accessors/SkinningNode.js +43 -62
- package/examples/jsm/nodes/accessors/StorageBufferNode.js +2 -2
- package/examples/jsm/nodes/accessors/TangentNode.js +2 -2
- package/examples/jsm/nodes/accessors/TextureBicubicNode.js +94 -0
- package/examples/jsm/nodes/accessors/TextureNode.js +68 -6
- package/examples/jsm/nodes/accessors/TextureSizeNode.js +35 -0
- package/examples/jsm/nodes/accessors/UVNode.js +1 -1
- package/examples/jsm/nodes/code/CodeNode.js +3 -0
- package/examples/jsm/nodes/code/FunctionNode.js +25 -4
- package/examples/jsm/nodes/core/AttributeNode.js +1 -1
- package/examples/jsm/nodes/core/BypassNode.js +2 -2
- package/examples/jsm/nodes/core/ContextNode.js +2 -0
- package/examples/jsm/nodes/core/IndexNode.js +66 -0
- package/examples/jsm/nodes/core/LightingModel.js +2 -1
- package/examples/jsm/nodes/core/Node.js +13 -16
- package/examples/jsm/nodes/core/NodeAttribute.js +2 -1
- package/examples/jsm/nodes/core/NodeBuilder.js +86 -8
- package/examples/jsm/nodes/core/NodeUtils.js +10 -0
- package/examples/jsm/nodes/core/PropertyNode.js +6 -2
- package/examples/jsm/nodes/core/StackNode.js +8 -1
- package/examples/jsm/nodes/core/UniformNode.js +1 -1
- package/examples/jsm/nodes/core/VarNode.js +1 -3
- package/examples/jsm/nodes/display/BlendModeNode.js +9 -9
- package/examples/jsm/nodes/display/ColorAdjustmentNode.js +7 -7
- package/examples/jsm/nodes/display/ColorSpaceNode.js +50 -49
- package/examples/jsm/nodes/display/NormalMapNode.js +3 -3
- package/examples/jsm/nodes/display/ToneMappingNode.js +24 -15
- package/examples/jsm/nodes/display/ViewportDepthNode.js +69 -0
- package/examples/jsm/nodes/display/ViewportDepthTextureNode.js +34 -0
- package/examples/jsm/nodes/display/ViewportSharedTextureNode.js +7 -6
- package/examples/jsm/nodes/display/ViewportTextureNode.js +33 -19
- package/examples/jsm/nodes/functions/BSDF/BRDF_BlinnPhong.js +5 -5
- package/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js +10 -8
- package/examples/jsm/nodes/functions/BSDF/BRDF_Lambert.js +2 -2
- package/examples/jsm/nodes/functions/BSDF/BRDF_Sheen.js +43 -0
- package/examples/jsm/nodes/functions/BSDF/DFGApprox.js +4 -4
- package/examples/jsm/nodes/functions/BSDF/D_GGX.js +2 -2
- package/examples/jsm/nodes/functions/BSDF/EnvironmentBRDF.js +13 -0
- package/examples/jsm/nodes/functions/BSDF/F_Schlick.js +2 -4
- package/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +2 -2
- package/examples/jsm/nodes/functions/PhongLightingModel.js +7 -7
- package/examples/jsm/nodes/functions/PhysicalLightingModel.js +132 -19
- package/examples/jsm/nodes/functions/material/getGeometryRoughness.js +2 -2
- package/examples/jsm/nodes/functions/material/getRoughness.js +3 -3
- package/examples/jsm/nodes/geometry/RangeNode.js +33 -51
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +6 -3
- package/examples/jsm/nodes/lighting/DirectionalLightNode.js +2 -2
- package/examples/jsm/nodes/lighting/EnvironmentNode.js +107 -62
- package/examples/jsm/nodes/lighting/HemisphereLightNode.js +2 -2
- package/examples/jsm/nodes/lighting/LightUtils.js +2 -2
- package/examples/jsm/nodes/lighting/LightingContextNode.js +17 -15
- package/examples/jsm/nodes/lighting/PointLightNode.js +3 -3
- package/examples/jsm/nodes/lighting/SpotLightNode.js +3 -3
- package/examples/jsm/nodes/materials/LineBasicNodeMaterial.js +0 -15
- package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +0 -15
- package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +0 -10
- package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +0 -9
- package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +41 -0
- package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +1 -14
- package/examples/jsm/nodes/materials/NodeMaterial.js +119 -29
- package/examples/jsm/nodes/materials/PointsNodeMaterial.js +0 -9
- package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +0 -7
- package/examples/jsm/nodes/materialx/lib/mx_hsv.js +3 -3
- package/examples/jsm/nodes/materialx/lib/mx_noise.js +14 -14
- package/examples/jsm/nodes/materialx/lib/mx_transform_color.js +4 -4
- package/examples/jsm/nodes/math/MathNode.js +6 -0
- package/examples/jsm/nodes/math/OperatorNode.js +1 -1
- package/examples/jsm/nodes/procedural/CheckerNode.js +3 -3
- package/examples/jsm/nodes/shadernode/ShaderNode.js +60 -33
- package/examples/jsm/nodes/utils/EquirectUVNode.js +2 -3
- package/examples/jsm/nodes/utils/LoopNode.js +186 -0
- package/examples/jsm/nodes/utils/TriplanarTexturesNode.js +1 -1
- package/examples/jsm/objects/GroundProjectedSkybox.js +1 -1
- package/examples/jsm/objects/Lensflare.js +3 -4
- package/examples/jsm/objects/MarchingCubes.js +5 -1
- package/examples/jsm/objects/Reflector.js +4 -1
- package/examples/jsm/objects/Refractor.js +1 -1
- package/examples/jsm/objects/Sky.js +1 -1
- package/examples/jsm/objects/Water.js +2 -1
- package/examples/jsm/objects/Water2.js +1 -1
- package/examples/jsm/offscreen/scene.js +1 -0
- package/examples/jsm/physics/RapierPhysics.js +93 -133
- package/examples/jsm/postprocessing/AfterimagePass.js +3 -0
- package/examples/jsm/postprocessing/BloomPass.js +7 -2
- package/examples/jsm/postprocessing/BokehPass.js +3 -2
- package/examples/jsm/postprocessing/DotScreenPass.js +1 -0
- package/examples/jsm/postprocessing/EffectComposer.js +4 -1
- package/examples/jsm/postprocessing/FilmPass.js +1 -0
- package/examples/jsm/postprocessing/OutlinePass.js +8 -9
- package/examples/jsm/postprocessing/OutputPass.js +72 -0
- package/examples/jsm/postprocessing/RenderPixelatedPass.js +4 -3
- package/examples/jsm/postprocessing/SAOPass.js +4 -2
- package/examples/jsm/postprocessing/SMAAPass.js +5 -2
- package/examples/jsm/postprocessing/SSAARenderPass.js +5 -13
- package/examples/jsm/postprocessing/SSAOPass.js +4 -2
- package/examples/jsm/postprocessing/SSRPass.js +3 -1
- package/examples/jsm/postprocessing/SavePass.js +5 -2
- package/examples/jsm/postprocessing/ShaderPass.js +1 -0
- package/examples/jsm/postprocessing/TAARenderPass.js +17 -4
- package/examples/jsm/postprocessing/TexturePass.js +2 -1
- package/examples/jsm/postprocessing/UnrealBloomPass.js +13 -13
- package/examples/jsm/renderers/{webgpu/WebGPUAnimation.js → common/Animation.js} +2 -2
- package/examples/jsm/renderers/common/Attributes.js +75 -0
- package/examples/jsm/renderers/common/Backend.js +162 -0
- package/examples/jsm/renderers/common/Background.js +134 -0
- package/examples/jsm/renderers/common/Binding.js +11 -0
- package/examples/jsm/renderers/common/Bindings.js +169 -0
- package/examples/jsm/renderers/common/Buffer.js +38 -0
- package/examples/jsm/renderers/{webgpu/WebGPUBufferUtils.js → common/BufferUtils.js} +2 -2
- package/examples/jsm/renderers/{webgpu/WebGPUWeakMap.js → common/ChainMap.js} +11 -5
- package/examples/jsm/renderers/common/ComputePipeline.js +17 -0
- package/examples/jsm/renderers/common/Constants.js +14 -0
- package/examples/jsm/renderers/common/CubeRenderTarget.js +65 -0
- package/examples/jsm/renderers/common/DataMap.js +54 -0
- package/examples/jsm/renderers/{webgpu/WebGPUGeometries.js → common/Geometries.js} +38 -37
- package/examples/jsm/renderers/{webgpu/WebGPUInfo.js → common/Info.js} +2 -3
- package/examples/jsm/renderers/common/Pipeline.js +13 -0
- package/examples/jsm/renderers/common/Pipelines.js +321 -0
- package/examples/jsm/renderers/common/ProgrammableStage.js +18 -0
- package/examples/jsm/renderers/common/RenderContext.js +37 -0
- package/examples/jsm/renderers/common/RenderContexts.js +38 -0
- package/examples/jsm/renderers/{webgpu/WebGPURenderLists.js → common/RenderList.js} +2 -39
- package/examples/jsm/renderers/common/RenderLists.js +38 -0
- package/examples/jsm/renderers/common/RenderObject.js +113 -0
- package/examples/jsm/renderers/common/RenderObjects.js +92 -0
- package/examples/jsm/renderers/common/RenderPipeline.js +16 -0
- package/examples/jsm/renderers/{webgpu/WebGPURenderTarget.js → common/RenderTarget.js} +2 -2
- package/examples/jsm/renderers/common/Renderer.js +864 -0
- package/examples/jsm/renderers/common/SampledTexture.js +80 -0
- package/examples/jsm/renderers/common/Sampler.js +18 -0
- package/examples/jsm/renderers/common/StorageBuffer.js +17 -0
- package/examples/jsm/renderers/common/Textures.js +206 -0
- package/examples/jsm/renderers/{webgpu/WebGPUUniform.js → common/Uniform.js} +13 -9
- package/examples/jsm/renderers/common/UniformBuffer.js +15 -0
- package/examples/jsm/renderers/{webgpu/WebGPUUniformsGroup.js → common/UniformsGroup.js} +13 -13
- package/examples/jsm/renderers/{webgpu/nodes/WebGPUNodes.js → common/nodes/NodeRender.js} +3 -3
- package/examples/jsm/renderers/{webgpu/nodes/WebGPUNodeSampledTexture.js → common/nodes/NodeSampledTexture.js} +4 -4
- package/examples/jsm/renderers/{webgpu/nodes/WebGPUNodeSampler.js → common/nodes/NodeSampler.js} +3 -3
- package/examples/jsm/renderers/{webgpu/nodes/WebGPUNodeUniform.js → common/nodes/NodeUniform.js} +1 -1
- package/examples/jsm/renderers/common/nodes/Nodes.js +319 -0
- package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +340 -0
- package/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js +23 -19
- package/examples/jsm/renderers/webgpu/WebGPUBackend.js +847 -0
- package/examples/jsm/renderers/webgpu/WebGPURenderer.js +15 -1131
- package/examples/jsm/renderers/webgpu/nodes/{WebGPUNodeBuilder.js → WGSLNodeBuilder.js} +75 -45
- package/examples/jsm/{nodes/parsers → renderers/webgpu/nodes}/WGSLNodeFunction.js +2 -2
- package/examples/jsm/{nodes/parsers → renderers/webgpu/nodes}/WGSLNodeParser.js +1 -1
- package/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +255 -0
- package/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +145 -0
- package/examples/jsm/renderers/webgpu/{constants.js → utils/WebGPUConstants.js} +6 -7
- package/examples/jsm/renderers/webgpu/{WebGPURenderPipeline.js → utils/WebGPUPipelineUtils.js} +154 -247
- package/examples/jsm/renderers/webgpu/{WebGPUTextureUtils.js → utils/WebGPUTextureMipmapUtils.js} +3 -25
- package/examples/jsm/renderers/webgpu/{WebGPUTextures.js → utils/WebGPUTextureUtils.js} +392 -505
- package/examples/jsm/renderers/webgpu/utils/WebGPUUtils.js +92 -0
- package/examples/jsm/shaders/BleachBypassShader.js +2 -0
- package/examples/jsm/shaders/BlendShader.js +1 -2
- package/examples/jsm/shaders/BokehShader2.js +3 -0
- package/examples/jsm/shaders/ColorifyShader.js +2 -0
- package/examples/jsm/shaders/ConvolutionShader.js +2 -0
- package/examples/jsm/shaders/CopyShader.js +4 -2
- package/examples/jsm/shaders/DotScreenShader.js +2 -0
- package/examples/jsm/shaders/ExposureShader.js +44 -0
- package/examples/jsm/shaders/FilmShader.js +2 -0
- package/examples/jsm/shaders/GammaCorrectionShader.js +2 -0
- package/examples/jsm/shaders/HorizontalBlurShader.js +2 -0
- package/examples/jsm/shaders/OutputShader.js +61 -0
- package/examples/jsm/shaders/RGBShiftShader.js +2 -0
- package/examples/jsm/shaders/SepiaShader.js +2 -0
- package/examples/jsm/shaders/ToonShader.js +13 -5
- package/examples/jsm/shaders/VerticalBlurShader.js +2 -0
- package/examples/jsm/shaders/VignetteShader.js +2 -0
- package/examples/jsm/shaders/WaterRefractionShader.js +5 -2
- package/examples/jsm/utils/BufferGeometryUtils.js +17 -1
- package/examples/jsm/utils/TextureUtils.js +86 -0
- package/examples/jsm/webxr/OculusHandPointerModel.js +34 -13
- package/examples/jsm/webxr/XRHandPrimitiveModel.js +1 -0
- package/examples/jsm/webxr/XRPlanes.js +100 -0
- package/package.json +3 -1
- package/src/Three.Legacy.js +0 -228
- package/src/audio/PositionalAudio.js +8 -0
- package/src/cameras/Camera.js +5 -0
- package/src/cameras/CubeCamera.js +76 -13
- package/src/cameras/OrthographicCamera.js +1 -1
- package/src/cameras/PerspectiveCamera.js +1 -1
- package/src/constants.js +13 -1
- package/src/core/BufferAttribute.js +3 -25
- package/src/core/BufferGeometry.js +1 -8
- package/src/core/Object3D.js +1 -1
- package/src/extras/core/Curve.js +1 -1
- package/src/loaders/CubeTextureLoader.js +2 -0
- package/src/loaders/Loader.js +2 -0
- package/src/loaders/MaterialLoader.js +5 -0
- package/src/loaders/ObjectLoader.js +1 -0
- package/src/materials/Material.js +13 -1
- package/src/materials/MeshPhysicalMaterial.js +32 -6
- package/src/math/Color.js +16 -11
- package/src/math/Frustum.js +16 -2
- package/src/math/MathUtils.js +16 -0
- package/src/math/Matrix3.js +26 -6
- package/src/math/Matrix4.js +74 -19
- package/src/objects/InstancedMesh.js +3 -0
- package/src/objects/Mesh.js +14 -10
- package/src/objects/Skeleton.js +1 -3
- package/src/objects/SkinnedMesh.js +36 -8
- package/src/renderers/WebGLRenderer.js +126 -21
- package/src/renderers/shaders/ShaderChunk/alphahash_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/alphahash_pars_fragment.glsl.js +68 -0
- package/src/renderers/shaders/ShaderChunk/begin_vertex.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +26 -3
- package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +9 -1
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +26 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +52 -2
- package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +10 -2
- package/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/{output_fragment.glsl.js → opaque_fragment.glsl.js} +1 -2
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +3 -3
- package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +10 -5
- package/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.js +6 -1
- package/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.js +7 -1
- package/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.js +6 -1
- package/src/renderers/shaders/ShaderChunk.js +10 -6
- package/src/renderers/shaders/ShaderLib/background.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/cube.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/distanceRGBA.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/equirect.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/linedashed.glsl.js +2 -2
- package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +4 -2
- package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +4 -2
- package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +4 -2
- package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +4 -2
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +12 -2
- package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +4 -2
- package/src/renderers/shaders/ShaderLib/points.glsl.js +4 -2
- package/src/renderers/shaders/ShaderLib/shadow.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/sprite.glsl.js +4 -2
- package/src/renderers/shaders/ShaderLib.js +4 -1
- package/src/renderers/shaders/UniformsLib.js +2 -0
- package/src/renderers/webgl/WebGLBindingStates.js +13 -5
- package/src/renderers/webgl/WebGLGeometries.js +12 -0
- package/src/renderers/webgl/WebGLInfo.js +0 -1
- package/src/renderers/webgl/WebGLMaterials.js +18 -0
- package/src/renderers/webgl/WebGLObjects.js +23 -3
- package/src/renderers/webgl/WebGLProgram.js +43 -5
- package/src/renderers/webgl/WebGLPrograms.js +19 -7
- package/src/renderers/webgl/WebGLTextures.js +19 -1
- package/src/renderers/webvr/WebVRManager.js +12 -0
- package/src/renderers/webxr/WebXRManager.js +39 -99
- package/src/scenes/Scene.js +0 -14
- package/src/textures/DepthTexture.js +22 -0
- package/src/textures/FramebufferTexture.js +1 -3
- package/src/textures/Source.js +4 -0
- package/src/textures/Texture.js +1 -1
- package/examples/jsm/exporters/ColladaExporter.js +0 -725
- package/examples/jsm/geometries/LightningStrike.js +0 -1017
- package/examples/jsm/loaders/PRWMLoader.js +0 -299
- package/examples/jsm/nodes/core/InstanceIndexNode.js +0 -26
- package/examples/jsm/objects/LightningStorm.js +0 -245
- package/examples/jsm/postprocessing/AdaptiveToneMappingPass.js +0 -361
- package/examples/jsm/renderers/webgpu/WebGPUAttributes.js +0 -197
- package/examples/jsm/renderers/webgpu/WebGPUBackground.js +0 -190
- package/examples/jsm/renderers/webgpu/WebGPUBinding.js +0 -22
- package/examples/jsm/renderers/webgpu/WebGPUBindings.js +0 -270
- package/examples/jsm/renderers/webgpu/WebGPUBuffer.js +0 -43
- package/examples/jsm/renderers/webgpu/WebGPUComputePipelines.js +0 -78
- package/examples/jsm/renderers/webgpu/WebGPUProgrammableStage.js +0 -22
- package/examples/jsm/renderers/webgpu/WebGPUProperties.js +0 -44
- package/examples/jsm/renderers/webgpu/WebGPURenderObject.js +0 -40
- package/examples/jsm/renderers/webgpu/WebGPURenderObjects.js +0 -50
- package/examples/jsm/renderers/webgpu/WebGPURenderPipelines.js +0 -274
- package/examples/jsm/renderers/webgpu/WebGPURenderStates.js +0 -54
- package/examples/jsm/renderers/webgpu/WebGPUSampledTexture.js +0 -75
- package/examples/jsm/renderers/webgpu/WebGPUSampler.js +0 -29
- package/examples/jsm/renderers/webgpu/WebGPUStorageBuffer.js +0 -20
- package/examples/jsm/renderers/webgpu/WebGPUTextureRenderer.js +0 -38
- package/examples/jsm/renderers/webgpu/WebGPUUniformBuffer.js +0 -18
- package/examples/jsm/renderers/webgpu/WebGPUUtils.js +0 -88
- package/examples/jsm/shaders/ToneMapShader.js +0 -73
- /package/src/renderers/shaders/ShaderChunk/{encodings_fragment.glsl.js → colorspace_fragment.glsl.js} +0 -0
- /package/src/renderers/shaders/ShaderChunk/{encodings_pars_fragment.glsl.js → colorspace_pars_fragment.glsl.js} +0 -0
|
@@ -110,6 +110,8 @@ class MaterialLoader extends Loader {
|
|
|
110
110
|
if ( json.thickness !== undefined ) material.thickness = json.thickness;
|
|
111
111
|
if ( json.attenuationDistance !== undefined ) material.attenuationDistance = json.attenuationDistance;
|
|
112
112
|
if ( json.attenuationColor !== undefined && material.attenuationColor !== undefined ) material.attenuationColor.setHex( json.attenuationColor );
|
|
113
|
+
if ( json.anisotropy !== undefined ) material.anisotropy = json.anisotropy;
|
|
114
|
+
if ( json.anisotropyRotation !== undefined ) material.anisotropyRotation = json.anisotropyRotation;
|
|
113
115
|
if ( json.fog !== undefined ) material.fog = json.fog;
|
|
114
116
|
if ( json.flatShading !== undefined ) material.flatShading = json.flatShading;
|
|
115
117
|
if ( json.blending !== undefined ) material.blending = json.blending;
|
|
@@ -119,6 +121,7 @@ class MaterialLoader extends Loader {
|
|
|
119
121
|
if ( json.opacity !== undefined ) material.opacity = json.opacity;
|
|
120
122
|
if ( json.transparent !== undefined ) material.transparent = json.transparent;
|
|
121
123
|
if ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest;
|
|
124
|
+
if ( json.alphaHash !== undefined ) material.alphaHash = json.alphaHash;
|
|
122
125
|
if ( json.depthTest !== undefined ) material.depthTest = json.depthTest;
|
|
123
126
|
if ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite;
|
|
124
127
|
if ( json.colorWrite !== undefined ) material.colorWrite = json.colorWrite;
|
|
@@ -313,6 +316,8 @@ class MaterialLoader extends Loader {
|
|
|
313
316
|
if ( json.transmissionMap !== undefined ) material.transmissionMap = getTexture( json.transmissionMap );
|
|
314
317
|
if ( json.thicknessMap !== undefined ) material.thicknessMap = getTexture( json.thicknessMap );
|
|
315
318
|
|
|
319
|
+
if ( json.anisotropyMap !== undefined ) material.anisotropyMap = getTexture( json.anisotropyMap );
|
|
320
|
+
|
|
316
321
|
if ( json.sheenColorMap !== undefined ) material.sheenColorMap = getTexture( json.sheenColorMap );
|
|
317
322
|
if ( json.sheenRoughnessMap !== undefined ) material.sheenRoughnessMap = getTexture( json.sheenRoughnessMap );
|
|
318
323
|
|
|
@@ -682,6 +682,7 @@ class ObjectLoader extends Loader {
|
|
|
682
682
|
if ( data.generateMipmaps !== undefined ) texture.generateMipmaps = data.generateMipmaps;
|
|
683
683
|
if ( data.premultiplyAlpha !== undefined ) texture.premultiplyAlpha = data.premultiplyAlpha;
|
|
684
684
|
if ( data.unpackAlignment !== undefined ) texture.unpackAlignment = data.unpackAlignment;
|
|
685
|
+
if ( data.compareFunction !== undefined ) texture.compareFunction = data.compareFunction;
|
|
685
686
|
|
|
686
687
|
if ( data.userData !== undefined ) texture.userData = data.userData;
|
|
687
688
|
|
|
@@ -25,6 +25,7 @@ class Material extends EventDispatcher {
|
|
|
25
25
|
|
|
26
26
|
this.opacity = 1;
|
|
27
27
|
this.transparent = false;
|
|
28
|
+
this.alphaHash = false;
|
|
28
29
|
|
|
29
30
|
this.blendSrc = SrcAlphaFactor;
|
|
30
31
|
this.blendDst = OneMinusSrcAlphaFactor;
|
|
@@ -165,7 +166,7 @@ class Material extends EventDispatcher {
|
|
|
165
166
|
|
|
166
167
|
const data = {
|
|
167
168
|
metadata: {
|
|
168
|
-
version: 4.
|
|
169
|
+
version: 4.6,
|
|
169
170
|
type: 'Material',
|
|
170
171
|
generator: 'Material.toJSON'
|
|
171
172
|
}
|
|
@@ -230,6 +231,15 @@ class Material extends EventDispatcher {
|
|
|
230
231
|
|
|
231
232
|
}
|
|
232
233
|
|
|
234
|
+
if ( this.anisotropy !== undefined ) data.anisotropy = this.anisotropy;
|
|
235
|
+
if ( this.anisotropyRotation !== undefined ) data.anisotropyRotation = this.anisotropyRotation;
|
|
236
|
+
|
|
237
|
+
if ( this.anisotropyMap && this.anisotropyMap.isTexture ) {
|
|
238
|
+
|
|
239
|
+
data.anisotropyMap = this.anisotropyMap.toJSON( meta ).uuid;
|
|
240
|
+
|
|
241
|
+
}
|
|
242
|
+
|
|
233
243
|
if ( this.map && this.map.isTexture ) data.map = this.map.toJSON( meta ).uuid;
|
|
234
244
|
if ( this.matcap && this.matcap.isTexture ) data.matcap = this.matcap.toJSON( meta ).uuid;
|
|
235
245
|
if ( this.alphaMap && this.alphaMap.isTexture ) data.alphaMap = this.alphaMap.toJSON( meta ).uuid;
|
|
@@ -344,6 +354,7 @@ class Material extends EventDispatcher {
|
|
|
344
354
|
if ( this.dithering === true ) data.dithering = true;
|
|
345
355
|
|
|
346
356
|
if ( this.alphaTest > 0 ) data.alphaTest = this.alphaTest;
|
|
357
|
+
if ( this.alphaHash === true ) data.alphaHash = this.alphaHash;
|
|
347
358
|
if ( this.alphaToCoverage === true ) data.alphaToCoverage = this.alphaToCoverage;
|
|
348
359
|
if ( this.premultipliedAlpha === true ) data.premultipliedAlpha = this.premultipliedAlpha;
|
|
349
360
|
if ( this.forceSinglePass === true ) data.forceSinglePass = this.forceSinglePass;
|
|
@@ -465,6 +476,7 @@ class Material extends EventDispatcher {
|
|
|
465
476
|
this.dithering = source.dithering;
|
|
466
477
|
|
|
467
478
|
this.alphaTest = source.alphaTest;
|
|
479
|
+
this.alphaHash = source.alphaHash;
|
|
468
480
|
this.alphaToCoverage = source.alphaToCoverage;
|
|
469
481
|
this.premultipliedAlpha = source.premultipliedAlpha;
|
|
470
482
|
this.forceSinglePass = source.forceSinglePass;
|
|
@@ -20,6 +20,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
20
20
|
|
|
21
21
|
this.type = 'MeshPhysicalMaterial';
|
|
22
22
|
|
|
23
|
+
this.anisotropyRotation = 0;
|
|
24
|
+
this.anisotropyMap = null;
|
|
25
|
+
|
|
23
26
|
this.clearcoatMap = null;
|
|
24
27
|
this.clearcoatRoughness = 0.0;
|
|
25
28
|
this.clearcoatRoughnessMap = null;
|
|
@@ -63,30 +66,31 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
63
66
|
this.specularColor = new Color( 1, 1, 1 );
|
|
64
67
|
this.specularColorMap = null;
|
|
65
68
|
|
|
66
|
-
this.
|
|
69
|
+
this._anisotropy = 0;
|
|
67
70
|
this._clearcoat = 0;
|
|
68
71
|
this._iridescence = 0;
|
|
72
|
+
this._sheen = 0.0;
|
|
69
73
|
this._transmission = 0;
|
|
70
74
|
|
|
71
75
|
this.setValues( parameters );
|
|
72
76
|
|
|
73
77
|
}
|
|
74
78
|
|
|
75
|
-
get
|
|
79
|
+
get anisotropy() {
|
|
76
80
|
|
|
77
|
-
return this.
|
|
81
|
+
return this._anisotropy;
|
|
78
82
|
|
|
79
83
|
}
|
|
80
84
|
|
|
81
|
-
set
|
|
85
|
+
set anisotropy( value ) {
|
|
82
86
|
|
|
83
|
-
if ( this.
|
|
87
|
+
if ( this._anisotropy > 0 !== value > 0 ) {
|
|
84
88
|
|
|
85
89
|
this.version ++;
|
|
86
90
|
|
|
87
91
|
}
|
|
88
92
|
|
|
89
|
-
this.
|
|
93
|
+
this._anisotropy = value;
|
|
90
94
|
|
|
91
95
|
}
|
|
92
96
|
|
|
@@ -126,6 +130,24 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
126
130
|
|
|
127
131
|
}
|
|
128
132
|
|
|
133
|
+
get sheen() {
|
|
134
|
+
|
|
135
|
+
return this._sheen;
|
|
136
|
+
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
set sheen( value ) {
|
|
140
|
+
|
|
141
|
+
if ( this._sheen > 0 !== value > 0 ) {
|
|
142
|
+
|
|
143
|
+
this.version ++;
|
|
144
|
+
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
this._sheen = value;
|
|
148
|
+
|
|
149
|
+
}
|
|
150
|
+
|
|
129
151
|
get transmission() {
|
|
130
152
|
|
|
131
153
|
return this._transmission;
|
|
@@ -155,6 +177,10 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
155
177
|
|
|
156
178
|
};
|
|
157
179
|
|
|
180
|
+
this.anisotropy = source.anisotropy;
|
|
181
|
+
this.anisotropyRotation = source.anisotropyRotation;
|
|
182
|
+
this.anisotropyMap = source.anisotropyMap;
|
|
183
|
+
|
|
158
184
|
this.clearcoat = source.clearcoat;
|
|
159
185
|
this.clearcoatMap = source.clearcoatMap;
|
|
160
186
|
this.clearcoatRoughness = source.clearcoatRoughness;
|
package/src/math/Color.js
CHANGED
|
@@ -51,30 +51,35 @@ class Color {
|
|
|
51
51
|
this.g = 1;
|
|
52
52
|
this.b = 1;
|
|
53
53
|
|
|
54
|
+
return this.set( r, g, b );
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
set( r, g, b ) {
|
|
59
|
+
|
|
54
60
|
if ( g === undefined && b === undefined ) {
|
|
55
61
|
|
|
56
62
|
// r is THREE.Color, hex or string
|
|
57
|
-
return this.set( r );
|
|
58
63
|
|
|
59
|
-
|
|
64
|
+
const value = r;
|
|
60
65
|
|
|
61
|
-
|
|
66
|
+
if ( value && value.isColor ) {
|
|
62
67
|
|
|
63
|
-
|
|
68
|
+
this.copy( value );
|
|
64
69
|
|
|
65
|
-
|
|
70
|
+
} else if ( typeof value === 'number' ) {
|
|
66
71
|
|
|
67
|
-
|
|
72
|
+
this.setHex( value );
|
|
68
73
|
|
|
69
|
-
|
|
74
|
+
} else if ( typeof value === 'string' ) {
|
|
70
75
|
|
|
71
|
-
|
|
76
|
+
this.setStyle( value );
|
|
72
77
|
|
|
73
|
-
|
|
78
|
+
}
|
|
74
79
|
|
|
75
|
-
} else
|
|
80
|
+
} else {
|
|
76
81
|
|
|
77
|
-
this.
|
|
82
|
+
this.setRGB( r, g, b );
|
|
78
83
|
|
|
79
84
|
}
|
|
80
85
|
|
package/src/math/Frustum.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { WebGLCoordinateSystem, WebGPUCoordinateSystem } from '../constants.js';
|
|
1
2
|
import { Vector3 } from './Vector3.js';
|
|
2
3
|
import { Sphere } from './Sphere.js';
|
|
3
4
|
import { Plane } from './Plane.js';
|
|
@@ -42,7 +43,7 @@ class Frustum {
|
|
|
42
43
|
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
setFromProjectionMatrix( m ) {
|
|
46
|
+
setFromProjectionMatrix( m, coordinateSystem = WebGLCoordinateSystem ) {
|
|
46
47
|
|
|
47
48
|
const planes = this.planes;
|
|
48
49
|
const me = m.elements;
|
|
@@ -56,7 +57,20 @@ class Frustum {
|
|
|
56
57
|
planes[ 2 ].setComponents( me3 + me1, me7 + me5, me11 + me9, me15 + me13 ).normalize();
|
|
57
58
|
planes[ 3 ].setComponents( me3 - me1, me7 - me5, me11 - me9, me15 - me13 ).normalize();
|
|
58
59
|
planes[ 4 ].setComponents( me3 - me2, me7 - me6, me11 - me10, me15 - me14 ).normalize();
|
|
59
|
-
|
|
60
|
+
|
|
61
|
+
if ( coordinateSystem === WebGLCoordinateSystem ) {
|
|
62
|
+
|
|
63
|
+
planes[ 5 ].setComponents( me3 + me2, me7 + me6, me11 + me10, me15 + me14 ).normalize();
|
|
64
|
+
|
|
65
|
+
} else if ( coordinateSystem === WebGPUCoordinateSystem ) {
|
|
66
|
+
|
|
67
|
+
planes[ 5 ].setComponents( me2, me6, me10, me14 ).normalize();
|
|
68
|
+
|
|
69
|
+
} else {
|
|
70
|
+
|
|
71
|
+
throw new Error( 'THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: ' + coordinateSystem );
|
|
72
|
+
|
|
73
|
+
}
|
|
60
74
|
|
|
61
75
|
return this;
|
|
62
76
|
|
package/src/math/MathUtils.js
CHANGED
|
@@ -235,6 +235,10 @@ function denormalize( value, array ) {
|
|
|
235
235
|
|
|
236
236
|
return value;
|
|
237
237
|
|
|
238
|
+
case Uint32Array:
|
|
239
|
+
|
|
240
|
+
return value / 4294967295.0;
|
|
241
|
+
|
|
238
242
|
case Uint16Array:
|
|
239
243
|
|
|
240
244
|
return value / 65535.0;
|
|
@@ -243,6 +247,10 @@ function denormalize( value, array ) {
|
|
|
243
247
|
|
|
244
248
|
return value / 255.0;
|
|
245
249
|
|
|
250
|
+
case Int32Array:
|
|
251
|
+
|
|
252
|
+
return Math.max( value / 2147483647.0, - 1.0 );
|
|
253
|
+
|
|
246
254
|
case Int16Array:
|
|
247
255
|
|
|
248
256
|
return Math.max( value / 32767.0, - 1.0 );
|
|
@@ -267,6 +275,10 @@ function normalize( value, array ) {
|
|
|
267
275
|
|
|
268
276
|
return value;
|
|
269
277
|
|
|
278
|
+
case Uint32Array:
|
|
279
|
+
|
|
280
|
+
return Math.round( value * 4294967295.0 );
|
|
281
|
+
|
|
270
282
|
case Uint16Array:
|
|
271
283
|
|
|
272
284
|
return Math.round( value * 65535.0 );
|
|
@@ -275,6 +287,10 @@ function normalize( value, array ) {
|
|
|
275
287
|
|
|
276
288
|
return Math.round( value * 255.0 );
|
|
277
289
|
|
|
290
|
+
case Int32Array:
|
|
291
|
+
|
|
292
|
+
return Math.round( value * 2147483647.0 );
|
|
293
|
+
|
|
278
294
|
case Int16Array:
|
|
279
295
|
|
|
280
296
|
return Math.round( value * 32767.0 );
|
package/src/math/Matrix3.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
class Matrix3 {
|
|
2
2
|
|
|
3
|
-
constructor() {
|
|
3
|
+
constructor( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {
|
|
4
4
|
|
|
5
5
|
Matrix3.prototype.isMatrix3 = true;
|
|
6
6
|
|
|
@@ -12,6 +12,12 @@ class Matrix3 {
|
|
|
12
12
|
|
|
13
13
|
];
|
|
14
14
|
|
|
15
|
+
if ( n11 !== undefined ) {
|
|
16
|
+
|
|
17
|
+
this.set( n11, n12, n13, n21, n22, n23, n31, n32, n33 );
|
|
18
|
+
|
|
19
|
+
}
|
|
20
|
+
|
|
15
21
|
}
|
|
16
22
|
|
|
17
23
|
set( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {
|
|
@@ -261,13 +267,27 @@ class Matrix3 {
|
|
|
261
267
|
|
|
262
268
|
makeTranslation( x, y ) {
|
|
263
269
|
|
|
264
|
-
|
|
270
|
+
if ( x.isVector2 ) {
|
|
265
271
|
|
|
266
|
-
|
|
267
|
-
0, 1, y,
|
|
268
|
-
0, 0, 1
|
|
272
|
+
this.set(
|
|
269
273
|
|
|
270
|
-
|
|
274
|
+
1, 0, x.x,
|
|
275
|
+
0, 1, x.y,
|
|
276
|
+
0, 0, 1
|
|
277
|
+
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
} else {
|
|
281
|
+
|
|
282
|
+
this.set(
|
|
283
|
+
|
|
284
|
+
1, 0, x,
|
|
285
|
+
0, 1, y,
|
|
286
|
+
0, 0, 1
|
|
287
|
+
|
|
288
|
+
);
|
|
289
|
+
|
|
290
|
+
}
|
|
271
291
|
|
|
272
292
|
return this;
|
|
273
293
|
|
package/src/math/Matrix4.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { WebGLCoordinateSystem, WebGPUCoordinateSystem } from '../constants.js';
|
|
1
2
|
import { Vector3 } from './Vector3.js';
|
|
2
3
|
|
|
3
4
|
class Matrix4 {
|
|
4
5
|
|
|
5
|
-
constructor() {
|
|
6
|
+
constructor( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {
|
|
6
7
|
|
|
7
8
|
Matrix4.prototype.isMatrix4 = true;
|
|
8
9
|
|
|
@@ -15,6 +16,12 @@ class Matrix4 {
|
|
|
15
16
|
|
|
16
17
|
];
|
|
17
18
|
|
|
19
|
+
if ( n11 !== undefined ) {
|
|
20
|
+
|
|
21
|
+
this.set( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 );
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
18
25
|
}
|
|
19
26
|
|
|
20
27
|
set( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {
|
|
@@ -554,14 +561,29 @@ class Matrix4 {
|
|
|
554
561
|
|
|
555
562
|
makeTranslation( x, y, z ) {
|
|
556
563
|
|
|
557
|
-
|
|
564
|
+
if ( x.isVector3 ) {
|
|
558
565
|
|
|
559
|
-
|
|
560
|
-
0, 1, 0, y,
|
|
561
|
-
0, 0, 1, z,
|
|
562
|
-
0, 0, 0, 1
|
|
566
|
+
this.set(
|
|
563
567
|
|
|
564
|
-
|
|
568
|
+
1, 0, 0, x.x,
|
|
569
|
+
0, 1, 0, x.y,
|
|
570
|
+
0, 0, 1, x.z,
|
|
571
|
+
0, 0, 0, 1
|
|
572
|
+
|
|
573
|
+
);
|
|
574
|
+
|
|
575
|
+
} else {
|
|
576
|
+
|
|
577
|
+
this.set(
|
|
578
|
+
|
|
579
|
+
1, 0, 0, x,
|
|
580
|
+
0, 1, 0, y,
|
|
581
|
+
0, 0, 1, z,
|
|
582
|
+
0, 0, 0, 1
|
|
583
|
+
|
|
584
|
+
);
|
|
585
|
+
|
|
586
|
+
}
|
|
565
587
|
|
|
566
588
|
return this;
|
|
567
589
|
|
|
@@ -752,7 +774,7 @@ class Matrix4 {
|
|
|
752
774
|
|
|
753
775
|
}
|
|
754
776
|
|
|
755
|
-
makePerspective( left, right, top, bottom, near, far ) {
|
|
777
|
+
makePerspective( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem ) {
|
|
756
778
|
|
|
757
779
|
const te = this.elements;
|
|
758
780
|
const x = 2 * near / ( right - left );
|
|
@@ -760,19 +782,35 @@ class Matrix4 {
|
|
|
760
782
|
|
|
761
783
|
const a = ( right + left ) / ( right - left );
|
|
762
784
|
const b = ( top + bottom ) / ( top - bottom );
|
|
763
|
-
const c = - ( far + near ) / ( far - near );
|
|
764
|
-
const d = - 2 * far * near / ( far - near );
|
|
765
785
|
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
786
|
+
let c, d;
|
|
787
|
+
|
|
788
|
+
if ( coordinateSystem === WebGLCoordinateSystem ) {
|
|
789
|
+
|
|
790
|
+
c = - ( far + near ) / ( far - near );
|
|
791
|
+
d = ( - 2 * far * near ) / ( far - near );
|
|
792
|
+
|
|
793
|
+
} else if ( coordinateSystem === WebGPUCoordinateSystem ) {
|
|
794
|
+
|
|
795
|
+
c = - far / ( far - near );
|
|
796
|
+
d = ( - far * near ) / ( far - near );
|
|
797
|
+
|
|
798
|
+
} else {
|
|
799
|
+
|
|
800
|
+
throw new Error( 'THREE.Matrix4.makePerspective(): Invalid coordinate system: ' + coordinateSystem );
|
|
801
|
+
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
te[ 0 ] = x; te[ 4 ] = 0; te[ 8 ] = a; te[ 12 ] = 0;
|
|
805
|
+
te[ 1 ] = 0; te[ 5 ] = y; te[ 9 ] = b; te[ 13 ] = 0;
|
|
806
|
+
te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = c; te[ 14 ] = d;
|
|
769
807
|
te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = - 1; te[ 15 ] = 0;
|
|
770
808
|
|
|
771
809
|
return this;
|
|
772
810
|
|
|
773
811
|
}
|
|
774
812
|
|
|
775
|
-
makeOrthographic( left, right, top, bottom, near, far ) {
|
|
813
|
+
makeOrthographic( left, right, top, bottom, near, far, coordinateSystem = WebGLCoordinateSystem ) {
|
|
776
814
|
|
|
777
815
|
const te = this.elements;
|
|
778
816
|
const w = 1.0 / ( right - left );
|
|
@@ -781,12 +819,29 @@ class Matrix4 {
|
|
|
781
819
|
|
|
782
820
|
const x = ( right + left ) * w;
|
|
783
821
|
const y = ( top + bottom ) * h;
|
|
784
|
-
const z = ( far + near ) * p;
|
|
785
822
|
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
823
|
+
let z, zInv;
|
|
824
|
+
|
|
825
|
+
if ( coordinateSystem === WebGLCoordinateSystem ) {
|
|
826
|
+
|
|
827
|
+
z = ( far + near ) * p;
|
|
828
|
+
zInv = - 2 * p;
|
|
829
|
+
|
|
830
|
+
} else if ( coordinateSystem === WebGPUCoordinateSystem ) {
|
|
831
|
+
|
|
832
|
+
z = near * p;
|
|
833
|
+
zInv = - 1 * p;
|
|
834
|
+
|
|
835
|
+
} else {
|
|
836
|
+
|
|
837
|
+
throw new Error( 'THREE.Matrix4.makeOrthographic(): Invalid coordinate system: ' + coordinateSystem );
|
|
838
|
+
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
te[ 0 ] = 2 * w; te[ 4 ] = 0; te[ 8 ] = 0; te[ 12 ] = - x;
|
|
842
|
+
te[ 1 ] = 0; te[ 5 ] = 2 * h; te[ 9 ] = 0; te[ 13 ] = - y;
|
|
843
|
+
te[ 2 ] = 0; te[ 6 ] = 0; te[ 10 ] = zInv; te[ 14 ] = - z;
|
|
844
|
+
te[ 3 ] = 0; te[ 7 ] = 0; te[ 11 ] = 0; te[ 15 ] = 1;
|
|
790
845
|
|
|
791
846
|
return this;
|
|
792
847
|
|
|
@@ -110,6 +110,9 @@ class InstancedMesh extends Mesh {
|
|
|
110
110
|
|
|
111
111
|
this.count = source.count;
|
|
112
112
|
|
|
113
|
+
if ( source.boundingBox !== null ) this.boundingBox = source.boundingBox.clone();
|
|
114
|
+
if ( source.boundingSphere !== null ) this.boundingSphere = source.boundingSphere.clone();
|
|
115
|
+
|
|
113
116
|
return this;
|
|
114
117
|
|
|
115
118
|
}
|
package/src/objects/Mesh.js
CHANGED
|
@@ -155,13 +155,15 @@ class Mesh extends Object3D {
|
|
|
155
155
|
|
|
156
156
|
if ( material === undefined ) return;
|
|
157
157
|
|
|
158
|
-
//
|
|
158
|
+
// test with bounding sphere in world space
|
|
159
159
|
|
|
160
160
|
if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();
|
|
161
161
|
|
|
162
162
|
_sphere.copy( geometry.boundingSphere );
|
|
163
163
|
_sphere.applyMatrix4( matrixWorld );
|
|
164
164
|
|
|
165
|
+
// check distance from ray origin to bounding sphere
|
|
166
|
+
|
|
165
167
|
_ray.copy( raycaster.ray ).recast( raycaster.near );
|
|
166
168
|
|
|
167
169
|
if ( _sphere.containsPoint( _ray.origin ) === false ) {
|
|
@@ -172,12 +174,12 @@ class Mesh extends Object3D {
|
|
|
172
174
|
|
|
173
175
|
}
|
|
174
176
|
|
|
175
|
-
//
|
|
177
|
+
// convert ray to local space of mesh
|
|
176
178
|
|
|
177
179
|
_inverseMatrix.copy( matrixWorld ).invert();
|
|
178
180
|
_ray.copy( raycaster.ray ).applyMatrix4( _inverseMatrix );
|
|
179
181
|
|
|
180
|
-
//
|
|
182
|
+
// test with bounding box in local space
|
|
181
183
|
|
|
182
184
|
if ( geometry.boundingBox !== null ) {
|
|
183
185
|
|
|
@@ -185,11 +187,13 @@ class Mesh extends Object3D {
|
|
|
185
187
|
|
|
186
188
|
}
|
|
187
189
|
|
|
188
|
-
|
|
190
|
+
// test for intersections with geometry
|
|
191
|
+
|
|
192
|
+
this._computeIntersections( raycaster, intersects, _ray );
|
|
189
193
|
|
|
190
194
|
}
|
|
191
195
|
|
|
192
|
-
_computeIntersections( raycaster, intersects ) {
|
|
196
|
+
_computeIntersections( raycaster, intersects, rayLocalSpace ) {
|
|
193
197
|
|
|
194
198
|
let intersection;
|
|
195
199
|
|
|
@@ -224,7 +228,7 @@ class Mesh extends Object3D {
|
|
|
224
228
|
const b = index.getX( j + 1 );
|
|
225
229
|
const c = index.getX( j + 2 );
|
|
226
230
|
|
|
227
|
-
intersection = checkGeometryIntersection( this, groupMaterial, raycaster,
|
|
231
|
+
intersection = checkGeometryIntersection( this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );
|
|
228
232
|
|
|
229
233
|
if ( intersection ) {
|
|
230
234
|
|
|
@@ -249,7 +253,7 @@ class Mesh extends Object3D {
|
|
|
249
253
|
const b = index.getX( i + 1 );
|
|
250
254
|
const c = index.getX( i + 2 );
|
|
251
255
|
|
|
252
|
-
intersection = checkGeometryIntersection( this, material, raycaster,
|
|
256
|
+
intersection = checkGeometryIntersection( this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );
|
|
253
257
|
|
|
254
258
|
if ( intersection ) {
|
|
255
259
|
|
|
@@ -282,7 +286,7 @@ class Mesh extends Object3D {
|
|
|
282
286
|
const b = j + 1;
|
|
283
287
|
const c = j + 2;
|
|
284
288
|
|
|
285
|
-
intersection = checkGeometryIntersection( this, groupMaterial, raycaster,
|
|
289
|
+
intersection = checkGeometryIntersection( this, groupMaterial, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );
|
|
286
290
|
|
|
287
291
|
if ( intersection ) {
|
|
288
292
|
|
|
@@ -307,7 +311,7 @@ class Mesh extends Object3D {
|
|
|
307
311
|
const b = i + 1;
|
|
308
312
|
const c = i + 2;
|
|
309
313
|
|
|
310
|
-
intersection = checkGeometryIntersection( this, material, raycaster,
|
|
314
|
+
intersection = checkGeometryIntersection( this, material, raycaster, rayLocalSpace, uv, uv1, normal, a, b, c );
|
|
311
315
|
|
|
312
316
|
if ( intersection ) {
|
|
313
317
|
|
|
@@ -384,7 +388,7 @@ function checkGeometryIntersection( object, material, raycaster, ray, uv, uv1, n
|
|
|
384
388
|
_uvC.fromBufferAttribute( uv1, c );
|
|
385
389
|
|
|
386
390
|
intersection.uv1 = Triangle.getInterpolation( _intersectionPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2() );
|
|
387
|
-
intersection.uv2 = intersection.uv1; //
|
|
391
|
+
intersection.uv2 = intersection.uv1; // @deprecated, r152
|
|
388
392
|
|
|
389
393
|
}
|
|
390
394
|
|
package/src/objects/Skeleton.js
CHANGED
|
@@ -23,8 +23,6 @@ class Skeleton {
|
|
|
23
23
|
this.boneTexture = null;
|
|
24
24
|
this.boneTextureSize = 0;
|
|
25
25
|
|
|
26
|
-
this.frame = - 1;
|
|
27
|
-
|
|
28
26
|
this.init();
|
|
29
27
|
|
|
30
28
|
}
|
|
@@ -249,7 +247,7 @@ class Skeleton {
|
|
|
249
247
|
|
|
250
248
|
const data = {
|
|
251
249
|
metadata: {
|
|
252
|
-
version: 4.
|
|
250
|
+
version: 4.6,
|
|
253
251
|
type: 'Skeleton',
|
|
254
252
|
generator: 'Skeleton.toJSON'
|
|
255
253
|
},
|
|
@@ -4,6 +4,7 @@ import { Matrix4 } from '../math/Matrix4.js';
|
|
|
4
4
|
import { Sphere } from '../math/Sphere.js';
|
|
5
5
|
import { Vector3 } from '../math/Vector3.js';
|
|
6
6
|
import { Vector4 } from '../math/Vector4.js';
|
|
7
|
+
import { Ray } from '../math/Ray.js';
|
|
7
8
|
|
|
8
9
|
const _basePosition = /*@__PURE__*/ new Vector3();
|
|
9
10
|
|
|
@@ -14,7 +15,9 @@ const _vector3 = /*@__PURE__*/ new Vector3();
|
|
|
14
15
|
const _matrix4 = /*@__PURE__*/ new Matrix4();
|
|
15
16
|
const _vertex = /*@__PURE__*/ new Vector3();
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
const _sphere = /*@__PURE__*/ new Sphere();
|
|
19
|
+
const _inverseMatrix = /*@__PURE__*/ new Matrix4();
|
|
20
|
+
const _ray = /*@__PURE__*/ new Ray();
|
|
18
21
|
|
|
19
22
|
class SkinnedMesh extends Mesh {
|
|
20
23
|
|
|
@@ -93,22 +96,47 @@ class SkinnedMesh extends Mesh {
|
|
|
93
96
|
|
|
94
97
|
this.skeleton = source.skeleton;
|
|
95
98
|
|
|
99
|
+
if ( source.boundingBox !== null ) this.boundingBox = source.boundingBox.clone();
|
|
100
|
+
if ( source.boundingSphere !== null ) this.boundingSphere = source.boundingSphere.clone();
|
|
101
|
+
|
|
96
102
|
return this;
|
|
97
103
|
|
|
98
104
|
}
|
|
99
105
|
|
|
100
|
-
|
|
106
|
+
raycast( raycaster, intersects ) {
|
|
107
|
+
|
|
108
|
+
const material = this.material;
|
|
109
|
+
const matrixWorld = this.matrixWorld;
|
|
110
|
+
|
|
111
|
+
if ( material === undefined ) return;
|
|
112
|
+
|
|
113
|
+
// test with bounding sphere in world space
|
|
114
|
+
|
|
115
|
+
if ( this.boundingSphere === null ) this.computeBoundingSphere();
|
|
116
|
+
|
|
117
|
+
_sphere.copy( this.boundingSphere );
|
|
118
|
+
_sphere.applyMatrix4( matrixWorld );
|
|
119
|
+
|
|
120
|
+
if ( raycaster.ray.intersectsSphere( _sphere ) === false ) return;
|
|
101
121
|
|
|
102
|
-
|
|
122
|
+
// convert ray to local space of skinned mesh
|
|
103
123
|
|
|
104
|
-
|
|
105
|
-
|
|
124
|
+
_inverseMatrix.copy( matrixWorld ).invert();
|
|
125
|
+
_ray.copy( raycaster.ray ).applyMatrix4( _inverseMatrix );
|
|
106
126
|
|
|
107
|
-
|
|
127
|
+
// test with bounding box in local space
|
|
108
128
|
|
|
109
|
-
|
|
129
|
+
if ( this.boundingBox !== null ) {
|
|
110
130
|
|
|
111
|
-
|
|
131
|
+
if ( _ray.intersectsBox( this.boundingBox ) === false ) return;
|
|
132
|
+
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// test for intersections with geometry
|
|
136
|
+
|
|
137
|
+
this._computeIntersections( raycaster, intersects, _ray );
|
|
138
|
+
|
|
139
|
+
}
|
|
112
140
|
|
|
113
141
|
getVertexPosition( index, target ) {
|
|
114
142
|
|