()
| 3 | import type { PointsNode } from '../types'; |
| 4 | |
| 5 | export function usePointsNode(): PointsNode { |
| 6 | const showPointCloud = usePointCloudStore((s) => s.showPointCloud); |
| 7 | const pointOpacity = usePointCloudStore((s) => s.pointOpacity); |
| 8 | const pointSize = usePointCloudStore((s) => s.pointSize); |
| 9 | const colorMode = usePointCloudStore((s) => s.colorMode); |
| 10 | const minTrackLength = usePointCloudStore((s) => s.minTrackLength); |
| 11 | const maxReprojectionError = usePointCloudStore((s) => s.maxReprojectionError); |
| 12 | const thinning = usePointCloudStore((s) => s.thinning); |
| 13 | const selectedPointId = usePointCloudStore((s) => s.selectedPointId); |
| 14 | |
| 15 | return useMemo<PointsNode>( |
| 16 | () => ({ |
| 17 | nodeType: 'points', |
| 18 | visible: showPointCloud, |
| 19 | splatsVisible: showPointCloud && isSplatColorMode(colorMode), |
| 20 | opacity: pointOpacity, |
| 21 | size: pointSize, |
| 22 | colorMode, |
| 23 | minTrackLength, |
| 24 | maxReprojectionError: maxReprojectionError === Infinity ? null : maxReprojectionError, |
| 25 | thinning, |
| 26 | selectedPointId, |
| 27 | }), |
| 28 | [ |
| 29 | showPointCloud, |
| 30 | pointOpacity, |
| 31 | pointSize, |
| 32 | colorMode, |
| 33 | minTrackLength, |
| 34 | maxReprojectionError, |
| 35 | thinning, |
| 36 | selectedPointId, |
| 37 | ] |
| 38 | ); |
| 39 | } |
no test coverage detected