@gnsx/three 0.184.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +85 -0
- package/build/three.cjs +79695 -0
- package/build/three.core.js +59732 -0
- package/build/three.core.min.js +6 -0
- package/build/three.module.js +19552 -0
- package/build/three.module.min.js +6 -0
- package/build/three.tsl.js +654 -0
- package/build/three.tsl.min.js +6 -0
- package/build/three.webgpu.js +83969 -0
- package/build/three.webgpu.min.js +6 -0
- package/build/three.webgpu.nodes.js +83702 -0
- package/build/three.webgpu.nodes.min.js +6 -0
- package/examples/fonts/LICENSE +13 -0
- package/examples/fonts/MPLUSRounded1c/MPLUSRounded1c-Regular.typeface.json.zip +0 -0
- package/examples/fonts/MPLUSRounded1c/OFL.txt +91 -0
- package/examples/fonts/README.md +11 -0
- package/examples/fonts/droid/NOTICE +190 -0
- package/examples/fonts/droid/README.txt +18 -0
- package/examples/fonts/droid/droid_sans_bold.typeface.json +1 -0
- package/examples/fonts/droid/droid_sans_mono_regular.typeface.json +1 -0
- package/examples/fonts/droid/droid_sans_regular.typeface.json +1 -0
- package/examples/fonts/droid/droid_serif_bold.typeface.json +1 -0
- package/examples/fonts/droid/droid_serif_regular.typeface.json +1 -0
- package/examples/fonts/gentilis_bold.typeface.json +1 -0
- package/examples/fonts/gentilis_regular.typeface.json +1 -0
- package/examples/fonts/helvetiker_bold.typeface.json +1 -0
- package/examples/fonts/helvetiker_regular.typeface.json +1 -0
- package/examples/fonts/optimer_bold.typeface.json +1 -0
- package/examples/fonts/optimer_regular.typeface.json +1 -0
- package/examples/fonts/ttf/README.md +9 -0
- package/examples/fonts/ttf/kenpixel.ttf +0 -0
- package/examples/jsm/Addons.js +293 -0
- package/examples/jsm/animation/AnimationClipCreator.js +168 -0
- package/examples/jsm/animation/CCDIKSolver.js +595 -0
- package/examples/jsm/capabilities/WebGL.js +113 -0
- package/examples/jsm/capabilities/WebGPU.js +59 -0
- package/examples/jsm/controls/ArcballControls.js +3539 -0
- package/examples/jsm/controls/DragControls.js +452 -0
- package/examples/jsm/controls/FirstPersonControls.js +451 -0
- package/examples/jsm/controls/FlyControls.js +384 -0
- package/examples/jsm/controls/MapControls.js +116 -0
- package/examples/jsm/controls/OrbitControls.js +1963 -0
- package/examples/jsm/controls/PointerLockControls.js +264 -0
- package/examples/jsm/controls/TrackballControls.js +1001 -0
- package/examples/jsm/controls/TransformControls.js +1950 -0
- package/examples/jsm/csm/CSM.js +598 -0
- package/examples/jsm/csm/CSMFrustum.js +209 -0
- package/examples/jsm/csm/CSMHelper.js +243 -0
- package/examples/jsm/csm/CSMShader.js +307 -0
- package/examples/jsm/csm/CSMShadowNode.js +603 -0
- package/examples/jsm/curves/CurveExtras.js +694 -0
- package/examples/jsm/curves/NURBSCurve.js +155 -0
- package/examples/jsm/curves/NURBSSurface.js +98 -0
- package/examples/jsm/curves/NURBSUtils.js +532 -0
- package/examples/jsm/curves/NURBSVolume.js +82 -0
- package/examples/jsm/effects/AnaglyphEffect.js +274 -0
- package/examples/jsm/effects/AsciiEffect.js +310 -0
- package/examples/jsm/effects/OutlineEffect.js +489 -0
- package/examples/jsm/effects/ParallaxBarrierEffect.js +155 -0
- package/examples/jsm/effects/StereoEffect.js +91 -0
- package/examples/jsm/environments/ColorEnvironment.js +59 -0
- package/examples/jsm/environments/DebugEnvironment.js +102 -0
- package/examples/jsm/environments/RoomEnvironment.js +185 -0
- package/examples/jsm/exporters/DRACOExporter.js +311 -0
- package/examples/jsm/exporters/EXRExporter.js +618 -0
- package/examples/jsm/exporters/GLTFExporter.js +3738 -0
- package/examples/jsm/exporters/KTX2Exporter.js +347 -0
- package/examples/jsm/exporters/OBJExporter.js +308 -0
- package/examples/jsm/exporters/PLYExporter.js +562 -0
- package/examples/jsm/exporters/STLExporter.js +221 -0
- package/examples/jsm/exporters/USDZExporter.js +1254 -0
- package/examples/jsm/geometries/BoxLineGeometry.js +92 -0
- package/examples/jsm/geometries/ConvexGeometry.js +72 -0
- package/examples/jsm/geometries/DecalGeometry.js +420 -0
- package/examples/jsm/geometries/ParametricFunctions.js +100 -0
- package/examples/jsm/geometries/ParametricGeometry.js +172 -0
- package/examples/jsm/geometries/RoundedBoxGeometry.js +216 -0
- package/examples/jsm/geometries/TeapotGeometry.js +689 -0
- package/examples/jsm/geometries/TextGeometry.js +102 -0
- package/examples/jsm/gpgpu/BitonicSort.js +715 -0
- package/examples/jsm/helpers/AnimationPathHelper.js +302 -0
- package/examples/jsm/helpers/LightProbeGridHelper.js +221 -0
- package/examples/jsm/helpers/LightProbeHelper.js +165 -0
- package/examples/jsm/helpers/LightProbeHelperGPU.js +102 -0
- package/examples/jsm/helpers/OctreeHelper.js +109 -0
- package/examples/jsm/helpers/PositionalAudioHelper.js +169 -0
- package/examples/jsm/helpers/RapierHelper.js +59 -0
- package/examples/jsm/helpers/RectAreaLightHelper.js +118 -0
- package/examples/jsm/helpers/TextureHelper.js +265 -0
- package/examples/jsm/helpers/TextureHelperGPU.js +214 -0
- package/examples/jsm/helpers/VertexNormalsHelper.js +155 -0
- package/examples/jsm/helpers/VertexTangentsHelper.js +133 -0
- package/examples/jsm/helpers/ViewHelper.js +519 -0
- package/examples/jsm/inspector/Extension.js +13 -0
- package/examples/jsm/inspector/Inspector.js +542 -0
- package/examples/jsm/inspector/RendererInspector.js +425 -0
- package/examples/jsm/inspector/extensions/extensions.json +6 -0
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.js +916 -0
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.js +281 -0
- package/examples/jsm/inspector/tabs/Console.js +238 -0
- package/examples/jsm/inspector/tabs/Memory.js +128 -0
- package/examples/jsm/inspector/tabs/Parameters.js +380 -0
- package/examples/jsm/inspector/tabs/Performance.js +268 -0
- package/examples/jsm/inspector/tabs/Settings.js +264 -0
- package/examples/jsm/inspector/tabs/Timeline.js +1611 -0
- package/examples/jsm/inspector/tabs/Viewer.js +268 -0
- package/examples/jsm/inspector/ui/Graph.js +95 -0
- package/examples/jsm/inspector/ui/Item.js +170 -0
- package/examples/jsm/inspector/ui/List.js +75 -0
- package/examples/jsm/inspector/ui/Profiler.js +2072 -0
- package/examples/jsm/inspector/ui/Style.js +1667 -0
- package/examples/jsm/inspector/ui/Tab.js +265 -0
- package/examples/jsm/inspector/ui/Values.js +476 -0
- package/examples/jsm/inspector/ui/utils.js +69 -0
- package/examples/jsm/interaction/InteractionManager.js +226 -0
- package/examples/jsm/interactive/HTMLMesh.js +601 -0
- package/examples/jsm/interactive/InteractiveGroup.js +224 -0
- package/examples/jsm/interactive/SelectionBox.js +324 -0
- package/examples/jsm/interactive/SelectionHelper.js +150 -0
- package/examples/jsm/libs/ammo.wasm.js +822 -0
- package/examples/jsm/libs/ammo.wasm.wasm +0 -0
- package/examples/jsm/libs/basis/README.md +46 -0
- package/examples/jsm/libs/basis/basis_transcoder.js +19 -0
- package/examples/jsm/libs/basis/basis_transcoder.wasm +0 -0
- package/examples/jsm/libs/chevrotain.module.min.js +141 -0
- package/examples/jsm/libs/demuxer_mp4.js +109 -0
- package/examples/jsm/libs/draco/README.md +32 -0
- package/examples/jsm/libs/draco/draco_decoder.js +34 -0
- package/examples/jsm/libs/draco/draco_decoder.wasm +0 -0
- package/examples/jsm/libs/draco/draco_encoder.js +33 -0
- package/examples/jsm/libs/draco/draco_wasm_wrapper.js +117 -0
- package/examples/jsm/libs/draco/gltf/draco_decoder.js +33 -0
- package/examples/jsm/libs/draco/gltf/draco_decoder.wasm +0 -0
- package/examples/jsm/libs/draco/gltf/draco_encoder.js +33 -0
- package/examples/jsm/libs/draco/gltf/draco_wasm_wrapper.js +116 -0
- package/examples/jsm/libs/ecsy.module.js +1792 -0
- package/examples/jsm/libs/fflate.module.js +2672 -0
- package/examples/jsm/libs/ktx-parse.module.js +1 -0
- package/examples/jsm/libs/lil-gui.module.min.js +8 -0
- package/examples/jsm/libs/lottie_canvas.module.js +14849 -0
- package/examples/jsm/libs/meshopt_decoder.module.js +196 -0
- package/examples/jsm/libs/mikktspace.module.js +128 -0
- package/examples/jsm/libs/motion-controllers.module.js +397 -0
- package/examples/jsm/libs/opentype.module.js +14506 -0
- package/examples/jsm/libs/potpack.module.js +125 -0
- package/examples/jsm/libs/rhino3dm/rhino3dm.js +21 -0
- package/examples/jsm/libs/rhino3dm/rhino3dm.module.js +16 -0
- package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
- package/examples/jsm/libs/stats.module.js +167 -0
- package/examples/jsm/libs/surfaceNet.js +201 -0
- package/examples/jsm/libs/tween.module.js +876 -0
- package/examples/jsm/libs/utif.module.js +1665 -0
- package/examples/jsm/libs/zstddec.module.js +1 -0
- package/examples/jsm/lighting/DynamicLighting.js +82 -0
- package/examples/jsm/lighting/LightProbeGrid.js +651 -0
- package/examples/jsm/lighting/TiledLighting.js +42 -0
- package/examples/jsm/lights/LightProbeGenerator.js +337 -0
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +127 -0
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +40 -0
- package/examples/jsm/lines/Line2.js +56 -0
- package/examples/jsm/lines/LineGeometry.js +157 -0
- package/examples/jsm/lines/LineMaterial.js +703 -0
- package/examples/jsm/lines/LineSegments2.js +426 -0
- package/examples/jsm/lines/LineSegmentsGeometry.js +298 -0
- package/examples/jsm/lines/Wireframe.js +108 -0
- package/examples/jsm/lines/WireframeGeometry2.js +49 -0
- package/examples/jsm/lines/webgpu/Line2.js +46 -0
- package/examples/jsm/lines/webgpu/LineSegments2.js +411 -0
- package/examples/jsm/lines/webgpu/Wireframe.js +86 -0
- package/examples/jsm/loaders/3DMLoader.js +1836 -0
- package/examples/jsm/loaders/3MFLoader.js +1621 -0
- package/examples/jsm/loaders/AMFLoader.js +541 -0
- package/examples/jsm/loaders/BVHLoader.js +484 -0
- package/examples/jsm/loaders/ColladaLoader.js +153 -0
- package/examples/jsm/loaders/DDSLoader.js +385 -0
- package/examples/jsm/loaders/DRACOLoader.js +739 -0
- package/examples/jsm/loaders/EXRLoader.js +3423 -0
- package/examples/jsm/loaders/FBXLoader.js +4580 -0
- package/examples/jsm/loaders/FontLoader.js +260 -0
- package/examples/jsm/loaders/GCodeLoader.js +318 -0
- package/examples/jsm/loaders/GLTFLoader.js +4860 -0
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +164 -0
- package/examples/jsm/loaders/HDRLoader.js +485 -0
- package/examples/jsm/loaders/IESLoader.js +379 -0
- package/examples/jsm/loaders/KMZLoader.js +163 -0
- package/examples/jsm/loaders/KTX2Loader.js +1257 -0
- package/examples/jsm/loaders/KTXLoader.js +197 -0
- package/examples/jsm/loaders/LDrawLoader.js +2510 -0
- package/examples/jsm/loaders/LUT3dlLoader.js +205 -0
- package/examples/jsm/loaders/LUTCubeLoader.js +190 -0
- package/examples/jsm/loaders/LUTImageLoader.js +190 -0
- package/examples/jsm/loaders/LWOLoader.js +1047 -0
- package/examples/jsm/loaders/LottieLoader.js +130 -0
- package/examples/jsm/loaders/MD2Loader.js +435 -0
- package/examples/jsm/loaders/MDDLoader.js +147 -0
- package/examples/jsm/loaders/MTLLoader.js +593 -0
- package/examples/jsm/loaders/MaterialXLoader.js +1104 -0
- package/examples/jsm/loaders/NRRDLoader.js +718 -0
- package/examples/jsm/loaders/OBJLoader.js +955 -0
- package/examples/jsm/loaders/PCDLoader.js +620 -0
- package/examples/jsm/loaders/PDBLoader.js +272 -0
- package/examples/jsm/loaders/PLYLoader.js +805 -0
- package/examples/jsm/loaders/PVRLoader.js +270 -0
- package/examples/jsm/loaders/RGBELoader.js +18 -0
- package/examples/jsm/loaders/STLLoader.js +421 -0
- package/examples/jsm/loaders/SVGLoader.js +3267 -0
- package/examples/jsm/loaders/TDSLoader.js +1142 -0
- package/examples/jsm/loaders/TGALoader.js +538 -0
- package/examples/jsm/loaders/TIFFLoader.js +59 -0
- package/examples/jsm/loaders/TTFLoader.js +261 -0
- package/examples/jsm/loaders/USDLoader.js +279 -0
- package/examples/jsm/loaders/USDZLoader.js +16 -0
- package/examples/jsm/loaders/UltraHDRLoader.js +755 -0
- package/examples/jsm/loaders/VOXLoader.js +919 -0
- package/examples/jsm/loaders/VRMLLoader.js +3646 -0
- package/examples/jsm/loaders/VTKLoader.js +1293 -0
- package/examples/jsm/loaders/XYZLoader.js +143 -0
- package/examples/jsm/loaders/collada/ColladaComposer.js +3044 -0
- package/examples/jsm/loaders/collada/ColladaParser.js +1977 -0
- package/examples/jsm/loaders/lwo/IFFParser.js +1217 -0
- package/examples/jsm/loaders/lwo/LWO2Parser.js +414 -0
- package/examples/jsm/loaders/lwo/LWO3Parser.js +373 -0
- package/examples/jsm/loaders/usd/USDAParser.js +828 -0
- package/examples/jsm/loaders/usd/USDCParser.js +1878 -0
- package/examples/jsm/loaders/usd/USDComposer.js +4594 -0
- package/examples/jsm/materials/LDrawConditionalLineMaterial.js +183 -0
- package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +154 -0
- package/examples/jsm/materials/WoodNodeMaterial.js +533 -0
- package/examples/jsm/math/Capsule.js +159 -0
- package/examples/jsm/math/ColorConverter.js +58 -0
- package/examples/jsm/math/ColorSpaces.js +147 -0
- package/examples/jsm/math/ConvexHull.js +1695 -0
- package/examples/jsm/math/ImprovedNoise.js +88 -0
- package/examples/jsm/math/Lut.js +317 -0
- package/examples/jsm/math/MeshSurfaceSampler.js +315 -0
- package/examples/jsm/math/OBB.js +535 -0
- package/examples/jsm/math/Octree.js +822 -0
- package/examples/jsm/math/SimplexNoise.js +470 -0
- package/examples/jsm/misc/ConvexObjectBreaker.js +539 -0
- package/examples/jsm/misc/GPUComputationRenderer.js +508 -0
- package/examples/jsm/misc/Gyroscope.js +78 -0
- package/examples/jsm/misc/MD2Character.js +391 -0
- package/examples/jsm/misc/MD2CharacterComplex.js +740 -0
- package/examples/jsm/misc/MorphAnimMesh.js +119 -0
- package/examples/jsm/misc/MorphBlendMesh.js +425 -0
- package/examples/jsm/misc/ProgressiveLightMap.js +370 -0
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +322 -0
- package/examples/jsm/misc/RollerCoaster.js +661 -0
- package/examples/jsm/misc/TubePainter.js +599 -0
- package/examples/jsm/misc/Volume.js +520 -0
- package/examples/jsm/misc/VolumeSlice.js +275 -0
- package/examples/jsm/modifiers/CurveModifier.js +374 -0
- package/examples/jsm/modifiers/CurveModifierGPU.js +256 -0
- package/examples/jsm/modifiers/EdgeSplitModifier.js +299 -0
- package/examples/jsm/modifiers/SimplifyModifier.js +632 -0
- package/examples/jsm/modifiers/TessellateModifier.js +340 -0
- package/examples/jsm/objects/GroundedSkybox.js +69 -0
- package/examples/jsm/objects/Lensflare.js +489 -0
- package/examples/jsm/objects/LensflareMesh.js +376 -0
- package/examples/jsm/objects/MarchingCubes.js +1261 -0
- package/examples/jsm/objects/Reflector.js +386 -0
- package/examples/jsm/objects/ReflectorForSSRPass.js +393 -0
- package/examples/jsm/objects/Refractor.js +389 -0
- package/examples/jsm/objects/ShadowMesh.js +130 -0
- package/examples/jsm/objects/Sky.js +321 -0
- package/examples/jsm/objects/SkyMesh.js +377 -0
- package/examples/jsm/objects/Water.js +374 -0
- package/examples/jsm/objects/Water2.js +403 -0
- package/examples/jsm/objects/Water2Mesh.js +199 -0
- package/examples/jsm/objects/WaterMesh.js +194 -0
- package/examples/jsm/offscreen/jank.js +45 -0
- package/examples/jsm/offscreen/offscreen.js +8 -0
- package/examples/jsm/offscreen/scene.js +86 -0
- package/examples/jsm/physics/AmmoPhysics.js +359 -0
- package/examples/jsm/physics/JoltPhysics.js +334 -0
- package/examples/jsm/physics/RapierPhysics.js +436 -0
- package/examples/jsm/postprocessing/AfterimagePass.js +185 -0
- package/examples/jsm/postprocessing/BloomPass.js +274 -0
- package/examples/jsm/postprocessing/BokehPass.js +218 -0
- package/examples/jsm/postprocessing/ClearPass.js +97 -0
- package/examples/jsm/postprocessing/CubeTexturePass.js +146 -0
- package/examples/jsm/postprocessing/DotScreenPass.js +114 -0
- package/examples/jsm/postprocessing/EffectComposer.js +365 -0
- package/examples/jsm/postprocessing/FXAAPass.js +40 -0
- package/examples/jsm/postprocessing/FilmPass.js +113 -0
- package/examples/jsm/postprocessing/GTAOPass.js +727 -0
- package/examples/jsm/postprocessing/GlitchPass.js +177 -0
- package/examples/jsm/postprocessing/HalftonePass.js +134 -0
- package/examples/jsm/postprocessing/LUTPass.js +138 -0
- package/examples/jsm/postprocessing/MaskPass.js +195 -0
- package/examples/jsm/postprocessing/OutlinePass.js +776 -0
- package/examples/jsm/postprocessing/OutputPass.js +148 -0
- package/examples/jsm/postprocessing/Pass.js +191 -0
- package/examples/jsm/postprocessing/RenderPass.js +193 -0
- package/examples/jsm/postprocessing/RenderPixelatedPass.js +314 -0
- package/examples/jsm/postprocessing/RenderTransitionPass.js +267 -0
- package/examples/jsm/postprocessing/SAOPass.js +407 -0
- package/examples/jsm/postprocessing/SMAAPass.js +230 -0
- package/examples/jsm/postprocessing/SSAARenderPass.js +313 -0
- package/examples/jsm/postprocessing/SSAOPass.js +527 -0
- package/examples/jsm/postprocessing/SSRPass.js +856 -0
- package/examples/jsm/postprocessing/SavePass.js +132 -0
- package/examples/jsm/postprocessing/ShaderPass.js +135 -0
- package/examples/jsm/postprocessing/TAARenderPass.js +243 -0
- package/examples/jsm/postprocessing/TexturePass.js +131 -0
- package/examples/jsm/postprocessing/UnrealBloomPass.js +524 -0
- package/examples/jsm/renderers/CSS2DRenderer.js +328 -0
- package/examples/jsm/renderers/CSS3DRenderer.js +454 -0
- package/examples/jsm/renderers/Projector.js +1154 -0
- package/examples/jsm/renderers/SVGRenderer.js +799 -0
- package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +96 -0
- package/examples/jsm/shaders/AfterimageShader.js +63 -0
- package/examples/jsm/shaders/BasicShader.js +36 -0
- package/examples/jsm/shaders/BleachBypassShader.js +68 -0
- package/examples/jsm/shaders/BlendShader.js +56 -0
- package/examples/jsm/shaders/BokehShader.js +151 -0
- package/examples/jsm/shaders/BokehShader2.js +404 -0
- package/examples/jsm/shaders/BrightnessContrastShader.js +62 -0
- package/examples/jsm/shaders/ColorCorrectionShader.js +59 -0
- package/examples/jsm/shaders/ColorifyShader.js +57 -0
- package/examples/jsm/shaders/ConvolutionShader.js +74 -0
- package/examples/jsm/shaders/CopyShader.js +52 -0
- package/examples/jsm/shaders/DOFMipMapShader.js +63 -0
- package/examples/jsm/shaders/DepthLimitedBlurShader.js +180 -0
- package/examples/jsm/shaders/DigitalGlitch.js +104 -0
- package/examples/jsm/shaders/DotScreenShader.js +75 -0
- package/examples/jsm/shaders/ExposureShader.js +51 -0
- package/examples/jsm/shaders/FXAAShader.js +298 -0
- package/examples/jsm/shaders/FilmShader.js +72 -0
- package/examples/jsm/shaders/FocusShader.js +94 -0
- package/examples/jsm/shaders/FreiChenShader.js +103 -0
- package/examples/jsm/shaders/GTAOShader.js +434 -0
- package/examples/jsm/shaders/GammaCorrectionShader.js +52 -0
- package/examples/jsm/shaders/HalftoneShader.js +332 -0
- package/examples/jsm/shaders/HorizontalBlurShader.js +68 -0
- package/examples/jsm/shaders/HorizontalTiltShiftShader.js +70 -0
- package/examples/jsm/shaders/HueSaturationShader.js +74 -0
- package/examples/jsm/shaders/KaleidoShader.js +65 -0
- package/examples/jsm/shaders/LuminosityHighPassShader.js +68 -0
- package/examples/jsm/shaders/LuminosityShader.js +54 -0
- package/examples/jsm/shaders/MirrorShader.js +62 -0
- package/examples/jsm/shaders/NormalMapShader.js +60 -0
- package/examples/jsm/shaders/OutputShader.js +103 -0
- package/examples/jsm/shaders/PoissonDenoiseShader.js +239 -0
- package/examples/jsm/shaders/RGBShiftShader.js +61 -0
- package/examples/jsm/shaders/SAOShader.js +201 -0
- package/examples/jsm/shaders/SMAAShader.js +489 -0
- package/examples/jsm/shaders/SSAOShader.js +331 -0
- package/examples/jsm/shaders/SSRShader.js +396 -0
- package/examples/jsm/shaders/SepiaShader.js +57 -0
- package/examples/jsm/shaders/SobelOperatorShader.js +98 -0
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +95 -0
- package/examples/jsm/shaders/TechnicolorShader.js +51 -0
- package/examples/jsm/shaders/ToonShader.js +349 -0
- package/examples/jsm/shaders/TriangleBlurShader.js +79 -0
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +60 -0
- package/examples/jsm/shaders/VelocityShader.js +137 -0
- package/examples/jsm/shaders/VerticalBlurShader.js +66 -0
- package/examples/jsm/shaders/VerticalTiltShiftShader.js +70 -0
- package/examples/jsm/shaders/VignetteShader.js +56 -0
- package/examples/jsm/shaders/VolumeShader.js +298 -0
- package/examples/jsm/shaders/WaterRefractionShader.js +106 -0
- package/examples/jsm/textures/FlakesTexture.js +54 -0
- package/examples/jsm/transpiler/AST.js +675 -0
- package/examples/jsm/transpiler/GLSLDecoder.js +1228 -0
- package/examples/jsm/transpiler/Linker.js +327 -0
- package/examples/jsm/transpiler/ShaderToyDecoder.js +51 -0
- package/examples/jsm/transpiler/TSLEncoder.js +983 -0
- package/examples/jsm/transpiler/Transpiler.js +67 -0
- package/examples/jsm/transpiler/TranspilerUtils.js +29 -0
- package/examples/jsm/transpiler/WGSLEncoder.js +839 -0
- package/examples/jsm/tsl/WebGLNodesHandler.js +605 -0
- package/examples/jsm/tsl/display/AfterImageNode.js +254 -0
- package/examples/jsm/tsl/display/AnaglyphPassNode.js +549 -0
- package/examples/jsm/tsl/display/AnamorphicNode.js +293 -0
- package/examples/jsm/tsl/display/BilateralBlurNode.js +374 -0
- package/examples/jsm/tsl/display/BleachBypass.js +33 -0
- package/examples/jsm/tsl/display/BloomNode.js +534 -0
- package/examples/jsm/tsl/display/CRT.js +150 -0
- package/examples/jsm/tsl/display/ChromaticAberrationNode.js +174 -0
- package/examples/jsm/tsl/display/DenoiseNode.js +334 -0
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +554 -0
- package/examples/jsm/tsl/display/DotScreenNode.js +104 -0
- package/examples/jsm/tsl/display/FSR1Node.js +477 -0
- package/examples/jsm/tsl/display/FXAANode.js +365 -0
- package/examples/jsm/tsl/display/FilmNode.js +101 -0
- package/examples/jsm/tsl/display/GTAONode.js +572 -0
- package/examples/jsm/tsl/display/GaussianBlurNode.js +399 -0
- package/examples/jsm/tsl/display/GodraysNode.js +615 -0
- package/examples/jsm/tsl/display/LensflareNode.js +279 -0
- package/examples/jsm/tsl/display/Lut3DNode.js +109 -0
- package/examples/jsm/tsl/display/MotionBlur.js +33 -0
- package/examples/jsm/tsl/display/OutlineNode.js +812 -0
- package/examples/jsm/tsl/display/ParallaxBarrierPassNode.js +89 -0
- package/examples/jsm/tsl/display/PixelationPassNode.js +335 -0
- package/examples/jsm/tsl/display/RGBShiftNode.js +96 -0
- package/examples/jsm/tsl/display/RetroPassNode.js +263 -0
- package/examples/jsm/tsl/display/SMAANode.js +768 -0
- package/examples/jsm/tsl/display/SSAAPassNode.js +358 -0
- package/examples/jsm/tsl/display/SSGINode.js +638 -0
- package/examples/jsm/tsl/display/SSRNode.js +656 -0
- package/examples/jsm/tsl/display/SSSNode.js +490 -0
- package/examples/jsm/tsl/display/Sepia.js +24 -0
- package/examples/jsm/tsl/display/Shape.js +29 -0
- package/examples/jsm/tsl/display/SharpenNode.js +283 -0
- package/examples/jsm/tsl/display/SobelOperatorNode.js +168 -0
- package/examples/jsm/tsl/display/StereoCompositePassNode.js +192 -0
- package/examples/jsm/tsl/display/StereoPassNode.js +119 -0
- package/examples/jsm/tsl/display/TAAUNode.js +835 -0
- package/examples/jsm/tsl/display/TRAANode.js +767 -0
- package/examples/jsm/tsl/display/TransitionNode.js +141 -0
- package/examples/jsm/tsl/display/boxBlur.js +65 -0
- package/examples/jsm/tsl/display/depthAwareBlend.js +80 -0
- package/examples/jsm/tsl/display/hashBlur.js +54 -0
- package/examples/jsm/tsl/display/radialBlur.js +68 -0
- package/examples/jsm/tsl/lighting/DynamicLightsNode.js +300 -0
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +442 -0
- package/examples/jsm/tsl/lighting/data/AmbientLightDataNode.js +61 -0
- package/examples/jsm/tsl/lighting/data/DirectionalLightDataNode.js +111 -0
- package/examples/jsm/tsl/lighting/data/HemisphereLightDataNode.js +99 -0
- package/examples/jsm/tsl/lighting/data/PointLightDataNode.js +134 -0
- package/examples/jsm/tsl/lighting/data/SpotLightDataNode.js +161 -0
- package/examples/jsm/tsl/math/Bayer.js +84 -0
- package/examples/jsm/tsl/shadows/TileShadowNode.js +456 -0
- package/examples/jsm/tsl/shadows/TileShadowNodeHelper.js +212 -0
- package/examples/jsm/tsl/utils/Raymarching.js +70 -0
- package/examples/jsm/utils/BufferGeometryUtils.js +1434 -0
- package/examples/jsm/utils/CameraUtils.js +82 -0
- package/examples/jsm/utils/ColorUtils.js +76 -0
- package/examples/jsm/utils/GeometryCompressionUtils.js +547 -0
- package/examples/jsm/utils/GeometryUtils.js +226 -0
- package/examples/jsm/utils/LDrawUtils.js +211 -0
- package/examples/jsm/utils/SceneOptimizer.js +458 -0
- package/examples/jsm/utils/SceneUtils.js +363 -0
- package/examples/jsm/utils/ShadowMapViewer.js +244 -0
- package/examples/jsm/utils/ShadowMapViewerGPU.js +233 -0
- package/examples/jsm/utils/SkeletonUtils.js +496 -0
- package/examples/jsm/utils/SortUtils.js +175 -0
- package/examples/jsm/utils/UVsDebug.js +173 -0
- package/examples/jsm/utils/WebGLTextureUtils.js +115 -0
- package/examples/jsm/utils/WebGPUTextureUtils.js +81 -0
- package/examples/jsm/utils/WorkerPool.js +167 -0
- package/examples/jsm/webxr/ARButton.js +251 -0
- package/examples/jsm/webxr/OculusHandModel.js +194 -0
- package/examples/jsm/webxr/OculusHandPointerModel.js +539 -0
- package/examples/jsm/webxr/Text2D.js +52 -0
- package/examples/jsm/webxr/VRButton.js +264 -0
- package/examples/jsm/webxr/XRButton.js +246 -0
- package/examples/jsm/webxr/XRControllerModelFactory.js +403 -0
- package/examples/jsm/webxr/XREstimatedLight.js +254 -0
- package/examples/jsm/webxr/XRHandMeshModel.js +177 -0
- package/examples/jsm/webxr/XRHandModelFactory.js +198 -0
- package/examples/jsm/webxr/XRHandPrimitiveModel.js +147 -0
- package/examples/jsm/webxr/XRPlanes.js +118 -0
- package/package.json +123 -0
- package/src/Three.Core.js +187 -0
- package/src/Three.Legacy.js +0 -0
- package/src/Three.TSL.js +647 -0
- package/src/Three.WebGPU.Nodes.js +31 -0
- package/src/Three.WebGPU.js +37 -0
- package/src/Three.js +10 -0
- package/src/animation/AnimationAction.js +942 -0
- package/src/animation/AnimationClip.js +628 -0
- package/src/animation/AnimationMixer.js +860 -0
- package/src/animation/AnimationObjectGroup.js +411 -0
- package/src/animation/AnimationUtils.js +495 -0
- package/src/animation/KeyframeTrack.js +636 -0
- package/src/animation/PropertyBinding.js +794 -0
- package/src/animation/PropertyMixer.js +385 -0
- package/src/animation/tracks/BooleanKeyframeTrack.js +55 -0
- package/src/animation/tracks/ColorKeyframeTrack.js +36 -0
- package/src/animation/tracks/NumberKeyframeTrack.js +36 -0
- package/src/animation/tracks/QuaternionKeyframeTrack.js +51 -0
- package/src/animation/tracks/StringKeyframeTrack.js +55 -0
- package/src/animation/tracks/VectorKeyframeTrack.js +36 -0
- package/src/audio/Audio.js +778 -0
- package/src/audio/AudioAnalyser.js +97 -0
- package/src/audio/AudioContext.js +40 -0
- package/src/audio/AudioListener.js +218 -0
- package/src/audio/PositionalAudio.js +253 -0
- package/src/cameras/ArrayCamera.js +54 -0
- package/src/cameras/Camera.js +160 -0
- package/src/cameras/CubeCamera.js +259 -0
- package/src/cameras/OrthographicCamera.js +245 -0
- package/src/cameras/PerspectiveCamera.js +407 -0
- package/src/cameras/StereoCamera.js +146 -0
- package/src/constants.js +1760 -0
- package/src/core/BufferAttribute.js +1056 -0
- package/src/core/BufferGeometry.js +1458 -0
- package/src/core/Clock.js +135 -0
- package/src/core/EventDispatcher.js +131 -0
- package/src/core/GLBufferAttribute.js +171 -0
- package/src/core/InstancedBufferAttribute.js +68 -0
- package/src/core/InstancedBufferGeometry.js +60 -0
- package/src/core/InstancedInterleavedBuffer.js +74 -0
- package/src/core/InterleavedBuffer.js +291 -0
- package/src/core/InterleavedBufferAttribute.js +549 -0
- package/src/core/Layers.js +121 -0
- package/src/core/Object3D.js +1667 -0
- package/src/core/Raycaster.js +262 -0
- package/src/core/RenderTarget.js +392 -0
- package/src/core/RenderTarget3D.js +48 -0
- package/src/core/Timer.js +184 -0
- package/src/core/Uniform.js +46 -0
- package/src/core/UniformsGroup.js +180 -0
- package/src/extras/Controls.js +120 -0
- package/src/extras/DataUtils.js +217 -0
- package/src/extras/Earcut.js +28 -0
- package/src/extras/ImageUtils.js +137 -0
- package/src/extras/PMREMGenerator.js +1167 -0
- package/src/extras/ShapeUtils.js +114 -0
- package/src/extras/TextureUtils.js +297 -0
- package/src/extras/core/Curve.js +517 -0
- package/src/extras/core/CurvePath.js +296 -0
- package/src/extras/core/Interpolations.js +111 -0
- package/src/extras/core/Path.js +329 -0
- package/src/extras/core/Shape.js +165 -0
- package/src/extras/core/ShapePath.js +367 -0
- package/src/extras/curves/ArcCurve.js +39 -0
- package/src/extras/curves/CatmullRomCurve3.js +327 -0
- package/src/extras/curves/CubicBezierCurve.js +145 -0
- package/src/extras/curves/CubicBezierCurve3.js +129 -0
- package/src/extras/curves/Curves.js +10 -0
- package/src/extras/curves/EllipseCurve.js +258 -0
- package/src/extras/curves/LineCurve.js +128 -0
- package/src/extras/curves/LineCurve3.js +128 -0
- package/src/extras/curves/QuadraticBezierCurve.js +133 -0
- package/src/extras/curves/QuadraticBezierCurve3.js +118 -0
- package/src/extras/curves/SplineCurve.js +145 -0
- package/src/extras/lib/earcut.js +685 -0
- package/src/geometries/BoxGeometry.js +219 -0
- package/src/geometries/CapsuleGeometry.js +218 -0
- package/src/geometries/CircleGeometry.js +142 -0
- package/src/geometries/ConeGeometry.js +70 -0
- package/src/geometries/CylinderGeometry.js +333 -0
- package/src/geometries/DodecahedronGeometry.js +99 -0
- package/src/geometries/EdgesGeometry.js +180 -0
- package/src/geometries/ExtrudeGeometry.js +910 -0
- package/src/geometries/Geometries.js +21 -0
- package/src/geometries/IcosahedronGeometry.js +75 -0
- package/src/geometries/LatheGeometry.js +230 -0
- package/src/geometries/OctahedronGeometry.js +70 -0
- package/src/geometries/PlaneGeometry.js +133 -0
- package/src/geometries/PolyhedronGeometry.js +348 -0
- package/src/geometries/RingGeometry.js +165 -0
- package/src/geometries/ShapeGeometry.js +233 -0
- package/src/geometries/SphereGeometry.js +175 -0
- package/src/geometries/TetrahedronGeometry.js +67 -0
- package/src/geometries/TorusGeometry.js +161 -0
- package/src/geometries/TorusKnotGeometry.js +206 -0
- package/src/geometries/TubeGeometry.js +253 -0
- package/src/geometries/WireframeGeometry.js +179 -0
- package/src/helpers/ArrowHelper.js +171 -0
- package/src/helpers/AxesHelper.js +96 -0
- package/src/helpers/Box3Helper.js +83 -0
- package/src/helpers/BoxHelper.js +149 -0
- package/src/helpers/CameraHelper.js +345 -0
- package/src/helpers/DirectionalLightHelper.js +148 -0
- package/src/helpers/GridHelper.js +82 -0
- package/src/helpers/HemisphereLightHelper.js +130 -0
- package/src/helpers/PlaneHelper.js +96 -0
- package/src/helpers/PointLightHelper.js +111 -0
- package/src/helpers/PolarGridHelper.js +126 -0
- package/src/helpers/SkeletonHelper.js +194 -0
- package/src/helpers/SpotLightHelper.js +154 -0
- package/src/lights/AmbientLight.js +42 -0
- package/src/lights/DirectionalLight.js +113 -0
- package/src/lights/DirectionalLightShadow.js +31 -0
- package/src/lights/HemisphereLight.js +76 -0
- package/src/lights/Light.js +85 -0
- package/src/lights/LightProbe.js +75 -0
- package/src/lights/LightShadow.js +347 -0
- package/src/lights/PointLight.js +131 -0
- package/src/lights/PointLightShadow.js +31 -0
- package/src/lights/RectAreaLight.js +115 -0
- package/src/lights/SpotLight.js +194 -0
- package/src/lights/SpotLightShadow.js +80 -0
- package/src/lights/webgpu/IESSpotLight.js +47 -0
- package/src/lights/webgpu/ProjectorLight.js +46 -0
- package/src/loaders/AnimationLoader.js +98 -0
- package/src/loaders/AudioLoader.js +108 -0
- package/src/loaders/BufferGeometryLoader.js +242 -0
- package/src/loaders/Cache.js +115 -0
- package/src/loaders/CompressedTextureLoader.js +167 -0
- package/src/loaders/CubeTextureLoader.js +103 -0
- package/src/loaders/DataTextureLoader.js +174 -0
- package/src/loaders/FileLoader.js +367 -0
- package/src/loaders/ImageBitmapLoader.js +223 -0
- package/src/loaders/ImageLoader.js +168 -0
- package/src/loaders/Loader.js +222 -0
- package/src/loaders/LoaderUtils.js +59 -0
- package/src/loaders/LoadingManager.js +329 -0
- package/src/loaders/MaterialLoader.js +439 -0
- package/src/loaders/ObjectLoader.js +1304 -0
- package/src/loaders/TextureLoader.js +74 -0
- package/src/loaders/nodes/NodeLoader.js +194 -0
- package/src/loaders/nodes/NodeMaterialLoader.js +108 -0
- package/src/loaders/nodes/NodeObjectLoader.js +169 -0
- package/src/materials/LineBasicMaterial.js +122 -0
- package/src/materials/LineDashedMaterial.js +86 -0
- package/src/materials/Material.js +1017 -0
- package/src/materials/Materials.js +39 -0
- package/src/materials/MeshBasicMaterial.js +250 -0
- package/src/materials/MeshDepthMaterial.js +148 -0
- package/src/materials/MeshDistanceMaterial.js +119 -0
- package/src/materials/MeshLambertMaterial.js +402 -0
- package/src/materials/MeshMatcapMaterial.js +245 -0
- package/src/materials/MeshNormalMaterial.js +175 -0
- package/src/materials/MeshPhongMaterial.js +421 -0
- package/src/materials/MeshPhysicalMaterial.js +536 -0
- package/src/materials/MeshStandardMaterial.js +425 -0
- package/src/materials/MeshToonMaterial.js +321 -0
- package/src/materials/PointsMaterial.js +139 -0
- package/src/materials/RawShaderMaterial.js +42 -0
- package/src/materials/ShaderMaterial.js +413 -0
- package/src/materials/ShadowMaterial.js +91 -0
- package/src/materials/SpriteMaterial.js +136 -0
- package/src/materials/nodes/Line2NodeMaterial.js +569 -0
- package/src/materials/nodes/LineBasicNodeMaterial.js +46 -0
- package/src/materials/nodes/LineDashedNodeMaterial.js +132 -0
- package/src/materials/nodes/MeshBasicNodeMaterial.js +134 -0
- package/src/materials/nodes/MeshLambertNodeMaterial.js +82 -0
- package/src/materials/nodes/MeshMatcapNodeMaterial.js +77 -0
- package/src/materials/nodes/MeshNormalNodeMaterial.js +67 -0
- package/src/materials/nodes/MeshPhongNodeMaterial.js +141 -0
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +521 -0
- package/src/materials/nodes/MeshSSSNodeMaterial.js +175 -0
- package/src/materials/nodes/MeshStandardNodeMaterial.js +187 -0
- package/src/materials/nodes/MeshToonNodeMaterial.js +66 -0
- package/src/materials/nodes/NodeMaterial.js +1330 -0
- package/src/materials/nodes/NodeMaterials.js +21 -0
- package/src/materials/nodes/PointsNodeMaterial.js +211 -0
- package/src/materials/nodes/ShadowNodeMaterial.js +76 -0
- package/src/materials/nodes/SpriteNodeMaterial.js +186 -0
- package/src/materials/nodes/VolumeNodeMaterial.js +81 -0
- package/src/materials/nodes/manager/NodeMaterialObserver.js +718 -0
- package/src/math/Box2.js +381 -0
- package/src/math/Box3.js +805 -0
- package/src/math/Color.js +967 -0
- package/src/math/ColorManagement.js +215 -0
- package/src/math/Cylindrical.js +120 -0
- package/src/math/Euler.js +449 -0
- package/src/math/Frustum.js +285 -0
- package/src/math/FrustumArray.js +258 -0
- package/src/math/Interpolant.js +320 -0
- package/src/math/Line3.js +337 -0
- package/src/math/MathUtils.js +751 -0
- package/src/math/Matrix2.js +128 -0
- package/src/math/Matrix3.js +617 -0
- package/src/math/Matrix4.js +1314 -0
- package/src/math/Plane.js +368 -0
- package/src/math/Quaternion.js +918 -0
- package/src/math/Ray.js +655 -0
- package/src/math/Sphere.js +420 -0
- package/src/math/Spherical.js +147 -0
- package/src/math/SphericalHarmonics3.js +341 -0
- package/src/math/Triangle.js +539 -0
- package/src/math/Vector2.js +870 -0
- package/src/math/Vector3.js +1263 -0
- package/src/math/Vector4.js +1067 -0
- package/src/math/interpolants/BezierInterpolant.js +108 -0
- package/src/math/interpolants/CubicInterpolant.js +159 -0
- package/src/math/interpolants/DiscreteInterpolant.js +34 -0
- package/src/math/interpolants/LinearInterpolant.js +51 -0
- package/src/math/interpolants/QuaternionLinearInterpolant.js +48 -0
- package/src/nodes/Nodes.js +166 -0
- package/src/nodes/TSL.js +173 -0
- package/src/nodes/accessors/AccessorsUtils.js +53 -0
- package/src/nodes/accessors/Arrays.js +68 -0
- package/src/nodes/accessors/BatchNode.js +163 -0
- package/src/nodes/accessors/Bitangent.js +82 -0
- package/src/nodes/accessors/BufferAttributeNode.js +432 -0
- package/src/nodes/accessors/BufferNode.js +128 -0
- package/src/nodes/accessors/BuiltinNode.js +63 -0
- package/src/nodes/accessors/Camera.js +403 -0
- package/src/nodes/accessors/ClippingNode.js +255 -0
- package/src/nodes/accessors/CubeTextureNode.js +215 -0
- package/src/nodes/accessors/InstanceNode.js +349 -0
- package/src/nodes/accessors/InstancedMeshNode.js +50 -0
- package/src/nodes/accessors/Lights.js +139 -0
- package/src/nodes/accessors/MaterialNode.js +783 -0
- package/src/nodes/accessors/MaterialProperties.js +56 -0
- package/src/nodes/accessors/MaterialReferenceNode.js +84 -0
- package/src/nodes/accessors/ModelNode.js +184 -0
- package/src/nodes/accessors/ModelViewProjectionNode.js +13 -0
- package/src/nodes/accessors/MorphNode.js +310 -0
- package/src/nodes/accessors/Normal.js +243 -0
- package/src/nodes/accessors/Object3DNode.js +268 -0
- package/src/nodes/accessors/PointUVNode.js +55 -0
- package/src/nodes/accessors/Position.js +122 -0
- package/src/nodes/accessors/ReferenceBaseNode.js +357 -0
- package/src/nodes/accessors/ReferenceNode.js +424 -0
- package/src/nodes/accessors/ReflectVector.js +36 -0
- package/src/nodes/accessors/RendererReferenceNode.js +78 -0
- package/src/nodes/accessors/SceneProperties.js +47 -0
- package/src/nodes/accessors/SkinningNode.js +328 -0
- package/src/nodes/accessors/StorageBufferNode.js +405 -0
- package/src/nodes/accessors/StorageTextureNode.js +295 -0
- package/src/nodes/accessors/Tangent.js +60 -0
- package/src/nodes/accessors/TangentUtils.js +46 -0
- package/src/nodes/accessors/Texture3DNode.js +196 -0
- package/src/nodes/accessors/TextureBicubic.js +92 -0
- package/src/nodes/accessors/TextureNode.js +971 -0
- package/src/nodes/accessors/TextureSizeNode.js +77 -0
- package/src/nodes/accessors/UV.js +11 -0
- package/src/nodes/accessors/UniformArrayNode.js +350 -0
- package/src/nodes/accessors/UserDataNode.js +76 -0
- package/src/nodes/accessors/VelocityNode.js +224 -0
- package/src/nodes/accessors/VertexColorNode.js +109 -0
- package/src/nodes/code/CodeNode.js +181 -0
- package/src/nodes/code/ExpressionNode.js +68 -0
- package/src/nodes/code/FunctionCallNode.js +187 -0
- package/src/nodes/code/FunctionNode.js +182 -0
- package/src/nodes/core/ArrayNode.js +174 -0
- package/src/nodes/core/AssignNode.js +202 -0
- package/src/nodes/core/AttributeNode.js +168 -0
- package/src/nodes/core/BypassNode.js +93 -0
- package/src/nodes/core/ConstNode.js +67 -0
- package/src/nodes/core/ContextNode.js +283 -0
- package/src/nodes/core/IndexNode.js +165 -0
- package/src/nodes/core/InputNode.js +136 -0
- package/src/nodes/core/InspectorNode.js +128 -0
- package/src/nodes/core/IsolateNode.js +133 -0
- package/src/nodes/core/LightingModel.js +77 -0
- package/src/nodes/core/MRTNode.js +196 -0
- package/src/nodes/core/Node.js +1180 -0
- package/src/nodes/core/NodeAttribute.js +53 -0
- package/src/nodes/core/NodeBuilder.js +3299 -0
- package/src/nodes/core/NodeCache.js +75 -0
- package/src/nodes/core/NodeCode.js +46 -0
- package/src/nodes/core/NodeError.js +28 -0
- package/src/nodes/core/NodeFrame.js +314 -0
- package/src/nodes/core/NodeFunction.js +69 -0
- package/src/nodes/core/NodeFunctionInput.js +61 -0
- package/src/nodes/core/NodeParser.js +23 -0
- package/src/nodes/core/NodeUniform.js +91 -0
- package/src/nodes/core/NodeUtils.js +408 -0
- package/src/nodes/core/NodeVar.js +60 -0
- package/src/nodes/core/NodeVarying.js +63 -0
- package/src/nodes/core/OutputStructNode.js +105 -0
- package/src/nodes/core/ParameterNode.js +94 -0
- package/src/nodes/core/PropertyNode.js +367 -0
- package/src/nodes/core/StackNode.js +426 -0
- package/src/nodes/core/StackTrace.js +139 -0
- package/src/nodes/core/StructNode.js +134 -0
- package/src/nodes/core/StructType.js +13 -0
- package/src/nodes/core/StructTypeNode.js +148 -0
- package/src/nodes/core/SubBuildNode.js +89 -0
- package/src/nodes/core/TempNode.js +88 -0
- package/src/nodes/core/UniformGroupNode.js +167 -0
- package/src/nodes/core/UniformNode.js +259 -0
- package/src/nodes/core/VarNode.js +367 -0
- package/src/nodes/core/VaryingNode.js +210 -0
- package/src/nodes/core/constants.js +68 -0
- package/src/nodes/display/BlendModes.js +171 -0
- package/src/nodes/display/BumpMapNode.js +117 -0
- package/src/nodes/display/ColorAdjustment.js +158 -0
- package/src/nodes/display/ColorSpaceFunctions.js +54 -0
- package/src/nodes/display/ColorSpaceNode.js +164 -0
- package/src/nodes/display/FrontFacingNode.js +102 -0
- package/src/nodes/display/NormalMapNode.js +153 -0
- package/src/nodes/display/PassNode.js +1055 -0
- package/src/nodes/display/RenderOutputNode.js +150 -0
- package/src/nodes/display/ScreenNode.js +292 -0
- package/src/nodes/display/ToneMappingFunctions.js +242 -0
- package/src/nodes/display/ToneMappingNode.js +147 -0
- package/src/nodes/display/ToonOutlinePassNode.js +191 -0
- package/src/nodes/display/ViewportDepthNode.js +342 -0
- package/src/nodes/display/ViewportDepthTextureNode.js +63 -0
- package/src/nodes/display/ViewportSharedTextureNode.js +73 -0
- package/src/nodes/display/ViewportTextureNode.js +256 -0
- package/src/nodes/fog/Fog.js +97 -0
- package/src/nodes/functions/BSDF/BRDF_GGX.js +55 -0
- package/src/nodes/functions/BSDF/BRDF_GGX_Multiscatter.js +52 -0
- package/src/nodes/functions/BSDF/BRDF_Lambert.js +9 -0
- package/src/nodes/functions/BSDF/BRDF_Sheen.js +57 -0
- package/src/nodes/functions/BSDF/DFGLUT.js +56 -0
- package/src/nodes/functions/BSDF/D_GGX.js +23 -0
- package/src/nodes/functions/BSDF/D_GGX_Anisotropic.js +28 -0
- package/src/nodes/functions/BSDF/EnvironmentBRDF.js +13 -0
- package/src/nodes/functions/BSDF/F_Schlick.js +16 -0
- package/src/nodes/functions/BSDF/LTC.js +175 -0
- package/src/nodes/functions/BSDF/Schlick_to_F0.js +21 -0
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +26 -0
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +29 -0
- package/src/nodes/functions/BasicLightingModel.js +100 -0
- package/src/nodes/functions/PhongLightingModel.js +99 -0
- package/src/nodes/functions/PhysicalLightingModel.js +878 -0
- package/src/nodes/functions/ShadowMaskModel.js +58 -0
- package/src/nodes/functions/ToonLightingModel.js +70 -0
- package/src/nodes/functions/VolumetricLightingModel.js +183 -0
- package/src/nodes/functions/material/getAlphaHashThreshold.js +68 -0
- package/src/nodes/functions/material/getGeometryRoughness.js +19 -0
- package/src/nodes/functions/material/getParallaxCorrectNormal.js +37 -0
- package/src/nodes/functions/material/getRoughness.js +18 -0
- package/src/nodes/functions/material/getShIrradianceAt.js +28 -0
- package/src/nodes/geometry/RangeNode.js +210 -0
- package/src/nodes/gpgpu/AtomicFunctionNode.js +274 -0
- package/src/nodes/gpgpu/BarrierNode.js +98 -0
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +227 -0
- package/src/nodes/gpgpu/ComputeNode.js +310 -0
- package/src/nodes/gpgpu/SubgroupFunctionNode.js +455 -0
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +234 -0
- package/src/nodes/lighting/AONode.js +45 -0
- package/src/nodes/lighting/AmbientLightNode.js +35 -0
- package/src/nodes/lighting/AnalyticLightNode.js +309 -0
- package/src/nodes/lighting/BasicEnvironmentNode.js +49 -0
- package/src/nodes/lighting/BasicLightMapNode.js +49 -0
- package/src/nodes/lighting/DirectionalLightNode.js +39 -0
- package/src/nodes/lighting/EnvironmentNode.js +178 -0
- package/src/nodes/lighting/HemisphereLightNode.js +87 -0
- package/src/nodes/lighting/IESSpotLightNode.js +49 -0
- package/src/nodes/lighting/IrradianceNode.js +44 -0
- package/src/nodes/lighting/LightProbeNode.js +73 -0
- package/src/nodes/lighting/LightUtils.js +25 -0
- package/src/nodes/lighting/LightingContextNode.js +115 -0
- package/src/nodes/lighting/LightingNode.js +36 -0
- package/src/nodes/lighting/LightsNode.js +432 -0
- package/src/nodes/lighting/PointLightNode.js +102 -0
- package/src/nodes/lighting/PointShadowNode.js +325 -0
- package/src/nodes/lighting/ProjectorLightNode.js +91 -0
- package/src/nodes/lighting/RectAreaLightNode.js +133 -0
- package/src/nodes/lighting/ShadowBaseNode.js +81 -0
- package/src/nodes/lighting/ShadowFilterNode.js +264 -0
- package/src/nodes/lighting/ShadowNode.js +889 -0
- package/src/nodes/lighting/SpotLightNode.js +168 -0
- package/src/nodes/materialx/DISCLAIMER.md +199 -0
- package/src/nodes/materialx/MaterialXNodes.js +197 -0
- package/src/nodes/materialx/lib/mx_hsv.js +127 -0
- package/src/nodes/materialx/lib/mx_noise.js +1491 -0
- package/src/nodes/materialx/lib/mx_transform_color.js +23 -0
- package/src/nodes/math/BitcastNode.js +156 -0
- package/src/nodes/math/BitcountNode.js +433 -0
- package/src/nodes/math/ConditionalNode.js +245 -0
- package/src/nodes/math/Hash.js +21 -0
- package/src/nodes/math/MathNode.js +1202 -0
- package/src/nodes/math/MathUtils.js +54 -0
- package/src/nodes/math/OperatorNode.js +752 -0
- package/src/nodes/math/PackFloatNode.js +98 -0
- package/src/nodes/math/TriNoise3D.js +71 -0
- package/src/nodes/math/UnpackFloatNode.js +96 -0
- package/src/nodes/parsers/GLSLNodeFunction.js +168 -0
- package/src/nodes/parsers/GLSLNodeParser.js +25 -0
- package/src/nodes/pmrem/PMREMNode.js +397 -0
- package/src/nodes/pmrem/PMREMUtils.js +397 -0
- package/src/nodes/procedural/Checker.js +22 -0
- package/src/nodes/shapes/Shapes.js +33 -0
- package/src/nodes/tsl/TSLBase.js +36 -0
- package/src/nodes/tsl/TSLCore.js +1250 -0
- package/src/nodes/utils/ArrayElementNode.js +90 -0
- package/src/nodes/utils/ConvertNode.js +100 -0
- package/src/nodes/utils/CubeMapNode.js +237 -0
- package/src/nodes/utils/DebugNode.js +83 -0
- package/src/nodes/utils/Discard.js +24 -0
- package/src/nodes/utils/EquirectUV.js +27 -0
- package/src/nodes/utils/EventNode.js +148 -0
- package/src/nodes/utils/FlipNode.js +106 -0
- package/src/nodes/utils/FunctionOverloadingNode.js +170 -0
- package/src/nodes/utils/JoinNode.js +117 -0
- package/src/nodes/utils/LoopNode.js +349 -0
- package/src/nodes/utils/MatcapUV.js +22 -0
- package/src/nodes/utils/MaxMipLevelNode.js +103 -0
- package/src/nodes/utils/MemberNode.js +120 -0
- package/src/nodes/utils/Oscillators.js +41 -0
- package/src/nodes/utils/Packing.js +33 -0
- package/src/nodes/utils/PostProcessingUtils.js +154 -0
- package/src/nodes/utils/RTTNode.js +289 -0
- package/src/nodes/utils/ReflectorNode.js +629 -0
- package/src/nodes/utils/Remap.js +48 -0
- package/src/nodes/utils/RotateNode.js +103 -0
- package/src/nodes/utils/SampleNode.js +91 -0
- package/src/nodes/utils/SetNode.js +108 -0
- package/src/nodes/utils/SplitNode.js +179 -0
- package/src/nodes/utils/SpriteSheetUV.js +35 -0
- package/src/nodes/utils/SpriteUtils.js +63 -0
- package/src/nodes/utils/StorageArrayElementNode.js +143 -0
- package/src/nodes/utils/Timer.js +26 -0
- package/src/nodes/utils/TriplanarTextures.js +65 -0
- package/src/nodes/utils/UVUtils.js +67 -0
- package/src/nodes/utils/ViewportUtils.js +26 -0
- package/src/objects/BatchedMesh.js +1682 -0
- package/src/objects/Bone.js +41 -0
- package/src/objects/ClippingGroup.js +68 -0
- package/src/objects/Group.js +41 -0
- package/src/objects/InstancedMesh.js +422 -0
- package/src/objects/LOD.js +329 -0
- package/src/objects/Line.js +329 -0
- package/src/objects/LineLoop.js +37 -0
- package/src/objects/LineSegments.js +74 -0
- package/src/objects/Mesh.js +496 -0
- package/src/objects/Points.js +228 -0
- package/src/objects/Skeleton.js +392 -0
- package/src/objects/SkinnedMesh.js +370 -0
- package/src/objects/Sprite.js +245 -0
- package/src/renderers/WebGL3DRenderTarget.js +48 -0
- package/src/renderers/WebGLArrayRenderTarget.js +48 -0
- package/src/renderers/WebGLCubeRenderTarget.js +182 -0
- package/src/renderers/WebGLRenderTarget.js +34 -0
- package/src/renderers/WebGLRenderer.js +3699 -0
- package/src/renderers/common/Animation.js +159 -0
- package/src/renderers/common/Attributes.js +132 -0
- package/src/renderers/common/Backend.js +769 -0
- package/src/renderers/common/Background.js +225 -0
- package/src/renderers/common/BindGroup.js +46 -0
- package/src/renderers/common/Binding.js +71 -0
- package/src/renderers/common/Bindings.js +394 -0
- package/src/renderers/common/BlendMode.js +143 -0
- package/src/renderers/common/Buffer.js +127 -0
- package/src/renderers/common/BufferUtils.js +58 -0
- package/src/renderers/common/BundleGroup.js +83 -0
- package/src/renderers/common/CanvasTarget.js +341 -0
- package/src/renderers/common/ChainMap.js +122 -0
- package/src/renderers/common/ClippingContext.js +262 -0
- package/src/renderers/common/Color4.js +77 -0
- package/src/renderers/common/ComputePipeline.js +41 -0
- package/src/renderers/common/Constants.js +15 -0
- package/src/renderers/common/CubeRenderTarget.js +147 -0
- package/src/renderers/common/DataMap.js +90 -0
- package/src/renderers/common/Geometries.js +396 -0
- package/src/renderers/common/IndirectStorageBufferAttribute.js +38 -0
- package/src/renderers/common/Info.js +501 -0
- package/src/renderers/common/InspectorBase.js +151 -0
- package/src/renderers/common/Lighting.js +57 -0
- package/src/renderers/common/Pipeline.js +35 -0
- package/src/renderers/common/Pipelines.js +498 -0
- package/src/renderers/common/PostProcessing.js +28 -0
- package/src/renderers/common/ProgrammableStage.js +78 -0
- package/src/renderers/common/QuadMesh.js +112 -0
- package/src/renderers/common/ReadbackBuffer.js +78 -0
- package/src/renderers/common/RenderBundle.js +26 -0
- package/src/renderers/common/RenderBundles.js +71 -0
- package/src/renderers/common/RenderContext.js +281 -0
- package/src/renderers/common/RenderContexts.js +100 -0
- package/src/renderers/common/RenderList.js +404 -0
- package/src/renderers/common/RenderLists.js +78 -0
- package/src/renderers/common/RenderObject.js +915 -0
- package/src/renderers/common/RenderObjectPipeline.js +40 -0
- package/src/renderers/common/RenderObjects.js +218 -0
- package/src/renderers/common/RenderPipeline.js +255 -0
- package/src/renderers/common/Renderer.js +3654 -0
- package/src/renderers/common/RendererUtils.js +200 -0
- package/src/renderers/common/SampledTexture.js +152 -0
- package/src/renderers/common/Sampler.js +165 -0
- package/src/renderers/common/Storage3DTexture.js +100 -0
- package/src/renderers/common/StorageArrayTexture.js +84 -0
- package/src/renderers/common/StorageBuffer.js +53 -0
- package/src/renderers/common/StorageBufferAttribute.js +46 -0
- package/src/renderers/common/StorageInstancedBufferAttribute.js +46 -0
- package/src/renderers/common/StorageTexture.js +86 -0
- package/src/renderers/common/Textures.js +629 -0
- package/src/renderers/common/TimestampQueryPool.js +163 -0
- package/src/renderers/common/Uniform.js +375 -0
- package/src/renderers/common/UniformBuffer.js +34 -0
- package/src/renderers/common/UniformsGroup.js +548 -0
- package/src/renderers/common/XRManager.js +1684 -0
- package/src/renderers/common/XRRenderTarget.js +91 -0
- package/src/renderers/common/extras/PMREMGenerator.js +1042 -0
- package/src/renderers/common/nodes/NodeBuilderState.js +152 -0
- package/src/renderers/common/nodes/NodeLibrary.js +196 -0
- package/src/renderers/common/nodes/NodeManager.js +983 -0
- package/src/renderers/common/nodes/NodeSampledTexture.js +140 -0
- package/src/renderers/common/nodes/NodeSampler.js +62 -0
- package/src/renderers/common/nodes/NodeStorageBuffer.js +72 -0
- package/src/renderers/common/nodes/NodeUniform.js +418 -0
- package/src/renderers/common/nodes/NodeUniformBuffer.js +105 -0
- package/src/renderers/common/nodes/NodeUniformsGroup.js +51 -0
- package/src/renderers/shaders/DFGLUTData.js +49 -0
- package/src/renderers/shaders/ShaderChunk/alphahash_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/alphahash_pars_fragment.glsl.js +68 -0
- package/src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/alphamap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/alphatest_fragment.glsl.js +16 -0
- package/src/renderers/shaders/ShaderChunk/alphatest_pars_fragment.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js +26 -0
- package/src/renderers/shaders/ShaderChunk/aomap_pars_fragment.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +49 -0
- package/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/begin_vertex.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/beginnormal_vertex.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/bsdfs.glsl.js +33 -0
- package/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js +43 -0
- package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.js +10 -0
- package/src/renderers/shaders/ShaderChunk/clearcoat_pars_fragment.glsl.js +21 -0
- package/src/renderers/shaders/ShaderChunk/clipping_planes_fragment.glsl.js +78 -0
- package/src/renderers/shaders/ShaderChunk/clipping_planes_pars_fragment.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/clipping_planes_pars_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/clipping_planes_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/color_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +29 -0
- package/src/renderers/shaders/ShaderChunk/colorspace_fragment.glsl.js +3 -0
- package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +15 -0
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +125 -0
- package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +186 -0
- package/src/renderers/shaders/ShaderChunk/default_fragment.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/default_vertex.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +63 -0
- package/src/renderers/shaders/ShaderChunk/displacementmap_pars_vertex.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/displacementmap_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/dithering_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/dithering_pars_fragment.glsl.js +20 -0
- package/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.js +17 -0
- package/src/renderers/shaders/ShaderChunk/emissivemap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +58 -0
- package/src/renderers/shaders/ShaderChunk/envmap_pars_fragment.glsl.js +21 -0
- package/src/renderers/shaders/ShaderChunk/envmap_pars_vertex.glsl.js +22 -0
- package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +69 -0
- package/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.js +37 -0
- package/src/renderers/shaders/ShaderChunk/fog_fragment.glsl.js +17 -0
- package/src/renderers/shaders/ShaderChunk/fog_pars_fragment.glsl.js +19 -0
- package/src/renderers/shaders/ShaderChunk/fog_pars_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/fog_vertex.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.js +27 -0
- package/src/renderers/shaders/ShaderChunk/iridescence_fragment.glsl.js +120 -0
- package/src/renderers/shaders/ShaderChunk/iridescence_pars_fragment.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/lightmap_pars_fragment.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/lightprobes_pars_fragment.glsl.js +80 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +213 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js +19 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +44 -0
- package/src/renderers/shaders/ShaderChunk/lights_lambert_fragment.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.js +28 -0
- package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +216 -0
- package/src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl.js +32 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +161 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +656 -0
- package/src/renderers/shaders/ShaderChunk/lights_toon_fragment.glsl.js +4 -0
- package/src/renderers/shaders/ShaderChunk/lights_toon_pars_fragment.glsl.js +26 -0
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +9 -0
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +17 -0
- package/src/renderers/shaders/ShaderChunk/map_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl.js +27 -0
- package/src/renderers/shaders/ShaderChunk/map_particle_pars_fragment.glsl.js +27 -0
- package/src/renderers/shaders/ShaderChunk/metalnessmap_fragment.glsl.js +12 -0
- package/src/renderers/shaders/ShaderChunk/metalnessmap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.js +24 -0
- package/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js +16 -0
- package/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.js +26 -0
- package/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js +16 -0
- package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +76 -0
- package/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js +40 -0
- package/src/renderers/shaders/ShaderChunk/normal_pars_fragment.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/normal_pars_vertex.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js +43 -0
- package/src/renderers/shaders/ShaderChunk/opaque_fragment.glsl.js +11 -0
- package/src/renderers/shaders/ShaderChunk/packing.glsl.js +116 -0
- package/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/project_vertex.glsl.js +19 -0
- package/src/renderers/shaders/ShaderChunk/roughnessmap_fragment.glsl.js +12 -0
- package/src/renderers/shaders/ShaderChunk/roughnessmap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +376 -0
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +71 -0
- package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +78 -0
- package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +66 -0
- package/src/renderers/shaders/ShaderChunk/skinbase_vertex.glsl.js +10 -0
- package/src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl.js +25 -0
- package/src/renderers/shaders/ShaderChunk/skinning_vertex.glsl.js +15 -0
- package/src/renderers/shaders/ShaderChunk/skinnormal_vertex.glsl.js +20 -0
- package/src/renderers/shaders/ShaderChunk/specularmap_fragment.glsl.js +14 -0
- package/src/renderers/shaders/ShaderChunk/specularmap_pars_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/tonemapping_fragment.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +200 -0
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +36 -0
- package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +235 -0
- package/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.js +119 -0
- package/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.js +145 -0
- package/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.js +122 -0
- package/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.js +21 -0
- package/src/renderers/shaders/ShaderChunk.js +272 -0
- package/src/renderers/shaders/ShaderLib/background.glsl.js +40 -0
- package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +62 -0
- package/src/renderers/shaders/ShaderLib/cube.glsl.js +36 -0
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +117 -0
- package/src/renderers/shaders/ShaderLib/distance.glsl.js +77 -0
- package/src/renderers/shaders/ShaderLib/equirect.glsl.js +35 -0
- package/src/renderers/shaders/ShaderLib/linedashed.glsl.js +76 -0
- package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +116 -0
- package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +126 -0
- package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +112 -0
- package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +86 -0
- package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +128 -0
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +224 -0
- package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +118 -0
- package/src/renderers/shaders/ShaderLib/points.glsl.js +87 -0
- package/src/renderers/shaders/ShaderLib/shadow.glsl.js +58 -0
- package/src/renderers/shaders/ShaderLib/sprite.glsl.js +79 -0
- package/src/renderers/shaders/ShaderLib/vsm.glsl.js +51 -0
- package/src/renderers/shaders/ShaderLib.js +362 -0
- package/src/renderers/shaders/UniformsLib.js +234 -0
- package/src/renderers/shaders/UniformsUtils.js +154 -0
- package/src/renderers/webgl/WebGLAnimation.js +54 -0
- package/src/renderers/webgl/WebGLAttributes.js +237 -0
- package/src/renderers/webgl/WebGLBackground.js +303 -0
- package/src/renderers/webgl/WebGLBindingStates.js +666 -0
- package/src/renderers/webgl/WebGLBufferRenderer.js +57 -0
- package/src/renderers/webgl/WebGLCapabilities.js +150 -0
- package/src/renderers/webgl/WebGLClipping.js +171 -0
- package/src/renderers/webgl/WebGLEnvironments.js +228 -0
- package/src/renderers/webgl/WebGLExtensions.js +61 -0
- package/src/renderers/webgl/WebGLGeometries.js +186 -0
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +68 -0
- package/src/renderers/webgl/WebGLInfo.js +73 -0
- package/src/renderers/webgl/WebGLLights.js +584 -0
- package/src/renderers/webgl/WebGLMaterials.js +602 -0
- package/src/renderers/webgl/WebGLMorphtargets.js +168 -0
- package/src/renderers/webgl/WebGLObjects.js +94 -0
- package/src/renderers/webgl/WebGLOutput.js +270 -0
- package/src/renderers/webgl/WebGLProgram.js +1031 -0
- package/src/renderers/webgl/WebGLPrograms.js +679 -0
- package/src/renderers/webgl/WebGLProperties.js +55 -0
- package/src/renderers/webgl/WebGLRenderLists.js +253 -0
- package/src/renderers/webgl/WebGLRenderStates.js +124 -0
- package/src/renderers/webgl/WebGLShader.js +12 -0
- package/src/renderers/webgl/WebGLShaderCache.js +124 -0
- package/src/renderers/webgl/WebGLShadowMap.js +600 -0
- package/src/renderers/webgl/WebGLState.js +1370 -0
- package/src/renderers/webgl/WebGLTextures.js +2506 -0
- package/src/renderers/webgl/WebGLUniforms.js +1203 -0
- package/src/renderers/webgl/WebGLUniformsGroups.js +413 -0
- package/src/renderers/webgl/WebGLUtils.js +217 -0
- package/src/renderers/webgl-fallback/WebGLBackend.js +2783 -0
- package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +99 -0
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +1676 -0
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +359 -0
- package/src/renderers/webgl-fallback/utils/WebGLCapabilities.js +89 -0
- package/src/renderers/webgl-fallback/utils/WebGLConstants.js +13 -0
- package/src/renderers/webgl-fallback/utils/WebGLExtensions.js +83 -0
- package/src/renderers/webgl-fallback/utils/WebGLState.js +1361 -0
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +1324 -0
- package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +396 -0
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +317 -0
- package/src/renderers/webgpu/WebGPUBackend.js +2602 -0
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +69 -0
- package/src/renderers/webgpu/WebGPURenderer.js +107 -0
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +66 -0
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +100 -0
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +2523 -0
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +187 -0
- package/src/renderers/webgpu/nodes/WGSLNodeParser.js +25 -0
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +522 -0
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +642 -0
- package/src/renderers/webgpu/utils/WebGPUCapabilities.js +48 -0
- package/src/renderers/webgpu/utils/WebGPUConstants.js +354 -0
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +846 -0
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +389 -0
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +1673 -0
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +310 -0
- package/src/renderers/webgpu/utils/WebGPUUtils.js +269 -0
- package/src/renderers/webxr/WebXRController.js +440 -0
- package/src/renderers/webxr/WebXRDepthSensing.js +155 -0
- package/src/renderers/webxr/WebXRManager.js +1103 -0
- package/src/scenes/Fog.js +98 -0
- package/src/scenes/FogExp2.js +86 -0
- package/src/scenes/Scene.js +165 -0
- package/src/textures/CanvasTexture.js +45 -0
- package/src/textures/CompressedArrayTexture.js +89 -0
- package/src/textures/CompressedCubeTexture.js +48 -0
- package/src/textures/CompressedTexture.js +86 -0
- package/src/textures/CubeDepthTexture.js +76 -0
- package/src/textures/CubeTexture.js +81 -0
- package/src/textures/Data3DTexture.js +112 -0
- package/src/textures/DataArrayTexture.js +134 -0
- package/src/textures/DataTexture.js +87 -0
- package/src/textures/DepthTexture.js +104 -0
- package/src/textures/ExternalTexture.js +56 -0
- package/src/textures/FramebufferTexture.js +85 -0
- package/src/textures/HTMLTexture.js +74 -0
- package/src/textures/Source.js +230 -0
- package/src/textures/Texture.js +812 -0
- package/src/textures/VideoFrameTexture.js +72 -0
- package/src/textures/VideoTexture.js +127 -0
- package/src/utils.js +493 -0
|
@@ -0,0 +1,1611 @@
|
|
|
1
|
+
import { Tab } from '../ui/Tab.js';
|
|
2
|
+
import { Graph } from '../ui/Graph.js';
|
|
3
|
+
import { getItem, setItem } from '../Inspector.js';
|
|
4
|
+
import {
|
|
5
|
+
ByteType,
|
|
6
|
+
FloatType,
|
|
7
|
+
HalfFloatType,
|
|
8
|
+
IntType,
|
|
9
|
+
ShortType,
|
|
10
|
+
UnsignedByteType,
|
|
11
|
+
UnsignedInt101111Type,
|
|
12
|
+
UnsignedInt248Type,
|
|
13
|
+
UnsignedInt5999Type,
|
|
14
|
+
UnsignedIntType,
|
|
15
|
+
UnsignedShort4444Type,
|
|
16
|
+
UnsignedShort5551Type,
|
|
17
|
+
UnsignedShortType,
|
|
18
|
+
AlphaFormat,
|
|
19
|
+
RGBFormat,
|
|
20
|
+
RGBAFormat,
|
|
21
|
+
DepthFormat,
|
|
22
|
+
DepthStencilFormat,
|
|
23
|
+
RedFormat,
|
|
24
|
+
RedIntegerFormat,
|
|
25
|
+
RGFormat,
|
|
26
|
+
RGIntegerFormat,
|
|
27
|
+
RGBIntegerFormat,
|
|
28
|
+
RGBAIntegerFormat
|
|
29
|
+
} from 'three';
|
|
30
|
+
|
|
31
|
+
const LIMIT = 500;
|
|
32
|
+
const TRIANGLES_GRAPH_LIMIT = 60;
|
|
33
|
+
|
|
34
|
+
class Timeline extends Tab {
|
|
35
|
+
|
|
36
|
+
constructor( options = {} ) {
|
|
37
|
+
|
|
38
|
+
super( 'Timeline', options );
|
|
39
|
+
|
|
40
|
+
this.isRecording = false;
|
|
41
|
+
this.frames = []; // Array of { id: number, calls: [] }
|
|
42
|
+
|
|
43
|
+
this.baseTriangles = 0;
|
|
44
|
+
this.currentFrame = null;
|
|
45
|
+
this.isHierarchicalView = true;
|
|
46
|
+
this.callBlocks = new WeakMap();
|
|
47
|
+
this.fallbackBlocks = [];
|
|
48
|
+
this.originalBackend = null;
|
|
49
|
+
this.originalMethods = new Map();
|
|
50
|
+
this.renderer = null;
|
|
51
|
+
|
|
52
|
+
this.graph = new Graph( LIMIT ); // Accommodate standard graph points
|
|
53
|
+
// Make lines in timeline graph
|
|
54
|
+
this.graph.addLine( 'fps', 'var( --color-fps )' );
|
|
55
|
+
this.graph.addLine( 'calls', 'var( --color-call )' );
|
|
56
|
+
this.graph.addLine( 'triangles', 'var( --color-red )' );
|
|
57
|
+
|
|
58
|
+
const scrollWrapper = document.createElement( 'div' );
|
|
59
|
+
scrollWrapper.className = 'list-scroll-wrapper';
|
|
60
|
+
this.scrollWrapper = scrollWrapper;
|
|
61
|
+
this.content.appendChild( scrollWrapper );
|
|
62
|
+
|
|
63
|
+
this.buildHeader();
|
|
64
|
+
this.buildUI();
|
|
65
|
+
|
|
66
|
+
// Bind window resize to update graph bounds
|
|
67
|
+
window.addEventListener( 'resize', () => {
|
|
68
|
+
|
|
69
|
+
if ( ! this.isRecording && this.frames.length > 0 ) {
|
|
70
|
+
|
|
71
|
+
this.renderSlider();
|
|
72
|
+
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
} );
|
|
76
|
+
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
buildHeader() {
|
|
80
|
+
|
|
81
|
+
const header = document.createElement( 'div' );
|
|
82
|
+
header.className = 'console-header';
|
|
83
|
+
|
|
84
|
+
this.recordButton = document.createElement( 'button' );
|
|
85
|
+
this.recordButton.className = 'console-copy-button'; // Reusing style
|
|
86
|
+
this.recordButton.title = 'Record';
|
|
87
|
+
this.recordButton.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><circle cx="12" cy="12" r="4" fill="currentColor"></circle></svg>';
|
|
88
|
+
this.recordButton.style.padding = '0 10px';
|
|
89
|
+
this.recordButton.style.lineHeight = '24px'; // Match other buttons height
|
|
90
|
+
this.recordButton.style.display = 'flex';
|
|
91
|
+
this.recordButton.style.alignItems = 'center';
|
|
92
|
+
this.recordButton.addEventListener( 'click', () => this.toggleRecording() );
|
|
93
|
+
|
|
94
|
+
const clearButton = document.createElement( 'button' );
|
|
95
|
+
clearButton.className = 'console-copy-button';
|
|
96
|
+
clearButton.title = 'Clear';
|
|
97
|
+
clearButton.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path><line x1="10" y1="11" x2="10" y2="17"></line><line x1="14" y1="11" x2="14" y2="17"></line></svg>';
|
|
98
|
+
clearButton.style.padding = '0 10px';
|
|
99
|
+
clearButton.style.lineHeight = '24px';
|
|
100
|
+
clearButton.style.display = 'flex';
|
|
101
|
+
clearButton.style.alignItems = 'center';
|
|
102
|
+
clearButton.addEventListener( 'click', () => this.clear() );
|
|
103
|
+
|
|
104
|
+
this.viewModeButton = document.createElement( 'button' );
|
|
105
|
+
this.viewModeButton.className = 'console-copy-button';
|
|
106
|
+
this.viewModeButton.title = 'Toggle View Mode';
|
|
107
|
+
this.viewModeButton.textContent = 'Mode: Hierarchy';
|
|
108
|
+
this.viewModeButton.style.padding = '0 10px';
|
|
109
|
+
this.viewModeButton.style.lineHeight = '24px';
|
|
110
|
+
this.viewModeButton.addEventListener( 'click', () => {
|
|
111
|
+
|
|
112
|
+
this.isHierarchicalView = ! this.isHierarchicalView;
|
|
113
|
+
this.viewModeButton.textContent = this.isHierarchicalView ? 'Mode: Hierarchy' : 'Mode: Counts';
|
|
114
|
+
|
|
115
|
+
if ( this.selectedFrameIndex !== undefined && this.selectedFrameIndex !== - 1 ) {
|
|
116
|
+
|
|
117
|
+
this.selectFrame( this.selectedFrameIndex );
|
|
118
|
+
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
} );
|
|
122
|
+
|
|
123
|
+
this.recordRefreshButton = document.createElement( 'button' );
|
|
124
|
+
this.recordRefreshButton.className = 'console-copy-button'; // Reusing style
|
|
125
|
+
this.recordRefreshButton.title = 'Refresh & Record';
|
|
126
|
+
this.recordRefreshButton.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"></path><path d="M21 3v5h-5"></path><circle cx="12" cy="12" r="3" fill="currentColor"></circle></svg>';
|
|
127
|
+
this.recordRefreshButton.style.padding = '0 10px';
|
|
128
|
+
this.recordRefreshButton.style.lineHeight = '24px';
|
|
129
|
+
this.recordRefreshButton.style.display = 'flex';
|
|
130
|
+
this.recordRefreshButton.style.alignItems = 'center';
|
|
131
|
+
this.recordRefreshButton.addEventListener( 'click', () => {
|
|
132
|
+
|
|
133
|
+
const timelineSettings = getItem( 'timeline' );
|
|
134
|
+
timelineSettings.recording = true;
|
|
135
|
+
setItem( 'timeline', timelineSettings );
|
|
136
|
+
|
|
137
|
+
window.location.reload();
|
|
138
|
+
|
|
139
|
+
} );
|
|
140
|
+
|
|
141
|
+
this.exportButton = document.createElement( 'button' );
|
|
142
|
+
this.exportButton.className = 'console-copy-button';
|
|
143
|
+
this.exportButton.title = 'Export';
|
|
144
|
+
this.exportButton.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>';
|
|
145
|
+
this.exportButton.style.padding = '0 10px';
|
|
146
|
+
this.exportButton.style.lineHeight = '24px';
|
|
147
|
+
this.exportButton.style.display = 'flex';
|
|
148
|
+
this.exportButton.style.alignItems = 'center';
|
|
149
|
+
this.exportButton.addEventListener( 'click', () => this.exportData() );
|
|
150
|
+
|
|
151
|
+
const buttonsGroup = document.createElement( 'div' );
|
|
152
|
+
buttonsGroup.className = 'console-buttons-group';
|
|
153
|
+
buttonsGroup.appendChild( this.viewModeButton );
|
|
154
|
+
buttonsGroup.appendChild( this.recordButton );
|
|
155
|
+
buttonsGroup.appendChild( this.recordRefreshButton );
|
|
156
|
+
buttonsGroup.appendChild( this.exportButton );
|
|
157
|
+
buttonsGroup.appendChild( clearButton );
|
|
158
|
+
|
|
159
|
+
header.style.display = 'flex';
|
|
160
|
+
header.style.justifyContent = 'space-between';
|
|
161
|
+
header.style.padding = '6px';
|
|
162
|
+
header.style.borderBottom = '1px solid var(--border-color)';
|
|
163
|
+
|
|
164
|
+
const titleElement = document.createElement( 'div' );
|
|
165
|
+
titleElement.textContent = 'Backend Calls';
|
|
166
|
+
titleElement.style.display = 'flex';
|
|
167
|
+
titleElement.style.alignItems = 'center';
|
|
168
|
+
titleElement.style.color = 'var(--text-primary)';
|
|
169
|
+
titleElement.style.alignSelf = 'center';
|
|
170
|
+
titleElement.style.paddingLeft = '5px';
|
|
171
|
+
|
|
172
|
+
this.frameInfo = document.createElement( 'span' );
|
|
173
|
+
this.frameInfo.style.display = 'inline-flex';
|
|
174
|
+
this.frameInfo.style.alignItems = 'center';
|
|
175
|
+
this.frameInfo.style.marginLeft = '15px';
|
|
176
|
+
this.frameInfo.style.fontFamily = 'monospace';
|
|
177
|
+
this.frameInfo.style.color = 'var(--text-secondary)';
|
|
178
|
+
this.frameInfo.style.fontSize = '12px';
|
|
179
|
+
titleElement.appendChild( this.frameInfo );
|
|
180
|
+
|
|
181
|
+
header.appendChild( titleElement );
|
|
182
|
+
header.appendChild( buttonsGroup );
|
|
183
|
+
this.scrollWrapper.appendChild( header );
|
|
184
|
+
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
buildUI() {
|
|
188
|
+
|
|
189
|
+
const container = document.createElement( 'div' );
|
|
190
|
+
container.style.display = 'flex';
|
|
191
|
+
container.style.flexDirection = 'column';
|
|
192
|
+
container.style.height = 'calc(100% - 37px)'; // Subtract header height
|
|
193
|
+
container.style.width = '100%';
|
|
194
|
+
|
|
195
|
+
// Top Player/Graph Slider using Graph.js SVG
|
|
196
|
+
const graphContainer = document.createElement( 'div' );
|
|
197
|
+
graphContainer.style.height = '60px';
|
|
198
|
+
graphContainer.style.minHeight = '60px';
|
|
199
|
+
graphContainer.style.borderBottom = '1px solid var(--border-color)';
|
|
200
|
+
graphContainer.style.backgroundColor = 'var(--background-color)';
|
|
201
|
+
|
|
202
|
+
this.graphSlider = document.createElement( 'div' );
|
|
203
|
+
this.graphSlider.style.height = '100%';
|
|
204
|
+
this.graphSlider.style.margin = '0 10px';
|
|
205
|
+
this.graphSlider.style.position = 'relative';
|
|
206
|
+
this.graphSlider.style.cursor = 'crosshair';
|
|
207
|
+
|
|
208
|
+
graphContainer.appendChild( this.graphSlider );
|
|
209
|
+
|
|
210
|
+
// Setup SVG from Graph
|
|
211
|
+
this.graph.domElement.style.width = '100%';
|
|
212
|
+
this.graph.domElement.style.height = '100%';
|
|
213
|
+
this.graphSlider.appendChild( this.graph.domElement );
|
|
214
|
+
|
|
215
|
+
// Hover indicator
|
|
216
|
+
this.hoverIndicator = document.createElement( 'div' );
|
|
217
|
+
this.hoverIndicator.style.position = 'absolute';
|
|
218
|
+
this.hoverIndicator.style.top = '0';
|
|
219
|
+
this.hoverIndicator.style.bottom = '0';
|
|
220
|
+
this.hoverIndicator.style.width = '1px';
|
|
221
|
+
this.hoverIndicator.style.backgroundColor = 'rgba(255, 255, 255, 0.3)';
|
|
222
|
+
this.hoverIndicator.style.pointerEvents = 'none';
|
|
223
|
+
this.hoverIndicator.style.display = 'none';
|
|
224
|
+
this.hoverIndicator.style.zIndex = '9';
|
|
225
|
+
this.hoverIndicator.style.transform = 'translateX(-50%)';
|
|
226
|
+
this.graphSlider.appendChild( this.hoverIndicator );
|
|
227
|
+
|
|
228
|
+
// Playhead indicator (vertical line)
|
|
229
|
+
this.playhead = document.createElement( 'div' );
|
|
230
|
+
this.playhead.style.position = 'absolute';
|
|
231
|
+
this.playhead.style.top = '0';
|
|
232
|
+
this.playhead.style.bottom = '0';
|
|
233
|
+
this.playhead.style.width = '2px';
|
|
234
|
+
this.playhead.style.backgroundColor = 'var(--color-red)';
|
|
235
|
+
this.playhead.style.boxShadow = '0 0 4px rgba(255,0,0,0.5)';
|
|
236
|
+
this.playhead.style.pointerEvents = 'none';
|
|
237
|
+
this.playhead.style.display = 'none';
|
|
238
|
+
this.playhead.style.zIndex = '10';
|
|
239
|
+
this.playhead.style.transform = 'translateX(-50%)';
|
|
240
|
+
this.graphSlider.appendChild( this.playhead );
|
|
241
|
+
|
|
242
|
+
// Playhead handle (triangle/pointer)
|
|
243
|
+
const playheadHandle = document.createElement( 'div' );
|
|
244
|
+
playheadHandle.style.position = 'absolute';
|
|
245
|
+
playheadHandle.style.top = '0';
|
|
246
|
+
playheadHandle.style.left = '50%';
|
|
247
|
+
playheadHandle.style.transform = 'translate(-50%, 0)';
|
|
248
|
+
playheadHandle.style.width = '0';
|
|
249
|
+
playheadHandle.style.height = '0';
|
|
250
|
+
playheadHandle.style.borderLeft = '6px solid transparent';
|
|
251
|
+
playheadHandle.style.borderRight = '6px solid transparent';
|
|
252
|
+
playheadHandle.style.borderTop = '8px solid var(--color-red)';
|
|
253
|
+
this.playhead.appendChild( playheadHandle );
|
|
254
|
+
|
|
255
|
+
// Make it focusable to accept keyboard events
|
|
256
|
+
this.graphSlider.tabIndex = 0;
|
|
257
|
+
this.graphSlider.style.outline = 'none';
|
|
258
|
+
|
|
259
|
+
// Mouse interactivity on the graph
|
|
260
|
+
let isDragging = false;
|
|
261
|
+
|
|
262
|
+
const updatePlayheadFromEvent = ( e ) => {
|
|
263
|
+
|
|
264
|
+
if ( this.frames.length === 0 ) return;
|
|
265
|
+
|
|
266
|
+
const rect = this.graphSlider.getBoundingClientRect();
|
|
267
|
+
let x = e.clientX - rect.left;
|
|
268
|
+
|
|
269
|
+
// Clamp
|
|
270
|
+
x = Math.max( 0, Math.min( x, rect.width ) );
|
|
271
|
+
|
|
272
|
+
this.fixedScreenX = x;
|
|
273
|
+
|
|
274
|
+
// The graph stretches its points across the width
|
|
275
|
+
// Find closest frame index based on exact point coordinates
|
|
276
|
+
const pointCount = this.graph.lines[ 'calls' ].points.length;
|
|
277
|
+
if ( pointCount === 0 ) return;
|
|
278
|
+
|
|
279
|
+
const pointStep = rect.width / ( this.graph.maxPoints - 1 );
|
|
280
|
+
const offset = rect.width - ( ( pointCount - 1 ) * pointStep );
|
|
281
|
+
|
|
282
|
+
let localFrameIndex = Math.round( ( x - offset ) / pointStep );
|
|
283
|
+
localFrameIndex = Math.max( 0, Math.min( localFrameIndex, pointCount - 1 ) );
|
|
284
|
+
|
|
285
|
+
if ( localFrameIndex >= pointCount - 2 ) {
|
|
286
|
+
|
|
287
|
+
this.isTrackingLatest = true;
|
|
288
|
+
|
|
289
|
+
} else {
|
|
290
|
+
|
|
291
|
+
this.isTrackingLatest = false;
|
|
292
|
+
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
let frameIndex = localFrameIndex;
|
|
296
|
+
|
|
297
|
+
if ( this.frames.length > pointCount ) {
|
|
298
|
+
|
|
299
|
+
frameIndex += this.frames.length - pointCount;
|
|
300
|
+
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
this.playhead.style.display = 'block';
|
|
304
|
+
this.selectFrame( frameIndex );
|
|
305
|
+
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
this.graphSlider.addEventListener( 'mousedown', ( e ) => {
|
|
309
|
+
|
|
310
|
+
isDragging = true;
|
|
311
|
+
this.isManualScrubbing = true;
|
|
312
|
+
this.graphSlider.focus();
|
|
313
|
+
updatePlayheadFromEvent( e );
|
|
314
|
+
|
|
315
|
+
} );
|
|
316
|
+
|
|
317
|
+
this.graphSlider.addEventListener( 'mouseenter', () => {
|
|
318
|
+
|
|
319
|
+
if ( this.frames.length > 0 && ! this.isRecording ) {
|
|
320
|
+
|
|
321
|
+
this.hoverIndicator.style.display = 'block';
|
|
322
|
+
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
} );
|
|
326
|
+
|
|
327
|
+
this.graphSlider.addEventListener( 'mouseleave', () => {
|
|
328
|
+
|
|
329
|
+
this.hoverIndicator.style.display = 'none';
|
|
330
|
+
|
|
331
|
+
} );
|
|
332
|
+
|
|
333
|
+
this.graphSlider.addEventListener( 'mousemove', ( e ) => {
|
|
334
|
+
|
|
335
|
+
if ( this.frames.length === 0 || this.isRecording ) return;
|
|
336
|
+
|
|
337
|
+
const rect = this.graphSlider.getBoundingClientRect();
|
|
338
|
+
let x = e.clientX - rect.left;
|
|
339
|
+
x = Math.max( 0, Math.min( x, rect.width ) );
|
|
340
|
+
|
|
341
|
+
const pointCount = this.graph.lines[ 'calls' ].points.length;
|
|
342
|
+
if ( pointCount > 0 ) {
|
|
343
|
+
|
|
344
|
+
const pointStep = rect.width / ( this.graph.maxPoints - 1 );
|
|
345
|
+
const offset = rect.width - ( ( pointCount - 1 ) * pointStep );
|
|
346
|
+
|
|
347
|
+
let localFrameIndex = Math.round( ( x - offset ) / pointStep );
|
|
348
|
+
localFrameIndex = Math.max( 0, Math.min( localFrameIndex, pointCount - 1 ) );
|
|
349
|
+
|
|
350
|
+
let snappedX = offset + localFrameIndex * pointStep;
|
|
351
|
+
snappedX = Math.max( 1, Math.min( snappedX, rect.width - 1 ) );
|
|
352
|
+
this.hoverIndicator.style.left = snappedX + 'px';
|
|
353
|
+
|
|
354
|
+
} else {
|
|
355
|
+
|
|
356
|
+
const clampedX = Math.max( 1, Math.min( x, rect.width - 1 ) );
|
|
357
|
+
this.hoverIndicator.style.left = clampedX + 'px';
|
|
358
|
+
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
} );
|
|
362
|
+
|
|
363
|
+
this.graphSlider.addEventListener( 'keydown', ( e ) => {
|
|
364
|
+
|
|
365
|
+
if ( this.frames.length === 0 || this.isRecording ) return;
|
|
366
|
+
|
|
367
|
+
let newIndex = this.selectedFrameIndex;
|
|
368
|
+
|
|
369
|
+
if ( e.key === 'ArrowLeft' ) {
|
|
370
|
+
|
|
371
|
+
newIndex = Math.max( 0, this.selectedFrameIndex - 1 );
|
|
372
|
+
e.preventDefault();
|
|
373
|
+
|
|
374
|
+
} else if ( e.key === 'ArrowRight' ) {
|
|
375
|
+
|
|
376
|
+
newIndex = Math.min( this.frames.length - 1, this.selectedFrameIndex + 1 );
|
|
377
|
+
e.preventDefault();
|
|
378
|
+
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
if ( newIndex !== this.selectedFrameIndex ) {
|
|
382
|
+
|
|
383
|
+
this.selectFrame( newIndex );
|
|
384
|
+
|
|
385
|
+
// Update playhead tracking state
|
|
386
|
+
const pointCount = this.graph.lines[ 'calls' ].points.length;
|
|
387
|
+
if ( pointCount > 0 ) {
|
|
388
|
+
|
|
389
|
+
let localIndex = newIndex;
|
|
390
|
+
if ( this.frames.length > pointCount ) {
|
|
391
|
+
|
|
392
|
+
localIndex = newIndex - ( this.frames.length - pointCount );
|
|
393
|
+
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
if ( localIndex >= pointCount - 2 ) {
|
|
397
|
+
|
|
398
|
+
this.isTrackingLatest = true;
|
|
399
|
+
|
|
400
|
+
} else {
|
|
401
|
+
|
|
402
|
+
this.isTrackingLatest = false;
|
|
403
|
+
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
const rect = this.graphSlider.getBoundingClientRect();
|
|
407
|
+
const pointStep = rect.width / ( this.graph.maxPoints - 1 );
|
|
408
|
+
const offset = rect.width - ( ( pointCount - 1 ) * pointStep );
|
|
409
|
+
this.fixedScreenX = offset + localIndex * pointStep;
|
|
410
|
+
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
} );
|
|
416
|
+
|
|
417
|
+
window.addEventListener( 'mousemove', ( e ) => {
|
|
418
|
+
|
|
419
|
+
if ( isDragging ) {
|
|
420
|
+
|
|
421
|
+
updatePlayheadFromEvent( e );
|
|
422
|
+
|
|
423
|
+
// Also move hover indicator to match playback
|
|
424
|
+
const rect = this.graphSlider.getBoundingClientRect();
|
|
425
|
+
let x = e.clientX - rect.left;
|
|
426
|
+
x = Math.max( 0, Math.min( x, rect.width ) );
|
|
427
|
+
|
|
428
|
+
const pointCount = this.graph.lines[ 'calls' ].points.length;
|
|
429
|
+
if ( pointCount > 0 ) {
|
|
430
|
+
|
|
431
|
+
const pointStep = rect.width / ( this.graph.maxPoints - 1 );
|
|
432
|
+
const offset = rect.width - ( ( pointCount - 1 ) * pointStep );
|
|
433
|
+
|
|
434
|
+
let localFrameIndex = Math.round( ( x - offset ) / pointStep );
|
|
435
|
+
localFrameIndex = Math.max( 0, Math.min( localFrameIndex, pointCount - 1 ) );
|
|
436
|
+
|
|
437
|
+
let snappedX = offset + localFrameIndex * pointStep;
|
|
438
|
+
snappedX = Math.max( 1, Math.min( snappedX, rect.width - 1 ) );
|
|
439
|
+
this.hoverIndicator.style.left = snappedX + 'px';
|
|
440
|
+
|
|
441
|
+
} else {
|
|
442
|
+
|
|
443
|
+
const clampedX = Math.max( 1, Math.min( x, rect.width - 1 ) );
|
|
444
|
+
this.hoverIndicator.style.left = clampedX + 'px';
|
|
445
|
+
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
} );
|
|
451
|
+
|
|
452
|
+
window.addEventListener( 'mouseup', () => {
|
|
453
|
+
|
|
454
|
+
isDragging = false;
|
|
455
|
+
this.isManualScrubbing = false;
|
|
456
|
+
|
|
457
|
+
} );
|
|
458
|
+
|
|
459
|
+
container.appendChild( graphContainer );
|
|
460
|
+
|
|
461
|
+
// Bottom Main Area (Timeline Sequence)
|
|
462
|
+
const mainArea = document.createElement( 'div' );
|
|
463
|
+
mainArea.style.flex = '1';
|
|
464
|
+
mainArea.style.display = 'flex';
|
|
465
|
+
mainArea.style.flexDirection = 'column';
|
|
466
|
+
mainArea.style.overflow = 'hidden';
|
|
467
|
+
|
|
468
|
+
// Timeline Track
|
|
469
|
+
this.timelineTrack = document.createElement( 'div' );
|
|
470
|
+
this.timelineTrack.style.flex = '1';
|
|
471
|
+
this.timelineTrack.style.overflowY = 'auto';
|
|
472
|
+
this.timelineTrack.style.margin = '10px';
|
|
473
|
+
this.timelineTrack.style.backgroundColor = 'var(--background-color)';
|
|
474
|
+
mainArea.appendChild( this.timelineTrack );
|
|
475
|
+
|
|
476
|
+
container.appendChild( mainArea );
|
|
477
|
+
this.scrollWrapper.appendChild( container );
|
|
478
|
+
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
setRenderer( renderer ) {
|
|
482
|
+
|
|
483
|
+
this.renderer = renderer;
|
|
484
|
+
|
|
485
|
+
const timelineSettings = getItem( 'timeline' );
|
|
486
|
+
|
|
487
|
+
if ( timelineSettings.recording ) {
|
|
488
|
+
|
|
489
|
+
timelineSettings.recording = false;
|
|
490
|
+
setItem( 'timeline', timelineSettings );
|
|
491
|
+
|
|
492
|
+
this.toggleRecording();
|
|
493
|
+
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
toggleRecording() {
|
|
499
|
+
|
|
500
|
+
if ( ! this.renderer ) {
|
|
501
|
+
|
|
502
|
+
console.warn( 'Timeline: No renderer defined.' );
|
|
503
|
+
return;
|
|
504
|
+
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
this.isRecording = ! this.isRecording;
|
|
508
|
+
|
|
509
|
+
if ( this.isRecording ) {
|
|
510
|
+
|
|
511
|
+
this.recordButton.title = 'Stop';
|
|
512
|
+
this.recordButton.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect></svg>';
|
|
513
|
+
this.recordButton.style.color = 'var(--color-red)';
|
|
514
|
+
this.startRecording();
|
|
515
|
+
|
|
516
|
+
} else {
|
|
517
|
+
|
|
518
|
+
this.recordButton.title = 'Record';
|
|
519
|
+
this.recordButton.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><circle cx="12" cy="12" r="4" fill="currentColor"></circle></svg>';
|
|
520
|
+
this.recordButton.style.color = '';
|
|
521
|
+
this.stopRecording();
|
|
522
|
+
this.renderSlider();
|
|
523
|
+
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
startRecording() {
|
|
529
|
+
|
|
530
|
+
this.frames = [];
|
|
531
|
+
this.currentFrame = null;
|
|
532
|
+
this.selectedFrameIndex = - 1;
|
|
533
|
+
this.fixedScreenX = 0;
|
|
534
|
+
this.isTrackingLatest = true;
|
|
535
|
+
this.isManualScrubbing = false;
|
|
536
|
+
this.clear();
|
|
537
|
+
this.frameInfo.textContent = 'Recording...';
|
|
538
|
+
|
|
539
|
+
const backend = this.renderer.backend;
|
|
540
|
+
const methods = Object.getOwnPropertyNames( Object.getPrototypeOf( backend ) ).filter( prop => prop !== 'constructor' );
|
|
541
|
+
|
|
542
|
+
for ( const prop of methods ) {
|
|
543
|
+
|
|
544
|
+
const descriptor = Object.getOwnPropertyDescriptor( Object.getPrototypeOf( backend ), prop );
|
|
545
|
+
|
|
546
|
+
if ( descriptor && ( descriptor.get || descriptor.set ) ) continue;
|
|
547
|
+
|
|
548
|
+
const originalFunc = backend[ prop ];
|
|
549
|
+
|
|
550
|
+
if ( typeof originalFunc === 'function' && typeof prop === 'string' ) {
|
|
551
|
+
|
|
552
|
+
this.originalMethods.set( prop, originalFunc );
|
|
553
|
+
|
|
554
|
+
backend[ prop ] = ( ...args ) => {
|
|
555
|
+
|
|
556
|
+
if ( prop.toLowerCase().includes( 'timestamp' ) || prop.startsWith( 'get' ) || prop.startsWith( 'set' ) || prop.startsWith( 'has' ) || prop.startsWith( '_' ) || prop.startsWith( 'needs' ) ) {
|
|
557
|
+
|
|
558
|
+
return originalFunc.apply( backend, args );
|
|
559
|
+
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
// Check for frame change
|
|
563
|
+
const frameNumber = this.renderer.info.frame;
|
|
564
|
+
|
|
565
|
+
if ( ! this.currentFrame || this.currentFrame.id !== frameNumber ) {
|
|
566
|
+
|
|
567
|
+
if ( this.currentFrame ) {
|
|
568
|
+
|
|
569
|
+
this.currentFrame.fps = this.renderer.inspector ? this.renderer.inspector.fps : 0;
|
|
570
|
+
|
|
571
|
+
if ( ! isFinite( this.currentFrame.fps ) ) {
|
|
572
|
+
|
|
573
|
+
this.currentFrame.fps = 0;
|
|
574
|
+
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
const t = this.currentFrame.triangles || 0;
|
|
578
|
+
|
|
579
|
+
if ( t > this.baseTriangles ) {
|
|
580
|
+
|
|
581
|
+
const oldBase = this.baseTriangles;
|
|
582
|
+
this.baseTriangles = t;
|
|
583
|
+
|
|
584
|
+
if ( oldBase > 0 ) {
|
|
585
|
+
|
|
586
|
+
const ratio = oldBase / this.baseTriangles;
|
|
587
|
+
const points = this.graph.lines[ 'triangles' ].points;
|
|
588
|
+
|
|
589
|
+
for ( let i = 0; i < points.length; i ++ ) {
|
|
590
|
+
|
|
591
|
+
points[ i ] *= ratio;
|
|
592
|
+
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
const normalizedTriangles = this.baseTriangles > 0 ? ( t / this.baseTriangles ) * TRIANGLES_GRAPH_LIMIT : 0;
|
|
600
|
+
|
|
601
|
+
this.graph.addPoint( 'calls', this.currentFrame.calls.length );
|
|
602
|
+
this.graph.addPoint( 'fps', this.currentFrame.fps );
|
|
603
|
+
this.graph.addPoint( 'triangles', normalizedTriangles );
|
|
604
|
+
this.graph.update();
|
|
605
|
+
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
this.currentFrame = { id: frameNumber, calls: [], fps: 0, triangles: 0 };
|
|
609
|
+
this.frames.push( this.currentFrame );
|
|
610
|
+
|
|
611
|
+
if ( this.frames.length > LIMIT ) {
|
|
612
|
+
|
|
613
|
+
this.frames.shift();
|
|
614
|
+
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
// Sync playhead when new frames are added if user is actively watching a frame
|
|
618
|
+
if ( ! this.isManualScrubbing ) {
|
|
619
|
+
|
|
620
|
+
if ( this.isTrackingLatest ) {
|
|
621
|
+
|
|
622
|
+
const targetIndex = this.frames.length > 1 ? this.frames.length - 2 : 0;
|
|
623
|
+
this.selectFrame( targetIndex );
|
|
624
|
+
|
|
625
|
+
} else if ( this.selectedFrameIndex !== - 1 ) {
|
|
626
|
+
|
|
627
|
+
const pointCount = this.graph.lines[ 'calls' ].points.length;
|
|
628
|
+
|
|
629
|
+
if ( pointCount > 0 ) {
|
|
630
|
+
|
|
631
|
+
const rect = this.graphSlider.getBoundingClientRect();
|
|
632
|
+
const pointStep = rect.width / ( this.graph.maxPoints - 1 );
|
|
633
|
+
const offset = rect.width - ( ( pointCount - 1 ) * pointStep );
|
|
634
|
+
|
|
635
|
+
let localFrameIndex = Math.round( ( this.fixedScreenX - offset ) / pointStep );
|
|
636
|
+
localFrameIndex = Math.max( 0, Math.min( localFrameIndex, pointCount - 1 ) );
|
|
637
|
+
|
|
638
|
+
let newFrameIndex = localFrameIndex;
|
|
639
|
+
|
|
640
|
+
if ( this.frames.length > pointCount ) {
|
|
641
|
+
|
|
642
|
+
newFrameIndex += this.frames.length - pointCount;
|
|
643
|
+
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
this.selectFrame( newFrameIndex );
|
|
647
|
+
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
const call = { method: prop, target: args[ 0 ] };
|
|
657
|
+
const details = this.getCallDetail( prop, args );
|
|
658
|
+
|
|
659
|
+
if ( details ) {
|
|
660
|
+
|
|
661
|
+
call.details = details;
|
|
662
|
+
|
|
663
|
+
if ( details.triangles !== undefined ) {
|
|
664
|
+
|
|
665
|
+
this.currentFrame.triangles += details.triangles;
|
|
666
|
+
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
this.currentFrame.calls.push( call );
|
|
672
|
+
|
|
673
|
+
return originalFunc.apply( backend, args );
|
|
674
|
+
|
|
675
|
+
};
|
|
676
|
+
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
stopRecording() {
|
|
684
|
+
|
|
685
|
+
if ( this.originalMethods.size > 0 ) {
|
|
686
|
+
|
|
687
|
+
const backend = this.renderer.backend;
|
|
688
|
+
|
|
689
|
+
for ( const [ prop, originalFunc ] of this.originalMethods.entries() ) {
|
|
690
|
+
|
|
691
|
+
backend[ prop ] = originalFunc;
|
|
692
|
+
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
this.originalMethods.clear();
|
|
696
|
+
|
|
697
|
+
if ( this.currentFrame ) {
|
|
698
|
+
|
|
699
|
+
this.currentFrame.fps = this.renderer.inspector ? this.renderer.inspector.fps : 0;
|
|
700
|
+
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
clear() {
|
|
708
|
+
|
|
709
|
+
this.frames = [];
|
|
710
|
+
this.timelineTrack.innerHTML = '';
|
|
711
|
+
this.playhead.style.display = 'none';
|
|
712
|
+
this.frameInfo.textContent = '';
|
|
713
|
+
this.baseTriangles = 0;
|
|
714
|
+
this.graph.lines[ 'calls' ].points = [];
|
|
715
|
+
this.graph.lines[ 'fps' ].points = [];
|
|
716
|
+
this.graph.lines[ 'triangles' ].points = [];
|
|
717
|
+
this.graph.resetLimit();
|
|
718
|
+
this.graph.update();
|
|
719
|
+
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
exportData() {
|
|
723
|
+
|
|
724
|
+
if ( this.frames.length === 0 ) return;
|
|
725
|
+
|
|
726
|
+
const data = JSON.stringify( this.frames, null, '\t' );
|
|
727
|
+
const blob = new Blob( [ data ], { type: 'application/json' } );
|
|
728
|
+
const url = URL.createObjectURL( blob );
|
|
729
|
+
const a = document.createElement( 'a' );
|
|
730
|
+
a.href = url;
|
|
731
|
+
a.download = 'threejs-timeline.json';
|
|
732
|
+
a.click();
|
|
733
|
+
URL.revokeObjectURL( url );
|
|
734
|
+
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
getRenderTargetDetails( renderTarget ) {
|
|
738
|
+
|
|
739
|
+
const textures = renderTarget.textures;
|
|
740
|
+
const attachments = [];
|
|
741
|
+
|
|
742
|
+
const getBPC = ( texture ) => {
|
|
743
|
+
|
|
744
|
+
switch ( texture.type ) {
|
|
745
|
+
|
|
746
|
+
case ByteType:
|
|
747
|
+
case UnsignedByteType:
|
|
748
|
+
return '8';
|
|
749
|
+
case ShortType:
|
|
750
|
+
case UnsignedShortType:
|
|
751
|
+
case HalfFloatType:
|
|
752
|
+
case UnsignedShort4444Type:
|
|
753
|
+
case UnsignedShort5551Type:
|
|
754
|
+
return '16';
|
|
755
|
+
case IntType:
|
|
756
|
+
case UnsignedIntType:
|
|
757
|
+
case FloatType:
|
|
758
|
+
case UnsignedInt248Type:
|
|
759
|
+
case UnsignedInt5999Type:
|
|
760
|
+
case UnsignedInt101111Type:
|
|
761
|
+
return '32';
|
|
762
|
+
default:
|
|
763
|
+
return '?';
|
|
764
|
+
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
};
|
|
768
|
+
|
|
769
|
+
const getFormat = ( texture ) => {
|
|
770
|
+
|
|
771
|
+
switch ( texture.format ) {
|
|
772
|
+
|
|
773
|
+
case AlphaFormat:
|
|
774
|
+
return 'a';
|
|
775
|
+
case RedFormat:
|
|
776
|
+
case RedIntegerFormat:
|
|
777
|
+
return 'r';
|
|
778
|
+
case RGFormat:
|
|
779
|
+
case RGIntegerFormat:
|
|
780
|
+
return 'rg';
|
|
781
|
+
case RGBFormat:
|
|
782
|
+
case RGBIntegerFormat:
|
|
783
|
+
return 'rgb';
|
|
784
|
+
case DepthFormat:
|
|
785
|
+
return 'depth';
|
|
786
|
+
case DepthStencilFormat:
|
|
787
|
+
return 'depth-stencil';
|
|
788
|
+
case RGBAFormat:
|
|
789
|
+
case RGBAIntegerFormat:
|
|
790
|
+
default:
|
|
791
|
+
return 'rgba';
|
|
792
|
+
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
};
|
|
796
|
+
|
|
797
|
+
for ( let i = 0; i < textures.length; i ++ ) {
|
|
798
|
+
|
|
799
|
+
const texture = textures[ i ];
|
|
800
|
+
|
|
801
|
+
const bpc = getBPC( texture );
|
|
802
|
+
const format = getFormat( texture );
|
|
803
|
+
|
|
804
|
+
let description = `[${ i }]`;
|
|
805
|
+
|
|
806
|
+
if ( texture.name && ! ( texture.isDepthTexture && texture.name === 'depth' ) ) {
|
|
807
|
+
|
|
808
|
+
description += ` ${ texture.name }`;
|
|
809
|
+
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
description += ` ${ format } ${ bpc } bpc`;
|
|
813
|
+
|
|
814
|
+
attachments.push( description );
|
|
815
|
+
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
const details = {
|
|
819
|
+
target: renderTarget.name || 'RenderTarget',
|
|
820
|
+
[ `attachments(${ textures.length })` ]: attachments.join( ', ' )
|
|
821
|
+
};
|
|
822
|
+
|
|
823
|
+
if ( renderTarget.depthTexture ) {
|
|
824
|
+
|
|
825
|
+
details.depth = `${ getBPC( renderTarget.depthTexture ) } bpc`;
|
|
826
|
+
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
return details;
|
|
830
|
+
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
getCallDetail( method, args ) {
|
|
834
|
+
|
|
835
|
+
switch ( method ) {
|
|
836
|
+
|
|
837
|
+
case 'draw': {
|
|
838
|
+
|
|
839
|
+
const renderObject = args[ 0 ];
|
|
840
|
+
|
|
841
|
+
const details = {
|
|
842
|
+
object: renderObject.object.name || renderObject.object.type,
|
|
843
|
+
material: renderObject.material.name || renderObject.material.type,
|
|
844
|
+
geometry: renderObject.geometry.name || renderObject.geometry.type
|
|
845
|
+
};
|
|
846
|
+
|
|
847
|
+
if ( renderObject.getDrawParameters ) {
|
|
848
|
+
|
|
849
|
+
const drawParams = renderObject.getDrawParameters();
|
|
850
|
+
|
|
851
|
+
if ( drawParams ) {
|
|
852
|
+
|
|
853
|
+
if ( renderObject.object.isMesh || renderObject.object.isSprite ) {
|
|
854
|
+
|
|
855
|
+
details.triangles = drawParams.vertexCount / 3;
|
|
856
|
+
|
|
857
|
+
if ( renderObject.object.count > 1 ) {
|
|
858
|
+
|
|
859
|
+
details.instance = renderObject.object.count;
|
|
860
|
+
|
|
861
|
+
details[ 'triangles per instance' ] = details.triangles;
|
|
862
|
+
details.triangles *= details.instance;
|
|
863
|
+
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
return details;
|
|
873
|
+
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
case 'beginRender': {
|
|
877
|
+
|
|
878
|
+
const renderContext = args[ 0 ];
|
|
879
|
+
|
|
880
|
+
const details = {
|
|
881
|
+
scene: this.renderer.inspector.currentRender.name || 'unknown',
|
|
882
|
+
camera: renderContext.camera.name || renderContext.camera.type
|
|
883
|
+
};
|
|
884
|
+
|
|
885
|
+
if ( renderContext.renderTarget && ! renderContext.renderTarget.isPostProcessingRenderTarget ) {
|
|
886
|
+
|
|
887
|
+
Object.assign( details, this.getRenderTargetDetails( renderContext.renderTarget ) );
|
|
888
|
+
|
|
889
|
+
} else {
|
|
890
|
+
|
|
891
|
+
details.target = 'CanvasTarget';
|
|
892
|
+
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
return details;
|
|
896
|
+
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
case 'beginCompute': {
|
|
900
|
+
|
|
901
|
+
const details = {
|
|
902
|
+
compute: this.renderer.inspector.currentCompute.name || 'unknown'
|
|
903
|
+
};
|
|
904
|
+
|
|
905
|
+
return details;
|
|
906
|
+
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
case 'compute': {
|
|
910
|
+
|
|
911
|
+
const computeNode = args[ 1 ];
|
|
912
|
+
const bindings = args[ 2 ];
|
|
913
|
+
const dispatchSize = args[ 4 ] || computeNode.dispatchSize || computeNode.count;
|
|
914
|
+
|
|
915
|
+
const node = computeNode.name || computeNode.type || 'unknown';
|
|
916
|
+
|
|
917
|
+
// bindings
|
|
918
|
+
|
|
919
|
+
let bindingsCount = 0;
|
|
920
|
+
|
|
921
|
+
if ( bindings ) {
|
|
922
|
+
|
|
923
|
+
bindingsCount = bindings.length;
|
|
924
|
+
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
// dispatch
|
|
928
|
+
|
|
929
|
+
let dispatch;
|
|
930
|
+
|
|
931
|
+
if ( dispatchSize.isIndirectStorageBufferAttribute ) {
|
|
932
|
+
|
|
933
|
+
dispatch = 'indirect';
|
|
934
|
+
|
|
935
|
+
} else if ( Array.isArray( dispatchSize ) ) {
|
|
936
|
+
|
|
937
|
+
dispatch = dispatchSize.join( ', ' );
|
|
938
|
+
|
|
939
|
+
} else {
|
|
940
|
+
|
|
941
|
+
dispatch = dispatchSize;
|
|
942
|
+
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
// details
|
|
946
|
+
|
|
947
|
+
return {
|
|
948
|
+
node,
|
|
949
|
+
bindings: bindingsCount,
|
|
950
|
+
dispatch
|
|
951
|
+
};
|
|
952
|
+
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
case 'updateBinding': {
|
|
956
|
+
|
|
957
|
+
const binding = args[ 0 ];
|
|
958
|
+
|
|
959
|
+
return { group: binding.name || 'unknown' };
|
|
960
|
+
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
case 'clear': {
|
|
964
|
+
|
|
965
|
+
const renderContext = args[ 3 ];
|
|
966
|
+
|
|
967
|
+
const details = {
|
|
968
|
+
color: args[ 0 ],
|
|
969
|
+
depth: args[ 1 ],
|
|
970
|
+
stencil: args[ 2 ]
|
|
971
|
+
};
|
|
972
|
+
|
|
973
|
+
if ( renderContext.renderTarget && ! renderContext.renderTarget.isPostProcessingRenderTarget ) {
|
|
974
|
+
|
|
975
|
+
const renderTargetDetails = this.getRenderTargetDetails( renderContext.renderTarget );
|
|
976
|
+
|
|
977
|
+
if ( renderTargetDetails.depth ) {
|
|
978
|
+
|
|
979
|
+
renderTargetDetails[ 'depth texture' ] = renderTargetDetails.depth;
|
|
980
|
+
|
|
981
|
+
delete renderTargetDetails.depth;
|
|
982
|
+
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
Object.assign( details, renderTargetDetails );
|
|
986
|
+
|
|
987
|
+
} else {
|
|
988
|
+
|
|
989
|
+
details.target = 'CanvasTarget';
|
|
990
|
+
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
return details;
|
|
994
|
+
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
case 'updateViewport': {
|
|
998
|
+
|
|
999
|
+
const renderContext = args[ 0 ];
|
|
1000
|
+
const { x, y, width, height } = renderContext.viewportValue;
|
|
1001
|
+
|
|
1002
|
+
return { x, y, width, height };
|
|
1003
|
+
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
case 'updateScissor': {
|
|
1007
|
+
|
|
1008
|
+
const renderContext = args[ 0 ];
|
|
1009
|
+
const { x, y, width, height } = renderContext.scissorValue;
|
|
1010
|
+
|
|
1011
|
+
return { x, y, width, height };
|
|
1012
|
+
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
case 'createProgram':
|
|
1016
|
+
case 'destroyProgram': {
|
|
1017
|
+
|
|
1018
|
+
const program = args[ 0 ];
|
|
1019
|
+
return { stage: program.stage, name: program.name || 'unknown' };
|
|
1020
|
+
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
case 'createRenderPipeline': {
|
|
1024
|
+
|
|
1025
|
+
const renderObject = args[ 0 ];
|
|
1026
|
+
const details = {
|
|
1027
|
+
object: renderObject.object ? ( renderObject.object.name || renderObject.object.type || 'unknown' ) : 'unknown',
|
|
1028
|
+
material: renderObject.material ? ( renderObject.material.name || renderObject.material.type || 'unknown' ) : 'unknown'
|
|
1029
|
+
};
|
|
1030
|
+
|
|
1031
|
+
return details;
|
|
1032
|
+
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
case 'createComputePipeline':
|
|
1036
|
+
case 'destroyComputePipeline': {
|
|
1037
|
+
|
|
1038
|
+
const pipeline = args[ 0 ];
|
|
1039
|
+
return { name: pipeline.name || 'unknown' };
|
|
1040
|
+
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
case 'createBindings':
|
|
1044
|
+
case 'updateBindings': {
|
|
1045
|
+
|
|
1046
|
+
const bindGroup = args[ 0 ];
|
|
1047
|
+
const details = { group: bindGroup.name || 'unknown' };
|
|
1048
|
+
|
|
1049
|
+
if ( bindGroup.bindings ) {
|
|
1050
|
+
|
|
1051
|
+
details.count = bindGroup.bindings.length;
|
|
1052
|
+
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
return details;
|
|
1056
|
+
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
case 'createNodeBuilder': {
|
|
1060
|
+
|
|
1061
|
+
const object = args[ 0 ];
|
|
1062
|
+
const details = { object: object.name || object.type || 'unknown' };
|
|
1063
|
+
|
|
1064
|
+
if ( object.material ) {
|
|
1065
|
+
|
|
1066
|
+
details.material = object.material.name || object.material.type || 'unknown';
|
|
1067
|
+
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
return details;
|
|
1071
|
+
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
case 'createAttribute':
|
|
1075
|
+
case 'createIndexAttribute':
|
|
1076
|
+
case 'createStorageAttribute':
|
|
1077
|
+
case 'destroyAttribute':
|
|
1078
|
+
case 'destroyIndexAttribute':
|
|
1079
|
+
case 'destroyStorageAttribute': {
|
|
1080
|
+
|
|
1081
|
+
const attribute = args[ 0 ];
|
|
1082
|
+
const details = {};
|
|
1083
|
+
|
|
1084
|
+
if ( attribute.name ) details.name = attribute.name;
|
|
1085
|
+
if ( attribute.count !== undefined ) details.count = attribute.count;
|
|
1086
|
+
if ( attribute.itemSize !== undefined ) details.itemSize = attribute.itemSize;
|
|
1087
|
+
|
|
1088
|
+
return details;
|
|
1089
|
+
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
case 'copyFramebufferToTexture': {
|
|
1093
|
+
|
|
1094
|
+
const target = args[ 0 ];
|
|
1095
|
+
const rectangle = args[ 2 ];
|
|
1096
|
+
|
|
1097
|
+
const details = {
|
|
1098
|
+
target: this.getTextureName( target ),
|
|
1099
|
+
width: rectangle.z,
|
|
1100
|
+
height: rectangle.w
|
|
1101
|
+
};
|
|
1102
|
+
|
|
1103
|
+
return details;
|
|
1104
|
+
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
case 'copyTextureToTexture': {
|
|
1108
|
+
|
|
1109
|
+
const srcTexture = args[ 0 ];
|
|
1110
|
+
const dstTexture = args[ 1 ];
|
|
1111
|
+
|
|
1112
|
+
const details = {
|
|
1113
|
+
source: this.getTextureName( srcTexture ),
|
|
1114
|
+
destination: this.getTextureName( dstTexture )
|
|
1115
|
+
};
|
|
1116
|
+
|
|
1117
|
+
return details;
|
|
1118
|
+
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
case 'updateSampler': {
|
|
1122
|
+
|
|
1123
|
+
const texture = args[ 0 ];
|
|
1124
|
+
|
|
1125
|
+
const details = {
|
|
1126
|
+
magFilter: this.getTextureFilterName( texture.magFilter ),
|
|
1127
|
+
minFilter: this.getTextureFilterName( texture.minFilter ),
|
|
1128
|
+
wrapS: this.getTextureWrapName( texture.wrapS ),
|
|
1129
|
+
wrapT: this.getTextureWrapName( texture.wrapT ),
|
|
1130
|
+
anisotropy: texture.anisotropy
|
|
1131
|
+
};
|
|
1132
|
+
|
|
1133
|
+
return details;
|
|
1134
|
+
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
case 'updateTexture':
|
|
1138
|
+
case 'generateMipmaps':
|
|
1139
|
+
case 'createTexture':
|
|
1140
|
+
case 'destroyTexture': {
|
|
1141
|
+
|
|
1142
|
+
const texture = args[ 0 ];
|
|
1143
|
+
const name = this.getTextureName( texture );
|
|
1144
|
+
const details = { texture: name };
|
|
1145
|
+
|
|
1146
|
+
if ( texture.image ) {
|
|
1147
|
+
|
|
1148
|
+
if ( texture.image.width !== undefined ) details.width = texture.image.width;
|
|
1149
|
+
if ( texture.image.height !== undefined ) details.height = texture.image.height;
|
|
1150
|
+
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
return details;
|
|
1154
|
+
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
return null;
|
|
1160
|
+
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
getTextureName( texture ) {
|
|
1164
|
+
|
|
1165
|
+
if ( texture.name ) return texture.name;
|
|
1166
|
+
|
|
1167
|
+
const types = [
|
|
1168
|
+
'isFramebufferTexture', 'isDepthTexture', 'isDataArrayTexture',
|
|
1169
|
+
'isData3DTexture', 'isDataTexture', 'isCompressedArrayTexture',
|
|
1170
|
+
'isCompressedTexture', 'isCubeTexture', 'isVideoTexture',
|
|
1171
|
+
'isCanvasTexture', 'isTexture'
|
|
1172
|
+
];
|
|
1173
|
+
|
|
1174
|
+
for ( const type of types ) {
|
|
1175
|
+
|
|
1176
|
+
if ( texture[ type ] ) return type.replace( 'is', '' );
|
|
1177
|
+
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
return 'Texture';
|
|
1181
|
+
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
getTextureFilterName( filter ) {
|
|
1185
|
+
|
|
1186
|
+
const filters = {
|
|
1187
|
+
1003: 'Nearest',
|
|
1188
|
+
1004: 'NearestMipmapNearest',
|
|
1189
|
+
1005: 'NearestMipmapLinear',
|
|
1190
|
+
1006: 'Linear',
|
|
1191
|
+
1007: 'LinearMipmapNearest',
|
|
1192
|
+
1008: 'LinearMipmapLinear'
|
|
1193
|
+
};
|
|
1194
|
+
|
|
1195
|
+
return filters[ filter ] || filter;
|
|
1196
|
+
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
getTextureWrapName( wrap ) {
|
|
1200
|
+
|
|
1201
|
+
const wrappings = {
|
|
1202
|
+
1000: 'Repeat',
|
|
1203
|
+
1001: 'ClampToEdge',
|
|
1204
|
+
1002: 'MirroredRepeat'
|
|
1205
|
+
};
|
|
1206
|
+
|
|
1207
|
+
return wrappings[ wrap ] || wrap;
|
|
1208
|
+
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
formatDetails( details ) {
|
|
1212
|
+
|
|
1213
|
+
const parts = [];
|
|
1214
|
+
|
|
1215
|
+
for ( const key in details ) {
|
|
1216
|
+
|
|
1217
|
+
if ( details[ key ] !== undefined ) {
|
|
1218
|
+
|
|
1219
|
+
parts.push( `<span style="opacity: 0.5">${key}:</span> <span style="color: var(--text-secondary); opacity: 1">${details[ key ]}</span>` );
|
|
1220
|
+
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
if ( parts.length === 0 ) return '';
|
|
1226
|
+
|
|
1227
|
+
return `<span style="font-size: 11px; margin-left: 8px; color: var(--text-secondary); opacity: 1;">{ ${parts.join( '<span style="opacity: 0.5">, </span>' )} }</span>`;
|
|
1228
|
+
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
renderSlider() {
|
|
1232
|
+
|
|
1233
|
+
if ( this.frames.length === 0 ) {
|
|
1234
|
+
|
|
1235
|
+
this.playhead.style.display = 'none';
|
|
1236
|
+
this.frameInfo.textContent = '';
|
|
1237
|
+
return;
|
|
1238
|
+
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
// Reset graph safely to fit recorded frames exactly up to maxPoints
|
|
1242
|
+
this.graph.lines[ 'calls' ].points = [];
|
|
1243
|
+
this.graph.lines[ 'fps' ].points = [];
|
|
1244
|
+
this.graph.lines[ 'triangles' ].points = [];
|
|
1245
|
+
this.graph.resetLimit();
|
|
1246
|
+
|
|
1247
|
+
// If recorded frames exceed SVG Graph maxPoints, we sample/slice it
|
|
1248
|
+
// (Graph.js inherently handles shifting for real-time,
|
|
1249
|
+
// but statically we want to visualize as much up to max bounds)
|
|
1250
|
+
let framesToRender = this.frames;
|
|
1251
|
+
if ( framesToRender.length > this.graph.maxPoints ) {
|
|
1252
|
+
|
|
1253
|
+
framesToRender = framesToRender.slice( - this.graph.maxPoints );
|
|
1254
|
+
this.frames = framesToRender; // Adjust our internal array to match what's visible
|
|
1255
|
+
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
let maxTriangles = 0;
|
|
1259
|
+
|
|
1260
|
+
for ( let i = 0; i < framesToRender.length; i ++ ) {
|
|
1261
|
+
|
|
1262
|
+
const t = framesToRender[ i ].triangles || 0;
|
|
1263
|
+
if ( t > maxTriangles ) {
|
|
1264
|
+
|
|
1265
|
+
maxTriangles = t;
|
|
1266
|
+
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
for ( let i = 0; i < framesToRender.length; i ++ ) {
|
|
1272
|
+
|
|
1273
|
+
const t = framesToRender[ i ].triangles || 0;
|
|
1274
|
+
const normalizedTriangles = maxTriangles > 0 ? ( t / maxTriangles ) * TRIANGLES_GRAPH_LIMIT : 0;
|
|
1275
|
+
|
|
1276
|
+
// Adding calls length to the Graph SVG to visualize workload geometry
|
|
1277
|
+
this.graph.addPoint( 'calls', framesToRender[ i ].calls.length );
|
|
1278
|
+
this.graph.addPoint( 'fps', framesToRender[ i ].fps || 0 );
|
|
1279
|
+
this.graph.addPoint( 'triangles', normalizedTriangles );
|
|
1280
|
+
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
this.graph.update();
|
|
1284
|
+
|
|
1285
|
+
this.playhead.style.display = 'block';
|
|
1286
|
+
|
|
1287
|
+
// Select the previously selected frame, or the last one if tracking, or 0
|
|
1288
|
+
let targetFrame = 0;
|
|
1289
|
+
if ( this.selectedFrameIndex !== - 1 && this.selectedFrameIndex < this.frames.length ) {
|
|
1290
|
+
|
|
1291
|
+
targetFrame = this.selectedFrameIndex;
|
|
1292
|
+
|
|
1293
|
+
} else if ( this.frames.length > 0 ) {
|
|
1294
|
+
|
|
1295
|
+
targetFrame = this.frames.length - 1;
|
|
1296
|
+
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
this.selectFrame( targetFrame );
|
|
1300
|
+
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
selectFrame( index ) {
|
|
1304
|
+
|
|
1305
|
+
if ( index < 0 || index >= this.frames.length ) return;
|
|
1306
|
+
|
|
1307
|
+
this.selectedFrameIndex = index;
|
|
1308
|
+
|
|
1309
|
+
const frame = this.frames[ index ];
|
|
1310
|
+
this.renderTimelineTrack( frame );
|
|
1311
|
+
|
|
1312
|
+
// Update UI texts
|
|
1313
|
+
const group = ( c, text ) => `<span style="display:inline-flex;align-items:center;margin-left:12px;"><span style="width:6px;height:6px;border-radius:50%;background-color:${c};margin-right:6px;"></span>${text}</span>`;
|
|
1314
|
+
const maxTriangles = Math.max( this.baseTriangles, frame.triangles || 0 );
|
|
1315
|
+
this.frameInfo.innerHTML = 'Frame: ' + frame.id + group( 'var(--color-fps)', ( frame.fps || 0 ).toFixed( 1 ) + ' FPS' ) + group( 'var(--color-call)', frame.calls.length + ' calls' ) + group( 'var(--color-red)', ( frame.triangles || 0 ) + ' / ' + maxTriangles + ' triangles' );
|
|
1316
|
+
|
|
1317
|
+
// Update playhead position
|
|
1318
|
+
const rect = this.graphSlider.getBoundingClientRect();
|
|
1319
|
+
const pointCount = this.graph.lines[ 'calls' ].points.length;
|
|
1320
|
+
|
|
1321
|
+
if ( pointCount > 0 ) {
|
|
1322
|
+
|
|
1323
|
+
// Calculate point width step
|
|
1324
|
+
const pointStep = rect.width / ( this.graph.maxPoints - 1 );
|
|
1325
|
+
|
|
1326
|
+
let localIndex = index;
|
|
1327
|
+
|
|
1328
|
+
if ( this.frames.length > pointCount ) {
|
|
1329
|
+
|
|
1330
|
+
localIndex = index - ( this.frames.length - pointCount );
|
|
1331
|
+
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
// x offset calculation from SVG update logic
|
|
1335
|
+
// The graph translates (slides) back if points length < maxPoints
|
|
1336
|
+
// which means point 0 is at offset
|
|
1337
|
+
const offset = rect.width - ( ( pointCount - 1 ) * pointStep );
|
|
1338
|
+
let xPos = offset + ( localIndex * pointStep );
|
|
1339
|
+
xPos = Math.max( 1, Math.min( xPos, rect.width - 1 ) );
|
|
1340
|
+
|
|
1341
|
+
this.playhead.style.left = xPos + 'px';
|
|
1342
|
+
this.playhead.style.display = 'block';
|
|
1343
|
+
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
getCallBlock( call, fallbackIndex, instanceIndex = 0 ) {
|
|
1349
|
+
|
|
1350
|
+
const target = call.target;
|
|
1351
|
+
let block;
|
|
1352
|
+
|
|
1353
|
+
if ( target && typeof target === 'object' ) {
|
|
1354
|
+
|
|
1355
|
+
let blocks = this.callBlocks.get( target );
|
|
1356
|
+
|
|
1357
|
+
if ( ! blocks ) {
|
|
1358
|
+
|
|
1359
|
+
blocks = [];
|
|
1360
|
+
this.callBlocks.set( target, blocks );
|
|
1361
|
+
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
block = blocks[ instanceIndex ];
|
|
1365
|
+
|
|
1366
|
+
} else {
|
|
1367
|
+
|
|
1368
|
+
block = this.fallbackBlocks[ fallbackIndex ];
|
|
1369
|
+
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
if ( ! block ) {
|
|
1373
|
+
|
|
1374
|
+
block = document.createElement( 'div' );
|
|
1375
|
+
block.style.padding = '4px 8px';
|
|
1376
|
+
block.style.margin = '2px 0';
|
|
1377
|
+
block.style.backgroundColor = 'rgba(255, 255, 255, 0.03)';
|
|
1378
|
+
block.style.fontFamily = 'monospace';
|
|
1379
|
+
block.style.fontSize = '12px';
|
|
1380
|
+
block.style.color = 'var(--text-primary)';
|
|
1381
|
+
block.style.whiteSpace = 'nowrap';
|
|
1382
|
+
block.style.overflow = 'hidden';
|
|
1383
|
+
block.style.textOverflow = 'ellipsis';
|
|
1384
|
+
block.style.display = 'flex';
|
|
1385
|
+
block.style.alignItems = 'center';
|
|
1386
|
+
|
|
1387
|
+
block.arrow = document.createElement( 'span' );
|
|
1388
|
+
block.arrow.style.fontSize = '10px';
|
|
1389
|
+
block.arrow.style.marginRight = '10px';
|
|
1390
|
+
block.arrow.style.cursor = 'pointer';
|
|
1391
|
+
block.arrow.style.width = '26px';
|
|
1392
|
+
block.arrow.style.textAlign = 'center';
|
|
1393
|
+
block.appendChild( block.arrow );
|
|
1394
|
+
|
|
1395
|
+
block.titleSpan = document.createElement( 'span' );
|
|
1396
|
+
block.appendChild( block.titleSpan );
|
|
1397
|
+
|
|
1398
|
+
block.addEventListener( 'click', ( e ) => {
|
|
1399
|
+
|
|
1400
|
+
if ( ! block._groupId ) return;
|
|
1401
|
+
|
|
1402
|
+
e.stopPropagation();
|
|
1403
|
+
|
|
1404
|
+
if ( this.collapsedGroups.has( block._groupId ) ) {
|
|
1405
|
+
|
|
1406
|
+
this.collapsedGroups.delete( block._groupId );
|
|
1407
|
+
|
|
1408
|
+
} else {
|
|
1409
|
+
|
|
1410
|
+
this.collapsedGroups.add( block._groupId );
|
|
1411
|
+
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
this.renderTimelineTrack( this.frames[ this.selectedFrameIndex ] );
|
|
1415
|
+
|
|
1416
|
+
} );
|
|
1417
|
+
|
|
1418
|
+
if ( target && typeof target === 'object' ) {
|
|
1419
|
+
|
|
1420
|
+
this.callBlocks.get( target )[ instanceIndex ] = block;
|
|
1421
|
+
|
|
1422
|
+
} else {
|
|
1423
|
+
|
|
1424
|
+
this.fallbackBlocks[ fallbackIndex ] = block;
|
|
1425
|
+
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
block.style.cursor = 'default';
|
|
1431
|
+
block._groupId = null;
|
|
1432
|
+
block.arrow.style.display = 'none';
|
|
1433
|
+
|
|
1434
|
+
return block;
|
|
1435
|
+
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
renderTimelineTrack( frame ) {
|
|
1439
|
+
|
|
1440
|
+
if ( ! frame || frame.calls.length === 0 ) {
|
|
1441
|
+
|
|
1442
|
+
this.timelineTrack.innerHTML = '';
|
|
1443
|
+
return;
|
|
1444
|
+
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
// Track collapsed states
|
|
1448
|
+
if ( ! this.collapsedGroups ) {
|
|
1449
|
+
|
|
1450
|
+
this.collapsedGroups = new Set();
|
|
1451
|
+
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
let blockIndex = 0;
|
|
1455
|
+
const trackChildren = this.timelineTrack.children;
|
|
1456
|
+
let childIndex = 0;
|
|
1457
|
+
const instanceCounts = new WeakMap();
|
|
1458
|
+
|
|
1459
|
+
if ( this.isHierarchicalView ) {
|
|
1460
|
+
|
|
1461
|
+
const groupedCalls = [];
|
|
1462
|
+
let currentGroup = null;
|
|
1463
|
+
|
|
1464
|
+
for ( let i = 0; i < frame.calls.length; i ++ ) {
|
|
1465
|
+
|
|
1466
|
+
const call = frame.calls[ i ];
|
|
1467
|
+
const isStructural = call.method.startsWith( 'begin' ) || call.method.startsWith( 'finish' );
|
|
1468
|
+
const formatedDetails = call.details ? this.formatDetails( call.details ) : '';
|
|
1469
|
+
|
|
1470
|
+
if ( currentGroup && currentGroup.method === call.method && currentGroup.formatedDetails === formatedDetails && ! isStructural ) {
|
|
1471
|
+
|
|
1472
|
+
currentGroup.count ++;
|
|
1473
|
+
|
|
1474
|
+
} else {
|
|
1475
|
+
|
|
1476
|
+
currentGroup = { method: call.method, count: 1, formatedDetails, target: call.target };
|
|
1477
|
+
groupedCalls.push( currentGroup );
|
|
1478
|
+
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
let currentIndent = 0;
|
|
1484
|
+
const indentSize = 24;
|
|
1485
|
+
|
|
1486
|
+
// Stack to keep track of parent elements and their collapsed state
|
|
1487
|
+
const elementStack = [ { element: this.timelineTrack, isCollapsed: false, id: '', beginCount: 0 } ];
|
|
1488
|
+
|
|
1489
|
+
for ( let i = 0; i < groupedCalls.length; i ++ ) {
|
|
1490
|
+
|
|
1491
|
+
const call = groupedCalls[ i ];
|
|
1492
|
+
|
|
1493
|
+
let instanceIndex = 0;
|
|
1494
|
+
|
|
1495
|
+
if ( call.target && typeof call.target === 'object' ) {
|
|
1496
|
+
|
|
1497
|
+
instanceIndex = instanceCounts.get( call.target ) || 0;
|
|
1498
|
+
instanceCounts.set( call.target, instanceIndex + 1 );
|
|
1499
|
+
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
const block = this.getCallBlock( call, blockIndex ++, instanceIndex );
|
|
1503
|
+
block.style.marginLeft = ( currentIndent * indentSize ) + 'px';
|
|
1504
|
+
block.style.borderLeft = '4px solid ' + this.getColorForMethod( call.method );
|
|
1505
|
+
|
|
1506
|
+
const currentParent = elementStack[ elementStack.length - 1 ];
|
|
1507
|
+
|
|
1508
|
+
// Only add to DOM if parent is not collapsed
|
|
1509
|
+
if ( ! currentParent.isCollapsed ) {
|
|
1510
|
+
|
|
1511
|
+
if ( trackChildren[ childIndex ] !== block ) {
|
|
1512
|
+
|
|
1513
|
+
this.timelineTrack.insertBefore( block, trackChildren[ childIndex ] );
|
|
1514
|
+
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
childIndex ++;
|
|
1518
|
+
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
if ( call.method.startsWith( 'begin' ) ) {
|
|
1522
|
+
|
|
1523
|
+
const beginIndex = currentParent.beginCount ++;
|
|
1524
|
+
const groupId = currentParent.id + '/' + call.method + '-' + beginIndex;
|
|
1525
|
+
const isCollapsed = this.collapsedGroups.has( groupId );
|
|
1526
|
+
|
|
1527
|
+
block._groupId = groupId;
|
|
1528
|
+
block.style.cursor = 'pointer';
|
|
1529
|
+
|
|
1530
|
+
block.arrow.style.display = 'inline-block';
|
|
1531
|
+
block.arrow.textContent = isCollapsed ? '[ + ]' : '[ - ]';
|
|
1532
|
+
|
|
1533
|
+
block.titleSpan.innerHTML = call.method + ( call.formatedDetails ? call.formatedDetails : '' ) + ( call.count > 1 ? ` <span style="opacity: 0.5">( ${call.count} )</span>` : '' );
|
|
1534
|
+
|
|
1535
|
+
currentIndent ++;
|
|
1536
|
+
elementStack.push( { element: block, isCollapsed: currentParent.isCollapsed || isCollapsed, id: groupId, beginCount: 0 } );
|
|
1537
|
+
|
|
1538
|
+
} else if ( call.method.startsWith( 'finish' ) ) {
|
|
1539
|
+
|
|
1540
|
+
block.titleSpan.innerHTML = call.method + ( call.formatedDetails ? call.formatedDetails : '' ) + ( call.count > 1 ? ` <span style="opacity: 0.5">( ${call.count} )</span>` : '' );
|
|
1541
|
+
|
|
1542
|
+
currentIndent = Math.max( 0, currentIndent - 1 );
|
|
1543
|
+
elementStack.pop();
|
|
1544
|
+
|
|
1545
|
+
} else {
|
|
1546
|
+
|
|
1547
|
+
block.titleSpan.innerHTML = call.method + ( call.formatedDetails ? call.formatedDetails : '' ) + ( call.count > 1 ? ` <span style="opacity: 0.5">( ${call.count} )</span>` : '' );
|
|
1548
|
+
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
}
|
|
1552
|
+
|
|
1553
|
+
} else {
|
|
1554
|
+
|
|
1555
|
+
const callCounts = {};
|
|
1556
|
+
|
|
1557
|
+
for ( let i = 0; i < frame.calls.length; i ++ ) {
|
|
1558
|
+
|
|
1559
|
+
const method = frame.calls[ i ].method;
|
|
1560
|
+
|
|
1561
|
+
if ( method.startsWith( 'finish' ) ) continue;
|
|
1562
|
+
|
|
1563
|
+
callCounts[ method ] = ( callCounts[ method ] || 0 ) + 1;
|
|
1564
|
+
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1567
|
+
const sortedCalls = Object.keys( callCounts ).map( method => ( { method, count: callCounts[ method ] } ) );
|
|
1568
|
+
sortedCalls.sort( ( a, b ) => b.count - a.count );
|
|
1569
|
+
|
|
1570
|
+
for ( let i = 0; i < sortedCalls.length; i ++ ) {
|
|
1571
|
+
|
|
1572
|
+
const call = sortedCalls[ i ];
|
|
1573
|
+
|
|
1574
|
+
const block = this.getCallBlock( call, blockIndex ++ );
|
|
1575
|
+
block.style.marginLeft = '0px';
|
|
1576
|
+
block.style.borderLeft = '4px solid ' + this.getColorForMethod( call.method );
|
|
1577
|
+
|
|
1578
|
+
block.titleSpan.innerHTML = call.method + ( call.count > 1 ? ` <span style="opacity: 0.5">( ${call.count} )</span>` : '' );
|
|
1579
|
+
|
|
1580
|
+
if ( trackChildren[ childIndex ] !== block ) {
|
|
1581
|
+
|
|
1582
|
+
this.timelineTrack.insertBefore( block, trackChildren[ childIndex ] );
|
|
1583
|
+
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1586
|
+
childIndex ++;
|
|
1587
|
+
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
while ( this.timelineTrack.children.length > childIndex ) {
|
|
1593
|
+
|
|
1594
|
+
this.timelineTrack.removeChild( this.timelineTrack.lastChild );
|
|
1595
|
+
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1600
|
+
getColorForMethod( method ) {
|
|
1601
|
+
|
|
1602
|
+
if ( method.startsWith( 'begin' ) ) return 'var(--color-green)';
|
|
1603
|
+
if ( method.startsWith( 'finish' ) || method.startsWith( 'destroy' ) ) return 'var(--color-red)';
|
|
1604
|
+
if ( method.startsWith( 'draw' ) || method.startsWith( 'compute' ) || method.startsWith( 'create' ) || method.startsWith( 'generate' ) ) return 'var(--color-yellow)';
|
|
1605
|
+
return 'var(--text-secondary)';
|
|
1606
|
+
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
export { Timeline };
|