* Ensure that MatParam.value and MatParamTexture.texture always match, and throw exception if they dont
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10208 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
fd0c0fc0a1
commit
9eb9463261
@ -62,6 +62,15 @@ public class MatParamTexture extends MatParam {
|
||||
this.value = value;
|
||||
this.texture = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(Object value) {
|
||||
if (!(value instanceof Texture)) {
|
||||
throw new IllegalArgumentException("value must be a texture object");
|
||||
}
|
||||
this.value = value;
|
||||
this.texture = (Texture) value;
|
||||
}
|
||||
|
||||
public void setUnit(int unit) {
|
||||
this.unit = unit;
|
||||
@ -85,6 +94,8 @@ public class MatParamTexture extends MatParam {
|
||||
super.write(ex);
|
||||
OutputCapsule oc = ex.getCapsule(this);
|
||||
oc.write(unit, "texture_unit", -1);
|
||||
|
||||
// For backwards compat
|
||||
oc.write(texture, "texture", null);
|
||||
}
|
||||
|
||||
@ -93,6 +104,7 @@ public class MatParamTexture extends MatParam {
|
||||
super.read(im);
|
||||
InputCapsule ic = im.getCapsule(this);
|
||||
unit = ic.readInt("texture_unit", -1);
|
||||
texture = (Texture) ic.readSavable("texture", null);
|
||||
texture = (Texture) value;
|
||||
//texture = (Texture) ic.readSavable("texture", null);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user