copy method
recursive
-- If set to true
, descendants of the object are copied next to the existing ones.
If set to false
, descendants are left unchanged. Default is true
.
Copies the given object into this object. Note: Event listeners and user-defined callbacks (onAfterRender and onBeforeRender) are not copied.
Implementation
@override
BatchedMesh copy(Object3D source, [bool? recursive]) {
source as BatchedMesh;
super.copy( source );
this.geometry = source.geometry?.clone();
this.perObjectFrustumCulled = source.perObjectFrustumCulled;
this.sortObjects = source.sortObjects;
this.boundingBox = source.boundingBox != null ? source.boundingBox?.clone() : null;
this.boundingSphere = source.boundingSphere != null ? source.boundingSphere?.clone() : null;
this._geometryInfo = source._geometryInfo.sublist(0);
// .map( info => ( {
// ...info,
// boundingBox: info.boundingBox !== null ? info.boundingBox.clone() : null,
// boundingSphere: info.boundingSphere !== null ? info.boundingSphere.clone() : null,
// } ) );
this._instanceInfo = source._instanceInfo.sublist(0);//.map( info => ( { ...info } ) );
this._maxInstanceCount = source._maxInstanceCount;
this._maxVertexCount = source._maxVertexCount;
this._maxIndexCount = source._maxIndexCount;
this._geometryInitialized = source._geometryInitialized;
this._geometryCount = source._geometryCount;
this.multiDrawCounts = source.multiDrawCounts.sublist(0);
this.multiDrawStarts = source.multiDrawStarts.sublist(0);
this.matricesTexture = source.matricesTexture?.clone();
this.matricesTexture?.image.data = this.matricesTexture?.image.data.slice();
if ( this.colorsTexture != null ) {
this.colorsTexture = source.colorsTexture?.clone();
this.colorsTexture?.image.data = this.colorsTexture?.image.data.slice();
}
return this;
}