提交 c2cec2e7 编写于 作者: M Mr.doob

Renamed XHRLoader to FileLoader.

上级 a6cb0b65
...@@ -18,6 +18,7 @@ import { ExtrudeGeometry } from './geometries/ExtrudeGeometry.js'; ...@@ -18,6 +18,7 @@ import { ExtrudeGeometry } from './geometries/ExtrudeGeometry.js';
import { ShapeGeometry } from './geometries/ShapeGeometry.js'; import { ShapeGeometry } from './geometries/ShapeGeometry.js';
import { WireframeGeometry } from './geometries/WireframeGeometry.js'; import { WireframeGeometry } from './geometries/WireframeGeometry.js';
import { Light } from './lights/Light.js'; import { Light } from './lights/Light.js';
import { FileLoader } from './loaders/FileLoader.js';
import { AudioLoader } from './loaders/AudioLoader.js'; import { AudioLoader } from './loaders/AudioLoader.js';
import { CubeTextureLoader } from './loaders/CubeTextureLoader.js'; import { CubeTextureLoader } from './loaders/CubeTextureLoader.js';
import { TextureLoader } from './loaders/TextureLoader.js'; import { TextureLoader } from './loaders/TextureLoader.js';
...@@ -105,6 +106,13 @@ export function WireframeHelper( object, hex ) { ...@@ -105,6 +106,13 @@ export function WireframeHelper( object, hex ) {
// //
export function XHRLoader( manager ) {
console.warn( 'THREE.XHRLoader has been renamed to THREE.FileLoader.' );
return new FileLoader( manager );
}
//
Object.assign( Box2.prototype, { Object.assign( Box2.prototype, {
center: function ( optionalTarget ) { center: function ( optionalTarget ) {
console.warn( 'THREE.Box2: .center() has been renamed to .getCenter().' ); console.warn( 'THREE.Box2: .center() has been renamed to .getCenter().' );
......
...@@ -42,7 +42,7 @@ export { DefaultLoadingManager, LoadingManager } from './loaders/LoadingManager. ...@@ -42,7 +42,7 @@ export { DefaultLoadingManager, LoadingManager } from './loaders/LoadingManager.
export { JSONLoader } from './loaders/JSONLoader.js'; export { JSONLoader } from './loaders/JSONLoader.js';
export { ImageLoader } from './loaders/ImageLoader.js'; export { ImageLoader } from './loaders/ImageLoader.js';
export { FontLoader } from './loaders/FontLoader.js'; export { FontLoader } from './loaders/FontLoader.js';
export { XHRLoader } from './loaders/XHRLoader.js'; export { FileLoader } from './loaders/FileLoader.js';
export { Loader } from './loaders/Loader.js'; export { Loader } from './loaders/Loader.js';
export { Cache } from './loaders/Cache.js'; export { Cache } from './loaders/Cache.js';
export { AudioLoader } from './loaders/AudioLoader.js'; export { AudioLoader } from './loaders/AudioLoader.js';
......
import { AnimationClip } from '../animation/AnimationClip'; import { AnimationClip } from '../animation/AnimationClip';
import { XHRLoader } from './XHRLoader'; import { FileLoader } from './FileLoader';
import { DefaultLoadingManager } from './LoadingManager'; import { DefaultLoadingManager } from './LoadingManager';
/** /**
...@@ -18,7 +18,7 @@ Object.assign( AnimationLoader.prototype, { ...@@ -18,7 +18,7 @@ Object.assign( AnimationLoader.prototype, {
var scope = this; var scope = this;
var loader = new XHRLoader( scope.manager ); var loader = new FileLoader( scope.manager );
loader.load( url, function ( text ) { loader.load( url, function ( text ) {
onLoad( scope.parse( JSON.parse( text ) ) ); onLoad( scope.parse( JSON.parse( text ) ) );
......
import { getAudioContext } from '../audio/AudioContext'; import { getAudioContext } from '../audio/AudioContext';
import { XHRLoader } from './XHRLoader'; import { FileLoader } from './FileLoader';
import { DefaultLoadingManager } from './LoadingManager'; import { DefaultLoadingManager } from './LoadingManager';
/** /**
...@@ -16,7 +16,7 @@ Object.assign( AudioLoader.prototype, { ...@@ -16,7 +16,7 @@ Object.assign( AudioLoader.prototype, {
load: function ( url, onLoad, onProgress, onError ) { load: function ( url, onLoad, onProgress, onError ) {
var loader = new XHRLoader( this.manager ); var loader = new FileLoader( this.manager );
loader.setResponseType( 'arraybuffer' ); loader.setResponseType( 'arraybuffer' );
loader.load( url, function ( buffer ) { loader.load( url, function ( buffer ) {
......
import { LinearFilter, LinearMipMapLinearFilter, ClampToEdgeWrapping } from '../constants'; import { LinearFilter, LinearMipMapLinearFilter, ClampToEdgeWrapping } from '../constants';
import { XHRLoader } from './XHRLoader'; import { FileLoader } from './FileLoader';
import { DataTexture } from '../textures/DataTexture'; import { DataTexture } from '../textures/DataTexture';
import { DefaultLoadingManager } from './LoadingManager'; import { DefaultLoadingManager } from './LoadingManager';
...@@ -27,7 +27,7 @@ Object.assign( BinaryTextureLoader.prototype, { ...@@ -27,7 +27,7 @@ Object.assign( BinaryTextureLoader.prototype, {
var texture = new DataTexture(); var texture = new DataTexture();
var loader = new XHRLoader( this.manager ); var loader = new FileLoader( this.manager );
loader.setResponseType( 'arraybuffer' ); loader.setResponseType( 'arraybuffer' );
loader.load( url, function ( buffer ) { loader.load( url, function ( buffer ) {
......
...@@ -2,7 +2,7 @@ import { Sphere } from '../math/Sphere'; ...@@ -2,7 +2,7 @@ import { Sphere } from '../math/Sphere';
import { Vector3 } from '../math/Vector3'; import { Vector3 } from '../math/Vector3';
import { BufferAttribute } from '../core/BufferAttribute'; import { BufferAttribute } from '../core/BufferAttribute';
import { BufferGeometry } from '../core/BufferGeometry'; import { BufferGeometry } from '../core/BufferGeometry';
import { XHRLoader } from './XHRLoader'; import { FileLoader } from './FileLoader';
import { DefaultLoadingManager } from './LoadingManager'; import { DefaultLoadingManager } from './LoadingManager';
/** /**
...@@ -21,7 +21,7 @@ Object.assign( BufferGeometryLoader.prototype, { ...@@ -21,7 +21,7 @@ Object.assign( BufferGeometryLoader.prototype, {
var scope = this; var scope = this;
var loader = new XHRLoader( scope.manager ); var loader = new FileLoader( scope.manager );
loader.load( url, function ( text ) { loader.load( url, function ( text ) {
onLoad( scope.parse( JSON.parse( text ) ) ); onLoad( scope.parse( JSON.parse( text ) ) );
......
import { LinearFilter } from '../constants'; import { LinearFilter } from '../constants';
import { XHRLoader } from './XHRLoader'; import { FileLoader } from './FileLoader';
import { CompressedTexture } from '../textures/CompressedTexture'; import { CompressedTexture } from '../textures/CompressedTexture';
import { DefaultLoadingManager } from './LoadingManager'; import { DefaultLoadingManager } from './LoadingManager';
...@@ -29,7 +29,7 @@ Object.assign( CompressedTextureLoader.prototype, { ...@@ -29,7 +29,7 @@ Object.assign( CompressedTextureLoader.prototype, {
var texture = new CompressedTexture(); var texture = new CompressedTexture();
texture.image = images; texture.image = images;
var loader = new XHRLoader( this.manager ); var loader = new FileLoader( this.manager );
loader.setPath( this.path ); loader.setPath( this.path );
loader.setResponseType( 'arraybuffer' ); loader.setResponseType( 'arraybuffer' );
......
...@@ -5,13 +5,13 @@ import { DefaultLoadingManager } from './LoadingManager'; ...@@ -5,13 +5,13 @@ import { DefaultLoadingManager } from './LoadingManager';
* @author mrdoob / http://mrdoob.com/ * @author mrdoob / http://mrdoob.com/
*/ */
function XHRLoader( manager ) { function FileLoader( manager ) {
this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager; this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;
} }
Object.assign( XHRLoader.prototype, { Object.assign( FileLoader.prototype, {
load: function ( url, onLoad, onProgress, onError ) { load: function ( url, onLoad, onProgress, onError ) {
...@@ -147,7 +147,7 @@ Object.assign( XHRLoader.prototype, { ...@@ -147,7 +147,7 @@ Object.assign( XHRLoader.prototype, {
// Some browsers return HTTP Status 0 when using non-http protocol // Some browsers return HTTP Status 0 when using non-http protocol
// e.g. 'file://' or 'data://'. Handle as success. // e.g. 'file://' or 'data://'. Handle as success.
console.warn( 'THREE.XHRLoader: HTTP Status 0 received.' ); console.warn( 'THREE.FileLoader: HTTP Status 0 received.' );
if ( onLoad ) onLoad( response ); if ( onLoad ) onLoad( response );
...@@ -220,4 +220,4 @@ Object.assign( XHRLoader.prototype, { ...@@ -220,4 +220,4 @@ Object.assign( XHRLoader.prototype, {
} ); } );
export { XHRLoader }; export { FileLoader };
import { Font } from '../extras/core/Font'; import { Font } from '../extras/core/Font';
import { XHRLoader } from './XHRLoader'; import { FileLoader } from './FileLoader';
import { DefaultLoadingManager } from './LoadingManager'; import { DefaultLoadingManager } from './LoadingManager';
/** /**
...@@ -18,7 +18,7 @@ Object.assign( FontLoader.prototype, { ...@@ -18,7 +18,7 @@ Object.assign( FontLoader.prototype, {
var scope = this; var scope = this;
var loader = new XHRLoader( this.manager ); var loader = new FileLoader( this.manager );
loader.load( url, function ( text ) { loader.load( url, function ( text ) {
var json; var json;
......
import { XHRLoader } from './XHRLoader'; import { FileLoader } from './FileLoader';
import { DefaultLoadingManager } from './LoadingManager'; import { DefaultLoadingManager } from './LoadingManager';
/** /**
...@@ -37,7 +37,7 @@ Object.assign( ImageLoader.prototype, { ...@@ -37,7 +37,7 @@ Object.assign( ImageLoader.prototype, {
} else { } else {
var loader = new XHRLoader(); var loader = new FileLoader();
loader.setPath( this.path ); loader.setPath( this.path );
loader.setResponseType( 'blob' ); loader.setResponseType( 'blob' );
loader.setWithCredentials( this.withCredentials ); loader.setWithCredentials( this.withCredentials );
......
...@@ -6,7 +6,7 @@ import { Color } from '../math/Color'; ...@@ -6,7 +6,7 @@ import { Color } from '../math/Color';
import { Vector2 } from '../math/Vector2'; import { Vector2 } from '../math/Vector2';
import { Face3 } from '../core/Face3'; import { Face3 } from '../core/Face3';
import { Geometry } from '../core/Geometry'; import { Geometry } from '../core/Geometry';
import { XHRLoader } from './XHRLoader'; import { FileLoader } from './FileLoader';
import { DefaultLoadingManager } from './LoadingManager'; import { DefaultLoadingManager } from './LoadingManager';
/** /**
...@@ -37,7 +37,7 @@ Object.assign( JSONLoader.prototype, { ...@@ -37,7 +37,7 @@ Object.assign( JSONLoader.prototype, {
var texturePath = this.texturePath && ( typeof this.texturePath === "string" ) ? this.texturePath : Loader.prototype.extractUrlBase( url ); var texturePath = this.texturePath && ( typeof this.texturePath === "string" ) ? this.texturePath : Loader.prototype.extractUrlBase( url );
var loader = new XHRLoader( this.manager ); var loader = new FileLoader( this.manager );
loader.setWithCredentials( this.withCredentials ); loader.setWithCredentials( this.withCredentials );
loader.load( url, function ( text ) { loader.load( url, function ( text ) {
......
import { Vector2 } from '../math/Vector2'; import { Vector2 } from '../math/Vector2';
import { XHRLoader } from './XHRLoader'; import { FileLoader } from './FileLoader';
import { DefaultLoadingManager } from './LoadingManager'; import { DefaultLoadingManager } from './LoadingManager';
import * as Materials from '../materials/Materials'; import * as Materials from '../materials/Materials';
...@@ -20,7 +20,7 @@ Object.assign( MaterialLoader.prototype, { ...@@ -20,7 +20,7 @@ Object.assign( MaterialLoader.prototype, {
var scope = this; var scope = this;
var loader = new XHRLoader( scope.manager ); var loader = new FileLoader( scope.manager );
loader.load( url, function ( text ) { loader.load( url, function ( text ) {
onLoad( scope.parse( JSON.parse( text ) ) ); onLoad( scope.parse( JSON.parse( text ) ) );
......
...@@ -27,7 +27,7 @@ import { AnimationClip } from '../animation/AnimationClip'; ...@@ -27,7 +27,7 @@ import { AnimationClip } from '../animation/AnimationClip';
import { MaterialLoader } from './MaterialLoader'; import { MaterialLoader } from './MaterialLoader';
import { BufferGeometryLoader } from './BufferGeometryLoader'; import { BufferGeometryLoader } from './BufferGeometryLoader';
import { JSONLoader } from './JSONLoader'; import { JSONLoader } from './JSONLoader';
import { XHRLoader } from './XHRLoader'; import { FileLoader } from './FileLoader';
import * as Geometries from '../geometries/Geometries'; import * as Geometries from '../geometries/Geometries';
/** /**
...@@ -53,7 +53,7 @@ Object.assign( ObjectLoader.prototype, { ...@@ -53,7 +53,7 @@ Object.assign( ObjectLoader.prototype, {
var scope = this; var scope = this;
var loader = new XHRLoader( scope.manager ); var loader = new FileLoader( scope.manager );
loader.load( url, function ( text ) { loader.load( url, function ( text ) {
var json = null; var json = null;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册