@unikia/upe-renderer 0.186.110 → 0.187.11
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 +5 -7
- package/UPSTREAM.md +4 -4
- package/build/three.core.js +853 -277
- package/build/three.module.js +1098 -1280
- package/build/three.tsl.js +41938 -686
- package/build/three.webgpu.js +10604 -49055
- package/build/three.webgpu.nodes.js +9249 -5788
- package/examples/jsm/Addons.js +2 -0
- package/examples/jsm/animation/CCDIKSolver.js +17 -5
- package/examples/jsm/controls/FirstPersonControls.js +1 -1
- package/examples/jsm/controls/OrbitControls.js +27 -14
- package/examples/jsm/csm/CSMShader.js +74 -3
- package/examples/jsm/curves/CurveExtras.js +4 -4
- package/examples/jsm/curves/NURBSCurve.js +14 -0
- package/examples/jsm/exporters/EXRExporter.js +673 -16
- package/examples/jsm/exporters/GLTFExporter.js +4 -4
- package/examples/jsm/exporters/KTX2Exporter.js +1 -1
- package/examples/jsm/exporters/OBJExporter.js +48 -5
- package/examples/jsm/exporters/PLYExporter.js +22 -11
- package/examples/jsm/generators/CityGenerator.js +3 -2
- package/examples/jsm/generators/city/SkyscraperGenerator.js +63 -21
- package/examples/jsm/gpgpu/BitonicSort.js +30 -23
- package/examples/jsm/helpers/VertexTangentsHelper.js +1 -1
- package/examples/jsm/inspector/Extension.js +1 -1
- package/examples/jsm/inspector/Inspector.js +6 -46
- package/examples/jsm/inspector/RendererInspector.js +43 -8
- package/examples/jsm/inspector/Storage.js +49 -0
- package/examples/jsm/inspector/extensions/color-grading/ColorGrading.js +32 -27
- package/examples/jsm/inspector/tabs/Parameters.js +5 -1
- package/examples/jsm/inspector/tabs/Performance.js +22 -7
- package/examples/jsm/inspector/tabs/Settings.js +1 -1
- package/examples/jsm/inspector/tabs/Timeline.js +83 -7
- package/examples/jsm/inspector/tabs/Viewer.js +25 -10
- package/examples/jsm/inspector/ui/Profiler.js +1 -1
- package/examples/jsm/inspector/ui/Style.js +21 -53
- package/examples/jsm/inspector/ui/Values.js +28 -3
- package/examples/jsm/libs/fflate.module.js +83 -56
- package/examples/jsm/libs/mikktspace.README.md +27 -0
- package/examples/jsm/libs/mikktspace.module.js +721 -109
- package/examples/jsm/lighting/ClusteredLighting.js +100 -2
- package/examples/jsm/lighting/LightMapper.js +295 -0
- package/examples/jsm/lighting/LightProbeGrid.js +242 -139
- package/examples/jsm/lighting/LightProbeGridWebGL.js +30 -14
- package/examples/jsm/lighting/vxgi/VXGIConeTracer.js +54 -5
- package/examples/jsm/lighting/vxgi/VXGIIrradiance.js +43 -0
- package/examples/jsm/lighting/vxgi/VXGINode.js +13 -56
- package/examples/jsm/lighting/vxgi/VXGISceneCollector.js +316 -1
- package/examples/jsm/lighting/vxgi/VXGIVolume.js +69 -59
- package/examples/jsm/lights/SunLight.js +9 -4
- package/examples/jsm/lights/SunLightNode.js +3 -3
- package/examples/jsm/lines/LineMaterial.js +26 -10
- package/examples/jsm/loaders/3DMLoader.js +10 -1
- package/examples/jsm/loaders/3MFLoader.js +5 -1
- package/examples/jsm/loaders/AMFLoader.js +2 -0
- package/examples/jsm/loaders/BVHLoader.js +2 -0
- package/examples/jsm/loaders/ColladaLoader.js +8 -0
- package/examples/jsm/loaders/DDSLoader.js +1 -1
- package/examples/jsm/loaders/DRACOLoader.js +5 -1
- package/examples/jsm/loaders/EXRLoader.js +120 -104
- package/examples/jsm/loaders/FBXLoader.js +4 -0
- package/examples/jsm/loaders/FontLoader.js +2 -0
- package/examples/jsm/loaders/GCodeLoader.js +5 -9
- package/examples/jsm/loaders/GLTFLoader.js +112 -31
- package/examples/jsm/loaders/GaussianSplatPLYLoader.js +2 -0
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +3 -0
- package/examples/jsm/loaders/IESLoader.js +46 -12
- package/examples/jsm/loaders/JXLLoader.js +159 -0
- package/examples/jsm/loaders/KMZLoader.js +6 -0
- package/examples/jsm/loaders/KSPLATLoader.js +2 -0
- package/examples/jsm/loaders/KTX2Loader.js +49 -4
- package/examples/jsm/loaders/KTXLoader.js +5 -3
- package/examples/jsm/loaders/LDrawLoader.js +15 -22
- package/examples/jsm/loaders/LUT3dlLoader.js +5 -1
- package/examples/jsm/loaders/LUTCubeLoader.js +6 -2
- package/examples/jsm/loaders/LUTImageLoader.js +2 -0
- package/examples/jsm/loaders/LWOLoader.js +6 -0
- package/examples/jsm/loaders/MD2Loader.js +2 -0
- package/examples/jsm/loaders/MDDLoader.js +4 -0
- package/examples/jsm/loaders/MTLLoader.js +8 -0
- package/examples/jsm/loaders/MaterialXLoader.js +57 -5
- package/examples/jsm/loaders/NRRDLoader.js +4 -2
- package/examples/jsm/loaders/OBJLoader.js +10 -4
- package/examples/jsm/loaders/PCDLoader.js +6 -2
- package/examples/jsm/loaders/PDBLoader.js +5 -3
- package/examples/jsm/loaders/PLYLoader.js +39 -15
- package/examples/jsm/loaders/PVRLoader.js +2 -2
- package/examples/jsm/loaders/SPLATLoader.js +2 -0
- package/examples/jsm/loaders/SPZLoader.js +2 -0
- package/examples/jsm/loaders/STLLoader.js +3 -1
- package/examples/jsm/loaders/SVGLoader.js +27 -49
- package/examples/jsm/loaders/TDSLoader.js +4 -0
- package/examples/jsm/loaders/TGALoader.js +6 -5
- package/examples/jsm/loaders/TTFLoader.js +2 -0
- package/examples/jsm/loaders/USDLoader.js +14 -0
- package/examples/jsm/loaders/UltraHDRLoader.js +2 -0
- package/examples/jsm/loaders/VOXLoader.js +3 -0
- package/examples/jsm/loaders/VRMLLoader.js +4 -0
- package/examples/jsm/loaders/VTKLoader.js +2 -0
- package/examples/jsm/loaders/XYZLoader.js +2 -0
- package/examples/jsm/loaders/collada/ColladaComposer.js +15 -8
- package/examples/jsm/loaders/materialx/MaterialXDocument.js +610 -138
- package/examples/jsm/loaders/materialx/MaterialXInterfaceValidation.js +12 -95
- package/examples/jsm/loaders/materialx/MaterialXLog.js +4 -0
- package/examples/jsm/loaders/materialx/MaterialXNodeDefs.js +99 -0
- package/examples/jsm/loaders/materialx/MaterialXNodeInterfaceRegistry.js +760 -1
- package/examples/jsm/loaders/materialx/MaterialXNodeLibrary.js +222 -372
- package/examples/jsm/loaders/materialx/MaterialXSurfaceMappings.js +163 -259
- package/examples/jsm/loaders/materialx/MaterialXUtils.js +25 -0
- package/examples/jsm/loaders/materialx/compile/MaterialXCompileRegistry.js +161 -159
- package/examples/jsm/loaders/usd/USDAParser.js +56 -47
- package/examples/jsm/loaders/usd/USDComposer.js +25 -30
- package/examples/jsm/math/ColorConverter.js +7 -3
- package/examples/jsm/math/Lut.js +2 -2
- package/examples/jsm/math/OBB.js +3 -3
- package/examples/jsm/math/Octree.js +20 -17
- package/examples/jsm/objects/GaussianSplat.js +5 -4
- package/examples/jsm/objects/Reflector.js +5 -0
- package/examples/jsm/objects/SkyMesh.js +14 -7
- package/examples/jsm/objects/Water2Mesh.js +2 -2
- package/examples/jsm/physics/RapierPhysics.js +2 -2
- package/examples/jsm/pipelines/MeshletDrawingPipeline.js +5571 -0
- package/examples/jsm/pipelines/VisibilityBufferDrawingPipeline.js +954 -0
- package/examples/jsm/postprocessing/BokehPass.js +1 -1
- package/examples/jsm/postprocessing/GTAOPass.js +26 -18
- package/examples/jsm/renderers/SVGRenderer.js +3 -2
- package/examples/jsm/shaders/GTAOShader.js +7 -4
- package/examples/jsm/shaders/PoissonDenoiseShader.js +1 -10
- package/examples/jsm/tsl/WebGLNodesHandler.js +21 -9
- package/examples/jsm/tsl/display/AfterImageNode.js +3 -3
- package/examples/jsm/tsl/display/BilateralBlurNode.js +3 -3
- package/examples/jsm/tsl/display/BloomNode.js +3 -3
- package/examples/jsm/tsl/display/ChromaticAberrationNode.js +8 -19
- package/examples/jsm/tsl/display/DenoiseNode.js +5 -5
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +3 -3
- package/examples/jsm/tsl/display/DotScreenNode.js +3 -3
- package/examples/jsm/tsl/display/FSR1Node.js +3 -3
- package/examples/jsm/tsl/display/FXAANode.js +3 -10
- package/examples/jsm/tsl/display/FilmNode.js +3 -3
- package/examples/jsm/tsl/display/GTAONode.js +33 -25
- package/examples/jsm/tsl/display/GaussianBlurNode.js +3 -3
- package/examples/jsm/tsl/display/GodraysNode.js +5 -19
- package/examples/jsm/tsl/display/ImportanceSampledEnvironment.js +8 -4
- package/examples/jsm/tsl/display/LensflareNode.js +3 -3
- package/examples/jsm/tsl/display/Lut3DNode.js +3 -3
- package/examples/jsm/tsl/display/OITPassNode.js +0 -11
- package/examples/jsm/tsl/display/OutlineNode.js +107 -5
- package/examples/jsm/tsl/display/PixelationPassNode.js +85 -193
- package/examples/jsm/tsl/display/RGBShiftNode.js +3 -3
- package/examples/jsm/tsl/display/RecurrentDenoiseNode.js +23 -126
- package/examples/jsm/tsl/display/SMAANode.js +3 -3
- package/examples/jsm/tsl/display/SSAONode.js +6 -20
- package/examples/jsm/tsl/display/SSGINode.js +36 -29
- package/examples/jsm/tsl/display/SSRNode.js +135 -63
- package/examples/jsm/tsl/display/SSSNode.js +6 -20
- package/examples/jsm/tsl/display/SharpenNode.js +3 -3
- package/examples/jsm/tsl/display/SobelOperatorNode.js +3 -3
- package/examples/jsm/tsl/display/TAAUNode.js +10 -42
- package/examples/jsm/tsl/display/TRAANode.js +11 -43
- package/examples/jsm/tsl/display/TemporalReprojectNode.js +42 -47
- package/examples/jsm/tsl/display/TransitionNode.js +3 -3
- package/examples/jsm/tsl/display/lensDirt.js +30 -0
- package/examples/jsm/tsl/lighting/ClusteredLightsNode.js +482 -121
- package/examples/jsm/tsl/lighting/DynamicLightsNode.js +41 -140
- package/examples/jsm/tsl/lighting/LightProbeGridNode.js +72 -25
- package/examples/jsm/tsl/lighting/data/AmbientLightDataNode.js +6 -0
- package/examples/jsm/tsl/lighting/data/DirectionalLightDataNode.js +6 -0
- package/examples/jsm/tsl/lighting/data/HemisphereLightDataNode.js +6 -0
- package/examples/jsm/tsl/lighting/data/PointLightDataNode.js +6 -0
- package/examples/jsm/tsl/lighting/data/SpotLightDataNode.js +6 -0
- package/examples/jsm/tsl/shadows/TileShadowNode.js +102 -14
- package/examples/jsm/tsl/utils/Raymarching.js +1 -1
- package/examples/jsm/tsl/utils/SoftParticles.js +5 -12
- package/examples/jsm/tsl/utils/SpecularHelpers.js +47 -70
- package/examples/jsm/tsl/utils/TAAUtils.js +6 -17
- package/examples/jsm/utils/BufferGeometryUtils.js +110 -88
- package/examples/jsm/utils/MeshletGeometryUtils.js +417 -0
- package/examples/jsm/utils/SceneOptimizer.js +2 -1
- package/examples/jsm/utils/SceneUtils.js +1 -1
- package/examples/jsm/utils/unwrapUVs.js +865 -0
- package/examples/jsm/webxr/XREstimatedLight.js +11 -4
- package/package.json +3 -3
- package/src/Three.TSL.js +2 -683
- package/src/Three.WebGPU.Nodes.js +2 -1
- package/src/Three.WebGPU.js +2 -1
- package/src/animation/AnimationAction.js +1 -1
- package/src/animation/AnimationUtils.js +1 -3
- package/src/animation/KeyframeTrack.js +19 -0
- package/src/cameras/ArrayCamera.js +12 -0
- package/src/cameras/CubeCamera.js +3 -3
- package/src/constants.js +1 -9
- package/src/core/BufferAttribute.js +57 -21
- package/src/core/BufferGeometry.js +5 -13
- package/src/core/Clock.js +1 -1
- package/src/core/InterleavedBuffer.js +28 -18
- package/src/core/InterleavedBufferAttribute.js +54 -20
- package/src/core/Object3D.js +19 -9
- package/src/core/Raycaster.js +2 -0
- package/src/core/RenderTarget.js +11 -5
- package/src/core/UniformsGroup.js +7 -3
- package/src/extras/PMREMGenerator.js +392 -685
- package/src/extras/core/Curve.js +4 -0
- package/src/extras/core/CurvePath.js +13 -0
- package/src/extras/core/ShapePath.js +1 -1
- package/src/geometries/EdgesGeometry.js +12 -10
- package/src/geometries/LatheGeometry.js +2 -0
- package/src/helpers/PolarGridHelper.js +1 -1
- package/src/lights/Light.js +11 -0
- package/src/lights/LightProbe.js +2 -0
- package/src/lights/LightShadow.js +2 -0
- package/src/loaders/AnimationLoader.js +2 -0
- package/src/loaders/AudioLoader.js +2 -0
- package/src/loaders/BufferGeometryLoader.js +2 -0
- package/src/loaders/CompressedTextureLoader.js +2 -0
- package/src/loaders/CubeTextureLoader.js +2 -0
- package/src/loaders/DataTextureLoader.js +2 -0
- package/src/loaders/FileLoader.js +2 -0
- package/src/loaders/ImageBitmapLoader.js +3 -1
- package/src/loaders/ImageLoader.js +1 -0
- package/src/loaders/Loader.js +47 -0
- package/src/loaders/MaterialLoader.js +2 -0
- package/src/loaders/ObjectLoader.js +27 -8
- package/src/loaders/TextureLoader.js +5 -3
- package/src/loaders/nodes/NodeLoader.js +2 -0
- package/src/materials/Material.js +21 -2
- package/src/materials/MeshDepthMaterial.js +1 -1
- package/src/materials/MeshDistanceMaterial.js +1 -1
- package/src/materials/MeshLambertMaterial.js +1 -1
- package/src/materials/MeshMatcapMaterial.js +1 -1
- package/src/materials/MeshNormalMaterial.js +1 -1
- package/src/materials/MeshPhongMaterial.js +1 -1
- package/src/materials/MeshPhysicalMaterial.js +90 -11
- package/src/materials/MeshStandardMaterial.js +1 -1
- package/src/materials/MeshToonMaterial.js +1 -1
- package/src/materials/nodes/Line2NodeMaterial.js +32 -10
- package/src/materials/nodes/MeshLambertNodeMaterial.js +13 -0
- package/src/materials/nodes/MeshPhongNodeMaterial.js +13 -0
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +40 -5
- package/src/materials/nodes/MeshToonNodeMaterial.js +13 -0
- package/src/materials/nodes/NodeMaterial.js +36 -16
- package/src/materials/nodes/NodeMaterialInstance.js +193 -0
- package/src/materials/nodes/NodeMaterials.js +1 -0
- package/src/materials/nodes/PointsNodeMaterial.js +1 -1
- package/src/materials/nodes/SpriteNodeMaterial.js +3 -3
- package/src/materials/nodes/manager/NodeMaterialObserver.js +191 -22
- package/src/math/Box3.js +2 -2
- package/src/math/Color.js +8 -8
- package/src/math/ColorManagement.js +2 -21
- package/src/math/FrustumArray.js +12 -0
- package/src/math/Interpolant.js +1 -1
- package/src/math/Line3.js +2 -4
- package/src/math/MathUtils.js +33 -46
- package/src/math/Matrix2.js +1 -1
- package/src/math/Matrix3.js +1 -1
- package/src/math/Matrix4.js +1 -1
- package/src/math/Triangle.js +2 -1
- package/src/math/Vector2.js +1 -1
- package/src/math/Vector3.js +1 -1
- package/src/math/Vector4.js +1 -1
- package/src/nodes/Nodes.js +1 -0
- package/src/nodes/TSL.js +2 -0
- package/src/nodes/accessors/Arrays.js +1 -1
- package/src/nodes/accessors/Batch.js +29 -23
- package/src/nodes/accessors/BufferAttributeNode.js +21 -1
- package/src/nodes/accessors/BuiltinNode.js +6 -0
- package/src/nodes/accessors/Camera.js +100 -93
- package/src/nodes/accessors/ClippingNode.js +17 -6
- package/src/nodes/accessors/CubeTextureNode.js +12 -24
- package/src/nodes/accessors/Instance.js +198 -160
- package/src/nodes/accessors/Lights.js +19 -6
- package/src/nodes/accessors/MaterialNode.js +33 -4
- package/src/nodes/accessors/Morph.js +81 -22
- package/src/nodes/accessors/Normal.js +0 -42
- package/src/nodes/accessors/Object3DNode.js +6 -0
- package/src/nodes/accessors/PointUVNode.js +6 -0
- package/src/nodes/accessors/ReferenceAttributeNode.js +279 -0
- package/src/nodes/accessors/ReferenceBaseNode.js +6 -0
- package/src/nodes/accessors/ReferenceNode.js +6 -0
- package/src/nodes/accessors/Skinning.js +57 -52
- package/src/nodes/accessors/StorageBufferNode.js +3 -12
- package/src/nodes/accessors/TextureBicubic.js +30 -27
- package/src/nodes/accessors/TextureNode.js +164 -78
- package/src/nodes/accessors/TextureSizeNode.js +6 -0
- package/src/nodes/accessors/UniformArrayNode.js +8 -15
- package/src/nodes/accessors/VelocityNode.js +13 -8
- package/src/nodes/code/CodeNode.js +6 -0
- package/src/nodes/code/ExpressionNode.js +6 -0
- package/src/nodes/code/FunctionCallNode.js +3 -3
- package/src/nodes/code/FunctionNode.js +15 -13
- package/src/nodes/core/ArrayNode.js +3 -3
- package/src/nodes/core/AssignNode.js +10 -9
- package/src/nodes/core/AttributeNode.js +39 -0
- package/src/nodes/core/BypassNode.js +6 -0
- package/src/nodes/core/ConstNode.js +31 -1
- package/src/nodes/core/ContextNode.js +11 -6
- package/src/nodes/core/IndexNode.js +6 -0
- package/src/nodes/core/InputNode.js +6 -0
- package/src/nodes/core/InspectorNode.js +17 -31
- package/src/nodes/core/IsolateNode.js +8 -0
- package/src/nodes/core/Node.js +367 -67
- package/src/nodes/core/NodeBuilder.js +664 -222
- package/src/nodes/core/NodeUtils.js +25 -0
- package/src/nodes/core/NodeVar.js +10 -1
- package/src/nodes/core/OutputStructNode.js +6 -0
- package/src/nodes/core/OverrideContextNode.js +38 -37
- package/src/nodes/core/PropertyNode.js +14 -0
- package/src/nodes/core/StackNode.js +33 -21
- package/src/nodes/core/StructNode.js +6 -0
- package/src/nodes/core/StructTypeNode.js +6 -0
- package/src/nodes/core/SubBuildNode.js +8 -0
- package/src/nodes/core/TempNode.js +10 -35
- package/src/nodes/core/UniformGroupNode.js +6 -0
- package/src/nodes/core/VarNode.js +43 -135
- package/src/nodes/core/VaryingNode.js +33 -2
- package/src/nodes/display/BlendModes.js +5 -40
- package/src/nodes/display/BumpMapNode.js +17 -7
- package/src/nodes/display/ColorAdjustment.js +22 -10
- package/src/nodes/display/ColorSpaceFunctions.js +2 -14
- package/src/nodes/display/ColorSpaceNode.js +3 -3
- package/src/nodes/display/FrontFacingNode.js +6 -0
- package/src/nodes/display/NormalMapNode.js +3 -3
- package/src/nodes/display/PassNode.js +75 -16
- package/src/nodes/display/RenderOutputNode.js +22 -5
- package/src/nodes/display/ScreenNode.js +6 -0
- package/src/nodes/display/ToneMappingFunctions.js +9 -51
- package/src/nodes/display/ToneMappingNode.js +3 -3
- package/src/nodes/display/ToonOutlinePassNode.js +66 -2
- package/src/nodes/display/ViewportDepthNode.js +34 -4
- package/src/nodes/functions/BSDF/BRDF_EON.js +65 -0
- package/src/nodes/functions/BSDF/BRDF_GGX.js +5 -3
- package/src/nodes/functions/BSDF/BRDF_Sheen.js +2 -16
- package/src/nodes/functions/BSDF/D_GGX.js +1 -8
- package/src/nodes/functions/BSDF/D_GGX_Anisotropic.js +7 -10
- package/src/nodes/functions/BSDF/LTC.js +20 -47
- package/src/nodes/functions/BSDF/Schlick_to_F0.js +1 -9
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +1 -9
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +10 -13
- package/src/nodes/functions/PhysicalLightingModel.js +84 -51
- package/src/nodes/functions/VolumetricLightingModel.js +1 -1
- package/src/nodes/functions/material/getAlphaHashThreshold.js +3 -9
- package/src/nodes/functions/material/getParallaxCorrectNormal.js +10 -11
- package/src/nodes/functions/material/getRoughness.js +3 -1
- package/src/nodes/geometry/RangeNode.js +52 -69
- package/src/nodes/gpgpu/AtomicFunctionNode.js +11 -6
- package/src/nodes/gpgpu/BarrierNode.js +6 -0
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +6 -0
- package/src/nodes/gpgpu/ComputeNode.js +6 -0
- package/src/nodes/gpgpu/SubgroupFunctionNode.js +38 -29
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +6 -0
- package/src/nodes/lighting/AnalyticLightNode.js +7 -14
- package/src/nodes/lighting/BasicEnvironmentNode.js +5 -1
- package/src/nodes/lighting/EnvironmentNode.js +58 -8
- package/src/nodes/lighting/IESSpotLightNode.js +19 -4
- package/src/nodes/lighting/LightProbeNode.js +2 -1
- package/src/nodes/lighting/LightUtils.js +2 -2
- package/src/nodes/lighting/LightingNode.js +6 -0
- package/src/nodes/lighting/LightsNode.js +26 -32
- package/src/nodes/lighting/PointShadowNode.js +92 -48
- package/src/nodes/lighting/ProjectorLightNode.js +1 -1
- package/src/nodes/lighting/RectAreaLightNode.js +13 -14
- package/src/nodes/lighting/ShadowBaseNode.js +9 -17
- package/src/nodes/lighting/ShadowFilterNode.js +26 -3
- package/src/nodes/lighting/ShadowNode.js +13 -11
- package/src/nodes/materialx/MaterialXColor.js +2 -14
- package/src/nodes/materialx/MaterialXColorTransform.js +1 -7
- package/src/nodes/materialx/MaterialXNodes.js +8 -11
- package/src/nodes/materialx/MaterialXNoise.js +195 -454
- package/src/nodes/math/BitcastNode.js +5 -5
- package/src/nodes/math/BitcountNode.js +18 -46
- package/src/nodes/math/ConditionalNode.js +92 -22
- package/src/nodes/math/Hash.js +1 -1
- package/src/nodes/math/MathNode.js +86 -64
- package/src/nodes/math/MathUtils.js +2 -2
- package/src/nodes/math/OperatorNode.js +42 -59
- package/src/nodes/math/PackFloatNode.js +9 -9
- package/src/nodes/math/Packed4x8IntegerNode.js +20 -52
- package/src/nodes/math/TriNoise3D.js +3 -23
- package/src/nodes/math/UnpackFloatNode.js +9 -9
- package/src/nodes/pmrem/PMREMNode.js +38 -75
- package/src/nodes/pmrem/PMREMUtils.js +108 -272
- package/src/nodes/procedural/Checker.js +1 -1
- package/src/nodes/tsl/TSLCore.js +199 -74
- package/src/nodes/utils/ArrayElementNode.js +19 -1
- package/src/nodes/utils/CubeMapNode.js +3 -3
- package/src/nodes/utils/DebugNode.js +2 -2
- package/src/nodes/utils/EventNode.js +6 -0
- package/src/nodes/utils/FlipNode.js +3 -3
- package/src/nodes/utils/FunctionOverloadingNode.js +7 -1
- package/src/nodes/utils/JoinNode.js +3 -3
- package/src/nodes/utils/LoopNode.js +14 -9
- package/src/nodes/utils/MemberNode.js +18 -0
- package/src/nodes/utils/PostProcessingUtils.js +20 -25
- package/src/nodes/utils/RTTNode.js +2 -0
- package/src/nodes/utils/ReflectorNode.js +24 -0
- package/src/nodes/utils/RotateNode.js +3 -3
- package/src/nodes/utils/SampleNode.js +6 -0
- package/src/nodes/utils/SetNode.js +3 -3
- package/src/nodes/utils/SplitNode.js +6 -0
- package/src/nodes/utils/UVUtils.js +2 -2
- package/src/objects/BatchedMesh.js +146 -15
- package/src/objects/InstancedMesh.js +12 -4
- package/src/objects/Line.js +20 -0
- package/src/objects/Mesh.js +8 -0
- package/src/objects/Points.js +20 -0
- package/src/objects/Skeleton.js +26 -0
- package/src/objects/SkinnedMesh.js +3 -3
- package/src/objects/Sprite.js +10 -0
- package/src/renderers/WebGLRenderer.js +104 -70
- package/src/renderers/common/Animation.js +5 -1
- package/src/renderers/common/Attributes.js +67 -57
- package/src/renderers/common/Backend.js +78 -3
- package/src/renderers/common/BindGroup.js +11 -0
- package/src/renderers/common/Binding.js +0 -11
- package/src/renderers/common/Bindings.js +116 -10
- package/src/renderers/common/Buffer.js +1 -1
- package/src/renderers/common/ClippingContext.js +12 -1
- package/src/renderers/common/ComputePipeline.js +17 -1
- package/src/renderers/common/DirectRenderPipeline.js +7 -3
- package/src/renderers/common/Geometries.js +170 -132
- package/src/renderers/common/Info.js +1 -1
- package/src/renderers/common/InspectorBase.js +5 -5
- package/src/renderers/common/Lighting.js +59 -0
- package/src/renderers/common/Pipelines.js +26 -12
- package/src/renderers/common/ProgrammableStage.js +1 -17
- package/src/renderers/common/RenderContext.js +21 -0
- package/src/renderers/common/RenderContexts.js +13 -4
- package/src/renderers/common/RenderObject.js +111 -35
- package/src/renderers/common/RenderObjects.js +37 -19
- package/src/renderers/common/Renderer.js +537 -295
- package/src/renderers/common/RendererUtils.js +15 -0
- package/src/renderers/common/StandardDrawingPipeline.js +343 -0
- package/src/renderers/common/Storage3DTexture.js +11 -0
- package/src/renderers/common/StorageArrayTexture.js +10 -0
- package/src/renderers/common/StorageTexture.js +0 -9
- package/src/renderers/common/Textures.js +144 -37
- package/src/renderers/common/UniformsGroup.js +19 -0
- package/src/renderers/common/XRManager.js +10 -91
- package/src/renderers/common/extras/PMREMGenerator.js +298 -576
- package/src/renderers/common/nodes/NodeBuilderState.js +7 -5
- package/src/renderers/common/nodes/NodeLibrary.js +11 -35
- package/src/renderers/common/nodes/NodeManager.js +80 -31
- package/src/renderers/common/nodes/NodeSampledTexture.js +14 -0
- package/src/renderers/common/nodes/NodeSampler.js +14 -0
- package/src/renderers/common/nodes/NodeStorageBuffer.js +1 -1
- package/src/renderers/common/nodes/NodeUniformBuffer.js +1 -14
- package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +13 -4
- package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +8 -8
- package/src/renderers/shaders/ShaderChunk/lightprobes_pars_fragment.glsl.js +23 -11
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +21 -2
- package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +18 -2
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +104 -7
- package/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.js +11 -2
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +36 -20
- package/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk.js +0 -2
- package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +4 -18
- package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +0 -1
- package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +0 -1
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +8 -1
- package/src/renderers/shaders/ShaderLib.js +3 -0
- package/src/renderers/shaders/UniformsLib.js +4 -5
- package/src/renderers/webgl/WebGLBackground.js +3 -3
- package/src/renderers/webgl/WebGLBindingStates.js +4 -2
- package/src/renderers/webgl/WebGLCapabilities.js +7 -1
- package/src/renderers/webgl/WebGLEnvironments.js +2 -2
- package/src/renderers/webgl/WebGLGeometries.js +42 -14
- package/src/renderers/webgl/WebGLMaterials.js +15 -2
- package/src/renderers/webgl/WebGLOutput.js +37 -1
- package/src/renderers/webgl/WebGLProgram.js +13 -54
- package/src/renderers/webgl/WebGLPrograms.js +22 -8
- package/src/renderers/webgl/WebGLRenderStates.js +11 -8
- package/src/renderers/webgl/WebGLShadowMap.js +6 -4
- package/src/renderers/webgl/WebGLState.js +10 -6
- package/src/renderers/webgl/WebGLTextures.js +129 -77
- package/src/renderers/webgl/WebGLUniforms.js +44 -6
- package/src/renderers/webgl/WebGLUniformsGroups.js +75 -69
- package/src/renderers/webgl-fallback/WebGLBackend.js +206 -278
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +154 -20
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +45 -42
- package/src/renderers/webgl-fallback/utils/WebGLState.js +29 -4
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +129 -49
- package/src/renderers/webgl-fallback/utils/WebGLVertexArrayUtils.js +346 -0
- package/src/renderers/webgpu/WebGPUBackend.js +140 -82
- package/src/renderers/webgpu/WebGPURenderer.js +1 -1
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +10 -10
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +10 -10
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +135 -60
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +128 -55
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +1 -1
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +15 -12
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +55 -19
- package/src/renderers/webgpu/utils/WebGPUUtils.js +20 -3
- package/src/renderers/webxr/WebXRController.js +3 -3
- package/src/renderers/webxr/WebXRManager.js +5 -90
- package/src/scenes/Scene.js +4 -4
- package/src/textures/CompressedTexture.js +2 -2
- package/src/textures/DepthTexture.js +2 -2
- package/src/textures/FramebufferTexture.js +11 -0
- package/src/textures/Texture.js +29 -1
- package/src/textures/TextureSource.js +1 -1
- package/src/upe.js +1 -1
- package/src/utils.js +4 -4
- package/examples/jsm/libs/surfaceNet.js +0 -201
- package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +0 -186
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
RedFormat,
|
|
6
6
|
MathUtils,
|
|
7
7
|
Loader,
|
|
8
|
+
RepeatWrapping,
|
|
8
9
|
UnsignedByteType,
|
|
9
10
|
LinearFilter,
|
|
10
11
|
HalfFloatType,
|
|
@@ -50,7 +51,7 @@ class IESLoader extends Loader {
|
|
|
50
51
|
|
|
51
52
|
_getIESValues( iesLamp, type ) {
|
|
52
53
|
|
|
53
|
-
const width = 360;
|
|
54
|
+
const width = iesLamp.numHorAngles === 1 ? 1 : 360;
|
|
54
55
|
const height = 180;
|
|
55
56
|
const size = width * height;
|
|
56
57
|
|
|
@@ -61,7 +62,7 @@ class IESLoader extends Loader {
|
|
|
61
62
|
let phiIndex = 0, thetaIndex = 0;
|
|
62
63
|
let startTheta = 0, endTheta = 0, startPhi = 0, endPhi = 0;
|
|
63
64
|
|
|
64
|
-
for ( let i = 0; i < iesLamp.numHorAngles - 1; ++ i ) {
|
|
65
|
+
for ( let i = 0; i < iesLamp.numHorAngles - 1; ++ i ) {
|
|
65
66
|
|
|
66
67
|
if ( theta < iesLamp.horAngles[ i + 1 ] || i == iesLamp.numHorAngles - 2 ) {
|
|
67
68
|
|
|
@@ -108,23 +109,32 @@ class IESLoader extends Loader {
|
|
|
108
109
|
|
|
109
110
|
}
|
|
110
111
|
|
|
111
|
-
const
|
|
112
|
+
const endTheta = iesLamp.horAngles[ iesLamp.numHorAngles - 1 ];
|
|
112
113
|
|
|
113
114
|
for ( let i = 0; i < size; ++ i ) {
|
|
114
115
|
|
|
115
|
-
|
|
116
|
+
// the horizontal angles cover 0 to 359 degrees
|
|
117
|
+
const theta = i % width;
|
|
116
118
|
const phi = Math.floor( i / width );
|
|
117
119
|
|
|
118
|
-
|
|
120
|
+
let sampleTheta = theta;
|
|
119
121
|
|
|
120
|
-
|
|
122
|
+
// mirror the measured range around the cycle
|
|
123
|
+
if ( endTheta !== 0 && sampleTheta > endTheta ) {
|
|
121
124
|
|
|
122
|
-
|
|
123
|
-
|
|
125
|
+
sampleTheta %= endTheta * 2;
|
|
126
|
+
|
|
127
|
+
if ( sampleTheta > endTheta ) {
|
|
128
|
+
|
|
129
|
+
sampleTheta = endTheta * 2 - sampleTheta;
|
|
130
|
+
|
|
131
|
+
}
|
|
124
132
|
|
|
125
133
|
}
|
|
126
134
|
|
|
127
|
-
|
|
135
|
+
// the vertical angles span [0, 180]
|
|
136
|
+
const samplePhi = phi * 180 / ( height - 1 );
|
|
137
|
+
data[ phi + theta * height ] = interpolateCandelaValues( samplePhi, sampleTheta );
|
|
128
138
|
|
|
129
139
|
}
|
|
130
140
|
|
|
@@ -151,6 +161,8 @@ class IESLoader extends Loader {
|
|
|
151
161
|
load( url, onLoad, onProgress, onError ) {
|
|
152
162
|
|
|
153
163
|
const loader = new FileLoader( this.manager );
|
|
164
|
+
loader.setPriority( this.priority );
|
|
165
|
+
loader.setCache( this.cache );
|
|
154
166
|
loader.setResponseType( 'text' );
|
|
155
167
|
loader.setCrossOrigin( this.crossOrigin );
|
|
156
168
|
loader.setWithCredentials( this.withCredentials );
|
|
@@ -178,9 +190,12 @@ class IESLoader extends Loader {
|
|
|
178
190
|
const iesLamp = new IESLamp( text );
|
|
179
191
|
const data = this._getIESValues( iesLamp, type );
|
|
180
192
|
|
|
181
|
-
|
|
193
|
+
// X holds the vertical angle from 0 to 180 degrees inclusively, Y holds the horizontal
|
|
194
|
+
// angle from 0 to 359 degrees and wraps around, or a single row for symmetric profiles
|
|
195
|
+
const texture = new DataTexture( data, 180, data.length / 180, RedFormat, type );
|
|
182
196
|
texture.minFilter = LinearFilter;
|
|
183
197
|
texture.magFilter = LinearFilter;
|
|
198
|
+
texture.wrapT = RepeatWrapping;
|
|
184
199
|
texture.needsUpdate = true;
|
|
185
200
|
|
|
186
201
|
return texture;
|
|
@@ -339,16 +354,21 @@ function IESLamp( text ) {
|
|
|
339
354
|
|
|
340
355
|
for ( let j = 0; j < _self.numVerAngles; ++ j ) {
|
|
341
356
|
|
|
342
|
-
_self.candelaValues[ i ][ j ] *= _self.
|
|
343
|
-
* _self.ballFactor * _self.blpFactor;
|
|
357
|
+
_self.candelaValues[ i ][ j ] *= _self.multiplier * _self.ballFactor * _self.blpFactor;
|
|
344
358
|
|
|
345
359
|
}
|
|
346
360
|
|
|
347
361
|
}
|
|
348
362
|
|
|
363
|
+
const baseAngle = _self.horAngles[ 0 ];
|
|
364
|
+
|
|
349
365
|
let maxVal = - 1;
|
|
350
366
|
for ( let i = 0; i < _self.numHorAngles; ++ i ) {
|
|
351
367
|
|
|
368
|
+
// Shift the measured range to start at 0 so it can be mirrored across the full
|
|
369
|
+
// cycle when sampling.
|
|
370
|
+
_self.horAngles[ i ] -= baseAngle;
|
|
371
|
+
|
|
352
372
|
for ( let j = 0; j < _self.numVerAngles; ++ j ) {
|
|
353
373
|
|
|
354
374
|
const value = _self.candelaValues[ i ][ j ];
|
|
@@ -358,6 +378,20 @@ function IESLamp( text ) {
|
|
|
358
378
|
|
|
359
379
|
}
|
|
360
380
|
|
|
381
|
+
// A range wider than a half cycle is asymmetric, so it wraps back around to the
|
|
382
|
+
// first angle. Contrary to the standard some files skip that final 360 entry
|
|
383
|
+
// because it repeats the first one, which Blender's Cycles works around the same way
|
|
384
|
+
// https://github.com/blender/blender/blob/main/intern/cycles/util/ies.cpp
|
|
385
|
+
const endAngle = _self.horAngles[ _self.numHorAngles - 1 ];
|
|
386
|
+
if ( endAngle > 180 && endAngle < 360 ) {
|
|
387
|
+
|
|
388
|
+
_self.horAngles.push( 360 );
|
|
389
|
+
_self.candelaValues.push( _self.candelaValues[ 0 ].slice() );
|
|
390
|
+
|
|
391
|
+
_self.numHorAngles = _self.horAngles.length;
|
|
392
|
+
|
|
393
|
+
}
|
|
394
|
+
|
|
361
395
|
const bNormalize = true;
|
|
362
396
|
if ( bNormalize && maxVal > 0 ) {
|
|
363
397
|
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DataTexture,
|
|
3
|
+
FileLoader,
|
|
4
|
+
HalfFloatType,
|
|
5
|
+
LinearFilter,
|
|
6
|
+
LinearSRGBColorSpace,
|
|
7
|
+
Loader,
|
|
8
|
+
RGBAFormat
|
|
9
|
+
} from 'three';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Loads HDR JPEG XL images using the browser's native decoder.
|
|
13
|
+
* Produces half-float textures in linear sRGB. Requires float16 Canvas2D,
|
|
14
|
+
* the srgb-linear canvas color space and globalHDRHeadroom.
|
|
15
|
+
*
|
|
16
|
+
* ```js
|
|
17
|
+
* const texture = await new JXLLoader().loadAsync( 'image.jxl' );
|
|
18
|
+
* const material = new THREE.MeshStandardMaterial( { emissive: 0xffffff, emissiveMap: texture } );
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @augments Loader
|
|
22
|
+
* @three_import import { JXLLoader } from 'three/addons/loaders/JXLLoader.js';
|
|
23
|
+
*/
|
|
24
|
+
class JXLLoader extends Loader {
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Loads a native HDR image into a half-float data texture.
|
|
28
|
+
* @param {string} url - Image URL.
|
|
29
|
+
* @param {function(DataTexture)} onLoad - Completion callback.
|
|
30
|
+
* @param {Function} onProgress - Download progress callback.
|
|
31
|
+
* @param {Function} onError - Error callback.
|
|
32
|
+
* @return {DataTexture} Placeholder texture, populated after decoding.
|
|
33
|
+
*/
|
|
34
|
+
load( url, onLoad, onProgress, onError ) {
|
|
35
|
+
|
|
36
|
+
const texture = new DataTexture( null, 0, 0, RGBAFormat, HalfFloatType );
|
|
37
|
+
const loader = new FileLoader( this.manager );
|
|
38
|
+
loader.setPath( this.path );
|
|
39
|
+
loader.setRequestHeader( this.requestHeader );
|
|
40
|
+
loader.setWithCredentials( this.withCredentials );
|
|
41
|
+
loader.setResponseType( 'arraybuffer' );
|
|
42
|
+
|
|
43
|
+
// Track decoding so the manager does not finish after the download.
|
|
44
|
+
this.manager.itemStart( url );
|
|
45
|
+
|
|
46
|
+
const onFailure = error => {
|
|
47
|
+
|
|
48
|
+
if ( onError ) onError( error );
|
|
49
|
+
else console.error( error );
|
|
50
|
+
|
|
51
|
+
this.manager.itemError( url );
|
|
52
|
+
this.manager.itemEnd( url );
|
|
53
|
+
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
loader.load( url, buffer => {
|
|
57
|
+
|
|
58
|
+
this._decode( buffer ).then( data => {
|
|
59
|
+
|
|
60
|
+
this._applyData( texture, data );
|
|
61
|
+
if ( onLoad ) onLoad( texture );
|
|
62
|
+
this.manager.itemEnd( url );
|
|
63
|
+
|
|
64
|
+
}, onFailure );
|
|
65
|
+
|
|
66
|
+
}, onProgress, onFailure );
|
|
67
|
+
|
|
68
|
+
return texture;
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Decodes image bytes using the browser, preserving maximum HDR headroom.
|
|
74
|
+
* @param {ArrayBuffer} buffer - JPEG XL bytes.
|
|
75
|
+
* @param {function(DataTexture)} onLoad - Completion callback.
|
|
76
|
+
* @param {Function} onError - Error callback.
|
|
77
|
+
*/
|
|
78
|
+
parse( buffer, onLoad, onError ) {
|
|
79
|
+
|
|
80
|
+
this.parseAsync( buffer ).then( onLoad, onError );
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Async version of {@link JXLLoader#parse}.
|
|
86
|
+
* @param {ArrayBuffer} buffer - JPEG XL bytes.
|
|
87
|
+
* @return {Promise<DataTexture>} Half-float texture in linear sRGB.
|
|
88
|
+
*/
|
|
89
|
+
async parseAsync( buffer ) {
|
|
90
|
+
|
|
91
|
+
const data = await this._decode( buffer );
|
|
92
|
+
const texture = new DataTexture();
|
|
93
|
+
this._applyData( texture, data );
|
|
94
|
+
return texture;
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
_applyData( texture, { data, width, height } ) {
|
|
99
|
+
|
|
100
|
+
texture.image = { data, width, height };
|
|
101
|
+
texture.format = RGBAFormat;
|
|
102
|
+
texture.type = HalfFloatType;
|
|
103
|
+
texture.colorSpace = LinearSRGBColorSpace;
|
|
104
|
+
texture.minFilter = LinearFilter;
|
|
105
|
+
texture.magFilter = LinearFilter;
|
|
106
|
+
texture.flipY = true;
|
|
107
|
+
texture.needsUpdate = true;
|
|
108
|
+
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async _decode( buffer ) {
|
|
112
|
+
|
|
113
|
+
const canvas = document.createElement( 'canvas' );
|
|
114
|
+
const context = canvas.getContext( '2d', { colorSpace: 'srgb-linear', colorType: 'float16' } );
|
|
115
|
+
|
|
116
|
+
if ( context.getContextAttributes().colorType !== 'float16' || ! ( 'globalHDRHeadroom' in context ) ) {
|
|
117
|
+
|
|
118
|
+
throw new Error( 'JXLLoader: Canvas2D float16 storage and globalHDRHeadroom are required.' );
|
|
119
|
+
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const url = URL.createObjectURL( new Blob( [ buffer ] ) );
|
|
123
|
+
const image = new Image();
|
|
124
|
+
|
|
125
|
+
try {
|
|
126
|
+
|
|
127
|
+
image.src = url;
|
|
128
|
+
await image.decode();
|
|
129
|
+
|
|
130
|
+
canvas.width = image.naturalWidth;
|
|
131
|
+
canvas.height = image.naturalHeight;
|
|
132
|
+
context.globalHDRHeadroom = Infinity;
|
|
133
|
+
context.drawImage( image, 0, 0 );
|
|
134
|
+
|
|
135
|
+
const pixels = context.getImageData( 0, 0, canvas.width, canvas.height, { colorSpace: 'srgb-linear', pixelFormat: 'rgba-float16' } );
|
|
136
|
+
|
|
137
|
+
if ( pixels.pixelFormat !== 'rgba-float16' ) {
|
|
138
|
+
|
|
139
|
+
throw new Error( 'JXLLoader: Canvas2D rgba-float16 readback is required.' );
|
|
140
|
+
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// reinterpret the Float16Array readback as half-float bits
|
|
144
|
+
const data = new Uint16Array( pixels.data.buffer, pixels.data.byteOffset, pixels.data.length );
|
|
145
|
+
|
|
146
|
+
return { data, width: canvas.width, height: canvas.height };
|
|
147
|
+
|
|
148
|
+
} finally {
|
|
149
|
+
|
|
150
|
+
URL.revokeObjectURL( url );
|
|
151
|
+
canvas.width = canvas.height = 0;
|
|
152
|
+
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export { JXLLoader };
|
|
@@ -47,6 +47,8 @@ class KMZLoader extends Loader {
|
|
|
47
47
|
const scope = this;
|
|
48
48
|
|
|
49
49
|
const loader = new FileLoader( scope.manager );
|
|
50
|
+
loader.setPriority( scope.priority );
|
|
51
|
+
loader.setCache( scope.cache );
|
|
50
52
|
loader.setPath( scope.path );
|
|
51
53
|
loader.setResponseType( 'arraybuffer' );
|
|
52
54
|
loader.setRequestHeader( scope.requestHeader );
|
|
@@ -130,6 +132,8 @@ class KMZLoader extends Loader {
|
|
|
130
132
|
if ( model ) {
|
|
131
133
|
|
|
132
134
|
const loader = new ColladaLoader( manager );
|
|
135
|
+
loader.setPriority( this.priority );
|
|
136
|
+
loader.setCache( this.cache );
|
|
133
137
|
return loader.parse( new TextDecoder().decode( zip[ model.textContent ] ) );
|
|
134
138
|
|
|
135
139
|
}
|
|
@@ -145,6 +149,8 @@ class KMZLoader extends Loader {
|
|
|
145
149
|
if ( extension === 'dae' ) {
|
|
146
150
|
|
|
147
151
|
const loader = new ColladaLoader( manager );
|
|
152
|
+
loader.setPriority( this.priority );
|
|
153
|
+
loader.setCache( this.cache );
|
|
148
154
|
return loader.parse( new TextDecoder().decode( zip[ path ] ) );
|
|
149
155
|
|
|
150
156
|
}
|
|
@@ -99,6 +99,8 @@ class KSPLATLoader extends Loader {
|
|
|
99
99
|
const scope = this;
|
|
100
100
|
|
|
101
101
|
const loader = new FileLoader( this.manager );
|
|
102
|
+
loader.setPriority( this.priority );
|
|
103
|
+
loader.setCache( this.cache );
|
|
102
104
|
loader.setPath( this.path );
|
|
103
105
|
loader.setResponseType( 'arraybuffer' );
|
|
104
106
|
loader.setRequestHeader( this.requestHeader );
|
|
@@ -150,6 +150,15 @@ class KTX2Loader extends Loader {
|
|
|
150
150
|
|
|
151
151
|
super( manager );
|
|
152
152
|
|
|
153
|
+
/**
|
|
154
|
+
* This flag can be used for type testing.
|
|
155
|
+
*
|
|
156
|
+
* @type {boolean}
|
|
157
|
+
* @readonly
|
|
158
|
+
* @default true
|
|
159
|
+
*/
|
|
160
|
+
this.isKTX2Loader = true;
|
|
161
|
+
|
|
153
162
|
this.transcoderPath = '';
|
|
154
163
|
this.transcoderBinary = null;
|
|
155
164
|
this.transcoderPending = null;
|
|
@@ -285,9 +294,13 @@ class KTX2Loader extends Loader {
|
|
|
285
294
|
if ( ! this.transcoderPending ) {
|
|
286
295
|
|
|
287
296
|
const jsLoader = new FileLoader( this.manager );
|
|
297
|
+
jsLoader.setPriority( this.priority );
|
|
298
|
+
jsLoader.setCache( this.cache );
|
|
288
299
|
jsLoader.setWithCredentials( this.withCredentials );
|
|
289
300
|
|
|
290
301
|
const binaryLoader = new FileLoader( this.manager );
|
|
302
|
+
binaryLoader.setPriority( this.priority );
|
|
303
|
+
binaryLoader.setCache( this.cache );
|
|
291
304
|
binaryLoader.setWithCredentials( this.withCredentials );
|
|
292
305
|
binaryLoader.setResponseType( 'arraybuffer' );
|
|
293
306
|
|
|
@@ -381,6 +394,8 @@ class KTX2Loader extends Loader {
|
|
|
381
394
|
}
|
|
382
395
|
|
|
383
396
|
const loader = new FileLoader( this.manager );
|
|
397
|
+
loader.setPriority( this.priority );
|
|
398
|
+
loader.setCache( this.cache );
|
|
384
399
|
|
|
385
400
|
loader.setPath( this.path );
|
|
386
401
|
loader.setCrossOrigin( this.crossOrigin );
|
|
@@ -1220,6 +1235,7 @@ async function createRawTexture( container ) {
|
|
|
1220
1235
|
texture = container.pixelDepth === 0
|
|
1221
1236
|
? new DataTexture( mipmaps[ 0 ].data, container.pixelWidth, container.pixelHeight )
|
|
1222
1237
|
: new Data3DTexture( mipmaps[ 0 ].data, container.pixelWidth, container.pixelHeight, container.pixelDepth );
|
|
1238
|
+
texture.mipmaps = mipmaps;
|
|
1223
1239
|
texture.minFilter = useMipmaps ? NearestMipmapNearestFilter : NearestFilter;
|
|
1224
1240
|
texture.magFilter = NearestFilter;
|
|
1225
1241
|
texture.generateMipmaps = container.levelCount === 0;
|
|
@@ -1229,14 +1245,43 @@ async function createRawTexture( container ) {
|
|
|
1229
1245
|
|
|
1230
1246
|
if ( container.pixelDepth > 0 ) throw new Error( 'THREE.KTX2Loader: Unsupported pixelDepth.' );
|
|
1231
1247
|
|
|
1232
|
-
|
|
1248
|
+
if ( container.faceCount === 6 ) {
|
|
1249
|
+
|
|
1250
|
+
const faces = [];
|
|
1251
|
+
|
|
1252
|
+
for ( let face = 0; face < 6; face ++ ) {
|
|
1253
|
+
|
|
1254
|
+
const faceMipmaps = [];
|
|
1255
|
+
|
|
1256
|
+
for ( const mipmap of mipmaps ) {
|
|
1257
|
+
|
|
1258
|
+
const faceLength = mipmap.data.length / 6;
|
|
1259
|
+
|
|
1260
|
+
faceMipmaps.push( {
|
|
1261
|
+
data: mipmap.data.subarray( face * faceLength, ( face + 1 ) * faceLength ),
|
|
1262
|
+
width: mipmap.width,
|
|
1263
|
+
height: mipmap.height
|
|
1264
|
+
} );
|
|
1265
|
+
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
faces.push( { mipmaps: faceMipmaps, width: container.pixelWidth, height: container.pixelHeight } );
|
|
1269
|
+
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
texture = new CompressedCubeTexture( faces );
|
|
1273
|
+
|
|
1274
|
+
} else {
|
|
1275
|
+
|
|
1276
|
+
texture = new CompressedTexture( mipmaps, container.pixelWidth, container.pixelHeight );
|
|
1277
|
+
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1233
1280
|
texture.minFilter = useMipmaps ? LinearMipmapLinearFilter : LinearFilter;
|
|
1234
1281
|
texture.magFilter = LinearFilter;
|
|
1235
1282
|
|
|
1236
1283
|
}
|
|
1237
1284
|
|
|
1238
|
-
texture.mipmaps = mipmaps;
|
|
1239
|
-
|
|
1240
1285
|
texture.type = TYPE_MAP[ vkFormat ];
|
|
1241
1286
|
texture.format = FORMAT_MAP[ vkFormat ];
|
|
1242
1287
|
texture.colorSpace = parseColorSpace( container );
|
|
@@ -1244,7 +1289,7 @@ async function createRawTexture( container ) {
|
|
|
1244
1289
|
|
|
1245
1290
|
//
|
|
1246
1291
|
|
|
1247
|
-
return
|
|
1292
|
+
return texture;
|
|
1248
1293
|
|
|
1249
1294
|
}
|
|
1250
1295
|
|
|
@@ -104,6 +104,7 @@ class KhronosTextureContainer {
|
|
|
104
104
|
const endianness = headerDataView.getUint32( 0, true );
|
|
105
105
|
const littleEndian = endianness === 0x04030201;
|
|
106
106
|
|
|
107
|
+
this.littleEndian = littleEndian;
|
|
107
108
|
this.glType = headerDataView.getUint32( 1 * dataSize, littleEndian ); // must be 0 for compressed textures
|
|
108
109
|
this.glTypeSize = headerDataView.getUint32( 2 * dataSize, littleEndian ); // must be 1 for compressed textures
|
|
109
110
|
this.glFormat = headerDataView.getUint32( 3 * dataSize, littleEndian ); // must be 0 for compressed textures
|
|
@@ -160,6 +161,7 @@ class KhronosTextureContainer {
|
|
|
160
161
|
mipmaps( loadMipmaps ) {
|
|
161
162
|
|
|
162
163
|
const mipmaps = [];
|
|
164
|
+
const dataView = new DataView( this.arrayBuffer );
|
|
163
165
|
|
|
164
166
|
// initialize width & height for level 1
|
|
165
167
|
let dataOffset = HEADER_LEN + this.bytesOfKeyValueData;
|
|
@@ -169,7 +171,7 @@ class KhronosTextureContainer {
|
|
|
169
171
|
|
|
170
172
|
for ( let level = 0; level < mipmapCount; level ++ ) {
|
|
171
173
|
|
|
172
|
-
const imageSize =
|
|
174
|
+
const imageSize = dataView.getUint32( dataOffset, this.littleEndian ); // size per face, since not supporting array cubemaps
|
|
173
175
|
dataOffset += 4; // size of the image + 4 for the imageSize field
|
|
174
176
|
|
|
175
177
|
for ( let face = 0; face < this.numberOfFaces; face ++ ) {
|
|
@@ -183,8 +185,8 @@ class KhronosTextureContainer {
|
|
|
183
185
|
|
|
184
186
|
}
|
|
185
187
|
|
|
186
|
-
width = Math.max( 1
|
|
187
|
-
height = Math.max( 1
|
|
188
|
+
width = Math.max( width >> 1, 1 );
|
|
189
|
+
height = Math.max( height >> 1, 1 );
|
|
188
190
|
|
|
189
191
|
}
|
|
190
192
|
|
|
@@ -124,7 +124,7 @@ function smoothNormals( faces, lineSegments, checkSubSegments = false ) {
|
|
|
124
124
|
|
|
125
125
|
const hardEdges = new Set();
|
|
126
126
|
const hardEdgeRays = new Map();
|
|
127
|
-
const halfEdgeList =
|
|
127
|
+
const halfEdgeList = new Map();
|
|
128
128
|
const normals = [];
|
|
129
129
|
|
|
130
130
|
// Save the list of hard edges by hash
|
|
@@ -243,29 +243,15 @@ function smoothNormals( faces, lineSegments, checkSubSegments = false ) {
|
|
|
243
243
|
index: index,
|
|
244
244
|
tri: tri
|
|
245
245
|
};
|
|
246
|
-
halfEdgeList
|
|
246
|
+
halfEdgeList.set( hash, info );
|
|
247
247
|
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
}
|
|
251
251
|
|
|
252
252
|
// Iterate until we've tried to connect all faces to share normals
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
// Stop if there are no more faces left
|
|
256
|
-
let halfEdge = null;
|
|
257
|
-
for ( const key in halfEdgeList ) {
|
|
258
|
-
|
|
259
|
-
halfEdge = halfEdgeList[ key ];
|
|
260
|
-
break;
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
if ( halfEdge === null ) {
|
|
265
|
-
|
|
266
|
-
break;
|
|
267
|
-
|
|
268
|
-
}
|
|
253
|
+
// Map iterators skip entries deleted during iteration, so each face is visited once
|
|
254
|
+
for ( const halfEdge of halfEdgeList.values() ) {
|
|
269
255
|
|
|
270
256
|
// Exhaustively find all connected faces
|
|
271
257
|
const queue = [ halfEdge ];
|
|
@@ -288,10 +274,10 @@ function smoothNormals( faces, lineSegments, checkSubSegments = false ) {
|
|
|
288
274
|
|
|
289
275
|
// delete this triangle from the list so it won't be found again
|
|
290
276
|
const hash = hashEdge( v0, v1 );
|
|
291
|
-
delete
|
|
277
|
+
halfEdgeList.delete( hash );
|
|
292
278
|
|
|
293
279
|
const reverseHash = hashEdge( v1, v0 );
|
|
294
|
-
const otherInfo = halfEdgeList
|
|
280
|
+
const otherInfo = halfEdgeList.get( reverseHash );
|
|
295
281
|
if ( otherInfo ) {
|
|
296
282
|
|
|
297
283
|
const otherTri = otherInfo.tri;
|
|
@@ -312,10 +298,10 @@ function smoothNormals( faces, lineSegments, checkSubSegments = false ) {
|
|
|
312
298
|
// if this triangle has already been traversed then it won't be in
|
|
313
299
|
// the halfEdgeList. If it has not then add it to the queue and delete
|
|
314
300
|
// it so it won't be found again.
|
|
315
|
-
if ( reverseHash
|
|
301
|
+
if ( halfEdgeList.has( reverseHash ) ) {
|
|
316
302
|
|
|
317
303
|
queue.push( otherInfo );
|
|
318
|
-
delete
|
|
304
|
+
halfEdgeList.delete( reverseHash );
|
|
319
305
|
|
|
320
306
|
}
|
|
321
307
|
|
|
@@ -627,6 +613,8 @@ class LDrawParsedCache {
|
|
|
627
613
|
|
|
628
614
|
const loader = this.loader;
|
|
629
615
|
const fileLoader = new FileLoader( loader.manager );
|
|
616
|
+
fileLoader.setPriority( loader.priority );
|
|
617
|
+
fileLoader.setCache( loader.cache );
|
|
630
618
|
fileLoader.setPath( loader.partsLibraryPath );
|
|
631
619
|
fileLoader.setRequestHeader( loader.requestHeader );
|
|
632
620
|
fileLoader.setWithCredentials( loader.withCredentials );
|
|
@@ -1838,6 +1826,7 @@ class LDrawLoader extends Loader {
|
|
|
1838
1826
|
|
|
1839
1827
|
this.ConditionalLineMaterial = type;
|
|
1840
1828
|
this.missingConditionalEdgeColorMaterial = new this.ConditionalLineMaterial( { name: Loader.DEFAULT_MATERIAL_NAME, fog: true, color: 0xFF00FF } );
|
|
1829
|
+
this.conditionalEdgeMaterialCache.set( this.missingEdgeColorMaterial, this.missingConditionalEdgeColorMaterial );
|
|
1841
1830
|
return this;
|
|
1842
1831
|
|
|
1843
1832
|
}
|
|
@@ -1856,6 +1845,8 @@ class LDrawLoader extends Loader {
|
|
|
1856
1845
|
async preloadMaterials( url ) {
|
|
1857
1846
|
|
|
1858
1847
|
const fileLoader = new FileLoader( this.manager );
|
|
1848
|
+
fileLoader.setPriority( this.priority );
|
|
1849
|
+
fileLoader.setCache( this.cache );
|
|
1859
1850
|
fileLoader.setPath( this.path );
|
|
1860
1851
|
fileLoader.setRequestHeader( this.requestHeader );
|
|
1861
1852
|
fileLoader.setWithCredentials( this.withCredentials );
|
|
@@ -1893,6 +1884,8 @@ class LDrawLoader extends Loader {
|
|
|
1893
1884
|
load( url, onLoad, onProgress, onError ) {
|
|
1894
1885
|
|
|
1895
1886
|
const fileLoader = new FileLoader( this.manager );
|
|
1887
|
+
fileLoader.setPriority( this.priority );
|
|
1888
|
+
fileLoader.setCache( this.cache );
|
|
1896
1889
|
fileLoader.setPath( this.path );
|
|
1897
1890
|
fileLoader.setRequestHeader( this.requestHeader );
|
|
1898
1891
|
fileLoader.setWithCredentials( this.withCredentials );
|
|
@@ -70,6 +70,10 @@ export class LUT3dlLoader extends Loader {
|
|
|
70
70
|
load( url, onLoad, onProgress, onError ) {
|
|
71
71
|
|
|
72
72
|
const loader = new FileLoader( this.manager );
|
|
73
|
+
loader.setPriority( this.priority );
|
|
74
|
+
loader.setCache( this.cache );
|
|
75
|
+
loader.setRequestHeader( this.requestHeader );
|
|
76
|
+
loader.setWithCredentials( this.withCredentials );
|
|
73
77
|
loader.setPath( this.path );
|
|
74
78
|
loader.setResponseType( 'text' );
|
|
75
79
|
loader.load( url, text => {
|
|
@@ -160,7 +164,7 @@ export class LUT3dlLoader extends Loader {
|
|
|
160
164
|
}
|
|
161
165
|
|
|
162
166
|
// Determine the bit depth to scale the values to [0.0, 1.0].
|
|
163
|
-
const bits = Math.ceil( Math.log2( maxValue ) );
|
|
167
|
+
const bits = Math.max( 0, Math.ceil( Math.log2( maxValue ) ) );
|
|
164
168
|
const maxBitValue = Math.pow( 2, bits );
|
|
165
169
|
|
|
166
170
|
const data = this.type === UnsignedByteType ? new Uint8Array( dataFloat.length ) : dataFloat;
|
|
@@ -69,6 +69,10 @@ export class LUTCubeLoader extends Loader {
|
|
|
69
69
|
load( url, onLoad, onProgress, onError ) {
|
|
70
70
|
|
|
71
71
|
const loader = new FileLoader( this.manager );
|
|
72
|
+
loader.setPriority( this.priority );
|
|
73
|
+
loader.setCache( this.cache );
|
|
74
|
+
loader.setRequestHeader( this.requestHeader );
|
|
75
|
+
loader.setWithCredentials( this.withCredentials );
|
|
72
76
|
loader.setPath( this.path );
|
|
73
77
|
loader.setResponseType( 'text' );
|
|
74
78
|
loader.load( url, text => {
|
|
@@ -107,8 +111,8 @@ export class LUTCubeLoader extends Loader {
|
|
|
107
111
|
|
|
108
112
|
const regExpTitle = /TITLE +"([^"]*)"/;
|
|
109
113
|
const regExpSize = /LUT_3D_SIZE +(\d+)/;
|
|
110
|
-
const regExpDomainMin = /DOMAIN_MIN +([\d.]+) +([\d.]+) +([\d.]+)/;
|
|
111
|
-
const regExpDomainMax = /DOMAIN_MAX +([\d.]+) +([\d.]+) +([\d.]+)/;
|
|
114
|
+
const regExpDomainMin = /DOMAIN_MIN +([\d.e+-]+) +([\d.e+-]+) +([\d.e+-]+)/;
|
|
115
|
+
const regExpDomainMax = /DOMAIN_MAX +([\d.e+-]+) +([\d.e+-]+) +([\d.e+-]+)/;
|
|
112
116
|
const regExpDataPoints = /^([\d.e+-]+) +([\d.e+-]+) +([\d.e+-]+) *$/gm;
|
|
113
117
|
|
|
114
118
|
let result = regExpTitle.exec( input );
|
|
@@ -56,6 +56,8 @@ export class LUTImageLoader extends Loader {
|
|
|
56
56
|
load( url, onLoad, onProgress, onError ) {
|
|
57
57
|
|
|
58
58
|
const loader = new TextureLoader( this.manager );
|
|
59
|
+
loader.setPriority( this.priority );
|
|
60
|
+
loader.setCache( this.cache );
|
|
59
61
|
|
|
60
62
|
loader.setCrossOrigin( this.crossOrigin );
|
|
61
63
|
|
|
@@ -87,6 +87,10 @@ class LWOLoader extends Loader {
|
|
|
87
87
|
const modelName = url.split( path ).pop().split( '.' )[ 0 ];
|
|
88
88
|
|
|
89
89
|
const loader = new FileLoader( this.manager );
|
|
90
|
+
loader.setPriority( this.priority );
|
|
91
|
+
loader.setCache( this.cache );
|
|
92
|
+
loader.setRequestHeader( this.requestHeader );
|
|
93
|
+
loader.setWithCredentials( this.withCredentials );
|
|
90
94
|
loader.setPath( scope.path );
|
|
91
95
|
loader.setResponseType( 'arraybuffer' );
|
|
92
96
|
|
|
@@ -135,6 +139,8 @@ class LWOLoader extends Loader {
|
|
|
135
139
|
// console.log( 'lwoTree', lwoTree );
|
|
136
140
|
|
|
137
141
|
const textureLoader = new TextureLoader( this.manager ).setPath( this.resourcePath || path ).setCrossOrigin( this.crossOrigin );
|
|
142
|
+
textureLoader.setPriority( this.priority );
|
|
143
|
+
textureLoader.setCache( this.cache );
|
|
138
144
|
|
|
139
145
|
return new LWOTreeParser( textureLoader ).parse( modelName );
|
|
140
146
|
|
|
@@ -134,6 +134,8 @@ class MD2Loader extends Loader {
|
|
|
134
134
|
const scope = this;
|
|
135
135
|
|
|
136
136
|
const loader = new FileLoader( scope.manager );
|
|
137
|
+
loader.setPriority( scope.priority );
|
|
138
|
+
loader.setCache( scope.cache );
|
|
137
139
|
loader.setPath( scope.path );
|
|
138
140
|
loader.setResponseType( 'arraybuffer' );
|
|
139
141
|
loader.setRequestHeader( scope.requestHeader );
|
|
@@ -69,6 +69,10 @@ class MDDLoader extends Loader {
|
|
|
69
69
|
const scope = this;
|
|
70
70
|
|
|
71
71
|
const loader = new FileLoader( this.manager );
|
|
72
|
+
loader.setPriority( this.priority );
|
|
73
|
+
loader.setCache( this.cache );
|
|
74
|
+
loader.setRequestHeader( this.requestHeader );
|
|
75
|
+
loader.setWithCredentials( this.withCredentials );
|
|
72
76
|
loader.setPath( this.path );
|
|
73
77
|
loader.setResponseType( 'arraybuffer' );
|
|
74
78
|
loader.load( url, function ( data ) {
|