( splatToView: SplatTransformer, minDepth: DynoVal<"float">, maxDepth: DynoVal<"float">, reverse: DynoVal<"bool">, )
| 15 | } from "../dyno"; |
| 16 | |
| 17 | export function makeDepthColorModifier( |
| 18 | splatToView: SplatTransformer, |
| 19 | minDepth: DynoVal<"float">, |
| 20 | maxDepth: DynoVal<"float">, |
| 21 | reverse: DynoVal<"bool">, |
| 22 | ) { |
| 23 | return dynoBlock({ gsplat: Gsplat }, { gsplat: Gsplat }, ({ gsplat }) => { |
| 24 | if (!gsplat) { |
| 25 | throw new Error("No gsplat input"); |
| 26 | } |
| 27 | let { center } = splitGsplat(gsplat).outputs; |
| 28 | center = splatToView.apply(center); |
| 29 | const { z } = split(center).outputs; |
| 30 | let depth = normalizedDepth(neg(z), minDepth, maxDepth); |
| 31 | depth = select(reverse, sub(dynoConst("float", 1), depth), depth); |
| 32 | |
| 33 | gsplat = combineGsplat({ gsplat, r: depth, g: depth, b: depth }); |
| 34 | return { gsplat }; |
| 35 | }); |
| 36 | } |
| 37 | |
| 38 | export function setDepthColor( |
| 39 | splats: SplatMesh, |
no test coverage detected