@needle-tools/three 0.169.20-experimental.0 → 0.183.2-canary.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/LICENSE +1 -1
- package/README.md +5 -6
- package/build/three.cjs +54184 -56703
- package/build/three.core.js +59506 -0
- package/build/three.core.min.js +6 -0
- package/build/three.module.js +11645 -73000
- package/build/three.module.min.js +2 -2
- package/build/three.tsl.js +648 -0
- package/build/three.tsl.min.js +6 -0
- package/build/three.webgpu.js +53912 -51652
- package/build/three.webgpu.min.js +2 -2
- package/build/three.webgpu.nodes.js +53888 -51806
- package/build/three.webgpu.nodes.min.js +2 -2
- package/examples/fonts/MPLUSRounded1c/MPLUSRounded1c-Regular.typeface.json.zip +0 -0
- package/examples/fonts/MPLUSRounded1c/OFL.txt +91 -0
- package/examples/jsm/Addons.js +5 -15
- package/examples/jsm/animation/AnimationClipCreator.js +58 -6
- package/examples/jsm/animation/CCDIKSolver.js +152 -45
- package/examples/jsm/capabilities/WebGL.js +28 -29
- package/examples/jsm/capabilities/WebGPU.js +19 -17
- package/examples/jsm/controls/ArcballControls.js +474 -178
- package/examples/jsm/controls/DragControls.js +100 -58
- package/examples/jsm/controls/FirstPersonControls.js +116 -6
- package/examples/jsm/controls/FlyControls.js +50 -2
- package/examples/jsm/controls/MapControls.js +96 -8
- package/examples/jsm/controls/OrbitControls.js +496 -57
- package/examples/jsm/controls/PointerLockControls.js +115 -22
- package/examples/jsm/controls/TrackballControls.js +166 -14
- package/examples/jsm/controls/TransformControls.js +336 -26
- package/examples/jsm/csm/CSM.js +232 -18
- package/examples/jsm/csm/CSMFrustum.js +61 -4
- package/examples/jsm/csm/CSMHelper.js +50 -0
- package/examples/jsm/csm/CSMShader.js +13 -1
- package/examples/jsm/csm/CSMShadowNode.js +599 -0
- package/examples/jsm/curves/CurveExtras.js +303 -31
- package/examples/jsm/curves/NURBSCurve.js +91 -16
- package/examples/jsm/curves/NURBSSurface.js +52 -6
- package/examples/jsm/curves/NURBSUtils.js +102 -112
- package/examples/jsm/curves/NURBSVolume.js +24 -4
- package/examples/jsm/effects/AnaglyphEffect.js +134 -7
- package/examples/jsm/effects/AsciiEffect.js +69 -22
- package/examples/jsm/effects/OutlineEffect.js +61 -111
- package/examples/jsm/effects/ParallaxBarrierEffect.js +30 -0
- package/examples/jsm/effects/StereoEffect.js +31 -0
- package/examples/jsm/environments/ColorEnvironment.js +59 -0
- package/examples/jsm/environments/DebugEnvironment.js +50 -0
- package/examples/jsm/environments/RoomEnvironment.js +83 -42
- package/examples/jsm/exporters/DRACOExporter.js +56 -14
- package/examples/jsm/exporters/EXRExporter.js +40 -9
- package/examples/jsm/exporters/GLTFExporter.js +502 -169
- package/examples/jsm/exporters/OBJExporter.js +21 -1
- package/examples/jsm/exporters/PLYExporter.js +44 -12
- package/examples/jsm/exporters/STLExporter.js +27 -5
- package/examples/jsm/exporters/USDZExporter.js +781 -291
- package/examples/jsm/geometries/BoxLineGeometry.js +23 -0
- package/examples/jsm/geometries/ConvexGeometry.js +19 -0
- package/examples/jsm/geometries/DecalGeometry.js +91 -30
- package/examples/jsm/geometries/ParametricFunctions.js +100 -0
- package/examples/jsm/geometries/ParametricGeometry.js +38 -5
- package/examples/jsm/geometries/RoundedBoxGeometry.js +68 -7
- package/examples/jsm/geometries/TeapotGeometry.js +23 -38
- package/examples/jsm/geometries/TextGeometry.js +48 -29
- package/examples/jsm/gpgpu/BitonicSort.js +715 -0
- package/examples/jsm/helpers/AnimationPathHelper.js +302 -0
- package/examples/jsm/helpers/LightProbeHelper.js +36 -0
- package/examples/jsm/helpers/LightProbeHelperGPU.js +38 -1
- package/examples/jsm/helpers/OctreeHelper.js +36 -0
- package/examples/jsm/helpers/PositionalAudioHelper.js +60 -0
- package/examples/jsm/helpers/RapierHelper.js +59 -0
- package/examples/jsm/helpers/RectAreaLightHelper.js +36 -3
- package/examples/jsm/helpers/TextureHelper.js +28 -0
- package/examples/jsm/helpers/TextureHelperGPU.js +214 -0
- package/examples/jsm/helpers/VertexNormalsHelper.js +61 -2
- package/examples/jsm/helpers/VertexTangentsHelper.js +47 -2
- package/examples/jsm/helpers/ViewHelper.js +181 -9
- package/examples/jsm/inspector/Inspector.js +487 -0
- package/examples/jsm/inspector/RendererInspector.js +425 -0
- package/examples/jsm/inspector/tabs/Console.js +238 -0
- package/examples/jsm/inspector/tabs/Parameters.js +348 -0
- package/examples/jsm/inspector/tabs/Performance.js +268 -0
- package/examples/jsm/inspector/tabs/Viewer.js +166 -0
- package/examples/jsm/inspector/ui/Graph.js +95 -0
- package/examples/jsm/inspector/ui/Item.js +170 -0
- package/examples/jsm/inspector/ui/List.js +75 -0
- package/examples/jsm/inspector/ui/Profiler.js +1975 -0
- package/examples/jsm/inspector/ui/Style.js +1613 -0
- package/examples/jsm/inspector/ui/Tab.js +233 -0
- package/examples/jsm/inspector/ui/Values.js +439 -0
- package/examples/jsm/inspector/ui/utils.js +56 -0
- package/examples/jsm/interactive/HTMLMesh.js +43 -12
- package/examples/jsm/interactive/InteractiveGroup.js +170 -52
- package/examples/jsm/interactive/SelectionBox.js +106 -9
- package/examples/jsm/interactive/SelectionHelper.js +76 -30
- package/examples/jsm/libs/demuxer_mp4.js +109 -0
- package/examples/jsm/libs/meshopt_decoder.module.js +76 -58
- package/examples/jsm/libs/motion-controllers.module.js +1 -1
- package/examples/jsm/lighting/TiledLighting.js +42 -0
- package/examples/jsm/lights/LightProbeGenerator.js +44 -7
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +50 -14
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +16 -0
- package/examples/jsm/lines/Line2.js +41 -4
- package/examples/jsm/lines/LineGeometry.js +80 -2
- package/examples/jsm/lines/LineMaterial.js +105 -5
- package/examples/jsm/lines/LineSegments2.js +54 -4
- package/examples/jsm/lines/LineSegmentsGeometry.js +65 -8
- package/examples/jsm/lines/Wireframe.js +41 -4
- package/examples/jsm/lines/WireframeGeometry2.js +27 -2
- package/examples/jsm/lines/webgpu/Line2.js +28 -2
- package/examples/jsm/lines/webgpu/LineSegments2.js +59 -24
- package/examples/jsm/lines/webgpu/Wireframe.js +86 -0
- package/examples/jsm/loaders/3DMLoader.js +78 -6
- package/examples/jsm/loaders/3MFLoader.js +148 -7
- package/examples/jsm/loaders/AMFLoader.js +34 -14
- package/examples/jsm/loaders/BVHLoader.js +59 -12
- package/examples/jsm/loaders/ColladaLoader.js +61 -4027
- package/examples/jsm/loaders/DDSLoader.js +68 -1
- package/examples/jsm/loaders/DRACOLoader.js +146 -22
- package/examples/jsm/loaders/EXRLoader.js +255 -34
- package/examples/jsm/loaders/FBXLoader.js +80 -42
- package/examples/jsm/loaders/FontLoader.js +83 -6
- package/examples/jsm/loaders/GCodeLoader.js +71 -14
- package/examples/jsm/loaders/GLTFLoader.js +381 -263
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +52 -3
- package/examples/jsm/loaders/HDRLoader.js +485 -0
- package/examples/jsm/loaders/IESLoader.js +42 -0
- package/examples/jsm/loaders/KMZLoader.js +39 -6
- package/examples/jsm/loaders/KTX2Loader.js +124 -48
- package/examples/jsm/loaders/KTXLoader.js +31 -10
- package/examples/jsm/loaders/LDrawLoader.js +192 -145
- package/examples/jsm/loaders/LUT3dlLoader.js +47 -10
- package/examples/jsm/loaders/LUTCubeLoader.js +46 -9
- package/examples/jsm/loaders/LUTImageLoader.js +79 -38
- package/examples/jsm/loaders/LWOLoader.js +54 -59
- package/examples/jsm/loaders/LottieLoader.js +54 -1
- package/examples/jsm/loaders/MD2Loader.js +37 -1
- package/examples/jsm/loaders/MDDLoader.js +57 -12
- package/examples/jsm/loaders/MTLLoader.js +60 -35
- package/examples/jsm/loaders/MaterialXLoader.js +268 -34
- package/examples/jsm/loaders/NRRDLoader.js +40 -8
- package/examples/jsm/loaders/OBJLoader.js +51 -2
- package/examples/jsm/loaders/PCDLoader.js +173 -21
- package/examples/jsm/loaders/PDBLoader.js +41 -2
- package/examples/jsm/loaders/PLYLoader.js +70 -39
- package/examples/jsm/loaders/PVRLoader.js +25 -6
- package/examples/jsm/loaders/RGBELoader.js +6 -438
- package/examples/jsm/loaders/STLLoader.js +48 -38
- package/examples/jsm/loaders/SVGLoader.js +119 -25
- package/examples/jsm/loaders/TDSLoader.js +92 -74
- package/examples/jsm/loaders/TGALoader.js +23 -2
- package/examples/jsm/loaders/TIFFLoader.js +23 -0
- package/examples/jsm/loaders/TTFLoader.js +50 -3
- package/examples/jsm/loaders/USDLoader.js +279 -0
- package/examples/jsm/loaders/USDZLoader.js +4 -858
- package/examples/jsm/loaders/UltraHDRLoader.js +338 -166
- package/examples/jsm/loaders/VOXLoader.js +688 -87
- package/examples/jsm/loaders/VRMLLoader.js +121 -12
- package/examples/jsm/loaders/VTKLoader.js +77 -25
- package/examples/jsm/loaders/XYZLoader.js +36 -0
- package/examples/jsm/loaders/collada/ColladaComposer.js +2950 -0
- package/examples/jsm/loaders/collada/ColladaParser.js +1962 -0
- package/examples/jsm/loaders/lwo/IFFParser.js +77 -77
- package/examples/jsm/loaders/usd/USDAParser.js +822 -0
- package/examples/jsm/loaders/usd/USDCParser.js +1852 -0
- package/examples/jsm/loaders/usd/USDComposer.js +4041 -0
- package/examples/jsm/materials/LDrawConditionalLineMaterial.js +183 -0
- package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +154 -0
- package/examples/jsm/materials/WoodNodeMaterial.js +533 -0
- package/examples/jsm/math/Capsule.js +91 -14
- package/examples/jsm/math/ColorConverter.js +22 -0
- package/examples/jsm/math/ColorSpaces.js +74 -2
- package/examples/jsm/math/ConvexHull.js +517 -93
- package/examples/jsm/math/ImprovedNoise.js +32 -15
- package/examples/jsm/math/Lut.js +113 -0
- package/examples/jsm/math/MeshSurfaceSampler.js +78 -13
- package/examples/jsm/math/OBB.js +141 -29
- package/examples/jsm/math/Octree.js +283 -7
- package/examples/jsm/math/SimplexNoise.js +68 -42
- package/examples/jsm/misc/ConvexObjectBreaker.js +45 -25
- package/examples/jsm/misc/GPUComputationRenderer.js +96 -20
- package/examples/jsm/misc/Gyroscope.js +12 -0
- package/examples/jsm/misc/MD2Character.js +117 -2
- package/examples/jsm/misc/MD2CharacterComplex.js +175 -11
- package/examples/jsm/misc/MorphAnimMesh.js +44 -0
- package/examples/jsm/misc/MorphBlendMesh.js +103 -0
- package/examples/jsm/misc/ProgressiveLightMap.js +100 -54
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +322 -0
- package/examples/jsm/misc/RollerCoaster.js +57 -0
- package/examples/jsm/misc/TubePainter.js +437 -40
- package/examples/jsm/misc/Volume.js +123 -76
- package/examples/jsm/misc/VolumeSlice.js +95 -49
- package/examples/jsm/modifiers/CurveModifier.js +66 -38
- package/examples/jsm/modifiers/CurveModifierGPU.js +42 -19
- package/examples/jsm/modifiers/EdgeSplitModifier.js +20 -0
- package/examples/jsm/modifiers/SimplifyModifier.js +24 -10
- package/examples/jsm/modifiers/TessellateModifier.js +35 -2
- package/examples/jsm/objects/GroundedSkybox.js +25 -6
- package/examples/jsm/objects/Lensflare.js +94 -2
- package/examples/jsm/objects/LensflareMesh.js +64 -10
- package/examples/jsm/objects/MarchingCubes.js +90 -5
- package/examples/jsm/objects/Reflector.js +76 -2
- package/examples/jsm/objects/ReflectorForSSRPass.js +41 -0
- package/examples/jsm/objects/Refractor.js +62 -0
- package/examples/jsm/objects/ShadowMesh.js +54 -4
- package/examples/jsm/objects/Sky.js +106 -16
- package/examples/jsm/objects/SkyMesh.js +211 -38
- package/examples/jsm/objects/Water.js +49 -8
- package/examples/jsm/objects/Water2.js +49 -7
- package/examples/jsm/objects/Water2Mesh.js +50 -9
- package/examples/jsm/objects/WaterMesh.js +136 -43
- package/examples/jsm/physics/AmmoPhysics.js +60 -7
- package/examples/jsm/physics/JoltPhysics.js +65 -12
- package/examples/jsm/physics/RapierPhysics.js +217 -21
- package/examples/jsm/postprocessing/AfterimagePass.js +110 -29
- package/examples/jsm/postprocessing/BloomPass.js +128 -26
- package/examples/jsm/postprocessing/BokehPass.js +99 -22
- package/examples/jsm/postprocessing/ClearPass.js +54 -3
- package/examples/jsm/postprocessing/CubeTexturePass.js +82 -21
- package/examples/jsm/postprocessing/DotScreenPass.js +59 -10
- package/examples/jsm/postprocessing/EffectComposer.js +140 -6
- package/examples/jsm/postprocessing/FXAAPass.js +40 -0
- package/examples/jsm/postprocessing/FilmPass.js +54 -5
- package/examples/jsm/postprocessing/GTAOPass.js +202 -57
- package/examples/jsm/postprocessing/GlitchPass.js +86 -34
- package/examples/jsm/postprocessing/HalftonePass.js +65 -10
- package/examples/jsm/postprocessing/LUTPass.js +38 -8
- package/examples/jsm/postprocessing/MaskPass.js +91 -0
- package/examples/jsm/postprocessing/OutlinePass.js +272 -135
- package/examples/jsm/postprocessing/OutputPass.js +65 -14
- package/examples/jsm/postprocessing/Pass.js +100 -4
- package/examples/jsm/postprocessing/RenderPass.js +94 -0
- package/examples/jsm/postprocessing/RenderPixelatedPass.js +124 -45
- package/examples/jsm/postprocessing/RenderTransitionPass.js +120 -21
- package/examples/jsm/postprocessing/SAOPass.js +128 -55
- package/examples/jsm/postprocessing/SMAAPass.js +106 -75
- package/examples/jsm/postprocessing/SSAARenderPass.js +118 -35
- package/examples/jsm/postprocessing/SSAOPass.js +173 -60
- package/examples/jsm/postprocessing/SSRPass.js +268 -53
- package/examples/jsm/postprocessing/SavePass.js +69 -16
- package/examples/jsm/postprocessing/ShaderPass.js +65 -7
- package/examples/jsm/postprocessing/TAARenderPass.js +79 -24
- package/examples/jsm/postprocessing/TexturePass.js +72 -8
- package/examples/jsm/postprocessing/UnrealBloomPass.js +168 -59
- package/examples/jsm/renderers/CSS2DRenderer.js +98 -5
- package/examples/jsm/renderers/CSS3DRenderer.js +111 -7
- package/examples/jsm/renderers/Projector.js +288 -32
- package/examples/jsm/renderers/SVGRenderer.js +323 -61
- package/examples/jsm/renderers/webgl-legacy/nodes/GLSL1NodeBuilder.js +3 -1
- package/examples/jsm/renderers/webgl-legacy/nodes/SlotNode.js +1 -1
- package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodeBuilder.js +5 -1
- package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +12 -5
- package/examples/jsm/shaders/AfterimageShader.js +8 -3
- package/examples/jsm/shaders/BasicShader.js +8 -1
- package/examples/jsm/shaders/BleachBypassShader.js +10 -3
- package/examples/jsm/shaders/BlendShader.js +8 -1
- package/examples/jsm/shaders/BokehShader.js +9 -3
- package/examples/jsm/shaders/BokehShader2.js +11 -4
- package/examples/jsm/shaders/BrightnessContrastShader.js +10 -4
- package/examples/jsm/shaders/ColorCorrectionShader.js +8 -1
- package/examples/jsm/shaders/ColorifyShader.js +8 -1
- package/examples/jsm/shaders/ConvolutionShader.js +9 -38
- package/examples/jsm/shaders/CopyShader.js +8 -1
- package/examples/jsm/shaders/DOFMipMapShader.js +10 -3
- package/examples/jsm/shaders/DepthLimitedBlurShader.js +10 -1
- package/examples/jsm/shaders/DigitalGlitch.js +10 -7
- package/examples/jsm/shaders/DotScreenShader.js +8 -3
- package/examples/jsm/shaders/ExposureShader.js +8 -1
- package/examples/jsm/shaders/FXAAShader.js +233 -221
- package/examples/jsm/shaders/FilmShader.js +13 -0
- package/examples/jsm/shaders/FocusShader.js +8 -3
- package/examples/jsm/shaders/FreiChenShader.js +10 -3
- package/examples/jsm/shaders/GTAOShader.js +55 -45
- package/examples/jsm/shaders/GammaCorrectionShader.js +11 -2
- package/examples/jsm/shaders/HalftoneShader.js +24 -4
- package/examples/jsm/shaders/HorizontalBlurShader.js +12 -3
- package/examples/jsm/shaders/HorizontalTiltShiftShader.js +9 -2
- package/examples/jsm/shaders/HueSaturationShader.js +10 -3
- package/examples/jsm/shaders/KaleidoShader.js +11 -4
- package/examples/jsm/shaders/LuminosityHighPassShader.js +8 -4
- package/examples/jsm/shaders/LuminosityShader.js +8 -2
- package/examples/jsm/shaders/MirrorShader.js +10 -4
- package/examples/jsm/shaders/NormalMapShader.js +7 -2
- package/examples/jsm/shaders/OutputShader.js +19 -1
- package/examples/jsm/shaders/PoissonDenoiseShader.js +30 -17
- package/examples/jsm/shaders/RGBShiftShader.js +8 -1
- package/examples/jsm/shaders/SAOShader.js +27 -5
- package/examples/jsm/shaders/SMAAShader.js +24 -1
- package/examples/jsm/shaders/SSAOShader.js +37 -6
- package/examples/jsm/shaders/SSRShader.js +32 -6
- package/examples/jsm/shaders/SepiaShader.js +8 -3
- package/examples/jsm/shaders/SobelOperatorShader.js +9 -3
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +13 -8
- package/examples/jsm/shaders/TechnicolorShader.js +10 -4
- package/examples/jsm/shaders/ToonShader.js +29 -6
- package/examples/jsm/shaders/TriangleBlurShader.js +9 -4
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +19 -6
- package/examples/jsm/shaders/VelocityShader.js +8 -1
- package/examples/jsm/shaders/VerticalBlurShader.js +9 -2
- package/examples/jsm/shaders/VerticalTiltShiftShader.js +8 -1
- package/examples/jsm/shaders/VignetteShader.js +8 -3
- package/examples/jsm/shaders/VolumeShader.js +11 -2
- package/examples/jsm/shaders/WaterRefractionShader.js +11 -0
- package/examples/jsm/textures/FlakesTexture.js +14 -0
- package/examples/jsm/transpiler/AST.js +436 -31
- package/examples/jsm/transpiler/GLSLDecoder.js +380 -135
- package/examples/jsm/transpiler/Linker.js +327 -0
- package/examples/jsm/transpiler/ShaderToyDecoder.js +3 -1
- package/examples/jsm/transpiler/TSLEncoder.js +363 -97
- package/examples/jsm/transpiler/Transpiler.js +50 -1
- package/examples/jsm/transpiler/TranspilerUtils.js +29 -0
- package/examples/jsm/transpiler/WGSLEncoder.js +839 -0
- package/examples/jsm/tsl/display/AfterImageNode.js +244 -0
- package/examples/jsm/tsl/display/AnaglyphPassNode.js +549 -0
- package/examples/jsm/tsl/display/AnamorphicNode.js +282 -0
- package/examples/jsm/tsl/display/BilateralBlurNode.js +364 -0
- package/{src/nodes → examples/jsm/tsl}/display/BleachBypass.js +11 -4
- package/examples/jsm/tsl/display/BloomNode.js +534 -0
- package/examples/jsm/tsl/display/CRT.js +150 -0
- package/examples/jsm/tsl/display/ChromaticAberrationNode.js +207 -0
- package/examples/jsm/tsl/display/DenoiseNode.js +334 -0
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +554 -0
- package/examples/jsm/tsl/display/DotScreenNode.js +104 -0
- package/examples/jsm/tsl/display/FXAANode.js +365 -0
- package/examples/jsm/tsl/display/FilmNode.js +101 -0
- package/examples/jsm/tsl/display/GTAONode.js +571 -0
- package/examples/jsm/tsl/display/GaussianBlurNode.js +389 -0
- package/examples/jsm/tsl/display/GodraysNode.js +624 -0
- package/examples/jsm/tsl/display/LensflareNode.js +279 -0
- package/examples/jsm/tsl/display/Lut3DNode.js +109 -0
- package/examples/jsm/tsl/display/MotionBlur.js +33 -0
- package/examples/jsm/tsl/display/OutlineNode.js +762 -0
- package/examples/jsm/tsl/display/ParallaxBarrierPassNode.js +89 -0
- package/examples/jsm/tsl/display/PixelationPassNode.js +335 -0
- package/examples/jsm/tsl/display/RGBShiftNode.js +96 -0
- package/examples/jsm/tsl/display/RetroPassNode.js +263 -0
- package/examples/jsm/tsl/display/SMAANode.js +768 -0
- package/{src/nodes → examples/jsm/tsl}/display/SSAAPassNode.js +120 -49
- package/examples/jsm/tsl/display/SSGINode.js +642 -0
- package/examples/jsm/tsl/display/SSRNode.js +656 -0
- package/examples/jsm/tsl/display/SSSNode.js +490 -0
- package/{src/nodes → examples/jsm/tsl}/display/Sepia.js +9 -2
- package/examples/jsm/tsl/display/Shape.js +29 -0
- package/{src/nodes → examples/jsm/tsl}/display/SobelOperatorNode.js +61 -19
- package/examples/jsm/tsl/display/StereoCompositePassNode.js +192 -0
- package/{src/nodes → examples/jsm/tsl}/display/StereoPassNode.js +48 -12
- package/examples/jsm/tsl/display/TRAANode.js +726 -0
- package/examples/jsm/tsl/display/TransitionNode.js +141 -0
- package/examples/jsm/tsl/display/boxBlur.js +65 -0
- package/examples/jsm/tsl/display/depthAwareBlend.js +80 -0
- package/examples/jsm/tsl/display/hashBlur.js +54 -0
- package/examples/jsm/tsl/display/radialBlur.js +68 -0
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +442 -0
- package/examples/jsm/tsl/math/Bayer.js +73 -0
- package/examples/jsm/tsl/shadows/TileShadowNode.js +456 -0
- package/examples/jsm/tsl/shadows/TileShadowNodeHelper.js +212 -0
- package/examples/jsm/tsl/utils/Raymarching.js +70 -0
- package/examples/jsm/utils/BufferGeometryUtils.js +91 -29
- package/examples/jsm/utils/CameraUtils.js +15 -6
- package/examples/jsm/utils/GeometryCompressionUtils.js +23 -30
- package/examples/jsm/utils/GeometryUtils.js +32 -27
- package/examples/jsm/utils/LDrawUtils.js +14 -5
- package/examples/jsm/utils/SceneOptimizer.js +458 -0
- package/examples/jsm/utils/SceneUtils.js +53 -3
- package/examples/jsm/utils/ShadowMapViewer.js +72 -33
- package/examples/jsm/utils/ShadowMapViewerGPU.js +61 -29
- package/examples/jsm/utils/SkeletonUtils.js +48 -0
- package/examples/jsm/utils/SortUtils.js +17 -5
- package/examples/jsm/utils/UVsDebug.js +12 -4
- package/examples/jsm/utils/{TextureUtils.js → WebGLTextureUtils.js} +16 -0
- package/examples/jsm/utils/{TextureUtilsGPU.js → WebGPUTextureUtils.js} +20 -2
- package/examples/jsm/utils/WorkerPool.js +67 -2
- package/examples/jsm/webxr/ARButton.js +19 -0
- package/examples/jsm/webxr/OculusHandModel.js +84 -0
- package/examples/jsm/webxr/OculusHandPointerModel.js +148 -22
- package/examples/jsm/webxr/Text2D.js +20 -6
- package/examples/jsm/webxr/VRButton.js +31 -0
- package/examples/jsm/webxr/XRButton.js +23 -0
- package/examples/jsm/webxr/XRControllerModelFactory.js +94 -3
- package/examples/jsm/webxr/XREstimatedLight.js +35 -4
- package/examples/jsm/webxr/XRHandMeshModel.js +37 -0
- package/examples/jsm/webxr/XRHandModelFactory.js +96 -6
- package/examples/jsm/webxr/XRHandPrimitiveModel.js +44 -0
- package/examples/jsm/webxr/XRPlanes.js +18 -0
- package/package.json +29 -37
- package/src/Three.Core.js +198 -0
- package/src/Three.Legacy.js +0 -21
- package/src/Three.TSL.js +641 -0
- package/src/Three.WebGPU.Nodes.js +14 -186
- package/src/Three.WebGPU.js +16 -186
- package/src/Three.js +2 -197
- package/src/animation/AnimationAction.js +263 -31
- package/src/animation/AnimationClip.js +162 -7
- package/src/animation/AnimationMixer.js +105 -15
- package/src/animation/AnimationObjectGroup.js +45 -21
- package/src/animation/AnimationUtils.js +163 -24
- package/src/animation/KeyframeTrack.js +191 -17
- package/src/animation/PropertyBinding.js +91 -16
- package/src/animation/PropertyMixer.js +72 -5
- package/src/animation/tracks/BooleanKeyframeTrack.js +33 -6
- package/src/animation/tracks/ColorKeyframeTrack.js +26 -5
- package/src/animation/tracks/NumberKeyframeTrack.js +26 -2
- package/src/animation/tracks/QuaternionKeyframeTrack.js +30 -1
- package/src/animation/tracks/StringKeyframeTrack.js +33 -2
- package/src/animation/tracks/VectorKeyframeTrack.js +26 -2
- package/src/audio/Audio.js +386 -8
- package/src/audio/AudioAnalyser.js +58 -1
- package/src/audio/AudioContext.js +15 -0
- package/src/audio/AudioListener.js +94 -13
- package/src/audio/PositionalAudio.js +107 -0
- package/src/cameras/ArrayCamera.js +37 -0
- package/src/cameras/Camera.js +61 -0
- package/src/cameras/CubeCamera.js +86 -0
- package/src/cameras/OrthographicCamera.js +110 -1
- package/src/cameras/PerspectiveCamera.js +174 -35
- package/src/cameras/StereoCamera.js +48 -2
- package/src/constants.js +1546 -11
- package/src/core/BufferAttribute.js +417 -3
- package/src/core/BufferGeometry.js +407 -22
- package/src/core/Clock.js +69 -8
- package/src/core/EventDispatcher.js +52 -8
- package/src/core/GLBufferAttribute.js +113 -2
- package/src/core/InstancedBufferAttribute.js +29 -0
- package/src/core/InstancedBufferGeometry.js +20 -0
- package/src/core/InstancedInterleavedBuffer.js +26 -0
- package/src/core/InterleavedBuffer.js +141 -7
- package/src/core/InterleavedBufferAttribute.js +200 -2
- package/src/core/Layers.js +71 -10
- package/src/core/Object3D.js +673 -26
- package/src/core/Raycaster.js +136 -2
- package/src/core/RenderTarget.js +256 -27
- package/src/core/RenderTarget3D.js +48 -0
- package/src/core/Timer.js +184 -0
- package/src/core/Uniform.js +29 -0
- package/src/core/UniformsGroup.js +84 -2
- package/src/extras/Controls.js +89 -1
- package/src/extras/DataUtils.js +50 -9
- package/src/extras/Earcut.js +18 -779
- package/src/extras/ImageUtils.js +22 -14
- package/src/extras/PMREMGenerator.js +316 -67
- package/src/extras/ShapeUtils.js +24 -2
- package/src/extras/TextureUtils.js +101 -15
- package/src/extras/core/Curve.js +156 -55
- package/src/extras/core/CurvePath.js +63 -22
- package/src/extras/core/Interpolations.js +34 -2
- package/src/extras/core/Path.js +134 -1
- package/src/extras/core/Shape.js +66 -3
- package/src/extras/core/ShapePath.js +80 -4
- package/src/extras/curves/ArcCurve.js +22 -0
- package/src/extras/curves/CatmullRomCurve3.js +89 -18
- package/src/extras/curves/CubicBezierCurve.js +67 -0
- package/src/extras/curves/CubicBezierCurve3.js +50 -0
- package/src/extras/curves/EllipseCurve.js +102 -0
- package/src/extras/curves/LineCurve.js +36 -0
- package/src/extras/curves/LineCurve3.js +36 -0
- package/src/extras/curves/QuadraticBezierCurve.js +59 -0
- package/src/extras/curves/QuadraticBezierCurve3.js +43 -0
- package/src/extras/curves/SplineCurve.js +48 -0
- package/src/extras/lib/earcut.js +685 -0
- package/src/geometries/BoxGeometry.js +39 -0
- package/src/geometries/CapsuleGeometry.js +196 -11
- package/src/geometries/CircleGeometry.js +41 -0
- package/src/geometries/ConeGeometry.js +39 -0
- package/src/geometries/CylinderGeometry.js +42 -2
- package/src/geometries/DodecahedronGeometry.js +33 -0
- package/src/geometries/EdgesGeometry.js +30 -2
- package/src/geometries/ExtrudeGeometry.js +148 -52
- package/src/geometries/IcosahedronGeometry.js +33 -0
- package/src/geometries/LatheGeometry.js +44 -3
- package/src/geometries/OctahedronGeometry.js +33 -0
- package/src/geometries/PlaneGeometry.js +35 -0
- package/src/geometries/PolyhedronGeometry.js +30 -1
- package/src/geometries/RingGeometry.js +37 -0
- package/src/geometries/ShapeGeometry.js +38 -0
- package/src/geometries/SphereGeometry.js +38 -0
- package/src/geometries/TetrahedronGeometry.js +33 -0
- package/src/geometries/TorusGeometry.js +44 -3
- package/src/geometries/TorusKnotGeometry.js +39 -0
- package/src/geometries/TubeGeometry.js +50 -0
- package/src/geometries/WireframeGeometry.js +32 -0
- package/src/helpers/ArrowHelper.js +62 -5
- package/src/helpers/AxesHelper.js +28 -0
- package/src/helpers/Box3Helper.js +28 -0
- package/src/helpers/BoxHelper.js +43 -7
- package/src/helpers/CameraHelper.js +103 -27
- package/src/helpers/DirectionalLightHelper.js +55 -0
- package/src/helpers/GridHelper.js +26 -0
- package/src/helpers/HemisphereLightHelper.js +42 -0
- package/src/helpers/PlaneHelper.js +33 -0
- package/src/helpers/PointLightHelper.js +43 -24
- package/src/helpers/PolarGridHelper.js +30 -0
- package/src/helpers/SkeletonHelper.js +73 -7
- package/src/helpers/SpotLightHelper.js +43 -0
- package/src/lights/AmbientLight.js +25 -0
- package/src/lights/DirectionalLight.js +70 -0
- package/src/lights/DirectionalLightShadow.js +15 -0
- package/src/lights/HemisphereLight.js +42 -0
- package/src/lights/Light.js +37 -11
- package/src/lights/LightProbe.js +37 -9
- package/src/lights/LightShadow.js +202 -7
- package/src/lights/PointLight.js +74 -0
- package/src/lights/PointLightShadow.js +15 -80
- package/src/lights/RectAreaLight.js +59 -0
- package/src/lights/SpotLight.js +124 -1
- package/src/lights/SpotLightShadow.js +33 -3
- package/src/lights/webgpu/IESSpotLight.js +22 -0
- package/src/lights/webgpu/ProjectorLight.js +46 -0
- package/src/loaders/AnimationLoader.js +34 -2
- package/src/loaders/AudioLoader.js +34 -2
- package/src/loaders/BufferGeometryLoader.js +38 -13
- package/src/loaders/Cache.js +75 -2
- package/src/loaders/CompressedTextureLoader.js +36 -3
- package/src/loaders/CubeTextureLoader.js +45 -0
- package/src/loaders/DataTextureLoader.js +45 -4
- package/src/loaders/FileLoader.js +85 -5
- package/src/loaders/ImageBitmapLoader.js +113 -11
- package/src/loaders/ImageLoader.js +85 -8
- package/src/loaders/Loader.js +150 -0
- package/src/loaders/LoaderUtils.js +18 -36
- package/src/loaders/LoadingManager.js +187 -0
- package/src/loaders/MaterialLoader.js +62 -3
- package/src/loaders/ObjectLoader.js +131 -31
- package/src/loaders/TextureLoader.js +33 -0
- package/src/loaders/nodes/NodeLoader.js +68 -4
- package/src/loaders/nodes/NodeMaterialLoader.js +45 -0
- package/src/loaders/nodes/NodeObjectLoader.js +61 -0
- package/src/materials/LineBasicMaterial.js +74 -1
- package/src/materials/LineDashedMaterial.js +52 -1
- package/src/materials/Material.js +502 -8
- package/src/materials/MeshBasicMaterial.js +168 -2
- package/src/materials/MeshDepthMaterial.js +94 -0
- package/src/materials/MeshDistanceMaterial.js +76 -0
- package/src/materials/MeshLambertMaterial.js +283 -0
- package/src/materials/MeshMatcapMaterial.js +164 -0
- package/src/materials/MeshNormalMaterial.js +114 -0
- package/src/materials/MeshPhongMaterial.js +298 -0
- package/src/materials/MeshPhysicalMaterial.js +296 -4
- package/src/materials/MeshStandardMaterial.js +300 -2
- package/src/materials/MeshToonMaterial.js +219 -0
- package/src/materials/PointsMaterial.js +89 -0
- package/src/materials/RawShaderMaterial.js +25 -0
- package/src/materials/ShaderMaterial.js +234 -6
- package/src/materials/ShadowMaterial.js +54 -0
- package/src/materials/SpriteMaterial.js +82 -0
- package/src/materials/nodes/Line2NodeMaterial.js +158 -53
- package/src/materials/nodes/LineBasicNodeMaterial.js +17 -2
- package/src/materials/nodes/LineDashedNodeMaterial.js +81 -6
- package/src/materials/nodes/MeshBasicNodeMaterial.js +59 -2
- package/src/materials/nodes/MeshLambertNodeMaterial.js +35 -0
- package/src/materials/nodes/MeshMatcapNodeMaterial.js +23 -3
- package/src/materials/nodes/MeshNormalNodeMaterial.js +27 -4
- package/src/materials/nodes/MeshPhongNodeMaterial.js +64 -1
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +276 -3
- package/src/materials/nodes/MeshSSSNodeMaterial.js +98 -10
- package/src/materials/nodes/MeshStandardNodeMaterial.js +83 -4
- package/src/materials/nodes/MeshToonNodeMaterial.js +28 -0
- package/src/materials/nodes/NodeMaterial.js +789 -74
- package/src/materials/nodes/NodeMaterials.js +0 -1
- package/src/materials/nodes/PointsNodeMaterial.js +180 -11
- package/src/materials/nodes/ShadowNodeMaterial.js +38 -0
- package/src/materials/nodes/SpriteNodeMaterial.js +86 -23
- package/src/materials/nodes/VolumeNodeMaterial.js +57 -84
- package/src/materials/nodes/manager/NodeMaterialObserver.js +329 -12
- package/src/math/Box2.js +177 -0
- package/src/math/Box3.js +271 -0
- package/src/math/Color.js +355 -11
- package/src/math/ColorManagement.js +158 -92
- package/src/math/Cylindrical.js +65 -6
- package/src/math/Euler.js +139 -5
- package/src/math/Frustum.js +108 -9
- package/src/math/FrustumArray.js +258 -0
- package/src/math/Interpolant.js +87 -8
- package/src/math/Line3.js +221 -2
- package/src/math/MathUtils.js +408 -20
- package/src/math/Matrix2.js +70 -0
- package/src/math/Matrix3.js +229 -4
- package/src/math/Matrix4.js +489 -94
- package/src/math/Plane.js +164 -2
- package/src/math/Quaternion.js +322 -90
- package/src/math/Ray.js +162 -0
- package/src/math/Sphere.js +175 -0
- package/src/math/Spherical.js +73 -11
- package/src/math/SphericalHarmonics3.js +112 -14
- package/src/math/Triangle.js +206 -2
- package/src/math/Vector2.js +396 -10
- package/src/math/Vector3.js +550 -15
- package/src/math/Vector4.js +415 -9
- package/src/math/interpolants/BezierInterpolant.js +108 -0
- package/src/math/interpolants/CubicInterpolant.js +10 -1
- package/src/math/interpolants/DiscreteInterpolant.js +10 -2
- package/src/math/interpolants/LinearInterpolant.js +13 -0
- package/src/math/interpolants/QuaternionLinearInterpolant.js +10 -1
- package/src/nodes/Nodes.js +91 -88
- package/src/nodes/TSL.js +32 -38
- package/src/nodes/accessors/AccessorsUtils.js +37 -9
- package/src/nodes/accessors/Arrays.js +68 -0
- package/src/nodes/accessors/BatchNode.js +49 -14
- package/src/nodes/accessors/Bitangent.js +82 -13
- package/src/nodes/accessors/BufferAttributeNode.js +269 -8
- package/src/nodes/accessors/BufferNode.js +91 -2
- package/src/nodes/accessors/BuiltinNode.js +63 -0
- package/src/nodes/accessors/Camera.js +400 -10
- package/src/nodes/accessors/ClippingNode.js +149 -45
- package/src/nodes/accessors/CubeTextureNode.js +137 -7
- package/src/nodes/accessors/InstanceNode.js +245 -40
- package/src/nodes/accessors/InstancedMeshNode.js +50 -0
- package/src/nodes/accessors/Lights.js +88 -0
- package/src/nodes/accessors/MaterialNode.js +355 -13
- package/src/nodes/accessors/MaterialProperties.js +57 -1
- package/src/nodes/accessors/MaterialReferenceNode.js +52 -14
- package/src/nodes/accessors/ModelNode.js +117 -5
- package/src/nodes/accessors/ModelViewProjectionNode.js +10 -39
- package/src/nodes/accessors/MorphNode.js +73 -26
- package/src/nodes/accessors/Normal.js +174 -19
- package/src/nodes/accessors/Object3DNode.js +146 -12
- package/src/nodes/accessors/PointUVNode.js +25 -0
- package/src/nodes/accessors/Position.js +119 -7
- package/src/nodes/accessors/ReferenceBaseNode.js +190 -4
- package/src/nodes/accessors/ReferenceNode.js +223 -8
- package/src/nodes/accessors/ReflectVector.js +29 -3
- package/src/nodes/accessors/RendererReferenceNode.js +45 -2
- package/src/nodes/accessors/SceneProperties.js +53 -0
- package/src/nodes/accessors/SkinningNode.js +180 -43
- package/src/nodes/accessors/StorageBufferNode.js +278 -26
- package/src/nodes/accessors/StorageTextureNode.js +205 -12
- package/src/nodes/accessors/Tangent.js +48 -10
- package/src/nodes/accessors/TangentUtils.js +46 -0
- package/src/nodes/accessors/Texture3DNode.js +104 -11
- package/src/nodes/accessors/TextureBicubic.js +31 -4
- package/src/nodes/accessors/TextureNode.js +564 -52
- package/src/nodes/accessors/TextureSizeNode.js +42 -1
- package/src/nodes/accessors/UV.js +9 -1
- package/src/nodes/accessors/UniformArrayNode.js +226 -34
- package/src/nodes/accessors/UserDataNode.js +46 -2
- package/src/nodes/accessors/VelocityNode.js +93 -3
- package/src/nodes/accessors/VertexColorNode.js +39 -4
- package/src/nodes/code/CodeNode.js +101 -8
- package/src/nodes/code/ExpressionNode.js +29 -2
- package/src/nodes/code/FunctionCallNode.js +98 -10
- package/src/nodes/code/FunctionNode.js +69 -2
- package/src/nodes/core/ArrayNode.js +174 -0
- package/src/nodes/core/AssignNode.js +80 -9
- package/src/nodes/core/AttributeNode.js +47 -4
- package/src/nodes/core/BypassNode.js +47 -3
- package/src/nodes/core/ConstNode.js +32 -0
- package/src/nodes/core/ContextNode.js +220 -14
- package/src/nodes/core/IndexNode.js +72 -7
- package/src/nodes/core/InputNode.js +50 -1
- package/src/nodes/core/InspectorNode.js +128 -0
- package/src/nodes/core/IsolateNode.js +133 -0
- package/src/nodes/core/LightingModel.js +65 -5
- package/src/nodes/core/MRTNode.js +113 -2
- package/src/nodes/core/Node.js +595 -36
- package/src/nodes/core/NodeAttribute.js +38 -0
- package/src/nodes/core/NodeBuilder.js +1840 -121
- package/src/nodes/core/NodeCache.js +41 -2
- package/src/nodes/core/NodeCode.js +31 -0
- package/src/nodes/core/NodeError.js +28 -0
- package/src/nodes/core/NodeFrame.js +153 -24
- package/src/nodes/core/NodeFunction.js +48 -1
- package/src/nodes/core/NodeFunctionInput.js +44 -0
- package/src/nodes/core/NodeParser.js +13 -1
- package/src/nodes/core/NodeUniform.js +53 -1
- package/src/nodes/core/NodeUtils.js +201 -51
- package/src/nodes/core/NodeVar.js +47 -1
- package/src/nodes/core/NodeVarying.js +47 -1
- package/src/nodes/core/OutputStructNode.js +54 -12
- package/src/nodes/core/ParameterNode.js +60 -2
- package/src/nodes/core/PropertyNode.js +286 -7
- package/src/nodes/core/StackNode.js +337 -20
- package/src/nodes/core/StackTrace.js +139 -0
- package/src/nodes/core/StructNode.js +134 -0
- package/src/nodes/core/StructType.js +13 -0
- package/src/nodes/core/StructTypeNode.js +126 -6
- package/src/nodes/core/SubBuildNode.js +89 -0
- package/src/nodes/core/TempNode.js +31 -5
- package/src/nodes/core/UniformGroupNode.js +85 -7
- package/src/nodes/core/UniformNode.js +163 -16
- package/src/nodes/core/VarNode.js +317 -10
- package/src/nodes/core/VaryingNode.js +115 -13
- package/src/nodes/core/constants.js +40 -0
- package/src/nodes/display/BlendModes.js +171 -0
- package/src/nodes/display/BumpMapNode.js +38 -2
- package/src/nodes/display/ColorAdjustment.js +118 -6
- package/src/nodes/display/ColorSpaceFunctions.js +22 -6
- package/src/nodes/display/ColorSpaceNode.js +97 -47
- package/src/nodes/display/FrontFacingNode.js +64 -7
- package/src/nodes/display/NormalMapNode.js +101 -54
- package/src/nodes/display/PassNode.js +690 -33
- package/src/nodes/display/RenderOutputNode.js +94 -4
- package/src/nodes/display/ScreenNode.js +138 -27
- package/src/nodes/display/ToneMappingFunctions.js +62 -10
- package/src/nodes/display/ToneMappingNode.js +88 -8
- package/src/nodes/display/ToonOutlinePassNode.js +84 -4
- package/src/nodes/display/ViewportDepthNode.js +227 -10
- package/src/nodes/display/ViewportDepthTextureNode.js +39 -5
- package/src/nodes/display/ViewportSharedTextureNode.js +35 -1
- package/src/nodes/display/ViewportTextureNode.js +171 -7
- package/src/nodes/fog/Fog.js +97 -0
- package/src/nodes/functions/BSDF/BRDF_GGX.js +2 -6
- package/src/nodes/functions/BSDF/BRDF_GGX_Multiscatter.js +52 -0
- package/src/nodes/functions/BSDF/BRDF_Sheen.js +4 -4
- package/src/nodes/functions/BSDF/DFGLUT.js +56 -0
- package/src/nodes/functions/BSDF/EnvironmentBRDF.js +2 -2
- package/src/nodes/functions/BSDF/LTC.js +45 -1
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +1 -1
- package/src/nodes/functions/BasicLightingModel.js +28 -6
- package/src/nodes/functions/PhongLightingModel.js +36 -6
- package/src/nodes/functions/PhysicalLightingModel.js +336 -91
- package/src/nodes/functions/ShadowMaskModel.js +30 -3
- package/src/nodes/functions/ToonLightingModel.js +21 -2
- package/src/nodes/functions/VolumetricLightingModel.js +183 -0
- package/src/nodes/functions/material/getAlphaHashThreshold.js +68 -0
- package/src/nodes/functions/material/getGeometryRoughness.js +10 -4
- package/src/nodes/functions/material/getParallaxCorrectNormal.js +37 -0
- package/src/nodes/geometry/RangeNode.js +97 -8
- package/src/nodes/gpgpu/AtomicFunctionNode.js +198 -23
- package/src/nodes/gpgpu/BarrierNode.js +52 -3
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +135 -6
- package/src/nodes/gpgpu/ComputeNode.js +212 -16
- package/src/nodes/gpgpu/SubgroupFunctionNode.js +455 -0
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +143 -9
- package/src/nodes/lighting/AONode.js +18 -0
- package/src/nodes/lighting/AmbientLightNode.js +10 -0
- package/src/nodes/lighting/AnalyticLightNode.js +186 -399
- package/src/nodes/lighting/BasicEnvironmentNode.js +19 -0
- package/src/nodes/lighting/BasicLightMapNode.js +17 -0
- package/src/nodes/lighting/DirectionalLightNode.js +12 -11
- package/src/nodes/lighting/EnvironmentNode.js +59 -19
- package/src/nodes/lighting/HemisphereLightNode.js +33 -2
- package/src/nodes/lighting/IESSpotLightNode.js +13 -1
- package/src/nodes/lighting/IrradianceNode.js +17 -0
- package/src/nodes/lighting/LightProbeNode.js +20 -0
- package/src/nodes/lighting/LightUtils.js +11 -3
- package/src/nodes/lighting/LightingContextNode.js +52 -4
- package/src/nodes/lighting/LightingNode.js +15 -6
- package/src/nodes/lighting/LightsNode.js +238 -35
- package/src/nodes/lighting/PointLightNode.js +60 -25
- package/src/nodes/lighting/PointShadowNode.js +325 -0
- package/src/nodes/lighting/ProjectorLightNode.js +91 -0
- package/src/nodes/lighting/RectAreaLightNode.js +50 -14
- package/src/nodes/lighting/ShadowBaseNode.js +81 -0
- package/src/nodes/lighting/ShadowFilterNode.js +264 -0
- package/src/nodes/lighting/ShadowNode.js +867 -0
- package/src/nodes/lighting/SpotLightNode.js +99 -18
- package/src/nodes/materialx/MaterialXNodes.js +131 -2
- package/src/nodes/materialx/lib/mx_noise.js +166 -2
- package/src/nodes/math/BitcastNode.js +156 -0
- package/src/nodes/math/BitcountNode.js +433 -0
- package/src/nodes/math/ConditionalNode.js +110 -21
- package/src/nodes/math/Hash.js +8 -0
- package/src/nodes/math/MathNode.js +820 -97
- package/src/nodes/math/MathUtils.js +47 -1
- package/src/nodes/math/OperatorNode.js +517 -84
- package/src/nodes/math/PackFloatNode.js +98 -0
- package/src/nodes/math/TriNoise3D.js +17 -7
- package/src/nodes/math/UnpackFloatNode.js +96 -0
- package/src/nodes/parsers/GLSLNodeFunction.js +16 -0
- package/src/nodes/parsers/GLSLNodeParser.js +11 -0
- package/src/nodes/pmrem/PMREMNode.js +180 -23
- package/src/nodes/pmrem/PMREMUtils.js +114 -5
- package/src/nodes/procedural/Checker.js +8 -0
- package/src/nodes/shapes/Shapes.js +33 -0
- package/src/nodes/tsl/TSLBase.js +10 -4
- package/src/nodes/tsl/TSLCore.js +732 -160
- package/src/nodes/utils/ArrayElementNode.js +55 -4
- package/src/nodes/utils/ConvertNode.js +31 -0
- package/src/nodes/utils/CubeMapNode.js +79 -2
- package/src/nodes/utils/DebugNode.js +83 -0
- package/src/nodes/utils/Discard.js +18 -2
- package/src/nodes/utils/EquirectUV.js +27 -0
- package/src/nodes/utils/EventNode.js +118 -0
- package/src/nodes/utils/FlipNode.js +38 -0
- package/src/nodes/utils/FunctionOverloadingNode.js +91 -22
- package/src/nodes/utils/JoinNode.js +57 -4
- package/src/nodes/utils/LoopNode.js +193 -55
- package/src/nodes/utils/MatcapUV.js +22 -0
- package/src/nodes/utils/MaxMipLevelNode.js +49 -1
- package/src/nodes/utils/MemberNode.js +120 -0
- package/src/nodes/utils/Oscillators.js +41 -0
- package/src/nodes/utils/Packing.js +30 -1
- package/src/nodes/utils/PostProcessingUtils.js +154 -0
- package/src/nodes/utils/RTTNode.js +165 -9
- package/src/nodes/utils/ReflectorNode.js +407 -21
- package/src/nodes/utils/RemapNode.js +81 -2
- package/src/nodes/utils/RotateNode.js +41 -1
- package/src/nodes/utils/SampleNode.js +91 -0
- package/src/nodes/utils/SetNode.js +44 -1
- package/src/nodes/utils/SplitNode.js +66 -3
- package/src/nodes/utils/SpriteSheetUV.js +35 -0
- package/src/nodes/utils/SpriteUtils.js +16 -0
- package/src/nodes/utils/StorageArrayElementNode.js +56 -3
- package/src/nodes/utils/Timer.js +26 -0
- package/src/nodes/utils/TriplanarTextures.js +65 -0
- package/src/nodes/utils/UVUtils.js +48 -0
- package/src/nodes/utils/ViewportUtils.js +12 -0
- package/src/objects/BatchedMesh.js +798 -309
- package/src/objects/Bone.js +24 -0
- package/src/objects/ClippingGroup.js +68 -0
- package/src/objects/Group.js +24 -0
- package/src/objects/InstancedMesh.js +131 -2
- package/src/objects/LOD.js +99 -5
- package/src/objects/Line.js +90 -7
- package/src/objects/LineLoop.js +20 -0
- package/src/objects/LineSegments.js +20 -1
- package/src/objects/Mesh.js +84 -0
- package/src/objects/Points.js +60 -0
- package/src/objects/Skeleton.js +120 -5
- package/src/objects/SkinnedMesh.js +102 -6
- package/src/objects/Sprite.js +65 -1
- package/src/renderers/WebGL3DRenderTarget.js +26 -0
- package/src/renderers/WebGLArrayRenderTarget.js +26 -0
- package/src/renderers/WebGLCubeRenderTarget.js +41 -5
- package/src/renderers/WebGLRenderTarget.js +19 -0
- package/src/renderers/WebGLRenderer.js +1016 -278
- package/src/renderers/common/Animation.js +123 -14
- package/src/renderers/common/Attributes.js +41 -1
- package/src/renderers/common/Backend.js +623 -44
- package/src/renderers/common/Background.js +99 -16
- package/src/renderers/common/BindGroup.js +37 -2
- package/src/renderers/common/Binding.js +46 -0
- package/src/renderers/common/Bindings.js +211 -20
- package/src/renderers/common/BlendMode.js +143 -0
- package/src/renderers/common/Buffer.js +89 -0
- package/src/renderers/common/BufferUtils.js +25 -0
- package/src/renderers/common/BundleGroup.js +57 -0
- package/src/renderers/common/CanvasTarget.js +341 -0
- package/src/renderers/common/ChainMap.js +73 -10
- package/src/renderers/common/ClippingContext.js +172 -87
- package/src/renderers/common/Color4.js +40 -0
- package/src/renderers/common/ComputePipeline.js +24 -0
- package/src/renderers/common/Constants.js +2 -1
- package/src/renderers/common/CubeRenderTarget.js +77 -7
- package/src/renderers/common/DataMap.js +37 -1
- package/src/renderers/common/Geometries.js +163 -14
- package/src/renderers/common/IndirectStorageBufferAttribute.js +38 -0
- package/src/renderers/common/Info.js +81 -36
- package/src/renderers/common/InspectorBase.js +146 -0
- package/src/renderers/common/Lighting.js +57 -0
- package/src/renderers/common/Pipeline.js +22 -0
- package/src/renderers/common/Pipelines.js +150 -7
- package/src/renderers/common/PostProcessing.js +22 -84
- package/src/renderers/common/ProgrammableStage.js +60 -2
- package/src/renderers/common/QuadMesh.js +63 -6
- package/src/renderers/common/RenderBundle.js +14 -8
- package/src/renderers/common/RenderBundles.js +40 -10
- package/src/renderers/common/RenderContext.js +219 -4
- package/src/renderers/common/RenderContexts.js +54 -17
- package/src/renderers/common/RenderList.js +233 -24
- package/src/renderers/common/RenderLists.js +46 -6
- package/src/renderers/common/RenderObject.js +548 -46
- package/src/renderers/common/RenderObjectPipeline.js +40 -0
- package/src/renderers/common/RenderObjects.js +133 -15
- package/src/renderers/common/RenderPipeline.js +216 -6
- package/src/renderers/common/Renderer.js +2155 -332
- package/src/renderers/common/RendererUtils.js +200 -0
- package/src/renderers/common/SampledTexture.js +99 -39
- package/src/renderers/common/Sampler.js +148 -1
- package/src/renderers/common/Storage3DTexture.js +100 -0
- package/src/renderers/common/StorageArrayTexture.js +84 -0
- package/src/renderers/common/StorageBuffer.js +38 -2
- package/src/renderers/common/StorageBufferAttribute.js +31 -2
- package/src/renderers/common/StorageInstancedBufferAttribute.js +31 -2
- package/src/renderers/common/StorageTexture.js +65 -0
- package/src/renderers/common/Textures.js +273 -57
- package/src/renderers/common/TimestampQueryPool.js +163 -0
- package/src/renderers/common/Uniform.js +233 -3
- package/src/renderers/common/UniformBuffer.js +19 -0
- package/src/renderers/common/UniformsGroup.js +235 -26
- package/src/renderers/common/XRManager.js +1677 -0
- package/src/renderers/common/XRRenderTarget.js +91 -0
- package/src/renderers/common/extras/PMREMGenerator.js +371 -108
- package/src/renderers/common/nodes/NodeBuilderState.js +100 -6
- package/src/renderers/common/nodes/NodeLibrary.js +95 -17
- package/src/renderers/common/nodes/NodeManager.js +852 -0
- package/src/renderers/common/nodes/NodeSampledTexture.js +84 -8
- package/src/renderers/common/nodes/NodeSampler.js +41 -1
- package/src/renderers/common/nodes/NodeStorageBuffer.js +48 -3
- package/src/renderers/common/nodes/NodeUniform.js +285 -2
- package/src/renderers/common/nodes/NodeUniformBuffer.js +81 -0
- package/src/renderers/common/nodes/NodeUniformsGroup.js +31 -18
- package/src/renderers/shaders/DFGLUTData.js +49 -0
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/color_fragment.glsl.js +1 -5
- package/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.js +1 -5
- package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +1 -5
- package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +8 -10
- package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +4 -24
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +0 -12
- package/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +7 -11
- package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +5 -2
- package/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +6 -2
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +8 -4
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +154 -59
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/packing.glsl.js +20 -4
- package/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +230 -181
- package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +7 -7
- package/src/renderers/shaders/ShaderChunk.js +3 -3
- package/src/renderers/shaders/ShaderLib/background.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +14 -2
- package/src/renderers/shaders/ShaderLib/{distanceRGBA.glsl.js → distance.glsl.js} +1 -2
- package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +2 -1
- package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +1 -2
- package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +2 -1
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +4 -9
- package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +0 -1
- package/src/renderers/shaders/ShaderLib/shadow.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/vsm.glsl.js +4 -6
- package/src/renderers/shaders/ShaderLib.js +7 -5
- package/src/renderers/shaders/UniformsLib.js +2 -7
- package/src/renderers/shaders/UniformsUtils.js +21 -2
- package/src/renderers/webgl/WebGLAttributes.js +4 -0
- package/src/renderers/webgl/WebGLBackground.js +30 -5
- package/src/renderers/webgl/WebGLBindingStates.js +99 -27
- package/src/renderers/webgl/WebGLBufferRenderer.js +2 -6
- package/src/renderers/webgl/WebGLCapabilities.js +7 -14
- package/src/renderers/webgl/WebGLEnvironments.js +228 -0
- package/src/renderers/webgl/WebGLExtensions.js +2 -25
- package/src/renderers/webgl/WebGLGeometries.js +10 -35
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +2 -6
- package/src/renderers/webgl/WebGLInfo.js +3 -1
- package/src/renderers/webgl/WebGLLights.js +18 -1
- package/src/renderers/webgl/WebGLMaterials.js +12 -0
- package/src/renderers/webgl/WebGLObjects.js +3 -1
- package/src/renderers/webgl/WebGLOutput.js +267 -0
- package/src/renderers/webgl/WebGLProgram.js +87 -148
- package/src/renderers/webgl/WebGLPrograms.js +53 -51
- package/src/renderers/webgl/WebGLRenderLists.js +15 -0
- package/src/renderers/webgl/WebGLShadowMap.js +204 -28
- package/src/renderers/webgl/WebGLState.js +88 -56
- package/src/renderers/webgl/WebGLTextures.js +293 -59
- package/src/renderers/webgl/WebGLUniforms.js +40 -3
- package/src/renderers/webgl/WebGLUniformsGroups.js +5 -3
- package/src/renderers/webgl/WebGLUtils.js +7 -5
- package/src/renderers/webgl-fallback/WebGLBackend.js +1416 -293
- package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +5 -10
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +785 -92
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +62 -1
- package/src/renderers/webgl-fallback/utils/WebGLCapabilities.js +28 -0
- package/src/renderers/webgl-fallback/utils/WebGLConstants.js +3 -3
- package/src/renderers/webgl-fallback/utils/WebGLExtensions.js +45 -0
- package/src/renderers/webgl-fallback/utils/WebGLState.js +584 -20
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +468 -80
- package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +396 -0
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +72 -24
- package/src/renderers/webgpu/WebGPUBackend.js +1517 -428
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +31 -4
- package/src/renderers/webgpu/WebGPURenderer.js +55 -4
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +23 -16
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +37 -42
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +1335 -241
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +32 -4
- package/src/renderers/webgpu/nodes/WGSLNodeParser.js +11 -0
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +144 -20
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +460 -116
- package/src/renderers/webgpu/utils/WebGPUConstants.js +17 -4
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +283 -69
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +225 -178
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +583 -191
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +310 -0
- package/src/renderers/webgpu/utils/WebGPUUtils.js +150 -28
- package/src/renderers/webxr/WebXRController.js +87 -2
- package/src/renderers/webxr/WebXRDepthSensing.js +52 -7
- package/src/renderers/webxr/WebXRManager.js +275 -15
- package/src/scenes/Fog.js +60 -0
- package/src/scenes/FogExp2.js +51 -0
- package/src/scenes/Scene.js +88 -0
- package/src/textures/CanvasTexture.js +28 -0
- package/src/textures/CompressedArrayTexture.js +57 -0
- package/src/textures/CompressedCubeTexture.js +29 -0
- package/src/textures/CompressedTexture.js +64 -6
- package/src/textures/CubeDepthTexture.js +76 -0
- package/src/textures/CubeTexture.js +52 -4
- package/src/textures/Data3DTexture.js +79 -2
- package/src/textures/DataArrayTexture.js +93 -0
- package/src/textures/DataTexture.js +65 -0
- package/src/textures/DepthTexture.js +59 -11
- package/src/textures/ExternalTexture.js +56 -0
- package/src/textures/FramebufferTexture.js +62 -0
- package/src/textures/Source.js +106 -4
- package/src/textures/Texture.js +488 -6
- package/src/textures/VideoFrameTexture.js +72 -0
- package/src/textures/VideoTexture.js +78 -6
- package/src/utils.js +322 -3
- package/examples/jsm/animation/MMDAnimationHelper.js +0 -1207
- package/examples/jsm/animation/MMDPhysics.js +0 -1406
- package/examples/jsm/cameras/CinematicCamera.js +0 -208
- package/examples/jsm/effects/PeppersGhostEffect.js +0 -153
- package/examples/jsm/exporters/MMDExporter.js +0 -217
- package/examples/jsm/geometries/InstancedPointsGeometry.js +0 -174
- package/examples/jsm/geometries/ParametricGeometries.js +0 -254
- package/examples/jsm/libs/mmdparser.module.js +0 -11530
- package/examples/jsm/loaders/GLTFLoaderAnimationPointer.js +0 -729
- package/examples/jsm/loaders/MMDLoader.js +0 -2295
- package/examples/jsm/loaders/RGBMLoader.js +0 -1081
- package/examples/jsm/materials/MeshGouraudMaterial.js +0 -432
- package/examples/jsm/materials/MeshPostProcessingMaterial.js +0 -144
- package/examples/jsm/misc/Timer.js +0 -128
- package/examples/jsm/objects/InstancedPoints.js +0 -21
- package/examples/jsm/shaders/GodRaysShader.js +0 -321
- package/examples/jsm/shaders/MMDToonShader.js +0 -134
- package/src/materials/nodes/InstancedPointsNodeMaterial.js +0 -156
- package/src/nodes/accessors/InstancedPointsMaterialNode.js +0 -24
- package/src/nodes/accessors/SceneNode.js +0 -55
- package/src/nodes/code/ScriptableNode.js +0 -505
- package/src/nodes/code/ScriptableValueNode.js +0 -170
- package/src/nodes/core/CacheNode.js +0 -50
- package/src/nodes/core/UniformGroup.js +0 -13
- package/src/nodes/display/AfterImageNode.js +0 -158
- package/src/nodes/display/AnaglyphPassNode.js +0 -67
- package/src/nodes/display/AnamorphicNode.js +0 -151
- package/src/nodes/display/BlendMode.js +0 -54
- package/src/nodes/display/BloomNode.js +0 -341
- package/src/nodes/display/DenoiseNode.js +0 -204
- package/src/nodes/display/DepthOfFieldNode.js +0 -124
- package/src/nodes/display/DotScreenNode.js +0 -66
- package/src/nodes/display/FXAANode.js +0 -332
- package/src/nodes/display/FilmNode.js +0 -56
- package/src/nodes/display/GTAONode.js +0 -331
- package/src/nodes/display/GaussianBlurNode.js +0 -213
- package/src/nodes/display/Lut3DNode.js +0 -57
- package/src/nodes/display/MotionBlur.js +0 -25
- package/src/nodes/display/ParallaxBarrierPassNode.js +0 -58
- package/src/nodes/display/PixelationPassNode.js +0 -213
- package/src/nodes/display/PosterizeNode.js +0 -33
- package/src/nodes/display/RGBShiftNode.js +0 -53
- package/src/nodes/display/StereoCompositePassNode.js +0 -110
- package/src/nodes/display/TransitionNode.js +0 -80
- 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/nodes/functions/BSDF/DFGApprox.js +0 -30
- package/src/nodes/utils/EquirectUVNode.js +0 -36
- package/src/nodes/utils/MatcapUVNode.js +0 -33
- package/src/nodes/utils/OscNode.js +0 -85
- package/src/nodes/utils/SpriteSheetUVNode.js +0 -45
- package/src/nodes/utils/TimerNode.js +0 -97
- package/src/nodes/utils/TriplanarTexturesNode.js +0 -64
- package/src/renderers/common/nodes/Nodes.js +0 -534
- package/src/renderers/webgl/WebGLCubeMaps.js +0 -99
- package/src/renderers/webgl/WebGLCubeUVMaps.js +0 -136
|
@@ -10,10 +10,7 @@ import {
|
|
|
10
10
|
Matrix4,
|
|
11
11
|
Mesh,
|
|
12
12
|
MeshStandardMaterial,
|
|
13
|
-
ShaderMaterial,
|
|
14
13
|
SRGBColorSpace,
|
|
15
|
-
UniformsLib,
|
|
16
|
-
UniformsUtils,
|
|
17
14
|
Vector3,
|
|
18
15
|
Ray
|
|
19
16
|
} from 'three';
|
|
@@ -45,134 +42,6 @@ const COLOR_SPACE_LDRAW = SRGBColorSpace;
|
|
|
45
42
|
const _tempVec0 = new Vector3();
|
|
46
43
|
const _tempVec1 = new Vector3();
|
|
47
44
|
|
|
48
|
-
class LDrawConditionalLineMaterial extends ShaderMaterial {
|
|
49
|
-
|
|
50
|
-
constructor( parameters ) {
|
|
51
|
-
|
|
52
|
-
super( {
|
|
53
|
-
|
|
54
|
-
uniforms: UniformsUtils.merge( [
|
|
55
|
-
UniformsLib.fog,
|
|
56
|
-
{
|
|
57
|
-
diffuse: {
|
|
58
|
-
value: new Color()
|
|
59
|
-
},
|
|
60
|
-
opacity: {
|
|
61
|
-
value: 1.0
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
] ),
|
|
65
|
-
|
|
66
|
-
vertexShader: /* glsl */`
|
|
67
|
-
attribute vec3 control0;
|
|
68
|
-
attribute vec3 control1;
|
|
69
|
-
attribute vec3 direction;
|
|
70
|
-
varying float discardFlag;
|
|
71
|
-
|
|
72
|
-
#include <common>
|
|
73
|
-
#include <color_pars_vertex>
|
|
74
|
-
#include <fog_pars_vertex>
|
|
75
|
-
#include <logdepthbuf_pars_vertex>
|
|
76
|
-
#include <clipping_planes_pars_vertex>
|
|
77
|
-
void main() {
|
|
78
|
-
#include <color_vertex>
|
|
79
|
-
|
|
80
|
-
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
|
|
81
|
-
gl_Position = projectionMatrix * mvPosition;
|
|
82
|
-
|
|
83
|
-
// Transform the line segment ends and control points into camera clip space
|
|
84
|
-
vec4 c0 = projectionMatrix * modelViewMatrix * vec4( control0, 1.0 );
|
|
85
|
-
vec4 c1 = projectionMatrix * modelViewMatrix * vec4( control1, 1.0 );
|
|
86
|
-
vec4 p0 = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
87
|
-
vec4 p1 = projectionMatrix * modelViewMatrix * vec4( position + direction, 1.0 );
|
|
88
|
-
|
|
89
|
-
c0.xy /= c0.w;
|
|
90
|
-
c1.xy /= c1.w;
|
|
91
|
-
p0.xy /= p0.w;
|
|
92
|
-
p1.xy /= p1.w;
|
|
93
|
-
|
|
94
|
-
// Get the direction of the segment and an orthogonal vector
|
|
95
|
-
vec2 dir = p1.xy - p0.xy;
|
|
96
|
-
vec2 norm = vec2( -dir.y, dir.x );
|
|
97
|
-
|
|
98
|
-
// Get control point directions from the line
|
|
99
|
-
vec2 c0dir = c0.xy - p1.xy;
|
|
100
|
-
vec2 c1dir = c1.xy - p1.xy;
|
|
101
|
-
|
|
102
|
-
// If the vectors to the controls points are pointed in different directions away
|
|
103
|
-
// from the line segment then the line should not be drawn.
|
|
104
|
-
float d0 = dot( normalize( norm ), normalize( c0dir ) );
|
|
105
|
-
float d1 = dot( normalize( norm ), normalize( c1dir ) );
|
|
106
|
-
discardFlag = float( sign( d0 ) != sign( d1 ) );
|
|
107
|
-
|
|
108
|
-
#include <logdepthbuf_vertex>
|
|
109
|
-
#include <clipping_planes_vertex>
|
|
110
|
-
#include <fog_vertex>
|
|
111
|
-
}
|
|
112
|
-
`,
|
|
113
|
-
|
|
114
|
-
fragmentShader: /* glsl */`
|
|
115
|
-
uniform vec3 diffuse;
|
|
116
|
-
uniform float opacity;
|
|
117
|
-
varying float discardFlag;
|
|
118
|
-
|
|
119
|
-
#include <common>
|
|
120
|
-
#include <color_pars_fragment>
|
|
121
|
-
#include <fog_pars_fragment>
|
|
122
|
-
#include <logdepthbuf_pars_fragment>
|
|
123
|
-
#include <clipping_planes_pars_fragment>
|
|
124
|
-
void main() {
|
|
125
|
-
|
|
126
|
-
if ( discardFlag > 0.5 ) discard;
|
|
127
|
-
|
|
128
|
-
#include <clipping_planes_fragment>
|
|
129
|
-
vec3 outgoingLight = vec3( 0.0 );
|
|
130
|
-
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
131
|
-
#include <logdepthbuf_fragment>
|
|
132
|
-
#include <color_fragment>
|
|
133
|
-
outgoingLight = diffuseColor.rgb; // simple shader
|
|
134
|
-
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
|
|
135
|
-
#include <tonemapping_fragment>
|
|
136
|
-
#include <colorspace_fragment>
|
|
137
|
-
#include <fog_fragment>
|
|
138
|
-
#include <premultiplied_alpha_fragment>
|
|
139
|
-
}
|
|
140
|
-
`,
|
|
141
|
-
|
|
142
|
-
} );
|
|
143
|
-
|
|
144
|
-
Object.defineProperties( this, {
|
|
145
|
-
|
|
146
|
-
opacity: {
|
|
147
|
-
get: function () {
|
|
148
|
-
|
|
149
|
-
return this.uniforms.opacity.value;
|
|
150
|
-
|
|
151
|
-
},
|
|
152
|
-
|
|
153
|
-
set: function ( value ) {
|
|
154
|
-
|
|
155
|
-
this.uniforms.opacity.value = value;
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
|
|
160
|
-
color: {
|
|
161
|
-
get: function () {
|
|
162
|
-
|
|
163
|
-
return this.uniforms.diffuse.value;
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
} );
|
|
169
|
-
|
|
170
|
-
this.setValues( parameters );
|
|
171
|
-
this.isLDrawConditionalLineMaterial = true;
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
}
|
|
176
45
|
|
|
177
46
|
class ConditionalLineSegments extends LineSegments {
|
|
178
47
|
|
|
@@ -1795,7 +1664,7 @@ function createObject( loader, elements, elementSize, isConditionalSegments = fa
|
|
|
1795
1664
|
|
|
1796
1665
|
if ( numGroupVerts > 0 ) {
|
|
1797
1666
|
|
|
1798
|
-
bufferGeometry.addGroup( index0,
|
|
1667
|
+
bufferGeometry.addGroup( index0, numGroupVerts, materials.length - 1 );
|
|
1799
1668
|
|
|
1800
1669
|
}
|
|
1801
1670
|
|
|
@@ -1877,10 +1746,45 @@ function createObject( loader, elements, elementSize, isConditionalSegments = fa
|
|
|
1877
1746
|
|
|
1878
1747
|
}
|
|
1879
1748
|
|
|
1880
|
-
|
|
1881
|
-
|
|
1749
|
+
/**
|
|
1750
|
+
* A loader for the LDraw format.
|
|
1751
|
+
*
|
|
1752
|
+
* [LDraw](https://ldraw.org/} (LEGO Draw) is an [open format specification](https://ldraw.org/article/218.html)
|
|
1753
|
+
* for describing LEGO and other construction set 3D models.
|
|
1754
|
+
*
|
|
1755
|
+
* An LDraw asset (a text file usually with extension .ldr, .dat or .txt) can describe just a single construction
|
|
1756
|
+
* piece, or an entire model. In the case of a model the LDraw file can reference other LDraw files, which are
|
|
1757
|
+
* loaded from a library path set with `setPartsLibraryPath`. You usually download the LDraw official parts library,
|
|
1758
|
+
* extract to a folder and point setPartsLibraryPath to it.
|
|
1759
|
+
*
|
|
1760
|
+
* Library parts will be loaded by trial and error in subfolders 'parts', 'p' and 'models'. These file accesses
|
|
1761
|
+
* are not optimal for web environment, so a script tool has been made to pack an LDraw file with all its dependencies
|
|
1762
|
+
* into a single file, which loads much faster. See section 'Packing LDraw models'. The LDrawLoader example loads
|
|
1763
|
+
* several packed files. The official parts library is not included due to its large size.
|
|
1764
|
+
*
|
|
1765
|
+
* `LDrawLoader` supports the following extensions:
|
|
1766
|
+
* - !COLOUR: Color and surface finish declarations.
|
|
1767
|
+
* - BFC: Back Face Culling specification.
|
|
1768
|
+
* - !CATEGORY: Model/part category declarations.
|
|
1769
|
+
* - !KEYWORDS: Model/part keywords declarations.
|
|
1770
|
+
*
|
|
1771
|
+
* ```js
|
|
1772
|
+
* const loader = new LDrawLoader();
|
|
1773
|
+
* loader.setConditionalLineMaterial( LDrawConditionalLineMaterial ); // the type of line material depends on the used renderer
|
|
1774
|
+
* const object = await loader.loadAsync( 'models/ldraw/officialLibrary/models/car.ldr_Packed.mpd' );
|
|
1775
|
+
* scene.add( object );
|
|
1776
|
+
* ```
|
|
1777
|
+
*
|
|
1778
|
+
* @augments Loader
|
|
1779
|
+
* @three_import import { LDrawLoader } from 'three/addons/loaders/LDrawLoader.js';
|
|
1780
|
+
*/
|
|
1882
1781
|
class LDrawLoader extends Loader {
|
|
1883
1782
|
|
|
1783
|
+
/**
|
|
1784
|
+
* Constructs a new LDraw loader.
|
|
1785
|
+
*
|
|
1786
|
+
* @param {LoadingManager} [manager] - The loading manager.
|
|
1787
|
+
*/
|
|
1884
1788
|
constructor( manager ) {
|
|
1885
1789
|
|
|
1886
1790
|
super( manager );
|
|
@@ -1897,24 +1801,32 @@ class LDrawLoader extends Loader {
|
|
|
1897
1801
|
// This object is a map from file names to paths. It agilizes the paths search. If it is not set then files will be searched by trial and error.
|
|
1898
1802
|
this.fileMap = {};
|
|
1899
1803
|
|
|
1900
|
-
// Initializes the materials library with default materials
|
|
1901
|
-
this.setMaterials( [] );
|
|
1902
|
-
|
|
1903
1804
|
// If this flag is set to true the vertex normals will be smoothed.
|
|
1904
1805
|
this.smoothNormals = true;
|
|
1905
1806
|
|
|
1906
1807
|
// The path to load parts from the LDraw parts library from.
|
|
1907
1808
|
this.partsLibraryPath = '';
|
|
1908
1809
|
|
|
1810
|
+
// this material type must be injected via setConditionalLineMaterial()
|
|
1811
|
+
this.ConditionalLineMaterial = null;
|
|
1812
|
+
|
|
1909
1813
|
// Material assigned to not available colors for meshes and edges
|
|
1910
1814
|
this.missingColorMaterial = new MeshStandardMaterial( { name: Loader.DEFAULT_MATERIAL_NAME, color: 0xFF00FF, roughness: 0.3, metalness: 0 } );
|
|
1911
1815
|
this.missingEdgeColorMaterial = new LineBasicMaterial( { name: Loader.DEFAULT_MATERIAL_NAME, color: 0xFF00FF } );
|
|
1912
|
-
this.missingConditionalEdgeColorMaterial =
|
|
1816
|
+
this.missingConditionalEdgeColorMaterial = null;
|
|
1913
1817
|
this.edgeMaterialCache.set( this.missingColorMaterial, this.missingEdgeColorMaterial );
|
|
1914
1818
|
this.conditionalEdgeMaterialCache.set( this.missingEdgeColorMaterial, this.missingConditionalEdgeColorMaterial );
|
|
1915
1819
|
|
|
1916
1820
|
}
|
|
1917
1821
|
|
|
1822
|
+
/**
|
|
1823
|
+
* This method must be called prior to `load()` unless the model to load does not reference
|
|
1824
|
+
* library parts (usually it will be a model with all its parts packed in a single file).
|
|
1825
|
+
*
|
|
1826
|
+
* @param {string} path - Path to library parts files to load referenced parts from.
|
|
1827
|
+
* This is different from Loader.setPath, which indicates the path to load the main asset from.
|
|
1828
|
+
* @return {LDrawLoader} A reference to this loader.
|
|
1829
|
+
*/
|
|
1918
1830
|
setPartsLibraryPath( path ) {
|
|
1919
1831
|
|
|
1920
1832
|
this.partsLibraryPath = path;
|
|
@@ -1922,6 +1834,33 @@ class LDrawLoader extends Loader {
|
|
|
1922
1834
|
|
|
1923
1835
|
}
|
|
1924
1836
|
|
|
1837
|
+
/**
|
|
1838
|
+
* Sets the conditional line material type which depends on the used renderer.
|
|
1839
|
+
* Use {@link LDrawConditionalLineMaterial} when using `WebGLRenderer` and
|
|
1840
|
+
* {@link LDrawConditionalLineNodeMaterial} when using `WebGPURenderer`.
|
|
1841
|
+
*
|
|
1842
|
+
* @param {(LDrawConditionalLineMaterial.constructor|LDrawConditionalLineNodeMaterial.constructor)} type - The conditional line material type.
|
|
1843
|
+
* @return {LDrawLoader} A reference to this loader.
|
|
1844
|
+
*/
|
|
1845
|
+
setConditionalLineMaterial( type ) {
|
|
1846
|
+
|
|
1847
|
+
this.ConditionalLineMaterial = type;
|
|
1848
|
+
this.missingConditionalEdgeColorMaterial = new this.ConditionalLineMaterial( { name: Loader.DEFAULT_MATERIAL_NAME, fog: true, color: 0xFF00FF } );
|
|
1849
|
+
return this;
|
|
1850
|
+
|
|
1851
|
+
}
|
|
1852
|
+
|
|
1853
|
+
/**
|
|
1854
|
+
* This async method preloads materials from a single LDraw file. In the official
|
|
1855
|
+
* parts library there is a special file which is loaded always the first (LDConfig.ldr)
|
|
1856
|
+
* and contains all the standard color codes. This method is intended to be used with
|
|
1857
|
+
* not packed files, for example in an editor where materials are preloaded and parts
|
|
1858
|
+
* are loaded on demand.
|
|
1859
|
+
*
|
|
1860
|
+
* @async
|
|
1861
|
+
* @param {string} url - Path of the LDraw materials asset.
|
|
1862
|
+
* @return {Promise} A Promise that resolves when the preload has finished.
|
|
1863
|
+
*/
|
|
1925
1864
|
async preloadMaterials( url ) {
|
|
1926
1865
|
|
|
1927
1866
|
const fileLoader = new FileLoader( this.manager );
|
|
@@ -1946,10 +1885,19 @@ class LDrawLoader extends Loader {
|
|
|
1946
1885
|
|
|
1947
1886
|
}
|
|
1948
1887
|
|
|
1949
|
-
this.
|
|
1888
|
+
this.addMaterials( materials );
|
|
1950
1889
|
|
|
1951
1890
|
}
|
|
1952
1891
|
|
|
1892
|
+
/**
|
|
1893
|
+
* Starts loading from the given URL and passes the loaded LDraw asset
|
|
1894
|
+
* to the `onLoad()` callback.
|
|
1895
|
+
*
|
|
1896
|
+
* @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
|
|
1897
|
+
* @param {function(Group)} onLoad - Executed when the loading process has been finished.
|
|
1898
|
+
* @param {onProgressCallback} onProgress - Executed while the loading is in progress.
|
|
1899
|
+
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
1900
|
+
*/
|
|
1953
1901
|
load( url, onLoad, onProgress, onError ) {
|
|
1954
1902
|
|
|
1955
1903
|
const fileLoader = new FileLoader( this.manager );
|
|
@@ -1958,8 +1906,11 @@ class LDrawLoader extends Loader {
|
|
|
1958
1906
|
fileLoader.setWithCredentials( this.withCredentials );
|
|
1959
1907
|
fileLoader.load( url, text => {
|
|
1960
1908
|
|
|
1909
|
+
// Initializes the materials library with default materials
|
|
1910
|
+
this.addDefaultMaterials();
|
|
1911
|
+
|
|
1961
1912
|
this.partsCache
|
|
1962
|
-
.parseModel( text
|
|
1913
|
+
.parseModel( text )
|
|
1963
1914
|
.then( group => {
|
|
1964
1915
|
|
|
1965
1916
|
this.applyMaterialsToMesh( group, MAIN_COLOUR_CODE, this.materialLibrary, true );
|
|
@@ -1974,10 +1925,17 @@ class LDrawLoader extends Loader {
|
|
|
1974
1925
|
|
|
1975
1926
|
}
|
|
1976
1927
|
|
|
1928
|
+
/**
|
|
1929
|
+
* Parses the given LDraw data and returns the resulting group.
|
|
1930
|
+
*
|
|
1931
|
+
* @param {string} text - The raw VRML data as a string.
|
|
1932
|
+
* @param {function(Group)} onLoad - Executed when the loading/parsing process has been finished.
|
|
1933
|
+
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
1934
|
+
*/
|
|
1977
1935
|
parse( text, onLoad, onError ) {
|
|
1978
1936
|
|
|
1979
1937
|
this.partsCache
|
|
1980
|
-
.parseModel( text
|
|
1938
|
+
.parseModel( text )
|
|
1981
1939
|
.then( group => {
|
|
1982
1940
|
|
|
1983
1941
|
this.applyMaterialsToMesh( group, MAIN_COLOUR_CODE, this.materialLibrary, true );
|
|
@@ -1990,16 +1948,61 @@ class LDrawLoader extends Loader {
|
|
|
1990
1948
|
|
|
1991
1949
|
}
|
|
1992
1950
|
|
|
1951
|
+
/**
|
|
1952
|
+
* Sets the loader's material library. This method clears existing
|
|
1953
|
+
* material definitions.
|
|
1954
|
+
*
|
|
1955
|
+
* @param {Array<Material>} materials - The materials to set.
|
|
1956
|
+
* @return {LDrawLoader} A reference to this loader.
|
|
1957
|
+
*/
|
|
1993
1958
|
setMaterials( materials ) {
|
|
1994
1959
|
|
|
1960
|
+
this.clearMaterials();
|
|
1961
|
+
this.addMaterials( materials );
|
|
1962
|
+
|
|
1963
|
+
return this;
|
|
1964
|
+
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1967
|
+
/**
|
|
1968
|
+
* Clears the loader's material library.
|
|
1969
|
+
*
|
|
1970
|
+
* @return {LDrawLoader} A reference to this loader.
|
|
1971
|
+
*/
|
|
1972
|
+
clearMaterials() {
|
|
1973
|
+
|
|
1995
1974
|
this.materialLibrary = {};
|
|
1996
1975
|
this.materials = [];
|
|
1976
|
+
|
|
1977
|
+
return this;
|
|
1978
|
+
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1981
|
+
/**
|
|
1982
|
+
* Adds a list of materials to the loader's material library.
|
|
1983
|
+
*
|
|
1984
|
+
* @param {Array<Material>} materials - The materials to add.
|
|
1985
|
+
* @return {LDrawLoader} A reference to this loader.
|
|
1986
|
+
*/
|
|
1987
|
+
addMaterials( materials ) {
|
|
1988
|
+
|
|
1997
1989
|
for ( let i = 0, l = materials.length; i < l; i ++ ) {
|
|
1998
1990
|
|
|
1999
1991
|
this.addMaterial( materials[ i ] );
|
|
2000
1992
|
|
|
2001
1993
|
}
|
|
2002
1994
|
|
|
1995
|
+
return this;
|
|
1996
|
+
|
|
1997
|
+
}
|
|
1998
|
+
|
|
1999
|
+
/**
|
|
2000
|
+
* Initializes the loader with default materials.
|
|
2001
|
+
*
|
|
2002
|
+
* @return {LDrawLoader} A reference to this loader.
|
|
2003
|
+
*/
|
|
2004
|
+
addDefaultMaterials() {
|
|
2005
|
+
|
|
2003
2006
|
// Add default main triangle and line edge materials (used in pieces that can be colored with a main color)
|
|
2004
2007
|
this.addMaterial( this.parseColorMetaDirective( new LineParser( 'Main_Colour CODE 16 VALUE #FF8080 EDGE #333333' ) ) );
|
|
2005
2008
|
this.addMaterial( this.parseColorMetaDirective( new LineParser( 'Edge_Colour CODE 24 VALUE #A0A0A0 EDGE #333333' ) ) );
|
|
@@ -2008,6 +2011,14 @@ class LDrawLoader extends Loader {
|
|
|
2008
2011
|
|
|
2009
2012
|
}
|
|
2010
2013
|
|
|
2014
|
+
/**
|
|
2015
|
+
* Sets a map which maps referenced library filenames to new filenames.
|
|
2016
|
+
* If a fileMap is not specified (the default), library parts will be accessed by trial and
|
|
2017
|
+
* error in subfolders 'parts', 'p' and 'models'.
|
|
2018
|
+
*
|
|
2019
|
+
* @param {Object<string,string>} fileMap - The file map to set.
|
|
2020
|
+
* @return {LDrawLoader} A reference to this loader.
|
|
2021
|
+
*/
|
|
2011
2022
|
setFileMap( fileMap ) {
|
|
2012
2023
|
|
|
2013
2024
|
this.fileMap = fileMap;
|
|
@@ -2016,6 +2027,12 @@ class LDrawLoader extends Loader {
|
|
|
2016
2027
|
|
|
2017
2028
|
}
|
|
2018
2029
|
|
|
2030
|
+
/**
|
|
2031
|
+
* Adds a single material to the loader's material library.
|
|
2032
|
+
*
|
|
2033
|
+
* @param {Material} material - The material to add.
|
|
2034
|
+
* @return {LDrawLoader} A reference to this loader.
|
|
2035
|
+
*/
|
|
2019
2036
|
addMaterial( material ) {
|
|
2020
2037
|
|
|
2021
2038
|
// Adds a material to the material library which is on top of the parse scopes stack. And also to the materials array
|
|
@@ -2032,6 +2049,12 @@ class LDrawLoader extends Loader {
|
|
|
2032
2049
|
|
|
2033
2050
|
}
|
|
2034
2051
|
|
|
2052
|
+
/**
|
|
2053
|
+
* Returns a material for the given color code.
|
|
2054
|
+
*
|
|
2055
|
+
* @param {string} colorCode - The color code.
|
|
2056
|
+
* @return {?Material} The material. Returns `null` if no material has been found.
|
|
2057
|
+
*/
|
|
2035
2058
|
getMaterial( colorCode ) {
|
|
2036
2059
|
|
|
2037
2060
|
if ( colorCode.startsWith( '0x2' ) ) {
|
|
@@ -2109,7 +2132,7 @@ class LDrawLoader extends Loader {
|
|
|
2109
2132
|
|
|
2110
2133
|
} else if ( finalMaterialPass ) {
|
|
2111
2134
|
|
|
2112
|
-
// see if we can get the final material from
|
|
2135
|
+
// see if we can get the final material from the "getMaterial" function which will attempt to
|
|
2113
2136
|
// parse the "direct" colors
|
|
2114
2137
|
material = loader.getMaterial( colorCode );
|
|
2115
2138
|
if ( material === null ) {
|
|
@@ -2147,12 +2170,31 @@ class LDrawLoader extends Loader {
|
|
|
2147
2170
|
|
|
2148
2171
|
}
|
|
2149
2172
|
|
|
2173
|
+
/**
|
|
2174
|
+
* Returns the Material for the main LDraw color.
|
|
2175
|
+
*
|
|
2176
|
+
* For an already loaded LDraw asset, returns the Material associated with the main color code.
|
|
2177
|
+
* This method can be useful to modify the main material of a model or part that exposes it.
|
|
2178
|
+
*
|
|
2179
|
+
* The main color code is the standard way to color an LDraw part. It is '16' for triangles and
|
|
2180
|
+
* '24' for edges. Usually a complete model will not expose the main color (that is, no part
|
|
2181
|
+
* uses the code '16' at the top level, because they are assigned other specific colors) An LDraw
|
|
2182
|
+
* part file on the other hand will expose the code '16' to be colored, and can have additional
|
|
2183
|
+
* fixed colors.
|
|
2184
|
+
*
|
|
2185
|
+
* @return {?Material} The material. Returns `null` if no material has been found.
|
|
2186
|
+
*/
|
|
2150
2187
|
getMainMaterial() {
|
|
2151
2188
|
|
|
2152
2189
|
return this.getMaterial( MAIN_COLOUR_CODE );
|
|
2153
2190
|
|
|
2154
2191
|
}
|
|
2155
2192
|
|
|
2193
|
+
/**
|
|
2194
|
+
* Returns the material for the edges main LDraw color.
|
|
2195
|
+
*
|
|
2196
|
+
* @return {?Material} The material. Returns `null` if no material has been found.
|
|
2197
|
+
*/
|
|
2156
2198
|
getMainEdgeMaterial() {
|
|
2157
2199
|
|
|
2158
2200
|
const mat = this.getMaterial( MAIN_EDGE_COLOUR_CODE );
|
|
@@ -2271,7 +2313,7 @@ class LDrawLoader extends Loader {
|
|
|
2271
2313
|
|
|
2272
2314
|
if ( ! parseLuminance( lineParser.getToken() ) ) {
|
|
2273
2315
|
|
|
2274
|
-
throw new Error( 'LDrawLoader: Invalid luminance value in material definition' +
|
|
2316
|
+
throw new Error( 'LDrawLoader: Invalid luminance value in material definition' + lineParser.getLineNumberString() + '.' );
|
|
2275
2317
|
|
|
2276
2318
|
}
|
|
2277
2319
|
|
|
@@ -2358,7 +2400,6 @@ class LDrawLoader extends Loader {
|
|
|
2358
2400
|
|
|
2359
2401
|
material.color.setStyle( fillColor, COLOR_SPACE_LDRAW );
|
|
2360
2402
|
material.transparent = isTransparent;
|
|
2361
|
-
material.premultipliedAlpha = true;
|
|
2362
2403
|
material.opacity = alpha;
|
|
2363
2404
|
material.depthWrite = ! isTransparent;
|
|
2364
2405
|
|
|
@@ -2384,8 +2425,14 @@ class LDrawLoader extends Loader {
|
|
|
2384
2425
|
edgeMaterial.userData.code = code;
|
|
2385
2426
|
edgeMaterial.name = name + ' - Edge';
|
|
2386
2427
|
|
|
2428
|
+
if ( this.ConditionalLineMaterial === null ) {
|
|
2429
|
+
|
|
2430
|
+
throw new Error( 'THREE.LDrawLoader: ConditionalLineMaterial type must be specified via .setConditionalLineMaterial().' );
|
|
2431
|
+
|
|
2432
|
+
}
|
|
2433
|
+
|
|
2387
2434
|
// This is the material used for conditional edges
|
|
2388
|
-
const conditionalEdgeMaterial = new
|
|
2435
|
+
const conditionalEdgeMaterial = new this.ConditionalLineMaterial( {
|
|
2389
2436
|
|
|
2390
2437
|
fog: true,
|
|
2391
2438
|
transparent: isTransparent,
|
|
@@ -1,41 +1,72 @@
|
|
|
1
|
-
// http://download.autodesk.com/us/systemdocs/help/2011/lustre/index.html?url=./files/WSc4e151a45a3b785a24c3d9a411df9298473-7ffd.htm,topicNumber=d0e9492
|
|
2
|
-
// https://community.foundry.com/discuss/topic/103636/format-spec-for-3dl?mode=Post&postID=895258
|
|
3
|
-
|
|
4
1
|
import {
|
|
5
2
|
ClampToEdgeWrapping,
|
|
6
3
|
Data3DTexture,
|
|
7
4
|
FileLoader,
|
|
8
|
-
FloatType,
|
|
9
5
|
LinearFilter,
|
|
10
6
|
Loader,
|
|
11
7
|
RGBAFormat,
|
|
12
8
|
UnsignedByteType,
|
|
13
9
|
} from 'three';
|
|
14
10
|
|
|
11
|
+
/**
|
|
12
|
+
* A loader for the 3DL LUT format.
|
|
13
|
+
*
|
|
14
|
+
* References:
|
|
15
|
+
* - [3D LUTs](http://download.autodesk.com/us/systemdocs/help/2011/lustre/index.html?url=./files/WSc4e151a45a3b785a24c3d9a411df9298473-7ffd.htm,topicNumber=d0e9492)
|
|
16
|
+
* - [Format Spec for .3dl](https://community.foundry.com/discuss/topic/103636/format-spec-for-3dl?mode=Post&postID=895258)
|
|
17
|
+
*
|
|
18
|
+
* ```js
|
|
19
|
+
* const loader = new LUT3dlLoader();
|
|
20
|
+
* const map = loader.loadAsync( 'luts/Presetpro-Cinematic.3dl' );
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @augments Loader
|
|
24
|
+
* @three_import import { LUT3dlLoader } from 'three/addons/loaders/LUT3dlLoader.js';
|
|
25
|
+
*/
|
|
15
26
|
export class LUT3dlLoader extends Loader {
|
|
16
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Constructs a new 3DL LUT loader.
|
|
30
|
+
*
|
|
31
|
+
* @param {LoadingManager} [manager] - The loading manager.
|
|
32
|
+
*/
|
|
17
33
|
constructor( manager ) {
|
|
18
34
|
|
|
19
35
|
super( manager );
|
|
20
36
|
|
|
37
|
+
/**
|
|
38
|
+
* The texture type.
|
|
39
|
+
*
|
|
40
|
+
* @type {(UnsignedByteType|FloatType)}
|
|
41
|
+
* @default UnsignedByteType
|
|
42
|
+
*/
|
|
21
43
|
this.type = UnsignedByteType;
|
|
22
44
|
|
|
23
45
|
}
|
|
24
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Sets the texture type.
|
|
49
|
+
*
|
|
50
|
+
* @param {(UnsignedByteType|FloatType)} type - The texture type to set.
|
|
51
|
+
* @return {LUT3dlLoader} A reference to this loader.
|
|
52
|
+
*/
|
|
25
53
|
setType( type ) {
|
|
26
54
|
|
|
27
|
-
if ( type !== UnsignedByteType && type !== FloatType ) {
|
|
28
|
-
|
|
29
|
-
throw new Error( 'LUT3dlLoader: Unsupported type' );
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
55
|
this.type = type;
|
|
34
56
|
|
|
35
57
|
return this;
|
|
36
58
|
|
|
37
59
|
}
|
|
38
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Starts loading from the given URL and passes the loaded 3DL LUT asset
|
|
63
|
+
* to the `onLoad()` callback.
|
|
64
|
+
*
|
|
65
|
+
* @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
|
|
66
|
+
* @param {function({size:number,texture3D:Data3DTexture})} onLoad - Executed when the loading process has been finished.
|
|
67
|
+
* @param {onProgressCallback} onProgress - Executed while the loading is in progress.
|
|
68
|
+
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
69
|
+
*/
|
|
39
70
|
load( url, onLoad, onProgress, onError ) {
|
|
40
71
|
|
|
41
72
|
const loader = new FileLoader( this.manager );
|
|
@@ -67,6 +98,12 @@ export class LUT3dlLoader extends Loader {
|
|
|
67
98
|
|
|
68
99
|
}
|
|
69
100
|
|
|
101
|
+
/**
|
|
102
|
+
* Parses the given 3DL LUT data and returns the resulting 3D data texture.
|
|
103
|
+
*
|
|
104
|
+
* @param {string} input - The raw 3DL LUT data as a string.
|
|
105
|
+
* @return {{size:number,texture3D:Data3DTexture}} The parsed 3DL LUT.
|
|
106
|
+
*/
|
|
70
107
|
parse( input ) {
|
|
71
108
|
|
|
72
109
|
const regExpGridInfo = /^[\d ]+$/m;
|
|
@@ -1,40 +1,71 @@
|
|
|
1
|
-
// https://wwwimages2.adobe.com/content/dam/acom/en/products/speedgrade/cc/pdfs/cube-lut-specification-1.0.pdf
|
|
2
|
-
|
|
3
1
|
import {
|
|
4
2
|
ClampToEdgeWrapping,
|
|
5
3
|
Data3DTexture,
|
|
6
4
|
FileLoader,
|
|
7
|
-
FloatType,
|
|
8
5
|
LinearFilter,
|
|
9
6
|
Loader,
|
|
10
7
|
UnsignedByteType,
|
|
11
8
|
Vector3,
|
|
12
9
|
} from 'three';
|
|
13
10
|
|
|
11
|
+
/**
|
|
12
|
+
* A loader for the Cube LUT format.
|
|
13
|
+
*
|
|
14
|
+
* References:
|
|
15
|
+
* - [Cube LUT Specification](https://web.archive.org/web/20220220033515/https://wwwimages2.adobe.com/content/dam/acom/en/products/speedgrade/cc/pdfs/cube-lut-specification-1.0.pdf)
|
|
16
|
+
*
|
|
17
|
+
* ```js
|
|
18
|
+
* const loader = new LUTCubeLoader();
|
|
19
|
+
* const map = loader.loadAsync( 'luts/Bourbon 64.CUBE' );
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @augments Loader
|
|
23
|
+
* @three_import import { LUTCubeLoader } from 'three/addons/loaders/LUTCubeLoader.js';
|
|
24
|
+
*/
|
|
14
25
|
export class LUTCubeLoader extends Loader {
|
|
15
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Constructs a new Cube LUT loader.
|
|
29
|
+
*
|
|
30
|
+
* @param {LoadingManager} [manager] - The loading manager.
|
|
31
|
+
*/
|
|
16
32
|
constructor( manager ) {
|
|
17
33
|
|
|
18
34
|
super( manager );
|
|
19
35
|
|
|
36
|
+
/**
|
|
37
|
+
* The texture type.
|
|
38
|
+
*
|
|
39
|
+
* @type {(UnsignedByteType|FloatType)}
|
|
40
|
+
* @default UnsignedByteType
|
|
41
|
+
*/
|
|
20
42
|
this.type = UnsignedByteType;
|
|
21
43
|
|
|
22
44
|
}
|
|
23
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Sets the texture type.
|
|
48
|
+
*
|
|
49
|
+
* @param {(UnsignedByteType|FloatType)} type - The texture type to set.
|
|
50
|
+
* @return {LUTCubeLoader} A reference to this loader.
|
|
51
|
+
*/
|
|
24
52
|
setType( type ) {
|
|
25
53
|
|
|
26
|
-
if ( type !== UnsignedByteType && type !== FloatType ) {
|
|
27
|
-
|
|
28
|
-
throw new Error( 'LUTCubeLoader: Unsupported type' );
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
54
|
this.type = type;
|
|
33
55
|
|
|
34
56
|
return this;
|
|
35
57
|
|
|
36
58
|
}
|
|
37
59
|
|
|
60
|
+
/**
|
|
61
|
+
* Starts loading from the given URL and passes the loaded Cube LUT asset
|
|
62
|
+
* to the `onLoad()` callback.
|
|
63
|
+
*
|
|
64
|
+
* @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
|
|
65
|
+
* @param {function({title:string,size:number,domainMin:Vector3,domainMax:Vector3,texture3D:Data3DTexture})} onLoad - Executed when the loading process has been finished.
|
|
66
|
+
* @param {onProgressCallback} onProgress - Executed while the loading is in progress.
|
|
67
|
+
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
68
|
+
*/
|
|
38
69
|
load( url, onLoad, onProgress, onError ) {
|
|
39
70
|
|
|
40
71
|
const loader = new FileLoader( this.manager );
|
|
@@ -66,6 +97,12 @@ export class LUTCubeLoader extends Loader {
|
|
|
66
97
|
|
|
67
98
|
}
|
|
68
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Parses the given Cube LUT data and returns the resulting 3D data texture.
|
|
102
|
+
*
|
|
103
|
+
* @param {string} input - The raw Cube LUT data as a string.
|
|
104
|
+
* @return {{title:string,size:number,domainMin:Vector3,domainMax:Vector3,texture3D:Data3DTexture}} The parsed Cube LUT.
|
|
105
|
+
*/
|
|
69
106
|
parse( input ) {
|
|
70
107
|
|
|
71
108
|
const regExpTitle = /TITLE +"([^"]*)"/;
|