Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
95184887
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,发现更多精彩内容 >>
提交
95184887
编写于
8月 18, 2015
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds.
上级
08b05d39
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
290 addition
and
290 deletion
+290
-290
build/three.js
build/three.js
+93
-92
build/three.min.js
build/three.min.js
+197
-198
未找到文件。
build/three.js
浏览文件 @
95184887
...
...
@@ -20440,6 +20440,12 @@ THREE.WebGLRenderer = function ( parameters ) {
var index = geometry.attributes.index;
var position = geometry.attributes.position;
if ( material.wireframe === true ) {
index = geometry.attributes.wireframe;
}
var groups = geometry.drawcalls;
var renderer;
...
...
@@ -23672,9 +23678,11 @@ THREE.WebGLGeometries = function ( gl, properties, info ) {
geometry.addEventListener( 'dispose', onGeometryDispose );
var buffergeometry;
if ( geometry instanceof THREE.BufferGeometry ) {
geometries[ geometry.id ]
= geometry;
buffergeometry
= geometry;
} else if ( geometry instanceof THREE.Geometry ) {
...
...
@@ -23684,29 +23692,94 @@ THREE.WebGLGeometries = function ( gl, properties, info ) {
}
geometries[ geometry.id ] = geometry._bufferGeometry;
buffergeometry = geometry._bufferGeometry;
}
if ( object instanceof THREE.Mesh ) {
buffergeometry.addAttribute( 'wireframe', createWireframeIndexBuffer( buffergeometry ) );
}
geometries[ geometry.id ] = buffergeometry;
info.memory.geometries ++;
return
geometries[ geometry.id ]
;
return
buffergeometry
;
};
function
onGeometryDispose( event
) {
function
checkEdge( edges, a, b
) {
var geometry = event.target;
var buffergeometry = geometries[ geometry.id ];
if ( edges[ a + '|' + b ] === true ) return false;
deleteAttributes( buffergeometry.attributes );
edges[ a + '|' + b ] = true;
edges[ b + '|' + a ] = true;
return true;
}
function createWireframeIndexBuffer( geometry ) {
var attributes = geometry.attributes;
var indices = [];
var index = attributes.index;
var position = attributes.position;
console.time( 'wireframe' );
if ( index !== undefined ) {
if ( buffergeometry._wireframe !== undefined ) {
var edges = {};
var array = index.array;
deleteAttributes( buffergeometry._wireframe.attributes );
for ( var i = 0, j = 0, l = array.length; i < l; i += 3 ) {
var a = array[ i + 0 ];
var b = array[ i + 1 ];
var c = array[ i + 2 ];
if ( checkEdge( edges, a, b ) ) indices.push( a, b );
if ( checkEdge( edges, b, c ) ) indices.push( b, c );
if ( checkEdge( edges, c, a ) ) indices.push( c, a );
}
} else {
var array = position.array;
for ( var i = 0, j = 0, l = ( array.length / 3 ) - 1; i < l; i += 3 ) {
var a = i + 0;
var b = i + 1;
var c = i + 2;
indices.push( a, b, b, c, c, a );
}
}
console.timeEnd( 'wireframe' );
var TypeArray = position.array.length > 65535 ? Uint32Array : Uint16Array;
return new THREE.BufferAttribute( new TypeArray( indices ), 1 );
}
function onGeometryDispose( event ) {
var geometry = event.target;
var buffergeometry = geometries[ geometry.id ];
deleteAttributes( buffergeometry.attributes );
geometry.removeEventListener( 'dispose', onGeometryDispose );
delete geometries[ geometry.id ];
...
...
@@ -23847,18 +23920,6 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
var geometry = geometries.get( object );
if ( object.material.wireframe === true ) {
if ( geometry._wireframe === undefined ) {
geometry._wireframe = new THREE.WireframeBufferGeometry( geometry );
}
geometry = geometry._wireframe;
}
if ( object.geometry instanceof THREE.Geometry ) {
geometry.updateFromObject( object );
...
...
@@ -23895,7 +23956,17 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
function updateAttribute( attribute, name ) {
var bufferType = ( name === 'index' ) ? gl.ELEMENT_ARRAY_BUFFER : gl.ARRAY_BUFFER;
var bufferType;
if ( name === 'index' || name === 'wireframe' ) {
bufferType = gl.ELEMENT_ARRAY_BUFFER;
} else {
bufferType = gl.ARRAY_BUFFER;
}
var data = ( attribute instanceof THREE.InterleavedBufferAttribute ) ? attribute.data : attribute;
...
...
@@ -34210,76 +34281,6 @@ THREE.ParametricGeometry = function ( func, slices, stacks ) {
THREE.ParametricGeometry.prototype = Object.create( THREE.Geometry.prototype );
THREE.ParametricGeometry.prototype.constructor = THREE.ParametricGeometry;
// File:src/extras/geometries/WireframeBufferGeometry.js
/**
* @author mrdoob / http://mrdoob.com/
*/
THREE.WireframeBufferGeometry = function ( geometry ) {
THREE.BufferGeometry.call( this );
var attributes = geometry.attributes;
// link attributes
for ( var name in attributes ) {
this.addAttribute( name, attributes[ name ] );
}
this.morphAttributes = geometry.morphAttributes;
// create wireframe indices
var indices = [];
var index = attributes.index;
var position = attributes.position;
if ( index !== undefined ) {
var array = index.array;
for ( var i = 0, j = 0, l = array.length; i < l; i += 3 ) {
var a = array[ i + 0 ];
var b = array[ i + 1 ];
var c = array[ i + 2 ];
// TODO: Check for duplicates
indices.push( a, b, b, c, c, a );
}
} else {
var array = position.array;
for ( var i = 0, j = 0, l = ( array.length / 3 ) - 1; i < l; i += 3 ) {
var a = i + 0;
var b = i + 1;
var c = i + 2;
indices.push( a, b, b, c, c, a );
}
}
var TypeArray = position.array.length > 65535 ? Uint32Array : Uint16Array;
this.addAttribute( 'index', new THREE.BufferAttribute( new TypeArray( indices ), 1 ) );
};
THREE.WireframeBufferGeometry.prototype = Object.create( THREE.BufferGeometry.prototype );
THREE.WireframeBufferGeometry.prototype.constructor = THREE.WireframeBufferGeometry;
// File:src/extras/geometries/WireframeGeometry.js
/**
...
...
build/three.min.js
浏览文件 @
95184887
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录