Permalink
Browse files

Fixes the bug of shallow copies when cloning lights (See http://hub.j…

  • Loading branch information...
1 parent d1a0953 commit 6c4e8010f252a2fb59b63b05dbd2b636255ffd34 @MeFisto94 MeFisto94 committed Feb 17, 2016
@@ -146,4 +146,10 @@ public void read(JmeImporter im) throws IOException {
direction = (Vector3f) ic.readSavable("direction", null);
}
+ @Override
+ public DirectionalLight clone() {
+ DirectionalLight l = (DirectionalLight)super.clone();
+ l.direction = direction.clone();
+ return l;
+ }
}
@@ -228,7 +228,9 @@ public void setEnabled(boolean enabled) {
@Override
public Light clone(){
try {
- return (Light) super.clone();
+ Light l = (Light) super.clone();
+ l.color = color.clone();
+ return l;
} catch (CloneNotSupportedException ex) {
throw new AssertionError();
}
@@ -241,4 +241,11 @@ public void read(JmeImporter im) throws IOException {
this.invRadius = 0;
}
}
+
+ @Override
+ public PointLight clone() {
+ PointLight p = (PointLight)super.clone();
+ p.position = position.clone();
+ return p;
+ }
}
@@ -448,5 +448,13 @@ public void read(JmeImporter im) throws IOException {
this.invSpotRange = 0;
}
}
+
+ @Override
+ public SpotLight clone() {
+ SpotLight s = (SpotLight)super.clone();
+ s.direction = direction.clone();
+ s.position = position.clone();
+ return s;
+ }
}

0 comments on commit 6c4e801

Please sign in to comment.