Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
66f901d7
T
three.js
项目概览
车家大少爷
/
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,发现更多精彩内容 >>
提交
66f901d7
编写于
6月 01, 2013
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds.
上级
21ffef7f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
303 addition
and
305 deletion
+303
-305
build/three.js
build/three.js
+120
-118
build/three.min.js
build/three.min.js
+183
-187
未找到文件。
build/three.js
浏览文件 @
66f901d7
...
...
@@ -9959,9 +9959,9 @@ THREE.Loader.prototype = {
* @author mrdoob / http://mrdoob.com/
*/
THREE.ImageLoader = function (
manager
) {
THREE.ImageLoader = function (
crossOrigin
) {
this.
manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager
;
this.
crossOrigin = crossOrigin
;
};
...
...
@@ -9969,19 +9969,45 @@ THREE.ImageLoader.prototype = {
constructor: THREE.ImageLoader,
load: function ( url,
callback
) {
load: function ( url,
onLoad, onProgress, onError
) {
var
scope = this
;
var
image = document.createElement( 'img' )
;
this.manager.add( url, 'image', function ( image
) {
if ( onLoad !== undefined
) {
i
f ( callback !== undefined
) {
i
mage.addEventListener( 'load', function ( event
) {
callback( image
);
onLoad( this
);
}
}
, false );
} );
}
if ( onProgress !== undefined ) {
image.addEventListener( 'progress', function ( event ) {
onProgress( event );
}, false );
}
if ( onError !== undefined ) {
image.addEventListener( 'error', function ( event ) {
onError( event );
}, false );
}
if ( this.crossOrigin !== undefined ) image.crossOrigin = this.crossOrigin;
image.src = url;
return image;
}
...
...
@@ -10436,70 +10462,39 @@ THREE.JSONLoader.prototype.parse = function ( json, texturePath ) {
* @author mrdoob / http://mrdoob.com/
*/
THREE.LoadingManager = function () {
THREE.LoadingManager = function (
onLoad, onProgress, onError
) {
var scope = this;
var list = [], cache = {};
var loaders = {};
var queue = [];
var cache = {};
var loaded = 0, total = 0;
var crossOrigin = null;
var load = function () {
var loadNext = function () {
var item =
list
[ 0 ];
var item =
queue
[ 0 ];
if ( cache[ item.url ] === undefined ) {
switch ( item.type ) {
case 'image':
var loader = loaders[ item.type ];
var image = document.createElement( 'img' );
if ( loader !== undefined ) {
image.addEventListener( 'load'
, function ( event ) {
loader.load( item.url
, function ( event ) {
if ( item.onLoad !== undefined ) {
if ( item.onLoad !== undefined ) {
item.onLoad( this
);
item.onLoad( event
);
}
cache[ item.url ] = this;
onLoad( item );
}, false );
if ( crossOrigin !== null ) image.crossOrigin = crossOrigin;
image.src = item.url;
break;
default:
var request = new XMLHttpRequest();
request.addEventListener( 'load', function ( event ) {
if ( item.onLoad !== undefined ) {
item.onLoad( event );
}
cache[ item.url ] = event;
onLoad( item );
}
}, false )
;
cache[ item.url ] = event
;
request.open( 'GET', item.url, true );
request.send( null );
onItemLoaded( item );
break
;
} )
;
}
...
...
@@ -10515,25 +10510,25 @@ THREE.LoadingManager = function () {
}
list
.shift();
queue
.shift();
};
var on
Loa
d = function ( item ) {
var on
ItemLoade
d = function ( item ) {
loaded ++;
scope.dispatchEvent( { type: 'load', item: item, loaded: loaded, total: total }
);
onProgress( item, loaded, total
);
if (
list
.length > 0 ) {
if (
queue
.length > 0 ) {
load();
load
Next
();
}
if ( loaded === total ) {
scope.dispatchEvent( { type: 'complete' }
);
onLoad(
);
}
...
...
@@ -10543,7 +10538,7 @@ THREE.LoadingManager = function () {
total ++;
list
.push( {
queue
.push( {
url: url,
type: type,
onLoad: onLoad,
...
...
@@ -10551,38 +10546,25 @@ THREE.LoadingManager = function () {
onError: onError
} );
load();
load
Next
();
};
this.
setCrossOrigin = function ( value
) {
this.
addLoader = function ( type, loader
) {
crossOrigin = value
;
loaders[ type ] = loader
;
};
};
THREE.LoadingManager.prototype = {
constructor: THREE.LoadingManager,
addEventListener: THREE.EventDispatcher.prototype.addEventListener,
hasEventListener: THREE.EventDispatcher.prototype.hasEventListener,
removeEventListener: THREE.EventDispatcher.prototype.removeEventListener,
dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent
};
THREE.DefaultLoadingManager = new THREE.LoadingManager();
/**
* @author mrdoob / http://mrdoob.com/
*/
THREE.GeometryLoader = function (
manager
) {
THREE.GeometryLoader = function (
crossOrigin
) {
this.
manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager
;
this.
crossOrigin = crossOrigin
;
};
...
...
@@ -10590,19 +10572,46 @@ THREE.GeometryLoader.prototype = {
constructor: THREE.GeometryLoader,
load: function ( url,
callback
) {
load: function ( url,
onLoad, onProgress, onError
) {
var scope = this;
this.manager.add( url, 'text', function ( event ) {
var request = new XMLHttpRequest();
if ( callback
!== undefined ) {
if ( onLoad
!== undefined ) {
callback( scope.parse( JSON.parse( event.target.responseText ) ) );
request.addEventListener( 'load', function ( event ) {
}
onLoad( scope.parse( JSON.parse( event.target.responseText ) ) );
} );
}, false );
}
if ( onProgress !== undefined ) {
request.addEventListener( 'progress', function ( event ) {
onProgress( event );
}, false );
}
if ( onError !== undefined ) {
request.addEventListener( 'error', function ( event ) {
onError( event );
}, false );
}
if ( this.crossOrigin !== undefined ) request.crossOrigin = this.crossOrigin;
request.open( 'GET', url, true );
request.send( null );
},
...
...
@@ -12257,9 +12266,9 @@ THREE.SceneLoader.prototype.parse = function ( json, callbackFinished, url ) {
* @author mrdoob / http://mrdoob.com/
*/
THREE.TextureLoader = function () {
THREE.TextureLoader = function (
crossOrigin
) {
this.crossOrigin =
null
;
this.crossOrigin =
crossOrigin
;
};
...
...
@@ -12267,35 +12276,26 @@ THREE.TextureLoader.prototype = {
constructor: THREE.TextureLoader,
addEventListener: THREE.EventDispatcher.prototype.addEventListener,
hasEventListener: THREE.EventDispatcher.prototype.hasEventListener,
removeEventListener: THREE.EventDispatcher.prototype.removeEventListener,
dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent,
load: function ( url ) {
var scope = this;
load: function ( url, onLoad ) {
var
image = new Imag
e();
var
texture = new THREE.Textur
e();
image.addEventListener( 'load', function () {
var loader = new THREE.ImageLoader();
loader.crossOrigin = this.crossOrigin;
loader.load( url, function ( image ) {
var texture = new THREE.Texture( image )
;
texture.image = image
;
texture.needsUpdate = true;
scope.dispatchEvent( { type: 'load', content: texture } );
if ( onLoad !== undefined ) {
}, fals
e );
onLoad( textur
e );
image.addEventListener( 'error', function () {
scope.dispatchEvent( { type: 'error', message: 'Couldn\'t load URL [' + url + ']' } );
}, false );
}
if ( scope.crossOrigin ) image.crossOrigin = scope.crossOrigin
;
} )
;
image.src = url
;
return texture
;
}
...
...
@@ -22303,7 +22303,7 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( dispose && ! attributeItem.dynamic ) {
delete attributeItem.array
;
attributeItem.array = null
;
}
...
...
@@ -22410,13 +22410,13 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( material.visible === false ) return;
var
program, programAttributes, linewidth, primitives, a, attribute, geometryAttributes
;
var
linewidth, a, attribute
;
var attributeItem, attributeName, attributePointer, attributeSize;
program = setProgram( camera, lights, fog, material, object );
var
program = setProgram( camera, lights, fog, material, object );
programAttributes = program.attributes;
geometryAttributes = geometry.attributes;
var
programAttributes = program.attributes;
var
geometryAttributes = geometry.attributes;
var updateBuffers = false,
wireframeBit = material.wireframe ? 1 : 0,
...
...
@@ -22586,11 +22586,13 @@ THREE.WebGLRenderer = function ( parameters ) {
// render lines
var primitives = ( object.type === THREE.LineStrip ) ? _gl.LINE_STRIP : _gl.LINES;
setLineWidth( material.linewidth );
var position = geometryAttributes[ "position" ];
_gl.drawArrays(
_gl.LINE_STRIP
, 0, position.numItems / 3 );
_gl.drawArrays(
primitives
, 0, position.numItems / 3 );
_this.info.render.calls ++;
_this.info.render.points += position.numItems;
...
...
@@ -22605,11 +22607,11 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( material.visible === false ) return;
var
program, attributes, linewidth, primitives
, a, attribute, i, il;
var
linewidth
, a, attribute, i, il;
program = setProgram( camera, lights, fog, material, object );
var
program = setProgram( camera, lights, fog, material, object );
attributes = program.attributes;
var
attributes = program.attributes;
var updateBuffers = false,
wireframeBit = material.wireframe ? 1 : 0,
...
...
@@ -22779,7 +22781,7 @@ THREE.WebGLRenderer = function ( parameters ) {
} else if ( object instanceof THREE.Line ) {
primitives = ( object.type === THREE.LineStrip ) ? _gl.LINE_STRIP : _gl.LINES;
var
primitives = ( object.type === THREE.LineStrip ) ? _gl.LINE_STRIP : _gl.LINES;
setLineWidth( material.linewidth );
...
...
build/three.min.js
浏览文件 @
66f901d7
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录