Geometric optics for the wave equation