Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
a9f33e77
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,发现更多精彩内容 >>
提交
a9f33e77
编写于
8月 19, 2015
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds.
上级
c170af7b
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
158 addition
and
170 deletion
+158
-170
build/three.js
build/three.js
+62
-74
build/three.min.js
build/three.min.js
+95
-95
src/core/DynamicBufferAttribute.js
src/core/DynamicBufferAttribute.js
+1
-1
未找到文件。
build/three.js
浏览文件 @
a9f33e77
...
...
@@ -8938,6 +8938,22 @@ THREE.DynamicBufferAttribute = function ( array, itemSize ) {
THREE.DynamicBufferAttribute.prototype = Object.create( THREE.BufferAttribute.prototype );
THREE.DynamicBufferAttribute.prototype.constructor = THREE.DynamicBufferAttribute;
// File:src/core/IndexBufferAttribute.js
/**
* @author mrdoob / http://mrdoob.com/
*/
THREE.IndexBufferAttribute = function ( array, itemSize ) {
THREE.BufferAttribute.call( this, array, itemSize );
};
THREE.IndexBufferAttribute.prototype = Object.create( THREE.BufferAttribute.prototype );
THREE.IndexBufferAttribute.prototype.constructor = THREE.IndexBufferAttribute;
// File:src/core/InstancedBufferAttribute.js
/**
...
...
@@ -10757,6 +10773,13 @@ THREE.BufferGeometry.prototype = {
}
if ( name === 'index' && attribute instanceof THREE.IndexBufferAttribute === false ) {
console.warn( 'THREE.BufferGeometry.addAttribute: Use THREE.IndexBufferAttribute for index attribute.' );
attribute = new THREE.IndexBufferAttribute( attribute.array, attribute.itemSize );
}
this.attributes[ name ] = attribute;
},
...
...
@@ -11176,8 +11199,9 @@ THREE.BufferGeometry.prototype = {
if ( geometry.indices.length > 0 ) {
var indices = new Uint16Array( geometry.indices.length * 3 );
this.addAttribute( 'index', new THREE.BufferAttribute( indices, 1 ).copyIndicesArray( geometry.indices ) );
var TypeArray = geometry.vertices.length > 65535 ? Uint32Array : Uint16Array;
var indices = new TypeArray( geometry.indices.length * 3 );
this.addAttribute( 'index', new THREE.IndexBufferAttribute( indices, 1 ).copyIndicesArray( geometry.indices ) );
}
...
...
@@ -11717,57 +11741,6 @@ THREE.BufferGeometry.prototype = {
},
/*
reoderBuffers:
Reorder attributes based on a new indexBuffer and indexMap.
indexBuffer - Uint16Array of the new ordered indices.
indexMap - Int32Array where the position is the new vertex ID and the value the old vertex ID for each vertex.
vertexCount - Amount of total vertices considered in this reordering (in case you want to grow the vertex stack).
*/
reorderBuffers: function ( indexBuffer, indexMap, vertexCount ) {
/* Create a copy of all attributes for reordering. */
var sortedAttributes = {};
for ( var attr in this.attributes ) {
if ( attr === 'index' )
continue;
var sourceArray = this.attributes[ attr ].array;
sortedAttributes[ attr ] = new sourceArray.constructor( this.attributes[ attr ].itemSize * vertexCount );
}
/* Move attribute positions based on the new index map */
for ( var new_vid = 0; new_vid < vertexCount; new_vid ++ ) {
var vid = indexMap[ new_vid ];
for ( var attr in this.attributes ) {
if ( attr === 'index' )
continue;
var attrArray = this.attributes[ attr ].array;
var attrSize = this.attributes[ attr ].itemSize;
var sortedAttr = sortedAttributes[ attr ];
for ( var k = 0; k < attrSize; k ++ )
sortedAttr[ new_vid * attrSize + k ] = attrArray[ vid * attrSize + k ];
}
}
/* Carry the new sorted buffers locally */
this.attributes[ 'index' ].array = indexBuffer;
for ( var attr in this.attributes ) {
if ( attr === 'index' )
continue;
this.attributes[ attr ].array = sortedAttributes[ attr ];
this.attributes[ attr ].numItems = this.attributes[ attr ].itemSize * vertexCount;
}
},
toJSON: function () {
var data = {
...
...
@@ -18078,7 +18051,7 @@ THREE.Sprite = ( function () {
var uvs = new Float32Array( [ 0, 0, 1, 0, 1, 1, 0, 1 ] );
var geometry = new THREE.BufferGeometry();
geometry.addAttribute( 'index', new THREE.BufferAttribute( indices, 1 ) );
geometry.addAttribute( 'index', new THREE.
Index
BufferAttribute( indices, 1 ) );
geometry.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
geometry.addAttribute( 'uv', new THREE.BufferAttribute( uvs, 2 ) );
...
...
@@ -23863,7 +23836,7 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
for ( var name in attributes ) {
updateAttribute( attributes[ name ]
, name
);
updateAttribute( attributes[ name ] );
}
...
...
@@ -23877,7 +23850,7 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
for ( var i = 0, l = array.length; i < l; i ++ ) {
updateAttribute( array[ i ]
, i
);
updateAttribute( array[ i ] );
}
...
...
@@ -23887,9 +23860,19 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
}
function updateAttribute( attribute, name ) {
function updateAttribute( attribute ) {
var bufferType;
if ( attribute instanceof THREE.IndexBufferAttribute ) {
bufferType = gl.ELEMENT_ARRAY_BUFFER;
} else {
bufferType = gl.ARRAY_BUFFER;
var bufferType = name === 'index' ? gl.ELEMENT_ARRAY_BUFFER : gl.ARRAY_BUFFER;
}
var data = ( attribute instanceof THREE.InterleavedBufferAttribute ) ? attribute.data : attribute;
...
...
@@ -23969,9 +23952,11 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
function getWireframeAttribute( geometry ) {
if ( geometry._wireframe !== undefined ) {
var property = properties.get( geometry );
return geometry._wireframe;
if ( property.wireframe !== undefined ) {
return property.wireframe;
}
...
...
@@ -24020,11 +24005,11 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
console.timeEnd( 'wireframe' );
var TypeArray = position.count > 65535 ? Uint32Array : Uint16Array;
var attribute = new THREE.BufferAttribute( new TypeArray( indices ), 1 );
var attribute = new THREE.
Index
BufferAttribute( new TypeArray( indices ), 1 );
updateAttribute( attribute
, 'index'
);
updateAttribute( attribute );
geometry._
wireframe = attribute;
property.
wireframe = attribute;
return attribute;
...
...
@@ -24046,7 +24031,6 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
this.getWireframeAttribute = getWireframeAttribute;
this.update = update;
this.updateAttribute = updateAttribute;
this.clear = function () {
...
...
@@ -31333,7 +31317,7 @@ THREE.CircleBufferGeometry = function ( radius, segments, thetaStart, thetaLengt
}
this.addAttribute( 'index', new THREE.BufferAttribute( new Uint16Array( indices ), 1 ) );
this.addAttribute( 'index', new THREE.
Index
BufferAttribute( new Uint16Array( indices ), 1 ) );
this.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );
this.addAttribute( 'normal', new THREE.BufferAttribute( normals, 3 ) );
this.addAttribute( 'uv', new THREE.BufferAttribute( uvs, 2 ) );
...
...
@@ -31494,7 +31478,7 @@ THREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, radialSegme
var uv2 = uvs[ 0 ][ x + 1 ].clone();
var uv3 = new THREE.Vector2( uv2.x, 0 );
this.faces.push( new THREE.Face3( v1, v2, v3, [ n1, n2, n3 ] ) );
this.faces.push( new THREE.Face3( v1, v2, v3, [ n1, n2, n3 ]
, undefined, 1
) );
this.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv3 ] );
}
...
...
@@ -31521,7 +31505,7 @@ THREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, radialSegme
var uv2 = uvs[ heightSegments ][ x ].clone();
var uv3 = new THREE.Vector2( uv2.x, 1 );
this.faces.push( new THREE.Face3( v1, v2, v3, [ n1, n2, n3 ] ) );
this.faces.push( new THREE.Face3( v1, v2, v3, [ n1, n2, n3 ]
, undefined, 2
) );
this.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv3 ] );
}
...
...
@@ -32730,7 +32714,7 @@ THREE.PlaneBufferGeometry = function ( width, height, widthSegments, heightSegme
}
this.addAttribute( 'index', new THREE.BufferAttribute( indices, 1 ) );
this.addAttribute( 'index', new THREE.
Index
BufferAttribute( indices, 1 ) );
this.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
this.addAttribute( 'normal', new THREE.BufferAttribute( normals, 3 ) );
this.addAttribute( 'uv', new THREE.BufferAttribute( uvs, 2 ) );
...
...
@@ -33091,7 +33075,7 @@ THREE.SphereBufferGeometry = function ( radius, widthSegments, heightSegments, p
}
this.addAttribute( 'index', new THREE.BufferAttribute( new Uint16Array( indices ), 1 ) );
this.addAttribute( 'index', new THREE.
Index
BufferAttribute( new Uint16Array( indices ), 1 ) );
this.addAttribute( 'position', positions );
this.addAttribute( 'normal', normals );
this.addAttribute( 'uv', uvs );
...
...
@@ -33765,7 +33749,7 @@ THREE.PolyhedronGeometry = function ( vertices, indices, radius, detail ) {
var v2 = p[ indices[ i + 1 ] ];
var v3 = p[ indices[ i + 2 ] ];
faces[ j ] = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ] );
faces[ j ] = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ]
, undefined, j
);
}
...
...
@@ -33842,9 +33826,9 @@ THREE.PolyhedronGeometry = function ( vertices, indices, radius, detail ) {
// Approximate a curved face with recursively sub-divided triangles.
function make( v1, v2, v3 ) {
function make( v1, v2, v3
, materialIndex
) {
var face = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ] );
var face = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ]
, undefined, materialIndex
);
that.faces.push( face );
centroid.copy( v1 ).add( v2 ).add( v3 ).divideScalar( 3 );
...
...
@@ -33870,6 +33854,8 @@ THREE.PolyhedronGeometry = function ( vertices, indices, radius, detail ) {
var c = prepare( that.vertices[ face.c ] );
var v = [];
var materialIndex = face.materialIndex;
// Construct all of the vertices for this subdivision.
for ( var i = 0 ; i <= cols; i ++ ) {
...
...
@@ -33909,7 +33895,8 @@ THREE.PolyhedronGeometry = function ( vertices, indices, radius, detail ) {
make(
v[ i ][ k + 1 ],
v[ i + 1 ][ k ],
v[ i ][ k ]
v[ i ][ k ],
materialIndex
);
} else {
...
...
@@ -33917,7 +33904,8 @@ THREE.PolyhedronGeometry = function ( vertices, indices, radius, detail ) {
make(
v[ i ][ k + 1 ],
v[ i + 1 ][ k + 1 ],
v[ i + 1 ][ k ]
v[ i + 1 ][ k ],
materialIndex
);
}
...
...
build/three.min.js
浏览文件 @
a9f33e77
此差异已折叠。
点击以展开。
src/core/DynamicBufferAttribute.js
浏览文件 @
a9f33e77
...
...
@@ -12,4 +12,4 @@ THREE.DynamicBufferAttribute = function ( array, itemSize ) {
};
THREE
.
DynamicBufferAttribute
.
prototype
=
Object
.
create
(
THREE
.
BufferAttribute
.
prototype
);
THREE
.
DynamicBufferAttribute
.
prototype
.
constructor
=
THREE
.
DynamicBufferAttribute
;
\ No newline at end of file
THREE
.
DynamicBufferAttribute
.
prototype
.
constructor
=
THREE
.
DynamicBufferAttribute
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录