(numSplats: number)
| 801 | // This is done so the entire set of splats can be covered by min/max coords across |
| 802 | // each dimension. |
| 803 | export function getTextureSize(numSplats: number): { |
| 804 | width: number; |
| 805 | height: number; |
| 806 | depth: number; |
| 807 | maxSplats: number; |
| 808 | } { |
| 809 | // Compute a texture array size that is large enough to fit numSplats. |
| 810 | // The width is always 2048, the height sized to fit the splats but no larger than 2048. |
| 811 | // The depth is the number of layers needed to fit the splats. |
| 812 | // maxSplats is computed as the new total available splats that can be stored. |
| 813 | const width = SPLAT_TEX_WIDTH; |
| 814 | const height = Math.max( |
| 815 | SPLAT_TEX_MIN_HEIGHT, |
| 816 | Math.min(SPLAT_TEX_HEIGHT, Math.ceil(numSplats / width)), |
| 817 | ); |
| 818 | const depth = Math.ceil(numSplats / (width * height)); |
| 819 | const maxSplats = width * height * depth; |
| 820 | return { width, height, depth, maxSplats }; |
| 821 | } |
| 822 | |
| 823 | export function computeMaxSplats(numSplats: number): number { |
| 824 | // Compute the size of a Gsplat array texture (2048x2048xD) that can fit |
no outgoing calls
no test coverage detected