Browse Source

Add userData to BufferGeometry

Takahiro 7 years ago
parent
commit
0e489d543b
1 changed files with 7 additions and 0 deletions
  1. 7 0
      src/core/BufferGeometry.js

+ 7 - 0
src/core/BufferGeometry.js

@@ -38,6 +38,8 @@ function BufferGeometry() {
 
 	this.drawRange = { start: 0, count: Infinity };
 
+	this.userData = {};
+
 }
 
 BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), {
@@ -930,6 +932,7 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
 		data.uuid = this.uuid;
 		data.type = this.type;
 		if ( this.name !== '' ) data.name = this.name;
+		if ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;
 
 		if ( this.parameters !== undefined ) {
 
@@ -1123,6 +1126,10 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
 		this.drawRange.start = source.drawRange.start;
 		this.drawRange.count = source.drawRange.count;
 
+		// user data
+
+		this.userData = source.userData;
+
 		return this;
 
 	},