Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
ea0054a1
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,发现更多精彩内容 >>
提交
ea0054a1
编写于
2月 14, 2014
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds.
上级
76c66400
变更
2
展开全部
隐藏空白更改
内联
并排
Showing
2 changed file
with
511 addition
and
409 deletion
+511
-409
build/three.js
build/three.js
+115
-16
build/three.min.js
build/three.min.js
+396
-393
未找到文件。
build/three.js
浏览文件 @
ea0054a1
...
...
@@ -6927,7 +6927,6 @@ THREE.EventDispatcher.prototype = {
var material = object.material;
if ( material === undefined ) return intersects;
if ( geometry.dynamic === false ) return intersects;
var a, b, c;
var precision = raycaster.precision;
...
...
@@ -9533,10 +9532,6 @@ THREE.BufferGeometry = function () {
this.attributes = {};
// attributes typed arrays are kept only if dynamic flag is set
this.dynamic = true;
// offsets for chunks when using indexed elements
this.offsets = [];
...
...
@@ -20174,6 +20169,8 @@ THREE.WebGLRenderer = function ( parameters ) {
_precision = parameters.precision !== undefined ? parameters.precision : 'highp',
_buffers = {},
_alpha = parameters.alpha !== undefined ? parameters.alpha : false,
_premultipliedAlpha = parameters.premultipliedAlpha !== undefined ? parameters.premultipliedAlpha : true,
_antialias = parameters.antialias !== undefined ? parameters.antialias : false,
...
...
@@ -20301,7 +20298,7 @@ THREE.WebGLRenderer = function ( parameters ) {
_currentWidth = 0,
_currentHeight = 0,
_enabledAttributes =
{}
,
_enabledAttributes =
new Uint8Array( 16 )
,
// frustum
...
...
@@ -21241,6 +21238,27 @@ THREE.WebGLRenderer = function ( parameters ) {
};
function initGeometry2Buffers( geometry ) {
var buffers = {};
var attributes = [ 'vertices', 'normals', 'uvs' ];
for ( var key in attributes ) {
var array = geometry[ attributes[ key ] ];
var buffer = _gl.createBuffer();
_gl.bindBuffer( _gl.ARRAY_BUFFER, buffer );
_gl.bufferData( _gl.ARRAY_BUFFER, array, _gl.STATIC_DRAW );
buffers[ attributes[ key ] ] = buffer;
}
_buffers[ geometry.id ] = buffers;
};
// Buffer setting
function setParticleBuffers ( geometry, hint, object ) {
...
...
@@ -22579,7 +22597,7 @@ THREE.WebGLRenderer = function ( parameters ) {
}
function setDirectBuffers
( geometry, hint, dispose
) {
function setDirectBuffers
( geometry, hint
) {
var attributes = geometry.attributes;
...
...
@@ -22607,14 +22625,29 @@ THREE.WebGLRenderer = function ( parameters ) {
}
if ( dispose && ! attributeItem.dynamic ) {
}
attributeItem.array = null;
}
}
function setGeometry2Buffers( geometry, hint ) {
if ( geometry.needsUpdate === false ) return;
var attributes = [ 'vertices', 'normals', 'uvs' ];
var buffers = _buffers[ geometry.id ];
for ( var key in attributes ) {
var array = geometry[ attributes[ key ] ];
var buffer = buffers[ attributes[ key ] ];
_gl.bindBuffer( _gl.ARRAY_BUFFER, buffer );
_gl.bufferData( _gl.ARRAY_BUFFER, array, hint );
}
geometry.needsUpdate = false;
};
// Buffer rendering
...
...
@@ -22712,6 +22745,56 @@ THREE.WebGLRenderer = function ( parameters ) {
};
this.renderBufferGeometry2 = function ( camera, lights, fog, material, geometry, object ) {
var program = setProgram( camera, lights, fog, material, object );
var programAttributes = program.attributes;
var attributes = { 'position': 'vertices', 'normal': 'normals', 'uv': 'uvs' };
var itemSizes = { 'position': 3, 'normal': 3, 'uv': 2 };
var buffers = _buffers[ geometry.id ];
disableAttributes();
for ( var name in programAttributes ) {
var attributePointer = programAttributes[ name ];
if ( attributePointer >= 0 ) {
var array = geometry[ attributes[ name ] ];
if ( array !== undefined && array.length > 0 ) {
_gl.bindBuffer( _gl.ARRAY_BUFFER, buffers[ attributes[ name ] ] );
enableAttribute( attributePointer );
_gl.vertexAttribPointer( attributePointer, itemSizes[ name ], _gl.FLOAT, false, 0, 0 );
} else {
if ( itemSizes[ name ] === 3 ) {
_gl.vertexAttrib3fv( attributePointer, [ 0, 0, 0 ] );
} else if ( itemSizes[ name ] === 2 ) {
_gl.vertexAttrib2fv( attributePointer, [ 0, 0 ] );
}
}
}
}
_gl.drawArrays( _gl.TRIANGLES, 0, geometry.vertices.length / 3 );
};
this.renderBufferDirect = function ( camera, lights, fog, material, geometry, object ) {
if ( material.visible === false ) return;
...
...
@@ -23210,10 +23293,10 @@ THREE.WebGLRenderer = function ( parameters ) {
function enableAttribute( attribute ) {
if (
! _enabledAttributes[ attribute ]
) {
if (
_enabledAttributes[ attribute ] === 0
) {
_gl.enableVertexAttribArray( attribute );
_enabledAttributes[ attribute ] =
true
;
_enabledAttributes[ attribute ] =
1
;
}
...
...
@@ -23223,10 +23306,10 @@ THREE.WebGLRenderer = function ( parameters ) {
for ( var attribute in _enabledAttributes ) {
if ( _enabledAttributes[ attribute ] ) {
if ( _enabledAttributes[ attribute ]
=== 1
) {
_gl.disableVertexAttribArray( attribute );
_enabledAttributes[ attribute ] =
false
;
_enabledAttributes[ attribute ] =
0
;
}
...
...
@@ -23626,7 +23709,7 @@ THREE.WebGLRenderer = function ( parameters ) {
};
function renderObjects
( renderList, reverse, materialType, camera, lights, fog, useBlending, overrideMaterial ) {
function renderObjects( renderList, reverse, materialType, camera, lights, fog, useBlending, overrideMaterial ) {
var webglObject, object, buffer, material, start, end, delta;
...
...
@@ -23676,6 +23759,10 @@ THREE.WebGLRenderer = function ( parameters ) {
_this.renderBufferDirect( camera, lights, fog, material, buffer, object );
} else if ( buffer instanceof THREE.Geometry2 ) {
_this.renderBufferGeometry2( camera, lights, fog, material, buffer, object );
} else {
_this.renderBuffer( camera, lights, fog, material, buffer, object );
...
...
@@ -23960,6 +24047,10 @@ THREE.WebGLRenderer = function ( parameters ) {
initDirectBuffers( geometry );
} else if ( geometry instanceof THREE.Geometry2 ) {
initGeometry2Buffers( geometry );
} else if ( object instanceof THREE.Mesh ) {
material = object.material;
...
...
@@ -24034,6 +24125,10 @@ THREE.WebGLRenderer = function ( parameters ) {
addBuffer( scene.__webglObjects, geometry, object );
} else if ( geometry instanceof THREE.Geometry2 ) {
addBuffer( scene.__webglObjects, geometry, object );
} else if ( geometry instanceof THREE.Geometry ) {
for ( g in geometry.geometryGroups ) {
...
...
@@ -24110,7 +24205,11 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( geometry instanceof THREE.BufferGeometry ) {
setDirectBuffers( geometry, _gl.DYNAMIC_DRAW, !geometry.dynamic );
setDirectBuffers( geometry, _gl.DYNAMIC_DRAW );
} else if ( geometry instanceof THREE.Geometry2 ) {
setGeometry2Buffers( geometry, _gl.DYNAMIC_DRAW );
} else if ( object instanceof THREE.Mesh ) {
...
...
build/three.min.js
浏览文件 @
ea0054a1
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录