MPO: clear param for null textures

experimental^2^2
Kirill Vainer 9 years ago
parent 06b817e116
commit 5588e859cb
  1. 6
      jme3-core/src/main/java/com/jme3/material/Material.java

@ -788,6 +788,7 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
private void updateShaderMaterialParameters(Renderer renderer, Shader shader, List<MatParamOverride> overrides) { private void updateShaderMaterialParameters(Renderer renderer, Shader shader, List<MatParamOverride> overrides) {
int unit = 0; int unit = 0;
if (overrides != null) {
for (MatParamOverride override : overrides) { for (MatParamOverride override : overrides) {
VarType type = override.getVarType(); VarType type = override.getVarType();
@ -797,6 +798,7 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
} }
Uniform uniform = shader.getUniform(override.getPrefixedName()); Uniform uniform = shader.getUniform(override.getPrefixedName());
if (override.getValue() != null) {
if (type.isTextureType()) { if (type.isTextureType()) {
renderer.setTexture(unit, (Texture) override.getValue()); renderer.setTexture(unit, (Texture) override.getValue());
uniform.setValue(VarType.Int, unit); uniform.setValue(VarType.Int, unit);
@ -804,6 +806,10 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
} else { } else {
uniform.setValue(type, override.getValue()); uniform.setValue(type, override.getValue());
} }
} else {
uniform.clearValue();
}
}
} }
for (int i = 0; i < paramValues.size(); i++) { for (int i = 0; i < paramValues.size(); i++) {

Loading…
Cancel
Save