High-energy Gamma Rays from the Milky Way: Three-dimensional Spatial Models for the Cosmic-Ray and Radiation Field Densities in the Interstellar Medium