浏览代码

SphereBufferGeometry: Handle Uint16 limit. Fixes #7288.

Mr.doob 9 年之前
父节点
当前提交
23d6cc56e2
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/extras/geometries/SphereBufferGeometry.js

+ 1 - 1
src/extras/geometries/SphereBufferGeometry.js

@@ -88,7 +88,7 @@ THREE.SphereBufferGeometry = function ( radius, widthSegments, heightSegments, p
 
 	}
 
-	this.setIndex( new THREE.BufferAttribute( new Uint16Array( indices ), 1 ) );
+	this.setIndex( new ( positions.count > 65535 ? THREE.Uint32Attribute : THREE.Uint16Attribute )( indices, 1 ) );
 	this.addAttribute( 'position', positions );
 	this.addAttribute( 'normal', normals );
 	this.addAttribute( 'uv', uvs );