MPO: clear param for null textures

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

@ -788,21 +788,27 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
private void updateShaderMaterialParameters(Renderer renderer, Shader shader, List<MatParamOverride> overrides) {
int unit = 0;
for (MatParamOverride override : overrides) {
VarType type = override.getVarType();
if (overrides != null) {
for (MatParamOverride override : overrides) {
VarType type = override.getVarType();
MatParam paramDef = def.getMaterialParam(override.getName());
if (paramDef == null || paramDef.getVarType() != type || !override.isEnabled()) {
continue;
}
MatParam paramDef = def.getMaterialParam(override.getName());
if (paramDef == null || paramDef.getVarType() != type || !override.isEnabled()) {
continue;
}
Uniform uniform = shader.getUniform(override.getPrefixedName());
if (type.isTextureType()) {
renderer.setTexture(unit, (Texture) override.getValue());
uniform.setValue(VarType.Int, unit);
unit++;
} else {
uniform.setValue(type, override.getValue());
Uniform uniform = shader.getUniform(override.getPrefixedName());
if (override.getValue() != null) {
if (type.isTextureType()) {
renderer.setTexture(unit, (Texture) override.getValue());
uniform.setValue(VarType.Int, unit);
unit++;
} else {
uniform.setValue(type, override.getValue());
}
} else {
uniform.clearValue();
}
}
}

Loading…
Cancel
Save