Explorar el Código

BufferGeometry.toJSON(): Support primitives. Fixes #6391.

Mr.doob hace 10 años
padre
commit
8553c01e87
Se han modificado 1 ficheros con 16 adiciones y 2 borrados
  1. 16 2
      src/core/BufferGeometry.js

+ 16 - 2
src/core/BufferGeometry.js

@@ -1090,8 +1090,22 @@ THREE.BufferGeometry.prototype = {
 		data.type = this.type;
 		data.uuid = this.uuid;
 		if ( this.name !== '' ) data.name = this.name;
-		data.data = {};
-		data.data.attributes = {};
+
+		if ( this.parameters !== undefined ) {
+
+			var parameters = this.parameters;
+
+			for ( var key in parameters ) {
+
+				if ( parameters[ key ] !== undefined ) data[ key ] = parameters[ key ];
+
+			}
+
+			return data;
+
+		}
+
+		data.data = { attributes: {} };
 
 		var attributes = this.attributes;
 		var offsets = this.offsets;