Merge pull request #416 from MeFisto94/CloneLights
Fixes the bug of shallow copies when cloning lights
This commit is contained in:
commit
947c576ca8
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2009-2012, 2015 jMonkeyEngine
|
* Copyright (c) 2009-2012, 2015-2016 jMonkeyEngine
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2009-2012, 2015 jMonkeyEngine
|
* Copyright (c) 2009-2012, 2015-2016 jMonkeyEngine
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -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();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2009-2012, 2015 jMonkeyEngine
|
* Copyright (c) 2009-2012, 2015-2016 jMonkeyEngine
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2009-2012, 2015 jMonkeyEngine
|
* Copyright (c) 2009-2012, 2015-2016 jMonkeyEngine
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user