@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
|
@@ -426,10 +426,10 @@ class WebGPUBackend extends Backend {
|
|
|
426
426
|
* new allocation.
|
|
427
427
|
*
|
|
428
428
|
* @async
|
|
429
|
-
* @param {BufferAttribute} attribute - The storage buffer attribute to read
|
|
430
|
-
* @param {
|
|
431
|
-
* @param {number} offset - The
|
|
432
|
-
* @param {
|
|
429
|
+
* @param {BufferAttribute} attribute - The storage buffer attribute to read from.
|
|
430
|
+
* @param {?(ReadbackBuffer|ArrayBuffer)} [target=null] - The readback buffer or array buffer that receives the data. If `null`, a new array buffer is returned.
|
|
431
|
+
* @param {number} [offset=0] - The byte offset to start reading from. Must be a multiple of 4.
|
|
432
|
+
* @param {number} [count=-1] - The number of bytes to read. Must be a multiple of 4, or `-1` to read to the end of the buffer.
|
|
433
433
|
* @return {Promise<ArrayBuffer|ReadbackBuffer>} A promise that resolves with the buffer data when the data are ready.
|
|
434
434
|
*/
|
|
435
435
|
async getArrayBufferAsync( attribute, target = null, offset = 0, count = - 1 ) {
|
|
@@ -909,19 +909,20 @@ class WebGPUBackend extends Backend {
|
|
|
909
909
|
|
|
910
910
|
const device = this.device;
|
|
911
911
|
const occlusionQueryCount = renderContext.occlusionQueryCount;
|
|
912
|
+
const occlusionData = this.getOcclusionData( renderContext );
|
|
912
913
|
|
|
913
914
|
let occlusionQuerySet;
|
|
914
915
|
|
|
915
916
|
if ( occlusionQueryCount > 0 ) {
|
|
916
917
|
|
|
917
|
-
if (
|
|
918
|
-
if (
|
|
918
|
+
if ( occlusionData.currentOcclusionQuerySet ) occlusionData.currentOcclusionQuerySet.destroy();
|
|
919
|
+
if ( occlusionData.currentOcclusionQueryBuffer ) occlusionData.currentOcclusionQueryBuffer.destroy();
|
|
919
920
|
|
|
920
|
-
// Get a reference to the array of objects with queries. The
|
|
921
|
+
// Get a reference to the array of objects with queries. The occlusionData property
|
|
921
922
|
// can be changed by another render pass before the buffer.mapAsyc() completes.
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
923
|
+
occlusionData.currentOcclusionQuerySet = occlusionData.occlusionQuerySet;
|
|
924
|
+
occlusionData.currentOcclusionQueryBuffer = occlusionData.occlusionQueryBuffer;
|
|
925
|
+
occlusionData.currentOcclusionQueryObjects = occlusionData.occlusionQueryObjects;
|
|
925
926
|
|
|
926
927
|
//
|
|
927
928
|
|
|
@@ -933,20 +934,20 @@ class WebGPUBackend extends Backend {
|
|
|
933
934
|
|
|
934
935
|
_querySetDescriptor.reset();
|
|
935
936
|
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
937
|
+
occlusionData.occlusionQuerySet = occlusionQuerySet;
|
|
938
|
+
occlusionData.occlusionQueryIndex = 0;
|
|
939
|
+
occlusionData.occlusionQueryObjects = new Array( occlusionQueryCount );
|
|
939
940
|
|
|
940
|
-
|
|
941
|
+
occlusionData.lastOcclusionObject = null;
|
|
941
942
|
|
|
942
|
-
} else if (
|
|
943
|
+
} else if ( occlusionData.lastOcclusionObject !== undefined ) {
|
|
943
944
|
|
|
944
945
|
// invalidate if there is a stale query
|
|
945
946
|
|
|
946
|
-
|
|
947
|
+
occlusionData.lastOcclusionObject = undefined;
|
|
947
948
|
|
|
948
|
-
|
|
949
|
-
|
|
949
|
+
occlusionData.occlusionQuerySet.destroy();
|
|
950
|
+
occlusionData.occlusionQuerySet = undefined;
|
|
950
951
|
|
|
951
952
|
}
|
|
952
953
|
|
|
@@ -1109,9 +1110,15 @@ class WebGPUBackend extends Backend {
|
|
|
1109
1110
|
|
|
1110
1111
|
const cameras = renderContext.camera.cameras;
|
|
1111
1112
|
|
|
1112
|
-
|
|
1113
|
+
// The layer descriptors hold views of the depth texture, which can be recreated (dispose, resize)
|
|
1114
|
+
// or belong to another render target, since render contexts are shared by attachment state.
|
|
1115
|
+
|
|
1116
|
+
const depthTextureGPU = this.get( renderContext.depthTexture ).texture;
|
|
1117
|
+
|
|
1118
|
+
if ( ! renderContextData.layerDescriptors || renderContextData.layerDescriptors.length !== cameras.length || renderContextData.layerDepthTexture !== depthTextureGPU ) {
|
|
1113
1119
|
|
|
1114
1120
|
this._createArrayCameraLayerDescriptors( renderContext, renderContextData, descriptor, cameras );
|
|
1121
|
+
renderContextData.layerDepthTexture = depthTextureGPU;
|
|
1115
1122
|
|
|
1116
1123
|
} else {
|
|
1117
1124
|
|
|
@@ -1259,22 +1266,27 @@ class WebGPUBackend extends Backend {
|
|
|
1259
1266
|
|
|
1260
1267
|
for ( let i = 0; i < cameras.length; i ++ ) {
|
|
1261
1268
|
|
|
1262
|
-
const sourceAttachment = descriptor.colorAttachments[ 0 ];
|
|
1263
|
-
const layerAttachment = descriptor.colorAttachments[ i ];
|
|
1264
|
-
|
|
1265
|
-
const layerColorAttachment = new GPURenderPassColorAttachment();
|
|
1266
|
-
layerColorAttachment.view = layerAttachment.view;
|
|
1267
|
-
layerColorAttachment.depthSlice = layerAttachment.depthSlice;
|
|
1268
|
-
layerColorAttachment.resolveTarget = layerAttachment.resolveTarget;
|
|
1269
|
-
layerColorAttachment.loadOp = sourceAttachment.loadOp;
|
|
1270
|
-
layerColorAttachment.storeOp = sourceAttachment.storeOp;
|
|
1271
|
-
layerColorAttachment.clearValue = sourceAttachment.clearValue;
|
|
1272
|
-
|
|
1273
1269
|
const layerDescriptor = new GPURenderPassDescriptor();
|
|
1274
1270
|
layerDescriptor.label = descriptor.label;
|
|
1275
1271
|
layerDescriptor.occlusionQuerySet = descriptor.occlusionQuerySet;
|
|
1276
1272
|
layerDescriptor.timestampWrites = descriptor.timestampWrites;
|
|
1277
|
-
|
|
1273
|
+
|
|
1274
|
+
if ( descriptor.colorAttachments.length > 0 ) {
|
|
1275
|
+
|
|
1276
|
+
const sourceAttachment = descriptor.colorAttachments[ 0 ];
|
|
1277
|
+
const layerAttachment = descriptor.colorAttachments[ i ];
|
|
1278
|
+
|
|
1279
|
+
const layerColorAttachment = new GPURenderPassColorAttachment();
|
|
1280
|
+
layerColorAttachment.view = layerAttachment.view;
|
|
1281
|
+
layerColorAttachment.depthSlice = layerAttachment.depthSlice;
|
|
1282
|
+
layerColorAttachment.resolveTarget = layerAttachment.resolveTarget;
|
|
1283
|
+
layerColorAttachment.loadOp = sourceAttachment.loadOp;
|
|
1284
|
+
layerColorAttachment.storeOp = sourceAttachment.storeOp;
|
|
1285
|
+
layerColorAttachment.clearValue = sourceAttachment.clearValue;
|
|
1286
|
+
|
|
1287
|
+
layerDescriptor.colorAttachments.push( layerColorAttachment );
|
|
1288
|
+
|
|
1289
|
+
}
|
|
1278
1290
|
|
|
1279
1291
|
if ( descriptor.depthStencilAttachment ) {
|
|
1280
1292
|
|
|
@@ -1306,7 +1318,7 @@ class WebGPUBackend extends Backend {
|
|
|
1306
1318
|
layerDepthStencilAttachment.view = depthTextureData.viewCache[ layerIndex ];
|
|
1307
1319
|
layerDepthStencilAttachment.depthLoadOp = depthStencilAttachment.depthLoadOp || GPULoadOp.Clear;
|
|
1308
1320
|
layerDepthStencilAttachment.depthStoreOp = depthStencilAttachment.depthStoreOp || GPUStoreOp.Store;
|
|
1309
|
-
layerDepthStencilAttachment.depthClearValue = depthStencilAttachment.depthClearValue
|
|
1321
|
+
layerDepthStencilAttachment.depthClearValue = depthStencilAttachment.depthClearValue ?? 1.0;
|
|
1310
1322
|
|
|
1311
1323
|
if ( renderContext.stencil ) {
|
|
1312
1324
|
|
|
@@ -1358,16 +1370,22 @@ class WebGPUBackend extends Backend {
|
|
|
1358
1370
|
for ( let i = 0; i < cameras.length; i ++ ) {
|
|
1359
1371
|
|
|
1360
1372
|
const layerDescriptor = renderContextData.layerDescriptors[ i ];
|
|
1361
|
-
|
|
1362
|
-
const layerColorAttachment = descriptor.colorAttachments[ i ];
|
|
1363
|
-
const colorAttachment = layerDescriptor.colorAttachments[ 0 ];
|
|
1373
|
+
layerDescriptor.timestampWrites = descriptor.timestampWrites;
|
|
1364
1374
|
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1375
|
+
if ( descriptor.colorAttachments.length > 0 ) {
|
|
1376
|
+
|
|
1377
|
+
const sourceColorAttachment = descriptor.colorAttachments[ 0 ];
|
|
1378
|
+
const layerColorAttachment = descriptor.colorAttachments[ i ];
|
|
1379
|
+
const colorAttachment = layerDescriptor.colorAttachments[ 0 ];
|
|
1380
|
+
|
|
1381
|
+
colorAttachment.view = layerColorAttachment.view;
|
|
1382
|
+
colorAttachment.resolveTarget = layerColorAttachment.resolveTarget;
|
|
1383
|
+
colorAttachment.depthSlice = layerColorAttachment.depthSlice;
|
|
1384
|
+
colorAttachment.loadOp = sourceColorAttachment.loadOp;
|
|
1385
|
+
colorAttachment.storeOp = sourceColorAttachment.storeOp;
|
|
1386
|
+
colorAttachment.clearValue = sourceColorAttachment.clearValue;
|
|
1387
|
+
|
|
1388
|
+
}
|
|
1371
1389
|
|
|
1372
1390
|
if ( layerDescriptor.depthStencilAttachment ) {
|
|
1373
1391
|
|
|
@@ -1419,6 +1437,7 @@ class WebGPUBackend extends Backend {
|
|
|
1419
1437
|
|
|
1420
1438
|
const renderContextData = this.get( renderContext );
|
|
1421
1439
|
const occlusionQueryCount = renderContext.occlusionQueryCount;
|
|
1440
|
+
const occlusionData = this.getOcclusionData( renderContext );
|
|
1422
1441
|
|
|
1423
1442
|
if ( renderContextData.renderBundles.length > 0 ) {
|
|
1424
1443
|
|
|
@@ -1426,7 +1445,7 @@ class WebGPUBackend extends Backend {
|
|
|
1426
1445
|
|
|
1427
1446
|
}
|
|
1428
1447
|
|
|
1429
|
-
const lastOcclusionObject =
|
|
1448
|
+
const lastOcclusionObject = occlusionData.lastOcclusionObject;
|
|
1430
1449
|
|
|
1431
1450
|
if ( lastOcclusionObject && lastOcclusionObject.occlusionTest === true ) {
|
|
1432
1451
|
|
|
@@ -1573,10 +1592,10 @@ class WebGPUBackend extends Backend {
|
|
|
1573
1592
|
_bufferDescriptor.reset();
|
|
1574
1593
|
|
|
1575
1594
|
// two buffers required here - WebGPU doesn't allow usage of QUERY_RESOLVE & MAP_READ to be combined
|
|
1576
|
-
renderContextData.encoder.resolveQuerySet(
|
|
1595
|
+
renderContextData.encoder.resolveQuerySet( occlusionData.occlusionQuerySet, 0, occlusionQueryCount, queryResolveBuffer, 0 );
|
|
1577
1596
|
renderContextData.encoder.copyBufferToBuffer( queryResolveBuffer, 0, readBuffer, 0, bufferSize );
|
|
1578
1597
|
|
|
1579
|
-
|
|
1598
|
+
occlusionData.occlusionQueryBuffer = readBuffer;
|
|
1580
1599
|
|
|
1581
1600
|
//
|
|
1582
1601
|
|
|
@@ -1586,6 +1605,10 @@ class WebGPUBackend extends Backend {
|
|
|
1586
1605
|
|
|
1587
1606
|
submit( this.device, renderContextData.encoder.finish() );
|
|
1588
1607
|
|
|
1608
|
+
// pass and encoder are only valid between beginRender() and finishRender()
|
|
1609
|
+
|
|
1610
|
+
renderContextData.currentPass = null;
|
|
1611
|
+
renderContextData.encoder = null;
|
|
1589
1612
|
|
|
1590
1613
|
//
|
|
1591
1614
|
|
|
@@ -1597,7 +1620,7 @@ class WebGPUBackend extends Backend {
|
|
|
1597
1620
|
|
|
1598
1621
|
const texture = textures[ i ];
|
|
1599
1622
|
|
|
1600
|
-
if ( texture.generateMipmaps === true ) {
|
|
1623
|
+
if ( texture.generateMipmaps === true && texture.mipmapsAutoUpdate === true ) {
|
|
1601
1624
|
|
|
1602
1625
|
this.textureUtils.generateMipmaps( texture );
|
|
1603
1626
|
|
|
@@ -1619,15 +1642,15 @@ class WebGPUBackend extends Backend {
|
|
|
1619
1642
|
*/
|
|
1620
1643
|
isOccluded( renderContext, object ) {
|
|
1621
1644
|
|
|
1622
|
-
const
|
|
1645
|
+
const occlusionData = this.getOcclusionData( renderContext );
|
|
1623
1646
|
|
|
1624
|
-
return
|
|
1647
|
+
return occlusionData.occluded && occlusionData.occluded.has( object );
|
|
1625
1648
|
|
|
1626
1649
|
}
|
|
1627
1650
|
|
|
1628
1651
|
/**
|
|
1629
1652
|
* This method processes the result of occlusion queries and writes it
|
|
1630
|
-
* into render context
|
|
1653
|
+
* into the occlusion data of the render context.
|
|
1631
1654
|
*
|
|
1632
1655
|
* @async
|
|
1633
1656
|
* @param {RenderContext} renderContext - The render context.
|
|
@@ -1635,18 +1658,18 @@ class WebGPUBackend extends Backend {
|
|
|
1635
1658
|
*/
|
|
1636
1659
|
async resolveOccludedAsync( renderContext ) {
|
|
1637
1660
|
|
|
1638
|
-
const
|
|
1661
|
+
const occlusionData = this.getOcclusionData( renderContext );
|
|
1639
1662
|
|
|
1640
1663
|
// handle occlusion query results
|
|
1641
1664
|
|
|
1642
|
-
const { currentOcclusionQueryBuffer, currentOcclusionQueryObjects } =
|
|
1665
|
+
const { currentOcclusionQueryBuffer, currentOcclusionQueryObjects } = occlusionData;
|
|
1643
1666
|
|
|
1644
1667
|
if ( currentOcclusionQueryBuffer && currentOcclusionQueryObjects ) {
|
|
1645
1668
|
|
|
1646
1669
|
const occluded = new WeakSet();
|
|
1647
1670
|
|
|
1648
|
-
|
|
1649
|
-
|
|
1671
|
+
occlusionData.currentOcclusionQueryObjects = null;
|
|
1672
|
+
occlusionData.currentOcclusionQueryBuffer = null;
|
|
1650
1673
|
|
|
1651
1674
|
await currentOcclusionQueryBuffer.mapAsync( GPUMapMode.READ );
|
|
1652
1675
|
|
|
@@ -1667,7 +1690,7 @@ class WebGPUBackend extends Backend {
|
|
|
1667
1690
|
|
|
1668
1691
|
currentOcclusionQueryBuffer.destroy();
|
|
1669
1692
|
|
|
1670
|
-
|
|
1693
|
+
occlusionData.occluded = occluded;
|
|
1671
1694
|
|
|
1672
1695
|
}
|
|
1673
1696
|
|
|
@@ -2145,24 +2168,31 @@ class WebGPUBackend extends Backend {
|
|
|
2145
2168
|
|
|
2146
2169
|
if ( object.isBatchedMesh === true ) {
|
|
2147
2170
|
|
|
2148
|
-
const starts = object.
|
|
2149
|
-
const counts = object.
|
|
2150
|
-
const
|
|
2171
|
+
const starts = object._mergedDrawStarts;
|
|
2172
|
+
const counts = object._mergedDrawCounts;
|
|
2173
|
+
const instanceCounts = object._mergedDrawInstanceCounts;
|
|
2174
|
+
const drawCount = object._mergedDrawCount;
|
|
2151
2175
|
const bytesPerElement = object._multiDrawBytesPerElement;
|
|
2152
2176
|
|
|
2177
|
+
let firstInstance = 0;
|
|
2178
|
+
|
|
2153
2179
|
for ( let i = 0; i < drawCount; i ++ ) {
|
|
2154
2180
|
|
|
2181
|
+
const instanceCount = instanceCounts[ i ];
|
|
2182
|
+
|
|
2155
2183
|
if ( hasIndex === true ) {
|
|
2156
2184
|
|
|
2157
|
-
passEncoderGPU.drawIndexed( counts[ i ],
|
|
2185
|
+
passEncoderGPU.drawIndexed( counts[ i ], instanceCount, starts[ i ] / bytesPerElement, 0, firstInstance );
|
|
2158
2186
|
|
|
2159
2187
|
} else {
|
|
2160
2188
|
|
|
2161
|
-
passEncoderGPU.draw( counts[ i ],
|
|
2189
|
+
passEncoderGPU.draw( counts[ i ], instanceCount, starts[ i ], firstInstance );
|
|
2162
2190
|
|
|
2163
2191
|
}
|
|
2164
2192
|
|
|
2165
|
-
info.update( object, counts[ i ],
|
|
2193
|
+
info.update( object, counts[ i ], instanceCount );
|
|
2194
|
+
|
|
2195
|
+
firstInstance += instanceCount;
|
|
2166
2196
|
|
|
2167
2197
|
}
|
|
2168
2198
|
|
|
@@ -2188,9 +2218,9 @@ class WebGPUBackend extends Backend {
|
|
|
2188
2218
|
|
|
2189
2219
|
passEncoderGPU.drawIndexed( indexCount, instanceCount, firstIndex, 0, 0 );
|
|
2190
2220
|
|
|
2191
|
-
|
|
2221
|
+
info.update( object, indexCount, instanceCount );
|
|
2192
2222
|
|
|
2193
|
-
|
|
2223
|
+
}
|
|
2194
2224
|
|
|
2195
2225
|
} else {
|
|
2196
2226
|
|
|
@@ -2210,14 +2240,13 @@ class WebGPUBackend extends Backend {
|
|
|
2210
2240
|
|
|
2211
2241
|
}
|
|
2212
2242
|
|
|
2213
|
-
|
|
2214
2243
|
} else {
|
|
2215
2244
|
|
|
2216
2245
|
passEncoderGPU.draw( vertexCount, instanceCount, firstVertex, 0 );
|
|
2217
2246
|
|
|
2218
|
-
|
|
2247
|
+
info.update( object, vertexCount, instanceCount );
|
|
2219
2248
|
|
|
2220
|
-
|
|
2249
|
+
}
|
|
2221
2250
|
|
|
2222
2251
|
}
|
|
2223
2252
|
|
|
@@ -2283,11 +2312,13 @@ class WebGPUBackend extends Backend {
|
|
|
2283
2312
|
const pixelRatio = ( renderTarget === null || renderTarget.isPostProcessingRenderTarget === true ) ? this.renderer.getPixelRatio() : 1;
|
|
2284
2313
|
const indexPos = cameraIndex ? bindings.indexOf( cameraIndex ) : - 1;
|
|
2285
2314
|
|
|
2315
|
+
const frustumArray = context.frustumArray;
|
|
2316
|
+
|
|
2286
2317
|
for ( let i = 0, len = cameras.length; i < len; i ++ ) {
|
|
2287
2318
|
|
|
2288
2319
|
const subCamera = cameras[ i ];
|
|
2289
2320
|
|
|
2290
|
-
if ( object.layers.test( subCamera.layers ) ) {
|
|
2321
|
+
if ( object.layers.test( subCamera.layers ) && ( renderObject.camera.perCameraFrustumCulled === false || object.frustumCulled === false || object.intersectsFrustum( frustumArray.getFrustum( i ) ) ) ) {
|
|
2291
2322
|
|
|
2292
2323
|
const vp = subCamera.viewport;
|
|
2293
2324
|
|
|
@@ -2353,26 +2384,28 @@ class WebGPUBackend extends Backend {
|
|
|
2353
2384
|
|
|
2354
2385
|
}
|
|
2355
2386
|
|
|
2356
|
-
} else if (
|
|
2387
|
+
} else if ( context.occlusionQueryCount > 0 ) {
|
|
2357
2388
|
|
|
2358
|
-
const
|
|
2389
|
+
const occlusionData = this.getOcclusionData( context );
|
|
2390
|
+
|
|
2391
|
+
const lastObject = occlusionData.lastOcclusionObject;
|
|
2359
2392
|
if ( lastObject !== object ) {
|
|
2360
2393
|
|
|
2361
2394
|
if ( lastObject !== null && lastObject.occlusionTest === true ) {
|
|
2362
2395
|
|
|
2363
2396
|
renderContextData.currentPass.endOcclusionQuery();
|
|
2364
|
-
|
|
2397
|
+
occlusionData.occlusionQueryIndex ++;
|
|
2365
2398
|
|
|
2366
2399
|
}
|
|
2367
2400
|
|
|
2368
2401
|
if ( object.occlusionTest === true ) {
|
|
2369
2402
|
|
|
2370
|
-
renderContextData.currentPass.beginOcclusionQuery(
|
|
2371
|
-
|
|
2403
|
+
renderContextData.currentPass.beginOcclusionQuery( occlusionData.occlusionQueryIndex );
|
|
2404
|
+
occlusionData.occlusionQueryObjects[ occlusionData.occlusionQueryIndex ] = object;
|
|
2372
2405
|
|
|
2373
2406
|
}
|
|
2374
2407
|
|
|
2375
|
-
|
|
2408
|
+
occlusionData.lastOcclusionObject = object;
|
|
2376
2409
|
|
|
2377
2410
|
}
|
|
2378
2411
|
|
|
@@ -2398,7 +2431,7 @@ class WebGPUBackend extends Backend {
|
|
|
2398
2431
|
|
|
2399
2432
|
const data = this.get( renderObject );
|
|
2400
2433
|
|
|
2401
|
-
const { object, material } = renderObject;
|
|
2434
|
+
const { object, material, geometry } = renderObject;
|
|
2402
2435
|
|
|
2403
2436
|
const utils = this.utils;
|
|
2404
2437
|
|
|
@@ -2407,6 +2440,7 @@ class WebGPUBackend extends Backend {
|
|
|
2407
2440
|
const colorFormat = utils.getCurrentColorFormat( renderObject.context );
|
|
2408
2441
|
const depthStencilFormat = utils.getCurrentDepthStencilFormat( renderObject.context );
|
|
2409
2442
|
const primitiveTopology = utils.getPrimitiveTopology( object, material );
|
|
2443
|
+
const stripIndexFormat = utils.getStripIndexFormat( object, geometry );
|
|
2410
2444
|
const frontFaceCW = ( object.isMesh && object.matrixWorld.determinantAffine() < 0 );
|
|
2411
2445
|
|
|
2412
2446
|
let needsUpdate = false;
|
|
@@ -2423,8 +2457,9 @@ class WebGPUBackend extends Backend {
|
|
|
2423
2457
|
data.side !== material.side || data.alphaToCoverage !== material.alphaToCoverage ||
|
|
2424
2458
|
data.sampleCount !== sampleCount || data.colorSpace !== colorSpace ||
|
|
2425
2459
|
data.colorFormat !== colorFormat || data.depthStencilFormat !== depthStencilFormat ||
|
|
2426
|
-
data.primitiveTopology !== primitiveTopology ||
|
|
2460
|
+
data.primitiveTopology !== primitiveTopology || data.stripIndexFormat !== stripIndexFormat ||
|
|
2427
2461
|
data.frontFaceCW !== frontFaceCW ||
|
|
2462
|
+
data.geometryVersion !== renderObject.geometryVersion ||
|
|
2428
2463
|
data.clippingContextCacheKey !== renderObject.clippingContextCacheKey
|
|
2429
2464
|
) {
|
|
2430
2465
|
|
|
@@ -2444,7 +2479,9 @@ class WebGPUBackend extends Backend {
|
|
|
2444
2479
|
data.colorFormat = colorFormat;
|
|
2445
2480
|
data.depthStencilFormat = depthStencilFormat;
|
|
2446
2481
|
data.primitiveTopology = primitiveTopology;
|
|
2482
|
+
data.stripIndexFormat = stripIndexFormat;
|
|
2447
2483
|
data.frontFaceCW = frontFaceCW;
|
|
2484
|
+
data.geometryVersion = renderObject.geometryVersion;
|
|
2448
2485
|
data.clippingContextCacheKey = renderObject.clippingContextCacheKey;
|
|
2449
2486
|
|
|
2450
2487
|
needsUpdate = true;
|
|
@@ -2463,7 +2500,7 @@ class WebGPUBackend extends Backend {
|
|
|
2463
2500
|
*/
|
|
2464
2501
|
getRenderCacheKey( renderObject ) {
|
|
2465
2502
|
|
|
2466
|
-
const { object, material } = renderObject;
|
|
2503
|
+
const { object, material, geometry } = renderObject;
|
|
2467
2504
|
|
|
2468
2505
|
const utils = this.utils;
|
|
2469
2506
|
const renderContext = renderObject.context;
|
|
@@ -2487,8 +2524,8 @@ class WebGPUBackend extends Backend {
|
|
|
2487
2524
|
frontFaceCW,
|
|
2488
2525
|
utils.getSampleCountRenderContext( renderContext ),
|
|
2489
2526
|
utils.getCurrentColorSpace( renderContext ), utils.getCurrentColorFormat( renderContext ), utils.getCurrentDepthStencilFormat( renderContext ),
|
|
2490
|
-
utils.getPrimitiveTopology( object, material ),
|
|
2491
|
-
|
|
2527
|
+
utils.getPrimitiveTopology( object, material ), utils.getStripIndexFormat( object, geometry ),
|
|
2528
|
+
this.attributeUtils.getVertexBufferLayoutCacheKey( renderObject ),
|
|
2492
2529
|
renderObject.clippingContextCacheKey
|
|
2493
2530
|
].join();
|
|
2494
2531
|
|
|
@@ -2606,7 +2643,12 @@ class WebGPUBackend extends Backend {
|
|
|
2606
2643
|
*/
|
|
2607
2644
|
initTimestampQuery( type, uid, descriptor ) {
|
|
2608
2645
|
|
|
2609
|
-
if ( ! this.trackTimestamp )
|
|
2646
|
+
if ( ! this.trackTimestamp ) {
|
|
2647
|
+
|
|
2648
|
+
descriptor.timestampWrites = undefined;
|
|
2649
|
+
return;
|
|
2650
|
+
|
|
2651
|
+
}
|
|
2610
2652
|
|
|
2611
2653
|
if ( ! this.timestampQueryPool[ type ] ) {
|
|
2612
2654
|
|
|
@@ -2975,6 +3017,20 @@ class WebGPUBackend extends Backend {
|
|
|
2975
3017
|
|
|
2976
3018
|
}
|
|
2977
3019
|
|
|
3020
|
+
/**
|
|
3021
|
+
* Frees the GPU resources of the given canvas target.
|
|
3022
|
+
*
|
|
3023
|
+
* @param {CanvasTarget} canvasTarget - The canvas target.
|
|
3024
|
+
*/
|
|
3025
|
+
destroyCanvasTarget( canvasTarget ) {
|
|
3026
|
+
|
|
3027
|
+
this.destroyTexture( canvasTarget.colorTexture );
|
|
3028
|
+
this.destroyTexture( canvasTarget.depthTexture );
|
|
3029
|
+
|
|
3030
|
+
this.delete( canvasTarget );
|
|
3031
|
+
|
|
3032
|
+
}
|
|
3033
|
+
|
|
2978
3034
|
// utils public
|
|
2979
3035
|
|
|
2980
3036
|
/**
|
|
@@ -3084,7 +3140,7 @@ class WebGPUBackend extends Backend {
|
|
|
3084
3140
|
|
|
3085
3141
|
submit( this.device, encoder.finish() );
|
|
3086
3142
|
|
|
3087
|
-
if ( dstLevel === 0 && dstTexture.generateMipmaps ) {
|
|
3143
|
+
if ( dstLevel === 0 && dstTexture.generateMipmaps === true && dstTexture.mipmapsAutoUpdate === true ) {
|
|
3088
3144
|
|
|
3089
3145
|
this.textureUtils.generateMipmaps( dstTexture );
|
|
3090
3146
|
|
|
@@ -3141,7 +3197,9 @@ class WebGPUBackend extends Backend {
|
|
|
3141
3197
|
|
|
3142
3198
|
}
|
|
3143
3199
|
|
|
3144
|
-
|
|
3200
|
+
const generateMipmaps = texture.generateMipmaps === true && texture.mipmapsAutoUpdate === true && destinationGPU.mipLevelCount > 1;
|
|
3201
|
+
|
|
3202
|
+
if ( renderContextData.encoder && this._isRenderCameraDepthArray( renderContext ) === true ) {
|
|
3145
3203
|
|
|
3146
3204
|
// Layered draws are only executed in finishRender(), so preserve this copy as a render-stage boundary.
|
|
3147
3205
|
const bundles = this._finishArrayCameraBundleEncoders( renderContextData );
|
|
@@ -3154,7 +3212,7 @@ class WebGPUBackend extends Backend {
|
|
|
3154
3212
|
destinationGPU,
|
|
3155
3213
|
rectangle: { x: rectangle.x, y: rectangle.y, z: rectangle.z, w: rectangle.w },
|
|
3156
3214
|
// ViewportTextureNode restores this flag before the deferred copy executes.
|
|
3157
|
-
generateMipmaps
|
|
3215
|
+
generateMipmaps
|
|
3158
3216
|
}
|
|
3159
3217
|
} );
|
|
3160
3218
|
|
|
@@ -3183,7 +3241,7 @@ class WebGPUBackend extends Backend {
|
|
|
3183
3241
|
// mipmaps must be genereated with the same encoder otherwise the copied texture data
|
|
3184
3242
|
// might be out-of-sync, see #31768
|
|
3185
3243
|
|
|
3186
|
-
this._copyFramebufferToTexture( encoder, texture, sourceGPU, destinationGPU, rectangle );
|
|
3244
|
+
this._copyFramebufferToTexture( encoder, texture, sourceGPU, destinationGPU, rectangle, 0, generateMipmaps );
|
|
3187
3245
|
|
|
3188
3246
|
if ( renderContextData.currentPass ) {
|
|
3189
3247
|
|
|
@@ -3256,7 +3314,7 @@ class WebGPUBackend extends Backend {
|
|
|
3256
3314
|
_texelCopyTextureInfoDst.reset();
|
|
3257
3315
|
_extent3D.reset();
|
|
3258
3316
|
|
|
3259
|
-
if ( generateMipmaps ) {
|
|
3317
|
+
if ( generateMipmaps === true && destinationGPU.mipLevelCount > 1 ) {
|
|
3260
3318
|
|
|
3261
3319
|
this.textureUtils.generateMipmaps( texture, encoder );
|
|
3262
3320
|
|
|
@@ -31,7 +31,7 @@ class WebGPURenderer extends Renderer {
|
|
|
31
31
|
* WebGPURenderer options.
|
|
32
32
|
*
|
|
33
33
|
* @typedef {Object} WebGPURenderer~Options
|
|
34
|
-
* @property {boolean} [logarithmicDepthBuffer=false] - Whether logarithmic depth buffer is enabled or not.
|
|
34
|
+
* @property {boolean} [logarithmicDepthBuffer=false] - Whether logarithmic depth buffer is enabled or not. Ignored when a reversed depth buffer is in use.
|
|
35
35
|
* @property {boolean} [reversedDepthBuffer=false] - Whether reversed depth buffer is enabled or not.
|
|
36
36
|
* @property {boolean} [alpha=true] - Whether the default framebuffer (which represents the final contents of the canvas) should be transparent or opaque.
|
|
37
37
|
* @property {boolean} [depth=true] - Whether the default framebuffer should have a depth buffer or not.
|
|
@@ -26,6 +26,16 @@ import {
|
|
|
26
26
|
import { LinearToneMapping, ReinhardToneMapping, CineonToneMapping, ACESFilmicToneMapping, AgXToneMapping, NeutralToneMapping } from '../../../constants.js';
|
|
27
27
|
import { linearToneMapping, reinhardToneMapping, cineonToneMapping, acesFilmicToneMapping, agxToneMapping, neutralToneMapping } from '../../../nodes/display/ToneMappingFunctions.js';
|
|
28
28
|
|
|
29
|
+
PointLight.registerNode( PointLightNode );
|
|
30
|
+
DirectionalLight.registerNode( DirectionalLightNode );
|
|
31
|
+
RectAreaLight.registerNode( RectAreaLightNode );
|
|
32
|
+
SpotLight.registerNode( SpotLightNode );
|
|
33
|
+
AmbientLight.registerNode( AmbientLightNode );
|
|
34
|
+
HemisphereLight.registerNode( HemisphereLightNode );
|
|
35
|
+
LightProbe.registerNode( LightProbeNode );
|
|
36
|
+
IESSpotLight.registerNode( IESSpotLightNode );
|
|
37
|
+
ProjectorLight.registerNode( ProjectorLightNode );
|
|
38
|
+
|
|
29
39
|
/**
|
|
30
40
|
* This version of a node library represents a basic version
|
|
31
41
|
* just focusing on lights and tone mapping techniques.
|
|
@@ -42,16 +52,6 @@ class BasicNodeLibrary extends NodeLibrary {
|
|
|
42
52
|
|
|
43
53
|
super();
|
|
44
54
|
|
|
45
|
-
this.addLight( PointLightNode, PointLight );
|
|
46
|
-
this.addLight( DirectionalLightNode, DirectionalLight );
|
|
47
|
-
this.addLight( RectAreaLightNode, RectAreaLight );
|
|
48
|
-
this.addLight( SpotLightNode, SpotLight );
|
|
49
|
-
this.addLight( AmbientLightNode, AmbientLight );
|
|
50
|
-
this.addLight( HemisphereLightNode, HemisphereLight );
|
|
51
|
-
this.addLight( LightProbeNode, LightProbe );
|
|
52
|
-
this.addLight( IESSpotLightNode, IESSpotLight );
|
|
53
|
-
this.addLight( ProjectorLightNode, ProjectorLight );
|
|
54
|
-
|
|
55
55
|
this.addToneMapping( linearToneMapping, LinearToneMapping );
|
|
56
56
|
this.addToneMapping( reinhardToneMapping, ReinhardToneMapping );
|
|
57
57
|
this.addToneMapping( cineonToneMapping, CineonToneMapping );
|
|
@@ -45,6 +45,16 @@ import {
|
|
|
45
45
|
import { LinearToneMapping, ReinhardToneMapping, CineonToneMapping, ACESFilmicToneMapping, AgXToneMapping, NeutralToneMapping } from '../../../constants.js';
|
|
46
46
|
import { linearToneMapping, reinhardToneMapping, cineonToneMapping, acesFilmicToneMapping, agxToneMapping, neutralToneMapping } from '../../../nodes/display/ToneMappingFunctions.js';
|
|
47
47
|
|
|
48
|
+
PointLight.registerNode( PointLightNode );
|
|
49
|
+
DirectionalLight.registerNode( DirectionalLightNode );
|
|
50
|
+
RectAreaLight.registerNode( RectAreaLightNode );
|
|
51
|
+
SpotLight.registerNode( SpotLightNode );
|
|
52
|
+
AmbientLight.registerNode( AmbientLightNode );
|
|
53
|
+
HemisphereLight.registerNode( HemisphereLightNode );
|
|
54
|
+
LightProbe.registerNode( LightProbeNode );
|
|
55
|
+
IESSpotLight.registerNode( IESSpotLightNode );
|
|
56
|
+
ProjectorLight.registerNode( ProjectorLightNode );
|
|
57
|
+
|
|
48
58
|
/**
|
|
49
59
|
* This version of a node library represents the standard version
|
|
50
60
|
* used in {@link WebGPURenderer}. It maps lights, tone mapping
|
|
@@ -75,16 +85,6 @@ class StandardNodeLibrary extends NodeLibrary {
|
|
|
75
85
|
this.addMaterial( SpriteNodeMaterial, 'SpriteMaterial' );
|
|
76
86
|
this.addMaterial( ShadowNodeMaterial, 'ShadowMaterial' );
|
|
77
87
|
|
|
78
|
-
this.addLight( PointLightNode, PointLight );
|
|
79
|
-
this.addLight( DirectionalLightNode, DirectionalLight );
|
|
80
|
-
this.addLight( RectAreaLightNode, RectAreaLight );
|
|
81
|
-
this.addLight( SpotLightNode, SpotLight );
|
|
82
|
-
this.addLight( AmbientLightNode, AmbientLight );
|
|
83
|
-
this.addLight( HemisphereLightNode, HemisphereLight );
|
|
84
|
-
this.addLight( LightProbeNode, LightProbe );
|
|
85
|
-
this.addLight( IESSpotLightNode, IESSpotLight );
|
|
86
|
-
this.addLight( ProjectorLightNode, ProjectorLight );
|
|
87
|
-
|
|
88
88
|
this.addToneMapping( linearToneMapping, LinearToneMapping );
|
|
89
89
|
this.addToneMapping( reinhardToneMapping, ReinhardToneMapping );
|
|
90
90
|
this.addToneMapping( cineonToneMapping, CineonToneMapping );
|