1. Mapping apparatus, comprising: a transmitter, which is configured to emit a beam comprising pulses of light; a scanner, which is configured to scan the beam, within a predefined scan range, over a scene; a receiver, which is configured to receive the light reflected from the scene and to generate an output indicative of a time of flight of the pulses to and from points in the scene; and a processor, which is coupled to control the scanner so as to cause the beam to scan over a selected window within the scan range and to process the output of the receiver so as to generate a 3D map of a part of the scene that is within the selected window.