فهرست منبع

Added copy and clone to Layers

looeee 8 سال پیش
والد
کامیت
2ac5aeea7a
2فایلهای تغییر یافته به همراه16 افزوده شده و 0 حذف شده
  1. 14 0
      src/core/Layers.js
  2. 2 0
      src/core/Object3D.js

+ 14 - 0
src/core/Layers.js

@@ -40,6 +40,20 @@ Layers.prototype = {
 
 		return ( this.mask & layers.mask ) !== 0;
 
+	},
+
+	clone: function ( ) {
+
+		return new Layers().copy( this );
+
+	},
+
+	copy: function ( source ) {
+
+		this.mask = source.mask;
+
+		return this;
+
 	}
 
 };

+ 2 - 0
src/core/Object3D.js

@@ -702,6 +702,8 @@ Object.assign( Object3D.prototype, EventDispatcher.prototype, {
 		this.matrixAutoUpdate = source.matrixAutoUpdate;
 		this.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;
 
+		this.layers.copy( source.layers );
+
 		this.visible = source.visible;
 
 		this.castShadow = source.castShadow;