Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
5e2afa8a
T
three.js
项目概览
Ablesons
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5e2afa8a
编写于
6月 19, 2018
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds.
上级
8158234f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
1152 addition
and
747 deletion
+1152
-747
build/three.js
build/three.js
+229
-28
build/three.min.js
build/three.min.js
+694
-691
build/three.module.js
build/three.module.js
+229
-28
未找到文件。
build/three.js
浏览文件 @
5e2afa8a
...
...
@@ -3827,9 +3827,31 @@
if ( ! isRootObject && meta.images[ image.uuid ] === undefined ) {
var url;
if ( Array.isArray( image ) ) {
// process array of images e.g. CubeTexture
url = [];
for ( var i = 0, l = image.length; i < l; i ++ ) {
url.push( getDataURL( image[ i ] ) );
}
} else {
// process single image
url = getDataURL( image );
}
meta.images[ image.uuid ] = {
uuid: image.uuid,
url:
getDataURL( image )
url:
url
};
}
...
...
@@ -6646,6 +6668,62 @@
},
copySRGBToLinear: function () {
function SRGBToLinear( c ) {
return ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );
}
return function copySRGBToLinear( color ) {
this.r = SRGBToLinear( color.r );
this.g = SRGBToLinear( color.g );
this.b = SRGBToLinear( color.b );
return this;
};
}(),
copyLinearToSRGB: function () {
function LinearToSRGB( c ) {
return ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055;
}
return function copyLinearToSRGB( color ) {
this.r = LinearToSRGB( color.r );
this.g = LinearToSRGB( color.g );
this.b = LinearToSRGB( color.b );
return this;
};
}(),
convertSRGBToLinear: function () {
this.copySRGBToLinear( this );
return this;
},
convertLinearToSRGB: function () {
this.copyLinearToSRGB( this );
return this;
},
getHex: function () {
return ( this.r * 255 ) << 16 ^ ( this.g * 255 ) << 8 ^ ( this.b * 255 ) << 0;
...
...
@@ -14291,13 +14369,13 @@
}
function checkBufferGeometryIntersection( object, raycaster, ray, position, uv, a, b, c ) {
function checkBufferGeometryIntersection( object,
material,
raycaster, ray, position, uv, a, b, c ) {
vA.fromBufferAttribute( position, a );
vB.fromBufferAttribute( position, b );
vC.fromBufferAttribute( position, c );
var intersection = checkIntersection( object,
object.
material, raycaster, ray, vA, vB, vC, intersectionPoint );
var intersection = checkIntersection( object, material, raycaster, ray, vA, vB, vC, intersectionPoint );
if ( intersection ) {
...
...
@@ -14360,24 +14438,64 @@
var index = geometry.index;
var position = geometry.attributes.position;
var uv = geometry.attributes.uv;
var i, l;
var groups = geometry.groups;
var drawRange = geometry.drawRange;
var i, j, il, jl;
var group, groupMaterial;
var start, end;
if ( index !== null ) {
// indexed buffer geometry
for ( i = 0, l = index.count; i < l; i += 3 ) {
if ( Array.isArray( material ) ) {
for ( i = 0, il = groups.length; i < il; i ++ ) {
group = groups[ i ];
groupMaterial = material[ group.materialIndex ];
start = Math.max( group.start, drawRange.start );
end = Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) );
for ( j = start, jl = end; j < jl; j += 3 ) {
a = index.getX( i );
b = index.getX( i + 1 );
c = index.getX( i + 2 );
intersection = checkBufferGeometryIntersection( this, groupMaterial, raycaster, ray, position, uv, a, b, c );
if ( intersection ) {
intersection.faceIndex = Math.floor( i / 3 ); // triangle number in indexed buffer semantics
intersects.push( intersection );
}
}
}
} else {
start = Math.max( 0, drawRange.start );
end = Math.min( index.count, ( drawRange.start + drawRange.count ) );
a = index.getX( i );
b = index.getX( i + 1 );
c = index.getX( i + 2 );
for ( i = start, il = end; i < il; i += 3 ) {
intersection = checkBufferGeometryIntersection( this, raycaster, ray, position, uv, a, b, c );
a = index.getX( i );
b = index.getX( i + 1 );
c = index.getX( i + 2 );
if ( intersection ) {
intersection = checkBufferGeometryIntersection( this, material, raycaster, ray, position, uv, a, b, c );
intersection.faceIndex = Math.floor( i / 3 ); // triangle number in indexed buffer semantics
intersects.push( intersection );
if ( intersection ) {
intersection.faceIndex = Math.floor( i / 3 ); // triangle number in indexed buffer semantics
intersects.push( intersection );
}
}
...
...
@@ -14387,18 +14505,54 @@
// non-indexed buffer geometry
for ( i = 0, l = position.count; i < l; i += 3
) {
if ( Array.isArray( material )
) {
a = i;
b = i + 1;
c = i + 2;
for ( i = 0, il = groups.length; i < il; i ++ ) {
intersection = checkBufferGeometryIntersection( this, raycaster, ray, position, uv, a, b, c );
group = groups[ i ];
groupMaterial = material[ group.materialIndex ];
if ( intersection ) {
start = Math.max( group.start, drawRange.start );
end = Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) );
intersection.faceIndex = Math.floor( i / 3 ); // triangle number in non-indexed buffer semantics
intersects.push( intersection );
for ( j = start, jl = end; j < jl; j += 3 ) {
a = j;
b = j + 1;
c = j + 2;
intersection = checkBufferGeometryIntersection( this, groupMaterial, raycaster, ray, position, uv, a, b, c );
if ( intersection ) {
intersection.faceIndex = Math.floor( i / 3 ); // triangle number in non-indexed buffer semantics
intersects.push( intersection );
}
}
}
} else {
start = Math.max( 0, drawRange.start );
end = Math.min( position.count, ( drawRange.start + drawRange.count ) );
for ( i = start, il = end; i < il; i += 3 ) {
a = i;
b = i + 1;
c = i + 2;
intersection = checkBufferGeometryIntersection( this, material, raycaster, ray, position, uv, a, b, c );
if ( intersection ) {
intersection.faceIndex = Math.floor( i / 3 ); // triangle number in non-indexed buffer semantics
intersects.push( intersection );
}
}
...
...
@@ -31716,7 +31870,7 @@
Object.assign( ImageLoader.prototype, {
crossOrigin: '
A
nonymous',
crossOrigin: '
a
nonymous',
load: function ( url, onLoad, onProgress, onError ) {
...
...
@@ -31819,7 +31973,7 @@
Object.assign( CubeTextureLoader.prototype, {
crossOrigin: '
A
nonymous',
crossOrigin: '
a
nonymous',
load: function ( urls, onLoad, onProgress, onError ) {
...
...
@@ -31890,7 +32044,7 @@
Object.assign( TextureLoader.prototype, {
crossOrigin: '
A
nonymous',
crossOrigin: '
a
nonymous',
load: function ( url, onLoad, onProgress, onError ) {
...
...
@@ -36410,7 +36564,7 @@
Object.assign( Loader.prototype, {
crossOrigin:
undefined
,
crossOrigin:
'anonymous'
,
onLoadStart: function () {},
...
...
@@ -36753,6 +36907,8 @@
Object.assign( JSONLoader.prototype, {
crossOrigin: 'anonymous',
load: function ( url, onLoad, onProgress, onError ) {
var scope = this;
...
...
@@ -36790,9 +36946,17 @@
},
setCrossOrigin: function ( value ) {
this.crossOrigin = value;
return this;
},
setTexturePath: function ( value ) {
this.texturePath = value;
return this;
},
...
...
@@ -37299,6 +37463,8 @@
Object.assign( ObjectLoader.prototype, {
crossOrigin: 'anonymous',
load: function ( url, onLoad, onProgress, onError ) {
if ( this.texturePath === '' ) {
...
...
@@ -37765,12 +37931,36 @@
var loader = new ImageLoader( manager );
loader.setCrossOrigin( this.crossOrigin );
for ( var i = 0,
l = json.length; i <
l; i ++ ) {
for ( var i = 0,
il = json.length; i < i
l; i ++ ) {
var image = json[ i ];
var path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test( image.url ) ? image.url : scope.texturePath + image.url;
var url = image.url;
if ( Array.isArray( url ) ) {
// load array of images e.g CubeTexture
images[ image.uuid ] = [];
for ( var j = 0, jl = url.length; j < jl; j ++ ) {
var currentUrl = url[ j ];
var path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test( currentUrl ) ? currentUrl : scope.texturePath + currentUrl;
images[ image.uuid ].push( loadImage( path ) );
}
} else {
// load single image
images[ image.uuid ] = loadImage( path );
var path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test( image.url ) ? image.url : scope.texturePath + image.url;
images[ image.uuid ] = loadImage( path );
}
}
...
...
@@ -37812,7 +38002,18 @@
}
var texture = new Texture( images[ data.image ] );
var texture;
if ( Array.isArray( images[ data.image ] ) ) {
texture = new CubeTexture( images[ data.image ] );
} else {
texture = new Texture( images[ data.image ] );
}
texture.needsUpdate = true;
texture.uuid = data.uuid;
build/three.min.js
浏览文件 @
5e2afa8a
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
build/three.module.js
浏览文件 @
5e2afa8a
...
...
@@ -3821,9 +3821,31 @@ Texture.prototype = Object.assign( Object.create( EventDispatcher.prototype ), {
if ( ! isRootObject && meta.images[ image.uuid ] === undefined ) {
var url;
if ( Array.isArray( image ) ) {
// process array of images e.g. CubeTexture
url = [];
for ( var i = 0, l = image.length; i < l; i ++ ) {
url.push( getDataURL( image[ i ] ) );
}
} else {
// process single image
url = getDataURL( image );
}
meta.images[ image.uuid ] = {
uuid: image.uuid,
url:
getDataURL( image )
url:
url
};
}
...
...
@@ -6640,6 +6662,62 @@ Object.assign( Color.prototype, {
},
copySRGBToLinear: function () {
function SRGBToLinear( c ) {
return ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );
}
return function copySRGBToLinear( color ) {
this.r = SRGBToLinear( color.r );
this.g = SRGBToLinear( color.g );
this.b = SRGBToLinear( color.b );
return this;
};
}(),
copyLinearToSRGB: function () {
function LinearToSRGB( c ) {
return ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055;
}
return function copyLinearToSRGB( color ) {
this.r = LinearToSRGB( color.r );
this.g = LinearToSRGB( color.g );
this.b = LinearToSRGB( color.b );
return this;
};
}(),
convertSRGBToLinear: function () {
this.copySRGBToLinear( this );
return this;
},
convertLinearToSRGB: function () {
this.copyLinearToSRGB( this );
return this;
},
getHex: function () {
return ( this.r * 255 ) << 16 ^ ( this.g * 255 ) << 8 ^ ( this.b * 255 ) << 0;
...
...
@@ -14285,13 +14363,13 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), {
}
function checkBufferGeometryIntersection( object, raycaster, ray, position, uv, a, b, c ) {
function checkBufferGeometryIntersection( object,
material,
raycaster, ray, position, uv, a, b, c ) {
vA.fromBufferAttribute( position, a );
vB.fromBufferAttribute( position, b );
vC.fromBufferAttribute( position, c );
var intersection = checkIntersection( object,
object.
material, raycaster, ray, vA, vB, vC, intersectionPoint );
var intersection = checkIntersection( object, material, raycaster, ray, vA, vB, vC, intersectionPoint );
if ( intersection ) {
...
...
@@ -14354,24 +14432,64 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), {
var index = geometry.index;
var position = geometry.attributes.position;
var uv = geometry.attributes.uv;
var i, l;
var groups = geometry.groups;
var drawRange = geometry.drawRange;
var i, j, il, jl;
var group, groupMaterial;
var start, end;
if ( index !== null ) {
// indexed buffer geometry
for ( i = 0, l = index.count; i < l; i += 3 ) {
if ( Array.isArray( material ) ) {
for ( i = 0, il = groups.length; i < il; i ++ ) {
group = groups[ i ];
groupMaterial = material[ group.materialIndex ];
start = Math.max( group.start, drawRange.start );
end = Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) );
for ( j = start, jl = end; j < jl; j += 3 ) {
a = index.getX( i );
b = index.getX( i + 1 );
c = index.getX( i + 2 );
intersection = checkBufferGeometryIntersection( this, groupMaterial, raycaster, ray, position, uv, a, b, c );
if ( intersection ) {
intersection.faceIndex = Math.floor( i / 3 ); // triangle number in indexed buffer semantics
intersects.push( intersection );
}
}
}
} else {
start = Math.max( 0, drawRange.start );
end = Math.min( index.count, ( drawRange.start + drawRange.count ) );
a = index.getX( i );
b = index.getX( i + 1 );
c = index.getX( i + 2 );
for ( i = start, il = end; i < il; i += 3 ) {
intersection = checkBufferGeometryIntersection( this, raycaster, ray, position, uv, a, b, c );
a = index.getX( i );
b = index.getX( i + 1 );
c = index.getX( i + 2 );
if ( intersection ) {
intersection = checkBufferGeometryIntersection( this, material, raycaster, ray, position, uv, a, b, c );
intersection.faceIndex = Math.floor( i / 3 ); // triangle number in indexed buffer semantics
intersects.push( intersection );
if ( intersection ) {
intersection.faceIndex = Math.floor( i / 3 ); // triangle number in indexed buffer semantics
intersects.push( intersection );
}
}
...
...
@@ -14381,18 +14499,54 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), {
// non-indexed buffer geometry
for ( i = 0, l = position.count; i < l; i += 3
) {
if ( Array.isArray( material )
) {
a = i;
b = i + 1;
c = i + 2;
for ( i = 0, il = groups.length; i < il; i ++ ) {
intersection = checkBufferGeometryIntersection( this, raycaster, ray, position, uv, a, b, c );
group = groups[ i ];
groupMaterial = material[ group.materialIndex ];
if ( intersection ) {
start = Math.max( group.start, drawRange.start );
end = Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) );
intersection.faceIndex = Math.floor( i / 3 ); // triangle number in non-indexed buffer semantics
intersects.push( intersection );
for ( j = start, jl = end; j < jl; j += 3 ) {
a = j;
b = j + 1;
c = j + 2;
intersection = checkBufferGeometryIntersection( this, groupMaterial, raycaster, ray, position, uv, a, b, c );
if ( intersection ) {
intersection.faceIndex = Math.floor( i / 3 ); // triangle number in non-indexed buffer semantics
intersects.push( intersection );
}
}
}
} else {
start = Math.max( 0, drawRange.start );
end = Math.min( position.count, ( drawRange.start + drawRange.count ) );
for ( i = start, il = end; i < il; i += 3 ) {
a = i;
b = i + 1;
c = i + 2;
intersection = checkBufferGeometryIntersection( this, material, raycaster, ray, position, uv, a, b, c );
if ( intersection ) {
intersection.faceIndex = Math.floor( i / 3 ); // triangle number in non-indexed buffer semantics
intersects.push( intersection );
}
}
...
...
@@ -31710,7 +31864,7 @@ function ImageLoader( manager ) {
Object.assign( ImageLoader.prototype, {
crossOrigin: '
A
nonymous',
crossOrigin: '
a
nonymous',
load: function ( url, onLoad, onProgress, onError ) {
...
...
@@ -31813,7 +31967,7 @@ function CubeTextureLoader( manager ) {
Object.assign( CubeTextureLoader.prototype, {
crossOrigin: '
A
nonymous',
crossOrigin: '
a
nonymous',
load: function ( urls, onLoad, onProgress, onError ) {
...
...
@@ -31884,7 +32038,7 @@ function TextureLoader( manager ) {
Object.assign( TextureLoader.prototype, {
crossOrigin: '
A
nonymous',
crossOrigin: '
a
nonymous',
load: function ( url, onLoad, onProgress, onError ) {
...
...
@@ -36404,7 +36558,7 @@ Loader.Handlers = {
Object.assign( Loader.prototype, {
crossOrigin:
undefined
,
crossOrigin:
'anonymous'
,
onLoadStart: function () {},
...
...
@@ -36747,6 +36901,8 @@ function JSONLoader( manager ) {
Object.assign( JSONLoader.prototype, {
crossOrigin: 'anonymous',
load: function ( url, onLoad, onProgress, onError ) {
var scope = this;
...
...
@@ -36784,9 +36940,17 @@ Object.assign( JSONLoader.prototype, {
},
setCrossOrigin: function ( value ) {
this.crossOrigin = value;
return this;
},
setTexturePath: function ( value ) {
this.texturePath = value;
return this;
},
...
...
@@ -37293,6 +37457,8 @@ function ObjectLoader( manager ) {
Object.assign( ObjectLoader.prototype, {
crossOrigin: 'anonymous',
load: function ( url, onLoad, onProgress, onError ) {
if ( this.texturePath === '' ) {
...
...
@@ -37759,12 +37925,36 @@ Object.assign( ObjectLoader.prototype, {
var loader = new ImageLoader( manager );
loader.setCrossOrigin( this.crossOrigin );
for ( var i = 0,
l = json.length; i <
l; i ++ ) {
for ( var i = 0,
il = json.length; i < i
l; i ++ ) {
var image = json[ i ];
var path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test( image.url ) ? image.url : scope.texturePath + image.url;
var url = image.url;
if ( Array.isArray( url ) ) {
// load array of images e.g CubeTexture
images[ image.uuid ] = [];
for ( var j = 0, jl = url.length; j < jl; j ++ ) {
var currentUrl = url[ j ];
var path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test( currentUrl ) ? currentUrl : scope.texturePath + currentUrl;
images[ image.uuid ].push( loadImage( path ) );
}
} else {
// load single image
images[ image.uuid ] = loadImage( path );
var path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test( image.url ) ? image.url : scope.texturePath + image.url;
images[ image.uuid ] = loadImage( path );
}
}
...
...
@@ -37806,7 +37996,18 @@ Object.assign( ObjectLoader.prototype, {
}
var texture = new Texture( images[ data.image ] );
var texture;
if ( Array.isArray( images[ data.image ] ) ) {
texture = new CubeTexture( images[ data.image ] );
} else {
texture = new Texture( images[ data.image ] );
}
texture.needsUpdate = true;
texture.uuid = data.uuid;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录