LoadingManager.js 593 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. */
  4. THREE.LoadingManager = function ( onLoad, onProgress, onError ) {
  5. var scope = this;
  6. var loaded = 0, total = 0;
  7. this.onLoad = onLoad;
  8. this.onProgress = onProgress;
  9. this.onError = onError;
  10. this.itemStart = function ( url ) {
  11. total ++;
  12. };
  13. this.itemEnd = function ( url ) {
  14. loaded ++;
  15. if ( scope.onProgress !== undefined ) {
  16. scope.onProgress( url, loaded, total );
  17. }
  18. if ( loaded === total && scope.onLoad !== undefined ) {
  19. scope.onLoad();
  20. }
  21. };
  22. };
  23. THREE.DefaultLoadingManager = new THREE.LoadingManager();
粤ICP备19079148号