Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
c274258f
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,发现更多精彩内容 >>
提交
c274258f
编写于
8月 31, 2014
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds.
上级
90606a27
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
312 addition
and
352 deletion
+312
-352
build/three.js
build/three.js
+74
-113
build/three.min.js
build/three.min.js
+238
-239
未找到文件。
build/three.js
浏览文件 @
c274258f
...
...
@@ -8991,6 +8991,8 @@ THREE.BufferGeometry = function () {
this.type = 'BufferGeometry';
this.attributes = {};
this.attributesKeys = [];
this.drawcalls = [];
this.offsets = this.drawcalls; // backwards compatibility
...
...
@@ -9016,6 +9018,7 @@ THREE.BufferGeometry.prototype = {
}
this.attributes[ name ] = attribute;
this.attributesKeys = Object.keys( this.attributes );
},
...
...
@@ -9221,7 +9224,7 @@ THREE.BufferGeometry.prototype = {
}
var positions = this.attributes
[ 'position' ]
.array;
var positions = this.attributes
.position
.array;
if ( positions ) {
...
...
@@ -9267,7 +9270,7 @@ THREE.BufferGeometry.prototype = {
}
var positions = this.attributes
[ 'position' ]
.array;
var positions = this.attributes
.position
.array;
if ( positions ) {
...
...
@@ -9326,15 +9329,17 @@ THREE.BufferGeometry.prototype = {
if ( attributes.normal === undefined ) {
attributes.normal = new THREE.BufferAttribute( new Float32Array( positions.length ), 3
);
this.addAttribute( 'normal', new THREE.BufferAttribute( new Float32Array( positions.length ), 3 )
);
} else {
// reset existing normals to zero
for ( var i = 0, il = attributes.normal.array.length; i < il; i ++ ) {
var normals = attributes.normal.array;
for ( var i = 0, il = normals.length; i < il; i ++ ) {
attributes.normal.array
[ i ] = 0;
normals
[ i ] = 0;
}
...
...
@@ -9460,37 +9465,30 @@ THREE.BufferGeometry.prototype = {
// based on http://www.terathon.com/code/tangent.html
// (per vertex tangents)
if ( this.attributes
[ 'index' ]
=== undefined ||
this.attributes
[ 'position' ]
=== undefined ||
this.attributes
[ 'normal' ]
=== undefined ||
this.attributes
[ 'uv' ]
=== undefined ) {
if ( this.attributes
.index
=== undefined ||
this.attributes
.position
=== undefined ||
this.attributes
.normal
=== undefined ||
this.attributes
.uv
=== undefined ) {
console.warn( 'Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()' );
return;
}
var indices = this.attributes
[ 'index' ]
.array;
var positions = this.attributes
[ 'position' ]
.array;
var normals = this.attributes
[ 'normal' ]
.array;
var uvs = this.attributes
[ 'uv' ]
.array;
var indices = this.attributes
.index
.array;
var positions = this.attributes
.position
.array;
var normals = this.attributes
.normal
.array;
var uvs = this.attributes
.uv
.array;
var nVertices = positions.length / 3;
if ( this.attributes[ 'tangent' ] === undefined ) {
var nTangentElements = 4 * nVertices;
if ( this.attributes.tangent === undefined ) {
this.attributes[ 'tangent' ] = {
itemSize: 4,
array: new Float32Array( nTangentElements )
};
this.addAttribute( 'tangent', new THREE.BufferAttribute( new Float32Array( 4 * nVertices ), 4 ) );
}
var tangents = this.attributes
[ 'tangent' ]
.array;
var tangents = this.attributes
.tangent
.array;
var tan1 = [], tan2 = [];
...
...
@@ -9669,8 +9667,8 @@ THREE.BufferGeometry.prototype = {
var s = Date.now();
var indices = this.attributes
[ 'index' ]
.array;
var vertices = this.attributes
[ 'position' ]
.array;
var indices = this.attributes
.index
.array;
var vertices = this.attributes
.position
.array;
var verticesCount = ( vertices.length / 3 );
var facesCount = ( indices.length / 3 );
...
...
@@ -9773,7 +9771,7 @@ THREE.BufferGeometry.prototype = {
normalizeNormals: function () {
var normals = this.attributes
[ 'normal' ]
.array;
var normals = this.attributes
.normal
.array;
var x, y, z, n;
...
...
@@ -19914,14 +19912,9 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( geometry.__webglCustomAttributesList !== undefined ) {
var attributes = geometry.__webglCustomAttributesList;
var keys = Object.keys( attributes );
for ( var i = 0; i < keys.length; i ++ ) {
for ( var name in geometry.__webglCustomAttributesList ) {
var name = keys[ i ];
_gl.deleteBuffer( attributes[ name ].buffer );
_gl.deleteBuffer( geometry.__webglCustomAttributesList[ name ].buffer );
}
...
...
@@ -19937,16 +19930,11 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( geometry instanceof THREE.BufferGeometry ) {
var attributes = geometry.attributes;
var keys = Object.keys( attributes );
for ( var i = 0; i < keys.length; i ++ ) {
var name = keys[ i ];
for ( var name in geometry.attributes ) {
if ( attributes[ name ].buffer !== undefined ) {
if (
geometry.
attributes[ name ].buffer !== undefined ) {
_gl.deleteBuffer( attributes[ name ].buffer );
_gl.deleteBuffer(
geometry.
attributes[ name ].buffer );
}
...
...
@@ -20120,11 +20108,8 @@ THREE.WebGLRenderer = function ( parameters ) {
}
var keys = Object.keys( material.attributes );
for ( var i = 0; i < keys.length; i ++ ) {
for ( var name in material.attributes ) {
var name = keys[ i ];
var attribute = material.attributes[ name ];
if ( ! attribute.__webglInitialized || attribute.createUniqueBuffers ) {
...
...
@@ -20267,23 +20252,17 @@ THREE.WebGLRenderer = function ( parameters ) {
}
var keys = Object.keys( material.attributes );
for ( var i = 0; i < keys.length; i ++ ) {
for ( var name in material.attributes ) {
// Do a shallow copy of the attribute object so different geometryGroup chunks use different
// attribute buffers which are correctly indexed in the setMeshBuffers function
var name = keys[ i ];
var originalAttribute = material.attributes[ name ];
var attribute = {};
var keys2 = Object.keys( originalAttribute );
for ( var j = 0; j < keys2.length; j ++ ) {
for ( var property in originalAttribute ) {
var property = keys2[ j ];
attribute[ property ] = originalAttribute[ property ];
}
...
...
@@ -21632,12 +21611,11 @@ THREE.WebGLRenderer = function ( parameters ) {
function setDirectBuffers( geometry ) {
var attributes = geometry.attributes;
var attributesKeys = geometry.attributesKeys;
var keys = Object.keys( attributes );
for ( var i = 0, l = attributesKeys.length; i < l; i ++ ) {
for ( var i = 0; i < keys.length; i ++ ) {
var attributeName = keys[ i ];
var attributeName = attributesKeys[ i ];
var attributeItem = attributes[ attributeName ];
if ( attributeItem.buffer === undefined ) {
...
...
@@ -21761,28 +21739,34 @@ THREE.WebGLRenderer = function ( parameters ) {
};
function setupVertexAttributes( material, programAttributes, geometryAttributes, startIndex ) {
function setupVertexAttributes( material, program, geometry, startIndex ) {
var geometryAttributes = geometry.attributes;
var keys = Object.keys( programAttributes );
var programAttributes = program.attributes;
var programAttributesKeys = program.attributesKeys;
for ( var i = 0
; i < keys.length
; i ++ ) {
for ( var i = 0
, l = programAttributesKeys.length; i < l
; i ++ ) {
var attributeName =
k
eys[ i ];
var attributeName =
programAttributesK
eys[ i ];
var attributeItem = geometryAttributes[ attributeName ];
var attributePointer = programAttributes[ attributeName ];
if ( attributePointer >= 0 ) {
if ( attributeItem ) {
var attributeItem = geometryAttributes[ attributeName ];
if ( attributeItem !== undefined ) {
var attributeSize = attributeItem.itemSize;
_gl.bindBuffer( _gl.ARRAY_BUFFER, attributeItem.buffer );
enableAttribute( attributePointer );
_gl.vertexAttribPointer( attributePointer, attributeSize, _gl.FLOAT, false, 0, startIndex * attributeSize * 4 ); // 4 bytes per Float32
} else if ( material.defaultAttributeValues ) {
} else if ( material.defaultAttributeValues
!== undefined
) {
if ( material.defaultAttributeValues[ attributeName ].length === 2 ) {
...
...
@@ -21811,9 +21795,6 @@ THREE.WebGLRenderer = function ( parameters ) {
var program = setProgram( camera, lights, fog, material, object );
var programAttributes = program.attributes;
var geometryAttributes = geometry.attributes;
var updateBuffers = false,
wireframeBit = material.wireframe ? 1 : 0,
geometryHash = ( geometry.id * 0xffffff ) + ( program.id * 2 ) + wireframeBit;
...
...
@@ -21835,7 +21816,7 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( object instanceof THREE.Mesh ) {
var index = geometry
Attributes[ 'index' ]
;
var index = geometry
.attributes.index
;
if ( index ) {
...
...
@@ -21861,7 +21842,7 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( updateBuffers ) {
setupVertexAttributes( material, program
Attributes, geometryAttributes
, 0 );
setupVertexAttributes( material, program
, geometry
, 0 );
_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, index.buffer );
}
...
...
@@ -21886,7 +21867,7 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( updateBuffers ) {
setupVertexAttributes( material, program
Attributes, geometryAttributes
, startIndex );
setupVertexAttributes( material, program
, geometry
, startIndex );
_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, index.buffer );
}
...
...
@@ -21909,7 +21890,7 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( updateBuffers ) {
setupVertexAttributes( material, program
Attributes, geometryAttributes
, 0 );
setupVertexAttributes( material, program
, geometry
, 0 );
}
...
...
@@ -21931,11 +21912,11 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( updateBuffers ) {
setupVertexAttributes( material, program
Attributes, geometryAttributes
, 0 );
setupVertexAttributes( material, program
, geometry
, 0 );
}
var position = geometry
Attributes[ 'position' ]
;
var position = geometry
.attributes.position
;
// render particles
...
...
@@ -21950,7 +21931,7 @@ THREE.WebGLRenderer = function ( parameters ) {
setLineWidth( material.linewidth );
var index = geometry
Attributes[ 'index' ]
;
var index = geometry
.attributes.index
;
if ( index ) {
...
...
@@ -21976,7 +21957,7 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( updateBuffers ) {
setupVertexAttributes( material, program
Attributes, geometryAttributes
, 0 );
setupVertexAttributes( material, program
, geometry
, 0 );
_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, index.buffer );
}
...
...
@@ -22000,7 +21981,7 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( updateBuffers ) {
setupVertexAttributes( material, program
Attributes, geometryAttributes
, startIndex );
setupVertexAttributes( material, program
, geometry
, startIndex );
_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, index.buffer );
}
...
...
@@ -22022,11 +22003,11 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( updateBuffers ) {
setupVertexAttributes( material, program
Attributes, geometryAttributes
, 0 );
setupVertexAttributes( material, program
, geometry
, 0 );
}
var position = geometry
Attributes[ 'position' ]
;
var position = geometry
.attributes.position
;
_gl.drawArrays( mode, 0, position.array.length / 3 );
...
...
@@ -22122,7 +22103,7 @@ THREE.WebGLRenderer = function ( parameters ) {
enableAttribute( attributes.color );
_gl.vertexAttribPointer( attributes.color, 3, _gl.FLOAT, false, 0, 0 );
} else if ( material.defaultAttributeValues ) {
} else if ( material.defaultAttributeValues
!== undefined
) {
_gl.vertexAttrib3fv( attributes.color, material.defaultAttributeValues.color );
...
...
@@ -22161,7 +22142,7 @@ THREE.WebGLRenderer = function ( parameters ) {
enableAttribute( attributes.uv );
_gl.vertexAttribPointer( attributes.uv, 2, _gl.FLOAT, false, 0, 0 );
} else if ( material.defaultAttributeValues ) {
} else if ( material.defaultAttributeValues
!== undefined
) {
_gl.vertexAttrib2fv( attributes.uv, material.defaultAttributeValues.uv );
...
...
@@ -22178,7 +22159,7 @@ THREE.WebGLRenderer = function ( parameters ) {
enableAttribute( attributes.uv2 );
_gl.vertexAttribPointer( attributes.uv2, 2, _gl.FLOAT, false, 0, 0 );
} else if ( material.defaultAttributeValues ) {
} else if ( material.defaultAttributeValues
!== undefined
) {
_gl.vertexAttrib2fv( attributes.uv2, material.defaultAttributeValues.uv2 );
...
...
@@ -23196,11 +23177,7 @@ THREE.WebGLRenderer = function ( parameters ) {
function areCustomAttributesDirty( material ) {
var keys = Object.keys( material.attributes );
for ( var i = 0; i < keys.length; i ++ ) {
var name = keys[ i ];
for ( var name in material.attributes ) {
if ( material.attributes[ name ].needsUpdate ) return true;
...
...
@@ -23212,11 +23189,7 @@ THREE.WebGLRenderer = function ( parameters ) {
function clearCustomAttributes( material ) {
var keys = Object.keys( material.attributes );
for ( var i = 0; i < keys.length; i ++ ) {
var name = keys[ i ];
for ( var name in material.attributes ) {
material.attributes[ name ].needsUpdate = false;
...
...
@@ -23398,31 +23371,21 @@ THREE.WebGLRenderer = function ( parameters ) {
}
var keys;
if ( material.defines !== undefined ) {
keys = Object.keys( material.defines );
for ( var i = 0; i < keys.length; i ++ ) {
for ( var name in material.defines ) {
var d = keys[ i ];
chunks.push( d );
chunks.push( material.defines[ d ] );
chunks.push( name );
chunks.push( material.defines[ name ] );
}
}
keys = Object.keys( parameters );
for ( var i = 0; i < keys.length; i ++ ) {
for ( var name in parameters ) {
var p = keys[ i ];
chunks.push( p );
chunks.push( parameters[ p ] );
chunks.push( name );
chunks.push( parameters[ name ] );
}
...
...
@@ -23458,7 +23421,7 @@ THREE.WebGLRenderer = function ( parameters ) {
material.program = program;
var attributes =
material.
program.attributes;
var attributes = program.attributes;
if ( material.morphTargets ) {
...
...
@@ -23466,7 +23429,7 @@ THREE.WebGLRenderer = function ( parameters ) {
var id, base = 'morphTarget';
for ( i = 0; i < _this.maxMorphTargets; i ++ ) {
for (
var
i = 0; i < _this.maxMorphTargets; i ++ ) {
id = base + i;
...
...
@@ -23502,11 +23465,8 @@ THREE.WebGLRenderer = function ( parameters ) {
material.uniformsList = [];
keys = Object.keys( material.__webglShader.uniforms );
for ( var i = 0; i < keys.length; i ++ ) {
for ( var u in material.__webglShader.uniforms ) {
var u = keys[ i ];
var location = material.program.uniforms[ u ];
if ( location ) {
...
...
@@ -26105,6 +26065,7 @@ THREE.WebGLProgram = ( function () {
}
this.attributes = cacheAttributeLocations( _gl, program, identifiers );
this.attributesKeys = Object.keys( this.attributes );
//
...
...
build/three.min.js
浏览文件 @
c274258f
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录