A three-dimensional model for quark and gluon jets