@plastic-software/three 0.167.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 +86 -0
- package/build/three.cjs +54311 -0
- package/build/three.module.js +53897 -0
- package/build/three.module.min.js +6 -0
- package/build/three.webgpu.js +76281 -0
- package/build/three.webgpu.min.js +6 -0
- package/examples/fonts/LICENSE +13 -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 +299 -0
- package/examples/jsm/animation/AnimationClipCreator.js +116 -0
- package/examples/jsm/animation/CCDIKSolver.js +484 -0
- package/examples/jsm/animation/MMDAnimationHelper.js +1207 -0
- package/examples/jsm/animation/MMDPhysics.js +1406 -0
- package/examples/jsm/cameras/CinematicCamera.js +208 -0
- package/examples/jsm/capabilities/WebGL.js +108 -0
- package/examples/jsm/capabilities/WebGPU.js +57 -0
- package/examples/jsm/controls/ArcballControls.js +3224 -0
- package/examples/jsm/controls/DragControls.js +282 -0
- package/examples/jsm/controls/FirstPersonControls.js +325 -0
- package/examples/jsm/controls/FlyControls.js +326 -0
- package/examples/jsm/controls/MapControls.js +28 -0
- package/examples/jsm/controls/OrbitControls.js +1532 -0
- package/examples/jsm/controls/PointerLockControls.js +162 -0
- package/examples/jsm/controls/TrackballControls.js +828 -0
- package/examples/jsm/controls/TransformControls.js +1573 -0
- package/examples/jsm/csm/CSM.js +384 -0
- package/examples/jsm/csm/CSMFrustum.js +152 -0
- package/examples/jsm/csm/CSMHelper.js +193 -0
- package/examples/jsm/csm/CSMShader.js +295 -0
- package/examples/jsm/curves/CurveExtras.js +422 -0
- package/examples/jsm/curves/NURBSCurve.js +80 -0
- package/examples/jsm/curves/NURBSSurface.js +52 -0
- package/examples/jsm/curves/NURBSUtils.js +542 -0
- package/examples/jsm/curves/NURBSVolume.js +62 -0
- package/examples/jsm/effects/AnaglyphEffect.js +154 -0
- package/examples/jsm/effects/AsciiEffect.js +263 -0
- package/examples/jsm/effects/OutlineEffect.js +539 -0
- package/examples/jsm/effects/ParallaxBarrierEffect.js +119 -0
- package/examples/jsm/effects/PeppersGhostEffect.js +153 -0
- package/examples/jsm/effects/StereoEffect.js +55 -0
- package/examples/jsm/environments/DebugEnvironment.js +52 -0
- package/examples/jsm/environments/RoomEnvironment.js +144 -0
- package/examples/jsm/exporters/DRACOExporter.js +267 -0
- package/examples/jsm/exporters/EXRExporter.js +579 -0
- package/examples/jsm/exporters/GLTFExporter.js +3389 -0
- package/examples/jsm/exporters/KTX2Exporter.js +292 -0
- package/examples/jsm/exporters/MMDExporter.js +217 -0
- package/examples/jsm/exporters/OBJExporter.js +284 -0
- package/examples/jsm/exporters/PLYExporter.js +528 -0
- package/examples/jsm/exporters/STLExporter.js +199 -0
- package/examples/jsm/exporters/USDZExporter.js +743 -0
- package/examples/jsm/geometries/BoxLineGeometry.js +69 -0
- package/examples/jsm/geometries/ConvexGeometry.js +53 -0
- package/examples/jsm/geometries/DecalGeometry.js +356 -0
- package/examples/jsm/geometries/InstancedPointsGeometry.js +174 -0
- package/examples/jsm/geometries/ParametricGeometries.js +254 -0
- package/examples/jsm/geometries/ParametricGeometry.js +139 -0
- package/examples/jsm/geometries/RoundedBoxGeometry.js +155 -0
- package/examples/jsm/geometries/SDFGeometryGenerator.js +144 -0
- package/examples/jsm/geometries/TeapotGeometry.js +704 -0
- package/examples/jsm/geometries/TextGeometry.js +65 -0
- package/examples/jsm/helpers/LightProbeHelper.js +130 -0
- package/examples/jsm/helpers/OctreeHelper.js +73 -0
- package/examples/jsm/helpers/PositionalAudioHelper.js +109 -0
- package/examples/jsm/helpers/RectAreaLightHelper.js +85 -0
- package/examples/jsm/helpers/TextureHelper.js +237 -0
- package/examples/jsm/helpers/VertexNormalsHelper.js +96 -0
- package/examples/jsm/helpers/VertexTangentsHelper.js +88 -0
- package/examples/jsm/helpers/ViewHelper.js +347 -0
- package/examples/jsm/interactive/HTMLMesh.js +570 -0
- package/examples/jsm/interactive/InteractiveGroup.js +106 -0
- package/examples/jsm/interactive/SelectionBox.js +227 -0
- package/examples/jsm/interactive/SelectionHelper.js +104 -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 +21 -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/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 +178 -0
- package/examples/jsm/libs/mikktspace.module.js +128 -0
- package/examples/jsm/libs/mmdparser.module.js +11530 -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/lights/LightProbeGenerator.js +286 -0
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +91 -0
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +24 -0
- package/examples/jsm/lines/Line2.js +19 -0
- package/examples/jsm/lines/LineGeometry.js +79 -0
- package/examples/jsm/lines/LineMaterial.js +603 -0
- package/examples/jsm/lines/LineSegments2.js +376 -0
- package/examples/jsm/lines/LineSegmentsGeometry.js +241 -0
- package/examples/jsm/lines/Wireframe.js +71 -0
- package/examples/jsm/lines/WireframeGeometry2.js +24 -0
- package/examples/jsm/lines/webgpu/Line2.js +20 -0
- package/examples/jsm/lines/webgpu/LineSegments2.js +376 -0
- package/examples/jsm/loaders/3DMLoader.js +1764 -0
- package/examples/jsm/loaders/3MFLoader.js +1480 -0
- package/examples/jsm/loaders/AMFLoader.js +521 -0
- package/examples/jsm/loaders/BVHLoader.js +437 -0
- package/examples/jsm/loaders/ColladaLoader.js +4116 -0
- package/examples/jsm/loaders/DDSLoader.js +318 -0
- package/examples/jsm/loaders/DRACOLoader.js +613 -0
- package/examples/jsm/loaders/EXRLoader.js +2563 -0
- package/examples/jsm/loaders/FBXLoader.js +4303 -0
- package/examples/jsm/loaders/FontLoader.js +183 -0
- package/examples/jsm/loaders/GCodeLoader.js +261 -0
- package/examples/jsm/loaders/GLTFLoader.js +4730 -0
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +115 -0
- package/examples/jsm/loaders/IESLoader.js +337 -0
- package/examples/jsm/loaders/KMZLoader.js +130 -0
- package/examples/jsm/loaders/KTX2Loader.js +937 -0
- package/examples/jsm/loaders/KTXLoader.js +176 -0
- package/examples/jsm/loaders/LDrawLoader.js +2471 -0
- package/examples/jsm/loaders/LUT3dlLoader.js +168 -0
- package/examples/jsm/loaders/LUTCubeLoader.js +153 -0
- package/examples/jsm/loaders/LUTImageLoader.js +149 -0
- package/examples/jsm/loaders/LWOLoader.js +1052 -0
- package/examples/jsm/loaders/LogLuvLoader.js +606 -0
- package/examples/jsm/loaders/LottieLoader.js +77 -0
- package/examples/jsm/loaders/MD2Loader.js +399 -0
- package/examples/jsm/loaders/MDDLoader.js +102 -0
- package/examples/jsm/loaders/MMDLoader.js +2295 -0
- package/examples/jsm/loaders/MTLLoader.js +567 -0
- package/examples/jsm/loaders/MaterialXLoader.js +845 -0
- package/examples/jsm/loaders/NRRDLoader.js +686 -0
- package/examples/jsm/loaders/OBJLoader.js +905 -0
- package/examples/jsm/loaders/PCDLoader.js +467 -0
- package/examples/jsm/loaders/PDBLoader.js +232 -0
- package/examples/jsm/loaders/PLYLoader.js +771 -0
- package/examples/jsm/loaders/PVRLoader.js +251 -0
- package/examples/jsm/loaders/RGBELoader.js +450 -0
- package/examples/jsm/loaders/RGBMLoader.js +1081 -0
- package/examples/jsm/loaders/STLLoader.js +410 -0
- package/examples/jsm/loaders/SVGLoader.js +3173 -0
- package/examples/jsm/loaders/TDSLoader.js +1124 -0
- package/examples/jsm/loaders/TGALoader.js +517 -0
- package/examples/jsm/loaders/TIFFLoader.js +36 -0
- package/examples/jsm/loaders/TTFLoader.js +214 -0
- package/examples/jsm/loaders/TiltLoader.js +520 -0
- package/examples/jsm/loaders/USDZLoader.js +870 -0
- package/examples/jsm/loaders/UltraHDRLoader.js +583 -0
- package/examples/jsm/loaders/VOXLoader.js +318 -0
- package/examples/jsm/loaders/VRMLLoader.js +3537 -0
- package/examples/jsm/loaders/VTKLoader.js +1236 -0
- package/examples/jsm/loaders/XYZLoader.js +106 -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/materials/MeshGouraudMaterial.js +432 -0
- package/examples/jsm/materials/MeshPostProcessingMaterial.js +144 -0
- package/examples/jsm/math/Capsule.js +82 -0
- package/examples/jsm/math/ColorConverter.js +36 -0
- package/examples/jsm/math/ConvexHull.js +1271 -0
- package/examples/jsm/math/ImprovedNoise.js +71 -0
- package/examples/jsm/math/Lut.js +204 -0
- package/examples/jsm/math/MeshSurfaceSampler.js +250 -0
- package/examples/jsm/math/OBB.js +423 -0
- package/examples/jsm/math/Octree.js +546 -0
- package/examples/jsm/math/SimplexNoise.js +444 -0
- package/examples/jsm/misc/ConvexObjectBreaker.js +519 -0
- package/examples/jsm/misc/GPUComputationRenderer.js +430 -0
- package/examples/jsm/misc/Gyroscope.js +66 -0
- package/examples/jsm/misc/MD2Character.js +276 -0
- package/examples/jsm/misc/MD2CharacterComplex.js +576 -0
- package/examples/jsm/misc/MorphAnimMesh.js +75 -0
- package/examples/jsm/misc/MorphBlendMesh.js +322 -0
- package/examples/jsm/misc/ProgressiveLightMap.js +324 -0
- package/examples/jsm/misc/RollerCoaster.js +566 -0
- package/examples/jsm/misc/Timer.js +128 -0
- package/examples/jsm/misc/TubePainter.js +202 -0
- package/examples/jsm/misc/Volume.js +473 -0
- package/examples/jsm/misc/VolumeSlice.js +229 -0
- package/examples/jsm/modifiers/CurveModifier.js +346 -0
- package/examples/jsm/modifiers/EdgeSplitModifier.js +279 -0
- package/examples/jsm/modifiers/SimplifyModifier.js +618 -0
- package/examples/jsm/modifiers/TessellateModifier.js +307 -0
- package/examples/jsm/objects/GroundedSkybox.js +50 -0
- package/examples/jsm/objects/InstancedPoints.js +21 -0
- package/examples/jsm/objects/Lensflare.js +397 -0
- package/examples/jsm/objects/MarchingCubes.js +1176 -0
- package/examples/jsm/objects/Reflector.js +264 -0
- package/examples/jsm/objects/ReflectorForSSRPass.js +352 -0
- package/examples/jsm/objects/Refractor.js +327 -0
- package/examples/jsm/objects/ShadowMesh.js +80 -0
- package/examples/jsm/objects/Sky.js +219 -0
- package/examples/jsm/objects/SkyMesh.js +189 -0
- package/examples/jsm/objects/Water.js +333 -0
- package/examples/jsm/objects/Water2.js +361 -0
- package/examples/jsm/objects/Water2Mesh.js +160 -0
- package/examples/jsm/objects/WaterMesh.js +103 -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 +306 -0
- package/examples/jsm/physics/JoltPhysics.js +281 -0
- package/examples/jsm/physics/RapierPhysics.js +240 -0
- package/examples/jsm/postprocessing/AfterimagePass.js +104 -0
- package/examples/jsm/postprocessing/BloomPass.js +172 -0
- package/examples/jsm/postprocessing/BokehPass.js +141 -0
- package/examples/jsm/postprocessing/ClearPass.js +46 -0
- package/examples/jsm/postprocessing/CubeTexturePass.js +85 -0
- package/examples/jsm/postprocessing/DotScreenPass.js +65 -0
- package/examples/jsm/postprocessing/EffectComposer.js +231 -0
- package/examples/jsm/postprocessing/FilmPass.js +64 -0
- package/examples/jsm/postprocessing/GTAOPass.js +582 -0
- package/examples/jsm/postprocessing/GlitchPass.js +125 -0
- package/examples/jsm/postprocessing/HalftonePass.js +79 -0
- package/examples/jsm/postprocessing/LUTPass.js +108 -0
- package/examples/jsm/postprocessing/MaskPass.js +104 -0
- package/examples/jsm/postprocessing/OutlinePass.js +654 -0
- package/examples/jsm/postprocessing/OutputPass.js +97 -0
- package/examples/jsm/postprocessing/Pass.js +95 -0
- package/examples/jsm/postprocessing/RenderPass.js +99 -0
- package/examples/jsm/postprocessing/RenderPixelatedPass.js +235 -0
- package/examples/jsm/postprocessing/RenderTransitionPass.js +168 -0
- package/examples/jsm/postprocessing/SAOPass.js +334 -0
- package/examples/jsm/postprocessing/SMAAPass.js +199 -0
- package/examples/jsm/postprocessing/SSAARenderPass.js +228 -0
- package/examples/jsm/postprocessing/SSAOPass.js +414 -0
- package/examples/jsm/postprocessing/SSRPass.js +641 -0
- package/examples/jsm/postprocessing/SavePass.js +79 -0
- package/examples/jsm/postprocessing/ShaderPass.js +77 -0
- package/examples/jsm/postprocessing/TAARenderPass.js +188 -0
- package/examples/jsm/postprocessing/TexturePass.js +67 -0
- package/examples/jsm/postprocessing/UnrealBloomPass.js +415 -0
- package/examples/jsm/renderers/CSS2DRenderer.js +235 -0
- package/examples/jsm/renderers/CSS3DRenderer.js +350 -0
- package/examples/jsm/renderers/Projector.js +918 -0
- package/examples/jsm/renderers/SVGRenderer.js +556 -0
- package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +89 -0
- package/examples/jsm/shaders/AfterimageShader.js +58 -0
- package/examples/jsm/shaders/BasicShader.js +29 -0
- package/examples/jsm/shaders/BleachBypassShader.js +61 -0
- package/examples/jsm/shaders/BlendShader.js +49 -0
- package/examples/jsm/shaders/BokehShader.js +145 -0
- package/examples/jsm/shaders/BokehShader2.js +397 -0
- package/examples/jsm/shaders/BrightnessContrastShader.js +56 -0
- package/examples/jsm/shaders/ColorCorrectionShader.js +52 -0
- package/examples/jsm/shaders/ColorifyShader.js +50 -0
- package/examples/jsm/shaders/ConvolutionShader.js +103 -0
- package/examples/jsm/shaders/CopyShader.js +45 -0
- package/examples/jsm/shaders/DOFMipMapShader.js +56 -0
- package/examples/jsm/shaders/DepthLimitedBlurShader.js +171 -0
- package/examples/jsm/shaders/DigitalGlitch.js +101 -0
- package/examples/jsm/shaders/DotScreenShader.js +70 -0
- package/examples/jsm/shaders/ExposureShader.js +44 -0
- package/examples/jsm/shaders/FXAAShader.js +286 -0
- package/examples/jsm/shaders/FilmShader.js +59 -0
- package/examples/jsm/shaders/FocusShader.js +89 -0
- package/examples/jsm/shaders/FreiChenShader.js +96 -0
- package/examples/jsm/shaders/GTAOShader.js +424 -0
- package/examples/jsm/shaders/GammaCorrectionShader.js +43 -0
- package/examples/jsm/shaders/GodRaysShader.js +321 -0
- package/examples/jsm/shaders/HalftoneShader.js +312 -0
- package/examples/jsm/shaders/HorizontalBlurShader.js +59 -0
- package/examples/jsm/shaders/HorizontalTiltShiftShader.js +63 -0
- package/examples/jsm/shaders/HueSaturationShader.js +67 -0
- package/examples/jsm/shaders/KaleidoShader.js +58 -0
- package/examples/jsm/shaders/LuminosityHighPassShader.js +64 -0
- package/examples/jsm/shaders/LuminosityShader.js +48 -0
- package/examples/jsm/shaders/MMDToonShader.js +134 -0
- package/examples/jsm/shaders/MirrorShader.js +56 -0
- package/examples/jsm/shaders/NormalMapShader.js +55 -0
- package/examples/jsm/shaders/OutputShader.js +85 -0
- package/examples/jsm/shaders/PoissonDenoiseShader.js +226 -0
- package/examples/jsm/shaders/RGBShiftShader.js +54 -0
- package/examples/jsm/shaders/SAOShader.js +179 -0
- package/examples/jsm/shaders/SMAAShader.js +466 -0
- package/examples/jsm/shaders/SSAOShader.js +300 -0
- package/examples/jsm/shaders/SSRShader.js +370 -0
- package/examples/jsm/shaders/SepiaShader.js +52 -0
- package/examples/jsm/shaders/SobelOperatorShader.js +92 -0
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +90 -0
- package/examples/jsm/shaders/TechnicolorShader.js +45 -0
- package/examples/jsm/shaders/ToonShader.js +326 -0
- package/examples/jsm/shaders/TriangleBlurShader.js +74 -0
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +47 -0
- package/examples/jsm/shaders/VelocityShader.js +130 -0
- package/examples/jsm/shaders/VerticalBlurShader.js +59 -0
- package/examples/jsm/shaders/VerticalTiltShiftShader.js +63 -0
- package/examples/jsm/shaders/VignetteShader.js +51 -0
- package/examples/jsm/shaders/VolumeShader.js +289 -0
- package/examples/jsm/shaders/WaterRefractionShader.js +95 -0
- package/examples/jsm/textures/FlakesTexture.js +40 -0
- package/examples/jsm/transpiler/AST.js +270 -0
- package/examples/jsm/transpiler/GLSLDecoder.js +983 -0
- package/examples/jsm/transpiler/ShaderToyDecoder.js +49 -0
- package/examples/jsm/transpiler/TSLEncoder.js +717 -0
- package/examples/jsm/transpiler/Transpiler.js +18 -0
- package/examples/jsm/utils/BufferGeometryUtils.js +1373 -0
- package/examples/jsm/utils/CameraUtils.js +73 -0
- package/examples/jsm/utils/GPUStatsPanel.js +95 -0
- package/examples/jsm/utils/GeometryCompressionUtils.js +639 -0
- package/examples/jsm/utils/GeometryUtils.js +221 -0
- package/examples/jsm/utils/LDrawUtils.js +202 -0
- package/examples/jsm/utils/PackedPhongMaterial.js +178 -0
- package/examples/jsm/utils/SceneUtils.js +313 -0
- package/examples/jsm/utils/ShadowMapViewer.js +210 -0
- package/examples/jsm/utils/SkeletonUtils.js +424 -0
- package/examples/jsm/utils/SortUtils.js +163 -0
- package/examples/jsm/utils/TextureUtils.js +98 -0
- package/examples/jsm/utils/UVsDebug.js +165 -0
- package/examples/jsm/utils/WorkerPool.js +102 -0
- package/examples/jsm/webxr/ARButton.js +232 -0
- package/examples/jsm/webxr/OculusHandModel.js +110 -0
- package/examples/jsm/webxr/OculusHandPointerModel.js +413 -0
- package/examples/jsm/webxr/Text2D.js +38 -0
- package/examples/jsm/webxr/VRButton.js +233 -0
- package/examples/jsm/webxr/XRButton.js +223 -0
- package/examples/jsm/webxr/XRControllerModelFactory.js +312 -0
- package/examples/jsm/webxr/XREstimatedLight.js +223 -0
- package/examples/jsm/webxr/XRHandMeshModel.js +114 -0
- package/examples/jsm/webxr/XRHandModelFactory.js +107 -0
- package/examples/jsm/webxr/XRHandPrimitiveModel.js +103 -0
- package/examples/jsm/webxr/XRPlanes.js +100 -0
- package/package.json +127 -0
- package/src/Three.Legacy.js +21 -0
- package/src/Three.WebGPU.js +194 -0
- package/src/Three.js +184 -0
- package/src/animation/AnimationAction.js +700 -0
- package/src/animation/AnimationClip.js +473 -0
- package/src/animation/AnimationMixer.js +770 -0
- package/src/animation/AnimationObjectGroup.js +387 -0
- package/src/animation/AnimationUtils.js +356 -0
- package/src/animation/KeyframeTrack.js +462 -0
- package/src/animation/PropertyBinding.js +719 -0
- package/src/animation/PropertyMixer.js +318 -0
- package/src/animation/tracks/BooleanKeyframeTrack.js +28 -0
- package/src/animation/tracks/ColorKeyframeTrack.js +15 -0
- package/src/animation/tracks/NumberKeyframeTrack.js +12 -0
- package/src/animation/tracks/QuaternionKeyframeTrack.js +22 -0
- package/src/animation/tracks/StringKeyframeTrack.js +24 -0
- package/src/animation/tracks/VectorKeyframeTrack.js +12 -0
- package/src/audio/Audio.js +400 -0
- package/src/audio/AudioAnalyser.js +40 -0
- package/src/audio/AudioContext.js +25 -0
- package/src/audio/AudioListener.js +137 -0
- package/src/audio/PositionalAudio.js +146 -0
- package/src/cameras/ArrayCamera.js +17 -0
- package/src/cameras/Camera.js +69 -0
- package/src/cameras/CubeCamera.js +173 -0
- package/src/cameras/OrthographicCamera.js +136 -0
- package/src/cameras/PerspectiveCamera.js +268 -0
- package/src/cameras/StereoCamera.js +100 -0
- package/src/constants.js +216 -0
- package/src/core/BufferAttribute.js +639 -0
- package/src/core/BufferGeometry.js +1073 -0
- package/src/core/Clock.js +74 -0
- package/src/core/EventDispatcher.js +87 -0
- package/src/core/GLBufferAttribute.js +60 -0
- package/src/core/InstancedBufferAttribute.js +39 -0
- package/src/core/InstancedBufferGeometry.js +40 -0
- package/src/core/InstancedInterleavedBuffer.js +48 -0
- package/src/core/InterleavedBuffer.js +166 -0
- package/src/core/InterleavedBufferAttribute.js +351 -0
- package/src/core/Layers.js +60 -0
- package/src/core/Object3D.js +1024 -0
- package/src/core/Raycaster.js +128 -0
- package/src/core/RenderTarget.js +162 -0
- package/src/core/Uniform.js +17 -0
- package/src/core/UniformsGroup.js +98 -0
- package/src/extras/DataUtils.js +176 -0
- package/src/extras/Earcut.js +789 -0
- package/src/extras/ImageUtils.js +129 -0
- package/src/extras/PMREMGenerator.js +918 -0
- package/src/extras/ShapeUtils.js +92 -0
- package/src/extras/TextureUtils.js +210 -0
- package/src/extras/core/Curve.js +416 -0
- package/src/extras/core/CurvePath.js +255 -0
- package/src/extras/core/Interpolations.js +79 -0
- package/src/extras/core/Path.js +196 -0
- package/src/extras/core/Shape.js +102 -0
- package/src/extras/core/ShapePath.js +291 -0
- package/src/extras/curves/ArcCurve.js +17 -0
- package/src/extras/curves/CatmullRomCurve3.js +255 -0
- package/src/extras/curves/CubicBezierCurve.js +78 -0
- package/src/extras/curves/CubicBezierCurve3.js +79 -0
- package/src/extras/curves/Curves.js +10 -0
- package/src/extras/curves/EllipseCurve.js +156 -0
- package/src/extras/curves/LineCurve.js +92 -0
- package/src/extras/curves/LineCurve3.js +92 -0
- package/src/extras/curves/QuadraticBezierCurve.js +74 -0
- package/src/extras/curves/QuadraticBezierCurve3.js +75 -0
- package/src/extras/curves/SplineCurve.js +97 -0
- package/src/geometries/BoxGeometry.js +180 -0
- package/src/geometries/CapsuleGeometry.js +33 -0
- package/src/geometries/CircleGeometry.js +101 -0
- package/src/geometries/ConeGeometry.js +31 -0
- package/src/geometries/CylinderGeometry.js +286 -0
- package/src/geometries/DodecahedronGeometry.js +66 -0
- package/src/geometries/EdgesGeometry.js +152 -0
- package/src/geometries/ExtrudeGeometry.js +814 -0
- package/src/geometries/Geometries.js +21 -0
- package/src/geometries/IcosahedronGeometry.js +42 -0
- package/src/geometries/LatheGeometry.js +189 -0
- package/src/geometries/OctahedronGeometry.js +37 -0
- package/src/geometries/PlaneGeometry.js +98 -0
- package/src/geometries/PolyhedronGeometry.js +319 -0
- package/src/geometries/RingGeometry.js +128 -0
- package/src/geometries/ShapeGeometry.js +195 -0
- package/src/geometries/SphereGeometry.js +137 -0
- package/src/geometries/TetrahedronGeometry.js +34 -0
- package/src/geometries/TorusGeometry.js +120 -0
- package/src/geometries/TorusKnotGeometry.js +167 -0
- package/src/geometries/TubeGeometry.js +203 -0
- package/src/geometries/WireframeGeometry.js +147 -0
- package/src/helpers/ArrowHelper.js +114 -0
- package/src/helpers/AxesHelper.js +68 -0
- package/src/helpers/Box3Helper.js +55 -0
- package/src/helpers/BoxHelper.js +113 -0
- package/src/helpers/CameraHelper.js +269 -0
- package/src/helpers/DirectionalLightHelper.js +93 -0
- package/src/helpers/GridHelper.js +56 -0
- package/src/helpers/HemisphereLightHelper.js +88 -0
- package/src/helpers/PlaneHelper.js +63 -0
- package/src/helpers/PointLightHelper.js +92 -0
- package/src/helpers/PolarGridHelper.js +96 -0
- package/src/helpers/SkeletonHelper.js +128 -0
- package/src/helpers/SpotLightHelper.js +111 -0
- package/src/lights/AmbientLight.js +17 -0
- package/src/lights/DirectionalLight.js +43 -0
- package/src/lights/DirectionalLightShadow.js +16 -0
- package/src/lights/HemisphereLight.js +34 -0
- package/src/lights/Light.js +59 -0
- package/src/lights/LightProbe.js +47 -0
- package/src/lights/LightShadow.js +152 -0
- package/src/lights/PointLight.js +57 -0
- package/src/lights/PointLightShadow.js +96 -0
- package/src/lights/RectAreaLight.js +56 -0
- package/src/lights/SpotLight.js +71 -0
- package/src/lights/SpotLightShadow.js +50 -0
- package/src/lights/webgpu/IESSpotLight.js +25 -0
- package/src/loaders/AnimationLoader.js +66 -0
- package/src/loaders/AudioLoader.js +66 -0
- package/src/loaders/BufferGeometryLoader.js +217 -0
- package/src/loaders/Cache.js +42 -0
- package/src/loaders/CompressedTextureLoader.js +134 -0
- package/src/loaders/CubeTextureLoader.js +58 -0
- package/src/loaders/DataTextureLoader.js +131 -0
- package/src/loaders/FileLoader.js +288 -0
- package/src/loaders/ImageBitmapLoader.js +123 -0
- package/src/loaders/ImageLoader.js +91 -0
- package/src/loaders/Loader.js +72 -0
- package/src/loaders/LoaderUtils.js +77 -0
- package/src/loaders/LoadingManager.js +142 -0
- package/src/loaders/MaterialLoader.js +374 -0
- package/src/loaders/ObjectLoader.js +1183 -0
- package/src/loaders/TextureLoader.js +41 -0
- package/src/materials/LineBasicMaterial.js +49 -0
- package/src/materials/LineDashedMaterial.js +35 -0
- package/src/materials/Material.js +531 -0
- package/src/materials/Materials.js +39 -0
- package/src/materials/MeshBasicMaterial.js +84 -0
- package/src/materials/MeshDepthMaterial.js +54 -0
- package/src/materials/MeshDistanceMaterial.js +43 -0
- package/src/materials/MeshLambertMaterial.js +119 -0
- package/src/materials/MeshMatcapMaterial.js +81 -0
- package/src/materials/MeshNormalMaterial.js +61 -0
- package/src/materials/MeshPhongMaterial.js +123 -0
- package/src/materials/MeshPhysicalMaterial.js +244 -0
- package/src/materials/MeshStandardMaterial.js +127 -0
- package/src/materials/MeshToonMaterial.js +102 -0
- package/src/materials/PointsMaterial.js +50 -0
- package/src/materials/RawShaderMaterial.js +17 -0
- package/src/materials/ShaderMaterial.js +185 -0
- package/src/materials/ShadowMaterial.js +37 -0
- package/src/materials/SpriteMaterial.js +54 -0
- package/src/math/Box2.js +204 -0
- package/src/math/Box3.js +534 -0
- package/src/math/Color.js +623 -0
- package/src/math/ColorManagement.js +149 -0
- package/src/math/Cylindrical.js +61 -0
- package/src/math/Euler.js +315 -0
- package/src/math/Frustum.js +186 -0
- package/src/math/Interpolant.js +241 -0
- package/src/math/Line3.js +115 -0
- package/src/math/MathUtils.js +363 -0
- package/src/math/Matrix2.js +54 -0
- package/src/math/Matrix3.js +388 -0
- package/src/math/Matrix4.js +915 -0
- package/src/math/Plane.js +205 -0
- package/src/math/Quaternion.js +686 -0
- package/src/math/Ray.js +493 -0
- package/src/math/Sphere.js +245 -0
- package/src/math/Spherical.js +85 -0
- package/src/math/SphericalHarmonics3.js +243 -0
- package/src/math/Triangle.js +311 -0
- package/src/math/Vector2.js +480 -0
- package/src/math/Vector3.js +724 -0
- package/src/math/Vector4.js +657 -0
- package/src/math/interpolants/CubicInterpolant.js +150 -0
- package/src/math/interpolants/DiscreteInterpolant.js +26 -0
- package/src/math/interpolants/LinearInterpolant.js +38 -0
- package/src/math/interpolants/QuaternionLinearInterpolant.js +39 -0
- package/src/nodes/Nodes.js +225 -0
- package/src/nodes/accessors/AccessorsUtils.js +25 -0
- package/src/nodes/accessors/BatchNode.js +96 -0
- package/src/nodes/accessors/BitangentNode.js +13 -0
- package/src/nodes/accessors/BufferAttributeNode.js +162 -0
- package/src/nodes/accessors/BufferNode.js +36 -0
- package/src/nodes/accessors/CameraNode.js +19 -0
- package/src/nodes/accessors/ClippingNode.js +145 -0
- package/src/nodes/accessors/CubeTextureNode.js +78 -0
- package/src/nodes/accessors/InstanceNode.js +140 -0
- package/src/nodes/accessors/InstancedPointsMaterialNode.js +21 -0
- package/src/nodes/accessors/MaterialNode.js +435 -0
- package/src/nodes/accessors/MaterialProperties.js +3 -0
- package/src/nodes/accessors/MaterialReferenceNode.js +43 -0
- package/src/nodes/accessors/ModelNode.js +37 -0
- package/src/nodes/accessors/ModelViewProjectionNode.js +39 -0
- package/src/nodes/accessors/MorphNode.js +259 -0
- package/src/nodes/accessors/NormalNode.js +14 -0
- package/src/nodes/accessors/Object3DNode.js +150 -0
- package/src/nodes/accessors/PointUVNode.js +26 -0
- package/src/nodes/accessors/PositionNode.js +10 -0
- package/src/nodes/accessors/ReferenceNode.js +171 -0
- package/src/nodes/accessors/ReflectVectorNode.js +10 -0
- package/src/nodes/accessors/RendererReferenceNode.js +29 -0
- package/src/nodes/accessors/SceneNode.js +52 -0
- package/src/nodes/accessors/SkinningNode.js +124 -0
- package/src/nodes/accessors/StorageBufferNode.js +130 -0
- package/src/nodes/accessors/StorageTextureNode.js +104 -0
- package/src/nodes/accessors/TangentNode.js +23 -0
- package/src/nodes/accessors/Texture3DNode.js +100 -0
- package/src/nodes/accessors/TextureBicubicNode.js +94 -0
- package/src/nodes/accessors/TextureNode.js +445 -0
- package/src/nodes/accessors/TextureSizeNode.js +35 -0
- package/src/nodes/accessors/UVNode.js +3 -0
- package/src/nodes/accessors/UniformArrayNode.js +153 -0
- package/src/nodes/accessors/UserDataNode.js +29 -0
- package/src/nodes/accessors/VertexColorNode.js +71 -0
- package/src/nodes/code/CodeNode.js +84 -0
- package/src/nodes/code/ExpressionNode.js +37 -0
- package/src/nodes/code/FunctionCallNode.js +96 -0
- package/src/nodes/code/FunctionNode.js +130 -0
- package/src/nodes/code/ScriptableNode.js +502 -0
- package/src/nodes/code/ScriptableValueNode.js +168 -0
- package/src/nodes/core/AssignNode.js +128 -0
- package/src/nodes/core/AttributeNode.js +134 -0
- package/src/nodes/core/BypassNode.js +45 -0
- package/src/nodes/core/CacheNode.js +46 -0
- package/src/nodes/core/ConstNode.js +32 -0
- package/src/nodes/core/ContextNode.js +67 -0
- package/src/nodes/core/IndexNode.js +72 -0
- package/src/nodes/core/InputNode.js +83 -0
- package/src/nodes/core/LightingModel.js +17 -0
- package/src/nodes/core/MRTNode.js +76 -0
- package/src/nodes/core/Node.js +571 -0
- package/src/nodes/core/NodeAttribute.js +15 -0
- package/src/nodes/core/NodeBuilder.js +1403 -0
- package/src/nodes/core/NodeCache.js +36 -0
- package/src/nodes/core/NodeCode.js +15 -0
- package/src/nodes/core/NodeFrame.js +185 -0
- package/src/nodes/core/NodeFunction.js +22 -0
- package/src/nodes/core/NodeFunctionInput.js +17 -0
- package/src/nodes/core/NodeKeywords.js +80 -0
- package/src/nodes/core/NodeParser.js +11 -0
- package/src/nodes/core/NodeUniform.js +39 -0
- package/src/nodes/core/NodeUtils.js +215 -0
- package/src/nodes/core/NodeVar.js +14 -0
- package/src/nodes/core/NodeVarying.js +17 -0
- package/src/nodes/core/OutputStructNode.js +59 -0
- package/src/nodes/core/ParameterNode.js +33 -0
- package/src/nodes/core/PropertyNode.js +84 -0
- package/src/nodes/core/StackNode.js +89 -0
- package/src/nodes/core/StructTypeNode.js +24 -0
- package/src/nodes/core/TempNode.js +58 -0
- package/src/nodes/core/UniformGroup.js +13 -0
- package/src/nodes/core/UniformGroupNode.js +56 -0
- package/src/nodes/core/UniformNode.js +109 -0
- package/src/nodes/core/VarNode.js +56 -0
- package/src/nodes/core/VaryingNode.js +104 -0
- package/src/nodes/core/constants.js +28 -0
- package/src/nodes/display/AfterImageNode.js +152 -0
- package/src/nodes/display/AnamorphicNode.js +145 -0
- package/src/nodes/display/BleachBypassNode.js +28 -0
- package/src/nodes/display/BlendModeNode.js +128 -0
- package/src/nodes/display/BloomNode.js +333 -0
- package/src/nodes/display/BumpMapNode.js +80 -0
- package/src/nodes/display/ColorAdjustmentNode.js +104 -0
- package/src/nodes/display/ColorSpaceNode.js +108 -0
- package/src/nodes/display/DenoiseNode.js +198 -0
- package/src/nodes/display/DepthOfFieldNode.js +119 -0
- package/src/nodes/display/DotScreenNode.js +75 -0
- package/src/nodes/display/FXAANode.js +327 -0
- package/src/nodes/display/FilmNode.js +52 -0
- package/src/nodes/display/FrontFacingNode.js +41 -0
- package/src/nodes/display/GTAONode.js +324 -0
- package/src/nodes/display/GaussianBlurNode.js +207 -0
- package/src/nodes/display/Lut3DNode.js +53 -0
- package/src/nodes/display/NormalMapNode.js +106 -0
- package/src/nodes/display/PassNode.js +291 -0
- package/src/nodes/display/PixelationPassNode.js +201 -0
- package/src/nodes/display/PosterizeNode.js +32 -0
- package/src/nodes/display/RGBShiftNode.js +49 -0
- package/src/nodes/display/RenderOutputNode.js +56 -0
- package/src/nodes/display/SepiaNode.js +18 -0
- package/src/nodes/display/SobelOperatorNode.js +121 -0
- package/src/nodes/display/ToneMappingNode.js +227 -0
- package/src/nodes/display/TransitionNode.js +76 -0
- package/src/nodes/display/ViewportDepthNode.js +120 -0
- package/src/nodes/display/ViewportDepthTextureNode.js +32 -0
- package/src/nodes/display/ViewportNode.js +137 -0
- package/src/nodes/display/ViewportSharedTextureNode.js +38 -0
- package/src/nodes/display/ViewportTextureNode.js +81 -0
- package/src/nodes/fog/FogExp2Node.js +34 -0
- package/src/nodes/fog/FogNode.js +48 -0
- package/src/nodes/fog/FogRangeNode.js +35 -0
- package/src/nodes/functions/BSDF/BRDF_GGX.js +59 -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/DFGApprox.js +30 -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 +131 -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 +78 -0
- package/src/nodes/functions/PhongLightingModel.js +69 -0
- package/src/nodes/functions/PhysicalLightingModel.js +632 -0
- package/src/nodes/functions/ShadowMaskModel.js +31 -0
- package/src/nodes/functions/ToonLightingModel.js +51 -0
- package/src/nodes/functions/material/getGeometryRoughness.js +13 -0
- package/src/nodes/functions/material/getRoughness.js +18 -0
- package/src/nodes/geometry/RangeNode.js +117 -0
- package/src/nodes/gpgpu/ComputeNode.js +85 -0
- package/src/nodes/lighting/AONode.js +24 -0
- package/src/nodes/lighting/AmbientLightNode.js +27 -0
- package/src/nodes/lighting/AnalyticLightNode.js +334 -0
- package/src/nodes/lighting/BasicEnvironmentNode.js +26 -0
- package/src/nodes/lighting/BasicLightMapNode.js +29 -0
- package/src/nodes/lighting/DirectionalLightNode.js +40 -0
- package/src/nodes/lighting/EnvironmentNode.js +136 -0
- package/src/nodes/lighting/HemisphereLightNode.js +56 -0
- package/src/nodes/lighting/IESSpotLightNode.js +39 -0
- package/src/nodes/lighting/IrradianceNode.js +24 -0
- package/src/nodes/lighting/LightNode.js +57 -0
- package/src/nodes/lighting/LightUtils.js +17 -0
- package/src/nodes/lighting/LightingContextNode.js +66 -0
- package/src/nodes/lighting/LightingNode.js +23 -0
- package/src/nodes/lighting/LightsNode.js +213 -0
- package/src/nodes/lighting/PointLightNode.js +68 -0
- package/src/nodes/lighting/RectAreaLightNode.js +97 -0
- package/src/nodes/lighting/SpotLightNode.js +89 -0
- package/src/nodes/loaders/NodeLoader.js +110 -0
- package/src/nodes/loaders/NodeMaterialLoader.js +60 -0
- package/src/nodes/loaders/NodeObjectLoader.js +71 -0
- package/src/nodes/materials/InstancedPointsNodeMaterial.js +162 -0
- package/src/nodes/materials/Line2NodeMaterial.js +440 -0
- package/src/nodes/materials/LineBasicNodeMaterial.js +28 -0
- package/src/nodes/materials/LineDashedNodeMaterial.js +55 -0
- package/src/nodes/materials/Materials.js +20 -0
- package/src/nodes/materials/MeshBasicNodeMaterial.js +73 -0
- package/src/nodes/materials/MeshLambertNodeMaterial.js +43 -0
- package/src/nodes/materials/MeshMatcapNodeMaterial.js +53 -0
- package/src/nodes/materials/MeshNormalNodeMaterial.js +40 -0
- package/src/nodes/materials/MeshPhongNodeMaterial.js +74 -0
- package/src/nodes/materials/MeshPhysicalNodeMaterial.js +244 -0
- package/src/nodes/materials/MeshSSSNodeMaterial.js +84 -0
- package/src/nodes/materials/MeshStandardNodeMaterial.js +104 -0
- package/src/nodes/materials/MeshToonNodeMaterial.js +34 -0
- package/src/nodes/materials/NodeMaterial.js +680 -0
- package/src/nodes/materials/PointsNodeMaterial.js +39 -0
- package/src/nodes/materials/ShadowNodeMaterial.js +34 -0
- package/src/nodes/materials/SpriteNodeMaterial.js +90 -0
- package/src/nodes/materials/VolumeNodeMaterial.js +106 -0
- package/src/nodes/materialx/DISCLAIMER.md +199 -0
- package/src/nodes/materialx/MaterialXNodes.js +68 -0
- package/src/nodes/materialx/lib/mx_hsv.js +122 -0
- package/src/nodes/materialx/lib/mx_noise.js +1327 -0
- package/src/nodes/materialx/lib/mx_transform_color.js +23 -0
- package/src/nodes/math/CondNode.js +128 -0
- package/src/nodes/math/HashNode.js +34 -0
- package/src/nodes/math/MathNode.js +404 -0
- package/src/nodes/math/MathUtils.js +15 -0
- package/src/nodes/math/OperatorNode.js +306 -0
- package/src/nodes/math/TriNoise3D.js +71 -0
- package/src/nodes/parsers/GLSLNodeFunction.js +152 -0
- package/src/nodes/parsers/GLSLNodeParser.js +14 -0
- package/src/nodes/pmrem/PMREMNode.js +237 -0
- package/src/nodes/pmrem/PMREMUtils.js +288 -0
- package/src/nodes/procedural/CheckerNode.js +42 -0
- package/src/nodes/shadernode/ShaderNode.js +652 -0
- package/src/nodes/utils/ArrayElementNode.js +35 -0
- package/src/nodes/utils/ConvertNode.js +65 -0
- package/src/nodes/utils/DiscardNode.js +28 -0
- package/src/nodes/utils/EquirectUVNode.js +33 -0
- package/src/nodes/utils/FunctionOverloadingNode.js +97 -0
- package/src/nodes/utils/JoinNode.js +61 -0
- package/src/nodes/utils/LoopNode.js +201 -0
- package/src/nodes/utils/MatcapUVNode.js +30 -0
- package/src/nodes/utils/MaxMipLevelNode.js +52 -0
- package/src/nodes/utils/OscNode.js +81 -0
- package/src/nodes/utils/PackingNode.js +55 -0
- package/src/nodes/utils/RTTNode.js +130 -0
- package/src/nodes/utils/ReflectorNode.js +235 -0
- package/src/nodes/utils/RemapNode.js +42 -0
- package/src/nodes/utils/RotateNode.js +68 -0
- package/src/nodes/utils/SetNode.js +62 -0
- package/src/nodes/utils/SplitNode.js +112 -0
- package/src/nodes/utils/SpriteSheetUVNode.js +41 -0
- package/src/nodes/utils/SpriteUtils.js +47 -0
- package/src/nodes/utils/StorageArrayElementNode.js +91 -0
- package/src/nodes/utils/TimerNode.js +94 -0
- package/src/nodes/utils/TriplanarTexturesNode.js +62 -0
- package/src/nodes/utils/UVUtils.js +21 -0
- package/src/nodes/utils/ViewportUtils.js +14 -0
- package/src/objects/BatchedMesh.js +1113 -0
- package/src/objects/Bone.js +17 -0
- package/src/objects/Group.js +17 -0
- package/src/objects/InstancedMesh.js +277 -0
- package/src/objects/LOD.js +214 -0
- package/src/objects/Line.js +245 -0
- package/src/objects/LineLoop.js +17 -0
- package/src/objects/LineSegments.js +55 -0
- package/src/objects/Mesh.js +428 -0
- package/src/objects/Points.js +166 -0
- package/src/objects/Skeleton.js +277 -0
- package/src/objects/SkinnedMesh.js +257 -0
- package/src/objects/Sprite.js +181 -0
- package/src/renderers/WebGL3DRenderTarget.js +22 -0
- package/src/renderers/WebGLArrayRenderTarget.js +22 -0
- package/src/renderers/WebGLCubeRenderTarget.js +146 -0
- package/src/renderers/WebGLRenderTarget.js +15 -0
- package/src/renderers/WebGLRenderer.js +2847 -0
- package/src/renderers/common/Animation.js +50 -0
- package/src/renderers/common/Attributes.js +78 -0
- package/src/renderers/common/Backend.js +198 -0
- package/src/renderers/common/Background.js +141 -0
- package/src/renderers/common/BindGroup.js +17 -0
- package/src/renderers/common/Binding.js +25 -0
- package/src/renderers/common/Bindings.js +205 -0
- package/src/renderers/common/Buffer.js +38 -0
- package/src/renderers/common/BufferUtils.js +33 -0
- package/src/renderers/common/ChainMap.js +59 -0
- package/src/renderers/common/ClippingContext.js +167 -0
- package/src/renderers/common/Color4.js +37 -0
- package/src/renderers/common/ComputePipeline.js +17 -0
- package/src/renderers/common/Constants.js +14 -0
- package/src/renderers/common/CubeRenderTarget.js +71 -0
- package/src/renderers/common/DataMap.js +54 -0
- package/src/renderers/common/Geometries.js +247 -0
- package/src/renderers/common/Info.js +127 -0
- package/src/renderers/common/Pipeline.js +13 -0
- package/src/renderers/common/Pipelines.js +322 -0
- package/src/renderers/common/PostProcessing.js +87 -0
- package/src/renderers/common/ProgrammableStage.js +20 -0
- package/src/renderers/common/QuadMesh.js +53 -0
- package/src/renderers/common/RenderBundle.js +18 -0
- package/src/renderers/common/RenderBundles.js +38 -0
- package/src/renderers/common/RenderContext.js +43 -0
- package/src/renderers/common/RenderContexts.js +63 -0
- package/src/renderers/common/RenderList.js +195 -0
- package/src/renderers/common/RenderLists.js +38 -0
- package/src/renderers/common/RenderObject.js +302 -0
- package/src/renderers/common/RenderObjects.js +93 -0
- package/src/renderers/common/RenderPipeline.js +16 -0
- package/src/renderers/common/Renderer.js +1632 -0
- package/src/renderers/common/SampledTexture.js +83 -0
- package/src/renderers/common/Sampler.js +18 -0
- package/src/renderers/common/StorageBuffer.js +17 -0
- package/src/renderers/common/StorageBufferAttribute.js +17 -0
- package/src/renderers/common/StorageInstancedBufferAttribute.js +17 -0
- package/src/renderers/common/StorageTexture.js +21 -0
- package/src/renderers/common/Textures.js +348 -0
- package/src/renderers/common/Uniform.js +145 -0
- package/src/renderers/common/UniformBuffer.js +15 -0
- package/src/renderers/common/UniformsGroup.js +339 -0
- package/src/renderers/common/extras/PMREMGenerator.js +774 -0
- package/src/renderers/common/nodes/NodeBuilderState.js +58 -0
- package/src/renderers/common/nodes/NodeSampledTexture.js +64 -0
- package/src/renderers/common/nodes/NodeSampler.js +22 -0
- package/src/renderers/common/nodes/NodeStorageBuffer.js +27 -0
- package/src/renderers/common/nodes/NodeUniform.js +135 -0
- package/src/renderers/common/nodes/NodeUniformBuffer.js +24 -0
- package/src/renderers/common/nodes/NodeUniformsGroup.js +38 -0
- package/src/renderers/common/nodes/Nodes.js +488 -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 +7 -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 +11 -0
- package/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.js +11 -0
- package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +11 -0
- package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +31 -0
- package/src/renderers/shaders/ShaderChunk/colorspace_fragment.glsl.js +3 -0
- package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +35 -0
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +137 -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 +9 -0
- package/src/renderers/shaders/ShaderChunk/emissivemap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +15 -0
- package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +62 -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/lights_fragment_begin.glsl.js +202 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js +13 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +40 -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 +214 -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 +157 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +563 -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 +33 -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 +100 -0
- package/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.js +8 -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 +327 -0
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +71 -0
- package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +68 -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 +270 -0
- package/src/renderers/shaders/ShaderLib/background.glsl.js +40 -0
- package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +63 -0
- package/src/renderers/shaders/ShaderLib/cube.glsl.js +36 -0
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +105 -0
- package/src/renderers/shaders/ShaderLib/distanceRGBA.glsl.js +78 -0
- package/src/renderers/shaders/ShaderLib/equirect.glsl.js +35 -0
- package/src/renderers/shaders/ShaderLib/linedashed.glsl.js +78 -0
- package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +116 -0
- package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +125 -0
- package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +112 -0
- package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +87 -0
- package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +127 -0
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +229 -0
- package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +119 -0
- package/src/renderers/shaders/ShaderLib/points.glsl.js +89 -0
- package/src/renderers/shaders/ShaderLib/shadow.glsl.js +58 -0
- package/src/renderers/shaders/ShaderLib/sprite.glsl.js +81 -0
- package/src/renderers/shaders/ShaderLib/vsm.glsl.js +53 -0
- package/src/renderers/shaders/ShaderLib.js +361 -0
- package/src/renderers/shaders/UniformsLib.js +234 -0
- package/src/renderers/shaders/UniformsUtils.js +113 -0
- package/src/renderers/webgl/WebGLAnimation.js +53 -0
- package/src/renderers/webgl/WebGLAttributes.js +202 -0
- package/src/renderers/webgl/WebGLBackground.js +278 -0
- package/src/renderers/webgl/WebGLBindingStates.js +594 -0
- package/src/renderers/webgl/WebGLBufferRenderer.js +93 -0
- package/src/renderers/webgl/WebGLCapabilities.js +142 -0
- package/src/renderers/webgl/WebGLClipping.js +171 -0
- package/src/renderers/webgl/WebGLCubeMaps.js +99 -0
- package/src/renderers/webgl/WebGLCubeUVMaps.js +134 -0
- package/src/renderers/webgl/WebGLExtensions.js +84 -0
- package/src/renderers/webgl/WebGLGeometries.js +211 -0
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +104 -0
- package/src/renderers/webgl/WebGLInfo.js +71 -0
- package/src/renderers/webgl/WebGLLights.js +567 -0
- package/src/renderers/webgl/WebGLMaterials.js +591 -0
- package/src/renderers/webgl/WebGLMorphtargets.js +168 -0
- package/src/renderers/webgl/WebGLObjects.js +92 -0
- package/src/renderers/webgl/WebGLProgram.js +1087 -0
- package/src/renderers/webgl/WebGLPrograms.js +658 -0
- package/src/renderers/webgl/WebGLProperties.js +55 -0
- package/src/renderers/webgl/WebGLRenderLists.js +238 -0
- package/src/renderers/webgl/WebGLRenderStates.js +113 -0
- package/src/renderers/webgl/WebGLShader.js +12 -0
- package/src/renderers/webgl/WebGLShaderCache.js +124 -0
- package/src/renderers/webgl/WebGLShadowMap.js +424 -0
- package/src/renderers/webgl/WebGLState.js +1274 -0
- package/src/renderers/webgl/WebGLTextures.js +2146 -0
- package/src/renderers/webgl/WebGLUniforms.js +1166 -0
- package/src/renderers/webgl/WebGLUniformsGroups.js +392 -0
- package/src/renderers/webgl/WebGLUtils.js +214 -0
- package/src/renderers/webgl-fallback/WebGLBackend.js +1593 -0
- package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +145 -0
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +987 -0
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +258 -0
- package/src/renderers/webgl-fallback/utils/WebGLCapabilities.js +36 -0
- package/src/renderers/webgl-fallback/utils/WebGLConstants.js +13 -0
- package/src/renderers/webgl-fallback/utils/WebGLExtensions.js +38 -0
- package/src/renderers/webgl-fallback/utils/WebGLState.js +738 -0
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +870 -0
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +268 -0
- package/src/renderers/webgpu/WebGPUBackend.js +1473 -0
- package/src/renderers/webgpu/WebGPURenderer.js +53 -0
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +1287 -0
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +159 -0
- package/src/renderers/webgpu/nodes/WGSLNodeParser.js +14 -0
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +322 -0
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +274 -0
- package/src/renderers/webgpu/utils/WebGPUConstants.js +332 -0
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +641 -0
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +285 -0
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +1190 -0
- package/src/renderers/webgpu/utils/WebGPUUtils.js +114 -0
- package/src/renderers/webxr/WebXRController.js +343 -0
- package/src/renderers/webxr/WebXRDepthSensing.js +110 -0
- package/src/renderers/webxr/WebXRManager.js +832 -0
- package/src/scenes/Fog.js +38 -0
- package/src/scenes/FogExp2.js +35 -0
- package/src/scenes/Scene.js +77 -0
- package/src/textures/CanvasTexture.js +17 -0
- package/src/textures/CompressedArrayTexture.js +32 -0
- package/src/textures/CompressedCubeTexture.js +19 -0
- package/src/textures/CompressedTexture.js +28 -0
- package/src/textures/CubeTexture.js +33 -0
- package/src/textures/Data3DTexture.js +35 -0
- package/src/textures/DataArrayTexture.js +41 -0
- package/src/textures/DataTexture.js +22 -0
- package/src/textures/DepthTexture.js +56 -0
- package/src/textures/FramebufferTexture.js +23 -0
- package/src/textures/Source.js +128 -0
- package/src/textures/Texture.js +320 -0
- package/src/textures/VideoTexture.js +55 -0
- package/src/utils.js +120 -0
|
@@ -0,0 +1,1113 @@
|
|
|
1
|
+
import { BufferAttribute } from '../core/BufferAttribute.js';
|
|
2
|
+
import { BufferGeometry } from '../core/BufferGeometry.js';
|
|
3
|
+
import { DataTexture } from '../textures/DataTexture.js';
|
|
4
|
+
import { FloatType, RedIntegerFormat, UnsignedIntType } from '../constants.js';
|
|
5
|
+
import { Matrix4 } from '../math/Matrix4.js';
|
|
6
|
+
import { Mesh } from './Mesh.js';
|
|
7
|
+
import { RGBAFormat } from '../constants.js';
|
|
8
|
+
import { ColorManagement } from '../math/ColorManagement.js';
|
|
9
|
+
import { Box3 } from '../math/Box3.js';
|
|
10
|
+
import { Sphere } from '../math/Sphere.js';
|
|
11
|
+
import { Frustum } from '../math/Frustum.js';
|
|
12
|
+
import { Vector3 } from '../math/Vector3.js';
|
|
13
|
+
import { Color } from '../math/Color.js';
|
|
14
|
+
|
|
15
|
+
function sortOpaque( a, b ) {
|
|
16
|
+
|
|
17
|
+
return a.z - b.z;
|
|
18
|
+
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function sortTransparent( a, b ) {
|
|
22
|
+
|
|
23
|
+
return b.z - a.z;
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
class MultiDrawRenderList {
|
|
28
|
+
|
|
29
|
+
constructor() {
|
|
30
|
+
|
|
31
|
+
this.index = 0;
|
|
32
|
+
this.pool = [];
|
|
33
|
+
this.list = [];
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
push( drawRange, z, index ) {
|
|
38
|
+
|
|
39
|
+
const pool = this.pool;
|
|
40
|
+
const list = this.list;
|
|
41
|
+
if ( this.index >= pool.length ) {
|
|
42
|
+
|
|
43
|
+
pool.push( {
|
|
44
|
+
|
|
45
|
+
start: - 1,
|
|
46
|
+
count: - 1,
|
|
47
|
+
z: - 1,
|
|
48
|
+
index: - 1,
|
|
49
|
+
|
|
50
|
+
} );
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const item = pool[ this.index ];
|
|
55
|
+
list.push( item );
|
|
56
|
+
this.index ++;
|
|
57
|
+
|
|
58
|
+
item.start = drawRange.start;
|
|
59
|
+
item.count = drawRange.count;
|
|
60
|
+
item.z = z;
|
|
61
|
+
item.index = index;
|
|
62
|
+
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
reset() {
|
|
66
|
+
|
|
67
|
+
this.list.length = 0;
|
|
68
|
+
this.index = 0;
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const _matrix = /*@__PURE__*/ new Matrix4();
|
|
75
|
+
const _invMatrixWorld = /*@__PURE__*/ new Matrix4();
|
|
76
|
+
const _identityMatrix = /*@__PURE__*/ new Matrix4();
|
|
77
|
+
const _whiteColor = /*@__PURE__*/ new Color( 1, 1, 1 );
|
|
78
|
+
const _projScreenMatrix = /*@__PURE__*/ new Matrix4();
|
|
79
|
+
const _frustum = /*@__PURE__*/ new Frustum();
|
|
80
|
+
const _box = /*@__PURE__*/ new Box3();
|
|
81
|
+
const _sphere = /*@__PURE__*/ new Sphere();
|
|
82
|
+
const _vector = /*@__PURE__*/ new Vector3();
|
|
83
|
+
const _forward = /*@__PURE__*/ new Vector3();
|
|
84
|
+
const _temp = /*@__PURE__*/ new Vector3();
|
|
85
|
+
const _renderList = /*@__PURE__*/ new MultiDrawRenderList();
|
|
86
|
+
const _mesh = /*@__PURE__*/ new Mesh();
|
|
87
|
+
const _batchIntersects = [];
|
|
88
|
+
|
|
89
|
+
// @TODO: SkinnedMesh support?
|
|
90
|
+
// @TODO: geometry.groups support?
|
|
91
|
+
// @TODO: geometry.drawRange support?
|
|
92
|
+
// @TODO: geometry.morphAttributes support?
|
|
93
|
+
// @TODO: Support uniform parameter per geometry
|
|
94
|
+
// @TODO: Add an "optimize" function to pack geometry and remove data gaps
|
|
95
|
+
|
|
96
|
+
// copies data from attribute "src" into "target" starting at "targetOffset"
|
|
97
|
+
function copyAttributeData( src, target, targetOffset = 0 ) {
|
|
98
|
+
|
|
99
|
+
const itemSize = target.itemSize;
|
|
100
|
+
if ( src.isInterleavedBufferAttribute || src.array.constructor !== target.array.constructor ) {
|
|
101
|
+
|
|
102
|
+
// use the component getters and setters if the array data cannot
|
|
103
|
+
// be copied directly
|
|
104
|
+
const vertexCount = src.count;
|
|
105
|
+
for ( let i = 0; i < vertexCount; i ++ ) {
|
|
106
|
+
|
|
107
|
+
for ( let c = 0; c < itemSize; c ++ ) {
|
|
108
|
+
|
|
109
|
+
target.setComponent( i + targetOffset, c, src.getComponent( i, c ) );
|
|
110
|
+
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
} else {
|
|
116
|
+
|
|
117
|
+
// faster copy approach using typed array set function
|
|
118
|
+
target.array.set( src.array, targetOffset * itemSize );
|
|
119
|
+
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
target.needsUpdate = true;
|
|
123
|
+
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
class BatchedMesh extends Mesh {
|
|
127
|
+
|
|
128
|
+
get maxInstanceCount() {
|
|
129
|
+
|
|
130
|
+
return this._maxInstanceCount;
|
|
131
|
+
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
constructor( maxInstanceCount, maxVertexCount, maxIndexCount = maxVertexCount * 2, material ) {
|
|
135
|
+
|
|
136
|
+
super( new BufferGeometry(), material );
|
|
137
|
+
|
|
138
|
+
this.isBatchedMesh = true;
|
|
139
|
+
this.perObjectFrustumCulled = true;
|
|
140
|
+
this.sortObjects = true;
|
|
141
|
+
this.boundingBox = null;
|
|
142
|
+
this.boundingSphere = null;
|
|
143
|
+
this.customSort = null;
|
|
144
|
+
|
|
145
|
+
// stores visible, active, and geometry id per object
|
|
146
|
+
this._drawInfo = [];
|
|
147
|
+
|
|
148
|
+
// geometry information
|
|
149
|
+
this._drawRanges = [];
|
|
150
|
+
this._reservedRanges = [];
|
|
151
|
+
this._bounds = [];
|
|
152
|
+
|
|
153
|
+
this._maxInstanceCount = maxInstanceCount;
|
|
154
|
+
this._maxVertexCount = maxVertexCount;
|
|
155
|
+
this._maxIndexCount = maxIndexCount;
|
|
156
|
+
|
|
157
|
+
this._geometryInitialized = false;
|
|
158
|
+
this._geometryCount = 0;
|
|
159
|
+
this._multiDrawCounts = new Int32Array( maxInstanceCount );
|
|
160
|
+
this._multiDrawStarts = new Int32Array( maxInstanceCount );
|
|
161
|
+
this._multiDrawCount = 0;
|
|
162
|
+
this._multiDrawInstances = null;
|
|
163
|
+
this._visibilityChanged = true;
|
|
164
|
+
|
|
165
|
+
// Local matrix per geometry by using data texture
|
|
166
|
+
this._matricesTexture = null;
|
|
167
|
+
this._indirectTexture = null;
|
|
168
|
+
this._colorsTexture = null;
|
|
169
|
+
|
|
170
|
+
this._initMatricesTexture();
|
|
171
|
+
this._initIndirectTexture();
|
|
172
|
+
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
_initMatricesTexture() {
|
|
176
|
+
|
|
177
|
+
// layout (1 matrix = 4 pixels)
|
|
178
|
+
// RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)
|
|
179
|
+
// with 8x8 pixel texture max 16 matrices * 4 pixels = (8 * 8)
|
|
180
|
+
// 16x16 pixel texture max 64 matrices * 4 pixels = (16 * 16)
|
|
181
|
+
// 32x32 pixel texture max 256 matrices * 4 pixels = (32 * 32)
|
|
182
|
+
// 64x64 pixel texture max 1024 matrices * 4 pixels = (64 * 64)
|
|
183
|
+
|
|
184
|
+
let size = Math.sqrt( this._maxInstanceCount * 4 ); // 4 pixels needed for 1 matrix
|
|
185
|
+
size = Math.ceil( size / 4 ) * 4;
|
|
186
|
+
size = Math.max( size, 4 );
|
|
187
|
+
|
|
188
|
+
const matricesArray = new Float32Array( size * size * 4 ); // 4 floats per RGBA pixel
|
|
189
|
+
const matricesTexture = new DataTexture( matricesArray, size, size, RGBAFormat, FloatType );
|
|
190
|
+
|
|
191
|
+
this._matricesTexture = matricesTexture;
|
|
192
|
+
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
_initIndirectTexture() {
|
|
196
|
+
|
|
197
|
+
let size = Math.sqrt( this._maxInstanceCount );
|
|
198
|
+
size = Math.ceil( size );
|
|
199
|
+
|
|
200
|
+
const indirectArray = new Uint32Array( size * size );
|
|
201
|
+
const indirectTexture = new DataTexture( indirectArray, size, size, RedIntegerFormat, UnsignedIntType );
|
|
202
|
+
|
|
203
|
+
this._indirectTexture = indirectTexture;
|
|
204
|
+
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
_initColorsTexture() {
|
|
208
|
+
|
|
209
|
+
let size = Math.sqrt( this._maxInstanceCount );
|
|
210
|
+
size = Math.ceil( size );
|
|
211
|
+
|
|
212
|
+
// 4 floats per RGBA pixel initialized to white
|
|
213
|
+
const colorsArray = new Float32Array( size * size * 4 ).fill( 1 );
|
|
214
|
+
const colorsTexture = new DataTexture( colorsArray, size, size, RGBAFormat, FloatType );
|
|
215
|
+
colorsTexture.colorSpace = ColorManagement.workingColorSpace;
|
|
216
|
+
|
|
217
|
+
this._colorsTexture = colorsTexture;
|
|
218
|
+
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
_initializeGeometry( reference ) {
|
|
222
|
+
|
|
223
|
+
const geometry = this.geometry;
|
|
224
|
+
const maxVertexCount = this._maxVertexCount;
|
|
225
|
+
const maxIndexCount = this._maxIndexCount;
|
|
226
|
+
if ( this._geometryInitialized === false ) {
|
|
227
|
+
|
|
228
|
+
for ( const attributeName in reference.attributes ) {
|
|
229
|
+
|
|
230
|
+
const srcAttribute = reference.getAttribute( attributeName );
|
|
231
|
+
const { array, itemSize, normalized } = srcAttribute;
|
|
232
|
+
|
|
233
|
+
const dstArray = new array.constructor( maxVertexCount * itemSize );
|
|
234
|
+
const dstAttribute = new BufferAttribute( dstArray, itemSize, normalized );
|
|
235
|
+
|
|
236
|
+
geometry.setAttribute( attributeName, dstAttribute );
|
|
237
|
+
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
if ( reference.getIndex() !== null ) {
|
|
241
|
+
|
|
242
|
+
// Reserve last u16 index for primitive restart.
|
|
243
|
+
const indexArray = maxVertexCount > 65535
|
|
244
|
+
? new Uint32Array( maxIndexCount )
|
|
245
|
+
: new Uint16Array( maxIndexCount );
|
|
246
|
+
|
|
247
|
+
geometry.setIndex( new BufferAttribute( indexArray, 1 ) );
|
|
248
|
+
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
this._geometryInitialized = true;
|
|
252
|
+
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Make sure the geometry is compatible with the existing combined geometry attributes
|
|
258
|
+
_validateGeometry( geometry ) {
|
|
259
|
+
|
|
260
|
+
// check to ensure the geometries are using consistent attributes and indices
|
|
261
|
+
const batchGeometry = this.geometry;
|
|
262
|
+
if ( Boolean( geometry.getIndex() ) !== Boolean( batchGeometry.getIndex() ) ) {
|
|
263
|
+
|
|
264
|
+
throw new Error( 'BatchedMesh: All geometries must consistently have "index".' );
|
|
265
|
+
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
for ( const attributeName in batchGeometry.attributes ) {
|
|
269
|
+
|
|
270
|
+
if ( ! geometry.hasAttribute( attributeName ) ) {
|
|
271
|
+
|
|
272
|
+
throw new Error( `BatchedMesh: Added geometry missing "${ attributeName }". All geometries must have consistent attributes.` );
|
|
273
|
+
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
const srcAttribute = geometry.getAttribute( attributeName );
|
|
277
|
+
const dstAttribute = batchGeometry.getAttribute( attributeName );
|
|
278
|
+
if ( srcAttribute.itemSize !== dstAttribute.itemSize || srcAttribute.normalized !== dstAttribute.normalized ) {
|
|
279
|
+
|
|
280
|
+
throw new Error( 'BatchedMesh: All attributes must have a consistent itemSize and normalized value.' );
|
|
281
|
+
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
setCustomSort( func ) {
|
|
289
|
+
|
|
290
|
+
this.customSort = func;
|
|
291
|
+
return this;
|
|
292
|
+
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
computeBoundingBox() {
|
|
296
|
+
|
|
297
|
+
if ( this.boundingBox === null ) {
|
|
298
|
+
|
|
299
|
+
this.boundingBox = new Box3();
|
|
300
|
+
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
const geometryCount = this._geometryCount;
|
|
304
|
+
const boundingBox = this.boundingBox;
|
|
305
|
+
const drawInfo = this._drawInfo;
|
|
306
|
+
|
|
307
|
+
boundingBox.makeEmpty();
|
|
308
|
+
for ( let i = 0; i < geometryCount; i ++ ) {
|
|
309
|
+
|
|
310
|
+
if ( drawInfo[ i ].active === false ) continue;
|
|
311
|
+
|
|
312
|
+
const geometryId = drawInfo[ i ].geometryIndex;
|
|
313
|
+
this.getMatrixAt( i, _matrix );
|
|
314
|
+
this.getBoundingBoxAt( geometryId, _box ).applyMatrix4( _matrix );
|
|
315
|
+
boundingBox.union( _box );
|
|
316
|
+
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
computeBoundingSphere() {
|
|
322
|
+
|
|
323
|
+
if ( this.boundingSphere === null ) {
|
|
324
|
+
|
|
325
|
+
this.boundingSphere = new Sphere();
|
|
326
|
+
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
const boundingSphere = this.boundingSphere;
|
|
330
|
+
const drawInfo = this._drawInfo;
|
|
331
|
+
|
|
332
|
+
boundingSphere.makeEmpty();
|
|
333
|
+
for ( let i = 0, l = drawInfo.length; i < l; i ++ ) {
|
|
334
|
+
|
|
335
|
+
if ( drawInfo[ i ].active === false ) continue;
|
|
336
|
+
|
|
337
|
+
const geometryId = drawInfo[ i ].geometryIndex;
|
|
338
|
+
this.getMatrixAt( i, _matrix );
|
|
339
|
+
this.getBoundingSphereAt( geometryId, _sphere ).applyMatrix4( _matrix );
|
|
340
|
+
boundingSphere.union( _sphere );
|
|
341
|
+
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
addInstance( geometryId ) {
|
|
347
|
+
|
|
348
|
+
// ensure we're not over geometry
|
|
349
|
+
if ( this._drawInfo.length >= this._maxInstanceCount ) {
|
|
350
|
+
|
|
351
|
+
throw new Error( 'BatchedMesh: Maximum item count reached.' );
|
|
352
|
+
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
this._drawInfo.push( {
|
|
356
|
+
|
|
357
|
+
visible: true,
|
|
358
|
+
active: true,
|
|
359
|
+
geometryIndex: geometryId,
|
|
360
|
+
|
|
361
|
+
} );
|
|
362
|
+
|
|
363
|
+
// initialize the matrix
|
|
364
|
+
const drawId = this._drawInfo.length - 1;
|
|
365
|
+
const matricesTexture = this._matricesTexture;
|
|
366
|
+
const matricesArray = matricesTexture.image.data;
|
|
367
|
+
_identityMatrix.toArray( matricesArray, drawId * 16 );
|
|
368
|
+
matricesTexture.needsUpdate = true;
|
|
369
|
+
|
|
370
|
+
const colorsTexture = this._colorsTexture;
|
|
371
|
+
if ( colorsTexture ) {
|
|
372
|
+
|
|
373
|
+
_whiteColor.toArray( colorsTexture.image.data, drawId * 4 );
|
|
374
|
+
colorsTexture.needsUpdate = true;
|
|
375
|
+
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
return drawId;
|
|
379
|
+
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
addGeometry( geometry, vertexCount = - 1, indexCount = - 1 ) {
|
|
383
|
+
|
|
384
|
+
this._initializeGeometry( geometry );
|
|
385
|
+
|
|
386
|
+
this._validateGeometry( geometry );
|
|
387
|
+
|
|
388
|
+
// ensure we're not over geometry
|
|
389
|
+
if ( this._drawInfo.length >= this._maxInstanceCount ) {
|
|
390
|
+
|
|
391
|
+
throw new Error( 'BatchedMesh: Maximum item count reached.' );
|
|
392
|
+
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
// get the necessary range fo the geometry
|
|
396
|
+
const reservedRange = {
|
|
397
|
+
vertexStart: - 1,
|
|
398
|
+
vertexCount: - 1,
|
|
399
|
+
indexStart: - 1,
|
|
400
|
+
indexCount: - 1,
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
let lastRange = null;
|
|
404
|
+
const reservedRanges = this._reservedRanges;
|
|
405
|
+
const drawRanges = this._drawRanges;
|
|
406
|
+
const bounds = this._bounds;
|
|
407
|
+
if ( this._geometryCount !== 0 ) {
|
|
408
|
+
|
|
409
|
+
lastRange = reservedRanges[ reservedRanges.length - 1 ];
|
|
410
|
+
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
if ( vertexCount === - 1 ) {
|
|
414
|
+
|
|
415
|
+
reservedRange.vertexCount = geometry.getAttribute( 'position' ).count;
|
|
416
|
+
|
|
417
|
+
} else {
|
|
418
|
+
|
|
419
|
+
reservedRange.vertexCount = vertexCount;
|
|
420
|
+
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
if ( lastRange === null ) {
|
|
424
|
+
|
|
425
|
+
reservedRange.vertexStart = 0;
|
|
426
|
+
|
|
427
|
+
} else {
|
|
428
|
+
|
|
429
|
+
reservedRange.vertexStart = lastRange.vertexStart + lastRange.vertexCount;
|
|
430
|
+
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
const index = geometry.getIndex();
|
|
434
|
+
const hasIndex = index !== null;
|
|
435
|
+
if ( hasIndex ) {
|
|
436
|
+
|
|
437
|
+
if ( indexCount === - 1 ) {
|
|
438
|
+
|
|
439
|
+
reservedRange.indexCount = index.count;
|
|
440
|
+
|
|
441
|
+
} else {
|
|
442
|
+
|
|
443
|
+
reservedRange.indexCount = indexCount;
|
|
444
|
+
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
if ( lastRange === null ) {
|
|
448
|
+
|
|
449
|
+
reservedRange.indexStart = 0;
|
|
450
|
+
|
|
451
|
+
} else {
|
|
452
|
+
|
|
453
|
+
reservedRange.indexStart = lastRange.indexStart + lastRange.indexCount;
|
|
454
|
+
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
if (
|
|
460
|
+
reservedRange.indexStart !== - 1 &&
|
|
461
|
+
reservedRange.indexStart + reservedRange.indexCount > this._maxIndexCount ||
|
|
462
|
+
reservedRange.vertexStart + reservedRange.vertexCount > this._maxVertexCount
|
|
463
|
+
) {
|
|
464
|
+
|
|
465
|
+
throw new Error( 'BatchedMesh: Reserved space request exceeds the maximum buffer size.' );
|
|
466
|
+
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
// update id
|
|
470
|
+
const geometryId = this._geometryCount;
|
|
471
|
+
this._geometryCount ++;
|
|
472
|
+
|
|
473
|
+
// add the reserved range and draw range objects
|
|
474
|
+
reservedRanges.push( reservedRange );
|
|
475
|
+
drawRanges.push( {
|
|
476
|
+
start: hasIndex ? reservedRange.indexStart : reservedRange.vertexStart,
|
|
477
|
+
count: - 1
|
|
478
|
+
} );
|
|
479
|
+
bounds.push( {
|
|
480
|
+
boxInitialized: false,
|
|
481
|
+
box: new Box3(),
|
|
482
|
+
|
|
483
|
+
sphereInitialized: false,
|
|
484
|
+
sphere: new Sphere()
|
|
485
|
+
} );
|
|
486
|
+
|
|
487
|
+
// update the geometry
|
|
488
|
+
this.setGeometryAt( geometryId, geometry );
|
|
489
|
+
|
|
490
|
+
return geometryId;
|
|
491
|
+
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
setGeometryAt( geometryId, geometry ) {
|
|
495
|
+
|
|
496
|
+
if ( geometryId >= this._geometryCount ) {
|
|
497
|
+
|
|
498
|
+
throw new Error( 'BatchedMesh: Maximum geometry count reached.' );
|
|
499
|
+
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
this._validateGeometry( geometry );
|
|
503
|
+
|
|
504
|
+
const batchGeometry = this.geometry;
|
|
505
|
+
const hasIndex = batchGeometry.getIndex() !== null;
|
|
506
|
+
const dstIndex = batchGeometry.getIndex();
|
|
507
|
+
const srcIndex = geometry.getIndex();
|
|
508
|
+
const reservedRange = this._reservedRanges[ geometryId ];
|
|
509
|
+
if (
|
|
510
|
+
hasIndex &&
|
|
511
|
+
srcIndex.count > reservedRange.indexCount ||
|
|
512
|
+
geometry.attributes.position.count > reservedRange.vertexCount
|
|
513
|
+
) {
|
|
514
|
+
|
|
515
|
+
throw new Error( 'BatchedMesh: Reserved space not large enough for provided geometry.' );
|
|
516
|
+
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
// copy geometry over
|
|
520
|
+
const vertexStart = reservedRange.vertexStart;
|
|
521
|
+
const vertexCount = reservedRange.vertexCount;
|
|
522
|
+
for ( const attributeName in batchGeometry.attributes ) {
|
|
523
|
+
|
|
524
|
+
// copy attribute data
|
|
525
|
+
const srcAttribute = geometry.getAttribute( attributeName );
|
|
526
|
+
const dstAttribute = batchGeometry.getAttribute( attributeName );
|
|
527
|
+
copyAttributeData( srcAttribute, dstAttribute, vertexStart );
|
|
528
|
+
|
|
529
|
+
// fill the rest in with zeroes
|
|
530
|
+
const itemSize = srcAttribute.itemSize;
|
|
531
|
+
for ( let i = srcAttribute.count, l = vertexCount; i < l; i ++ ) {
|
|
532
|
+
|
|
533
|
+
const index = vertexStart + i;
|
|
534
|
+
for ( let c = 0; c < itemSize; c ++ ) {
|
|
535
|
+
|
|
536
|
+
dstAttribute.setComponent( index, c, 0 );
|
|
537
|
+
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
dstAttribute.needsUpdate = true;
|
|
543
|
+
dstAttribute.addUpdateRange( vertexStart * itemSize, vertexCount * itemSize );
|
|
544
|
+
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
// copy index
|
|
548
|
+
if ( hasIndex ) {
|
|
549
|
+
|
|
550
|
+
const indexStart = reservedRange.indexStart;
|
|
551
|
+
|
|
552
|
+
// copy index data over
|
|
553
|
+
for ( let i = 0; i < srcIndex.count; i ++ ) {
|
|
554
|
+
|
|
555
|
+
dstIndex.setX( indexStart + i, vertexStart + srcIndex.getX( i ) );
|
|
556
|
+
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
// fill the rest in with zeroes
|
|
560
|
+
for ( let i = srcIndex.count, l = reservedRange.indexCount; i < l; i ++ ) {
|
|
561
|
+
|
|
562
|
+
dstIndex.setX( indexStart + i, vertexStart );
|
|
563
|
+
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
dstIndex.needsUpdate = true;
|
|
567
|
+
dstIndex.addUpdateRange( indexStart, reservedRange.indexCount );
|
|
568
|
+
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
// store the bounding boxes
|
|
572
|
+
const bound = this._bounds[ geometryId ];
|
|
573
|
+
if ( geometry.boundingBox !== null ) {
|
|
574
|
+
|
|
575
|
+
bound.box.copy( geometry.boundingBox );
|
|
576
|
+
bound.boxInitialized = true;
|
|
577
|
+
|
|
578
|
+
} else {
|
|
579
|
+
|
|
580
|
+
bound.boxInitialized = false;
|
|
581
|
+
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
if ( geometry.boundingSphere !== null ) {
|
|
585
|
+
|
|
586
|
+
bound.sphere.copy( geometry.boundingSphere );
|
|
587
|
+
bound.sphereInitialized = true;
|
|
588
|
+
|
|
589
|
+
} else {
|
|
590
|
+
|
|
591
|
+
bound.sphereInitialized = false;
|
|
592
|
+
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
// set drawRange count
|
|
596
|
+
const drawRange = this._drawRanges[ geometryId ];
|
|
597
|
+
const posAttr = geometry.getAttribute( 'position' );
|
|
598
|
+
drawRange.count = hasIndex ? srcIndex.count : posAttr.count;
|
|
599
|
+
this._visibilityChanged = true;
|
|
600
|
+
|
|
601
|
+
return geometryId;
|
|
602
|
+
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
/*
|
|
606
|
+
deleteGeometry( geometryId ) {
|
|
607
|
+
|
|
608
|
+
// TODO: delete geometry and associated instances
|
|
609
|
+
|
|
610
|
+
}
|
|
611
|
+
*/
|
|
612
|
+
|
|
613
|
+
/*
|
|
614
|
+
deleteInstance( instanceId ) {
|
|
615
|
+
|
|
616
|
+
// Note: User needs to call optimize() afterward to pack the data.
|
|
617
|
+
|
|
618
|
+
const drawInfo = this._drawInfo;
|
|
619
|
+
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
620
|
+
|
|
621
|
+
return this;
|
|
622
|
+
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
drawInfo[ instanceId ].active = false;
|
|
626
|
+
this._visibilityChanged = true;
|
|
627
|
+
|
|
628
|
+
return this;
|
|
629
|
+
|
|
630
|
+
}
|
|
631
|
+
*/
|
|
632
|
+
|
|
633
|
+
// get bounding box and compute it if it doesn't exist
|
|
634
|
+
getBoundingBoxAt( geometryId, target ) {
|
|
635
|
+
|
|
636
|
+
if ( geometryId >= this._geometryCount ) {
|
|
637
|
+
|
|
638
|
+
return null;
|
|
639
|
+
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
// compute bounding box
|
|
643
|
+
const bound = this._bounds[ geometryId ];
|
|
644
|
+
const box = bound.box;
|
|
645
|
+
const geometry = this.geometry;
|
|
646
|
+
if ( bound.boxInitialized === false ) {
|
|
647
|
+
|
|
648
|
+
box.makeEmpty();
|
|
649
|
+
|
|
650
|
+
const index = geometry.index;
|
|
651
|
+
const position = geometry.attributes.position;
|
|
652
|
+
const drawRange = this._drawRanges[ geometryId ];
|
|
653
|
+
for ( let i = drawRange.start, l = drawRange.start + drawRange.count; i < l; i ++ ) {
|
|
654
|
+
|
|
655
|
+
let iv = i;
|
|
656
|
+
if ( index ) {
|
|
657
|
+
|
|
658
|
+
iv = index.getX( iv );
|
|
659
|
+
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
box.expandByPoint( _vector.fromBufferAttribute( position, iv ) );
|
|
663
|
+
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
bound.boxInitialized = true;
|
|
667
|
+
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
target.copy( box );
|
|
671
|
+
return target;
|
|
672
|
+
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
// get bounding sphere and compute it if it doesn't exist
|
|
676
|
+
getBoundingSphereAt( geometryId, target ) {
|
|
677
|
+
|
|
678
|
+
if ( geometryId >= this._geometryCount ) {
|
|
679
|
+
|
|
680
|
+
return null;
|
|
681
|
+
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
// compute bounding sphere
|
|
685
|
+
const bound = this._bounds[ geometryId ];
|
|
686
|
+
const sphere = bound.sphere;
|
|
687
|
+
const geometry = this.geometry;
|
|
688
|
+
if ( bound.sphereInitialized === false ) {
|
|
689
|
+
|
|
690
|
+
sphere.makeEmpty();
|
|
691
|
+
|
|
692
|
+
this.getBoundingBoxAt( geometryId, _box );
|
|
693
|
+
_box.getCenter( sphere.center );
|
|
694
|
+
|
|
695
|
+
const index = geometry.index;
|
|
696
|
+
const position = geometry.attributes.position;
|
|
697
|
+
const drawRange = this._drawRanges[ geometryId ];
|
|
698
|
+
|
|
699
|
+
let maxRadiusSq = 0;
|
|
700
|
+
for ( let i = drawRange.start, l = drawRange.start + drawRange.count; i < l; i ++ ) {
|
|
701
|
+
|
|
702
|
+
let iv = i;
|
|
703
|
+
if ( index ) {
|
|
704
|
+
|
|
705
|
+
iv = index.getX( iv );
|
|
706
|
+
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
_vector.fromBufferAttribute( position, iv );
|
|
710
|
+
maxRadiusSq = Math.max( maxRadiusSq, sphere.center.distanceToSquared( _vector ) );
|
|
711
|
+
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
sphere.radius = Math.sqrt( maxRadiusSq );
|
|
715
|
+
bound.sphereInitialized = true;
|
|
716
|
+
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
target.copy( sphere );
|
|
720
|
+
return target;
|
|
721
|
+
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
setMatrixAt( instanceId, matrix ) {
|
|
725
|
+
|
|
726
|
+
// @TODO: Map geometryId to index of the arrays because
|
|
727
|
+
// optimize() can make geometryId mismatch the index
|
|
728
|
+
|
|
729
|
+
const drawInfo = this._drawInfo;
|
|
730
|
+
const matricesTexture = this._matricesTexture;
|
|
731
|
+
const matricesArray = this._matricesTexture.image.data;
|
|
732
|
+
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
733
|
+
|
|
734
|
+
return this;
|
|
735
|
+
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
matrix.toArray( matricesArray, instanceId * 16 );
|
|
739
|
+
matricesTexture.needsUpdate = true;
|
|
740
|
+
|
|
741
|
+
return this;
|
|
742
|
+
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
getMatrixAt( instanceId, matrix ) {
|
|
746
|
+
|
|
747
|
+
const drawInfo = this._drawInfo;
|
|
748
|
+
const matricesArray = this._matricesTexture.image.data;
|
|
749
|
+
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
750
|
+
|
|
751
|
+
return null;
|
|
752
|
+
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
return matrix.fromArray( matricesArray, instanceId * 16 );
|
|
756
|
+
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
setColorAt( instanceId, color ) {
|
|
760
|
+
|
|
761
|
+
if ( this._colorsTexture === null ) {
|
|
762
|
+
|
|
763
|
+
this._initColorsTexture();
|
|
764
|
+
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
// @TODO: Map id to index of the arrays because
|
|
768
|
+
// optimize() can make id mismatch the index
|
|
769
|
+
|
|
770
|
+
const colorsTexture = this._colorsTexture;
|
|
771
|
+
const colorsArray = this._colorsTexture.image.data;
|
|
772
|
+
const drawInfo = this._drawInfo;
|
|
773
|
+
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
774
|
+
|
|
775
|
+
return this;
|
|
776
|
+
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
color.toArray( colorsArray, instanceId * 4 );
|
|
780
|
+
colorsTexture.needsUpdate = true;
|
|
781
|
+
|
|
782
|
+
return this;
|
|
783
|
+
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
getColorAt( instanceId, color ) {
|
|
787
|
+
|
|
788
|
+
const colorsArray = this._colorsTexture.image.data;
|
|
789
|
+
const drawInfo = this._drawInfo;
|
|
790
|
+
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
791
|
+
|
|
792
|
+
return null;
|
|
793
|
+
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
return color.fromArray( colorsArray, instanceId * 4 );
|
|
797
|
+
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
setVisibleAt( instanceId, value ) {
|
|
801
|
+
|
|
802
|
+
// if the geometry is out of range, not active, or visibility state
|
|
803
|
+
// does not change then return early
|
|
804
|
+
const drawInfo = this._drawInfo;
|
|
805
|
+
if (
|
|
806
|
+
instanceId >= drawInfo.length ||
|
|
807
|
+
drawInfo[ instanceId ].active === false ||
|
|
808
|
+
drawInfo[ instanceId ].visible === value
|
|
809
|
+
) {
|
|
810
|
+
|
|
811
|
+
return this;
|
|
812
|
+
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
drawInfo[ instanceId ].visible = value;
|
|
816
|
+
this._visibilityChanged = true;
|
|
817
|
+
|
|
818
|
+
return this;
|
|
819
|
+
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
getVisibleAt( instanceId ) {
|
|
823
|
+
|
|
824
|
+
// return early if the geometry is out of range or not active
|
|
825
|
+
const drawInfo = this._drawInfo;
|
|
826
|
+
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
827
|
+
|
|
828
|
+
return false;
|
|
829
|
+
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
return drawInfo[ instanceId ].visible;
|
|
833
|
+
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
raycast( raycaster, intersects ) {
|
|
837
|
+
|
|
838
|
+
const drawInfo = this._drawInfo;
|
|
839
|
+
const drawRanges = this._drawRanges;
|
|
840
|
+
const matrixWorld = this.matrixWorld;
|
|
841
|
+
const batchGeometry = this.geometry;
|
|
842
|
+
|
|
843
|
+
// iterate over each geometry
|
|
844
|
+
_mesh.material = this.material;
|
|
845
|
+
_mesh.geometry.index = batchGeometry.index;
|
|
846
|
+
_mesh.geometry.attributes = batchGeometry.attributes;
|
|
847
|
+
if ( _mesh.geometry.boundingBox === null ) {
|
|
848
|
+
|
|
849
|
+
_mesh.geometry.boundingBox = new Box3();
|
|
850
|
+
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
if ( _mesh.geometry.boundingSphere === null ) {
|
|
854
|
+
|
|
855
|
+
_mesh.geometry.boundingSphere = new Sphere();
|
|
856
|
+
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
for ( let i = 0, l = drawInfo.length; i < l; i ++ ) {
|
|
860
|
+
|
|
861
|
+
if ( ! drawInfo[ i ].visible || ! drawInfo[ i ].active ) {
|
|
862
|
+
|
|
863
|
+
continue;
|
|
864
|
+
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
const geometryId = drawInfo[ i ].geometryIndex;
|
|
868
|
+
const drawRange = drawRanges[ geometryId ];
|
|
869
|
+
_mesh.geometry.setDrawRange( drawRange.start, drawRange.count );
|
|
870
|
+
|
|
871
|
+
// ge the intersects
|
|
872
|
+
this.getMatrixAt( i, _mesh.matrixWorld ).premultiply( matrixWorld );
|
|
873
|
+
this.getBoundingBoxAt( geometryId, _mesh.geometry.boundingBox );
|
|
874
|
+
this.getBoundingSphereAt( geometryId, _mesh.geometry.boundingSphere );
|
|
875
|
+
_mesh.raycast( raycaster, _batchIntersects );
|
|
876
|
+
|
|
877
|
+
// add batch id to the intersects
|
|
878
|
+
for ( let j = 0, l = _batchIntersects.length; j < l; j ++ ) {
|
|
879
|
+
|
|
880
|
+
const intersect = _batchIntersects[ j ];
|
|
881
|
+
intersect.object = this;
|
|
882
|
+
intersect.batchId = i;
|
|
883
|
+
intersects.push( intersect );
|
|
884
|
+
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
_batchIntersects.length = 0;
|
|
888
|
+
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
_mesh.material = null;
|
|
892
|
+
_mesh.geometry.index = null;
|
|
893
|
+
_mesh.geometry.attributes = {};
|
|
894
|
+
_mesh.geometry.setDrawRange( 0, Infinity );
|
|
895
|
+
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
copy( source ) {
|
|
899
|
+
|
|
900
|
+
super.copy( source );
|
|
901
|
+
|
|
902
|
+
this.geometry = source.geometry.clone();
|
|
903
|
+
this.perObjectFrustumCulled = source.perObjectFrustumCulled;
|
|
904
|
+
this.sortObjects = source.sortObjects;
|
|
905
|
+
this.boundingBox = source.boundingBox !== null ? source.boundingBox.clone() : null;
|
|
906
|
+
this.boundingSphere = source.boundingSphere !== null ? source.boundingSphere.clone() : null;
|
|
907
|
+
|
|
908
|
+
this._drawRanges = source._drawRanges.map( range => ( { ...range } ) );
|
|
909
|
+
this._reservedRanges = source._reservedRanges.map( range => ( { ...range } ) );
|
|
910
|
+
|
|
911
|
+
this._drawInfo = source._drawInfo.map( inf => ( { ...inf } ) );
|
|
912
|
+
this._bounds = source._bounds.map( bound => ( {
|
|
913
|
+
boxInitialized: bound.boxInitialized,
|
|
914
|
+
box: bound.box.clone(),
|
|
915
|
+
|
|
916
|
+
sphereInitialized: bound.sphereInitialized,
|
|
917
|
+
sphere: bound.sphere.clone()
|
|
918
|
+
} ) );
|
|
919
|
+
|
|
920
|
+
this._maxInstanceCount = source._maxInstanceCount;
|
|
921
|
+
this._maxVertexCount = source._maxVertexCount;
|
|
922
|
+
this._maxIndexCount = source._maxIndexCount;
|
|
923
|
+
|
|
924
|
+
this._geometryInitialized = source._geometryInitialized;
|
|
925
|
+
this._geometryCount = source._geometryCount;
|
|
926
|
+
this._multiDrawCounts = source._multiDrawCounts.slice();
|
|
927
|
+
this._multiDrawStarts = source._multiDrawStarts.slice();
|
|
928
|
+
|
|
929
|
+
this._matricesTexture = source._matricesTexture.clone();
|
|
930
|
+
this._matricesTexture.image.data = this._matricesTexture.image.data.slice();
|
|
931
|
+
|
|
932
|
+
if ( this._colorsTexture !== null ) {
|
|
933
|
+
|
|
934
|
+
this._colorsTexture = source._colorsTexture.clone();
|
|
935
|
+
this._colorsTexture.image.data = this._colorsTexture.image.data.slice();
|
|
936
|
+
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
return this;
|
|
940
|
+
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
dispose() {
|
|
944
|
+
|
|
945
|
+
// Assuming the geometry is not shared with other meshes
|
|
946
|
+
this.geometry.dispose();
|
|
947
|
+
|
|
948
|
+
this._matricesTexture.dispose();
|
|
949
|
+
this._matricesTexture = null;
|
|
950
|
+
|
|
951
|
+
this._indirectTexture.dispose();
|
|
952
|
+
this._indirectTexture = null;
|
|
953
|
+
|
|
954
|
+
if ( this._colorsTexture !== null ) {
|
|
955
|
+
|
|
956
|
+
this._colorsTexture.dispose();
|
|
957
|
+
this._colorsTexture = null;
|
|
958
|
+
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
return this;
|
|
962
|
+
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
onBeforeRender( renderer, scene, camera, geometry, material/*, _group*/ ) {
|
|
966
|
+
|
|
967
|
+
// if visibility has not changed and frustum culling and object sorting is not required
|
|
968
|
+
// then skip iterating over all items
|
|
969
|
+
if ( ! this._visibilityChanged && ! this.perObjectFrustumCulled && ! this.sortObjects ) {
|
|
970
|
+
|
|
971
|
+
return;
|
|
972
|
+
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
// the indexed version of the multi draw function requires specifying the start
|
|
976
|
+
// offset in bytes.
|
|
977
|
+
const index = geometry.getIndex();
|
|
978
|
+
const bytesPerElement = index === null ? 1 : index.array.BYTES_PER_ELEMENT;
|
|
979
|
+
|
|
980
|
+
const drawInfo = this._drawInfo;
|
|
981
|
+
const multiDrawStarts = this._multiDrawStarts;
|
|
982
|
+
const multiDrawCounts = this._multiDrawCounts;
|
|
983
|
+
const drawRanges = this._drawRanges;
|
|
984
|
+
const perObjectFrustumCulled = this.perObjectFrustumCulled;
|
|
985
|
+
const indirectTexture = this._indirectTexture;
|
|
986
|
+
const indirectArray = indirectTexture.image.data;
|
|
987
|
+
|
|
988
|
+
// prepare the frustum in the local frame
|
|
989
|
+
if ( perObjectFrustumCulled ) {
|
|
990
|
+
|
|
991
|
+
_projScreenMatrix
|
|
992
|
+
.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse )
|
|
993
|
+
.multiply( this.matrixWorld );
|
|
994
|
+
_frustum.setFromProjectionMatrix(
|
|
995
|
+
_projScreenMatrix,
|
|
996
|
+
renderer.coordinateSystem
|
|
997
|
+
);
|
|
998
|
+
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
let count = 0;
|
|
1002
|
+
if ( this.sortObjects ) {
|
|
1003
|
+
|
|
1004
|
+
// get the camera position in the local frame
|
|
1005
|
+
_invMatrixWorld.copy( this.matrixWorld ).invert();
|
|
1006
|
+
_vector.setFromMatrixPosition( camera.matrixWorld ).applyMatrix4( _invMatrixWorld );
|
|
1007
|
+
_forward.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld ).transformDirection( _invMatrixWorld );
|
|
1008
|
+
|
|
1009
|
+
for ( let i = 0, l = drawInfo.length; i < l; i ++ ) {
|
|
1010
|
+
|
|
1011
|
+
if ( drawInfo[ i ].visible && drawInfo[ i ].active ) {
|
|
1012
|
+
|
|
1013
|
+
const geometryId = drawInfo[ i ].geometryIndex;
|
|
1014
|
+
|
|
1015
|
+
// get the bounds in world space
|
|
1016
|
+
this.getMatrixAt( i, _matrix );
|
|
1017
|
+
this.getBoundingSphereAt( geometryId, _sphere ).applyMatrix4( _matrix );
|
|
1018
|
+
|
|
1019
|
+
// determine whether the batched geometry is within the frustum
|
|
1020
|
+
let culled = false;
|
|
1021
|
+
if ( perObjectFrustumCulled ) {
|
|
1022
|
+
|
|
1023
|
+
culled = ! _frustum.intersectsSphere( _sphere );
|
|
1024
|
+
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
if ( ! culled ) {
|
|
1028
|
+
|
|
1029
|
+
// get the distance from camera used for sorting
|
|
1030
|
+
const z = _temp.subVectors( _sphere.center, _vector ).dot( _forward );
|
|
1031
|
+
_renderList.push( drawRanges[ geometryId ], z, i );
|
|
1032
|
+
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
// Sort the draw ranges and prep for rendering
|
|
1040
|
+
const list = _renderList.list;
|
|
1041
|
+
const customSort = this.customSort;
|
|
1042
|
+
if ( customSort === null ) {
|
|
1043
|
+
|
|
1044
|
+
list.sort( material.transparent ? sortTransparent : sortOpaque );
|
|
1045
|
+
|
|
1046
|
+
} else {
|
|
1047
|
+
|
|
1048
|
+
customSort.call( this, list, camera );
|
|
1049
|
+
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
for ( let i = 0, l = list.length; i < l; i ++ ) {
|
|
1053
|
+
|
|
1054
|
+
const item = list[ i ];
|
|
1055
|
+
multiDrawStarts[ count ] = item.start * bytesPerElement;
|
|
1056
|
+
multiDrawCounts[ count ] = item.count;
|
|
1057
|
+
indirectArray[ count ] = item.index;
|
|
1058
|
+
count ++;
|
|
1059
|
+
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
_renderList.reset();
|
|
1063
|
+
|
|
1064
|
+
} else {
|
|
1065
|
+
|
|
1066
|
+
for ( let i = 0, l = drawInfo.length; i < l; i ++ ) {
|
|
1067
|
+
|
|
1068
|
+
if ( drawInfo[ i ].visible && drawInfo[ i ].active ) {
|
|
1069
|
+
|
|
1070
|
+
const geometryId = drawInfo[ i ].geometryIndex;
|
|
1071
|
+
|
|
1072
|
+
// determine whether the batched geometry is within the frustum
|
|
1073
|
+
let culled = false;
|
|
1074
|
+
if ( perObjectFrustumCulled ) {
|
|
1075
|
+
|
|
1076
|
+
// get the bounds in world space
|
|
1077
|
+
this.getMatrixAt( i, _matrix );
|
|
1078
|
+
this.getBoundingSphereAt( geometryId, _sphere ).applyMatrix4( _matrix );
|
|
1079
|
+
culled = ! _frustum.intersectsSphere( _sphere );
|
|
1080
|
+
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
if ( ! culled ) {
|
|
1084
|
+
|
|
1085
|
+
const range = drawRanges[ geometryId ];
|
|
1086
|
+
multiDrawStarts[ count ] = range.start * bytesPerElement;
|
|
1087
|
+
multiDrawCounts[ count ] = range.count;
|
|
1088
|
+
indirectArray[ count ] = i;
|
|
1089
|
+
count ++;
|
|
1090
|
+
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
indirectTexture.needsUpdate = true;
|
|
1100
|
+
this._multiDrawCount = count;
|
|
1101
|
+
this._visibilityChanged = false;
|
|
1102
|
+
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
onBeforeShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial/* , group */ ) {
|
|
1106
|
+
|
|
1107
|
+
this.onBeforeRender( renderer, null, shadowCamera, geometry, depthMaterial );
|
|
1108
|
+
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
export { BatchedMesh };
|