Browse Source

DirectGeometry: Added indices back.

Mr.doob 10 years ago
parent
commit
a28f4e9b7c
2 changed files with 8 additions and 0 deletions
  1. 7 0
      src/core/BufferGeometry.js
  2. 1 0
      src/core/DirectGeometry.js

+ 7 - 0
src/core/BufferGeometry.js

@@ -297,6 +297,13 @@ THREE.BufferGeometry.prototype = {
 
 	fromDirectGeometry: function ( geometry ) {
 
+		if ( geometry.indices.length > 0 ) {
+
+			var indices = new Uint16Array( geometry.indices.length * 3 );
+			this.addAttribute( 'index', new THREE.BufferAttribute( indices, 1 ).copyIndicesArray( geometry.indices ) );
+
+		}
+
 		if ( geometry.vertices.length > 0 ) {
 
 			var positions = new Float32Array( geometry.vertices.length * 3 );

+ 1 - 0
src/core/DirectGeometry.js

@@ -11,6 +11,7 @@ THREE.DirectGeometry = function () {
 	this.name = '';
 	this.type = 'DirectGeometry';
 
+	this.indices = [];
 	this.vertices = [];
 	this.colors = [];
 	this.normals = [];