* Material.setParam() now calls setTextureParam() instead of messing up internal state if the type is a texture

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10209 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
sha..RD 12 years ago
parent 9eb9463261
commit 84183ad154
  1. 20
      engine/src/core/com/jme3/material/Material.java

@ -459,16 +459,20 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
public void setParam(String name, VarType type, Object value) { public void setParam(String name, VarType type, Object value) {
checkSetParam(type, name); checkSetParam(type, name);
MatParam val = getParam(name); if (type.isTextureType()) {
if (val == null) { setTextureParam(name, type, (Texture)value);
MatParam paramDef = def.getMaterialParam(name);
paramValues.put(name, new MatParam(type, name, value, paramDef.getFixedFuncBinding()));
} else { } else {
val.setValue(value); MatParam val = getParam(name);
} if (val == null) {
MatParam paramDef = def.getMaterialParam(name);
paramValues.put(name, new MatParam(type, name, value, paramDef.getFixedFuncBinding()));
} else {
val.setValue(value);
}
if (technique != null) { if (technique != null) {
technique.notifyParamChanged(name, type, value); technique.notifyParamChanged(name, type, value);
}
} }
} }

Loading…
Cancel
Save