@needle-tools/three 0.162.12 → 0.169.2
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 +3 -3
- package/build/three.cjs +29789 -1941
- package/build/three.module.js +29095 -1933
- package/build/three.module.min.js +2 -2
- package/build/three.webgpu.js +80003 -0
- package/build/three.webgpu.min.js +6 -0
- package/build/three.webgpu.nodes.js +79951 -0
- package/build/three.webgpu.nodes.min.js +6 -0
- package/examples/jsm/Addons.js +2 -5
- package/examples/jsm/animation/AnimationClipCreator.js +1 -1
- package/examples/jsm/animation/CCDIKSolver.js +4 -2
- package/examples/jsm/capabilities/WebGL.js +27 -21
- package/examples/jsm/controls/ArcballControls.js +174 -158
- package/examples/jsm/controls/DragControls.js +260 -132
- package/examples/jsm/controls/FirstPersonControls.js +175 -163
- package/examples/jsm/controls/FlyControls.js +194 -188
- package/examples/jsm/controls/OrbitControls.js +790 -797
- package/examples/jsm/controls/PointerLockControls.js +24 -15
- package/examples/jsm/controls/TrackballControls.js +469 -448
- package/examples/jsm/controls/TransformControls.js +98 -63
- package/examples/jsm/csm/CSMShader.js +4 -4
- package/examples/jsm/effects/AnaglyphEffect.js +6 -13
- package/examples/jsm/effects/ParallaxBarrierEffect.js +17 -11
- package/examples/jsm/effects/StereoEffect.js +6 -1
- package/examples/jsm/environments/RoomEnvironment.js +2 -6
- package/examples/jsm/exporters/DRACOExporter.js +4 -2
- package/examples/jsm/exporters/EXRExporter.js +19 -11
- package/examples/jsm/exporters/GLTFExporter.js +77 -8
- package/examples/jsm/exporters/KTX2Exporter.js +21 -13
- package/examples/jsm/exporters/OBJExporter.js +5 -1
- package/examples/jsm/exporters/PLYExporter.js +9 -7
- package/examples/jsm/exporters/USDZExporter.js +55 -11
- package/examples/jsm/geometries/DecalGeometry.js +4 -1
- package/examples/jsm/geometries/InstancedPointsGeometry.js +1 -1
- package/examples/jsm/geometries/TeapotGeometry.js +1 -1
- package/examples/jsm/geometries/TextGeometry.js +10 -2
- package/examples/jsm/helpers/LightProbeHelper.js +43 -44
- package/examples/jsm/helpers/LightProbeHelperGPU.js +65 -0
- package/examples/jsm/helpers/ViewHelper.js +75 -61
- package/examples/jsm/interactive/HTMLMesh.js +7 -9
- package/examples/jsm/libs/basis/basis_transcoder.js +8 -10
- package/examples/jsm/libs/basis/basis_transcoder.wasm +0 -0
- package/examples/jsm/libs/draco/README.md +2 -2
- package/examples/jsm/libs/fflate.module.js +694 -496
- package/examples/jsm/libs/ktx-parse.module.js +1 -1
- package/examples/jsm/lights/LightProbeGenerator.js +24 -10
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +91 -0
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +8 -63
- package/examples/jsm/lines/LineMaterial.js +1 -17
- package/examples/jsm/lines/LineSegments2.js +15 -0
- package/examples/jsm/lines/Wireframe.js +16 -1
- package/examples/jsm/lines/webgpu/Line2.js +20 -0
- package/examples/jsm/lines/webgpu/LineSegments2.js +376 -0
- package/examples/jsm/loaders/3MFLoader.js +2 -0
- package/examples/jsm/loaders/ColladaLoader.js +9 -6
- package/examples/jsm/loaders/DRACOLoader.js +4 -2
- package/examples/jsm/loaders/EXRLoader.js +351 -97
- package/examples/jsm/loaders/FBXLoader.js +77 -78
- package/examples/jsm/loaders/GLTFLoader.js +76 -14
- package/examples/jsm/loaders/KTX2Loader.js +30 -22
- package/examples/jsm/loaders/LDrawLoader.js +3 -2
- package/examples/jsm/loaders/LUT3dlLoader.js +0 -15
- package/examples/jsm/loaders/LUTCubeLoader.js +0 -14
- package/examples/jsm/loaders/LUTImageLoader.js +0 -14
- package/examples/jsm/loaders/MMDLoader.js +31 -12
- package/examples/jsm/loaders/MTLLoader.js +4 -3
- package/examples/jsm/loaders/MaterialXLoader.js +45 -21
- package/examples/jsm/loaders/OBJLoader.js +5 -3
- package/examples/jsm/loaders/PCDLoader.js +14 -13
- package/examples/jsm/loaders/PDBLoader.js +3 -2
- package/examples/jsm/loaders/PLYLoader.js +8 -5
- package/examples/jsm/loaders/RGBMLoader.js +16 -0
- package/examples/jsm/loaders/STLLoader.js +3 -2
- package/examples/jsm/loaders/USDZLoader.js +124 -76
- package/examples/jsm/loaders/UltraHDRLoader.js +583 -0
- package/examples/jsm/loaders/VRMLLoader.js +11 -11
- package/examples/jsm/loaders/VTKLoader.js +80 -6
- package/examples/jsm/loaders/XYZLoader.js +3 -2
- package/examples/jsm/loaders/lwo/IFFParser.js +8 -5
- package/examples/jsm/materials/MeshGouraudMaterial.js +7 -1
- package/examples/jsm/math/Octree.js +26 -20
- package/examples/jsm/misc/GPUComputationRenderer.js +9 -25
- package/examples/jsm/misc/Timer.js +1 -1
- package/examples/jsm/modifiers/CurveModifier.js +11 -9
- package/examples/jsm/modifiers/CurveModifierGPU.js +233 -0
- package/examples/jsm/modifiers/SimplifyModifier.js +2 -1
- package/examples/jsm/objects/InstancedPoints.js +2 -2
- package/examples/jsm/objects/Lensflare.js +2 -2
- package/examples/jsm/objects/LensflareMesh.js +322 -0
- package/examples/jsm/objects/SkyMesh.js +187 -0
- package/examples/jsm/objects/Water2Mesh.js +158 -0
- package/examples/jsm/objects/WaterMesh.js +101 -0
- package/examples/jsm/physics/JoltPhysics.js +281 -0
- package/examples/jsm/physics/RapierPhysics.js +25 -5
- package/examples/jsm/postprocessing/GlitchPass.js +0 -3
- package/examples/jsm/postprocessing/LUTPass.js +5 -71
- package/examples/jsm/postprocessing/OutlinePass.js +31 -46
- package/examples/jsm/postprocessing/RenderPass.js +1 -1
- package/examples/jsm/postprocessing/RenderTransitionPass.js +168 -0
- package/examples/jsm/postprocessing/SAOPass.js +0 -1
- package/examples/jsm/postprocessing/SSAARenderPass.js +3 -1
- package/examples/jsm/postprocessing/SSAOPass.js +6 -12
- package/examples/jsm/postprocessing/UnrealBloomPass.js +4 -4
- package/examples/jsm/renderers/CSS2DRenderer.js +25 -5
- package/examples/jsm/renderers/CSS3DRenderer.js +24 -3
- package/examples/jsm/renderers/webgl-legacy/nodes/GLSL1NodeBuilder.js +1 -3
- package/examples/jsm/renderers/webgl-legacy/nodes/SlotNode.js +1 -1
- package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodeBuilder.js +7 -4
- package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodes.js +19 -5
- package/examples/jsm/shaders/BleachBypassShader.js +1 -2
- package/examples/jsm/shaders/ColorifyShader.js +1 -2
- package/examples/jsm/shaders/FXAAShader.js +0 -2
- package/examples/jsm/shaders/GTAOShader.js +1 -1
- package/examples/jsm/shaders/LuminosityHighPassShader.js +1 -3
- package/examples/jsm/shaders/OutputShader.js +1 -1
- package/examples/jsm/transpiler/GLSLDecoder.js +47 -5
- package/examples/jsm/transpiler/ShaderToyDecoder.js +2 -2
- package/examples/jsm/transpiler/TSLEncoder.js +24 -22
- package/examples/jsm/utils/BufferGeometryUtils.js +18 -16
- package/examples/jsm/utils/GeometryCompressionUtils.js +37 -122
- package/examples/jsm/utils/SceneUtils.js +60 -1
- package/examples/jsm/utils/ShadowMapViewer.js +3 -8
- package/examples/jsm/utils/ShadowMapViewerGPU.js +201 -0
- package/examples/jsm/utils/SkeletonUtils.js +84 -66
- package/examples/jsm/utils/SortUtils.js +8 -5
- package/examples/jsm/utils/TextureUtils.js +3 -2
- package/examples/jsm/utils/TextureUtilsGPU.js +63 -0
- package/examples/jsm/webxr/OculusHandModel.js +3 -2
- package/examples/jsm/webxr/XRControllerModelFactory.js +1 -1
- package/examples/jsm/webxr/XRHandModelFactory.js +4 -2
- package/package.json +11 -8
- package/src/Three.WebGPU.Nodes.js +200 -0
- package/src/Three.WebGPU.js +201 -0
- package/src/Three.js +23 -1
- package/src/animation/AnimationClip.js +1 -1
- package/src/animation/tracks/BooleanKeyframeTrack.js +10 -1
- package/src/animation/tracks/QuaternionKeyframeTrack.js +1 -2
- package/src/animation/tracks/StringKeyframeTrack.js +10 -1
- package/src/audio/Audio.js +2 -2
- package/src/constants.js +6 -7
- package/src/core/BufferAttribute.js +0 -9
- package/src/core/Clock.js +1 -1
- package/src/core/InterleavedBuffer.js +0 -9
- package/src/core/Object3D.js +34 -29
- package/src/core/Raycaster.js +6 -2
- package/src/core/RenderTarget.js +8 -0
- package/src/extras/Controls.js +32 -0
- package/src/extras/PMREMGenerator.js +12 -11
- package/src/extras/TextureUtils.js +210 -0
- package/src/geometries/CylinderGeometry.js +11 -4
- package/src/lights/Light.js +1 -0
- package/src/lights/LightShadow.js +5 -0
- package/{examples/jsm/lights → src/lights/webgpu}/IESSpotLight.js +1 -1
- package/src/loaders/FileLoader.js +5 -1
- package/src/loaders/LoaderUtils.js +3 -1
- package/src/loaders/MaterialLoader.js +8 -1
- package/src/loaders/ObjectLoader.js +36 -2
- package/{examples/jsm/nodes/loaders → src/loaders/nodes}/NodeLoader.js +27 -5
- package/{examples/jsm/nodes/loaders → src/loaders/nodes}/NodeMaterialLoader.js +22 -18
- package/{examples/jsm/nodes/loaders → src/loaders/nodes}/NodeObjectLoader.js +21 -1
- package/src/materials/Material.js +4 -0
- package/src/materials/MeshPhysicalMaterial.js +20 -0
- package/src/materials/ShaderMaterial.js +0 -4
- package/src/materials/nodes/InstancedPointsNodeMaterial.js +156 -0
- package/{examples/jsm/nodes/materials → src/materials/nodes}/Line2NodeMaterial.js +69 -68
- package/src/materials/nodes/LineBasicNodeMaterial.js +31 -0
- package/{examples/jsm/nodes/materials → src/materials/nodes}/LineDashedNodeMaterial.js +15 -12
- package/src/materials/nodes/MeshBasicNodeMaterial.js +77 -0
- package/src/materials/nodes/MeshLambertNodeMaterial.js +47 -0
- package/src/materials/nodes/MeshMatcapNodeMaterial.js +57 -0
- package/src/materials/nodes/MeshNormalNodeMaterial.js +44 -0
- package/src/materials/nodes/MeshPhongNodeMaterial.js +78 -0
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +248 -0
- package/{examples/jsm/nodes/materials → src/materials/nodes}/MeshSSSNodeMaterial.js +10 -7
- package/src/materials/nodes/MeshStandardNodeMaterial.js +108 -0
- package/src/materials/nodes/MeshToonNodeMaterial.js +38 -0
- package/{examples/jsm/nodes/materials → src/materials/nodes}/NodeMaterial.js +198 -157
- package/{examples/jsm/nodes/materials/Materials.js → src/materials/nodes/NodeMaterials.js} +7 -1
- package/{examples/jsm/nodes/materials → src/materials/nodes}/PointsNodeMaterial.js +10 -7
- package/src/materials/nodes/ShadowNodeMaterial.js +38 -0
- package/src/materials/nodes/SpriteNodeMaterial.js +123 -0
- package/src/materials/nodes/VolumeNodeMaterial.js +108 -0
- package/src/materials/nodes/manager/NodeMaterialObserver.js +302 -0
- package/src/math/Box2.js +4 -4
- package/src/math/Box3.js +6 -6
- package/src/math/ColorManagement.js +10 -0
- package/src/math/Matrix2.js +54 -0
- package/src/math/Spherical.js +4 -5
- package/src/math/Triangle.js +24 -0
- package/src/math/Vector4.js +13 -0
- package/src/nodes/Nodes.js +164 -0
- package/src/nodes/TSL.js +179 -0
- package/src/nodes/accessors/AccessorsUtils.js +25 -0
- package/src/nodes/accessors/BatchNode.js +128 -0
- package/src/nodes/accessors/Bitangent.js +13 -0
- package/{examples/jsm → src}/nodes/accessors/BufferAttributeNode.js +44 -6
- package/{examples/jsm → src}/nodes/accessors/BufferNode.js +13 -4
- package/src/nodes/accessors/Camera.js +13 -0
- package/{examples/jsm → src}/nodes/accessors/ClippingNode.js +22 -15
- package/src/nodes/accessors/CubeTextureNode.js +79 -0
- package/src/nodes/accessors/InstanceNode.js +144 -0
- package/src/nodes/accessors/InstancedPointsMaterialNode.js +24 -0
- package/src/nodes/accessors/Lights.js +51 -0
- package/src/nodes/accessors/MaterialNode.js +441 -0
- package/src/nodes/accessors/MaterialProperties.js +3 -0
- package/{examples/jsm → src}/nodes/accessors/MaterialReferenceNode.js +10 -5
- package/src/nodes/accessors/ModelNode.js +72 -0
- package/src/nodes/accessors/ModelViewProjectionNode.js +42 -0
- package/{examples/jsm → src}/nodes/accessors/MorphNode.js +51 -33
- package/src/nodes/accessors/Normal.js +88 -0
- package/{examples/jsm → src}/nodes/accessors/Object3DNode.js +18 -34
- package/src/nodes/accessors/PointUVNode.js +30 -0
- package/src/nodes/accessors/Position.js +10 -0
- package/src/nodes/accessors/ReferenceBaseNode.js +171 -0
- package/{examples/jsm → src}/nodes/accessors/ReferenceNode.js +58 -9
- package/src/nodes/accessors/ReflectVector.js +10 -0
- package/src/nodes/accessors/RendererReferenceNode.js +35 -0
- package/{examples/jsm → src}/nodes/accessors/SceneNode.js +9 -6
- package/src/nodes/accessors/SkinningNode.js +191 -0
- package/src/nodes/accessors/StorageBufferNode.js +147 -0
- package/{examples/jsm/nodes/accessors/TextureStoreNode.js → src/nodes/accessors/StorageTextureNode.js} +35 -10
- package/src/nodes/accessors/Tangent.js +22 -0
- package/src/nodes/accessors/Texture3DNode.js +103 -0
- package/{examples/jsm/nodes/accessors/TextureBicubicNode.js → src/nodes/accessors/TextureBicubic.js} +3 -32
- package/{examples/jsm → src}/nodes/accessors/TextureNode.js +123 -39
- package/src/nodes/accessors/TextureSizeNode.js +36 -0
- package/src/nodes/accessors/UV.js +3 -0
- package/{examples/jsm/nodes/accessors/UniformsNode.js → src/nodes/accessors/UniformArrayNode.js} +33 -15
- package/{examples/jsm → src}/nodes/accessors/UserDataNode.js +10 -7
- package/src/nodes/accessors/VelocityNode.js +134 -0
- package/{examples/jsm → src}/nodes/accessors/VertexColorNode.js +9 -5
- package/{examples/jsm → src}/nodes/code/CodeNode.js +9 -5
- package/{examples/jsm → src}/nodes/code/ExpressionNode.js +10 -6
- package/{examples/jsm → src}/nodes/code/FunctionCallNode.js +8 -5
- package/{examples/jsm → src}/nodes/code/FunctionNode.js +8 -31
- package/{examples/jsm → src}/nodes/code/ScriptableNode.js +24 -7
- package/{examples/jsm → src}/nodes/code/ScriptableValueNode.js +11 -8
- package/{examples/jsm → src}/nodes/core/AssignNode.js +12 -9
- package/{examples/jsm → src}/nodes/core/AttributeNode.js +29 -12
- package/{examples/jsm → src}/nodes/core/BypassNode.js +11 -7
- package/src/nodes/core/CacheNode.js +50 -0
- package/{examples/jsm → src}/nodes/core/ConstNode.js +6 -3
- package/{examples/jsm → src}/nodes/core/ContextNode.js +27 -11
- package/src/nodes/core/IndexNode.js +99 -0
- package/{examples/jsm → src}/nodes/core/InputNode.js +7 -3
- package/{examples/jsm → src}/nodes/core/LightingModel.js +2 -2
- package/src/nodes/core/MRTNode.js +85 -0
- package/{examples/jsm → src}/nodes/core/Node.js +114 -57
- package/{examples/jsm → src}/nodes/core/NodeBuilder.js +327 -90
- package/src/nodes/core/NodeCache.js +36 -0
- package/{examples/jsm → src}/nodes/core/NodeFrame.js +52 -10
- package/{examples/jsm → src}/nodes/core/NodeFunction.js +2 -2
- package/{examples/jsm → src}/nodes/core/NodeUniform.js +1 -2
- package/{examples/jsm → src}/nodes/core/NodeUtils.js +56 -8
- package/{examples/jsm → src}/nodes/core/OutputStructNode.js +13 -12
- package/{examples/jsm → src}/nodes/core/ParameterNode.js +7 -4
- package/src/nodes/core/PropertyNode.js +88 -0
- package/{examples/jsm → src}/nodes/core/StackNode.js +31 -11
- package/{examples/jsm → src}/nodes/core/StructTypeNode.js +7 -3
- package/{examples/jsm → src}/nodes/core/TempNode.js +10 -6
- package/src/nodes/core/UniformGroupNode.js +59 -0
- package/{examples/jsm → src}/nodes/core/UniformNode.js +37 -5
- package/{examples/jsm → src}/nodes/core/VarNode.js +14 -14
- package/src/nodes/core/VaryingNode.js +108 -0
- package/{examples/jsm → src}/nodes/display/AfterImageNode.js +38 -28
- package/src/nodes/display/AnaglyphPassNode.js +67 -0
- package/{examples/jsm → src}/nodes/display/AnamorphicNode.js +33 -30
- package/src/nodes/display/BleachBypass.js +26 -0
- package/src/nodes/display/BlendMode.js +54 -0
- package/src/nodes/display/BloomNode.js +341 -0
- package/{examples/jsm → src}/nodes/display/BumpMapNode.js +20 -38
- package/src/nodes/display/ColorAdjustment.js +46 -0
- package/src/nodes/display/ColorSpaceFunctions.js +38 -0
- package/src/nodes/display/ColorSpaceNode.js +114 -0
- package/src/nodes/display/DenoiseNode.js +204 -0
- package/src/nodes/display/DepthOfFieldNode.js +124 -0
- package/src/nodes/display/DotScreenNode.js +66 -0
- package/src/nodes/display/FXAANode.js +332 -0
- package/src/nodes/display/FilmNode.js +56 -0
- package/src/nodes/display/FrontFacingNode.js +45 -0
- package/src/nodes/display/GTAONode.js +331 -0
- package/{examples/jsm → src}/nodes/display/GaussianBlurNode.js +47 -24
- package/src/nodes/display/Lut3DNode.js +57 -0
- package/src/nodes/display/MotionBlur.js +25 -0
- package/{examples/jsm → src}/nodes/display/NormalMapNode.js +14 -14
- package/src/nodes/display/ParallaxBarrierPassNode.js +58 -0
- package/src/nodes/display/PassNode.js +378 -0
- package/src/nodes/display/PixelationPassNode.js +213 -0
- package/{examples/jsm → src}/nodes/display/PosterizeNode.js +8 -7
- package/src/nodes/display/RGBShiftNode.js +53 -0
- package/src/nodes/display/RenderOutputNode.js +60 -0
- package/src/nodes/display/SSAAPassNode.js +287 -0
- package/src/nodes/display/ScreenNode.js +181 -0
- package/src/nodes/display/Sepia.js +17 -0
- package/src/nodes/display/SobelOperatorNode.js +126 -0
- package/src/nodes/display/StereoCompositePassNode.js +110 -0
- package/src/nodes/display/StereoPassNode.js +83 -0
- package/src/nodes/display/ToneMappingFunctions.js +190 -0
- package/src/nodes/display/ToneMappingNode.js +67 -0
- package/src/nodes/display/ToonOutlinePassNode.js +111 -0
- package/src/nodes/display/TransitionNode.js +80 -0
- package/src/nodes/display/ViewportDepthNode.js +125 -0
- package/src/nodes/display/ViewportDepthTextureNode.js +33 -0
- package/src/nodes/display/ViewportSharedTextureNode.js +39 -0
- package/{examples/jsm → src}/nodes/display/ViewportTextureNode.js +20 -14
- package/src/nodes/fog/FogExp2Node.js +35 -0
- package/src/nodes/fog/FogNode.js +50 -0
- package/src/nodes/fog/FogRangeNode.js +36 -0
- package/src/nodes/functions/BSDF/BRDF_GGX.js +59 -0
- package/{examples/jsm → src}/nodes/functions/BSDF/BRDF_Lambert.js +2 -2
- package/{examples/jsm → src}/nodes/functions/BSDF/BRDF_Sheen.js +6 -6
- package/{examples/jsm → src}/nodes/functions/BSDF/DFGApprox.js +2 -2
- package/{examples/jsm → src}/nodes/functions/BSDF/D_GGX.js +2 -2
- package/src/nodes/functions/BSDF/D_GGX_Anisotropic.js +28 -0
- package/{examples/jsm → src}/nodes/functions/BSDF/EnvironmentBRDF.js +2 -2
- package/{examples/jsm → src}/nodes/functions/BSDF/F_Schlick.js +2 -2
- package/src/nodes/functions/BSDF/LTC.js +131 -0
- package/{examples/jsm → src}/nodes/functions/BSDF/Schlick_to_F0.js +2 -2
- package/{examples/jsm → src}/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +2 -4
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +29 -0
- package/src/nodes/functions/BasicLightingModel.js +78 -0
- package/{examples/jsm → src}/nodes/functions/PhongLightingModel.js +11 -9
- package/src/nodes/functions/PhysicalLightingModel.js +633 -0
- package/src/nodes/functions/ShadowMaskModel.js +31 -0
- package/src/nodes/functions/ToonLightingModel.js +51 -0
- package/src/nodes/functions/material/getGeometryRoughness.js +13 -0
- package/{examples/jsm → src}/nodes/functions/material/getRoughness.js +2 -2
- package/src/nodes/functions/material/getShIrradianceAt.js +28 -0
- package/{examples/jsm → src}/nodes/geometry/RangeNode.js +28 -11
- package/src/nodes/gpgpu/AtomicFunctionNode.js +99 -0
- package/src/nodes/gpgpu/BarrierNode.js +40 -0
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +98 -0
- package/{examples/jsm → src}/nodes/gpgpu/ComputeNode.js +10 -6
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +100 -0
- package/src/nodes/lighting/AONode.js +27 -0
- package/{examples/jsm → src}/nodes/lighting/AmbientLightNode.js +6 -8
- package/src/nodes/lighting/AnalyticLightNode.js +522 -0
- package/src/nodes/lighting/BasicEnvironmentNode.js +30 -0
- package/src/nodes/lighting/BasicLightMapNode.js +32 -0
- package/{examples/jsm → src}/nodes/lighting/DirectionalLightNode.js +7 -9
- package/src/nodes/lighting/EnvironmentNode.js +138 -0
- package/{examples/jsm → src}/nodes/lighting/HemisphereLightNode.js +12 -11
- package/{examples/jsm → src}/nodes/lighting/IESSpotLightNode.js +7 -9
- package/src/nodes/lighting/IrradianceNode.js +27 -0
- package/src/nodes/lighting/LightProbeNode.js +53 -0
- package/{examples/jsm → src}/nodes/lighting/LightUtils.js +3 -3
- package/src/nodes/lighting/LightingContextNode.js +67 -0
- package/{examples/jsm → src}/nodes/lighting/LightingNode.js +9 -3
- package/src/nodes/lighting/LightsNode.js +250 -0
- package/{examples/jsm → src}/nodes/lighting/PointLightNode.js +12 -13
- package/src/nodes/lighting/RectAreaLightNode.js +97 -0
- package/{examples/jsm → src}/nodes/lighting/SpotLightNode.js +14 -16
- package/{examples/jsm → src}/nodes/materialx/MaterialXNodes.js +2 -2
- package/src/nodes/materialx/lib/mx_hsv.js +127 -0
- package/{examples/jsm → src}/nodes/materialx/lib/mx_noise.js +500 -603
- package/{examples/jsm → src}/nodes/materialx/lib/mx_transform_color.js +3 -9
- package/{examples/jsm/nodes/math/CondNode.js → src/nodes/math/ConditionalNode.js} +48 -13
- package/src/nodes/math/Hash.js +13 -0
- package/src/nodes/math/MathNode.js +407 -0
- package/{examples/jsm → src}/nodes/math/MathUtils.js +0 -7
- package/src/nodes/math/OperatorNode.js +319 -0
- package/{examples/jsm → src}/nodes/math/TriNoise3D.js +19 -29
- package/{examples/jsm → src}/nodes/parsers/GLSLNodeFunction.js +7 -7
- package/src/nodes/pmrem/PMREMNode.js +240 -0
- package/src/nodes/pmrem/PMREMUtils.js +288 -0
- package/src/nodes/procedural/Checker.js +14 -0
- package/src/nodes/tsl/TSLBase.js +30 -0
- package/{examples/jsm/nodes/shadernode/ShaderNode.js → src/nodes/tsl/TSLCore.js} +122 -96
- package/{examples/jsm → src}/nodes/utils/ArrayElementNode.js +9 -5
- package/{examples/jsm → src}/nodes/utils/ConvertNode.js +7 -3
- package/src/nodes/utils/CubeMapNode.js +160 -0
- package/src/nodes/utils/Discard.js +8 -0
- package/src/nodes/utils/EquirectUVNode.js +36 -0
- package/src/nodes/utils/FlipNode.js +68 -0
- package/{examples/jsm → src}/nodes/utils/FunctionOverloadingNode.js +11 -5
- package/{examples/jsm → src}/nodes/utils/JoinNode.js +6 -3
- package/{examples/jsm → src}/nodes/utils/LoopNode.js +23 -12
- package/src/nodes/utils/MatcapUVNode.js +33 -0
- package/{examples/jsm → src}/nodes/utils/MaxMipLevelNode.js +16 -7
- package/{examples/jsm → src}/nodes/utils/OscNode.js +12 -8
- package/src/nodes/utils/Packing.js +4 -0
- package/src/nodes/utils/RTTNode.js +133 -0
- package/{examples/jsm → src}/nodes/utils/ReflectorNode.js +21 -5
- package/{examples/jsm → src}/nodes/utils/RemapNode.js +12 -8
- package/{examples/jsm → src}/nodes/utils/RotateNode.js +8 -13
- package/{examples/jsm → src}/nodes/utils/SetNode.js +7 -4
- package/{examples/jsm → src}/nodes/utils/SplitNode.js +7 -3
- package/{examples/jsm → src}/nodes/utils/SpriteSheetUVNode.js +10 -6
- package/src/nodes/utils/SpriteUtils.js +47 -0
- package/{examples/jsm → src}/nodes/utils/StorageArrayElementNode.js +11 -12
- package/{examples/jsm → src}/nodes/utils/TimerNode.js +8 -5
- package/{examples/jsm → src}/nodes/utils/TriplanarTexturesNode.js +11 -9
- package/src/nodes/utils/UVUtils.js +19 -0
- package/src/nodes/utils/ViewportUtils.js +14 -0
- package/src/objects/BatchedMesh.js +302 -144
- package/src/objects/InstancedMesh.js +11 -1
- package/src/objects/LOD.js +21 -0
- package/src/objects/Line.js +67 -43
- package/src/objects/Mesh.js +7 -23
- package/src/objects/Points.js +2 -0
- package/src/renderers/WebGLRenderer.js +473 -224
- package/{examples/jsm → src}/renderers/common/Animation.js +3 -0
- package/{examples/jsm → src}/renderers/common/Attributes.js +4 -1
- package/{examples/jsm → src}/renderers/common/Backend.js +30 -27
- package/{examples/jsm → src}/renderers/common/Background.js +18 -10
- package/src/renderers/common/BindGroup.js +18 -0
- package/src/renderers/common/Bindings.js +203 -0
- package/src/renderers/common/BundleGroup.js +26 -0
- package/src/renderers/common/ChainMap.js +59 -0
- package/{examples/jsm → src}/renderers/common/ClippingContext.js +24 -12
- package/{examples/jsm → src}/renderers/common/Color4.js +1 -1
- package/{examples/jsm → src}/renderers/common/CubeRenderTarget.js +16 -4
- package/{examples/jsm → src}/renderers/common/Geometries.js +37 -5
- package/{examples/jsm → src}/renderers/common/Info.js +35 -15
- package/{examples/jsm → src}/renderers/common/Pipelines.js +2 -2
- package/src/renderers/common/PostProcessing.js +90 -0
- package/src/renderers/common/QuadMesh.js +55 -0
- package/src/renderers/common/RenderBundle.js +18 -0
- package/src/renderers/common/RenderBundles.js +38 -0
- package/{examples/jsm → src}/renderers/common/RenderContext.js +25 -2
- package/{examples/jsm → src}/renderers/common/RenderContexts.js +1 -1
- package/{examples/jsm → src}/renderers/common/RenderList.js +11 -2
- package/src/renderers/common/RenderObject.js +413 -0
- package/{examples/jsm → src}/renderers/common/RenderObjects.js +9 -2
- package/{examples/jsm → src}/renderers/common/Renderer.js +431 -83
- package/{examples/jsm → src}/renderers/common/SampledTexture.js +14 -5
- package/{examples/jsm → src}/renderers/common/StorageBufferAttribute.js +1 -1
- package/{examples/jsm → src}/renderers/common/StorageInstancedBufferAttribute.js +1 -1
- package/{examples/jsm → src}/renderers/common/StorageTexture.js +2 -1
- package/{examples/jsm → src}/renderers/common/Textures.js +15 -15
- package/{examples/jsm → src}/renderers/common/Uniform.js +10 -5
- package/{examples/jsm → src}/renderers/common/UniformsGroup.js +69 -31
- package/src/renderers/common/extras/PMREMGenerator.js +771 -0
- package/src/renderers/common/nodes/NodeBuilderState.js +58 -0
- package/src/renderers/common/nodes/NodeLibrary.js +118 -0
- package/src/renderers/common/nodes/NodeSampledTexture.js +64 -0
- package/{examples/jsm → src}/renderers/common/nodes/NodeSampler.js +8 -1
- package/{examples/jsm → src}/renderers/common/nodes/NodeStorageBuffer.js +5 -1
- package/{examples/jsm → src}/renderers/common/nodes/NodeUniform.js +3 -3
- package/{examples/jsm → src}/renderers/common/nodes/NodeUniformBuffer.js +2 -1
- package/{examples/jsm → src}/renderers/common/nodes/NodeUniformsGroup.js +2 -8
- package/{examples/jsm → src}/renderers/common/nodes/Nodes.js +106 -68
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +31 -1
- package/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +9 -1
- package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +0 -9
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +0 -10
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +3 -3
- package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +8 -22
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +1 -0
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +2 -10
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +2 -16
- package/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js +3 -14
- package/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.js +10 -31
- package/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js +3 -23
- package/src/renderers/shaders/ShaderChunk/packing.glsl.js +45 -13
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +38 -25
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +3 -0
- package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +3 -3
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +19 -11
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +47 -13
- package/src/renderers/shaders/ShaderChunk.js +0 -2
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +8 -0
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +4 -0
- package/src/renderers/shaders/ShaderLib/sprite.glsl.js +2 -4
- package/src/renderers/shaders/ShaderLib.js +2 -1
- package/src/renderers/shaders/UniformsLib.js +3 -0
- package/src/renderers/shaders/UniformsUtils.js +10 -1
- package/src/renderers/webgl/WebGLAttributes.js +42 -38
- package/src/renderers/webgl/WebGLBackground.js +24 -3
- package/src/renderers/webgl/WebGLBindingStates.js +14 -51
- package/src/renderers/webgl/WebGLBufferRenderer.js +23 -22
- package/src/renderers/webgl/WebGLCapabilities.js +44 -13
- package/src/renderers/webgl/WebGLCubeUVMaps.js +10 -6
- package/src/renderers/webgl/WebGLExtensions.js +7 -20
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +23 -21
- package/src/renderers/webgl/WebGLLights.js +21 -44
- package/src/renderers/webgl/WebGLMaterials.js +9 -8
- package/src/renderers/webgl/WebGLMorphtargets.js +78 -217
- package/src/renderers/webgl/WebGLProgram.js +46 -78
- package/src/renderers/webgl/WebGLPrograms.js +37 -40
- package/src/renderers/webgl/WebGLProperties.js +7 -0
- package/src/renderers/webgl/WebGLRenderStates.js +15 -9
- package/src/renderers/webgl/WebGLShadowMap.js +25 -25
- package/src/renderers/webgl/WebGLState.js +35 -58
- package/src/renderers/webgl/WebGLTextures.js +313 -358
- package/src/renderers/webgl/WebGLUniforms.js +12 -2
- package/src/renderers/webgl/WebGLUniformsGroups.js +8 -8
- package/src/renderers/webgl/WebGLUtils.js +9 -78
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/WebGLBackend.js +389 -152
- package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +145 -0
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/nodes/GLSLNodeBuilder.js +245 -44
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLAttributeUtils.js +7 -1
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLConstants.js +2 -0
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLExtensions.js +2 -0
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLState.js +21 -3
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLTextureUtils.js +271 -43
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLUtils.js +6 -23
- package/{examples/jsm → src}/renderers/webgpu/WebGPUBackend.js +318 -141
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +42 -0
- package/{examples/jsm → src}/renderers/webgpu/WebGPURenderer.js +10 -7
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +59 -0
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +105 -0
- package/{examples/jsm → src}/renderers/webgpu/nodes/WGSLNodeBuilder.js +424 -95
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +159 -0
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUAttributeUtils.js +37 -18
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUBindingUtils.js +86 -32
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUConstants.js +10 -1
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUPipelineUtils.js +68 -27
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUTexturePassUtils.js +62 -5
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUTextureUtils.js +235 -68
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUUtils.js +43 -5
- package/src/renderers/webxr/WebXRDepthSensing.js +11 -6
- package/src/renderers/webxr/WebXRManager.js +53 -38
- package/src/scenes/Scene.js +7 -1
- package/src/textures/CompressedArrayTexture.js +14 -0
- package/src/textures/DataArrayTexture.js +14 -0
- package/src/textures/DepthTexture.js +1 -3
- package/src/textures/Texture.js +12 -2
- package/src/utils.js +62 -1
- package/examples/jsm/geometries/SDFGeometryGenerator.js +0 -144
- package/examples/jsm/loaders/LogLuvLoader.js +0 -606
- package/examples/jsm/loaders/TiltLoader.js +0 -520
- package/examples/jsm/nodes/Nodes.js +0 -195
- package/examples/jsm/nodes/accessors/AccessorsUtils.js +0 -10
- package/examples/jsm/nodes/accessors/BitangentNode.js +0 -89
- package/examples/jsm/nodes/accessors/CameraNode.js +0 -119
- package/examples/jsm/nodes/accessors/CubeTextureNode.js +0 -61
- package/examples/jsm/nodes/accessors/InstanceNode.js +0 -71
- package/examples/jsm/nodes/accessors/InstancedPointsMaterialNode.js +0 -21
- package/examples/jsm/nodes/accessors/MaterialNode.js +0 -314
- package/examples/jsm/nodes/accessors/ModelNode.js +0 -33
- package/examples/jsm/nodes/accessors/ModelViewProjectionNode.js +0 -39
- package/examples/jsm/nodes/accessors/NormalNode.js +0 -96
- package/examples/jsm/nodes/accessors/PointUVNode.js +0 -26
- package/examples/jsm/nodes/accessors/PositionNode.js +0 -104
- package/examples/jsm/nodes/accessors/ReflectVectorNode.js +0 -35
- package/examples/jsm/nodes/accessors/SkinningNode.js +0 -124
- package/examples/jsm/nodes/accessors/StorageBufferNode.js +0 -72
- package/examples/jsm/nodes/accessors/TangentNode.js +0 -109
- package/examples/jsm/nodes/accessors/TextureSizeNode.js +0 -35
- package/examples/jsm/nodes/accessors/UVNode.js +0 -47
- package/examples/jsm/nodes/core/CacheNode.js +0 -49
- package/examples/jsm/nodes/core/IndexNode.js +0 -66
- package/examples/jsm/nodes/core/NodeCache.js +0 -26
- package/examples/jsm/nodes/core/NodeKeywords.js +0 -80
- package/examples/jsm/nodes/core/PropertyNode.js +0 -72
- package/examples/jsm/nodes/core/UniformGroupNode.js +0 -36
- package/examples/jsm/nodes/core/VaryingNode.js +0 -65
- package/examples/jsm/nodes/display/BlendModeNode.js +0 -128
- package/examples/jsm/nodes/display/ColorAdjustmentNode.js +0 -99
- package/examples/jsm/nodes/display/ColorSpaceNode.js +0 -108
- package/examples/jsm/nodes/display/FrontFacingNode.js +0 -27
- package/examples/jsm/nodes/display/PassNode.js +0 -183
- package/examples/jsm/nodes/display/ToneMappingNode.js +0 -184
- package/examples/jsm/nodes/display/ViewportDepthNode.js +0 -97
- package/examples/jsm/nodes/display/ViewportDepthTextureNode.js +0 -31
- package/examples/jsm/nodes/display/ViewportNode.js +0 -134
- package/examples/jsm/nodes/display/ViewportSharedTextureNode.js +0 -31
- package/examples/jsm/nodes/fog/FogExp2Node.js +0 -35
- package/examples/jsm/nodes/fog/FogNode.js +0 -38
- package/examples/jsm/nodes/fog/FogRangeNode.js +0 -34
- package/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js +0 -40
- package/examples/jsm/nodes/functions/PhysicalLightingModel.js +0 -393
- package/examples/jsm/nodes/functions/material/getGeometryRoughness.js +0 -13
- package/examples/jsm/nodes/lighting/AONode.js +0 -27
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +0 -241
- package/examples/jsm/nodes/lighting/EnvironmentNode.js +0 -181
- package/examples/jsm/nodes/lighting/LightNode.js +0 -57
- package/examples/jsm/nodes/lighting/LightingContextNode.js +0 -66
- package/examples/jsm/nodes/lighting/LightsNode.js +0 -188
- package/examples/jsm/nodes/materials/InstancedPointsNodeMaterial.js +0 -162
- package/examples/jsm/nodes/materials/LineBasicNodeMaterial.js +0 -28
- package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +0 -28
- package/examples/jsm/nodes/materials/MeshLambertNodeMaterial.js +0 -34
- package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +0 -40
- package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +0 -65
- package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +0 -155
- package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +0 -80
- package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +0 -90
- package/examples/jsm/nodes/materialx/lib/mx_hsv.js +0 -130
- package/examples/jsm/nodes/math/HashNode.js +0 -34
- package/examples/jsm/nodes/math/MathNode.js +0 -391
- package/examples/jsm/nodes/math/OperatorNode.js +0 -274
- package/examples/jsm/nodes/procedural/CheckerNode.js +0 -42
- package/examples/jsm/nodes/utils/DiscardNode.js +0 -27
- package/examples/jsm/nodes/utils/EquirectUVNode.js +0 -33
- package/examples/jsm/nodes/utils/MatcapUVNode.js +0 -30
- package/examples/jsm/nodes/utils/PackingNode.js +0 -55
- package/examples/jsm/nodes/utils/RotateUVNode.js +0 -35
- package/examples/jsm/nodes/utils/SpecularMIPLevelNode.js +0 -37
- package/examples/jsm/objects/QuadMesh.js +0 -66
- package/examples/jsm/renderers/common/Bindings.js +0 -173
- package/examples/jsm/renderers/common/ChainMap.js +0 -89
- package/examples/jsm/renderers/common/PostProcessing.js +0 -25
- package/examples/jsm/renderers/common/RenderObject.js +0 -221
- package/examples/jsm/renderers/common/nodes/NodeBuilderState.js +0 -44
- package/examples/jsm/renderers/common/nodes/NodeSampledTexture.js +0 -49
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeFunction.js +0 -104
- package/examples/jsm/utils/GPUStatsPanel.js +0 -128
- package/examples/jsm/utils/PackedPhongMaterial.js +0 -178
- package/src/renderers/WebGL1Renderer.js +0 -7
- package/src/renderers/shaders/ShaderChunk/lightmap_fragment.glsl.js +0 -10
- /package/{examples/jsm → src}/nodes/core/NodeAttribute.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeCode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeFunctionInput.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeParser.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeVar.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeVarying.js +0 -0
- /package/{examples/jsm → src}/nodes/core/UniformGroup.js +0 -0
- /package/{examples/jsm → src}/nodes/core/constants.js +0 -0
- /package/{examples/jsm → src}/nodes/materialx/DISCLAIMER.md +0 -0
- /package/{examples/jsm → src}/nodes/parsers/GLSLNodeParser.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Binding.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Buffer.js +0 -0
- /package/{examples/jsm → src}/renderers/common/BufferUtils.js +0 -0
- /package/{examples/jsm → src}/renderers/common/ComputePipeline.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Constants.js +0 -0
- /package/{examples/jsm → src}/renderers/common/DataMap.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Pipeline.js +0 -0
- /package/{examples/jsm → src}/renderers/common/ProgrammableStage.js +0 -0
- /package/{examples/jsm → src}/renderers/common/RenderLists.js +0 -0
- /package/{examples/jsm → src}/renderers/common/RenderPipeline.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Sampler.js +0 -0
- /package/{examples/jsm → src}/renderers/common/StorageBuffer.js +0 -0
- /package/{examples/jsm → src}/renderers/common/UniformBuffer.js +0 -0
- /package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLCapabilities.js +0 -0
- /package/{examples/jsm → src}/renderers/webgpu/nodes/WGSLNodeParser.js +0 -0
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
BufferGeometry,
|
|
6
6
|
ClampToEdgeWrapping,
|
|
7
7
|
Color,
|
|
8
|
+
ColorManagement,
|
|
8
9
|
DirectionalLight,
|
|
9
10
|
EquirectangularReflectionMapping,
|
|
10
11
|
Euler,
|
|
@@ -23,13 +24,14 @@ import {
|
|
|
23
24
|
MeshPhongMaterial,
|
|
24
25
|
NumberKeyframeTrack,
|
|
25
26
|
Object3D,
|
|
26
|
-
OrthographicCamera,
|
|
27
27
|
PerspectiveCamera,
|
|
28
28
|
PointLight,
|
|
29
29
|
PropertyBinding,
|
|
30
30
|
Quaternion,
|
|
31
31
|
QuaternionKeyframeTrack,
|
|
32
32
|
RepeatWrapping,
|
|
33
|
+
SRGBColorSpace,
|
|
34
|
+
ShapeUtils,
|
|
33
35
|
Skeleton,
|
|
34
36
|
SkinnedMesh,
|
|
35
37
|
SpotLight,
|
|
@@ -39,10 +41,9 @@ import {
|
|
|
39
41
|
Vector2,
|
|
40
42
|
Vector3,
|
|
41
43
|
Vector4,
|
|
42
|
-
VectorKeyframeTrack
|
|
43
|
-
SRGBColorSpace,
|
|
44
|
-
ShapeUtils
|
|
44
|
+
VectorKeyframeTrack
|
|
45
45
|
} from 'three';
|
|
46
|
+
|
|
46
47
|
import * as fflate from '../libs/fflate.module.js';
|
|
47
48
|
import { NURBSCurve } from '../curves/NURBSCurve.js';
|
|
48
49
|
|
|
@@ -407,72 +408,50 @@ class FBXTreeParser {
|
|
|
407
408
|
// load a texture specified as a blob or data URI, or via an external URL using TextureLoader
|
|
408
409
|
loadTexture( textureNode, images ) {
|
|
409
410
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
const currentPath = this.textureLoader.path;
|
|
411
|
+
const nonNativeExtensions = new Set( [ 'tga', 'tif', 'tiff', 'exr', 'dds', 'hdr', 'ktx2' ] );
|
|
413
412
|
|
|
414
|
-
const
|
|
413
|
+
const extension = textureNode.FileName.split( '.' ).pop().toLowerCase();
|
|
415
414
|
|
|
416
|
-
|
|
415
|
+
const loader = nonNativeExtensions.has( extension ) ? this.manager.getHandler( `.${extension}` ) : this.textureLoader;
|
|
417
416
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
if ( fileName.indexOf( 'blob:' ) === 0 || fileName.indexOf( 'data:' ) === 0 ) {
|
|
417
|
+
if ( ! loader ) {
|
|
421
418
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
419
|
+
console.warn(
|
|
420
|
+
`FBXLoader: ${extension.toUpperCase()} loader not found, creating placeholder texture for`,
|
|
421
|
+
textureNode.RelativeFilename
|
|
422
|
+
);
|
|
423
|
+
return new Texture();
|
|
425
424
|
|
|
426
425
|
}
|
|
427
426
|
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
const extension = textureNode.FileName.slice( - 3 ).toLowerCase();
|
|
431
|
-
|
|
432
|
-
if ( extension === 'tga' ) {
|
|
433
|
-
|
|
434
|
-
const loader = this.manager.getHandler( '.tga' );
|
|
427
|
+
const loaderPath = loader.path;
|
|
435
428
|
|
|
436
|
-
|
|
429
|
+
if ( ! loaderPath ) {
|
|
437
430
|
|
|
438
|
-
|
|
439
|
-
texture = new Texture();
|
|
431
|
+
loader.setPath( this.textureLoader.path );
|
|
440
432
|
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
loader.setPath( this.textureLoader.path );
|
|
444
|
-
texture = loader.load( fileName );
|
|
445
|
-
|
|
446
|
-
}
|
|
433
|
+
}
|
|
447
434
|
|
|
448
|
-
|
|
435
|
+
const children = connections.get( textureNode.id ).children;
|
|
449
436
|
|
|
450
|
-
|
|
437
|
+
let fileName;
|
|
451
438
|
|
|
452
|
-
|
|
439
|
+
if ( children !== undefined && children.length > 0 && images[ children[ 0 ].ID ] !== undefined ) {
|
|
453
440
|
|
|
454
|
-
|
|
455
|
-
texture = new Texture();
|
|
441
|
+
fileName = images[ children[ 0 ].ID ];
|
|
456
442
|
|
|
457
|
-
|
|
443
|
+
if ( fileName.indexOf( 'blob:' ) === 0 || fileName.indexOf( 'data:' ) === 0 ) {
|
|
458
444
|
|
|
459
|
-
loader.setPath(
|
|
460
|
-
texture = loader.load( fileName );
|
|
445
|
+
loader.setPath( undefined );
|
|
461
446
|
|
|
462
447
|
}
|
|
463
448
|
|
|
464
|
-
} else if ( extension === 'psd' ) {
|
|
465
|
-
|
|
466
|
-
console.warn( 'FBXLoader: PSD textures are not supported, creating placeholder texture for', textureNode.RelativeFilename );
|
|
467
|
-
texture = new Texture();
|
|
468
|
-
|
|
469
|
-
} else {
|
|
470
|
-
|
|
471
|
-
texture = this.textureLoader.load( fileName );
|
|
472
|
-
|
|
473
449
|
}
|
|
474
450
|
|
|
475
|
-
|
|
451
|
+
const texture = loader.load( fileName );
|
|
452
|
+
|
|
453
|
+
// revert to initial path
|
|
454
|
+
loader.setPath( loaderPath );
|
|
476
455
|
|
|
477
456
|
return texture;
|
|
478
457
|
|
|
@@ -560,12 +539,12 @@ class FBXTreeParser {
|
|
|
560
539
|
|
|
561
540
|
if ( materialNode.Diffuse ) {
|
|
562
541
|
|
|
563
|
-
parameters.color = new Color().fromArray( materialNode.Diffuse.value )
|
|
542
|
+
parameters.color = ColorManagement.toWorkingColorSpace( new Color().fromArray( materialNode.Diffuse.value ), SRGBColorSpace );
|
|
564
543
|
|
|
565
544
|
} else if ( materialNode.DiffuseColor && ( materialNode.DiffuseColor.type === 'Color' || materialNode.DiffuseColor.type === 'ColorRGB' ) ) {
|
|
566
545
|
|
|
567
546
|
// The blender exporter exports diffuse here instead of in materialNode.Diffuse
|
|
568
|
-
parameters.color = new Color().fromArray( materialNode.DiffuseColor.value )
|
|
547
|
+
parameters.color = ColorManagement.toWorkingColorSpace( new Color().fromArray( materialNode.DiffuseColor.value ), SRGBColorSpace );
|
|
569
548
|
|
|
570
549
|
}
|
|
571
550
|
|
|
@@ -577,12 +556,12 @@ class FBXTreeParser {
|
|
|
577
556
|
|
|
578
557
|
if ( materialNode.Emissive ) {
|
|
579
558
|
|
|
580
|
-
parameters.emissive = new Color().fromArray( materialNode.Emissive.value )
|
|
559
|
+
parameters.emissive = ColorManagement.toWorkingColorSpace( new Color().fromArray( materialNode.Emissive.value ), SRGBColorSpace );
|
|
581
560
|
|
|
582
561
|
} else if ( materialNode.EmissiveColor && ( materialNode.EmissiveColor.type === 'Color' || materialNode.EmissiveColor.type === 'ColorRGB' ) ) {
|
|
583
562
|
|
|
584
563
|
// The blender exporter exports emissive color here instead of in materialNode.Emissive
|
|
585
|
-
parameters.emissive = new Color().fromArray( materialNode.EmissiveColor.value )
|
|
564
|
+
parameters.emissive = ColorManagement.toWorkingColorSpace( new Color().fromArray( materialNode.EmissiveColor.value ), SRGBColorSpace );
|
|
586
565
|
|
|
587
566
|
}
|
|
588
567
|
|
|
@@ -618,12 +597,12 @@ class FBXTreeParser {
|
|
|
618
597
|
|
|
619
598
|
if ( materialNode.Specular ) {
|
|
620
599
|
|
|
621
|
-
parameters.specular = new Color().fromArray( materialNode.Specular.value )
|
|
600
|
+
parameters.specular = ColorManagement.toWorkingColorSpace( new Color().fromArray( materialNode.Specular.value ), SRGBColorSpace );
|
|
622
601
|
|
|
623
602
|
} else if ( materialNode.SpecularColor && materialNode.SpecularColor.type === 'Color' ) {
|
|
624
603
|
|
|
625
604
|
// The blender exporter exports specular color here instead of in materialNode.Specular
|
|
626
|
-
parameters.specular = new Color().fromArray( materialNode.SpecularColor.value )
|
|
605
|
+
parameters.specular = ColorManagement.toWorkingColorSpace( new Color().fromArray( materialNode.SpecularColor.value ), SRGBColorSpace );
|
|
627
606
|
|
|
628
607
|
}
|
|
629
608
|
|
|
@@ -1116,7 +1095,8 @@ class FBXTreeParser {
|
|
|
1116
1095
|
break;
|
|
1117
1096
|
|
|
1118
1097
|
case 1: // Orthographic
|
|
1119
|
-
|
|
1098
|
+
console.warn( 'THREE.FBXLoader: Orthographic cameras not supported yet.' );
|
|
1099
|
+
model = new Object3D();
|
|
1120
1100
|
break;
|
|
1121
1101
|
|
|
1122
1102
|
default:
|
|
@@ -1173,7 +1153,7 @@ class FBXTreeParser {
|
|
|
1173
1153
|
|
|
1174
1154
|
if ( lightAttribute.Color !== undefined ) {
|
|
1175
1155
|
|
|
1176
|
-
color = new Color().fromArray( lightAttribute.Color.value )
|
|
1156
|
+
color = ColorManagement.toWorkingColorSpace( new Color().fromArray( lightAttribute.Color.value ), SRGBColorSpace );
|
|
1177
1157
|
|
|
1178
1158
|
}
|
|
1179
1159
|
|
|
@@ -1351,7 +1331,7 @@ class FBXTreeParser {
|
|
|
1351
1331
|
if ( 'InheritType' in modelNode ) transformData.inheritType = parseInt( modelNode.InheritType.value );
|
|
1352
1332
|
|
|
1353
1333
|
if ( 'RotationOrder' in modelNode ) transformData.eulerOrder = getEulerOrder( modelNode.RotationOrder.value );
|
|
1354
|
-
else transformData.eulerOrder =
|
|
1334
|
+
else transformData.eulerOrder = getEulerOrder( 0 );
|
|
1355
1335
|
|
|
1356
1336
|
if ( 'Lcl_Translation' in modelNode ) transformData.translation = modelNode.Lcl_Translation.value;
|
|
1357
1337
|
|
|
@@ -1499,7 +1479,7 @@ class FBXTreeParser {
|
|
|
1499
1479
|
|
|
1500
1480
|
if ( r !== 0 || g !== 0 || b !== 0 ) {
|
|
1501
1481
|
|
|
1502
|
-
const color = new Color( r, g, b )
|
|
1482
|
+
const color = new Color().setRGB( r, g, b, SRGBColorSpace );
|
|
1503
1483
|
sceneGraph.add( new AmbientLight( color, 1 ) );
|
|
1504
1484
|
|
|
1505
1485
|
}
|
|
@@ -2051,14 +2031,18 @@ class GeometryParser {
|
|
|
2051
2031
|
// Triangulate n-gon using earcut
|
|
2052
2032
|
|
|
2053
2033
|
const vertices = [];
|
|
2054
|
-
|
|
2034
|
+
// in morphing scenario vertexPositions represent morphPositions
|
|
2035
|
+
// while baseVertexPositions represent the original geometry's positions
|
|
2036
|
+
const positions = geoInfo.baseVertexPositions || geoInfo.vertexPositions;
|
|
2055
2037
|
for ( let i = 0; i < facePositionIndexes.length; i += 3 ) {
|
|
2056
2038
|
|
|
2057
|
-
vertices.push(
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2039
|
+
vertices.push(
|
|
2040
|
+
new Vector3(
|
|
2041
|
+
positions[ facePositionIndexes[ i ] ],
|
|
2042
|
+
positions[ facePositionIndexes[ i + 1 ] ],
|
|
2043
|
+
positions[ facePositionIndexes[ i + 2 ] ]
|
|
2044
|
+
)
|
|
2045
|
+
);
|
|
2062
2046
|
|
|
2063
2047
|
}
|
|
2064
2048
|
|
|
@@ -2071,6 +2055,12 @@ class GeometryParser {
|
|
|
2071
2055
|
|
|
2072
2056
|
}
|
|
2073
2057
|
|
|
2058
|
+
// When vertices is an array of [0,0,0] elements (which is the case for vertices not participating in morph)
|
|
2059
|
+
// the triangulationInput will be an array of [0,0] elements
|
|
2060
|
+
// resulting in an array of 0 triangles being returned from ShapeUtils.triangulateShape
|
|
2061
|
+
// leading to not pushing into buffers.vertex the redundant vertices (the vertices that are not morphed).
|
|
2062
|
+
// That's why, in order to support morphing scenario, "positions" is looking first for baseVertexPositions,
|
|
2063
|
+
// so that we don't end up with an array of 0 triangles for the faces not participating in morph.
|
|
2074
2064
|
triangles = ShapeUtils.triangulateShape( triangulationInput, [] );
|
|
2075
2065
|
|
|
2076
2066
|
} else {
|
|
@@ -2225,17 +2215,18 @@ class GeometryParser {
|
|
|
2225
2215
|
// Normal and position attributes only have data for the vertices that are affected by the morph
|
|
2226
2216
|
genMorphGeometry( parentGeo, parentGeoNode, morphGeoNode, preTransform, name ) {
|
|
2227
2217
|
|
|
2228
|
-
const
|
|
2218
|
+
const basePositions = parentGeoNode.Vertices !== undefined ? parentGeoNode.Vertices.a : [];
|
|
2219
|
+
const baseIndices = parentGeoNode.PolygonVertexIndex !== undefined ? parentGeoNode.PolygonVertexIndex.a : [];
|
|
2229
2220
|
|
|
2230
|
-
const morphPositionsSparse =
|
|
2231
|
-
const
|
|
2221
|
+
const morphPositionsSparse = morphGeoNode.Vertices !== undefined ? morphGeoNode.Vertices.a : [];
|
|
2222
|
+
const morphIndices = morphGeoNode.Indexes !== undefined ? morphGeoNode.Indexes.a : [];
|
|
2232
2223
|
|
|
2233
2224
|
const length = parentGeo.attributes.position.count * 3;
|
|
2234
2225
|
const morphPositions = new Float32Array( length );
|
|
2235
2226
|
|
|
2236
|
-
for ( let i = 0; i <
|
|
2227
|
+
for ( let i = 0; i < morphIndices.length; i ++ ) {
|
|
2237
2228
|
|
|
2238
|
-
const morphIndex =
|
|
2229
|
+
const morphIndex = morphIndices[ i ] * 3;
|
|
2239
2230
|
|
|
2240
2231
|
morphPositions[ morphIndex ] = morphPositionsSparse[ i * 3 ];
|
|
2241
2232
|
morphPositions[ morphIndex + 1 ] = morphPositionsSparse[ i * 3 + 1 ];
|
|
@@ -2245,9 +2236,9 @@ class GeometryParser {
|
|
|
2245
2236
|
|
|
2246
2237
|
// TODO: add morph normal support
|
|
2247
2238
|
const morphGeoInfo = {
|
|
2248
|
-
vertexIndices:
|
|
2239
|
+
vertexIndices: baseIndices,
|
|
2249
2240
|
vertexPositions: morphPositions,
|
|
2250
|
-
|
|
2241
|
+
baseVertexPositions: basePositions
|
|
2251
2242
|
};
|
|
2252
2243
|
|
|
2253
2244
|
const morphBuffers = this.genBuffers( morphGeoInfo );
|
|
@@ -2332,7 +2323,9 @@ class GeometryParser {
|
|
|
2332
2323
|
|
|
2333
2324
|
for ( let i = 0, c = new Color(); i < buffer.length; i += 4 ) {
|
|
2334
2325
|
|
|
2335
|
-
c.fromArray( buffer, i )
|
|
2326
|
+
c.fromArray( buffer, i );
|
|
2327
|
+
ColorManagement.toWorkingColorSpace( c, SRGBColorSpace );
|
|
2328
|
+
c.toArray( buffer, i );
|
|
2336
2329
|
|
|
2337
2330
|
}
|
|
2338
2331
|
|
|
@@ -2832,10 +2825,13 @@ class AnimationParser {
|
|
|
2832
2825
|
|
|
2833
2826
|
}
|
|
2834
2827
|
|
|
2828
|
+
// For Maya models using "Joint Orient", Euler order only applies to rotation, not pre/post-rotations
|
|
2829
|
+
const defaultEulerOrder = getEulerOrder( 0 );
|
|
2830
|
+
|
|
2835
2831
|
if ( preRotation !== undefined ) {
|
|
2836
2832
|
|
|
2837
2833
|
preRotation = preRotation.map( MathUtils.degToRad );
|
|
2838
|
-
preRotation.push(
|
|
2834
|
+
preRotation.push( defaultEulerOrder );
|
|
2839
2835
|
|
|
2840
2836
|
preRotation = new Euler().fromArray( preRotation );
|
|
2841
2837
|
preRotation = new Quaternion().setFromEuler( preRotation );
|
|
@@ -2845,7 +2841,7 @@ class AnimationParser {
|
|
|
2845
2841
|
if ( postRotation !== undefined ) {
|
|
2846
2842
|
|
|
2847
2843
|
postRotation = postRotation.map( MathUtils.degToRad );
|
|
2848
|
-
postRotation.push(
|
|
2844
|
+
postRotation.push( defaultEulerOrder );
|
|
2849
2845
|
|
|
2850
2846
|
postRotation = new Euler().fromArray( postRotation );
|
|
2851
2847
|
postRotation = new Quaternion().setFromEuler( postRotation ).invert();
|
|
@@ -4157,10 +4153,13 @@ function generateTransform( transformData ) {
|
|
|
4157
4153
|
|
|
4158
4154
|
if ( transformData.translation ) lTranslationM.setPosition( tempVec.fromArray( transformData.translation ) );
|
|
4159
4155
|
|
|
4156
|
+
// For Maya models using "Joint Orient", Euler order only applies to rotation, not pre/post-rotations
|
|
4157
|
+
const defaultEulerOrder = getEulerOrder( 0 );
|
|
4158
|
+
|
|
4160
4159
|
if ( transformData.preRotation ) {
|
|
4161
4160
|
|
|
4162
4161
|
const array = transformData.preRotation.map( MathUtils.degToRad );
|
|
4163
|
-
array.push(
|
|
4162
|
+
array.push( defaultEulerOrder );
|
|
4164
4163
|
lPreRotationM.makeRotationFromEuler( tempEuler.fromArray( array ) );
|
|
4165
4164
|
|
|
4166
4165
|
}
|
|
@@ -4168,7 +4167,7 @@ function generateTransform( transformData ) {
|
|
|
4168
4167
|
if ( transformData.rotation ) {
|
|
4169
4168
|
|
|
4170
4169
|
const array = transformData.rotation.map( MathUtils.degToRad );
|
|
4171
|
-
array.push( transformData.eulerOrder ||
|
|
4170
|
+
array.push( transformData.eulerOrder || defaultEulerOrder );
|
|
4172
4171
|
lRotationM.makeRotationFromEuler( tempEuler.fromArray( array ) );
|
|
4173
4172
|
|
|
4174
4173
|
}
|
|
@@ -4176,7 +4175,7 @@ function generateTransform( transformData ) {
|
|
|
4176
4175
|
if ( transformData.postRotation ) {
|
|
4177
4176
|
|
|
4178
4177
|
const array = transformData.postRotation.map( MathUtils.degToRad );
|
|
4179
|
-
array.push(
|
|
4178
|
+
array.push( defaultEulerOrder );
|
|
4180
4179
|
lPostRotationM.makeRotationFromEuler( tempEuler.fromArray( array ) );
|
|
4181
4180
|
lPostRotationM.invert();
|
|
4182
4181
|
|
|
@@ -85,6 +85,12 @@ class GLTFLoader extends Loader {
|
|
|
85
85
|
|
|
86
86
|
} );
|
|
87
87
|
|
|
88
|
+
this.register( function ( parser ) {
|
|
89
|
+
|
|
90
|
+
return new GLTFMaterialsDispersionExtension( parser );
|
|
91
|
+
|
|
92
|
+
} );
|
|
93
|
+
|
|
88
94
|
this.register( function ( parser ) {
|
|
89
95
|
|
|
90
96
|
return new GLTFTextureBasisUExtension( parser );
|
|
@@ -261,16 +267,6 @@ class GLTFLoader extends Loader {
|
|
|
261
267
|
|
|
262
268
|
}
|
|
263
269
|
|
|
264
|
-
setDDSLoader() {
|
|
265
|
-
|
|
266
|
-
throw new Error(
|
|
267
|
-
|
|
268
|
-
'THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".'
|
|
269
|
-
|
|
270
|
-
);
|
|
271
|
-
|
|
272
|
-
}
|
|
273
|
-
|
|
274
270
|
setKTX2Loader( ktx2Loader ) {
|
|
275
271
|
|
|
276
272
|
this.ktx2Loader = ktx2Loader;
|
|
@@ -491,6 +487,7 @@ const EXTENSIONS = {
|
|
|
491
487
|
KHR_DRACO_MESH_COMPRESSION: 'KHR_draco_mesh_compression',
|
|
492
488
|
KHR_LIGHTS_PUNCTUAL: 'KHR_lights_punctual',
|
|
493
489
|
KHR_MATERIALS_CLEARCOAT: 'KHR_materials_clearcoat',
|
|
490
|
+
KHR_MATERIALS_DISPERSION: 'KHR_materials_dispersion',
|
|
494
491
|
KHR_MATERIALS_IOR: 'KHR_materials_ior',
|
|
495
492
|
KHR_MATERIALS_SHEEN: 'KHR_materials_sheen',
|
|
496
493
|
KHR_MATERIALS_SPECULAR: 'KHR_materials_specular',
|
|
@@ -824,6 +821,52 @@ class GLTFMaterialsClearcoatExtension {
|
|
|
824
821
|
|
|
825
822
|
}
|
|
826
823
|
|
|
824
|
+
/**
|
|
825
|
+
* Materials dispersion Extension
|
|
826
|
+
*
|
|
827
|
+
* Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_dispersion
|
|
828
|
+
*/
|
|
829
|
+
class GLTFMaterialsDispersionExtension {
|
|
830
|
+
|
|
831
|
+
constructor( parser ) {
|
|
832
|
+
|
|
833
|
+
this.parser = parser;
|
|
834
|
+
this.name = EXTENSIONS.KHR_MATERIALS_DISPERSION;
|
|
835
|
+
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
getMaterialType( materialIndex ) {
|
|
839
|
+
|
|
840
|
+
const parser = this.parser;
|
|
841
|
+
const materialDef = parser.json.materials[ materialIndex ];
|
|
842
|
+
|
|
843
|
+
if ( ! materialDef.extensions || ! materialDef.extensions[ this.name ] ) return null;
|
|
844
|
+
|
|
845
|
+
return MeshPhysicalMaterial;
|
|
846
|
+
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
extendMaterialParams( materialIndex, materialParams ) {
|
|
850
|
+
|
|
851
|
+
const parser = this.parser;
|
|
852
|
+
const materialDef = parser.json.materials[ materialIndex ];
|
|
853
|
+
|
|
854
|
+
if ( ! materialDef.extensions || ! materialDef.extensions[ this.name ] ) {
|
|
855
|
+
|
|
856
|
+
return Promise.resolve();
|
|
857
|
+
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
const extension = materialDef.extensions[ this.name ];
|
|
861
|
+
|
|
862
|
+
materialParams.dispersion = extension.dispersion !== undefined ? extension.dispersion : 0;
|
|
863
|
+
|
|
864
|
+
return Promise.resolve();
|
|
865
|
+
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
}
|
|
869
|
+
|
|
827
870
|
/**
|
|
828
871
|
* Iridescence Materials Extension
|
|
829
872
|
*
|
|
@@ -2527,18 +2570,24 @@ class GLTFParser {
|
|
|
2527
2570
|
// expensive work of uploading a texture to the GPU off the main thread.
|
|
2528
2571
|
|
|
2529
2572
|
let isSafari = false;
|
|
2573
|
+
let safariVersion = - 1;
|
|
2530
2574
|
let isFirefox = false;
|
|
2531
2575
|
let firefoxVersion = - 1;
|
|
2532
2576
|
|
|
2533
2577
|
if ( typeof navigator !== 'undefined' ) {
|
|
2534
2578
|
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2579
|
+
const userAgent = navigator.userAgent;
|
|
2580
|
+
|
|
2581
|
+
isSafari = /^((?!chrome|android).)*safari/i.test( userAgent ) === true;
|
|
2582
|
+
const safariMatch = userAgent.match( /Version\/(\d+)/ );
|
|
2583
|
+
safariVersion = isSafari && safariMatch ? parseInt( safariMatch[ 1 ], 10 ) : - 1;
|
|
2584
|
+
|
|
2585
|
+
isFirefox = userAgent.indexOf( 'Firefox' ) > - 1;
|
|
2586
|
+
firefoxVersion = isFirefox ? userAgent.match( /Firefox\/([0-9]+)\./ )[ 1 ] : - 1;
|
|
2538
2587
|
|
|
2539
2588
|
}
|
|
2540
2589
|
|
|
2541
|
-
if ( typeof createImageBitmap === 'undefined' || isSafari || ( isFirefox && firefoxVersion < 98 ) ) {
|
|
2590
|
+
if ( typeof createImageBitmap === 'undefined' || ( isSafari && safariVersion < 17 ) || ( isFirefox && firefoxVersion < 98 ) ) {
|
|
2542
2591
|
|
|
2543
2592
|
this.textureLoader = new TextureLoader( this.options.manager );
|
|
2544
2593
|
|
|
@@ -2627,6 +2676,12 @@ class GLTFParser {
|
|
|
2627
2676
|
|
|
2628
2677
|
} ) ).then( function () {
|
|
2629
2678
|
|
|
2679
|
+
for ( const scene of result.scenes ) {
|
|
2680
|
+
|
|
2681
|
+
scene.updateMatrixWorld();
|
|
2682
|
+
|
|
2683
|
+
}
|
|
2684
|
+
|
|
2630
2685
|
onLoad( result );
|
|
2631
2686
|
|
|
2632
2687
|
} );
|
|
@@ -3088,6 +3143,9 @@ class GLTFParser {
|
|
|
3088
3143
|
|
|
3089
3144
|
}
|
|
3090
3145
|
|
|
3146
|
+
// Ignore normalized since we copy from sparse
|
|
3147
|
+
bufferAttribute.normalized = false;
|
|
3148
|
+
|
|
3091
3149
|
for ( let i = 0, il = sparseIndices.length; i < il; i ++ ) {
|
|
3092
3150
|
|
|
3093
3151
|
const index = sparseIndices[ i ];
|
|
@@ -3100,6 +3158,8 @@ class GLTFParser {
|
|
|
3100
3158
|
|
|
3101
3159
|
}
|
|
3102
3160
|
|
|
3161
|
+
bufferAttribute.normalized = normalized;
|
|
3162
|
+
|
|
3103
3163
|
}
|
|
3104
3164
|
|
|
3105
3165
|
return bufferAttribute;
|
|
@@ -3259,6 +3319,8 @@ class GLTFParser {
|
|
|
3259
3319
|
|
|
3260
3320
|
}
|
|
3261
3321
|
|
|
3322
|
+
assignExtrasToUserData( texture, sourceDef );
|
|
3323
|
+
|
|
3262
3324
|
texture.userData.mimeType = sourceDef.mimeType || getImageURIMimeType( sourceDef.uri );
|
|
3263
3325
|
|
|
3264
3326
|
return texture;
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* References:
|
|
10
10
|
* - KTX: http://github.khronos.org/KTX-Specification/
|
|
11
11
|
* - DFD: https://www.khronos.org/registry/DataFormat/specs/1.3/dataformat.1.3.html#basicdescriptor
|
|
12
|
+
* - BasisU HDR: https://github.com/BinomialLLC/basis_universal/wiki/UASTC-HDR-Texture-Specification-v1.0
|
|
12
13
|
*/
|
|
13
14
|
|
|
14
15
|
import {
|
|
@@ -31,13 +32,13 @@ import {
|
|
|
31
32
|
RGB_ETC1_Format,
|
|
32
33
|
RGB_ETC2_Format,
|
|
33
34
|
RGB_PVRTC_4BPPV1_Format,
|
|
34
|
-
RGB_S3TC_DXT1_Format,
|
|
35
35
|
RGBA_ASTC_4x4_Format,
|
|
36
36
|
RGBA_ASTC_6x6_Format,
|
|
37
37
|
RGBA_BPTC_Format,
|
|
38
38
|
RGBA_ETC2_EAC_Format,
|
|
39
39
|
RGBA_PVRTC_4BPPV1_Format,
|
|
40
40
|
RGBA_S3TC_DXT5_Format,
|
|
41
|
+
RGBA_S3TC_DXT1_Format,
|
|
41
42
|
RGBAFormat,
|
|
42
43
|
RGFormat,
|
|
43
44
|
SRGBColorSpace,
|
|
@@ -63,6 +64,7 @@ import {
|
|
|
63
64
|
VK_FORMAT_R8G8_UNORM,
|
|
64
65
|
VK_FORMAT_R8G8B8A8_SRGB,
|
|
65
66
|
VK_FORMAT_R8G8B8A8_UNORM,
|
|
67
|
+
VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT,
|
|
66
68
|
VK_FORMAT_ASTC_6x6_SRGB_BLOCK,
|
|
67
69
|
VK_FORMAT_ASTC_6x6_UNORM_BLOCK,
|
|
68
70
|
KHR_DF_PRIMARIES_UNSPECIFIED,
|
|
@@ -160,13 +162,6 @@ class KTX2Loader extends Loader {
|
|
|
160
162
|
|| renderer.extensions.has( 'WEBKIT_WEBGL_compressed_texture_pvrtc' )
|
|
161
163
|
};
|
|
162
164
|
|
|
163
|
-
if ( renderer.capabilities.isWebGL2 ) {
|
|
164
|
-
|
|
165
|
-
// https://github.com/mrdoob/three.js/pull/22928
|
|
166
|
-
this.workerConfig.etc1Supported = false;
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
|
|
170
165
|
}
|
|
171
166
|
|
|
172
167
|
return this;
|
|
@@ -258,21 +253,33 @@ class KTX2Loader extends Loader {
|
|
|
258
253
|
|
|
259
254
|
loader.load( url, ( buffer ) => {
|
|
260
255
|
|
|
261
|
-
|
|
262
|
-
// again from this thread.
|
|
263
|
-
if ( _taskCache.has( buffer ) ) {
|
|
256
|
+
this.parse( buffer, onLoad, onError );
|
|
264
257
|
|
|
265
|
-
|
|
258
|
+
}, onProgress, onError );
|
|
266
259
|
|
|
267
|
-
|
|
260
|
+
}
|
|
268
261
|
|
|
269
|
-
|
|
262
|
+
parse( buffer, onLoad, onError ) {
|
|
270
263
|
|
|
271
|
-
|
|
272
|
-
.then( ( texture ) => onLoad ? onLoad( texture ) : null )
|
|
273
|
-
.catch( onError );
|
|
264
|
+
if ( this.workerConfig === null ) {
|
|
274
265
|
|
|
275
|
-
|
|
266
|
+
throw new Error( 'THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.' );
|
|
267
|
+
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// Check for an existing task using this buffer. A transferred buffer cannot be transferred
|
|
271
|
+
// again from this thread.
|
|
272
|
+
if ( _taskCache.has( buffer ) ) {
|
|
273
|
+
|
|
274
|
+
const cachedTask = _taskCache.get( buffer );
|
|
275
|
+
|
|
276
|
+
return cachedTask.promise.then( onLoad ).catch( onError );
|
|
277
|
+
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
this._createTexture( buffer )
|
|
281
|
+
.then( ( texture ) => onLoad ? onLoad( texture ) : null )
|
|
282
|
+
.catch( onError );
|
|
276
283
|
|
|
277
284
|
}
|
|
278
285
|
|
|
@@ -391,7 +398,7 @@ KTX2Loader.EngineFormat = {
|
|
|
391
398
|
RGB_ETC1_Format: RGB_ETC1_Format,
|
|
392
399
|
RGB_ETC2_Format: RGB_ETC2_Format,
|
|
393
400
|
RGB_PVRTC_4BPPV1_Format: RGB_PVRTC_4BPPV1_Format,
|
|
394
|
-
|
|
401
|
+
RGBA_S3TC_DXT1_Format: RGBA_S3TC_DXT1_Format,
|
|
395
402
|
};
|
|
396
403
|
|
|
397
404
|
|
|
@@ -607,7 +614,7 @@ KTX2Loader.BasisWorker = function () {
|
|
|
607
614
|
if: 'dxtSupported',
|
|
608
615
|
basisFormat: [ BasisFormat.ETC1S, BasisFormat.UASTC_4x4 ],
|
|
609
616
|
transcoderFormat: [ TranscoderFormat.BC1, TranscoderFormat.BC3 ],
|
|
610
|
-
engineFormat: [ EngineFormat.
|
|
617
|
+
engineFormat: [ EngineFormat.RGBA_S3TC_DXT1_Format, EngineFormat.RGBA_S3TC_DXT5_Format ],
|
|
611
618
|
priorityETC1S: 4,
|
|
612
619
|
priorityUASTC: 5,
|
|
613
620
|
needsPowerOfTwo: false,
|
|
@@ -725,8 +732,7 @@ KTX2Loader.BasisWorker = function () {
|
|
|
725
732
|
|
|
726
733
|
};
|
|
727
734
|
|
|
728
|
-
//
|
|
729
|
-
// Parsing for non-Basis textures. These textures are may have supercompression
|
|
735
|
+
// Parsing for non-Basis textures. These textures may have supercompression
|
|
730
736
|
// like Zstd, but they do not require transcoding.
|
|
731
737
|
|
|
732
738
|
const UNCOMPRESSED_FORMATS = new Set( [ RGBAFormat, RGFormat, RedFormat ] );
|
|
@@ -748,6 +754,7 @@ const FORMAT_MAP = {
|
|
|
748
754
|
[ VK_FORMAT_R8_SRGB ]: RedFormat,
|
|
749
755
|
[ VK_FORMAT_R8_UNORM ]: RedFormat,
|
|
750
756
|
|
|
757
|
+
[ VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT ]: RGBA_ASTC_4x4_Format,
|
|
751
758
|
[ VK_FORMAT_ASTC_6x6_SRGB_BLOCK ]: RGBA_ASTC_6x6_Format,
|
|
752
759
|
[ VK_FORMAT_ASTC_6x6_UNORM_BLOCK ]: RGBA_ASTC_6x6_Format,
|
|
753
760
|
|
|
@@ -770,6 +777,7 @@ const TYPE_MAP = {
|
|
|
770
777
|
[ VK_FORMAT_R8_SRGB ]: UnsignedByteType,
|
|
771
778
|
[ VK_FORMAT_R8_UNORM ]: UnsignedByteType,
|
|
772
779
|
|
|
780
|
+
[ VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT ]: HalfFloatType,
|
|
773
781
|
[ VK_FORMAT_ASTC_6x6_SRGB_BLOCK ]: UnsignedByteType,
|
|
774
782
|
[ VK_FORMAT_ASTC_6x6_UNORM_BLOCK ]: UnsignedByteType,
|
|
775
783
|
|
|
@@ -1974,7 +1974,7 @@ class LDrawLoader extends Loader {
|
|
|
1974
1974
|
|
|
1975
1975
|
}
|
|
1976
1976
|
|
|
1977
|
-
parse( text, onLoad ) {
|
|
1977
|
+
parse( text, onLoad, onError ) {
|
|
1978
1978
|
|
|
1979
1979
|
this.partsCache
|
|
1980
1980
|
.parseModel( text, this.materialLibrary )
|
|
@@ -1985,7 +1985,8 @@ class LDrawLoader extends Loader {
|
|
|
1985
1985
|
group.userData.fileName = '';
|
|
1986
1986
|
onLoad( group );
|
|
1987
1987
|
|
|
1988
|
-
} )
|
|
1988
|
+
} )
|
|
1989
|
+
.catch( onError );
|
|
1989
1990
|
|
|
1990
1991
|
}
|
|
1991
1992
|
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
ClampToEdgeWrapping,
|
|
6
|
-
DataTexture,
|
|
7
6
|
Data3DTexture,
|
|
8
7
|
FileLoader,
|
|
9
8
|
FloatType,
|
|
@@ -144,19 +143,6 @@ export class LUT3dlLoader extends Loader {
|
|
|
144
143
|
|
|
145
144
|
}
|
|
146
145
|
|
|
147
|
-
const texture = new DataTexture();
|
|
148
|
-
texture.image.data = data;
|
|
149
|
-
texture.image.width = size;
|
|
150
|
-
texture.image.height = size * size;
|
|
151
|
-
texture.format = RGBAFormat;
|
|
152
|
-
texture.type = this.type;
|
|
153
|
-
texture.magFilter = LinearFilter;
|
|
154
|
-
texture.minFilter = LinearFilter;
|
|
155
|
-
texture.wrapS = ClampToEdgeWrapping;
|
|
156
|
-
texture.wrapT = ClampToEdgeWrapping;
|
|
157
|
-
texture.generateMipmaps = false;
|
|
158
|
-
texture.needsUpdate = true;
|
|
159
|
-
|
|
160
146
|
const texture3D = new Data3DTexture();
|
|
161
147
|
texture3D.image.data = data;
|
|
162
148
|
texture3D.image.width = size;
|
|
@@ -174,7 +160,6 @@ export class LUT3dlLoader extends Loader {
|
|
|
174
160
|
|
|
175
161
|
return {
|
|
176
162
|
size,
|
|
177
|
-
texture,
|
|
178
163
|
texture3D,
|
|
179
164
|
};
|
|
180
165
|
|