LDA+DMFT approach to resonant inelastic x-ray scattering in correlated materials