@gnsx/three 0.184.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 +21 -0
- package/README.md +85 -0
- package/build/three.cjs +79695 -0
- package/build/three.core.js +59732 -0
- package/build/three.core.min.js +6 -0
- package/build/three.module.js +19552 -0
- package/build/three.module.min.js +6 -0
- package/build/three.tsl.js +654 -0
- package/build/three.tsl.min.js +6 -0
- package/build/three.webgpu.js +83969 -0
- package/build/three.webgpu.min.js +6 -0
- package/build/three.webgpu.nodes.js +83702 -0
- package/build/three.webgpu.nodes.min.js +6 -0
- package/examples/fonts/LICENSE +13 -0
- package/examples/fonts/MPLUSRounded1c/MPLUSRounded1c-Regular.typeface.json.zip +0 -0
- package/examples/fonts/MPLUSRounded1c/OFL.txt +91 -0
- package/examples/fonts/README.md +11 -0
- package/examples/fonts/droid/NOTICE +190 -0
- package/examples/fonts/droid/README.txt +18 -0
- package/examples/fonts/droid/droid_sans_bold.typeface.json +1 -0
- package/examples/fonts/droid/droid_sans_mono_regular.typeface.json +1 -0
- package/examples/fonts/droid/droid_sans_regular.typeface.json +1 -0
- package/examples/fonts/droid/droid_serif_bold.typeface.json +1 -0
- package/examples/fonts/droid/droid_serif_regular.typeface.json +1 -0
- package/examples/fonts/gentilis_bold.typeface.json +1 -0
- package/examples/fonts/gentilis_regular.typeface.json +1 -0
- package/examples/fonts/helvetiker_bold.typeface.json +1 -0
- package/examples/fonts/helvetiker_regular.typeface.json +1 -0
- package/examples/fonts/optimer_bold.typeface.json +1 -0
- package/examples/fonts/optimer_regular.typeface.json +1 -0
- package/examples/fonts/ttf/README.md +9 -0
- package/examples/fonts/ttf/kenpixel.ttf +0 -0
- package/examples/jsm/Addons.js +293 -0
- package/examples/jsm/animation/AnimationClipCreator.js +168 -0
- package/examples/jsm/animation/CCDIKSolver.js +595 -0
- package/examples/jsm/capabilities/WebGL.js +113 -0
- package/examples/jsm/capabilities/WebGPU.js +59 -0
- package/examples/jsm/controls/ArcballControls.js +3539 -0
- package/examples/jsm/controls/DragControls.js +452 -0
- package/examples/jsm/controls/FirstPersonControls.js +451 -0
- package/examples/jsm/controls/FlyControls.js +384 -0
- package/examples/jsm/controls/MapControls.js +116 -0
- package/examples/jsm/controls/OrbitControls.js +1963 -0
- package/examples/jsm/controls/PointerLockControls.js +264 -0
- package/examples/jsm/controls/TrackballControls.js +1001 -0
- package/examples/jsm/controls/TransformControls.js +1950 -0
- package/examples/jsm/csm/CSM.js +598 -0
- package/examples/jsm/csm/CSMFrustum.js +209 -0
- package/examples/jsm/csm/CSMHelper.js +243 -0
- package/examples/jsm/csm/CSMShader.js +307 -0
- package/examples/jsm/csm/CSMShadowNode.js +603 -0
- package/examples/jsm/curves/CurveExtras.js +694 -0
- package/examples/jsm/curves/NURBSCurve.js +155 -0
- package/examples/jsm/curves/NURBSSurface.js +98 -0
- package/examples/jsm/curves/NURBSUtils.js +532 -0
- package/examples/jsm/curves/NURBSVolume.js +82 -0
- package/examples/jsm/effects/AnaglyphEffect.js +274 -0
- package/examples/jsm/effects/AsciiEffect.js +310 -0
- package/examples/jsm/effects/OutlineEffect.js +489 -0
- package/examples/jsm/effects/ParallaxBarrierEffect.js +155 -0
- package/examples/jsm/effects/StereoEffect.js +91 -0
- package/examples/jsm/environments/ColorEnvironment.js +59 -0
- package/examples/jsm/environments/DebugEnvironment.js +102 -0
- package/examples/jsm/environments/RoomEnvironment.js +185 -0
- package/examples/jsm/exporters/DRACOExporter.js +311 -0
- package/examples/jsm/exporters/EXRExporter.js +618 -0
- package/examples/jsm/exporters/GLTFExporter.js +3738 -0
- package/examples/jsm/exporters/KTX2Exporter.js +347 -0
- package/examples/jsm/exporters/OBJExporter.js +308 -0
- package/examples/jsm/exporters/PLYExporter.js +562 -0
- package/examples/jsm/exporters/STLExporter.js +221 -0
- package/examples/jsm/exporters/USDZExporter.js +1254 -0
- package/examples/jsm/geometries/BoxLineGeometry.js +92 -0
- package/examples/jsm/geometries/ConvexGeometry.js +72 -0
- package/examples/jsm/geometries/DecalGeometry.js +420 -0
- package/examples/jsm/geometries/ParametricFunctions.js +100 -0
- package/examples/jsm/geometries/ParametricGeometry.js +172 -0
- package/examples/jsm/geometries/RoundedBoxGeometry.js +216 -0
- package/examples/jsm/geometries/TeapotGeometry.js +689 -0
- package/examples/jsm/geometries/TextGeometry.js +102 -0
- package/examples/jsm/gpgpu/BitonicSort.js +715 -0
- package/examples/jsm/helpers/AnimationPathHelper.js +302 -0
- package/examples/jsm/helpers/LightProbeGridHelper.js +221 -0
- package/examples/jsm/helpers/LightProbeHelper.js +165 -0
- package/examples/jsm/helpers/LightProbeHelperGPU.js +102 -0
- package/examples/jsm/helpers/OctreeHelper.js +109 -0
- package/examples/jsm/helpers/PositionalAudioHelper.js +169 -0
- package/examples/jsm/helpers/RapierHelper.js +59 -0
- package/examples/jsm/helpers/RectAreaLightHelper.js +118 -0
- package/examples/jsm/helpers/TextureHelper.js +265 -0
- package/examples/jsm/helpers/TextureHelperGPU.js +214 -0
- package/examples/jsm/helpers/VertexNormalsHelper.js +155 -0
- package/examples/jsm/helpers/VertexTangentsHelper.js +133 -0
- package/examples/jsm/helpers/ViewHelper.js +519 -0
- package/examples/jsm/inspector/Extension.js +13 -0
- package/examples/jsm/inspector/Inspector.js +542 -0
- package/examples/jsm/inspector/RendererInspector.js +425 -0
- package/examples/jsm/inspector/extensions/extensions.json +6 -0
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.js +916 -0
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.js +281 -0
- package/examples/jsm/inspector/tabs/Console.js +238 -0
- package/examples/jsm/inspector/tabs/Memory.js +128 -0
- package/examples/jsm/inspector/tabs/Parameters.js +380 -0
- package/examples/jsm/inspector/tabs/Performance.js +268 -0
- package/examples/jsm/inspector/tabs/Settings.js +264 -0
- package/examples/jsm/inspector/tabs/Timeline.js +1611 -0
- package/examples/jsm/inspector/tabs/Viewer.js +268 -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 +2072 -0
- package/examples/jsm/inspector/ui/Style.js +1667 -0
- package/examples/jsm/inspector/ui/Tab.js +265 -0
- package/examples/jsm/inspector/ui/Values.js +476 -0
- package/examples/jsm/inspector/ui/utils.js +69 -0
- package/examples/jsm/interaction/InteractionManager.js +226 -0
- package/examples/jsm/interactive/HTMLMesh.js +601 -0
- package/examples/jsm/interactive/InteractiveGroup.js +224 -0
- package/examples/jsm/interactive/SelectionBox.js +324 -0
- package/examples/jsm/interactive/SelectionHelper.js +150 -0
- package/examples/jsm/libs/ammo.wasm.js +822 -0
- package/examples/jsm/libs/ammo.wasm.wasm +0 -0
- package/examples/jsm/libs/basis/README.md +46 -0
- package/examples/jsm/libs/basis/basis_transcoder.js +19 -0
- package/examples/jsm/libs/basis/basis_transcoder.wasm +0 -0
- package/examples/jsm/libs/chevrotain.module.min.js +141 -0
- package/examples/jsm/libs/demuxer_mp4.js +109 -0
- package/examples/jsm/libs/draco/README.md +32 -0
- package/examples/jsm/libs/draco/draco_decoder.js +34 -0
- package/examples/jsm/libs/draco/draco_decoder.wasm +0 -0
- package/examples/jsm/libs/draco/draco_encoder.js +33 -0
- package/examples/jsm/libs/draco/draco_wasm_wrapper.js +117 -0
- package/examples/jsm/libs/draco/gltf/draco_decoder.js +33 -0
- package/examples/jsm/libs/draco/gltf/draco_decoder.wasm +0 -0
- package/examples/jsm/libs/draco/gltf/draco_encoder.js +33 -0
- package/examples/jsm/libs/draco/gltf/draco_wasm_wrapper.js +116 -0
- package/examples/jsm/libs/ecsy.module.js +1792 -0
- package/examples/jsm/libs/fflate.module.js +2672 -0
- package/examples/jsm/libs/ktx-parse.module.js +1 -0
- package/examples/jsm/libs/lil-gui.module.min.js +8 -0
- package/examples/jsm/libs/lottie_canvas.module.js +14849 -0
- package/examples/jsm/libs/meshopt_decoder.module.js +196 -0
- package/examples/jsm/libs/mikktspace.module.js +128 -0
- package/examples/jsm/libs/motion-controllers.module.js +397 -0
- package/examples/jsm/libs/opentype.module.js +14506 -0
- package/examples/jsm/libs/potpack.module.js +125 -0
- package/examples/jsm/libs/rhino3dm/rhino3dm.js +21 -0
- package/examples/jsm/libs/rhino3dm/rhino3dm.module.js +16 -0
- package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
- package/examples/jsm/libs/stats.module.js +167 -0
- package/examples/jsm/libs/surfaceNet.js +201 -0
- package/examples/jsm/libs/tween.module.js +876 -0
- package/examples/jsm/libs/utif.module.js +1665 -0
- package/examples/jsm/libs/zstddec.module.js +1 -0
- package/examples/jsm/lighting/DynamicLighting.js +82 -0
- package/examples/jsm/lighting/LightProbeGrid.js +651 -0
- package/examples/jsm/lighting/TiledLighting.js +42 -0
- package/examples/jsm/lights/LightProbeGenerator.js +337 -0
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +127 -0
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +40 -0
- package/examples/jsm/lines/Line2.js +56 -0
- package/examples/jsm/lines/LineGeometry.js +157 -0
- package/examples/jsm/lines/LineMaterial.js +703 -0
- package/examples/jsm/lines/LineSegments2.js +426 -0
- package/examples/jsm/lines/LineSegmentsGeometry.js +298 -0
- package/examples/jsm/lines/Wireframe.js +108 -0
- package/examples/jsm/lines/WireframeGeometry2.js +49 -0
- package/examples/jsm/lines/webgpu/Line2.js +46 -0
- package/examples/jsm/lines/webgpu/LineSegments2.js +411 -0
- package/examples/jsm/lines/webgpu/Wireframe.js +86 -0
- package/examples/jsm/loaders/3DMLoader.js +1836 -0
- package/examples/jsm/loaders/3MFLoader.js +1621 -0
- package/examples/jsm/loaders/AMFLoader.js +541 -0
- package/examples/jsm/loaders/BVHLoader.js +484 -0
- package/examples/jsm/loaders/ColladaLoader.js +153 -0
- package/examples/jsm/loaders/DDSLoader.js +385 -0
- package/examples/jsm/loaders/DRACOLoader.js +739 -0
- package/examples/jsm/loaders/EXRLoader.js +3423 -0
- package/examples/jsm/loaders/FBXLoader.js +4580 -0
- package/examples/jsm/loaders/FontLoader.js +260 -0
- package/examples/jsm/loaders/GCodeLoader.js +318 -0
- package/examples/jsm/loaders/GLTFLoader.js +4860 -0
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +164 -0
- package/examples/jsm/loaders/HDRLoader.js +485 -0
- package/examples/jsm/loaders/IESLoader.js +379 -0
- package/examples/jsm/loaders/KMZLoader.js +163 -0
- package/examples/jsm/loaders/KTX2Loader.js +1257 -0
- package/examples/jsm/loaders/KTXLoader.js +197 -0
- package/examples/jsm/loaders/LDrawLoader.js +2510 -0
- package/examples/jsm/loaders/LUT3dlLoader.js +205 -0
- package/examples/jsm/loaders/LUTCubeLoader.js +190 -0
- package/examples/jsm/loaders/LUTImageLoader.js +190 -0
- package/examples/jsm/loaders/LWOLoader.js +1047 -0
- package/examples/jsm/loaders/LottieLoader.js +130 -0
- package/examples/jsm/loaders/MD2Loader.js +435 -0
- package/examples/jsm/loaders/MDDLoader.js +147 -0
- package/examples/jsm/loaders/MTLLoader.js +593 -0
- package/examples/jsm/loaders/MaterialXLoader.js +1104 -0
- package/examples/jsm/loaders/NRRDLoader.js +718 -0
- package/examples/jsm/loaders/OBJLoader.js +955 -0
- package/examples/jsm/loaders/PCDLoader.js +620 -0
- package/examples/jsm/loaders/PDBLoader.js +272 -0
- package/examples/jsm/loaders/PLYLoader.js +805 -0
- package/examples/jsm/loaders/PVRLoader.js +270 -0
- package/examples/jsm/loaders/RGBELoader.js +18 -0
- package/examples/jsm/loaders/STLLoader.js +421 -0
- package/examples/jsm/loaders/SVGLoader.js +3267 -0
- package/examples/jsm/loaders/TDSLoader.js +1142 -0
- package/examples/jsm/loaders/TGALoader.js +538 -0
- package/examples/jsm/loaders/TIFFLoader.js +59 -0
- package/examples/jsm/loaders/TTFLoader.js +261 -0
- package/examples/jsm/loaders/USDLoader.js +279 -0
- package/examples/jsm/loaders/USDZLoader.js +16 -0
- package/examples/jsm/loaders/UltraHDRLoader.js +755 -0
- package/examples/jsm/loaders/VOXLoader.js +919 -0
- package/examples/jsm/loaders/VRMLLoader.js +3646 -0
- package/examples/jsm/loaders/VTKLoader.js +1293 -0
- package/examples/jsm/loaders/XYZLoader.js +143 -0
- package/examples/jsm/loaders/collada/ColladaComposer.js +3044 -0
- package/examples/jsm/loaders/collada/ColladaParser.js +1977 -0
- package/examples/jsm/loaders/lwo/IFFParser.js +1217 -0
- package/examples/jsm/loaders/lwo/LWO2Parser.js +414 -0
- package/examples/jsm/loaders/lwo/LWO3Parser.js +373 -0
- package/examples/jsm/loaders/usd/USDAParser.js +828 -0
- package/examples/jsm/loaders/usd/USDCParser.js +1878 -0
- package/examples/jsm/loaders/usd/USDComposer.js +4594 -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 +159 -0
- package/examples/jsm/math/ColorConverter.js +58 -0
- package/examples/jsm/math/ColorSpaces.js +147 -0
- package/examples/jsm/math/ConvexHull.js +1695 -0
- package/examples/jsm/math/ImprovedNoise.js +88 -0
- package/examples/jsm/math/Lut.js +317 -0
- package/examples/jsm/math/MeshSurfaceSampler.js +315 -0
- package/examples/jsm/math/OBB.js +535 -0
- package/examples/jsm/math/Octree.js +822 -0
- package/examples/jsm/math/SimplexNoise.js +470 -0
- package/examples/jsm/misc/ConvexObjectBreaker.js +539 -0
- package/examples/jsm/misc/GPUComputationRenderer.js +508 -0
- package/examples/jsm/misc/Gyroscope.js +78 -0
- package/examples/jsm/misc/MD2Character.js +391 -0
- package/examples/jsm/misc/MD2CharacterComplex.js +740 -0
- package/examples/jsm/misc/MorphAnimMesh.js +119 -0
- package/examples/jsm/misc/MorphBlendMesh.js +425 -0
- package/examples/jsm/misc/ProgressiveLightMap.js +370 -0
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +322 -0
- package/examples/jsm/misc/RollerCoaster.js +661 -0
- package/examples/jsm/misc/TubePainter.js +599 -0
- package/examples/jsm/misc/Volume.js +520 -0
- package/examples/jsm/misc/VolumeSlice.js +275 -0
- package/examples/jsm/modifiers/CurveModifier.js +374 -0
- package/examples/jsm/modifiers/CurveModifierGPU.js +256 -0
- package/examples/jsm/modifiers/EdgeSplitModifier.js +299 -0
- package/examples/jsm/modifiers/SimplifyModifier.js +632 -0
- package/examples/jsm/modifiers/TessellateModifier.js +340 -0
- package/examples/jsm/objects/GroundedSkybox.js +69 -0
- package/examples/jsm/objects/Lensflare.js +489 -0
- package/examples/jsm/objects/LensflareMesh.js +376 -0
- package/examples/jsm/objects/MarchingCubes.js +1261 -0
- package/examples/jsm/objects/Reflector.js +386 -0
- package/examples/jsm/objects/ReflectorForSSRPass.js +393 -0
- package/examples/jsm/objects/Refractor.js +389 -0
- package/examples/jsm/objects/ShadowMesh.js +130 -0
- package/examples/jsm/objects/Sky.js +321 -0
- package/examples/jsm/objects/SkyMesh.js +377 -0
- package/examples/jsm/objects/Water.js +374 -0
- package/examples/jsm/objects/Water2.js +403 -0
- package/examples/jsm/objects/Water2Mesh.js +199 -0
- package/examples/jsm/objects/WaterMesh.js +194 -0
- package/examples/jsm/offscreen/jank.js +45 -0
- package/examples/jsm/offscreen/offscreen.js +8 -0
- package/examples/jsm/offscreen/scene.js +86 -0
- package/examples/jsm/physics/AmmoPhysics.js +359 -0
- package/examples/jsm/physics/JoltPhysics.js +334 -0
- package/examples/jsm/physics/RapierPhysics.js +436 -0
- package/examples/jsm/postprocessing/AfterimagePass.js +185 -0
- package/examples/jsm/postprocessing/BloomPass.js +274 -0
- package/examples/jsm/postprocessing/BokehPass.js +218 -0
- package/examples/jsm/postprocessing/ClearPass.js +97 -0
- package/examples/jsm/postprocessing/CubeTexturePass.js +146 -0
- package/examples/jsm/postprocessing/DotScreenPass.js +114 -0
- package/examples/jsm/postprocessing/EffectComposer.js +365 -0
- package/examples/jsm/postprocessing/FXAAPass.js +40 -0
- package/examples/jsm/postprocessing/FilmPass.js +113 -0
- package/examples/jsm/postprocessing/GTAOPass.js +727 -0
- package/examples/jsm/postprocessing/GlitchPass.js +177 -0
- package/examples/jsm/postprocessing/HalftonePass.js +134 -0
- package/examples/jsm/postprocessing/LUTPass.js +138 -0
- package/examples/jsm/postprocessing/MaskPass.js +195 -0
- package/examples/jsm/postprocessing/OutlinePass.js +776 -0
- package/examples/jsm/postprocessing/OutputPass.js +148 -0
- package/examples/jsm/postprocessing/Pass.js +191 -0
- package/examples/jsm/postprocessing/RenderPass.js +193 -0
- package/examples/jsm/postprocessing/RenderPixelatedPass.js +314 -0
- package/examples/jsm/postprocessing/RenderTransitionPass.js +267 -0
- package/examples/jsm/postprocessing/SAOPass.js +407 -0
- package/examples/jsm/postprocessing/SMAAPass.js +230 -0
- package/examples/jsm/postprocessing/SSAARenderPass.js +313 -0
- package/examples/jsm/postprocessing/SSAOPass.js +527 -0
- package/examples/jsm/postprocessing/SSRPass.js +856 -0
- package/examples/jsm/postprocessing/SavePass.js +132 -0
- package/examples/jsm/postprocessing/ShaderPass.js +135 -0
- package/examples/jsm/postprocessing/TAARenderPass.js +243 -0
- package/examples/jsm/postprocessing/TexturePass.js +131 -0
- package/examples/jsm/postprocessing/UnrealBloomPass.js +524 -0
- package/examples/jsm/renderers/CSS2DRenderer.js +328 -0
- package/examples/jsm/renderers/CSS3DRenderer.js +454 -0
- package/examples/jsm/renderers/Projector.js +1154 -0
- package/examples/jsm/renderers/SVGRenderer.js +799 -0
- package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +96 -0
- package/examples/jsm/shaders/AfterimageShader.js +63 -0
- package/examples/jsm/shaders/BasicShader.js +36 -0
- package/examples/jsm/shaders/BleachBypassShader.js +68 -0
- package/examples/jsm/shaders/BlendShader.js +56 -0
- package/examples/jsm/shaders/BokehShader.js +151 -0
- package/examples/jsm/shaders/BokehShader2.js +404 -0
- package/examples/jsm/shaders/BrightnessContrastShader.js +62 -0
- package/examples/jsm/shaders/ColorCorrectionShader.js +59 -0
- package/examples/jsm/shaders/ColorifyShader.js +57 -0
- package/examples/jsm/shaders/ConvolutionShader.js +74 -0
- package/examples/jsm/shaders/CopyShader.js +52 -0
- package/examples/jsm/shaders/DOFMipMapShader.js +63 -0
- package/examples/jsm/shaders/DepthLimitedBlurShader.js +180 -0
- package/examples/jsm/shaders/DigitalGlitch.js +104 -0
- package/examples/jsm/shaders/DotScreenShader.js +75 -0
- package/examples/jsm/shaders/ExposureShader.js +51 -0
- package/examples/jsm/shaders/FXAAShader.js +298 -0
- package/examples/jsm/shaders/FilmShader.js +72 -0
- package/examples/jsm/shaders/FocusShader.js +94 -0
- package/examples/jsm/shaders/FreiChenShader.js +103 -0
- package/examples/jsm/shaders/GTAOShader.js +434 -0
- package/examples/jsm/shaders/GammaCorrectionShader.js +52 -0
- package/examples/jsm/shaders/HalftoneShader.js +332 -0
- package/examples/jsm/shaders/HorizontalBlurShader.js +68 -0
- package/examples/jsm/shaders/HorizontalTiltShiftShader.js +70 -0
- package/examples/jsm/shaders/HueSaturationShader.js +74 -0
- package/examples/jsm/shaders/KaleidoShader.js +65 -0
- package/examples/jsm/shaders/LuminosityHighPassShader.js +68 -0
- package/examples/jsm/shaders/LuminosityShader.js +54 -0
- package/examples/jsm/shaders/MirrorShader.js +62 -0
- package/examples/jsm/shaders/NormalMapShader.js +60 -0
- package/examples/jsm/shaders/OutputShader.js +103 -0
- package/examples/jsm/shaders/PoissonDenoiseShader.js +239 -0
- package/examples/jsm/shaders/RGBShiftShader.js +61 -0
- package/examples/jsm/shaders/SAOShader.js +201 -0
- package/examples/jsm/shaders/SMAAShader.js +489 -0
- package/examples/jsm/shaders/SSAOShader.js +331 -0
- package/examples/jsm/shaders/SSRShader.js +396 -0
- package/examples/jsm/shaders/SepiaShader.js +57 -0
- package/examples/jsm/shaders/SobelOperatorShader.js +98 -0
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +95 -0
- package/examples/jsm/shaders/TechnicolorShader.js +51 -0
- package/examples/jsm/shaders/ToonShader.js +349 -0
- package/examples/jsm/shaders/TriangleBlurShader.js +79 -0
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +60 -0
- package/examples/jsm/shaders/VelocityShader.js +137 -0
- package/examples/jsm/shaders/VerticalBlurShader.js +66 -0
- package/examples/jsm/shaders/VerticalTiltShiftShader.js +70 -0
- package/examples/jsm/shaders/VignetteShader.js +56 -0
- package/examples/jsm/shaders/VolumeShader.js +298 -0
- package/examples/jsm/shaders/WaterRefractionShader.js +106 -0
- package/examples/jsm/textures/FlakesTexture.js +54 -0
- package/examples/jsm/transpiler/AST.js +675 -0
- package/examples/jsm/transpiler/GLSLDecoder.js +1228 -0
- package/examples/jsm/transpiler/Linker.js +327 -0
- package/examples/jsm/transpiler/ShaderToyDecoder.js +51 -0
- package/examples/jsm/transpiler/TSLEncoder.js +983 -0
- package/examples/jsm/transpiler/Transpiler.js +67 -0
- package/examples/jsm/transpiler/TranspilerUtils.js +29 -0
- package/examples/jsm/transpiler/WGSLEncoder.js +839 -0
- package/examples/jsm/tsl/WebGLNodesHandler.js +605 -0
- package/examples/jsm/tsl/display/AfterImageNode.js +254 -0
- package/examples/jsm/tsl/display/AnaglyphPassNode.js +549 -0
- package/examples/jsm/tsl/display/AnamorphicNode.js +293 -0
- package/examples/jsm/tsl/display/BilateralBlurNode.js +374 -0
- package/examples/jsm/tsl/display/BleachBypass.js +33 -0
- 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 +174 -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/FSR1Node.js +477 -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 +572 -0
- package/examples/jsm/tsl/display/GaussianBlurNode.js +399 -0
- package/examples/jsm/tsl/display/GodraysNode.js +615 -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 +812 -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/examples/jsm/tsl/display/SSAAPassNode.js +358 -0
- package/examples/jsm/tsl/display/SSGINode.js +638 -0
- package/examples/jsm/tsl/display/SSRNode.js +656 -0
- package/examples/jsm/tsl/display/SSSNode.js +490 -0
- package/examples/jsm/tsl/display/Sepia.js +24 -0
- package/examples/jsm/tsl/display/Shape.js +29 -0
- package/examples/jsm/tsl/display/SharpenNode.js +283 -0
- package/examples/jsm/tsl/display/SobelOperatorNode.js +168 -0
- package/examples/jsm/tsl/display/StereoCompositePassNode.js +192 -0
- package/examples/jsm/tsl/display/StereoPassNode.js +119 -0
- package/examples/jsm/tsl/display/TAAUNode.js +835 -0
- package/examples/jsm/tsl/display/TRAANode.js +767 -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/DynamicLightsNode.js +300 -0
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +442 -0
- package/examples/jsm/tsl/lighting/data/AmbientLightDataNode.js +61 -0
- package/examples/jsm/tsl/lighting/data/DirectionalLightDataNode.js +111 -0
- package/examples/jsm/tsl/lighting/data/HemisphereLightDataNode.js +99 -0
- package/examples/jsm/tsl/lighting/data/PointLightDataNode.js +134 -0
- package/examples/jsm/tsl/lighting/data/SpotLightDataNode.js +161 -0
- package/examples/jsm/tsl/math/Bayer.js +84 -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 +1434 -0
- package/examples/jsm/utils/CameraUtils.js +82 -0
- package/examples/jsm/utils/ColorUtils.js +76 -0
- package/examples/jsm/utils/GeometryCompressionUtils.js +547 -0
- package/examples/jsm/utils/GeometryUtils.js +226 -0
- package/examples/jsm/utils/LDrawUtils.js +211 -0
- package/examples/jsm/utils/SceneOptimizer.js +458 -0
- package/examples/jsm/utils/SceneUtils.js +363 -0
- package/examples/jsm/utils/ShadowMapViewer.js +244 -0
- package/examples/jsm/utils/ShadowMapViewerGPU.js +233 -0
- package/examples/jsm/utils/SkeletonUtils.js +496 -0
- package/examples/jsm/utils/SortUtils.js +175 -0
- package/examples/jsm/utils/UVsDebug.js +173 -0
- package/examples/jsm/utils/WebGLTextureUtils.js +115 -0
- package/examples/jsm/utils/WebGPUTextureUtils.js +81 -0
- package/examples/jsm/utils/WorkerPool.js +167 -0
- package/examples/jsm/webxr/ARButton.js +251 -0
- package/examples/jsm/webxr/OculusHandModel.js +194 -0
- package/examples/jsm/webxr/OculusHandPointerModel.js +539 -0
- package/examples/jsm/webxr/Text2D.js +52 -0
- package/examples/jsm/webxr/VRButton.js +264 -0
- package/examples/jsm/webxr/XRButton.js +246 -0
- package/examples/jsm/webxr/XRControllerModelFactory.js +403 -0
- package/examples/jsm/webxr/XREstimatedLight.js +254 -0
- package/examples/jsm/webxr/XRHandMeshModel.js +177 -0
- package/examples/jsm/webxr/XRHandModelFactory.js +198 -0
- package/examples/jsm/webxr/XRHandPrimitiveModel.js +147 -0
- package/examples/jsm/webxr/XRPlanes.js +118 -0
- package/package.json +123 -0
- package/src/Three.Core.js +187 -0
- package/src/Three.Legacy.js +0 -0
- package/src/Three.TSL.js +647 -0
- package/src/Three.WebGPU.Nodes.js +31 -0
- package/src/Three.WebGPU.js +37 -0
- package/src/Three.js +10 -0
- package/src/animation/AnimationAction.js +942 -0
- package/src/animation/AnimationClip.js +628 -0
- package/src/animation/AnimationMixer.js +860 -0
- package/src/animation/AnimationObjectGroup.js +411 -0
- package/src/animation/AnimationUtils.js +495 -0
- package/src/animation/KeyframeTrack.js +636 -0
- package/src/animation/PropertyBinding.js +794 -0
- package/src/animation/PropertyMixer.js +385 -0
- package/src/animation/tracks/BooleanKeyframeTrack.js +55 -0
- package/src/animation/tracks/ColorKeyframeTrack.js +36 -0
- package/src/animation/tracks/NumberKeyframeTrack.js +36 -0
- package/src/animation/tracks/QuaternionKeyframeTrack.js +51 -0
- package/src/animation/tracks/StringKeyframeTrack.js +55 -0
- package/src/animation/tracks/VectorKeyframeTrack.js +36 -0
- package/src/audio/Audio.js +778 -0
- package/src/audio/AudioAnalyser.js +97 -0
- package/src/audio/AudioContext.js +40 -0
- package/src/audio/AudioListener.js +218 -0
- package/src/audio/PositionalAudio.js +253 -0
- package/src/cameras/ArrayCamera.js +54 -0
- package/src/cameras/Camera.js +160 -0
- package/src/cameras/CubeCamera.js +259 -0
- package/src/cameras/OrthographicCamera.js +245 -0
- package/src/cameras/PerspectiveCamera.js +407 -0
- package/src/cameras/StereoCamera.js +146 -0
- package/src/constants.js +1760 -0
- package/src/core/BufferAttribute.js +1056 -0
- package/src/core/BufferGeometry.js +1458 -0
- package/src/core/Clock.js +135 -0
- package/src/core/EventDispatcher.js +131 -0
- package/src/core/GLBufferAttribute.js +171 -0
- package/src/core/InstancedBufferAttribute.js +68 -0
- package/src/core/InstancedBufferGeometry.js +60 -0
- package/src/core/InstancedInterleavedBuffer.js +74 -0
- package/src/core/InterleavedBuffer.js +291 -0
- package/src/core/InterleavedBufferAttribute.js +549 -0
- package/src/core/Layers.js +121 -0
- package/src/core/Object3D.js +1667 -0
- package/src/core/Raycaster.js +262 -0
- package/src/core/RenderTarget.js +392 -0
- package/src/core/RenderTarget3D.js +48 -0
- package/src/core/Timer.js +184 -0
- package/src/core/Uniform.js +46 -0
- package/src/core/UniformsGroup.js +180 -0
- package/src/extras/Controls.js +120 -0
- package/src/extras/DataUtils.js +217 -0
- package/src/extras/Earcut.js +28 -0
- package/src/extras/ImageUtils.js +137 -0
- package/src/extras/PMREMGenerator.js +1167 -0
- package/src/extras/ShapeUtils.js +114 -0
- package/src/extras/TextureUtils.js +297 -0
- package/src/extras/core/Curve.js +517 -0
- package/src/extras/core/CurvePath.js +296 -0
- package/src/extras/core/Interpolations.js +111 -0
- package/src/extras/core/Path.js +329 -0
- package/src/extras/core/Shape.js +165 -0
- package/src/extras/core/ShapePath.js +367 -0
- package/src/extras/curves/ArcCurve.js +39 -0
- package/src/extras/curves/CatmullRomCurve3.js +327 -0
- package/src/extras/curves/CubicBezierCurve.js +145 -0
- package/src/extras/curves/CubicBezierCurve3.js +129 -0
- package/src/extras/curves/Curves.js +10 -0
- package/src/extras/curves/EllipseCurve.js +258 -0
- package/src/extras/curves/LineCurve.js +128 -0
- package/src/extras/curves/LineCurve3.js +128 -0
- package/src/extras/curves/QuadraticBezierCurve.js +133 -0
- package/src/extras/curves/QuadraticBezierCurve3.js +118 -0
- package/src/extras/curves/SplineCurve.js +145 -0
- package/src/extras/lib/earcut.js +685 -0
- package/src/geometries/BoxGeometry.js +219 -0
- package/src/geometries/CapsuleGeometry.js +218 -0
- package/src/geometries/CircleGeometry.js +142 -0
- package/src/geometries/ConeGeometry.js +70 -0
- package/src/geometries/CylinderGeometry.js +333 -0
- package/src/geometries/DodecahedronGeometry.js +99 -0
- package/src/geometries/EdgesGeometry.js +180 -0
- package/src/geometries/ExtrudeGeometry.js +910 -0
- package/src/geometries/Geometries.js +21 -0
- package/src/geometries/IcosahedronGeometry.js +75 -0
- package/src/geometries/LatheGeometry.js +230 -0
- package/src/geometries/OctahedronGeometry.js +70 -0
- package/src/geometries/PlaneGeometry.js +133 -0
- package/src/geometries/PolyhedronGeometry.js +348 -0
- package/src/geometries/RingGeometry.js +165 -0
- package/src/geometries/ShapeGeometry.js +233 -0
- package/src/geometries/SphereGeometry.js +175 -0
- package/src/geometries/TetrahedronGeometry.js +67 -0
- package/src/geometries/TorusGeometry.js +161 -0
- package/src/geometries/TorusKnotGeometry.js +206 -0
- package/src/geometries/TubeGeometry.js +253 -0
- package/src/geometries/WireframeGeometry.js +179 -0
- package/src/helpers/ArrowHelper.js +171 -0
- package/src/helpers/AxesHelper.js +96 -0
- package/src/helpers/Box3Helper.js +83 -0
- package/src/helpers/BoxHelper.js +149 -0
- package/src/helpers/CameraHelper.js +345 -0
- package/src/helpers/DirectionalLightHelper.js +148 -0
- package/src/helpers/GridHelper.js +82 -0
- package/src/helpers/HemisphereLightHelper.js +130 -0
- package/src/helpers/PlaneHelper.js +96 -0
- package/src/helpers/PointLightHelper.js +111 -0
- package/src/helpers/PolarGridHelper.js +126 -0
- package/src/helpers/SkeletonHelper.js +194 -0
- package/src/helpers/SpotLightHelper.js +154 -0
- package/src/lights/AmbientLight.js +42 -0
- package/src/lights/DirectionalLight.js +113 -0
- package/src/lights/DirectionalLightShadow.js +31 -0
- package/src/lights/HemisphereLight.js +76 -0
- package/src/lights/Light.js +85 -0
- package/src/lights/LightProbe.js +75 -0
- package/src/lights/LightShadow.js +347 -0
- package/src/lights/PointLight.js +131 -0
- package/src/lights/PointLightShadow.js +31 -0
- package/src/lights/RectAreaLight.js +115 -0
- package/src/lights/SpotLight.js +194 -0
- package/src/lights/SpotLightShadow.js +80 -0
- package/src/lights/webgpu/IESSpotLight.js +47 -0
- package/src/lights/webgpu/ProjectorLight.js +46 -0
- package/src/loaders/AnimationLoader.js +98 -0
- package/src/loaders/AudioLoader.js +108 -0
- package/src/loaders/BufferGeometryLoader.js +242 -0
- package/src/loaders/Cache.js +115 -0
- package/src/loaders/CompressedTextureLoader.js +167 -0
- package/src/loaders/CubeTextureLoader.js +103 -0
- package/src/loaders/DataTextureLoader.js +174 -0
- package/src/loaders/FileLoader.js +367 -0
- package/src/loaders/ImageBitmapLoader.js +223 -0
- package/src/loaders/ImageLoader.js +168 -0
- package/src/loaders/Loader.js +222 -0
- package/src/loaders/LoaderUtils.js +59 -0
- package/src/loaders/LoadingManager.js +329 -0
- package/src/loaders/MaterialLoader.js +439 -0
- package/src/loaders/ObjectLoader.js +1304 -0
- package/src/loaders/TextureLoader.js +74 -0
- package/src/loaders/nodes/NodeLoader.js +194 -0
- package/src/loaders/nodes/NodeMaterialLoader.js +108 -0
- package/src/loaders/nodes/NodeObjectLoader.js +169 -0
- package/src/materials/LineBasicMaterial.js +122 -0
- package/src/materials/LineDashedMaterial.js +86 -0
- package/src/materials/Material.js +1017 -0
- package/src/materials/Materials.js +39 -0
- package/src/materials/MeshBasicMaterial.js +250 -0
- package/src/materials/MeshDepthMaterial.js +148 -0
- package/src/materials/MeshDistanceMaterial.js +119 -0
- package/src/materials/MeshLambertMaterial.js +402 -0
- package/src/materials/MeshMatcapMaterial.js +245 -0
- package/src/materials/MeshNormalMaterial.js +175 -0
- package/src/materials/MeshPhongMaterial.js +421 -0
- package/src/materials/MeshPhysicalMaterial.js +536 -0
- package/src/materials/MeshStandardMaterial.js +425 -0
- package/src/materials/MeshToonMaterial.js +321 -0
- package/src/materials/PointsMaterial.js +139 -0
- package/src/materials/RawShaderMaterial.js +42 -0
- package/src/materials/ShaderMaterial.js +413 -0
- package/src/materials/ShadowMaterial.js +91 -0
- package/src/materials/SpriteMaterial.js +136 -0
- package/src/materials/nodes/Line2NodeMaterial.js +569 -0
- package/src/materials/nodes/LineBasicNodeMaterial.js +46 -0
- package/src/materials/nodes/LineDashedNodeMaterial.js +132 -0
- package/src/materials/nodes/MeshBasicNodeMaterial.js +134 -0
- package/src/materials/nodes/MeshLambertNodeMaterial.js +82 -0
- package/src/materials/nodes/MeshMatcapNodeMaterial.js +77 -0
- package/src/materials/nodes/MeshNormalNodeMaterial.js +67 -0
- package/src/materials/nodes/MeshPhongNodeMaterial.js +141 -0
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +521 -0
- package/src/materials/nodes/MeshSSSNodeMaterial.js +175 -0
- package/src/materials/nodes/MeshStandardNodeMaterial.js +187 -0
- package/src/materials/nodes/MeshToonNodeMaterial.js +66 -0
- package/src/materials/nodes/NodeMaterial.js +1330 -0
- package/src/materials/nodes/NodeMaterials.js +21 -0
- package/src/materials/nodes/PointsNodeMaterial.js +211 -0
- package/src/materials/nodes/ShadowNodeMaterial.js +76 -0
- package/src/materials/nodes/SpriteNodeMaterial.js +186 -0
- package/src/materials/nodes/VolumeNodeMaterial.js +81 -0
- package/src/materials/nodes/manager/NodeMaterialObserver.js +718 -0
- package/src/math/Box2.js +381 -0
- package/src/math/Box3.js +805 -0
- package/src/math/Color.js +967 -0
- package/src/math/ColorManagement.js +215 -0
- package/src/math/Cylindrical.js +120 -0
- package/src/math/Euler.js +449 -0
- package/src/math/Frustum.js +285 -0
- package/src/math/FrustumArray.js +258 -0
- package/src/math/Interpolant.js +320 -0
- package/src/math/Line3.js +337 -0
- package/src/math/MathUtils.js +751 -0
- package/src/math/Matrix2.js +128 -0
- package/src/math/Matrix3.js +617 -0
- package/src/math/Matrix4.js +1314 -0
- package/src/math/Plane.js +368 -0
- package/src/math/Quaternion.js +918 -0
- package/src/math/Ray.js +655 -0
- package/src/math/Sphere.js +420 -0
- package/src/math/Spherical.js +147 -0
- package/src/math/SphericalHarmonics3.js +341 -0
- package/src/math/Triangle.js +539 -0
- package/src/math/Vector2.js +870 -0
- package/src/math/Vector3.js +1263 -0
- package/src/math/Vector4.js +1067 -0
- package/src/math/interpolants/BezierInterpolant.js +108 -0
- package/src/math/interpolants/CubicInterpolant.js +159 -0
- package/src/math/interpolants/DiscreteInterpolant.js +34 -0
- package/src/math/interpolants/LinearInterpolant.js +51 -0
- package/src/math/interpolants/QuaternionLinearInterpolant.js +48 -0
- package/src/nodes/Nodes.js +166 -0
- package/src/nodes/TSL.js +173 -0
- package/src/nodes/accessors/AccessorsUtils.js +53 -0
- package/src/nodes/accessors/Arrays.js +68 -0
- package/src/nodes/accessors/BatchNode.js +163 -0
- package/src/nodes/accessors/Bitangent.js +82 -0
- package/src/nodes/accessors/BufferAttributeNode.js +432 -0
- package/src/nodes/accessors/BufferNode.js +128 -0
- package/src/nodes/accessors/BuiltinNode.js +63 -0
- package/src/nodes/accessors/Camera.js +403 -0
- package/src/nodes/accessors/ClippingNode.js +255 -0
- package/src/nodes/accessors/CubeTextureNode.js +215 -0
- package/src/nodes/accessors/InstanceNode.js +349 -0
- package/src/nodes/accessors/InstancedMeshNode.js +50 -0
- package/src/nodes/accessors/Lights.js +139 -0
- package/src/nodes/accessors/MaterialNode.js +783 -0
- package/src/nodes/accessors/MaterialProperties.js +56 -0
- package/src/nodes/accessors/MaterialReferenceNode.js +84 -0
- package/src/nodes/accessors/ModelNode.js +184 -0
- package/src/nodes/accessors/ModelViewProjectionNode.js +13 -0
- package/src/nodes/accessors/MorphNode.js +310 -0
- package/src/nodes/accessors/Normal.js +243 -0
- package/src/nodes/accessors/Object3DNode.js +268 -0
- package/src/nodes/accessors/PointUVNode.js +55 -0
- package/src/nodes/accessors/Position.js +122 -0
- package/src/nodes/accessors/ReferenceBaseNode.js +357 -0
- package/src/nodes/accessors/ReferenceNode.js +424 -0
- package/src/nodes/accessors/ReflectVector.js +36 -0
- package/src/nodes/accessors/RendererReferenceNode.js +78 -0
- package/src/nodes/accessors/SceneProperties.js +47 -0
- package/src/nodes/accessors/SkinningNode.js +328 -0
- package/src/nodes/accessors/StorageBufferNode.js +405 -0
- package/src/nodes/accessors/StorageTextureNode.js +295 -0
- package/src/nodes/accessors/Tangent.js +60 -0
- package/src/nodes/accessors/TangentUtils.js +46 -0
- package/src/nodes/accessors/Texture3DNode.js +196 -0
- package/src/nodes/accessors/TextureBicubic.js +92 -0
- package/src/nodes/accessors/TextureNode.js +971 -0
- package/src/nodes/accessors/TextureSizeNode.js +77 -0
- package/src/nodes/accessors/UV.js +11 -0
- package/src/nodes/accessors/UniformArrayNode.js +350 -0
- package/src/nodes/accessors/UserDataNode.js +76 -0
- package/src/nodes/accessors/VelocityNode.js +224 -0
- package/src/nodes/accessors/VertexColorNode.js +109 -0
- package/src/nodes/code/CodeNode.js +181 -0
- package/src/nodes/code/ExpressionNode.js +68 -0
- package/src/nodes/code/FunctionCallNode.js +187 -0
- package/src/nodes/code/FunctionNode.js +182 -0
- package/src/nodes/core/ArrayNode.js +174 -0
- package/src/nodes/core/AssignNode.js +202 -0
- package/src/nodes/core/AttributeNode.js +168 -0
- package/src/nodes/core/BypassNode.js +93 -0
- package/src/nodes/core/ConstNode.js +67 -0
- package/src/nodes/core/ContextNode.js +283 -0
- package/src/nodes/core/IndexNode.js +165 -0
- package/src/nodes/core/InputNode.js +136 -0
- package/src/nodes/core/InspectorNode.js +128 -0
- package/src/nodes/core/IsolateNode.js +133 -0
- package/src/nodes/core/LightingModel.js +77 -0
- package/src/nodes/core/MRTNode.js +196 -0
- package/src/nodes/core/Node.js +1180 -0
- package/src/nodes/core/NodeAttribute.js +53 -0
- package/src/nodes/core/NodeBuilder.js +3299 -0
- package/src/nodes/core/NodeCache.js +75 -0
- package/src/nodes/core/NodeCode.js +46 -0
- package/src/nodes/core/NodeError.js +28 -0
- package/src/nodes/core/NodeFrame.js +314 -0
- package/src/nodes/core/NodeFunction.js +69 -0
- package/src/nodes/core/NodeFunctionInput.js +61 -0
- package/src/nodes/core/NodeParser.js +23 -0
- package/src/nodes/core/NodeUniform.js +91 -0
- package/src/nodes/core/NodeUtils.js +408 -0
- package/src/nodes/core/NodeVar.js +60 -0
- package/src/nodes/core/NodeVarying.js +63 -0
- package/src/nodes/core/OutputStructNode.js +105 -0
- package/src/nodes/core/ParameterNode.js +94 -0
- package/src/nodes/core/PropertyNode.js +367 -0
- package/src/nodes/core/StackNode.js +426 -0
- 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 +148 -0
- package/src/nodes/core/SubBuildNode.js +89 -0
- package/src/nodes/core/TempNode.js +88 -0
- package/src/nodes/core/UniformGroupNode.js +167 -0
- package/src/nodes/core/UniformNode.js +259 -0
- package/src/nodes/core/VarNode.js +367 -0
- package/src/nodes/core/VaryingNode.js +210 -0
- package/src/nodes/core/constants.js +68 -0
- package/src/nodes/display/BlendModes.js +171 -0
- package/src/nodes/display/BumpMapNode.js +117 -0
- package/src/nodes/display/ColorAdjustment.js +158 -0
- package/src/nodes/display/ColorSpaceFunctions.js +54 -0
- package/src/nodes/display/ColorSpaceNode.js +164 -0
- package/src/nodes/display/FrontFacingNode.js +102 -0
- package/src/nodes/display/NormalMapNode.js +153 -0
- package/src/nodes/display/PassNode.js +1055 -0
- package/src/nodes/display/RenderOutputNode.js +150 -0
- package/src/nodes/display/ScreenNode.js +292 -0
- package/src/nodes/display/ToneMappingFunctions.js +242 -0
- package/src/nodes/display/ToneMappingNode.js +147 -0
- package/src/nodes/display/ToonOutlinePassNode.js +191 -0
- package/src/nodes/display/ViewportDepthNode.js +342 -0
- package/src/nodes/display/ViewportDepthTextureNode.js +63 -0
- package/src/nodes/display/ViewportSharedTextureNode.js +73 -0
- package/src/nodes/display/ViewportTextureNode.js +256 -0
- package/src/nodes/fog/Fog.js +97 -0
- package/src/nodes/functions/BSDF/BRDF_GGX.js +55 -0
- package/src/nodes/functions/BSDF/BRDF_GGX_Multiscatter.js +52 -0
- package/src/nodes/functions/BSDF/BRDF_Lambert.js +9 -0
- package/src/nodes/functions/BSDF/BRDF_Sheen.js +57 -0
- package/src/nodes/functions/BSDF/DFGLUT.js +56 -0
- package/src/nodes/functions/BSDF/D_GGX.js +23 -0
- package/src/nodes/functions/BSDF/D_GGX_Anisotropic.js +28 -0
- package/src/nodes/functions/BSDF/EnvironmentBRDF.js +13 -0
- package/src/nodes/functions/BSDF/F_Schlick.js +16 -0
- package/src/nodes/functions/BSDF/LTC.js +175 -0
- package/src/nodes/functions/BSDF/Schlick_to_F0.js +21 -0
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +26 -0
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +29 -0
- package/src/nodes/functions/BasicLightingModel.js +100 -0
- package/src/nodes/functions/PhongLightingModel.js +99 -0
- package/src/nodes/functions/PhysicalLightingModel.js +878 -0
- package/src/nodes/functions/ShadowMaskModel.js +58 -0
- package/src/nodes/functions/ToonLightingModel.js +70 -0
- package/src/nodes/functions/VolumetricLightingModel.js +183 -0
- package/src/nodes/functions/material/getAlphaHashThreshold.js +68 -0
- package/src/nodes/functions/material/getGeometryRoughness.js +19 -0
- package/src/nodes/functions/material/getParallaxCorrectNormal.js +37 -0
- package/src/nodes/functions/material/getRoughness.js +18 -0
- package/src/nodes/functions/material/getShIrradianceAt.js +28 -0
- package/src/nodes/geometry/RangeNode.js +210 -0
- package/src/nodes/gpgpu/AtomicFunctionNode.js +274 -0
- package/src/nodes/gpgpu/BarrierNode.js +98 -0
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +227 -0
- package/src/nodes/gpgpu/ComputeNode.js +310 -0
- package/src/nodes/gpgpu/SubgroupFunctionNode.js +455 -0
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +234 -0
- package/src/nodes/lighting/AONode.js +45 -0
- package/src/nodes/lighting/AmbientLightNode.js +35 -0
- package/src/nodes/lighting/AnalyticLightNode.js +309 -0
- package/src/nodes/lighting/BasicEnvironmentNode.js +49 -0
- package/src/nodes/lighting/BasicLightMapNode.js +49 -0
- package/src/nodes/lighting/DirectionalLightNode.js +39 -0
- package/src/nodes/lighting/EnvironmentNode.js +178 -0
- package/src/nodes/lighting/HemisphereLightNode.js +87 -0
- package/src/nodes/lighting/IESSpotLightNode.js +49 -0
- package/src/nodes/lighting/IrradianceNode.js +44 -0
- package/src/nodes/lighting/LightProbeNode.js +73 -0
- package/src/nodes/lighting/LightUtils.js +25 -0
- package/src/nodes/lighting/LightingContextNode.js +115 -0
- package/src/nodes/lighting/LightingNode.js +36 -0
- package/src/nodes/lighting/LightsNode.js +432 -0
- package/src/nodes/lighting/PointLightNode.js +102 -0
- package/src/nodes/lighting/PointShadowNode.js +325 -0
- package/src/nodes/lighting/ProjectorLightNode.js +91 -0
- package/src/nodes/lighting/RectAreaLightNode.js +133 -0
- package/src/nodes/lighting/ShadowBaseNode.js +81 -0
- package/src/nodes/lighting/ShadowFilterNode.js +264 -0
- package/src/nodes/lighting/ShadowNode.js +889 -0
- package/src/nodes/lighting/SpotLightNode.js +168 -0
- package/src/nodes/materialx/DISCLAIMER.md +199 -0
- package/src/nodes/materialx/MaterialXNodes.js +197 -0
- package/src/nodes/materialx/lib/mx_hsv.js +127 -0
- package/src/nodes/materialx/lib/mx_noise.js +1491 -0
- package/src/nodes/materialx/lib/mx_transform_color.js +23 -0
- package/src/nodes/math/BitcastNode.js +156 -0
- package/src/nodes/math/BitcountNode.js +433 -0
- package/src/nodes/math/ConditionalNode.js +245 -0
- package/src/nodes/math/Hash.js +21 -0
- package/src/nodes/math/MathNode.js +1202 -0
- package/src/nodes/math/MathUtils.js +54 -0
- package/src/nodes/math/OperatorNode.js +752 -0
- package/src/nodes/math/PackFloatNode.js +98 -0
- package/src/nodes/math/TriNoise3D.js +71 -0
- package/src/nodes/math/UnpackFloatNode.js +96 -0
- package/src/nodes/parsers/GLSLNodeFunction.js +168 -0
- package/src/nodes/parsers/GLSLNodeParser.js +25 -0
- package/src/nodes/pmrem/PMREMNode.js +397 -0
- package/src/nodes/pmrem/PMREMUtils.js +397 -0
- package/src/nodes/procedural/Checker.js +22 -0
- package/src/nodes/shapes/Shapes.js +33 -0
- package/src/nodes/tsl/TSLBase.js +36 -0
- package/src/nodes/tsl/TSLCore.js +1250 -0
- package/src/nodes/utils/ArrayElementNode.js +90 -0
- package/src/nodes/utils/ConvertNode.js +100 -0
- package/src/nodes/utils/CubeMapNode.js +237 -0
- package/src/nodes/utils/DebugNode.js +83 -0
- package/src/nodes/utils/Discard.js +24 -0
- package/src/nodes/utils/EquirectUV.js +27 -0
- package/src/nodes/utils/EventNode.js +148 -0
- package/src/nodes/utils/FlipNode.js +106 -0
- package/src/nodes/utils/FunctionOverloadingNode.js +170 -0
- package/src/nodes/utils/JoinNode.js +117 -0
- package/src/nodes/utils/LoopNode.js +349 -0
- package/src/nodes/utils/MatcapUV.js +22 -0
- package/src/nodes/utils/MaxMipLevelNode.js +103 -0
- package/src/nodes/utils/MemberNode.js +120 -0
- package/src/nodes/utils/Oscillators.js +41 -0
- package/src/nodes/utils/Packing.js +33 -0
- package/src/nodes/utils/PostProcessingUtils.js +154 -0
- package/src/nodes/utils/RTTNode.js +289 -0
- package/src/nodes/utils/ReflectorNode.js +629 -0
- package/src/nodes/utils/Remap.js +48 -0
- package/src/nodes/utils/RotateNode.js +103 -0
- package/src/nodes/utils/SampleNode.js +91 -0
- package/src/nodes/utils/SetNode.js +108 -0
- package/src/nodes/utils/SplitNode.js +179 -0
- package/src/nodes/utils/SpriteSheetUV.js +35 -0
- package/src/nodes/utils/SpriteUtils.js +63 -0
- package/src/nodes/utils/StorageArrayElementNode.js +143 -0
- package/src/nodes/utils/Timer.js +26 -0
- package/src/nodes/utils/TriplanarTextures.js +65 -0
- package/src/nodes/utils/UVUtils.js +67 -0
- package/src/nodes/utils/ViewportUtils.js +26 -0
- package/src/objects/BatchedMesh.js +1682 -0
- package/src/objects/Bone.js +41 -0
- package/src/objects/ClippingGroup.js +68 -0
- package/src/objects/Group.js +41 -0
- package/src/objects/InstancedMesh.js +422 -0
- package/src/objects/LOD.js +329 -0
- package/src/objects/Line.js +329 -0
- package/src/objects/LineLoop.js +37 -0
- package/src/objects/LineSegments.js +74 -0
- package/src/objects/Mesh.js +496 -0
- package/src/objects/Points.js +228 -0
- package/src/objects/Skeleton.js +392 -0
- package/src/objects/SkinnedMesh.js +370 -0
- package/src/objects/Sprite.js +245 -0
- package/src/renderers/WebGL3DRenderTarget.js +48 -0
- package/src/renderers/WebGLArrayRenderTarget.js +48 -0
- package/src/renderers/WebGLCubeRenderTarget.js +182 -0
- package/src/renderers/WebGLRenderTarget.js +34 -0
- package/src/renderers/WebGLRenderer.js +3699 -0
- package/src/renderers/common/Animation.js +159 -0
- package/src/renderers/common/Attributes.js +132 -0
- package/src/renderers/common/Backend.js +769 -0
- package/src/renderers/common/Background.js +225 -0
- package/src/renderers/common/BindGroup.js +46 -0
- package/src/renderers/common/Binding.js +71 -0
- package/src/renderers/common/Bindings.js +394 -0
- package/src/renderers/common/BlendMode.js +143 -0
- package/src/renderers/common/Buffer.js +127 -0
- package/src/renderers/common/BufferUtils.js +58 -0
- package/src/renderers/common/BundleGroup.js +83 -0
- package/src/renderers/common/CanvasTarget.js +341 -0
- package/src/renderers/common/ChainMap.js +122 -0
- package/src/renderers/common/ClippingContext.js +262 -0
- package/src/renderers/common/Color4.js +77 -0
- package/src/renderers/common/ComputePipeline.js +41 -0
- package/src/renderers/common/Constants.js +15 -0
- package/src/renderers/common/CubeRenderTarget.js +147 -0
- package/src/renderers/common/DataMap.js +90 -0
- package/src/renderers/common/Geometries.js +396 -0
- package/src/renderers/common/IndirectStorageBufferAttribute.js +38 -0
- package/src/renderers/common/Info.js +501 -0
- package/src/renderers/common/InspectorBase.js +151 -0
- package/src/renderers/common/Lighting.js +57 -0
- package/src/renderers/common/Pipeline.js +35 -0
- package/src/renderers/common/Pipelines.js +498 -0
- package/src/renderers/common/PostProcessing.js +28 -0
- package/src/renderers/common/ProgrammableStage.js +78 -0
- package/src/renderers/common/QuadMesh.js +112 -0
- package/src/renderers/common/ReadbackBuffer.js +78 -0
- package/src/renderers/common/RenderBundle.js +26 -0
- package/src/renderers/common/RenderBundles.js +71 -0
- package/src/renderers/common/RenderContext.js +281 -0
- package/src/renderers/common/RenderContexts.js +100 -0
- package/src/renderers/common/RenderList.js +404 -0
- package/src/renderers/common/RenderLists.js +78 -0
- package/src/renderers/common/RenderObject.js +915 -0
- package/src/renderers/common/RenderObjectPipeline.js +40 -0
- package/src/renderers/common/RenderObjects.js +218 -0
- package/src/renderers/common/RenderPipeline.js +255 -0
- package/src/renderers/common/Renderer.js +3654 -0
- package/src/renderers/common/RendererUtils.js +200 -0
- package/src/renderers/common/SampledTexture.js +152 -0
- package/src/renderers/common/Sampler.js +165 -0
- package/src/renderers/common/Storage3DTexture.js +100 -0
- package/src/renderers/common/StorageArrayTexture.js +84 -0
- package/src/renderers/common/StorageBuffer.js +53 -0
- package/src/renderers/common/StorageBufferAttribute.js +46 -0
- package/src/renderers/common/StorageInstancedBufferAttribute.js +46 -0
- package/src/renderers/common/StorageTexture.js +86 -0
- package/src/renderers/common/Textures.js +629 -0
- package/src/renderers/common/TimestampQueryPool.js +163 -0
- package/src/renderers/common/Uniform.js +375 -0
- package/src/renderers/common/UniformBuffer.js +34 -0
- package/src/renderers/common/UniformsGroup.js +548 -0
- package/src/renderers/common/XRManager.js +1684 -0
- package/src/renderers/common/XRRenderTarget.js +91 -0
- package/src/renderers/common/extras/PMREMGenerator.js +1042 -0
- package/src/renderers/common/nodes/NodeBuilderState.js +152 -0
- package/src/renderers/common/nodes/NodeLibrary.js +196 -0
- package/src/renderers/common/nodes/NodeManager.js +983 -0
- package/src/renderers/common/nodes/NodeSampledTexture.js +140 -0
- package/src/renderers/common/nodes/NodeSampler.js +62 -0
- package/src/renderers/common/nodes/NodeStorageBuffer.js +72 -0
- package/src/renderers/common/nodes/NodeUniform.js +418 -0
- package/src/renderers/common/nodes/NodeUniformBuffer.js +105 -0
- package/src/renderers/common/nodes/NodeUniformsGroup.js +51 -0
- package/src/renderers/shaders/DFGLUTData.js +49 -0
- package/src/renderers/shaders/ShaderChunk/alphahash_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/alphahash_pars_fragment.glsl.js +68 -0
- package/src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/alphamap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/alphatest_fragment.glsl.js +16 -0
- package/src/renderers/shaders/ShaderChunk/alphatest_pars_fragment.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js +26 -0
- package/src/renderers/shaders/ShaderChunk/aomap_pars_fragment.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +49 -0
- package/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/begin_vertex.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/beginnormal_vertex.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/bsdfs.glsl.js +33 -0
- package/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js +43 -0
- package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.js +10 -0
- package/src/renderers/shaders/ShaderChunk/clearcoat_pars_fragment.glsl.js +21 -0
- package/src/renderers/shaders/ShaderChunk/clipping_planes_fragment.glsl.js +78 -0
- package/src/renderers/shaders/ShaderChunk/clipping_planes_pars_fragment.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/clipping_planes_pars_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/clipping_planes_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/color_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +29 -0
- package/src/renderers/shaders/ShaderChunk/colorspace_fragment.glsl.js +3 -0
- package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +15 -0
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +125 -0
- package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +186 -0
- package/src/renderers/shaders/ShaderChunk/default_fragment.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/default_vertex.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +63 -0
- package/src/renderers/shaders/ShaderChunk/displacementmap_pars_vertex.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/displacementmap_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/dithering_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/dithering_pars_fragment.glsl.js +20 -0
- package/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.js +17 -0
- package/src/renderers/shaders/ShaderChunk/emissivemap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +58 -0
- package/src/renderers/shaders/ShaderChunk/envmap_pars_fragment.glsl.js +21 -0
- package/src/renderers/shaders/ShaderChunk/envmap_pars_vertex.glsl.js +22 -0
- package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +69 -0
- package/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.js +37 -0
- package/src/renderers/shaders/ShaderChunk/fog_fragment.glsl.js +17 -0
- package/src/renderers/shaders/ShaderChunk/fog_pars_fragment.glsl.js +19 -0
- package/src/renderers/shaders/ShaderChunk/fog_pars_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/fog_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.js +27 -0
- package/src/renderers/shaders/ShaderChunk/iridescence_fragment.glsl.js +120 -0
- package/src/renderers/shaders/ShaderChunk/iridescence_pars_fragment.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/lightmap_pars_fragment.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/lightprobes_pars_fragment.glsl.js +80 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +213 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js +19 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +44 -0
- package/src/renderers/shaders/ShaderChunk/lights_lambert_fragment.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.js +28 -0
- package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +216 -0
- package/src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl.js +32 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +161 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +656 -0
- package/src/renderers/shaders/ShaderChunk/lights_toon_fragment.glsl.js +4 -0
- package/src/renderers/shaders/ShaderChunk/lights_toon_pars_fragment.glsl.js +26 -0
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +17 -0
- package/src/renderers/shaders/ShaderChunk/map_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl.js +27 -0
- package/src/renderers/shaders/ShaderChunk/map_particle_pars_fragment.glsl.js +27 -0
- package/src/renderers/shaders/ShaderChunk/metalnessmap_fragment.glsl.js +12 -0
- package/src/renderers/shaders/ShaderChunk/metalnessmap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.js +24 -0
- package/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js +16 -0
- package/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.js +26 -0
- package/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js +16 -0
- package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +76 -0
- package/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js +40 -0
- package/src/renderers/shaders/ShaderChunk/normal_pars_fragment.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/normal_pars_vertex.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js +43 -0
- package/src/renderers/shaders/ShaderChunk/opaque_fragment.glsl.js +11 -0
- package/src/renderers/shaders/ShaderChunk/packing.glsl.js +116 -0
- package/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/project_vertex.glsl.js +19 -0
- package/src/renderers/shaders/ShaderChunk/roughnessmap_fragment.glsl.js +12 -0
- package/src/renderers/shaders/ShaderChunk/roughnessmap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +376 -0
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +71 -0
- package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +78 -0
- package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +66 -0
- package/src/renderers/shaders/ShaderChunk/skinbase_vertex.glsl.js +10 -0
- package/src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl.js +25 -0
- package/src/renderers/shaders/ShaderChunk/skinning_vertex.glsl.js +15 -0
- package/src/renderers/shaders/ShaderChunk/skinnormal_vertex.glsl.js +20 -0
- package/src/renderers/shaders/ShaderChunk/specularmap_fragment.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/specularmap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/tonemapping_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +200 -0
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +36 -0
- package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +235 -0
- package/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.js +119 -0
- package/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.js +145 -0
- package/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.js +122 -0
- package/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.js +21 -0
- package/src/renderers/shaders/ShaderChunk.js +272 -0
- package/src/renderers/shaders/ShaderLib/background.glsl.js +40 -0
- package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +62 -0
- package/src/renderers/shaders/ShaderLib/cube.glsl.js +36 -0
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +117 -0
- package/src/renderers/shaders/ShaderLib/distance.glsl.js +77 -0
- package/src/renderers/shaders/ShaderLib/equirect.glsl.js +35 -0
- package/src/renderers/shaders/ShaderLib/linedashed.glsl.js +76 -0
- package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +116 -0
- package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +126 -0
- package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +112 -0
- package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +86 -0
- package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +128 -0
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +224 -0
- package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +118 -0
- package/src/renderers/shaders/ShaderLib/points.glsl.js +87 -0
- package/src/renderers/shaders/ShaderLib/shadow.glsl.js +58 -0
- package/src/renderers/shaders/ShaderLib/sprite.glsl.js +79 -0
- package/src/renderers/shaders/ShaderLib/vsm.glsl.js +51 -0
- package/src/renderers/shaders/ShaderLib.js +362 -0
- package/src/renderers/shaders/UniformsLib.js +234 -0
- package/src/renderers/shaders/UniformsUtils.js +154 -0
- package/src/renderers/webgl/WebGLAnimation.js +54 -0
- package/src/renderers/webgl/WebGLAttributes.js +237 -0
- package/src/renderers/webgl/WebGLBackground.js +303 -0
- package/src/renderers/webgl/WebGLBindingStates.js +666 -0
- package/src/renderers/webgl/WebGLBufferRenderer.js +57 -0
- package/src/renderers/webgl/WebGLCapabilities.js +150 -0
- package/src/renderers/webgl/WebGLClipping.js +171 -0
- package/src/renderers/webgl/WebGLEnvironments.js +228 -0
- package/src/renderers/webgl/WebGLExtensions.js +61 -0
- package/src/renderers/webgl/WebGLGeometries.js +186 -0
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +68 -0
- package/src/renderers/webgl/WebGLInfo.js +73 -0
- package/src/renderers/webgl/WebGLLights.js +584 -0
- package/src/renderers/webgl/WebGLMaterials.js +602 -0
- package/src/renderers/webgl/WebGLMorphtargets.js +168 -0
- package/src/renderers/webgl/WebGLObjects.js +94 -0
- package/src/renderers/webgl/WebGLOutput.js +270 -0
- package/src/renderers/webgl/WebGLProgram.js +1031 -0
- package/src/renderers/webgl/WebGLPrograms.js +679 -0
- package/src/renderers/webgl/WebGLProperties.js +55 -0
- package/src/renderers/webgl/WebGLRenderLists.js +253 -0
- package/src/renderers/webgl/WebGLRenderStates.js +124 -0
- package/src/renderers/webgl/WebGLShader.js +12 -0
- package/src/renderers/webgl/WebGLShaderCache.js +124 -0
- package/src/renderers/webgl/WebGLShadowMap.js +600 -0
- package/src/renderers/webgl/WebGLState.js +1370 -0
- package/src/renderers/webgl/WebGLTextures.js +2506 -0
- package/src/renderers/webgl/WebGLUniforms.js +1203 -0
- package/src/renderers/webgl/WebGLUniformsGroups.js +413 -0
- package/src/renderers/webgl/WebGLUtils.js +217 -0
- package/src/renderers/webgl-fallback/WebGLBackend.js +2783 -0
- package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +99 -0
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +1676 -0
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +359 -0
- package/src/renderers/webgl-fallback/utils/WebGLCapabilities.js +89 -0
- package/src/renderers/webgl-fallback/utils/WebGLConstants.js +13 -0
- package/src/renderers/webgl-fallback/utils/WebGLExtensions.js +83 -0
- package/src/renderers/webgl-fallback/utils/WebGLState.js +1361 -0
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +1324 -0
- package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +396 -0
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +317 -0
- package/src/renderers/webgpu/WebGPUBackend.js +2602 -0
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +69 -0
- package/src/renderers/webgpu/WebGPURenderer.js +107 -0
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +66 -0
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +100 -0
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +2523 -0
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +187 -0
- package/src/renderers/webgpu/nodes/WGSLNodeParser.js +25 -0
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +522 -0
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +642 -0
- package/src/renderers/webgpu/utils/WebGPUCapabilities.js +48 -0
- package/src/renderers/webgpu/utils/WebGPUConstants.js +354 -0
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +846 -0
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +389 -0
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +1673 -0
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +310 -0
- package/src/renderers/webgpu/utils/WebGPUUtils.js +269 -0
- package/src/renderers/webxr/WebXRController.js +440 -0
- package/src/renderers/webxr/WebXRDepthSensing.js +155 -0
- package/src/renderers/webxr/WebXRManager.js +1103 -0
- package/src/scenes/Fog.js +98 -0
- package/src/scenes/FogExp2.js +86 -0
- package/src/scenes/Scene.js +165 -0
- package/src/textures/CanvasTexture.js +45 -0
- package/src/textures/CompressedArrayTexture.js +89 -0
- package/src/textures/CompressedCubeTexture.js +48 -0
- package/src/textures/CompressedTexture.js +86 -0
- package/src/textures/CubeDepthTexture.js +76 -0
- package/src/textures/CubeTexture.js +81 -0
- package/src/textures/Data3DTexture.js +112 -0
- package/src/textures/DataArrayTexture.js +134 -0
- package/src/textures/DataTexture.js +87 -0
- package/src/textures/DepthTexture.js +104 -0
- package/src/textures/ExternalTexture.js +56 -0
- package/src/textures/FramebufferTexture.js +85 -0
- package/src/textures/HTMLTexture.js +74 -0
- package/src/textures/Source.js +230 -0
- package/src/textures/Texture.js +812 -0
- package/src/textures/VideoFrameTexture.js +72 -0
- package/src/textures/VideoTexture.js +127 -0
- package/src/utils.js +493 -0
|
@@ -0,0 +1,1458 @@
|
|
|
1
|
+
import { Vector3 } from '../math/Vector3.js';
|
|
2
|
+
import { Vector2 } from '../math/Vector2.js';
|
|
3
|
+
import { Box3 } from '../math/Box3.js';
|
|
4
|
+
import { EventDispatcher } from './EventDispatcher.js';
|
|
5
|
+
import { BufferAttribute, Float32BufferAttribute, Uint16BufferAttribute, Uint32BufferAttribute } from './BufferAttribute.js';
|
|
6
|
+
import { Sphere } from '../math/Sphere.js';
|
|
7
|
+
import { Object3D } from './Object3D.js';
|
|
8
|
+
import { Matrix4 } from '../math/Matrix4.js';
|
|
9
|
+
import { Matrix3 } from '../math/Matrix3.js';
|
|
10
|
+
import { generateUUID } from '../math/MathUtils.js';
|
|
11
|
+
import { arrayNeedsUint32, warn, error } from '../utils.js';
|
|
12
|
+
|
|
13
|
+
let _id = 0;
|
|
14
|
+
|
|
15
|
+
const _m1 = /*@__PURE__*/ new Matrix4();
|
|
16
|
+
const _obj = /*@__PURE__*/ new Object3D();
|
|
17
|
+
const _offset = /*@__PURE__*/ new Vector3();
|
|
18
|
+
const _box = /*@__PURE__*/ new Box3();
|
|
19
|
+
const _boxMorphTargets = /*@__PURE__*/ new Box3();
|
|
20
|
+
const _vector = /*@__PURE__*/ new Vector3();
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* A representation of mesh, line, or point geometry. Includes vertex
|
|
24
|
+
* positions, face indices, normals, colors, UVs, and custom attributes
|
|
25
|
+
* within buffers, reducing the cost of passing all this data to the GPU.
|
|
26
|
+
*
|
|
27
|
+
* ```js
|
|
28
|
+
* const geometry = new THREE.BufferGeometry();
|
|
29
|
+
* // create a simple square shape. We duplicate the top left and bottom right
|
|
30
|
+
* // vertices because each vertex needs to appear once per triangle.
|
|
31
|
+
* const vertices = new Float32Array( [
|
|
32
|
+
* -1.0, -1.0, 1.0, // v0
|
|
33
|
+
* 1.0, -1.0, 1.0, // v1
|
|
34
|
+
* 1.0, 1.0, 1.0, // v2
|
|
35
|
+
*
|
|
36
|
+
* 1.0, 1.0, 1.0, // v3
|
|
37
|
+
* -1.0, 1.0, 1.0, // v4
|
|
38
|
+
* -1.0, -1.0, 1.0 // v5
|
|
39
|
+
* ] );
|
|
40
|
+
* // itemSize = 3 because there are 3 values (components) per vertex
|
|
41
|
+
* geometry.setAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
|
|
42
|
+
* const material = new THREE.MeshBasicMaterial( { color: 0xff0000 } );
|
|
43
|
+
* const mesh = new THREE.Mesh( geometry, material );
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @augments EventDispatcher
|
|
47
|
+
*/
|
|
48
|
+
class BufferGeometry extends EventDispatcher {
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Constructs a new geometry.
|
|
52
|
+
*/
|
|
53
|
+
constructor() {
|
|
54
|
+
|
|
55
|
+
super();
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* This flag can be used for type testing.
|
|
59
|
+
*
|
|
60
|
+
* @type {boolean}
|
|
61
|
+
* @readonly
|
|
62
|
+
* @default true
|
|
63
|
+
*/
|
|
64
|
+
this.isBufferGeometry = true;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The ID of the geometry.
|
|
68
|
+
*
|
|
69
|
+
* @name BufferGeometry#id
|
|
70
|
+
* @type {number}
|
|
71
|
+
* @readonly
|
|
72
|
+
*/
|
|
73
|
+
Object.defineProperty( this, 'id', { value: _id ++ } );
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The UUID of the geometry.
|
|
77
|
+
*
|
|
78
|
+
* @type {string}
|
|
79
|
+
* @readonly
|
|
80
|
+
*/
|
|
81
|
+
this.uuid = generateUUID();
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The name of the geometry.
|
|
85
|
+
*
|
|
86
|
+
* @type {string}
|
|
87
|
+
*/
|
|
88
|
+
this.name = '';
|
|
89
|
+
this.type = 'BufferGeometry';
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Allows for vertices to be re-used across multiple triangles; this is
|
|
93
|
+
* called using "indexed triangles". Each triangle is associated with the
|
|
94
|
+
* indices of three vertices. This attribute therefore stores the index of
|
|
95
|
+
* each vertex for each triangular face. If this attribute is not set, the
|
|
96
|
+
* renderer assumes that each three contiguous positions represent a single triangle.
|
|
97
|
+
*
|
|
98
|
+
* @type {?BufferAttribute}
|
|
99
|
+
* @default null
|
|
100
|
+
*/
|
|
101
|
+
this.index = null;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* A (storage) buffer attribute which was generated with a compute shader and
|
|
105
|
+
* now defines indirect draw calls.
|
|
106
|
+
*
|
|
107
|
+
* Can only be used with {@link WebGPURenderer} and a WebGPU backend.
|
|
108
|
+
*
|
|
109
|
+
* @type {?BufferAttribute}
|
|
110
|
+
* @default null
|
|
111
|
+
*/
|
|
112
|
+
this.indirect = null;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* The offset, in bytes, into the indirect drawing buffer where the value data begins. If an array is provided, multiple indirect draw calls will be made for each offset.
|
|
116
|
+
*
|
|
117
|
+
* Can only be used with {@link WebGPURenderer} and a WebGPU backend.
|
|
118
|
+
*
|
|
119
|
+
* @type {number|Array<number>}
|
|
120
|
+
* @default 0
|
|
121
|
+
*/
|
|
122
|
+
this.indirectOffset = 0;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* This dictionary has as id the name of the attribute to be set and as value
|
|
126
|
+
* the buffer attribute to set it to. Rather than accessing this property directly,
|
|
127
|
+
* use `setAttribute()` and `getAttribute()` to access attributes of this geometry.
|
|
128
|
+
*
|
|
129
|
+
* @type {Object<string,(BufferAttribute|InterleavedBufferAttribute)>}
|
|
130
|
+
*/
|
|
131
|
+
this.attributes = {};
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* This dictionary holds the morph targets of the geometry.
|
|
135
|
+
*
|
|
136
|
+
* Note: Once the geometry has been rendered, the morph attribute data cannot
|
|
137
|
+
* be changed. You will have to call `dispose()`, and create a new geometry instance.
|
|
138
|
+
*
|
|
139
|
+
* @type {Object}
|
|
140
|
+
*/
|
|
141
|
+
this.morphAttributes = {};
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Used to control the morph target behavior; when set to `true`, the morph
|
|
145
|
+
* target data is treated as relative offsets, rather than as absolute
|
|
146
|
+
* positions/normals.
|
|
147
|
+
*
|
|
148
|
+
* @type {boolean}
|
|
149
|
+
* @default false
|
|
150
|
+
*/
|
|
151
|
+
this.morphTargetsRelative = false;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Split the geometry into groups, each of which will be rendered in a
|
|
155
|
+
* separate draw call. This allows an array of materials to be used with the geometry.
|
|
156
|
+
*
|
|
157
|
+
* Use `addGroup()` and `clearGroups()` to edit groups, rather than modifying this array directly.
|
|
158
|
+
*
|
|
159
|
+
* Every vertex and index must belong to exactly one group — groups must not share vertices or
|
|
160
|
+
* indices, and must not leave vertices or indices unused.
|
|
161
|
+
*
|
|
162
|
+
* @type {Array<Object>}
|
|
163
|
+
*/
|
|
164
|
+
this.groups = [];
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Bounding box for the geometry which can be calculated with `computeBoundingBox()`.
|
|
168
|
+
*
|
|
169
|
+
* @type {?Box3}
|
|
170
|
+
* @default null
|
|
171
|
+
*/
|
|
172
|
+
this.boundingBox = null;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Bounding sphere for the geometry which can be calculated with `computeBoundingSphere()`.
|
|
176
|
+
*
|
|
177
|
+
* @type {?Sphere}
|
|
178
|
+
* @default null
|
|
179
|
+
*/
|
|
180
|
+
this.boundingSphere = null;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Determines the part of the geometry to render. This should not be set directly,
|
|
184
|
+
* instead use `setDrawRange()`.
|
|
185
|
+
*
|
|
186
|
+
* @type {{start:number,count:number}}
|
|
187
|
+
*/
|
|
188
|
+
this.drawRange = { start: 0, count: Infinity };
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* An object that can be used to store custom data about the geometry.
|
|
192
|
+
* It should not hold references to functions as these will not be cloned.
|
|
193
|
+
*
|
|
194
|
+
* @type {Object}
|
|
195
|
+
*/
|
|
196
|
+
this.userData = {};
|
|
197
|
+
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Returns the index of this geometry.
|
|
202
|
+
*
|
|
203
|
+
* @return {?BufferAttribute} The index. Returns `null` if no index is defined.
|
|
204
|
+
*/
|
|
205
|
+
getIndex() {
|
|
206
|
+
|
|
207
|
+
return this.index;
|
|
208
|
+
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Sets the given index to this geometry.
|
|
213
|
+
*
|
|
214
|
+
* @param {Array<number>|BufferAttribute} index - The index to set.
|
|
215
|
+
* @return {BufferGeometry} A reference to this instance.
|
|
216
|
+
*/
|
|
217
|
+
setIndex( index ) {
|
|
218
|
+
|
|
219
|
+
if ( Array.isArray( index ) ) {
|
|
220
|
+
|
|
221
|
+
this.index = new ( arrayNeedsUint32( index ) ? Uint32BufferAttribute : Uint16BufferAttribute )( index, 1 );
|
|
222
|
+
|
|
223
|
+
} else {
|
|
224
|
+
|
|
225
|
+
this.index = index;
|
|
226
|
+
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
return this;
|
|
230
|
+
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Sets the given indirect attribute to this geometry.
|
|
235
|
+
*
|
|
236
|
+
* @param {BufferAttribute} indirect - The attribute holding indirect draw calls.
|
|
237
|
+
* @param {number|Array<number>} [indirectOffset=0] - The offset, in bytes, into the indirect drawing buffer where the value data begins. If an array is provided, multiple indirect draw calls will be made for each offset.
|
|
238
|
+
* @return {BufferGeometry} A reference to this instance.
|
|
239
|
+
*/
|
|
240
|
+
setIndirect( indirect, indirectOffset = 0 ) {
|
|
241
|
+
|
|
242
|
+
this.indirect = indirect;
|
|
243
|
+
this.indirectOffset = indirectOffset;
|
|
244
|
+
|
|
245
|
+
return this;
|
|
246
|
+
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Returns the indirect attribute of this geometry.
|
|
251
|
+
*
|
|
252
|
+
* @return {?BufferAttribute} The indirect attribute. Returns `null` if no indirect attribute is defined.
|
|
253
|
+
*/
|
|
254
|
+
getIndirect() {
|
|
255
|
+
|
|
256
|
+
return this.indirect;
|
|
257
|
+
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Returns the buffer attribute for the given name.
|
|
262
|
+
*
|
|
263
|
+
* @param {string} name - The attribute name.
|
|
264
|
+
* @return {BufferAttribute|InterleavedBufferAttribute|undefined} The buffer attribute.
|
|
265
|
+
* Returns `undefined` if not attribute has been found.
|
|
266
|
+
*/
|
|
267
|
+
getAttribute( name ) {
|
|
268
|
+
|
|
269
|
+
return this.attributes[ name ];
|
|
270
|
+
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Sets the given attribute for the given name.
|
|
275
|
+
*
|
|
276
|
+
* @param {string} name - The attribute name.
|
|
277
|
+
* @param {BufferAttribute|InterleavedBufferAttribute} attribute - The attribute to set.
|
|
278
|
+
* @return {BufferGeometry} A reference to this instance.
|
|
279
|
+
*/
|
|
280
|
+
setAttribute( name, attribute ) {
|
|
281
|
+
|
|
282
|
+
this.attributes[ name ] = attribute;
|
|
283
|
+
|
|
284
|
+
return this;
|
|
285
|
+
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Deletes the attribute for the given name.
|
|
290
|
+
*
|
|
291
|
+
* @param {string} name - The attribute name to delete.
|
|
292
|
+
* @return {BufferGeometry} A reference to this instance.
|
|
293
|
+
*/
|
|
294
|
+
deleteAttribute( name ) {
|
|
295
|
+
|
|
296
|
+
delete this.attributes[ name ];
|
|
297
|
+
|
|
298
|
+
return this;
|
|
299
|
+
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Returns `true` if this geometry has an attribute for the given name.
|
|
304
|
+
*
|
|
305
|
+
* @param {string} name - The attribute name.
|
|
306
|
+
* @return {boolean} Whether this geometry has an attribute for the given name or not.
|
|
307
|
+
*/
|
|
308
|
+
hasAttribute( name ) {
|
|
309
|
+
|
|
310
|
+
return this.attributes[ name ] !== undefined;
|
|
311
|
+
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Adds a group to this geometry.
|
|
316
|
+
*
|
|
317
|
+
* @param {number} start - The first element in this draw call. That is the first
|
|
318
|
+
* vertex for non-indexed geometry, otherwise the first triangle index.
|
|
319
|
+
* @param {number} count - Specifies how many vertices (or indices) are part of this group.
|
|
320
|
+
* @param {number} [materialIndex=0] - The material array index to use.
|
|
321
|
+
*/
|
|
322
|
+
addGroup( start, count, materialIndex = 0 ) {
|
|
323
|
+
|
|
324
|
+
this.groups.push( {
|
|
325
|
+
|
|
326
|
+
start: start,
|
|
327
|
+
count: count,
|
|
328
|
+
materialIndex: materialIndex
|
|
329
|
+
|
|
330
|
+
} );
|
|
331
|
+
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Clears all groups.
|
|
336
|
+
*/
|
|
337
|
+
clearGroups() {
|
|
338
|
+
|
|
339
|
+
this.groups = [];
|
|
340
|
+
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Sets the draw range for this geometry.
|
|
345
|
+
*
|
|
346
|
+
* @param {number} start - The first vertex for non-indexed geometry, otherwise the first triangle index.
|
|
347
|
+
* @param {number} count - For non-indexed BufferGeometry, `count` is the number of vertices to render.
|
|
348
|
+
* For indexed BufferGeometry, `count` is the number of indices to render.
|
|
349
|
+
*/
|
|
350
|
+
setDrawRange( start, count ) {
|
|
351
|
+
|
|
352
|
+
this.drawRange.start = start;
|
|
353
|
+
this.drawRange.count = count;
|
|
354
|
+
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Applies the given 4x4 transformation matrix to the geometry.
|
|
359
|
+
*
|
|
360
|
+
* @param {Matrix4} matrix - The matrix to apply.
|
|
361
|
+
* @return {BufferGeometry} A reference to this instance.
|
|
362
|
+
*/
|
|
363
|
+
applyMatrix4( matrix ) {
|
|
364
|
+
|
|
365
|
+
const position = this.attributes.position;
|
|
366
|
+
|
|
367
|
+
if ( position !== undefined ) {
|
|
368
|
+
|
|
369
|
+
position.applyMatrix4( matrix );
|
|
370
|
+
|
|
371
|
+
position.needsUpdate = true;
|
|
372
|
+
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
const normal = this.attributes.normal;
|
|
376
|
+
|
|
377
|
+
if ( normal !== undefined ) {
|
|
378
|
+
|
|
379
|
+
const normalMatrix = new Matrix3().getNormalMatrix( matrix );
|
|
380
|
+
|
|
381
|
+
normal.applyNormalMatrix( normalMatrix );
|
|
382
|
+
|
|
383
|
+
normal.needsUpdate = true;
|
|
384
|
+
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
const tangent = this.attributes.tangent;
|
|
388
|
+
|
|
389
|
+
if ( tangent !== undefined ) {
|
|
390
|
+
|
|
391
|
+
tangent.transformDirection( matrix );
|
|
392
|
+
|
|
393
|
+
tangent.needsUpdate = true;
|
|
394
|
+
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
if ( this.boundingBox !== null ) {
|
|
398
|
+
|
|
399
|
+
this.computeBoundingBox();
|
|
400
|
+
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
if ( this.boundingSphere !== null ) {
|
|
404
|
+
|
|
405
|
+
this.computeBoundingSphere();
|
|
406
|
+
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
return this;
|
|
410
|
+
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Applies the rotation represented by the Quaternion to the geometry.
|
|
415
|
+
*
|
|
416
|
+
* @param {Quaternion} q - The Quaternion to apply.
|
|
417
|
+
* @return {BufferGeometry} A reference to this instance.
|
|
418
|
+
*/
|
|
419
|
+
applyQuaternion( q ) {
|
|
420
|
+
|
|
421
|
+
_m1.makeRotationFromQuaternion( q );
|
|
422
|
+
|
|
423
|
+
this.applyMatrix4( _m1 );
|
|
424
|
+
|
|
425
|
+
return this;
|
|
426
|
+
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* Rotates the geometry about the X axis. This is typically done as a one time
|
|
431
|
+
* operation, and not during a loop. Use {@link Object3D#rotation} for typical
|
|
432
|
+
* real-time mesh rotation.
|
|
433
|
+
*
|
|
434
|
+
* @param {number} angle - The angle in radians.
|
|
435
|
+
* @return {BufferGeometry} A reference to this instance.
|
|
436
|
+
*/
|
|
437
|
+
rotateX( angle ) {
|
|
438
|
+
|
|
439
|
+
// rotate geometry around world x-axis
|
|
440
|
+
|
|
441
|
+
_m1.makeRotationX( angle );
|
|
442
|
+
|
|
443
|
+
this.applyMatrix4( _m1 );
|
|
444
|
+
|
|
445
|
+
return this;
|
|
446
|
+
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* Rotates the geometry about the Y axis. This is typically done as a one time
|
|
451
|
+
* operation, and not during a loop. Use {@link Object3D#rotation} for typical
|
|
452
|
+
* real-time mesh rotation.
|
|
453
|
+
*
|
|
454
|
+
* @param {number} angle - The angle in radians.
|
|
455
|
+
* @return {BufferGeometry} A reference to this instance.
|
|
456
|
+
*/
|
|
457
|
+
rotateY( angle ) {
|
|
458
|
+
|
|
459
|
+
// rotate geometry around world y-axis
|
|
460
|
+
|
|
461
|
+
_m1.makeRotationY( angle );
|
|
462
|
+
|
|
463
|
+
this.applyMatrix4( _m1 );
|
|
464
|
+
|
|
465
|
+
return this;
|
|
466
|
+
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Rotates the geometry about the Z axis. This is typically done as a one time
|
|
471
|
+
* operation, and not during a loop. Use {@link Object3D#rotation} for typical
|
|
472
|
+
* real-time mesh rotation.
|
|
473
|
+
*
|
|
474
|
+
* @param {number} angle - The angle in radians.
|
|
475
|
+
* @return {BufferGeometry} A reference to this instance.
|
|
476
|
+
*/
|
|
477
|
+
rotateZ( angle ) {
|
|
478
|
+
|
|
479
|
+
// rotate geometry around world z-axis
|
|
480
|
+
|
|
481
|
+
_m1.makeRotationZ( angle );
|
|
482
|
+
|
|
483
|
+
this.applyMatrix4( _m1 );
|
|
484
|
+
|
|
485
|
+
return this;
|
|
486
|
+
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Translates the geometry. This is typically done as a one time
|
|
491
|
+
* operation, and not during a loop. Use {@link Object3D#position} for typical
|
|
492
|
+
* real-time mesh rotation.
|
|
493
|
+
*
|
|
494
|
+
* @param {number} x - The x offset.
|
|
495
|
+
* @param {number} y - The y offset.
|
|
496
|
+
* @param {number} z - The z offset.
|
|
497
|
+
* @return {BufferGeometry} A reference to this instance.
|
|
498
|
+
*/
|
|
499
|
+
translate( x, y, z ) {
|
|
500
|
+
|
|
501
|
+
// translate geometry
|
|
502
|
+
|
|
503
|
+
_m1.makeTranslation( x, y, z );
|
|
504
|
+
|
|
505
|
+
this.applyMatrix4( _m1 );
|
|
506
|
+
|
|
507
|
+
return this;
|
|
508
|
+
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Scales the geometry. This is typically done as a one time
|
|
513
|
+
* operation, and not during a loop. Use {@link Object3D#scale} for typical
|
|
514
|
+
* real-time mesh rotation.
|
|
515
|
+
*
|
|
516
|
+
* @param {number} x - The x scale.
|
|
517
|
+
* @param {number} y - The y scale.
|
|
518
|
+
* @param {number} z - The z scale.
|
|
519
|
+
* @return {BufferGeometry} A reference to this instance.
|
|
520
|
+
*/
|
|
521
|
+
scale( x, y, z ) {
|
|
522
|
+
|
|
523
|
+
// scale geometry
|
|
524
|
+
|
|
525
|
+
_m1.makeScale( x, y, z );
|
|
526
|
+
|
|
527
|
+
this.applyMatrix4( _m1 );
|
|
528
|
+
|
|
529
|
+
return this;
|
|
530
|
+
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* Rotates the geometry to face a point in 3D space. This is typically done as a one time
|
|
535
|
+
* operation, and not during a loop. Use {@link Object3D#lookAt} for typical
|
|
536
|
+
* real-time mesh rotation.
|
|
537
|
+
*
|
|
538
|
+
* @param {Vector3} vector - The target point.
|
|
539
|
+
* @return {BufferGeometry} A reference to this instance.
|
|
540
|
+
*/
|
|
541
|
+
lookAt( vector ) {
|
|
542
|
+
|
|
543
|
+
_obj.lookAt( vector );
|
|
544
|
+
|
|
545
|
+
_obj.updateMatrix();
|
|
546
|
+
|
|
547
|
+
this.applyMatrix4( _obj.matrix );
|
|
548
|
+
|
|
549
|
+
return this;
|
|
550
|
+
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* Center the geometry based on its bounding box.
|
|
555
|
+
*
|
|
556
|
+
* @return {BufferGeometry} A reference to this instance.
|
|
557
|
+
*/
|
|
558
|
+
center() {
|
|
559
|
+
|
|
560
|
+
this.computeBoundingBox();
|
|
561
|
+
|
|
562
|
+
this.boundingBox.getCenter( _offset ).negate();
|
|
563
|
+
|
|
564
|
+
this.translate( _offset.x, _offset.y, _offset.z );
|
|
565
|
+
|
|
566
|
+
return this;
|
|
567
|
+
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* Defines a geometry by creating a `position` attribute based on the given array of points. The array
|
|
572
|
+
* can hold 2D or 3D vectors. When using two-dimensional data, the `z` coordinate for all vertices is
|
|
573
|
+
* set to `0`.
|
|
574
|
+
*
|
|
575
|
+
* If the method is used with an existing `position` attribute, the vertex data are overwritten with the
|
|
576
|
+
* data from the array. The length of the array must match the vertex count.
|
|
577
|
+
*
|
|
578
|
+
* @param {Array<Vector2>|Array<Vector3>} points - The points.
|
|
579
|
+
* @return {BufferGeometry} A reference to this instance.
|
|
580
|
+
*/
|
|
581
|
+
setFromPoints( points ) {
|
|
582
|
+
|
|
583
|
+
const positionAttribute = this.getAttribute( 'position' );
|
|
584
|
+
|
|
585
|
+
if ( positionAttribute === undefined ) {
|
|
586
|
+
|
|
587
|
+
const position = [];
|
|
588
|
+
|
|
589
|
+
for ( let i = 0, l = points.length; i < l; i ++ ) {
|
|
590
|
+
|
|
591
|
+
const point = points[ i ];
|
|
592
|
+
position.push( point.x, point.y, point.z || 0 );
|
|
593
|
+
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
this.setAttribute( 'position', new Float32BufferAttribute( position, 3 ) );
|
|
597
|
+
|
|
598
|
+
} else {
|
|
599
|
+
|
|
600
|
+
const l = Math.min( points.length, positionAttribute.count ); // make sure data do not exceed buffer size
|
|
601
|
+
|
|
602
|
+
for ( let i = 0; i < l; i ++ ) {
|
|
603
|
+
|
|
604
|
+
const point = points[ i ];
|
|
605
|
+
positionAttribute.setXYZ( i, point.x, point.y, point.z || 0 );
|
|
606
|
+
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
if ( points.length > positionAttribute.count ) {
|
|
610
|
+
|
|
611
|
+
warn( 'BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.' );
|
|
612
|
+
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
positionAttribute.needsUpdate = true;
|
|
616
|
+
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
return this;
|
|
620
|
+
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Computes the bounding box of the geometry, and updates the `boundingBox` member.
|
|
625
|
+
* The bounding box is not computed by the engine; it must be computed by your app.
|
|
626
|
+
* You may need to recompute the bounding box if the geometry vertices are modified.
|
|
627
|
+
*/
|
|
628
|
+
computeBoundingBox() {
|
|
629
|
+
|
|
630
|
+
if ( this.boundingBox === null ) {
|
|
631
|
+
|
|
632
|
+
this.boundingBox = new Box3();
|
|
633
|
+
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
const position = this.attributes.position;
|
|
637
|
+
const morphAttributesPosition = this.morphAttributes.position;
|
|
638
|
+
|
|
639
|
+
if ( position && position.isGLBufferAttribute ) {
|
|
640
|
+
|
|
641
|
+
error( 'BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.', this );
|
|
642
|
+
|
|
643
|
+
this.boundingBox.set(
|
|
644
|
+
new Vector3( - Infinity, - Infinity, - Infinity ),
|
|
645
|
+
new Vector3( + Infinity, + Infinity, + Infinity )
|
|
646
|
+
);
|
|
647
|
+
|
|
648
|
+
return;
|
|
649
|
+
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
if ( position !== undefined ) {
|
|
653
|
+
|
|
654
|
+
this.boundingBox.setFromBufferAttribute( position );
|
|
655
|
+
|
|
656
|
+
// process morph attributes if present
|
|
657
|
+
|
|
658
|
+
if ( morphAttributesPosition ) {
|
|
659
|
+
|
|
660
|
+
for ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {
|
|
661
|
+
|
|
662
|
+
const morphAttribute = morphAttributesPosition[ i ];
|
|
663
|
+
_box.setFromBufferAttribute( morphAttribute );
|
|
664
|
+
|
|
665
|
+
if ( this.morphTargetsRelative ) {
|
|
666
|
+
|
|
667
|
+
_vector.addVectors( this.boundingBox.min, _box.min );
|
|
668
|
+
this.boundingBox.expandByPoint( _vector );
|
|
669
|
+
|
|
670
|
+
_vector.addVectors( this.boundingBox.max, _box.max );
|
|
671
|
+
this.boundingBox.expandByPoint( _vector );
|
|
672
|
+
|
|
673
|
+
} else {
|
|
674
|
+
|
|
675
|
+
this.boundingBox.expandByPoint( _box.min );
|
|
676
|
+
this.boundingBox.expandByPoint( _box.max );
|
|
677
|
+
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
} else {
|
|
685
|
+
|
|
686
|
+
this.boundingBox.makeEmpty();
|
|
687
|
+
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
if ( isNaN( this.boundingBox.min.x ) || isNaN( this.boundingBox.min.y ) || isNaN( this.boundingBox.min.z ) ) {
|
|
691
|
+
|
|
692
|
+
error( 'BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.', this );
|
|
693
|
+
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
/**
|
|
699
|
+
* Computes the bounding sphere of the geometry, and updates the `boundingSphere` member.
|
|
700
|
+
* The engine automatically computes the bounding sphere when it is needed, e.g., for ray casting or view frustum culling.
|
|
701
|
+
* You may need to recompute the bounding sphere if the geometry vertices are modified.
|
|
702
|
+
*/
|
|
703
|
+
computeBoundingSphere() {
|
|
704
|
+
|
|
705
|
+
if ( this.boundingSphere === null ) {
|
|
706
|
+
|
|
707
|
+
this.boundingSphere = new Sphere();
|
|
708
|
+
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
const position = this.attributes.position;
|
|
712
|
+
const morphAttributesPosition = this.morphAttributes.position;
|
|
713
|
+
|
|
714
|
+
if ( position && position.isGLBufferAttribute ) {
|
|
715
|
+
|
|
716
|
+
error( 'BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.', this );
|
|
717
|
+
|
|
718
|
+
this.boundingSphere.set( new Vector3(), Infinity );
|
|
719
|
+
|
|
720
|
+
return;
|
|
721
|
+
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
if ( position ) {
|
|
725
|
+
|
|
726
|
+
// first, find the center of the bounding sphere
|
|
727
|
+
|
|
728
|
+
const center = this.boundingSphere.center;
|
|
729
|
+
|
|
730
|
+
_box.setFromBufferAttribute( position );
|
|
731
|
+
|
|
732
|
+
// process morph attributes if present
|
|
733
|
+
|
|
734
|
+
if ( morphAttributesPosition ) {
|
|
735
|
+
|
|
736
|
+
for ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {
|
|
737
|
+
|
|
738
|
+
const morphAttribute = morphAttributesPosition[ i ];
|
|
739
|
+
_boxMorphTargets.setFromBufferAttribute( morphAttribute );
|
|
740
|
+
|
|
741
|
+
if ( this.morphTargetsRelative ) {
|
|
742
|
+
|
|
743
|
+
_vector.addVectors( _box.min, _boxMorphTargets.min );
|
|
744
|
+
_box.expandByPoint( _vector );
|
|
745
|
+
|
|
746
|
+
_vector.addVectors( _box.max, _boxMorphTargets.max );
|
|
747
|
+
_box.expandByPoint( _vector );
|
|
748
|
+
|
|
749
|
+
} else {
|
|
750
|
+
|
|
751
|
+
_box.expandByPoint( _boxMorphTargets.min );
|
|
752
|
+
_box.expandByPoint( _boxMorphTargets.max );
|
|
753
|
+
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
_box.getCenter( center );
|
|
761
|
+
|
|
762
|
+
// second, try to find a boundingSphere with a radius smaller than the
|
|
763
|
+
// boundingSphere of the boundingBox: sqrt(3) smaller in the best case
|
|
764
|
+
|
|
765
|
+
let maxRadiusSq = 0;
|
|
766
|
+
|
|
767
|
+
for ( let i = 0, il = position.count; i < il; i ++ ) {
|
|
768
|
+
|
|
769
|
+
_vector.fromBufferAttribute( position, i );
|
|
770
|
+
|
|
771
|
+
maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector ) );
|
|
772
|
+
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
// process morph attributes if present
|
|
776
|
+
|
|
777
|
+
if ( morphAttributesPosition ) {
|
|
778
|
+
|
|
779
|
+
for ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {
|
|
780
|
+
|
|
781
|
+
const morphAttribute = morphAttributesPosition[ i ];
|
|
782
|
+
const morphTargetsRelative = this.morphTargetsRelative;
|
|
783
|
+
|
|
784
|
+
for ( let j = 0, jl = morphAttribute.count; j < jl; j ++ ) {
|
|
785
|
+
|
|
786
|
+
_vector.fromBufferAttribute( morphAttribute, j );
|
|
787
|
+
|
|
788
|
+
if ( morphTargetsRelative ) {
|
|
789
|
+
|
|
790
|
+
_offset.fromBufferAttribute( position, j );
|
|
791
|
+
_vector.add( _offset );
|
|
792
|
+
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector ) );
|
|
796
|
+
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
this.boundingSphere.radius = Math.sqrt( maxRadiusSq );
|
|
804
|
+
|
|
805
|
+
if ( isNaN( this.boundingSphere.radius ) ) {
|
|
806
|
+
|
|
807
|
+
error( 'BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this );
|
|
808
|
+
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
/**
|
|
816
|
+
* Calculates and adds a tangent attribute to this geometry.
|
|
817
|
+
*
|
|
818
|
+
* The computation is only supported for indexed geometries and if position, normal, and uv attributes
|
|
819
|
+
* are defined. When using a tangent space normal map, prefer the MikkTSpace algorithm provided by
|
|
820
|
+
* {@link BufferGeometryUtils#computeMikkTSpaceTangents} instead.
|
|
821
|
+
*/
|
|
822
|
+
computeTangents() {
|
|
823
|
+
|
|
824
|
+
const index = this.index;
|
|
825
|
+
const attributes = this.attributes;
|
|
826
|
+
|
|
827
|
+
// based on http://www.terathon.com/code/tangent.html
|
|
828
|
+
// (per vertex tangents)
|
|
829
|
+
|
|
830
|
+
if ( index === null ||
|
|
831
|
+
attributes.position === undefined ||
|
|
832
|
+
attributes.normal === undefined ||
|
|
833
|
+
attributes.uv === undefined ) {
|
|
834
|
+
|
|
835
|
+
error( 'BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)' );
|
|
836
|
+
return;
|
|
837
|
+
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
const positionAttribute = attributes.position;
|
|
841
|
+
const normalAttribute = attributes.normal;
|
|
842
|
+
const uvAttribute = attributes.uv;
|
|
843
|
+
|
|
844
|
+
if ( this.hasAttribute( 'tangent' ) === false ) {
|
|
845
|
+
|
|
846
|
+
this.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * positionAttribute.count ), 4 ) );
|
|
847
|
+
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
const tangentAttribute = this.getAttribute( 'tangent' );
|
|
851
|
+
|
|
852
|
+
const tan1 = [], tan2 = [];
|
|
853
|
+
|
|
854
|
+
for ( let i = 0; i < positionAttribute.count; i ++ ) {
|
|
855
|
+
|
|
856
|
+
tan1[ i ] = new Vector3();
|
|
857
|
+
tan2[ i ] = new Vector3();
|
|
858
|
+
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
const vA = new Vector3(),
|
|
862
|
+
vB = new Vector3(),
|
|
863
|
+
vC = new Vector3(),
|
|
864
|
+
|
|
865
|
+
uvA = new Vector2(),
|
|
866
|
+
uvB = new Vector2(),
|
|
867
|
+
uvC = new Vector2(),
|
|
868
|
+
|
|
869
|
+
sdir = new Vector3(),
|
|
870
|
+
tdir = new Vector3();
|
|
871
|
+
|
|
872
|
+
function handleTriangle( a, b, c ) {
|
|
873
|
+
|
|
874
|
+
vA.fromBufferAttribute( positionAttribute, a );
|
|
875
|
+
vB.fromBufferAttribute( positionAttribute, b );
|
|
876
|
+
vC.fromBufferAttribute( positionAttribute, c );
|
|
877
|
+
|
|
878
|
+
uvA.fromBufferAttribute( uvAttribute, a );
|
|
879
|
+
uvB.fromBufferAttribute( uvAttribute, b );
|
|
880
|
+
uvC.fromBufferAttribute( uvAttribute, c );
|
|
881
|
+
|
|
882
|
+
vB.sub( vA );
|
|
883
|
+
vC.sub( vA );
|
|
884
|
+
|
|
885
|
+
uvB.sub( uvA );
|
|
886
|
+
uvC.sub( uvA );
|
|
887
|
+
|
|
888
|
+
const r = 1.0 / ( uvB.x * uvC.y - uvC.x * uvB.y );
|
|
889
|
+
|
|
890
|
+
// silently ignore degenerate uv triangles having coincident or colinear vertices
|
|
891
|
+
|
|
892
|
+
if ( ! isFinite( r ) ) return;
|
|
893
|
+
|
|
894
|
+
sdir.copy( vB ).multiplyScalar( uvC.y ).addScaledVector( vC, - uvB.y ).multiplyScalar( r );
|
|
895
|
+
tdir.copy( vC ).multiplyScalar( uvB.x ).addScaledVector( vB, - uvC.x ).multiplyScalar( r );
|
|
896
|
+
|
|
897
|
+
tan1[ a ].add( sdir );
|
|
898
|
+
tan1[ b ].add( sdir );
|
|
899
|
+
tan1[ c ].add( sdir );
|
|
900
|
+
|
|
901
|
+
tan2[ a ].add( tdir );
|
|
902
|
+
tan2[ b ].add( tdir );
|
|
903
|
+
tan2[ c ].add( tdir );
|
|
904
|
+
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
let groups = this.groups;
|
|
908
|
+
|
|
909
|
+
if ( groups.length === 0 ) {
|
|
910
|
+
|
|
911
|
+
groups = [ {
|
|
912
|
+
start: 0,
|
|
913
|
+
count: index.count
|
|
914
|
+
} ];
|
|
915
|
+
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
for ( let i = 0, il = groups.length; i < il; ++ i ) {
|
|
919
|
+
|
|
920
|
+
const group = groups[ i ];
|
|
921
|
+
|
|
922
|
+
const start = group.start;
|
|
923
|
+
const count = group.count;
|
|
924
|
+
|
|
925
|
+
for ( let j = start, jl = start + count; j < jl; j += 3 ) {
|
|
926
|
+
|
|
927
|
+
handleTriangle(
|
|
928
|
+
index.getX( j + 0 ),
|
|
929
|
+
index.getX( j + 1 ),
|
|
930
|
+
index.getX( j + 2 )
|
|
931
|
+
);
|
|
932
|
+
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
const tmp = new Vector3(), tmp2 = new Vector3();
|
|
938
|
+
const n = new Vector3(), n2 = new Vector3();
|
|
939
|
+
|
|
940
|
+
function handleVertex( v ) {
|
|
941
|
+
|
|
942
|
+
n.fromBufferAttribute( normalAttribute, v );
|
|
943
|
+
n2.copy( n );
|
|
944
|
+
|
|
945
|
+
const t = tan1[ v ];
|
|
946
|
+
|
|
947
|
+
// Gram-Schmidt orthogonalize
|
|
948
|
+
|
|
949
|
+
tmp.copy( t );
|
|
950
|
+
tmp.sub( n.multiplyScalar( n.dot( t ) ) ).normalize();
|
|
951
|
+
|
|
952
|
+
// Calculate handedness
|
|
953
|
+
|
|
954
|
+
tmp2.crossVectors( n2, t );
|
|
955
|
+
const test = tmp2.dot( tan2[ v ] );
|
|
956
|
+
const w = ( test < 0.0 ) ? - 1.0 : 1.0;
|
|
957
|
+
|
|
958
|
+
tangentAttribute.setXYZW( v, tmp.x, tmp.y, tmp.z, w );
|
|
959
|
+
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
for ( let i = 0, il = groups.length; i < il; ++ i ) {
|
|
963
|
+
|
|
964
|
+
const group = groups[ i ];
|
|
965
|
+
|
|
966
|
+
const start = group.start;
|
|
967
|
+
const count = group.count;
|
|
968
|
+
|
|
969
|
+
for ( let j = start, jl = start + count; j < jl; j += 3 ) {
|
|
970
|
+
|
|
971
|
+
handleVertex( index.getX( j + 0 ) );
|
|
972
|
+
handleVertex( index.getX( j + 1 ) );
|
|
973
|
+
handleVertex( index.getX( j + 2 ) );
|
|
974
|
+
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
/**
|
|
982
|
+
* Computes vertex normals for the given vertex data. For indexed geometries, the method sets
|
|
983
|
+
* each vertex normal to be the average of the face normals of the faces that share that vertex.
|
|
984
|
+
* For non-indexed geometries, vertices are not shared, and the method sets each vertex normal
|
|
985
|
+
* to be the same as the face normal.
|
|
986
|
+
*/
|
|
987
|
+
computeVertexNormals() {
|
|
988
|
+
|
|
989
|
+
const index = this.index;
|
|
990
|
+
const positionAttribute = this.getAttribute( 'position' );
|
|
991
|
+
|
|
992
|
+
if ( positionAttribute !== undefined ) {
|
|
993
|
+
|
|
994
|
+
let normalAttribute = this.getAttribute( 'normal' );
|
|
995
|
+
|
|
996
|
+
if ( normalAttribute === undefined ) {
|
|
997
|
+
|
|
998
|
+
normalAttribute = new BufferAttribute( new Float32Array( positionAttribute.count * 3 ), 3 );
|
|
999
|
+
this.setAttribute( 'normal', normalAttribute );
|
|
1000
|
+
|
|
1001
|
+
} else {
|
|
1002
|
+
|
|
1003
|
+
// reset existing normals to zero
|
|
1004
|
+
|
|
1005
|
+
for ( let i = 0, il = normalAttribute.count; i < il; i ++ ) {
|
|
1006
|
+
|
|
1007
|
+
normalAttribute.setXYZ( i, 0, 0, 0 );
|
|
1008
|
+
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
const pA = new Vector3(), pB = new Vector3(), pC = new Vector3();
|
|
1014
|
+
const nA = new Vector3(), nB = new Vector3(), nC = new Vector3();
|
|
1015
|
+
const cb = new Vector3(), ab = new Vector3();
|
|
1016
|
+
|
|
1017
|
+
// indexed elements
|
|
1018
|
+
|
|
1019
|
+
if ( index ) {
|
|
1020
|
+
|
|
1021
|
+
for ( let i = 0, il = index.count; i < il; i += 3 ) {
|
|
1022
|
+
|
|
1023
|
+
const vA = index.getX( i + 0 );
|
|
1024
|
+
const vB = index.getX( i + 1 );
|
|
1025
|
+
const vC = index.getX( i + 2 );
|
|
1026
|
+
|
|
1027
|
+
pA.fromBufferAttribute( positionAttribute, vA );
|
|
1028
|
+
pB.fromBufferAttribute( positionAttribute, vB );
|
|
1029
|
+
pC.fromBufferAttribute( positionAttribute, vC );
|
|
1030
|
+
|
|
1031
|
+
cb.subVectors( pC, pB );
|
|
1032
|
+
ab.subVectors( pA, pB );
|
|
1033
|
+
cb.cross( ab );
|
|
1034
|
+
|
|
1035
|
+
nA.fromBufferAttribute( normalAttribute, vA );
|
|
1036
|
+
nB.fromBufferAttribute( normalAttribute, vB );
|
|
1037
|
+
nC.fromBufferAttribute( normalAttribute, vC );
|
|
1038
|
+
|
|
1039
|
+
nA.add( cb );
|
|
1040
|
+
nB.add( cb );
|
|
1041
|
+
nC.add( cb );
|
|
1042
|
+
|
|
1043
|
+
normalAttribute.setXYZ( vA, nA.x, nA.y, nA.z );
|
|
1044
|
+
normalAttribute.setXYZ( vB, nB.x, nB.y, nB.z );
|
|
1045
|
+
normalAttribute.setXYZ( vC, nC.x, nC.y, nC.z );
|
|
1046
|
+
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
} else {
|
|
1050
|
+
|
|
1051
|
+
// non-indexed elements (unconnected triangle soup)
|
|
1052
|
+
|
|
1053
|
+
for ( let i = 0, il = positionAttribute.count; i < il; i += 3 ) {
|
|
1054
|
+
|
|
1055
|
+
pA.fromBufferAttribute( positionAttribute, i + 0 );
|
|
1056
|
+
pB.fromBufferAttribute( positionAttribute, i + 1 );
|
|
1057
|
+
pC.fromBufferAttribute( positionAttribute, i + 2 );
|
|
1058
|
+
|
|
1059
|
+
cb.subVectors( pC, pB );
|
|
1060
|
+
ab.subVectors( pA, pB );
|
|
1061
|
+
cb.cross( ab );
|
|
1062
|
+
|
|
1063
|
+
normalAttribute.setXYZ( i + 0, cb.x, cb.y, cb.z );
|
|
1064
|
+
normalAttribute.setXYZ( i + 1, cb.x, cb.y, cb.z );
|
|
1065
|
+
normalAttribute.setXYZ( i + 2, cb.x, cb.y, cb.z );
|
|
1066
|
+
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
this.normalizeNormals();
|
|
1072
|
+
|
|
1073
|
+
normalAttribute.needsUpdate = true;
|
|
1074
|
+
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
/**
|
|
1080
|
+
* Ensures every normal vector in a geometry will have a magnitude of `1`. This will
|
|
1081
|
+
* correct lighting on the geometry surfaces.
|
|
1082
|
+
*/
|
|
1083
|
+
normalizeNormals() {
|
|
1084
|
+
|
|
1085
|
+
const normals = this.attributes.normal;
|
|
1086
|
+
|
|
1087
|
+
for ( let i = 0, il = normals.count; i < il; i ++ ) {
|
|
1088
|
+
|
|
1089
|
+
_vector.fromBufferAttribute( normals, i );
|
|
1090
|
+
|
|
1091
|
+
_vector.normalize();
|
|
1092
|
+
|
|
1093
|
+
normals.setXYZ( i, _vector.x, _vector.y, _vector.z );
|
|
1094
|
+
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
/**
|
|
1100
|
+
* Return a new non-index version of this indexed geometry. If the geometry
|
|
1101
|
+
* is already non-indexed, the method is a NOOP.
|
|
1102
|
+
*
|
|
1103
|
+
* @return {BufferGeometry} The non-indexed version of this indexed geometry.
|
|
1104
|
+
*/
|
|
1105
|
+
toNonIndexed() {
|
|
1106
|
+
|
|
1107
|
+
function convertBufferAttribute( attribute, indices ) {
|
|
1108
|
+
|
|
1109
|
+
const array = attribute.array;
|
|
1110
|
+
const itemSize = attribute.itemSize;
|
|
1111
|
+
const normalized = attribute.normalized;
|
|
1112
|
+
|
|
1113
|
+
const array2 = new array.constructor( indices.length * itemSize );
|
|
1114
|
+
|
|
1115
|
+
let index = 0, index2 = 0;
|
|
1116
|
+
|
|
1117
|
+
for ( let i = 0, l = indices.length; i < l; i ++ ) {
|
|
1118
|
+
|
|
1119
|
+
if ( attribute.isInterleavedBufferAttribute ) {
|
|
1120
|
+
|
|
1121
|
+
index = indices[ i ] * attribute.data.stride + attribute.offset;
|
|
1122
|
+
|
|
1123
|
+
} else {
|
|
1124
|
+
|
|
1125
|
+
index = indices[ i ] * itemSize;
|
|
1126
|
+
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
for ( let j = 0; j < itemSize; j ++ ) {
|
|
1130
|
+
|
|
1131
|
+
array2[ index2 ++ ] = array[ index ++ ];
|
|
1132
|
+
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
return new BufferAttribute( array2, itemSize, normalized );
|
|
1138
|
+
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
//
|
|
1142
|
+
|
|
1143
|
+
if ( this.index === null ) {
|
|
1144
|
+
|
|
1145
|
+
warn( 'BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.' );
|
|
1146
|
+
return this;
|
|
1147
|
+
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
const geometry2 = new BufferGeometry();
|
|
1151
|
+
|
|
1152
|
+
const indices = this.index.array;
|
|
1153
|
+
const attributes = this.attributes;
|
|
1154
|
+
|
|
1155
|
+
// attributes
|
|
1156
|
+
|
|
1157
|
+
for ( const name in attributes ) {
|
|
1158
|
+
|
|
1159
|
+
const attribute = attributes[ name ];
|
|
1160
|
+
|
|
1161
|
+
const newAttribute = convertBufferAttribute( attribute, indices );
|
|
1162
|
+
|
|
1163
|
+
geometry2.setAttribute( name, newAttribute );
|
|
1164
|
+
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
// morph attributes
|
|
1168
|
+
|
|
1169
|
+
const morphAttributes = this.morphAttributes;
|
|
1170
|
+
|
|
1171
|
+
for ( const name in morphAttributes ) {
|
|
1172
|
+
|
|
1173
|
+
const morphArray = [];
|
|
1174
|
+
const morphAttribute = morphAttributes[ name ]; // morphAttribute: array of Float32BufferAttributes
|
|
1175
|
+
|
|
1176
|
+
for ( let i = 0, il = morphAttribute.length; i < il; i ++ ) {
|
|
1177
|
+
|
|
1178
|
+
const attribute = morphAttribute[ i ];
|
|
1179
|
+
|
|
1180
|
+
const newAttribute = convertBufferAttribute( attribute, indices );
|
|
1181
|
+
|
|
1182
|
+
morphArray.push( newAttribute );
|
|
1183
|
+
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
geometry2.morphAttributes[ name ] = morphArray;
|
|
1187
|
+
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
geometry2.morphTargetsRelative = this.morphTargetsRelative;
|
|
1191
|
+
|
|
1192
|
+
// groups
|
|
1193
|
+
|
|
1194
|
+
const groups = this.groups;
|
|
1195
|
+
|
|
1196
|
+
for ( let i = 0, l = groups.length; i < l; i ++ ) {
|
|
1197
|
+
|
|
1198
|
+
const group = groups[ i ];
|
|
1199
|
+
geometry2.addGroup( group.start, group.count, group.materialIndex );
|
|
1200
|
+
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
return geometry2;
|
|
1204
|
+
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
/**
|
|
1208
|
+
* Serializes the geometry into JSON.
|
|
1209
|
+
*
|
|
1210
|
+
* @return {Object} A JSON object representing the serialized geometry.
|
|
1211
|
+
*/
|
|
1212
|
+
toJSON() {
|
|
1213
|
+
|
|
1214
|
+
const data = {
|
|
1215
|
+
metadata: {
|
|
1216
|
+
version: 4.7,
|
|
1217
|
+
type: 'BufferGeometry',
|
|
1218
|
+
generator: 'BufferGeometry.toJSON'
|
|
1219
|
+
}
|
|
1220
|
+
};
|
|
1221
|
+
|
|
1222
|
+
// standard BufferGeometry serialization
|
|
1223
|
+
|
|
1224
|
+
data.uuid = this.uuid;
|
|
1225
|
+
data.type = this.type;
|
|
1226
|
+
if ( this.name !== '' ) data.name = this.name;
|
|
1227
|
+
if ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;
|
|
1228
|
+
|
|
1229
|
+
if ( this.parameters !== undefined ) {
|
|
1230
|
+
|
|
1231
|
+
const parameters = this.parameters;
|
|
1232
|
+
|
|
1233
|
+
for ( const key in parameters ) {
|
|
1234
|
+
|
|
1235
|
+
if ( parameters[ key ] !== undefined ) data[ key ] = parameters[ key ];
|
|
1236
|
+
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
return data;
|
|
1240
|
+
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
// for simplicity the code assumes attributes are not shared across geometries, see #15811
|
|
1244
|
+
|
|
1245
|
+
data.data = { attributes: {} };
|
|
1246
|
+
|
|
1247
|
+
const index = this.index;
|
|
1248
|
+
|
|
1249
|
+
if ( index !== null ) {
|
|
1250
|
+
|
|
1251
|
+
data.data.index = {
|
|
1252
|
+
type: index.array.constructor.name,
|
|
1253
|
+
array: Array.prototype.slice.call( index.array )
|
|
1254
|
+
};
|
|
1255
|
+
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
const attributes = this.attributes;
|
|
1259
|
+
|
|
1260
|
+
for ( const key in attributes ) {
|
|
1261
|
+
|
|
1262
|
+
const attribute = attributes[ key ];
|
|
1263
|
+
|
|
1264
|
+
data.data.attributes[ key ] = attribute.toJSON( data.data );
|
|
1265
|
+
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
const morphAttributes = {};
|
|
1269
|
+
let hasMorphAttributes = false;
|
|
1270
|
+
|
|
1271
|
+
for ( const key in this.morphAttributes ) {
|
|
1272
|
+
|
|
1273
|
+
const attributeArray = this.morphAttributes[ key ];
|
|
1274
|
+
|
|
1275
|
+
const array = [];
|
|
1276
|
+
|
|
1277
|
+
for ( let i = 0, il = attributeArray.length; i < il; i ++ ) {
|
|
1278
|
+
|
|
1279
|
+
const attribute = attributeArray[ i ];
|
|
1280
|
+
|
|
1281
|
+
array.push( attribute.toJSON( data.data ) );
|
|
1282
|
+
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
if ( array.length > 0 ) {
|
|
1286
|
+
|
|
1287
|
+
morphAttributes[ key ] = array;
|
|
1288
|
+
|
|
1289
|
+
hasMorphAttributes = true;
|
|
1290
|
+
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
if ( hasMorphAttributes ) {
|
|
1296
|
+
|
|
1297
|
+
data.data.morphAttributes = morphAttributes;
|
|
1298
|
+
data.data.morphTargetsRelative = this.morphTargetsRelative;
|
|
1299
|
+
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
const groups = this.groups;
|
|
1303
|
+
|
|
1304
|
+
if ( groups.length > 0 ) {
|
|
1305
|
+
|
|
1306
|
+
data.data.groups = JSON.parse( JSON.stringify( groups ) );
|
|
1307
|
+
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
const boundingSphere = this.boundingSphere;
|
|
1311
|
+
|
|
1312
|
+
if ( boundingSphere !== null ) {
|
|
1313
|
+
|
|
1314
|
+
data.data.boundingSphere = boundingSphere.toJSON();
|
|
1315
|
+
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
return data;
|
|
1319
|
+
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
/**
|
|
1323
|
+
* Returns a new geometry with copied values from this instance.
|
|
1324
|
+
*
|
|
1325
|
+
* @return {BufferGeometry} A clone of this instance.
|
|
1326
|
+
*/
|
|
1327
|
+
clone() {
|
|
1328
|
+
|
|
1329
|
+
return new this.constructor().copy( this );
|
|
1330
|
+
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
/**
|
|
1334
|
+
* Copies the values of the given geometry to this instance.
|
|
1335
|
+
*
|
|
1336
|
+
* @param {BufferGeometry} source - The geometry to copy.
|
|
1337
|
+
* @return {BufferGeometry} A reference to this instance.
|
|
1338
|
+
*/
|
|
1339
|
+
copy( source ) {
|
|
1340
|
+
|
|
1341
|
+
// reset
|
|
1342
|
+
|
|
1343
|
+
this.index = null;
|
|
1344
|
+
this.attributes = {};
|
|
1345
|
+
this.morphAttributes = {};
|
|
1346
|
+
this.groups = [];
|
|
1347
|
+
this.boundingBox = null;
|
|
1348
|
+
this.boundingSphere = null;
|
|
1349
|
+
|
|
1350
|
+
// used for storing cloned, shared data
|
|
1351
|
+
|
|
1352
|
+
const data = {};
|
|
1353
|
+
|
|
1354
|
+
// name
|
|
1355
|
+
|
|
1356
|
+
this.name = source.name;
|
|
1357
|
+
|
|
1358
|
+
// index
|
|
1359
|
+
|
|
1360
|
+
const index = source.index;
|
|
1361
|
+
|
|
1362
|
+
if ( index !== null ) {
|
|
1363
|
+
|
|
1364
|
+
this.setIndex( index.clone() );
|
|
1365
|
+
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
// attributes
|
|
1369
|
+
|
|
1370
|
+
const attributes = source.attributes;
|
|
1371
|
+
|
|
1372
|
+
for ( const name in attributes ) {
|
|
1373
|
+
|
|
1374
|
+
const attribute = attributes[ name ];
|
|
1375
|
+
this.setAttribute( name, attribute.clone( data ) );
|
|
1376
|
+
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
// morph attributes
|
|
1380
|
+
|
|
1381
|
+
const morphAttributes = source.morphAttributes;
|
|
1382
|
+
|
|
1383
|
+
for ( const name in morphAttributes ) {
|
|
1384
|
+
|
|
1385
|
+
const array = [];
|
|
1386
|
+
const morphAttribute = morphAttributes[ name ]; // morphAttribute: array of Float32BufferAttributes
|
|
1387
|
+
|
|
1388
|
+
for ( let i = 0, l = morphAttribute.length; i < l; i ++ ) {
|
|
1389
|
+
|
|
1390
|
+
array.push( morphAttribute[ i ].clone( data ) );
|
|
1391
|
+
|
|
1392
|
+
}
|
|
1393
|
+
|
|
1394
|
+
this.morphAttributes[ name ] = array;
|
|
1395
|
+
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
this.morphTargetsRelative = source.morphTargetsRelative;
|
|
1399
|
+
|
|
1400
|
+
// groups
|
|
1401
|
+
|
|
1402
|
+
const groups = source.groups;
|
|
1403
|
+
|
|
1404
|
+
for ( let i = 0, l = groups.length; i < l; i ++ ) {
|
|
1405
|
+
|
|
1406
|
+
const group = groups[ i ];
|
|
1407
|
+
this.addGroup( group.start, group.count, group.materialIndex );
|
|
1408
|
+
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
// bounding box
|
|
1412
|
+
|
|
1413
|
+
const boundingBox = source.boundingBox;
|
|
1414
|
+
|
|
1415
|
+
if ( boundingBox !== null ) {
|
|
1416
|
+
|
|
1417
|
+
this.boundingBox = boundingBox.clone();
|
|
1418
|
+
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
// bounding sphere
|
|
1422
|
+
|
|
1423
|
+
const boundingSphere = source.boundingSphere;
|
|
1424
|
+
|
|
1425
|
+
if ( boundingSphere !== null ) {
|
|
1426
|
+
|
|
1427
|
+
this.boundingSphere = boundingSphere.clone();
|
|
1428
|
+
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
// draw range
|
|
1432
|
+
|
|
1433
|
+
this.drawRange.start = source.drawRange.start;
|
|
1434
|
+
this.drawRange.count = source.drawRange.count;
|
|
1435
|
+
|
|
1436
|
+
// user data
|
|
1437
|
+
|
|
1438
|
+
this.userData = source.userData;
|
|
1439
|
+
|
|
1440
|
+
return this;
|
|
1441
|
+
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
/**
|
|
1445
|
+
* Frees the GPU-related resources allocated by this instance. Call this
|
|
1446
|
+
* method whenever this instance is no longer used in your app.
|
|
1447
|
+
*
|
|
1448
|
+
* @fires BufferGeometry#dispose
|
|
1449
|
+
*/
|
|
1450
|
+
dispose() {
|
|
1451
|
+
|
|
1452
|
+
this.dispatchEvent( { type: 'dispose' } );
|
|
1453
|
+
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
export { BufferGeometry };
|