|
@@ -56,17 +56,15 @@ import { FileLoader } from './FileLoader.js';
|
|
|
import * as Geometries from '../geometries/Geometries.js';
|
|
|
import * as Curves from '../extras/curves/Curves.js';
|
|
|
|
|
|
-function ObjectLoader( manager ) {
|
|
|
+class ObjectLoader extends Loader {
|
|
|
|
|
|
- Loader.call( this, manager );
|
|
|
+ constructor( manager ) {
|
|
|
|
|
|
-}
|
|
|
-
|
|
|
-ObjectLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
|
|
|
+ super( manager );
|
|
|
|
|
|
- constructor: ObjectLoader,
|
|
|
+ }
|
|
|
|
|
|
- load: function ( url, onLoad, onProgress, onError ) {
|
|
|
+ load( url, onLoad, onProgress, onError ) {
|
|
|
|
|
|
const scope = this;
|
|
|
|
|
@@ -107,9 +105,9 @@ ObjectLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
|
|
|
|
|
|
}, onProgress, onError );
|
|
|
|
|
|
- },
|
|
|
+ }
|
|
|
|
|
|
- parse: function ( json, onLoad ) {
|
|
|
+ parse( json, onLoad ) {
|
|
|
|
|
|
const shapes = this.parseShape( json.shapes );
|
|
|
const geometries = this.parseGeometries( json.geometries, shapes );
|
|
@@ -139,9 +137,9 @@ ObjectLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
|
|
|
|
|
|
return object;
|
|
|
|
|
|
- },
|
|
|
+ }
|
|
|
|
|
|
- parseShape: function ( json ) {
|
|
|
+ parseShape( json ) {
|
|
|
|
|
|
const shapes = {};
|
|
|
|
|
@@ -159,9 +157,9 @@ ObjectLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
|
|
|
|
|
|
return shapes;
|
|
|
|
|
|
- },
|
|
|
+ }
|
|
|
|
|
|
- parseGeometries: function ( json, shapes ) {
|
|
|
+ parseGeometries( json, shapes ) {
|
|
|
|
|
|
const geometries = {};
|
|
|
let geometryShapes;
|
|
@@ -441,9 +439,9 @@ ObjectLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
|
|
|
|
|
|
return geometries;
|
|
|
|
|
|
- },
|
|
|
+ }
|
|
|
|
|
|
- parseMaterials: function ( json, textures ) {
|
|
|
+ parseMaterials( json, textures ) {
|
|
|
|
|
|
const cache = {}; // MultiMaterial
|
|
|
const materials = {};
|
|
@@ -497,9 +495,9 @@ ObjectLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
|
|
|
|
|
|
return materials;
|
|
|
|
|
|
- },
|
|
|
+ }
|
|
|
|
|
|
- parseAnimations: function ( json ) {
|
|
|
+ parseAnimations( json ) {
|
|
|
|
|
|
const animations = [];
|
|
|
|
|
@@ -517,9 +515,9 @@ ObjectLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
|
|
|
|
|
|
return animations;
|
|
|
|
|
|
- },
|
|
|
+ }
|
|
|
|
|
|
- parseImages: function ( json, onLoad ) {
|
|
|
+ parseImages( json, onLoad ) {
|
|
|
|
|
|
const scope = this;
|
|
|
const images = {};
|
|
@@ -587,9 +585,9 @@ ObjectLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
|
|
|
|
|
|
return images;
|
|
|
|
|
|
- },
|
|
|
+ }
|
|
|
|
|
|
- parseTextures: function ( json, images ) {
|
|
|
+ parseTextures( json, images ) {
|
|
|
|
|
|
function parseConstant( value, type ) {
|
|
|
|
|
@@ -674,9 +672,9 @@ ObjectLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
|
|
|
|
|
|
return textures;
|
|
|
|
|
|
- },
|
|
|
+ }
|
|
|
|
|
|
- parseObject: function ( data, geometries, materials ) {
|
|
|
+ parseObject( data, geometries, materials ) {
|
|
|
|
|
|
let object;
|
|
|
|
|
@@ -975,7 +973,16 @@ ObjectLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
|
|
|
|
|
|
}
|
|
|
|
|
|
-} );
|
|
|
+ /* DEPRECATED */
|
|
|
+
|
|
|
+ setTexturePath( value ) {
|
|
|
+
|
|
|
+ console.warn( 'THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath().' );
|
|
|
+ return this.setResourcePath( value );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
|
|
|
const TEXTURE_MAPPING = {
|
|
|
UVMapping: UVMapping,
|
|
@@ -1002,5 +1009,4 @@ const TEXTURE_FILTER = {
|
|
|
LinearMipmapLinearFilter: LinearMipmapLinearFilter
|
|
|
};
|
|
|
|
|
|
-
|
|
|
export { ObjectLoader };
|