Skip to content

Commit 6d4c00b

Browse files
committed
Updated builds.
1 parent a38644b commit 6d4c00b

File tree

2 files changed

+83
-73
lines changed

2 files changed

+83
-73
lines changed

build/three.js

Lines changed: 68 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -13749,6 +13749,7 @@ THREE.BufferGeometryLoader.prototype = {
1374913749
THREE.MaterialLoader = function ( manager ) {
1375013750

1375113751
this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
13752+
this.textures = {};
1375213753

1375313754
};
1375413755

@@ -13776,10 +13777,32 @@ THREE.MaterialLoader.prototype = {
1377613777

1377713778
},
1377813779

13780+
setTextures: function ( value ) {
13781+
13782+
this.textures = value;
13783+
13784+
},
13785+
13786+
getTexture: function ( name ) {
13787+
13788+
var textures = this.textures;
13789+
13790+
if ( textures[ name ] === undefined ) {
13791+
13792+
console.warn( 'THREE.MaterialLoader: Undefined texture', name );
13793+
13794+
}
13795+
13796+
return textures[ name ];
13797+
13798+
},
13799+
1377913800
parse: function ( json ) {
1378013801

1378113802
var material = new THREE[ json.type ];
13803+
material.uuid = json.uuid;
1378213804

13805+
if ( json.name !== undefined ) material.name = json.name;
1378313806
if ( json.color !== undefined ) material.color.setHex( json.color );
1378413807
if ( json.emissive !== undefined ) material.emissive.setHex( json.emissive );
1378513808
if ( json.specular !== undefined ) material.specular.setHex( json.specular );
@@ -13794,13 +13817,55 @@ THREE.MaterialLoader.prototype = {
1379413817
if ( json.opacity !== undefined ) material.opacity = json.opacity;
1379513818
if ( json.transparent !== undefined ) material.transparent = json.transparent;
1379613819
if ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest;
13820+
if ( json.depthTest !== undefined ) material.depthTest = json.depthTest;
13821+
if ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite;
1379713822
if ( json.wireframe !== undefined ) material.wireframe = json.wireframe;
1379813823
if ( json.wireframeLinewidth !== undefined ) material.wireframeLinewidth = json.wireframeLinewidth;
1379913824

1380013825
// for PointCloudMaterial
1380113826
if ( json.size !== undefined ) material.size = json.size;
1380213827
if ( json.sizeAttenuation !== undefined ) material.sizeAttenuation = json.sizeAttenuation;
1380313828

13829+
// maps
13830+
13831+
if ( json.map !== undefined ) material.map = this.getTexture( json.map );
13832+
13833+
if ( json.alphaMap !== undefined ) {
13834+
13835+
material.alphaMap = this.getTexture( json.alphaMap );
13836+
material.transparent = true;
13837+
13838+
}
13839+
13840+
if ( json.bumpMap !== undefined ) material.bumpMap = this.getTexture( json.bumpMap );
13841+
if ( json.bumpScale !== undefined ) material.bumpScale = json.bumpScale;
13842+
13843+
if ( json.normalMap !== undefined ) material.normalMap = this.getTexture( json.normalMap );
13844+
if ( json.normalScale ) material.normalScale = new THREE.Vector2( json.normalScale, json.normalScale );
13845+
13846+
if ( json.displacementMap !== undefined ) material.displacementMap = this.getTexture( json.displacementMap );
13847+
if ( json.displacementScale !== undefined ) material.displacementScale = json.displacementScale;
13848+
if ( json.displacementBias !== undefined ) material.displacementBias = json.displacementBias;
13849+
13850+
if ( json.specularMap !== undefined ) material.specularMap = this.getTexture( json.specularMap );
13851+
13852+
if ( json.envMap !== undefined ) {
13853+
13854+
material.envMap = this.getTexture( json.envMap );
13855+
material.combine = THREE.MultiplyOperation;
13856+
13857+
}
13858+
13859+
if ( json.reflectivity ) material.reflectivity = json.reflectivity;
13860+
13861+
if ( json.lightMap !== undefined ) material.lightMap = this.getTexture( json.lightMap );
13862+
if ( json.lightMapIntensity !== undefined ) material.lightMapIntensity = json.lightMapIntensity;
13863+
13864+
if ( json.aoMap !== undefined ) material.aoMap = this.getTexture( json.aoMap );
13865+
if ( json.aoMapIntensity !== undefined ) material.aoMapIntensity = json.aoMapIntensity;
13866+
13867+
// MeshFaceMaterial
13868+
1380413869
if ( json.materials !== undefined ) {
1380513870

1380613871
for ( var i = 0, l = json.materials.length; i < l; i ++ ) {
@@ -14121,69 +14186,13 @@ THREE.ObjectLoader.prototype = {
1412114186

1412214187
if ( json !== undefined ) {
1412314188

14124-
var getTexture = function ( name ) {
14125-
14126-
if ( textures[ name ] === undefined ) {
14127-
14128-
console.warn( 'THREE.ObjectLoader: Undefined texture', name );
14129-
14130-
}
14131-
14132-
return textures[ name ];
14133-
14134-
};
14135-
1413614189
var loader = new THREE.MaterialLoader();
14190+
loader.setTextures( textures );
1413714191

1413814192
for ( var i = 0, l = json.length; i < l; i ++ ) {
1413914193

14140-
var data = json[ i ];
14141-
var material = loader.parse( data );
14142-
14143-
material.uuid = data.uuid;
14144-
14145-
if ( data.depthTest !== undefined ) material.depthTest = data.depthTest;
14146-
if ( data.depthWrite !== undefined ) material.depthWrite = data.depthWrite;
14147-
14148-
if ( data.name !== undefined ) material.name = data.name;
14149-
14150-
if ( data.map !== undefined ) material.map = getTexture( data.map );
14151-
14152-
if ( data.alphaMap !== undefined ) {
14153-
14154-
material.alphaMap = getTexture( data.alphaMap );
14155-
material.transparent = true;
14156-
14157-
}
14158-
14159-
if ( data.bumpMap !== undefined ) material.bumpMap = getTexture( data.bumpMap );
14160-
if ( data.bumpScale !== undefined ) material.bumpScale = data.bumpScale;
14161-
14162-
if ( data.normalMap !== undefined ) material.normalMap = getTexture( data.normalMap );
14163-
if ( data.normalScale ) material.normalScale = new THREE.Vector2( data.normalScale, data.normalScale );
14164-
14165-
if ( data.displacementMap !== undefined ) material.displacementMap = getTexture( data.displacementMap );
14166-
if ( data.displacementScale !== undefined ) material.displacementScale = data.displacementScale;
14167-
if ( data.displacementBias !== undefined ) material.displacementBias = data.displacementBias;
14168-
14169-
if ( data.specularMap !== undefined ) material.specularMap = getTexture( data.specularMap );
14170-
14171-
if ( data.envMap !== undefined ) {
14172-
14173-
material.envMap = getTexture( data.envMap );
14174-
material.combine = THREE.MultiplyOperation;
14175-
14176-
}
14177-
14178-
if ( data.reflectivity ) material.reflectivity = data.reflectivity;
14179-
14180-
if ( data.lightMap !== undefined ) material.lightMap = getTexture( data.lightMap );
14181-
if ( data.lightMapIntensity !== undefined ) material.lightMapIntensity = data.lightMapIntensity;
14182-
14183-
if ( data.aoMap !== undefined ) material.aoMap = getTexture( data.aoMap );
14184-
if ( data.aoMapIntensity !== undefined ) material.aoMapIntensity = data.aoMapIntensity;
14185-
14186-
materials[ data.uuid ] = material;
14194+
var material = loader.parse( json[ i ] );
14195+
materials[ material.uuid ] = material;
1418714196

1418814197
}
1418914198

0 commit comments

Comments
 (0)