This commit is contained in:
MeFisto94 2016-02-17 23:45:27 +01:00
parent d1a09536e5
commit 6c4e8010f2
4 changed files with 24 additions and 1 deletions

View File

@ -146,4 +146,10 @@ public class DirectionalLight extends Light {
direction = (Vector3f) ic.readSavable("direction", null); direction = (Vector3f) ic.readSavable("direction", null);
} }
@Override
public DirectionalLight clone() {
DirectionalLight l = (DirectionalLight)super.clone();
l.direction = direction.clone();
return l;
}
} }

View File

@ -228,7 +228,9 @@ public abstract class Light implements Savable, Cloneable {
@Override @Override
public Light clone(){ public Light clone(){
try { try {
return (Light) super.clone(); Light l = (Light) super.clone();
l.color = color.clone();
return l;
} catch (CloneNotSupportedException ex) { } catch (CloneNotSupportedException ex) {
throw new AssertionError(); throw new AssertionError();
} }

View File

@ -241,4 +241,11 @@ public class PointLight extends Light {
this.invRadius = 0; this.invRadius = 0;
} }
} }
@Override
public PointLight clone() {
PointLight p = (PointLight)super.clone();
p.position = position.clone();
return p;
}
} }

View File

@ -448,5 +448,13 @@ public class SpotLight extends Light {
this.invSpotRange = 0; this.invSpotRange = 0;
} }
} }
@Override
public SpotLight clone() {
SpotLight s = (SpotLight)super.clone();
s.direction = direction.clone();
s.position = position.clone();
return s;
}
} }