Texture and residual stresses in thermally sprayed coatings