|
|
@ -788,21 +788,27 @@ 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; |
|
|
|
|
|
|
|
|
|
|
|
for (MatParamOverride override : overrides) { |
|
|
|
if (overrides != null) { |
|
|
|
VarType type = override.getVarType(); |
|
|
|
for (MatParamOverride override : overrides) { |
|
|
|
|
|
|
|
VarType type = override.getVarType(); |
|
|
|
|
|
|
|
|
|
|
|
MatParam paramDef = def.getMaterialParam(override.getName()); |
|
|
|
MatParam paramDef = def.getMaterialParam(override.getName()); |
|
|
|
if (paramDef == null || paramDef.getVarType() != type || !override.isEnabled()) { |
|
|
|
if (paramDef == null || paramDef.getVarType() != type || !override.isEnabled()) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Uniform uniform = shader.getUniform(override.getPrefixedName()); |
|
|
|
Uniform uniform = shader.getUniform(override.getPrefixedName()); |
|
|
|
if (type.isTextureType()) { |
|
|
|
if (override.getValue() != null) { |
|
|
|
renderer.setTexture(unit, (Texture) override.getValue()); |
|
|
|
if (type.isTextureType()) { |
|
|
|
uniform.setValue(VarType.Int, unit); |
|
|
|
renderer.setTexture(unit, (Texture) override.getValue()); |
|
|
|
unit++; |
|
|
|
uniform.setValue(VarType.Int, unit); |
|
|
|
} else { |
|
|
|
unit++; |
|
|
|
uniform.setValue(type, override.getValue()); |
|
|
|
} else { |
|
|
|
|
|
|
|
uniform.setValue(type, override.getValue()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
uniform.clearValue(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|