Permalink
Browse files

added indices to fromGeometry

  • Loading branch information...
Bruno Imbrizi Bruno Imbrizi
Bruno Imbrizi authored and Bruno Imbrizi committed Feb 13, 2017
1 parent 747469f commit 3d6040733cf4a8a76444ab78f09ae26189dd8300
Showing with 4 additions and 3 deletions.
  1. +1 −2 src/core/BufferGeometry.js
  2. +3 −1 src/core/DirectGeometry.js
@@ -506,8 +506,7 @@ Object.assign( BufferGeometry.prototype, EventDispatcher.prototype, {
if ( geometry.indices.length > 0 ) {
var TypeArray = arrayMax( geometry.indices ) > 65535 ? Uint32Array : Uint16Array;
- var indices = new TypeArray( geometry.indices.length * 3 );
- this.setIndex( new BufferAttribute( indices, 1 ).copyIndicesArray( geometry.indices ) );
+ this.setIndex( new THREE.BufferAttribute( new TypeArray( geometry.indices ), 1 ) );
}
@@ -141,11 +141,13 @@ Object.assign( DirectGeometry.prototype, {
//
+ this.vertices = vertices.concat();
+
for ( var i = 0; i < faces.length; i ++ ) {
var face = faces[ i ];
- this.vertices.push( vertices[ face.a ], vertices[ face.b ], vertices[ face.c ] );
+ this.indices.push( face.a, face.b, face.c );
var vertexNormals = face.vertexNormals;

0 comments on commit 3d60407

Please sign in to comment.