D-meson production as a function of event spherocity