Refact particle generator

clean up the codes and add a scene parameter to it