super-three 0.170.1 → 0.172.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/build/three.cjs +157 -49
- package/build/three.core.js +104 -42
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +53 -8
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +10 -5
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +21191 -1008
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +21189 -1008
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/Addons.js +0 -5
- package/examples/jsm/animation/CCDIKSolver.js +3 -2
- package/examples/jsm/controls/ArcballControls.js +28 -19
- package/examples/jsm/controls/OrbitControls.js +5 -4
- package/examples/jsm/csm/CSMShadowNode.js +16 -11
- package/examples/jsm/curves/NURBSCurve.js +1 -1
- package/examples/jsm/curves/NURBSUtils.js +3 -0
- package/examples/jsm/effects/OutlineEffect.js +1 -1
- package/examples/jsm/exporters/GLTFExporter.js +11 -7
- package/examples/jsm/exporters/KTX2Exporter.js +1 -1
- package/examples/jsm/exporters/PLYExporter.js +2 -2
- package/examples/jsm/helpers/TextureHelperGPU.js +15 -5
- package/examples/jsm/helpers/VertexNormalsHelper.js +2 -0
- package/examples/jsm/lights/LightProbeGenerator.js +3 -3
- package/examples/jsm/lines/webgpu/LineSegments2.js +15 -6
- package/examples/jsm/loaders/3MFLoader.js +6 -3
- package/examples/jsm/loaders/BVHLoader.js +1 -1
- package/examples/jsm/loaders/ColladaLoader.js +5 -5
- package/examples/jsm/loaders/DDSLoader.js +42 -0
- package/examples/jsm/loaders/GCodeLoader.js +1 -1
- package/examples/jsm/loaders/GLTFLoader.js +22 -2
- package/examples/jsm/loaders/KTX2Loader.js +6 -1
- package/examples/jsm/loaders/KTXLoader.js +4 -4
- package/examples/jsm/loaders/LDrawLoader.js +1 -1
- package/examples/jsm/loaders/LottieLoader.js +1 -1
- package/examples/jsm/loaders/MTLLoader.js +1 -0
- package/examples/jsm/loaders/NRRDLoader.js +1 -1
- package/examples/jsm/loaders/PLYLoader.js +7 -7
- package/examples/jsm/loaders/PVRLoader.js +1 -1
- package/examples/jsm/loaders/SVGLoader.js +2 -2
- package/examples/jsm/loaders/TDSLoader.js +1 -1
- package/examples/jsm/loaders/VRMLLoader.js +7 -7
- package/examples/jsm/loaders/lwo/IFFParser.js +4 -4
- package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +1 -1
- package/examples/jsm/math/ConvexHull.js +1 -1
- package/examples/jsm/math/OBB.js +17 -0
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +10 -10
- package/examples/jsm/misc/Volume.js +20 -12
- package/examples/jsm/misc/VolumeSlice.js +2 -2
- package/examples/jsm/modifiers/CurveModifier.js +10 -8
- package/examples/jsm/modifiers/CurveModifierGPU.js +9 -7
- package/examples/jsm/modifiers/SimplifyModifier.js +2 -2
- package/examples/jsm/objects/GroundedSkybox.js +4 -4
- package/examples/jsm/objects/Sky.js +2 -2
- package/examples/jsm/objects/SkyMesh.js +3 -3
- package/examples/jsm/objects/Water2.js +1 -1
- package/examples/jsm/objects/Water2Mesh.js +2 -2
- package/examples/jsm/objects/WaterMesh.js +4 -4
- package/examples/jsm/postprocessing/BloomPass.js +2 -2
- package/examples/jsm/postprocessing/EffectComposer.js +1 -2
- package/examples/jsm/postprocessing/OutlinePass.js +4 -4
- package/examples/jsm/postprocessing/SAOPass.js +1 -2
- package/examples/jsm/postprocessing/SMAAPass.js +1 -3
- package/examples/jsm/postprocessing/SSAOPass.js +2 -4
- package/examples/jsm/postprocessing/SSRPass.js +2 -4
- package/examples/jsm/postprocessing/UnrealBloomPass.js +2 -2
- package/examples/jsm/renderers/SVGRenderer.js +6 -4
- package/examples/jsm/shaders/BokehShader2.js +1 -1
- package/examples/jsm/shaders/GodRaysShader.js +3 -3
- package/examples/jsm/shaders/SobelOperatorShader.js +1 -1
- package/examples/jsm/tsl/display/AfterImageNode.js +93 -4
- package/examples/jsm/tsl/display/AnaglyphPassNode.js +46 -2
- package/examples/jsm/tsl/display/AnamorphicNode.js +118 -5
- package/examples/jsm/tsl/display/BleachBypass.js +10 -0
- package/examples/jsm/tsl/display/BloomNode.js +233 -26
- package/examples/jsm/tsl/display/DenoiseNode.js +141 -25
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +80 -1
- package/examples/jsm/tsl/display/DotScreenNode.js +50 -5
- package/examples/jsm/tsl/display/FXAANode.js +52 -3
- package/examples/jsm/tsl/display/FilmNode.js +47 -1
- package/examples/jsm/tsl/display/GTAONode.js +210 -14
- package/examples/jsm/tsl/display/GaussianBlurNode.js +152 -8
- package/examples/jsm/tsl/display/LensflareNode.js +131 -13
- package/examples/jsm/tsl/display/Lut3DNode.js +55 -1
- package/examples/jsm/tsl/display/MotionBlur.js +12 -2
- package/examples/jsm/tsl/display/OutlineNode.js +343 -26
- package/examples/jsm/tsl/display/ParallaxBarrierPassNode.js +36 -2
- package/examples/jsm/tsl/display/PixelationPassNode.js +142 -9
- package/examples/jsm/tsl/display/RGBShiftNode.js +49 -2
- package/examples/jsm/tsl/display/SMAANode.js +187 -46
- package/examples/jsm/tsl/display/SSAAPassNode.js +110 -25
- package/examples/jsm/tsl/display/SSRNode.js +194 -21
- package/examples/jsm/tsl/display/Sepia.js +9 -0
- package/examples/jsm/tsl/display/SobelOperatorNode.js +54 -4
- package/examples/jsm/tsl/display/StereoCompositePassNode.js +79 -3
- package/examples/jsm/tsl/display/StereoPassNode.js +41 -3
- package/examples/jsm/tsl/display/TRAAPassNode.js +116 -21
- package/examples/jsm/tsl/display/TransitionNode.js +71 -6
- package/examples/jsm/tsl/display/hashBlur.js +14 -3
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +40 -34
- package/examples/jsm/utils/BufferGeometryUtils.js +1 -1
- package/examples/jsm/utils/CameraUtils.js +4 -1
- package/examples/jsm/utils/GeometryUtils.js +22 -19
- package/examples/jsm/utils/SceneUtils.js +2 -2
- package/examples/jsm/webxr/XRControllerModelFactory.js +6 -1
- package/examples/jsm/webxr/XREstimatedLight.js +1 -1
- package/package.json +8 -3
- package/src/Three.Core.js +2 -0
- package/src/Three.Legacy.js +0 -21
- package/src/Three.TSL.js +9 -4
- package/src/Three.WebGPU.Nodes.js +2 -2
- package/src/Three.WebGPU.js +2 -2
- package/src/animation/PropertyBinding.js +2 -2
- package/src/cameras/PerspectiveCamera.js +18 -2
- package/src/constants.js +1 -1
- package/src/core/RenderTarget.js +18 -0
- package/src/core/RenderTarget3D.js +22 -0
- package/src/core/RenderTargetArray.js +22 -0
- package/src/extras/Earcut.js +1 -1
- package/src/extras/PMREMGenerator.js +20 -0
- package/src/extras/TextureUtils.js +6 -0
- package/src/helpers/CameraHelper.js +16 -13
- package/src/loaders/nodes/NodeLoader.js +59 -0
- package/src/loaders/nodes/NodeMaterialLoader.js +45 -0
- package/src/loaders/nodes/NodeObjectLoader.js +61 -0
- package/src/materials/nodes/InstancedPointsNodeMaterial.js +72 -19
- package/src/materials/nodes/Line2NodeMaterial.js +128 -34
- package/src/materials/nodes/LineBasicNodeMaterial.js +17 -2
- package/src/materials/nodes/LineDashedNodeMaterial.js +78 -5
- package/src/materials/nodes/MeshBasicNodeMaterial.js +56 -0
- package/src/materials/nodes/MeshLambertNodeMaterial.js +35 -0
- package/src/materials/nodes/MeshMatcapNodeMaterial.js +22 -2
- package/src/materials/nodes/MeshNormalNodeMaterial.js +21 -2
- package/src/materials/nodes/MeshPhongNodeMaterial.js +64 -1
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +269 -0
- package/src/materials/nodes/MeshSSSNodeMaterial.js +97 -6
- package/src/materials/nodes/MeshStandardNodeMaterial.js +78 -0
- package/src/materials/nodes/MeshToonNodeMaterial.js +28 -0
- package/src/materials/nodes/NodeMaterial.js +474 -21
- package/src/materials/nodes/PointsNodeMaterial.js +22 -13
- package/src/materials/nodes/ShadowNodeMaterial.js +29 -0
- package/src/materials/nodes/SpriteNodeMaterial.js +77 -19
- package/src/materials/nodes/VolumeNodeMaterial.js +80 -4
- package/src/materials/nodes/manager/NodeMaterialObserver.js +87 -0
- package/src/nodes/Nodes.js +1 -6
- package/src/nodes/TSL.js +2 -3
- package/src/nodes/accessors/AccessorsUtils.js +27 -0
- package/src/nodes/accessors/Arrays.js +24 -5
- package/src/nodes/accessors/BatchNode.js +39 -3
- package/src/nodes/accessors/Bitangent.js +37 -0
- package/src/nodes/accessors/BufferAttributeNode.js +178 -5
- package/src/nodes/accessors/BufferNode.js +63 -0
- package/src/nodes/accessors/BuiltinNode.js +38 -0
- package/src/nodes/accessors/Camera.js +49 -0
- package/src/nodes/accessors/ClippingNode.js +71 -2
- package/src/nodes/accessors/CubeTextureNode.js +64 -0
- package/src/nodes/accessors/InstanceNode.js +85 -2
- package/src/nodes/accessors/InstancedMeshNode.js +28 -3
- package/src/nodes/accessors/InstancedPointsMaterialNode.js +13 -0
- package/src/nodes/accessors/Lights.js +50 -1
- package/src/nodes/accessors/MaterialNode.js +302 -8
- package/src/nodes/accessors/MaterialProperties.js +7 -0
- package/src/nodes/accessors/MaterialReferenceNode.js +53 -13
- package/src/nodes/accessors/ModelNode.js +100 -5
- package/src/nodes/accessors/ModelViewProjectionNode.js +10 -38
- package/src/nodes/accessors/MorphNode.js +48 -4
- package/src/nodes/accessors/Normal.js +59 -3
- package/src/nodes/accessors/Object3DNode.js +102 -1
- package/src/nodes/accessors/PointUVNode.js +26 -0
- package/src/nodes/accessors/Position.js +53 -4
- package/src/nodes/accessors/ReferenceBaseNode.js +188 -0
- package/src/nodes/accessors/ReferenceNode.js +202 -2
- package/src/nodes/accessors/ReflectVector.js +24 -0
- package/src/nodes/accessors/RendererReferenceNode.js +46 -1
- package/src/nodes/accessors/SceneNode.js +54 -0
- package/src/nodes/accessors/SkinningNode.js +127 -1
- package/src/nodes/accessors/StorageBufferNode.js +168 -4
- package/src/nodes/accessors/StorageTextureNode.js +118 -0
- package/src/nodes/accessors/Tangent.js +36 -0
- package/src/nodes/accessors/Texture3DNode.js +89 -5
- package/src/nodes/accessors/TextureBicubic.js +12 -2
- package/src/nodes/accessors/TextureNode.js +309 -10
- package/src/nodes/accessors/TextureSizeNode.js +42 -0
- package/src/nodes/accessors/UV.js +10 -1
- package/src/nodes/accessors/UniformArrayNode.js +223 -23
- package/src/nodes/accessors/UserDataNode.js +46 -0
- package/src/nodes/accessors/VelocityNode.js +82 -0
- package/src/nodes/accessors/VertexColorNode.js +39 -2
- package/src/nodes/code/CodeNode.js +95 -1
- package/src/nodes/code/ExpressionNode.js +28 -0
- package/src/nodes/code/FunctionCallNode.js +37 -0
- package/src/nodes/code/FunctionNode.js +45 -0
- package/src/nodes/code/ScriptableNode.js +223 -1
- package/src/nodes/code/ScriptableValueNode.js +85 -1
- package/src/nodes/core/AssignNode.js +48 -2
- package/src/nodes/core/AttributeNode.js +43 -0
- package/src/nodes/core/BypassNode.js +47 -2
- package/src/nodes/core/CacheNode.js +53 -2
- package/src/nodes/core/ConstNode.js +24 -0
- package/src/nodes/core/ContextNode.js +65 -0
- package/src/nodes/core/IndexNode.js +68 -7
- package/src/nodes/core/InputNode.js +48 -0
- package/src/nodes/core/LightingModel.js +60 -0
- package/src/nodes/core/MRTNode.js +66 -0
- package/src/nodes/core/Node.js +337 -12
- package/src/nodes/core/NodeAttribute.js +38 -0
- package/src/nodes/core/NodeBuilder.js +945 -15
- package/src/nodes/core/NodeCache.js +41 -2
- package/src/nodes/core/NodeCode.js +31 -0
- package/src/nodes/core/NodeFrame.js +123 -2
- package/src/nodes/core/NodeFunction.js +46 -0
- package/src/nodes/core/NodeFunctionInput.js +44 -0
- package/src/nodes/core/NodeParser.js +11 -0
- package/src/nodes/core/NodeUniform.js +52 -0
- package/src/nodes/core/NodeUtils.js +141 -0
- package/src/nodes/core/NodeVar.js +30 -0
- package/src/nodes/core/NodeVarying.js +28 -0
- package/src/nodes/core/OutputStructNode.js +33 -2
- package/src/nodes/core/ParameterNode.js +28 -0
- package/src/nodes/core/PropertyNode.js +232 -0
- package/src/nodes/core/StackNode.js +78 -0
- package/src/nodes/core/StructTypeNode.js +39 -1
- package/src/nodes/core/TempNode.js +30 -4
- package/src/nodes/core/UniformGroupNode.js +82 -7
- package/src/nodes/core/UniformNode.js +66 -0
- package/src/nodes/core/VarNode.js +52 -0
- package/src/nodes/core/VaryingNode.js +83 -2
- package/src/nodes/core/constants.js +36 -0
- package/src/nodes/display/BumpMapNode.js +37 -0
- package/src/nodes/display/ColorAdjustment.js +53 -11
- package/src/nodes/display/ColorSpaceFunctions.js +16 -0
- package/src/nodes/display/ColorSpaceNode.js +82 -0
- package/src/nodes/display/FrontFacingNode.js +29 -0
- package/src/nodes/display/NormalMapNode.js +43 -0
- package/src/nodes/display/PassNode.js +298 -7
- package/src/nodes/display/PosterizeNode.js +33 -0
- package/src/nodes/display/RenderOutputNode.js +66 -1
- package/src/nodes/display/ScreenNode.js +87 -0
- package/src/nodes/display/ToneMappingFunctions.js +58 -10
- package/src/nodes/display/ToneMappingNode.js +55 -2
- package/src/nodes/display/ToonOutlinePassNode.js +73 -0
- package/src/nodes/display/ViewportDepthNode.js +122 -8
- package/src/nodes/display/ViewportDepthTextureNode.js +23 -0
- package/src/nodes/display/ViewportSharedTextureNode.js +23 -0
- package/src/nodes/display/ViewportTextureNode.js +57 -0
- package/src/nodes/fog/Fog.js +93 -0
- package/src/nodes/functions/BasicLightingModel.js +24 -0
- package/src/nodes/functions/PhongLightingModel.js +34 -2
- package/src/nodes/functions/PhysicalLightingModel.js +167 -8
- package/src/nodes/functions/ShadowMaskModel.js +23 -0
- package/src/nodes/functions/ToonLightingModel.js +20 -0
- package/src/nodes/functions/material/getAlphaHashThreshold.js +1 -3
- package/src/nodes/functions/material/getParallaxCorrectNormal.js +16 -1
- package/src/nodes/geometry/RangeNode.js +54 -2
- package/src/nodes/gpgpu/AtomicFunctionNode.js +157 -1
- package/src/nodes/gpgpu/BarrierNode.js +47 -0
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +126 -0
- package/src/nodes/gpgpu/ComputeNode.js +106 -2
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +115 -6
- package/src/nodes/lighting/AONode.js +18 -0
- package/src/nodes/lighting/AmbientLightNode.js +10 -0
- package/src/nodes/lighting/AnalyticLightNode.js +97 -2
- package/src/nodes/lighting/BasicEnvironmentNode.js +19 -0
- package/src/nodes/lighting/BasicLightMapNode.js +17 -0
- package/src/nodes/lighting/DirectionalLightNode.js +10 -0
- package/src/nodes/lighting/EnvironmentNode.js +18 -0
- package/src/nodes/lighting/HemisphereLightNode.js +31 -0
- package/src/nodes/lighting/IESSpotLightNode.js +11 -0
- package/src/nodes/lighting/IrradianceNode.js +17 -0
- package/src/nodes/lighting/LightProbeNode.js +20 -0
- package/src/nodes/lighting/LightUtils.js +12 -0
- package/src/nodes/lighting/LightingContextNode.js +48 -0
- package/src/nodes/lighting/LightingNode.js +15 -6
- package/src/nodes/lighting/LightsNode.js +132 -1
- package/src/nodes/lighting/PointLightNode.js +32 -1
- package/src/nodes/lighting/PointShadowNode.js +54 -1
- package/src/nodes/lighting/RectAreaLightNode.js +44 -6
- package/src/nodes/lighting/ShadowBaseNode.js +93 -0
- package/src/nodes/lighting/ShadowNode.js +240 -34
- package/src/nodes/lighting/SpotLightNode.js +43 -0
- package/src/nodes/math/ConditionalNode.js +70 -3
- package/src/nodes/math/Hash.js +9 -0
- package/src/nodes/math/MathNode.js +614 -11
- package/src/nodes/math/MathUtils.js +45 -1
- package/src/nodes/math/OperatorNode.js +233 -0
- package/src/nodes/math/TriNoise3D.js +18 -7
- package/src/nodes/parsers/GLSLNodeFunction.js +16 -0
- package/src/nodes/parsers/GLSLNodeParser.js +11 -0
- package/src/nodes/pmrem/PMREMNode.js +133 -0
- package/src/nodes/pmrem/PMREMUtils.js +1 -1
- package/src/nodes/procedural/Checker.js +9 -0
- package/src/nodes/tsl/TSLBase.js +2 -2
- package/src/nodes/utils/ArrayElementNode.js +38 -2
- package/src/nodes/utils/ConvertNode.js +31 -0
- package/src/nodes/utils/CubeMapNode.js +78 -0
- package/src/nodes/utils/Discard.js +16 -0
- package/src/nodes/utils/EquirectUVNode.js +31 -1
- package/src/nodes/utils/FlipNode.js +38 -0
- package/src/nodes/utils/FunctionOverloadingNode.js +53 -1
- package/src/nodes/utils/JoinNode.js +25 -0
- package/src/nodes/utils/LoopNode.js +74 -1
- package/src/nodes/utils/MatcapUVNode.js +17 -0
- package/src/nodes/utils/MaxMipLevelNode.js +49 -0
- package/src/nodes/utils/Oscillators.js +33 -0
- package/src/nodes/utils/Packing.js +17 -0
- package/src/nodes/utils/PostProcessingUtils.js +28 -23
- package/src/nodes/utils/RTTNode.js +123 -2
- package/src/nodes/utils/ReflectorNode.js +174 -4
- package/src/nodes/utils/RemapNode.js +79 -0
- package/src/nodes/utils/RotateNode.js +41 -0
- package/src/nodes/utils/SetNode.js +44 -1
- package/src/nodes/utils/SplitNode.js +55 -3
- package/src/nodes/utils/SpriteSheetUVNode.js +46 -0
- package/src/nodes/utils/SpriteUtils.js +17 -0
- package/src/nodes/utils/StorageArrayElementNode.js +40 -0
- package/src/nodes/utils/Timer.js +19 -0
- package/src/nodes/utils/TriplanarTexturesNode.js +84 -0
- package/src/nodes/utils/UVUtils.js +20 -0
- package/src/nodes/utils/ViewportUtils.js +13 -0
- package/src/objects/BatchedMesh.js +1 -2
- package/src/objects/ClippingGroup.js +49 -0
- package/src/renderers/WebGLRenderer.js +23 -4
- package/src/renderers/common/Animation.js +63 -0
- package/src/renderers/common/Attributes.js +36 -0
- package/src/renderers/common/Backend.js +467 -52
- package/src/renderers/common/Background.js +34 -1
- package/src/renderers/common/BindGroup.js +43 -0
- package/src/renderers/common/Binding.js +35 -0
- package/src/renderers/common/Bindings.js +93 -1
- package/src/renderers/common/Buffer.js +49 -0
- package/src/renderers/common/BufferUtils.js +27 -0
- package/src/renderers/common/BundleGroup.js +57 -0
- package/src/renderers/common/ChainMap.js +38 -1
- package/src/renderers/common/ClippingContext.js +107 -14
- package/src/renderers/common/Color4.js +36 -0
- package/src/renderers/common/ComputePipeline.js +24 -0
- package/src/renderers/common/CubeRenderTarget.js +13 -0
- package/src/renderers/common/DataMap.js +37 -1
- package/src/renderers/common/Geometries.js +98 -0
- package/src/renderers/common/IndirectStorageBufferAttribute.js +25 -2
- package/src/renderers/common/Info.js +87 -0
- package/src/renderers/common/Lighting.js +26 -0
- package/src/renderers/common/Pipeline.js +22 -0
- package/src/renderers/common/Pipelines.js +148 -5
- package/src/renderers/common/PostProcessing.js +75 -3
- package/src/renderers/common/ProgrammableStage.js +60 -2
- package/src/renderers/common/QuadMesh.js +54 -5
- package/src/renderers/common/RenderBundle.js +14 -8
- package/src/renderers/common/RenderBundles.js +33 -10
- package/src/renderers/common/RenderContext.js +169 -4
- package/src/renderers/common/RenderContexts.js +42 -2
- package/src/renderers/common/RenderList.js +178 -0
- package/src/renderers/common/RenderLists.js +31 -0
- package/src/renderers/common/RenderObject.js +328 -4
- package/src/renderers/common/RenderObjects.js +101 -7
- package/src/renderers/common/RenderPipeline.js +24 -0
- package/src/renderers/common/Renderer.js +1096 -31
- package/src/renderers/common/RendererUtils.js +193 -0
- package/src/renderers/common/SampledTexture.js +121 -0
- package/src/renderers/common/Sampler.js +30 -0
- package/src/renderers/common/StorageBuffer.js +24 -0
- package/src/renderers/common/StorageBufferAttribute.js +31 -2
- package/src/renderers/common/StorageInstancedBufferAttribute.js +31 -2
- package/src/renderers/common/StorageTexture.js +38 -0
- package/src/renderers/common/Textures.js +83 -0
- package/src/renderers/common/Uniform.js +188 -2
- package/src/renderers/common/UniformBuffer.js +19 -0
- package/src/renderers/common/UniformsGroup.js +139 -2
- package/src/renderers/common/extras/PMREMGenerator.js +24 -3
- package/src/renderers/common/nodes/NodeBuilderState.js +95 -1
- package/src/renderers/common/nodes/NodeLibrary.js +89 -0
- package/src/renderers/common/nodes/NodeSampledTexture.js +91 -2
- package/src/renderers/common/nodes/NodeSampler.js +28 -0
- package/src/renderers/common/nodes/NodeStorageBuffer.js +35 -0
- package/src/renderers/common/nodes/NodeUniform.js +189 -0
- package/src/renderers/common/nodes/NodeUniformBuffer.js +29 -0
- package/src/renderers/common/nodes/NodeUniformsGroup.js +31 -18
- package/src/renderers/common/nodes/Nodes.js +327 -60
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +7 -7
- package/src/renderers/webgl-fallback/WebGLBackend.js +547 -29
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +0 -1
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +1 -1
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +1 -1
- package/src/renderers/webgpu/WebGPUBackend.js +480 -49
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +34 -0
- package/src/renderers/webgpu/WebGPURenderer.js +35 -0
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +20 -8
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +21 -8
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +59 -11
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +17 -0
- package/src/renderers/webgpu/nodes/WGSLNodeParser.js +11 -0
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +10 -8
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +9 -1
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +5 -9
- package/src/renderers/webgpu/utils/WebGPUUtils.js +30 -0
- package/src/renderers/webxr/WebXRDepthSensing.js +1 -1
- package/src/renderers/webxr/WebXRManager.js +7 -1
- package/src/textures/Data3DTexture.js +2 -2
- package/src/textures/Texture.js +4 -0
- package/examples/jsm/animation/MMDAnimationHelper.js +0 -1209
- package/examples/jsm/animation/MMDPhysics.js +0 -1408
- package/examples/jsm/exporters/MMDExporter.js +0 -223
- package/examples/jsm/libs/mmdparser.module.js +0 -11530
- package/examples/jsm/loaders/MMDLoader.js +0 -2298
- package/examples/jsm/shaders/MMDToonShader.js +0 -134
- package/src/nodes/core/UniformGroup.js +0 -13
- package/src/nodes/fog/FogExp2Node.js +0 -35
- package/src/nodes/fog/FogNode.js +0 -50
- package/src/nodes/fog/FogRangeNode.js +0 -36
- package/src/renderers/common/PostProcessingUtils.js +0 -86
package/examples/jsm/Addons.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export * from './animation/AnimationClipCreator.js';
|
|
2
2
|
export * from './animation/CCDIKSolver.js';
|
|
3
|
-
export * from './animation/MMDAnimationHelper.js';
|
|
4
|
-
export * from './animation/MMDPhysics.js';
|
|
5
3
|
|
|
6
4
|
export { default as WebGL } from './capabilities/WebGL.js';
|
|
7
5
|
|
|
@@ -40,7 +38,6 @@ export * from './exporters/DRACOExporter.js';
|
|
|
40
38
|
export * from './exporters/EXRExporter.js';
|
|
41
39
|
export * from './exporters/GLTFExporter.js';
|
|
42
40
|
export * from './exporters/KTX2Exporter.js';
|
|
43
|
-
export * from './exporters/MMDExporter.js';
|
|
44
41
|
export * from './exporters/OBJExporter.js';
|
|
45
42
|
export * from './exporters/PLYExporter.js';
|
|
46
43
|
export * from './exporters/STLExporter.js';
|
|
@@ -105,7 +102,6 @@ export * from './loaders/LWOLoader.js';
|
|
|
105
102
|
export * from './loaders/LottieLoader.js';
|
|
106
103
|
export * from './loaders/MD2Loader.js';
|
|
107
104
|
export * from './loaders/MDDLoader.js';
|
|
108
|
-
export * from './loaders/MMDLoader.js';
|
|
109
105
|
export * from './loaders/MTLLoader.js';
|
|
110
106
|
export * from './loaders/NRRDLoader.js';
|
|
111
107
|
export * from './loaders/OBJLoader.js';
|
|
@@ -240,7 +236,6 @@ export * from './shaders/HueSaturationShader.js';
|
|
|
240
236
|
export * from './shaders/KaleidoShader.js';
|
|
241
237
|
export * from './shaders/LuminosityHighPassShader.js';
|
|
242
238
|
export * from './shaders/LuminosityShader.js';
|
|
243
|
-
export * from './shaders/MMDToonShader.js';
|
|
244
239
|
export * from './shaders/MirrorShader.js';
|
|
245
240
|
export * from './shaders/NormalMapShader.js';
|
|
246
241
|
export * from './shaders/OutputShader.js';
|
|
@@ -111,8 +111,7 @@ class CCDIKSolver {
|
|
|
111
111
|
|
|
112
112
|
const link = bones[ links[ j ].index ];
|
|
113
113
|
|
|
114
|
-
// skip this link and following links
|
|
115
|
-
// this skip is used for MMD performance optimization.
|
|
114
|
+
// skip this link and following links
|
|
116
115
|
if ( links[ j ].enabled === false ) break;
|
|
117
116
|
|
|
118
117
|
const limitation = links[ j ].limitation;
|
|
@@ -331,6 +330,8 @@ class CCDIKHelper extends Object3D {
|
|
|
331
330
|
|
|
332
331
|
/**
|
|
333
332
|
* Updates IK bones visualization.
|
|
333
|
+
*
|
|
334
|
+
* @param {Boolean} force
|
|
334
335
|
*/
|
|
335
336
|
updateMatrixWorld( force ) {
|
|
336
337
|
|
|
@@ -1183,7 +1183,7 @@ class ArcballControls extends Controls {
|
|
|
1183
1183
|
* Remove a mouse action by specifying its mouse/key combination
|
|
1184
1184
|
* @param {*} mouse A mouse button (0, 1, 2) or 'WHEEL' for wheel notches
|
|
1185
1185
|
* @param {*} key The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed
|
|
1186
|
-
* @returns {Boolean} True if the operation has been
|
|
1186
|
+
* @returns {Boolean} True if the operation has been successfully removed, false otherwise
|
|
1187
1187
|
*/
|
|
1188
1188
|
unsetMouseAction( mouse, key = null ) {
|
|
1189
1189
|
|
|
@@ -1204,9 +1204,9 @@ class ArcballControls extends Controls {
|
|
|
1204
1204
|
|
|
1205
1205
|
/**
|
|
1206
1206
|
* Return the operation associated to a mouse/keyboard combination
|
|
1207
|
-
* @param {
|
|
1208
|
-
* @param {
|
|
1209
|
-
* @returns The operation if it has been found, null otherwise
|
|
1207
|
+
* @param {0|1|2|'WHEEL'} mouse Mouse button index (0, 1, 2) or 'WHEEL' for wheel notches
|
|
1208
|
+
* @param {'CTRL'|'SHIFT'|null} key Keyboard modifier
|
|
1209
|
+
* @returns {string|null} The operation if it has been found, null otherwise
|
|
1210
1210
|
*/
|
|
1211
1211
|
getOpFromAction( mouse, key ) {
|
|
1212
1212
|
|
|
@@ -1244,9 +1244,9 @@ class ArcballControls extends Controls {
|
|
|
1244
1244
|
|
|
1245
1245
|
/**
|
|
1246
1246
|
* Get the operation associated to mouse and key combination and returns the corresponding FSA state
|
|
1247
|
-
* @param {
|
|
1248
|
-
* @param {
|
|
1249
|
-
* @returns The FSA state obtained from the operation associated to mouse/keyboard combination
|
|
1247
|
+
* @param {0|1|2} mouse Mouse button index (0, 1, 2)
|
|
1248
|
+
* @param {'CTRL'|'SHIFT'|null} key Keyboard modifier
|
|
1249
|
+
* @returns {STATE|null} The FSA state obtained from the operation associated to mouse/keyboard combination
|
|
1250
1250
|
*/
|
|
1251
1251
|
getOpStateFromAction( mouse, key ) {
|
|
1252
1252
|
|
|
@@ -1402,10 +1402,12 @@ class ArcballControls extends Controls {
|
|
|
1402
1402
|
|
|
1403
1403
|
/**
|
|
1404
1404
|
* Calculate the angular speed
|
|
1405
|
+
*
|
|
1405
1406
|
* @param {Number} p0 Position at t0
|
|
1406
1407
|
* @param {Number} p1 Position at t1
|
|
1407
1408
|
* @param {Number} t0 Initial time in milliseconds
|
|
1408
1409
|
* @param {Number} t1 Ending time in milliseconds
|
|
1410
|
+
* @returns {Number}
|
|
1409
1411
|
*/
|
|
1410
1412
|
calculateAngularSpeed( p0, p1, t0, t1 ) {
|
|
1411
1413
|
|
|
@@ -1450,7 +1452,7 @@ class ArcballControls extends Controls {
|
|
|
1450
1452
|
}
|
|
1451
1453
|
|
|
1452
1454
|
/**
|
|
1453
|
-
* Calculate the trackball radius so that gizmo's
|
|
1455
|
+
* Calculate the trackball radius so that gizmo's diameter will be 2/3 of the minimum side of the camera frustum
|
|
1454
1456
|
* @param {Camera} camera
|
|
1455
1457
|
* @returns {Number} The trackball radius
|
|
1456
1458
|
*/
|
|
@@ -1627,8 +1629,9 @@ class ArcballControls extends Controls {
|
|
|
1627
1629
|
|
|
1628
1630
|
/**
|
|
1629
1631
|
* Calculate the cursor position in NDC
|
|
1630
|
-
*
|
|
1631
|
-
* @param {number}
|
|
1632
|
+
*
|
|
1633
|
+
* @param {number} cursorX Cursor horizontal coordinate within the canvas
|
|
1634
|
+
* @param {number} cursorY Cursor vertical coordinate within the canvas
|
|
1632
1635
|
* @param {HTMLElement} canvas The canvas where the renderer draws its output
|
|
1633
1636
|
* @returns {Vector2} Cursor normalized position inside the canvas
|
|
1634
1637
|
*/
|
|
@@ -1643,8 +1646,9 @@ class ArcballControls extends Controls {
|
|
|
1643
1646
|
|
|
1644
1647
|
/**
|
|
1645
1648
|
* Calculate the cursor position inside the canvas x/y coordinates with the origin being in the center of the canvas
|
|
1646
|
-
*
|
|
1647
|
-
* @param {Number}
|
|
1649
|
+
*
|
|
1650
|
+
* @param {Number} cursorX Cursor horizontal coordinate within the canvas
|
|
1651
|
+
* @param {Number} cursorY Cursor vertical coordinate within the canvas
|
|
1648
1652
|
* @param {HTMLElement} canvas The canvas where the renderer draws its output
|
|
1649
1653
|
* @returns {Vector2} Cursor position inside the canvas
|
|
1650
1654
|
*/
|
|
@@ -1940,9 +1944,11 @@ class ArcballControls extends Controls {
|
|
|
1940
1944
|
|
|
1941
1945
|
/**
|
|
1942
1946
|
* Perform pan operation moving camera between two points
|
|
1947
|
+
*
|
|
1943
1948
|
* @param {Vector3} p0 Initial point
|
|
1944
1949
|
* @param {Vector3} p1 Ending point
|
|
1945
|
-
* @param {Boolean} adjust If movement should be adjusted considering camera distance (Perspective only)
|
|
1950
|
+
* @param {Boolean} [adjust=false] If movement should be adjusted considering camera distance (Perspective only)
|
|
1951
|
+
* @returns {Object}
|
|
1946
1952
|
*/
|
|
1947
1953
|
pan( p0, p1, adjust = false ) {
|
|
1948
1954
|
|
|
@@ -2219,7 +2225,7 @@ class ArcballControls extends Controls {
|
|
|
2219
2225
|
|
|
2220
2226
|
/**
|
|
2221
2227
|
* Set camera fov
|
|
2222
|
-
* @param {Number} value fov to be
|
|
2228
|
+
* @param {Number} value fov to be set
|
|
2223
2229
|
*/
|
|
2224
2230
|
setFov( value ) {
|
|
2225
2231
|
|
|
@@ -2234,8 +2240,9 @@ class ArcballControls extends Controls {
|
|
|
2234
2240
|
|
|
2235
2241
|
/**
|
|
2236
2242
|
* Set values in transformation object
|
|
2237
|
-
*
|
|
2238
|
-
* @param {Matrix4}
|
|
2243
|
+
*
|
|
2244
|
+
* @param {Matrix4} [camera=null] Transformation to be applied to the camera
|
|
2245
|
+
* @param {Matrix4} [gizmos=null] Transformation to be applied to gizmos
|
|
2239
2246
|
*/
|
|
2240
2247
|
setTransformationMatrices( camera = null, gizmos = null ) {
|
|
2241
2248
|
|
|
@@ -2279,9 +2286,10 @@ class ArcballControls extends Controls {
|
|
|
2279
2286
|
|
|
2280
2287
|
/**
|
|
2281
2288
|
* Rotate camera around its direction axis passing by a given point by a given angle
|
|
2289
|
+
*
|
|
2282
2290
|
* @param {Vector3} point The point where the rotation axis is passing trough
|
|
2283
2291
|
* @param {Number} angle Angle in radians
|
|
2284
|
-
* @returns The computed
|
|
2292
|
+
* @returns {Object} The computed transformation matrix
|
|
2285
2293
|
*/
|
|
2286
2294
|
zRotate( point, angle ) {
|
|
2287
2295
|
|
|
@@ -2313,9 +2321,10 @@ class ArcballControls extends Controls {
|
|
|
2313
2321
|
|
|
2314
2322
|
/**
|
|
2315
2323
|
* Unproject the cursor on the 3D object surface
|
|
2324
|
+
*
|
|
2316
2325
|
* @param {Vector2} cursor Cursor coordinates in NDC
|
|
2317
2326
|
* @param {Camera} camera Virtual camera
|
|
2318
|
-
* @returns {Vector3} The point of intersection with the model, if exist, null otherwise
|
|
2327
|
+
* @returns {Vector3|null} The point of intersection with the model, if exist, null otherwise
|
|
2319
2328
|
*/
|
|
2320
2329
|
unprojectOnObj( cursor, camera ) {
|
|
2321
2330
|
|
|
@@ -2576,7 +2585,7 @@ class ArcballControls extends Controls {
|
|
|
2576
2585
|
/**
|
|
2577
2586
|
* Update the trackball FSA
|
|
2578
2587
|
* @param {STATE} newState New state of the FSA
|
|
2579
|
-
* @param {Boolean} updateMatrices If
|
|
2588
|
+
* @param {Boolean} updateMatrices If matrices state should be updated
|
|
2580
2589
|
*/
|
|
2581
2590
|
updateTbState( newState, updateMatrices ) {
|
|
2582
2591
|
|
|
@@ -92,6 +92,7 @@ class OrbitControls extends Controls {
|
|
|
92
92
|
// Set to false to disable rotating
|
|
93
93
|
this.enableRotate = true;
|
|
94
94
|
this.rotateSpeed = 1.0;
|
|
95
|
+
this.keyRotateSpeed = 1.0;
|
|
95
96
|
|
|
96
97
|
// Set to false to disable panning
|
|
97
98
|
this.enablePan = true;
|
|
@@ -786,7 +787,7 @@ class OrbitControls extends Controls {
|
|
|
786
787
|
|
|
787
788
|
if ( this.enableRotate ) {
|
|
788
789
|
|
|
789
|
-
this._rotateUp( _twoPI * this.
|
|
790
|
+
this._rotateUp( _twoPI * this.keyRotateSpeed / this.domElement.clientHeight );
|
|
790
791
|
|
|
791
792
|
}
|
|
792
793
|
|
|
@@ -809,7 +810,7 @@ class OrbitControls extends Controls {
|
|
|
809
810
|
|
|
810
811
|
if ( this.enableRotate ) {
|
|
811
812
|
|
|
812
|
-
this._rotateUp( - _twoPI * this.
|
|
813
|
+
this._rotateUp( - _twoPI * this.keyRotateSpeed / this.domElement.clientHeight );
|
|
813
814
|
|
|
814
815
|
}
|
|
815
816
|
|
|
@@ -832,7 +833,7 @@ class OrbitControls extends Controls {
|
|
|
832
833
|
|
|
833
834
|
if ( this.enableRotate ) {
|
|
834
835
|
|
|
835
|
-
this._rotateLeft( _twoPI * this.
|
|
836
|
+
this._rotateLeft( _twoPI * this.keyRotateSpeed / this.domElement.clientHeight );
|
|
836
837
|
|
|
837
838
|
}
|
|
838
839
|
|
|
@@ -855,7 +856,7 @@ class OrbitControls extends Controls {
|
|
|
855
856
|
|
|
856
857
|
if ( this.enableRotate ) {
|
|
857
858
|
|
|
858
|
-
this._rotateLeft( - _twoPI * this.
|
|
859
|
+
this._rotateLeft( - _twoPI * this.keyRotateSpeed / this.domElement.clientHeight );
|
|
859
860
|
|
|
860
861
|
}
|
|
861
862
|
|
|
@@ -6,8 +6,7 @@ import {
|
|
|
6
6
|
Box3,
|
|
7
7
|
Object3D,
|
|
8
8
|
WebGLCoordinateSystem,
|
|
9
|
-
|
|
10
|
-
Node
|
|
9
|
+
ShadowBaseNode
|
|
11
10
|
} from 'three/webgpu';
|
|
12
11
|
|
|
13
12
|
import { CSMFrustum } from './CSMFrustum.js';
|
|
@@ -36,13 +35,12 @@ class LwLight extends Object3D {
|
|
|
36
35
|
|
|
37
36
|
}
|
|
38
37
|
|
|
39
|
-
class CSMShadowNode extends
|
|
38
|
+
class CSMShadowNode extends ShadowBaseNode {
|
|
40
39
|
|
|
41
40
|
constructor( light, data = {} ) {
|
|
42
41
|
|
|
43
|
-
super();
|
|
42
|
+
super( light );
|
|
44
43
|
|
|
45
|
-
this.light = light;
|
|
46
44
|
this.camera = null;
|
|
47
45
|
this.cascades = data.cascades || 3;
|
|
48
46
|
this.maxFar = data.maxFar || 100000;
|
|
@@ -57,7 +55,6 @@ class CSMShadowNode extends Node {
|
|
|
57
55
|
this._cascades = [];
|
|
58
56
|
this.mainFrustum = null;
|
|
59
57
|
this.frustums = [];
|
|
60
|
-
this.updateBeforeType = NodeUpdateType.FRAME;
|
|
61
58
|
|
|
62
59
|
this.lights = [];
|
|
63
60
|
|
|
@@ -78,6 +75,8 @@ class CSMShadowNode extends Node {
|
|
|
78
75
|
for ( let i = 0; i < this.cascades; i ++ ) {
|
|
79
76
|
|
|
80
77
|
const lwLight = new LwLight();
|
|
78
|
+
lwLight.castShadow = true;
|
|
79
|
+
|
|
81
80
|
const lShadow = light.shadow.clone();
|
|
82
81
|
lShadow.bias = lShadow.bias * ( i + 1 );
|
|
83
82
|
|
|
@@ -256,7 +255,7 @@ class CSMShadowNode extends Node {
|
|
|
256
255
|
setupFade() {
|
|
257
256
|
|
|
258
257
|
const cameraNear = reference( 'camera.near', 'float', this ).setGroup( renderGroup );
|
|
259
|
-
const cascades = reference( '_cascades', 'vec2', this ).setGroup( renderGroup ).label( '
|
|
258
|
+
const cascades = reference( '_cascades', 'vec2', this ).setGroup( renderGroup ).label( 'cascades' );
|
|
260
259
|
|
|
261
260
|
const shadowFar = uniform( 'float' ).setGroup( renderGroup ).label( 'shadowFar' )
|
|
262
261
|
.onRenderUpdate( () => Math.min( this.maxFar, this.camera.far ) );
|
|
@@ -264,7 +263,9 @@ class CSMShadowNode extends Node {
|
|
|
264
263
|
const linearDepth = viewZToOrthographicDepth( positionView.z, cameraNear, shadowFar ).toVar( 'linearDepth' );
|
|
265
264
|
const lastCascade = this.cascades - 1;
|
|
266
265
|
|
|
267
|
-
return Fn( () => {
|
|
266
|
+
return Fn( ( builder ) => {
|
|
267
|
+
|
|
268
|
+
this.setupShadowPosition( builder );
|
|
268
269
|
|
|
269
270
|
const ret = vec4( 1, 1, 1, 1 ).toVar( 'shadowValue' );
|
|
270
271
|
|
|
@@ -310,7 +311,7 @@ class CSMShadowNode extends Node {
|
|
|
310
311
|
|
|
311
312
|
if ( i === 0 ) {
|
|
312
313
|
|
|
313
|
-
//
|
|
314
|
+
// don't fade at nearest edge
|
|
314
315
|
ratio = linearDepth.greaterThan( cascadeCenter ).select( ratio, 1 );
|
|
315
316
|
|
|
316
317
|
}
|
|
@@ -330,14 +331,16 @@ class CSMShadowNode extends Node {
|
|
|
330
331
|
setupStandard() {
|
|
331
332
|
|
|
332
333
|
const cameraNear = reference( 'camera.near', 'float', this ).setGroup( renderGroup );
|
|
333
|
-
const cascades = reference( '_cascades', 'vec2', this ).setGroup( renderGroup ).label( '
|
|
334
|
+
const cascades = reference( '_cascades', 'vec2', this ).setGroup( renderGroup ).label( 'cascades' );
|
|
334
335
|
|
|
335
336
|
const shadowFar = uniform( 'float' ).setGroup( renderGroup ).label( 'shadowFar' )
|
|
336
337
|
.onRenderUpdate( () => Math.min( this.maxFar, this.camera.far ) );
|
|
337
338
|
|
|
338
339
|
const linearDepth = viewZToOrthographicDepth( positionView.z, cameraNear, shadowFar ).toVar( 'linearDepth' );
|
|
339
340
|
|
|
340
|
-
return Fn( () => {
|
|
341
|
+
return Fn( ( builder ) => {
|
|
342
|
+
|
|
343
|
+
this.setupShadowPosition( builder );
|
|
341
344
|
|
|
342
345
|
const ret = vec4( 1, 1, 1, 1 ).toVar( 'shadowValue' );
|
|
343
346
|
const cascade = vec2().toVar( 'cascade' );
|
|
@@ -430,6 +433,8 @@ class CSMShadowNode extends Node {
|
|
|
430
433
|
|
|
431
434
|
}
|
|
432
435
|
|
|
436
|
+
super.dispose();
|
|
437
|
+
|
|
433
438
|
}
|
|
434
439
|
|
|
435
440
|
}
|
|
@@ -513,13 +513,16 @@ function calcVolumePoint( p, q, r, U, V, W, P, u, v, w, target ) {
|
|
|
513
513
|
}
|
|
514
514
|
|
|
515
515
|
}
|
|
516
|
+
|
|
516
517
|
const Sw = new Vector4( 0, 0, 0, 0 );
|
|
517
518
|
for ( let m = 0; m <= r; ++ m ) {
|
|
519
|
+
|
|
518
520
|
for ( let l = 0; l <= q; ++ l ) {
|
|
519
521
|
|
|
520
522
|
Sw.add( temp[ m ][ l ].multiplyScalar( Nw[ m ] ).multiplyScalar( Nv[ l ] ) );
|
|
521
523
|
|
|
522
524
|
}
|
|
525
|
+
|
|
523
526
|
}
|
|
524
527
|
|
|
525
528
|
Sw.divideScalar( Sw.w );
|
|
@@ -190,7 +190,8 @@ class GLTFExporter {
|
|
|
190
190
|
|
|
191
191
|
/**
|
|
192
192
|
* Parse scenes and generate GLTF output
|
|
193
|
-
*
|
|
193
|
+
*
|
|
194
|
+
* @param {Scene|THREE.Scenes} input Scene or Array of THREE.Scenes
|
|
194
195
|
* @param {Function} onDone Callback on completed
|
|
195
196
|
* @param {Function} onError Callback on errors
|
|
196
197
|
* @param {Object} options options
|
|
@@ -543,9 +544,10 @@ class GLTFWriter {
|
|
|
543
544
|
|
|
544
545
|
/**
|
|
545
546
|
* Parse scenes and generate GLTF output
|
|
546
|
-
*
|
|
547
|
-
* @param
|
|
548
|
-
* @param
|
|
547
|
+
*
|
|
548
|
+
* @param {Scene|THREE.Scenes} input Scene or Array of THREE.Scenes
|
|
549
|
+
* @param {Function} onDone Callback on completed
|
|
550
|
+
* @param {Object} options options
|
|
549
551
|
*/
|
|
550
552
|
async writeAsync( input, onDone, options = {} ) {
|
|
551
553
|
|
|
@@ -709,7 +711,9 @@ class GLTFWriter {
|
|
|
709
711
|
|
|
710
712
|
/**
|
|
711
713
|
* Returns ids for buffer attributes.
|
|
712
|
-
*
|
|
714
|
+
*
|
|
715
|
+
* @param {Object} attribute
|
|
716
|
+
* @param {boolean} [isRelativeCopy=false]
|
|
713
717
|
* @return {Integer}
|
|
714
718
|
*/
|
|
715
719
|
getUID( attribute, isRelativeCopy = false ) {
|
|
@@ -2262,7 +2266,7 @@ class GLTFWriter {
|
|
|
2262
2266
|
|
|
2263
2267
|
/**
|
|
2264
2268
|
* Process Object3D node
|
|
2265
|
-
* @param {THREE.Object3D}
|
|
2269
|
+
* @param {THREE.Object3D} object Object3D to processNodeAsync
|
|
2266
2270
|
* @return {Integer} Index of the node in the nodes list
|
|
2267
2271
|
*/
|
|
2268
2272
|
async processNodeAsync( object ) {
|
|
@@ -2370,7 +2374,7 @@ class GLTFWriter {
|
|
|
2370
2374
|
|
|
2371
2375
|
/**
|
|
2372
2376
|
* Process Scene
|
|
2373
|
-
* @param {Scene}
|
|
2377
|
+
* @param {Scene} scene Scene to process
|
|
2374
2378
|
*/
|
|
2375
2379
|
async processSceneAsync( scene ) {
|
|
2376
2380
|
|
|
@@ -120,7 +120,7 @@ const KHR_DF_CHANNEL_SAMPLE_LOWER_UPPER = {
|
|
|
120
120
|
[ HalfFloatType ]: [ 0xbf800000, 0x3f800000 ],
|
|
121
121
|
[ UnsignedByteType ]: [ 0, 255 ],
|
|
122
122
|
|
|
123
|
-
}
|
|
123
|
+
};
|
|
124
124
|
|
|
125
125
|
const ERROR_INPUT = 'THREE.KTX2Exporter: Supported inputs are DataTexture, Data3DTexture, or WebGLRenderer and WebGLRenderTarget.';
|
|
126
126
|
const ERROR_FORMAT = 'THREE.KTX2Exporter: Supported formats are RGBAFormat, RGFormat, or RedFormat.';
|
|
@@ -124,7 +124,7 @@ class PLYExporter {
|
|
|
124
124
|
if ( includeIndices && faceCount !== Math.floor( faceCount ) ) {
|
|
125
125
|
|
|
126
126
|
// point cloud meshes will not have an index array and may not have a
|
|
127
|
-
// number of vertices that is
|
|
127
|
+
// number of vertices that is divisible by 3 (and therefore representable
|
|
128
128
|
// as triangles)
|
|
129
129
|
console.error(
|
|
130
130
|
|
|
@@ -206,7 +206,7 @@ class PLYExporter {
|
|
|
206
206
|
// 2 uv values at 4 bytes
|
|
207
207
|
const vertexListLength = vertexCount * ( 4 * 3 + ( includeNormals ? 4 * 3 : 0 ) + ( includeColors ? 3 : 0 ) + ( includeUVs ? 4 * 2 : 0 ) );
|
|
208
208
|
|
|
209
|
-
// 1 byte shape
|
|
209
|
+
// 1 byte shape descriptor
|
|
210
210
|
// 3 vertex indices at ${indexByteCount} bytes
|
|
211
211
|
const faceListLength = includeIndices ? faceCount * ( indexByteCount * 3 + 1 ) : 0;
|
|
212
212
|
const output = new DataView( new ArrayBuffer( headerBin.length + vertexListLength + faceListLength ) );
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
|
+
NodeMaterial,
|
|
2
3
|
BoxGeometry,
|
|
3
4
|
BufferAttribute,
|
|
4
5
|
Mesh,
|
|
5
6
|
PlaneGeometry,
|
|
7
|
+
DoubleSide,
|
|
6
8
|
Vector3,
|
|
7
9
|
} from 'three';
|
|
8
|
-
import {
|
|
10
|
+
import { texture as textureNode, cubeTexture, texture3D, float, vec4, attribute } from 'three/tsl';
|
|
9
11
|
import { mergeGeometries } from '../utils/BufferGeometryUtils.js';
|
|
10
12
|
|
|
11
13
|
class TextureHelper extends Mesh {
|
|
@@ -13,17 +15,25 @@ class TextureHelper extends Mesh {
|
|
|
13
15
|
constructor( texture, width = 1, height = 1, depth = 1 ) {
|
|
14
16
|
|
|
15
17
|
const material = new NodeMaterial();
|
|
18
|
+
material.side = DoubleSide;
|
|
19
|
+
material.transparent = true;
|
|
16
20
|
material.name = 'TextureHelper';
|
|
17
21
|
|
|
18
22
|
let colorNode;
|
|
19
23
|
|
|
24
|
+
const uvw = attribute( 'uvw' );
|
|
25
|
+
|
|
20
26
|
if ( texture.isCubeTexture ) {
|
|
21
27
|
|
|
22
|
-
colorNode = cubeTexture( texture );
|
|
28
|
+
colorNode = cubeTexture( texture ).sample( uvw );
|
|
23
29
|
|
|
24
30
|
} else if ( texture.isData3DTexture || texture.isCompressed3DTexture ) {
|
|
25
31
|
|
|
26
|
-
colorNode = texture3D( texture );
|
|
32
|
+
colorNode = texture3D( texture ).sample( uvw );
|
|
33
|
+
|
|
34
|
+
} else if ( texture.isDataArrayTexture || texture.isCompressedArrayTexture ) {
|
|
35
|
+
|
|
36
|
+
colorNode = textureNode( texture ).sample( uvw.xy ).depth( uvw.z );
|
|
27
37
|
|
|
28
38
|
} else {
|
|
29
39
|
|
|
@@ -122,7 +132,7 @@ function createCubeGeometry( width, height, depth ) {
|
|
|
122
132
|
}
|
|
123
133
|
|
|
124
134
|
geometry.deleteAttribute( 'uv' );
|
|
125
|
-
geometry.setAttribute( '
|
|
135
|
+
geometry.setAttribute( 'uvw', uvw );
|
|
126
136
|
|
|
127
137
|
return geometry;
|
|
128
138
|
|
|
@@ -162,7 +172,7 @@ function createSliceGeometry( texture, width, height, depth ) {
|
|
|
162
172
|
}
|
|
163
173
|
|
|
164
174
|
geometry.deleteAttribute( 'uv' );
|
|
165
|
-
geometry.setAttribute( '
|
|
175
|
+
geometry.setAttribute( 'uvw', uvw );
|
|
166
176
|
|
|
167
177
|
geometries.push( geometry );
|
|
168
178
|
|
|
@@ -99,7 +99,7 @@ class LightProbeGenerator {
|
|
|
99
99
|
// evaluate SH basis functions in direction dir
|
|
100
100
|
SphericalHarmonics3.getBasisAt( dir, shBasis );
|
|
101
101
|
|
|
102
|
-
//
|
|
102
|
+
// accumulate
|
|
103
103
|
for ( let j = 0; j < 9; j ++ ) {
|
|
104
104
|
|
|
105
105
|
shCoefficients[ j ].x += shBasis[ j ] * color.r * weight;
|
|
@@ -129,7 +129,7 @@ class LightProbeGenerator {
|
|
|
129
129
|
|
|
130
130
|
static async fromCubeRenderTarget( renderer, cubeRenderTarget ) {
|
|
131
131
|
|
|
132
|
-
const flip = renderer.coordinateSystem === WebGLCoordinateSystem ? -1 : 1;
|
|
132
|
+
const flip = renderer.coordinateSystem === WebGLCoordinateSystem ? - 1 : 1;
|
|
133
133
|
|
|
134
134
|
// The renderTarget must be set to RGBA in order to make readRenderTargetPixels works
|
|
135
135
|
let totalWeight = 0;
|
|
@@ -242,7 +242,7 @@ class LightProbeGenerator {
|
|
|
242
242
|
// evaluate SH basis functions in direction dir
|
|
243
243
|
SphericalHarmonics3.getBasisAt( dir, shBasis );
|
|
244
244
|
|
|
245
|
-
//
|
|
245
|
+
// accumulate
|
|
246
246
|
for ( let j = 0; j < 9; j ++ ) {
|
|
247
247
|
|
|
248
248
|
shCoefficients[ j ].x += shBasis[ j ] * color.r * weight;
|
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
Sphere,
|
|
10
10
|
Vector3,
|
|
11
11
|
Vector4,
|
|
12
|
-
Line2NodeMaterial
|
|
12
|
+
Line2NodeMaterial,
|
|
13
|
+
Vector2
|
|
13
14
|
} from 'three/webgpu';
|
|
14
|
-
|
|
15
15
|
import { LineSegmentsGeometry } from '../../lines/LineSegmentsGeometry.js';
|
|
16
16
|
|
|
17
17
|
const _start = new Vector3();
|
|
@@ -29,6 +29,7 @@ const _closestPoint = new Vector3();
|
|
|
29
29
|
const _box = new Box3();
|
|
30
30
|
const _sphere = new Sphere();
|
|
31
31
|
const _clipToWorldVector = new Vector4();
|
|
32
|
+
const _viewport = new Vector4();
|
|
32
33
|
|
|
33
34
|
let _ray, _lineWidth;
|
|
34
35
|
|
|
@@ -93,8 +94,7 @@ function raycastWorldUnits( lineSegments, intersects ) {
|
|
|
93
94
|
function raycastScreenSpace( lineSegments, camera, intersects ) {
|
|
94
95
|
|
|
95
96
|
const projectionMatrix = camera.projectionMatrix;
|
|
96
|
-
const
|
|
97
|
-
const resolution = material.resolution;
|
|
97
|
+
const resolution = lineSegments.resolution;
|
|
98
98
|
const matrixWorld = lineSegments.matrixWorld;
|
|
99
99
|
|
|
100
100
|
const geometry = lineSegments.geometry;
|
|
@@ -233,6 +233,8 @@ class LineSegments2 extends Mesh {
|
|
|
233
233
|
|
|
234
234
|
this.type = 'LineSegments2';
|
|
235
235
|
|
|
236
|
+
this.resolution = new Vector2();
|
|
237
|
+
|
|
236
238
|
}
|
|
237
239
|
|
|
238
240
|
// for backwards-compatibility, but could be a method of LineSegmentsGeometry...
|
|
@@ -264,6 +266,13 @@ class LineSegments2 extends Mesh {
|
|
|
264
266
|
|
|
265
267
|
}
|
|
266
268
|
|
|
269
|
+
onBeforeRender( renderer ) {
|
|
270
|
+
|
|
271
|
+
renderer.getViewport( _viewport );
|
|
272
|
+
this.resolution.set( _viewport.z, _viewport.w );
|
|
273
|
+
|
|
274
|
+
}
|
|
275
|
+
|
|
267
276
|
raycast( raycaster, intersects ) {
|
|
268
277
|
|
|
269
278
|
const worldUnits = this.material.worldUnits;
|
|
@@ -303,7 +312,7 @@ class LineSegments2 extends Mesh {
|
|
|
303
312
|
} else {
|
|
304
313
|
|
|
305
314
|
const distanceToSphere = Math.max( camera.near, _sphere.distanceToPoint( _ray.origin ) );
|
|
306
|
-
sphereMargin = getWorldSpaceHalfWidth( camera, distanceToSphere,
|
|
315
|
+
sphereMargin = getWorldSpaceHalfWidth( camera, distanceToSphere, this.resolution );
|
|
307
316
|
|
|
308
317
|
}
|
|
309
318
|
|
|
@@ -333,7 +342,7 @@ class LineSegments2 extends Mesh {
|
|
|
333
342
|
} else {
|
|
334
343
|
|
|
335
344
|
const distanceToBox = Math.max( camera.near, _box.distanceToPoint( _ray.origin ) );
|
|
336
|
-
boxMargin = getWorldSpaceHalfWidth( camera, distanceToBox,
|
|
345
|
+
boxMargin = getWorldSpaceHalfWidth( camera, distanceToBox, this.resolution );
|
|
337
346
|
|
|
338
347
|
}
|
|
339
348
|
|
|
@@ -386,8 +386,11 @@ class ThreeMFLoader extends Loader {
|
|
|
386
386
|
|
|
387
387
|
const attrib = portNodes[ i ].attributes[ j ];
|
|
388
388
|
if ( attrib.specified ) {
|
|
389
|
+
|
|
389
390
|
args[ attrib.name ] = attrib.value;
|
|
391
|
+
|
|
390
392
|
}
|
|
393
|
+
|
|
391
394
|
}
|
|
392
395
|
|
|
393
396
|
portArguments[ portNodes[ i ].getAttribute( 'identifier' ) ] = args;
|
|
@@ -415,19 +418,19 @@ class ThreeMFLoader extends Loader {
|
|
|
415
418
|
|
|
416
419
|
if ( operatorNode.nodeName === 'i:in' || operatorNode.nodeName === 'i:out' ) {
|
|
417
420
|
|
|
418
|
-
operations[ operatorNode.nodeName === 'i:in' ?
|
|
421
|
+
operations[ operatorNode.nodeName === 'i:in' ? 'inputs' : 'outputs' ] = parseImplicitIONode( operatorNode );
|
|
419
422
|
|
|
420
423
|
} else {
|
|
421
424
|
|
|
422
425
|
const inputNodes = operatorNode.children;
|
|
423
|
-
|
|
426
|
+
const portArguments = { 'op': operatorNode.nodeName.substring( 2 ), 'identifier': operatorNode.getAttribute( 'identifier' ) };
|
|
424
427
|
for ( let i = 0; i < inputNodes.length; i ++ ) {
|
|
425
428
|
|
|
426
429
|
portArguments[ inputNodes[ i ].nodeName.substring( 2 ) ] = parseImplicitIONode( inputNodes[ i ] );
|
|
427
430
|
|
|
428
431
|
}
|
|
429
432
|
|
|
430
|
-
operations[ portArguments[
|
|
433
|
+
operations[ portArguments[ 'identifier' ] ] = portArguments;
|
|
431
434
|
|
|
432
435
|
}
|
|
433
436
|
|
|
@@ -204,7 +204,7 @@ class BVHLoader extends Loader {
|
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
/*
|
|
207
|
-
Recursively parses the
|
|
207
|
+
Recursively parses the HIERARCHY section of the BVH file
|
|
208
208
|
|
|
209
209
|
- lines: all lines of the file. lines are consumed as we go along.
|
|
210
210
|
- firstline: line containing the node type and name e.g. 'JOINT hip'
|