提交 900094ef 编写于 作者: I Ian Kerr 提交者: Mr.doob

This commit fixes wireframe rendering when groups and drawRange are in use. (#9698)

上级 4669e6f0
......@@ -777,10 +777,12 @@ function WebGLRenderer( parameters ) {
var index = geometry.index;
var position = geometry.attributes.position;
var rangeFactor = 1;
if ( material.wireframe === true ) {
index = objects.getWireframeAttribute( geometry );
rangeFactor = 2;
}
......@@ -811,7 +813,6 @@ function WebGLRenderer( parameters ) {
//
var dataStart = 0;
var dataCount = 0;
if ( index !== null ) {
......@@ -830,8 +831,8 @@ function WebGLRenderer( parameters ) {
var groupStart = group !== null ? group.start : 0;
var groupCount = group !== null ? group.count : Infinity;
var drawStart = Math.max( dataStart, rangeStart, groupStart );
var drawEnd = Math.min( dataStart + dataCount, rangeStart + rangeCount, groupStart + groupCount ) - 1;
var drawStart = Math.max( rangeStart, groupStart ) * rangeFactor;
var drawEnd = ( Math.min( dataCount, rangeStart + rangeCount, groupStart + groupCount ) - 1 ) * rangeFactor;
var drawCount = Math.max( 0, drawEnd - drawStart + 1 );
......
......@@ -157,9 +157,7 @@ function WebGLObjects( gl, properties, info ) {
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 );
indices.push( a, b, b, c, c, a );
}
......@@ -192,34 +190,6 @@ function WebGLObjects( gl, properties, info ) {
}
function checkEdge( edges, a, b ) {
if ( a > b ) {
var tmp = a;
a = b;
b = tmp;
}
var list = edges[ a ];
if ( list === undefined ) {
edges[ a ] = [ b ];
return true;
} else if ( list.indexOf( b ) === -1 ) {
list.push( b );
return true;
}
return false;
}
return {
getAttributeBuffer: getAttributeBuffer,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册