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

Merge pull request #5628 from m-schuetz/fix_pc_indices

fixed rendering indexed pointclouds
......@@ -2779,8 +2779,52 @@ THREE.WebGLRenderer = function ( parameters ) {
var position = geometry.attributes.position;
// render particles
if ( geometry.attributes.index !== undefined ) {
var indices = geometry.attributes.index;
var type;
var size;
if ( indices.array instanceof Uint16Array ) {
type = _gl.UNSIGNED_SHORT;
size = 2;
} else {
console.error( "unsupported index data type" );
return;
}
_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, indices.buffer );
if ( geometry.offsets.length > 0 ) {
for ( var i = 0; i < geometry.offsets.length; i++ ) {
var offset = geometry.offsets[ i ];
_gl.drawElements( _gl.POINTS, offset.count, type, offset.start * size );
}
} else {
_gl.drawElements( _gl.POINTS, indices.length, type, 0);
}
} else {
_gl.drawArrays( _gl.POINTS, 0, position.array.length / 3 );
}
_gl.drawArrays( _gl.POINTS, 0, position.array.length / 3 );
_this.info.render.calls ++;
_this.info.render.points += position.array.length / 3;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册