threejs-worldgen
    Preparing search index...

    Function selectLod

    • Picks a level of detail for one instance.

      LOD i covers distances below distances[i] (nearest first, ascending); beyond the last distance the instance is hidden (-1). With a current level, the instance keeps it until it is hysteresis (a fraction of the threshold) past the boundary on either side, so instances sitting on a boundary don't flicker as the camera jitters.

      Parameters

      • distance: number

        Distance from the camera, in metres.

      • distances: ArrayLike<number>

        Ascending end distance of each level.

      • current: number = -1

        The level used last time, or -1 / undefined for none (also "hidden").

      • hysteresis: number = 0

        Fractional band around each threshold, e.g. 0.1 = ±10 %.

      Returns number