Fixed an issue where the color space of a texture mat param was disregarded when loaded from a j3o.
This commit is contained in:
parent
debd62ee87
commit
54f283e8d2
@ -529,6 +529,21 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
|
||||
checkSetParam(type, name);
|
||||
MatParamTexture val = getTextureParam(name);
|
||||
if (val == null) {
|
||||
checkTextureParamColorSpace(name, value);
|
||||
paramValues.put(name, new MatParamTexture(type, name, value, null));
|
||||
} else {
|
||||
val.setTextureValue(value);
|
||||
}
|
||||
|
||||
if (technique != null) {
|
||||
technique.notifyParamChanged(name, type, value);
|
||||
}
|
||||
|
||||
// need to recompute sort ID
|
||||
sortingId = -1;
|
||||
}
|
||||
|
||||
private void checkTextureParamColorSpace(String name, Texture value) {
|
||||
MatParamTexture paramDef = (MatParamTexture) def.getMaterialParam(name);
|
||||
if (paramDef.getColorSpace() != null && paramDef.getColorSpace() != value.getImage().getColorSpace()) {
|
||||
value.getImage().setColorSpace(paramDef.getColorSpace());
|
||||
@ -547,17 +562,6 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
|
||||
+ "Linear using texture.getImage.setColorSpace().",
|
||||
new Object[]{value.getName(), value.getImage().getColorSpace().name(), name});
|
||||
}
|
||||
paramValues.put(name, new MatParamTexture(type, name, value, null));
|
||||
} else {
|
||||
val.setTextureValue(value);
|
||||
}
|
||||
|
||||
if (technique != null) {
|
||||
technique.notifyParamChanged(name, type, value);
|
||||
}
|
||||
|
||||
// need to recompute sort ID
|
||||
sortingId = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1062,6 +1066,7 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
|
||||
if (texVal.getTextureValue() == null || texVal.getTextureValue().getImage() == null) {
|
||||
continue;
|
||||
}
|
||||
checkTextureParamColorSpace(texVal.getName(), texVal.getTextureValue());
|
||||
}
|
||||
|
||||
if (im.getFormatVersion() == 0 && param.getName().startsWith("m_")) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user