Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,17 @@ public void read(JmeImporter im) throws IOException {

@Override
public DefaultParticleInfluencer clone() {
// Set up the cloner for the type of cloning we want to do.
Cloner cloner = new Cloner();
DefaultParticleInfluencer clone = cloner.clone(this);
// Perform a shallow construction and manually deep-copy mutable fields.
// This avoids the heavy reflective Cloner allocation and provides a much
// faster clone for this simple type while preserving exact behavior:
// - same field values
// - distinct Vector3f instances for temp and initialVelocity
DefaultParticleInfluencer clone = new DefaultParticleInfluencer();
// Copy primitive
clone.velocityVariation = this.velocityVariation;
// Clone Vector3f fields if present to ensure distinct instances
clone.initialVelocity = (this.initialVelocity == null) ? null : this.initialVelocity.clone();
clone.temp = (this.temp == null) ? null : this.temp.clone();
return clone;
}

Expand Down
Loading