@equinor/videx-3d
    Preparing search index...

    Function Distance

    • The Distance component can be used to conditionally render (or, with onDemand, mount/unmount) child components based on the camera's distance to a bounds — for example to swap geometry level-of-detail. It reads the DistanceContext, which a parent must provide: use the generic Bounds for any object, or WellboreBounds for a wellbore.

      Parameters

      • __namedParameters: DistanceProps

        Distance props

        Distance props

        • children: ReactNode

          the elements that should be rendered when in visible range (min, max)

        • max: number

          the maximum distance for which the child elements of this component is rendered

        • Optionalmin?: number

          the minimal distance for which the child elements of this component is rendered

        • OptionalonDemand?: boolean

          if enabled, the child elements will only be loaded when within visible range, and will be unloaded/unmounted once it falls out of visible range

      Returns Element

      <Bounds sphere={{ center: [0, 0, 0], radius: 5 }}>
      <Distance min={0} max={50}>
      <mesh>
      <sphereGeometry />
      <meshStandardMaterial color="red" />
      </mesh>
      </Distance>
      <Distance min={50} max={Infinity}>
      <mesh>
      <boxGeometry />
      <meshStandardMaterial color="blue" />
      </mesh>
      </Distance>
      </Bounds>

      This component depends on a DistanceContext being provided by a parent component (e.g. Bounds or WellboreBounds).