Skip to content

Commit 36f4f45

Browse files
committed
Updated builds.
1 parent ca85e3a commit 36f4f45

File tree

2 files changed

+99
-197
lines changed

2 files changed

+99
-197
lines changed

build/three.js

Lines changed: 84 additions & 181 deletions
Original file line numberDiff line numberDiff line change
@@ -14339,16 +14339,16 @@ THREE.Loader.prototype = {
1433914339

1434014340
if ( repeat !== undefined ) {
1434114341

14342-
texture.repeat.set( repeat[ 0 ], repeat[ 1 ] );
14342+
texture.repeat.fromArray( repeat );
1434314343

14344-
if ( repeat[ 0 ] > 1 ) texture.wrapS = THREE.RepeatWrapping;
14345-
if ( repeat[ 1 ] > 1 ) texture.wrapT = THREE.RepeatWrapping;
14344+
if ( repeat[ 0 ] !== 1 ) texture.wrapS = THREE.RepeatWrapping;
14345+
if ( repeat[ 1 ] !== 1 ) texture.wrapT = THREE.RepeatWrapping;
1434614346

1434714347
}
1434814348

1434914349
if ( offset !== undefined ) {
1435014350

14351-
texture.offset.set( offset[ 0 ], offset[ 1 ] );
14351+
texture.offset.fromArray( offset );
1435214352

1435314353
}
1435414354

@@ -14419,31 +14419,31 @@ THREE.Loader.prototype = {
1441914419
if ( value.toLowerCase() === 'phong' ) json.type = 'MeshPhongMaterial';
1442014420
break;
1442114421
case 'mapDiffuse':
14422-
json.map = loadTexture( value, json.mapDiffuseRepeat, json.mapDiffuseOffset, json.mapDiffuseWrap, json.mapDiffuseAnisotropy );
14422+
json.map = loadTexture( value, m.mapDiffuseRepeat, m.mapDiffuseOffset, m.mapDiffuseWrap, m.mapDiffuseAnisotropy );
1442314423
break;
1442414424
case 'mapDiffuseRepeat':
1442514425
case 'mapDiffuseOffset':
1442614426
case 'mapDiffuseWrap':
1442714427
case 'mapDiffuseAnisotropy':
1442814428
break;
1442914429
case 'mapLight':
14430-
json.lightMap = loadTexture( value, json.mapLightRepeat, json.mapLightOffset, json.mapLightWrap, json.mapLightAnisotropy );
14430+
json.lightMap = loadTexture( value, m.mapLightRepeat, m.mapLightOffset, m.mapLightWrap, m.mapLightAnisotropy );
1443114431
break;
1443214432
case 'mapLightRepeat':
1443314433
case 'mapLightOffset':
1443414434
case 'mapLightWrap':
1443514435
case 'mapLightAnisotropy':
1443614436
break;
1443714437
case 'mapAO':
14438-
json.aoMap = loadTexture( value, json.mapAORepeat, json.mapAOOffset, json.mapAOWrap, json.mapAOAnisotropy );
14438+
json.aoMap = loadTexture( value, m.mapAORepeat, m.mapAOOffset, m.mapAOWrap, m.mapAOAnisotropy );
1443914439
break;
1444014440
case 'mapAORepeat':
1444114441
case 'mapAOOffset':
1444214442
case 'mapAOWrap':
1444314443
case 'mapAOAnisotropy':
1444414444
break;
1444514445
case 'mapBump':
14446-
json.bumpMap = loadTexture( value, json.mapBumpRepeat, json.mapBumpOffset, json.mapBumpWrap, json.mapBumpAnisotropy );
14446+
json.bumpMap = loadTexture( value, m.mapBumpRepeat, m.mapBumpOffset, m.mapBumpWrap, m.mapBumpAnisotropy );
1444714447
break;
1444814448
case 'mapBumpScale':
1444914449
json.bumpScale = value;
@@ -14454,7 +14454,7 @@ THREE.Loader.prototype = {
1445414454
case 'mapBumpAnisotropy':
1445514455
break;
1445614456
case 'mapNormal':
14457-
json.normalMap = loadTexture( value, json.mapNormalRepeat, json.mapNormalOffset, json.mapNormalWrap, json.mapNormalAnisotropy );
14457+
json.normalMap = loadTexture( value, m.mapNormalRepeat, m.mapNormalOffset, m.mapNormalWrap, m.mapNormalAnisotropy );
1445814458
break;
1445914459
case 'mapNormalFactor':
1446014460
json.normalScale = [ value, value ];
@@ -14465,15 +14465,15 @@ THREE.Loader.prototype = {
1446514465
case 'mapNormalAnisotropy':
1446614466
break;
1446714467
case 'mapSpecular':
14468-
json.specularMap = loadTexture( value, json.mapSpecularRepeat, json.mapSpecularOffset, json.mapSpecularWrap, json.mapSpecularAnisotropy );
14468+
json.specularMap = loadTexture( value, m.mapSpecularRepeat, m.mapSpecularOffset, m.mapSpecularWrap, m.mapSpecularAnisotropy );
1446914469
break;
1447014470
case 'mapSpecularRepeat':
1447114471
case 'mapSpecularOffset':
1447214472
case 'mapSpecularWrap':
1447314473
case 'mapSpecularAnisotropy':
1447414474
break;
1447514475
case 'mapAlpha':
14476-
json.alphaMap = loadTexture( value, json.mapAlphaRepeat, json.mapAlphaOffset, json.mapAlphaWrap, json.mapAlphaAnisotropy );
14476+
json.alphaMap = loadTexture( value, m.mapAlphaRepeat, m.mapAlphaOffset, m.mapAlphaWrap, m.mapAlphaAnisotropy );
1447714477
break;
1447814478
case 'mapAlphaRepeat':
1447914479
case 'mapAlphaOffset':
@@ -16260,11 +16260,9 @@ THREE.TextureLoader.prototype = {
1626016260

1626116261
load: function ( url, onLoad, onProgress, onError ) {
1626216262

16263-
var scope = this;
16264-
1626516263
var texture = new THREE.Texture();
1626616264

16267-
var loader = new THREE.ImageLoader( scope.manager );
16265+
var loader = new THREE.ImageLoader( this.manager );
1626816266
loader.setCrossOrigin( this.crossOrigin );
1626916267
loader.load( url, function ( image ) {
1627016268

@@ -16291,6 +16289,69 @@ THREE.TextureLoader.prototype = {
1629116289

1629216290
};
1629316291

16292+
// File:src/loaders/CubeTextureLoader.js
16293+
16294+
/**
16295+
* @author mrdoob / http://mrdoob.com/
16296+
*/
16297+
16298+
THREE.CubeTextureLoader = function ( manager ) {
16299+
16300+
this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
16301+
16302+
};
16303+
16304+
THREE.CubeTextureLoader.prototype = {
16305+
16306+
constructor: THREE.CubeTextureLoader,
16307+
16308+
load: function ( urls, onLoad, onProgress, onError ) {
16309+
16310+
var texture = new THREE.CubeTexture( [] );
16311+
16312+
var loader = new THREE.ImageLoader();
16313+
loader.setCrossOrigin( this.crossOrigin );
16314+
16315+
var loaded = 0;
16316+
16317+
function loadTexture( i ) {
16318+
16319+
loader.load( urls[ i ], function ( image ) {
16320+
16321+
texture.images[ i ] = image;
16322+
16323+
loaded ++;
16324+
16325+
if ( loaded === 6 ) {
16326+
16327+
texture.needsUpdate = true;
16328+
16329+
if ( onLoad ) onLoad( texture );
16330+
16331+
}
16332+
16333+
}, undefined, onError );
16334+
16335+
}
16336+
16337+
for ( var i = 0; i < urls.length; ++ i ) {
16338+
16339+
loadTexture( i );
16340+
16341+
}
16342+
16343+
return texture;
16344+
16345+
},
16346+
16347+
setCrossOrigin: function ( value ) {
16348+
16349+
this.crossOrigin = value;
16350+
16351+
}
16352+
16353+
};
16354+
1629416355
// File:src/loaders/BinaryTextureLoader.js
1629516356

1629616357
/**
@@ -28207,58 +28268,27 @@ THREE.ImageUtils = {
2820728268

2820828269
loadTexture: function ( url, mapping, onLoad, onError ) {
2820928270

28271+
console.warn( 'THREE.ImageUtils.loadTexture is being deprecated. Use THREE.TextureLoader() instead.' );
28272+
2821028273
var loader = new THREE.TextureLoader();
2821128274
loader.setCrossOrigin( this.crossOrigin );
2821228275

28213-
var texture = loader.load( url, function ( texture ) {
28214-
28215-
if ( onLoad ) onLoad( texture );
28216-
28217-
}, undefined, onError );
28218-
28276+
var texture = loader.load( url, onLoad, undefined, onError );
2821928277
texture.mapping = mapping;
28220-
texture.sourceFile = url;
2822128278

2822228279
return texture;
2822328280

2822428281
},
2822528282

28226-
loadTextureCube: function ( array, mapping, onLoad, onError ) {
28227-
28228-
var images = [];
28229-
28230-
var loader = new THREE.ImageLoader();
28231-
loader.crossOrigin = this.crossOrigin;
28232-
28233-
var texture = new THREE.CubeTexture( images, mapping );
28234-
28235-
var loaded = 0;
28236-
28237-
function loadTexture( i ) {
28238-
28239-
loader.load( array[ i ], function ( image ) {
28240-
28241-
texture.images[ i ] = image;
28242-
28243-
loaded += 1;
28244-
28245-
if ( loaded === 6 ) {
28246-
28247-
texture.needsUpdate = true;
28248-
28249-
if ( onLoad ) onLoad( texture );
28283+
loadTextureCube: function ( urls, mapping, onLoad, onError ) {
2825028284

28251-
}
28252-
28253-
}, undefined, onError );
28254-
28255-
}
28285+
console.warn( 'THREE.ImageUtils.loadTextureCube is being deprecated. Use THREE.CubeTextureLoader() instead.' );
2825628286

28257-
for ( var i = 0, il = array.length; i < il; ++ i ) {
28258-
28259-
loadTexture( i );
28287+
var loader = new THREE.CubeTextureLoader();
28288+
loader.setCrossOrigin( this.crossOrigin );
2826028289

28261-
}
28290+
var texture = loader.load( urls, onLoad, undefined, onError );
28291+
texture.mapping = mapping;
2826228292

2826328293
return texture;
2826428294

@@ -28274,133 +28304,6 @@ THREE.ImageUtils = {
2827428304

2827528305
console.error( 'THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.' )
2827628306

28277-
},
28278-
28279-
getNormalMap: function ( image, depth ) {
28280-
28281-
// Adapted from http://www.paulbrunt.co.uk/lab/heightnormal/
28282-
28283-
function cross( a, b ) {
28284-
28285-
return [ a[ 1 ] * b[ 2 ] - a[ 2 ] * b[ 1 ], a[ 2 ] * b[ 0 ] - a[ 0 ] * b[ 2 ], a[ 0 ] * b[ 1 ] - a[ 1 ] * b[ 0 ] ];
28286-
28287-
}
28288-
28289-
function subtract( a, b ) {
28290-
28291-
return [ a[ 0 ] - b[ 0 ], a[ 1 ] - b[ 1 ], a[ 2 ] - b[ 2 ] ];
28292-
28293-
}
28294-
28295-
function normalize( a ) {
28296-
28297-
var l = Math.sqrt( a[ 0 ] * a[ 0 ] + a[ 1 ] * a[ 1 ] + a[ 2 ] * a[ 2 ] );
28298-
return [ a[ 0 ] / l, a[ 1 ] / l, a[ 2 ] / l ];
28299-
28300-
}
28301-
28302-
depth = depth | 1;
28303-
28304-
var width = image.width;
28305-
var height = image.height;
28306-
28307-
var canvas = document.createElement( 'canvas' );
28308-
canvas.width = width;
28309-
canvas.height = height;
28310-
28311-
var context = canvas.getContext( '2d' );
28312-
context.drawImage( image, 0, 0 );
28313-
28314-
var data = context.getImageData( 0, 0, width, height ).data;
28315-
var imageData = context.createImageData( width, height );
28316-
var output = imageData.data;
28317-
28318-
for ( var x = 0; x < width; x ++ ) {
28319-
28320-
for ( var y = 0; y < height; y ++ ) {
28321-
28322-
var ly = y - 1 < 0 ? 0 : y - 1;
28323-
var uy = y + 1 > height - 1 ? height - 1 : y + 1;
28324-
var lx = x - 1 < 0 ? 0 : x - 1;
28325-
var ux = x + 1 > width - 1 ? width - 1 : x + 1;
28326-
28327-
var points = [];
28328-
var origin = [ 0, 0, data[ ( y * width + x ) * 4 ] / 255 * depth ];
28329-
points.push( [ - 1, 0, data[ ( y * width + lx ) * 4 ] / 255 * depth ] );
28330-
points.push( [ - 1, - 1, data[ ( ly * width + lx ) * 4 ] / 255 * depth ] );
28331-
points.push( [ 0, - 1, data[ ( ly * width + x ) * 4 ] / 255 * depth ] );
28332-
points.push( [ 1, - 1, data[ ( ly * width + ux ) * 4 ] / 255 * depth ] );
28333-
points.push( [ 1, 0, data[ ( y * width + ux ) * 4 ] / 255 * depth ] );
28334-
points.push( [ 1, 1, data[ ( uy * width + ux ) * 4 ] / 255 * depth ] );
28335-
points.push( [ 0, 1, data[ ( uy * width + x ) * 4 ] / 255 * depth ] );
28336-
points.push( [ - 1, 1, data[ ( uy * width + lx ) * 4 ] / 255 * depth ] );
28337-
28338-
var normals = [];
28339-
var num_points = points.length;
28340-
28341-
for ( var i = 0; i < num_points; i ++ ) {
28342-
28343-
var v1 = points[ i ];
28344-
var v2 = points[ ( i + 1 ) % num_points ];
28345-
v1 = subtract( v1, origin );
28346-
v2 = subtract( v2, origin );
28347-
normals.push( normalize( cross( v1, v2 ) ) );
28348-
28349-
}
28350-
28351-
var normal = [ 0, 0, 0 ];
28352-
28353-
for ( var i = 0; i < normals.length; i ++ ) {
28354-
28355-
normal[ 0 ] += normals[ i ][ 0 ];
28356-
normal[ 1 ] += normals[ i ][ 1 ];
28357-
normal[ 2 ] += normals[ i ][ 2 ];
28358-
28359-
}
28360-
28361-
normal[ 0 ] /= normals.length;
28362-
normal[ 1 ] /= normals.length;
28363-
normal[ 2 ] /= normals.length;
28364-
28365-
var idx = ( y * width + x ) * 4;
28366-
28367-
output[ idx ] = ( ( normal[ 0 ] + 1.0 ) / 2.0 * 255 ) | 0;
28368-
output[ idx + 1 ] = ( ( normal[ 1 ] + 1.0 ) / 2.0 * 255 ) | 0;
28369-
output[ idx + 2 ] = ( normal[ 2 ] * 255 ) | 0;
28370-
output[ idx + 3 ] = 255;
28371-
28372-
}
28373-
28374-
}
28375-
28376-
context.putImageData( imageData, 0, 0 );
28377-
28378-
return canvas;
28379-
28380-
},
28381-
28382-
generateDataTexture: function ( width, height, color ) {
28383-
28384-
var size = width * height;
28385-
var data = new Uint8Array( 3 * size );
28386-
28387-
var r = Math.floor( color.r * 255 );
28388-
var g = Math.floor( color.g * 255 );
28389-
var b = Math.floor( color.b * 255 );
28390-
28391-
for ( var i = 0; i < size; i ++ ) {
28392-
28393-
data[ i * 3 ] = r;
28394-
data[ i * 3 + 1 ] = g;
28395-
data[ i * 3 + 2 ] = b;
28396-
28397-
}
28398-
28399-
var texture = new THREE.DataTexture( data, width, height, THREE.RGBFormat );
28400-
texture.needsUpdate = true;
28401-
28402-
return texture;
28403-
2840428307
}
2840528308

2840628309
};

0 commit comments

Comments
 (0)