提交 eda6cd1e 编写于 作者: M Mr.doob

Geometry.fromBufferGeometry(): Support drawcalls/offsets. See #5864.

上级 7c2d4e2e
......@@ -764,7 +764,8 @@ THREE.BufferGeometry.prototype = {
/* Move all attribute values to map to the new computed indices , also expand the vertice stack to match our new vertexPtr. */
this.reorderBuffers( sortedIndices, revVertexMap, vertexPtr );
this.offsets = offsets;
this.offsets = offsets; // TODO: Deprecate
this.drawcalls = offsets;
/*
var orderTime = Date.now();
......
......@@ -154,9 +154,33 @@ THREE.Geometry.prototype = {
if ( indices !== undefined ) {
for ( var i = 0; i < indices.length; i += 3 ) {
var drawcalls = geometry.drawcalls;
addFace( indices[ i ], indices[ i + 1 ], indices[ i + 2 ] );
if ( drawcalls.length > 0 ) {
for ( var i = 0; i < drawcalls.length; i ++ ) {
var drawcall = drawcalls[ i ];
var start = drawcall.start;
var count = drawcall.count;
var index = drawcall.index;
for ( var j = start, jl = start + count; j < jl; j += 3 ) {
addFace( index + indices[ j ], index + indices[ j + 1 ], index + indices[ j + 2 ] );
}
}
} else {
for ( var i = 0; i < indices.length; i += 3 ) {
addFace( indices[ i ], indices[ i + 1 ], indices[ i + 2 ] );
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册