/** * Resets all uniforms that do not have the "set-by-current-material" flag * to their default value (usually all zeroes or false). * When a uniform is modified, that flag is set, to remove the flag, * use {@link #clearUniformsSetByCurrentFlag() }. */ public void resetUniformsNotSetByCurrent() { int size = uniforms.size(); for (int i = 0; i < size; i++) { Uniform u = uniforms.getValue(i); if (!u.isSetByCurrentMaterial()) { u.clearValue(); } } }
private void resetUniformsNotSetByCurrent(Shader shader) { ListMap<String, Uniform> uniforms = shader.getUniformMap(); int size = uniforms.size(); for (int i = 0; i < size; i++) { Uniform u = uniforms.getValue(i); if (!u.isSetByCurrentMaterial()) { if (u.getName().charAt(0) != 'g') { // Don't reset world globals! // The benefits gained from this are very minimal // and cause lots of matrix -> FloatBuffer conversions. u.clearValue(); } } } }
private int applyOverrides(Renderer renderer, Shader shader, SafeArrayList<MatParamOverride> overrides, int unit) { for (MatParamOverride override : overrides.getArray()) { VarType type = override.getVarType(); MatParam paramDef = def.getMaterialParam(override.getName()); if (paramDef == null || paramDef.getVarType() != type || !override.isEnabled()) { continue; } 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(); } } return unit; }
/** * Resets all uniforms that do not have the "set-by-current-material" flag * to their default value (usually all zeroes or false). * When a uniform is modified, that flag is set, to remove the flag, * use {@link #clearUniformsSetByCurrent() }. */ public void resetUniformsNotSetByCurrent() { int size = uniforms.size(); for (int i = 0; i < size; i++) { Uniform u = uniforms.getValue(i); if (!u.isSetByCurrentMaterial()) { u.clearValue(); } } }
private void resetUniformsNotSetByCurrent(Shader shader) { ListMap<String, Uniform> uniforms = shader.getUniformMap(); for (int i = 0; i < uniforms.size(); i++) { Uniform u = uniforms.getValue(i); if (!u.isSetByCurrentMaterial()) { u.clearValue(); } } }
private void resetUniformsNotSetByCurrent(Shader shader) { ListMap<String, Uniform> uniforms = shader.getUniformMap(); int size = uniforms.size(); for (int i = 0; i < size; i++) { Uniform u = uniforms.getValue(i); if (!u.isSetByCurrentMaterial()) { if (u.getName().charAt(0) != 'g') { // Don't reset world globals! // The benefits gained from this are very minimal // and cause lots of matrix -> FloatBuffer conversions. u.clearValue(); } } } }
private int applyOverrides(Renderer renderer, Shader shader, SafeArrayList<MatParamOverride> overrides, int unit) { for (MatParamOverride override : overrides.getArray()) { VarType type = override.getVarType(); MatParam paramDef = def.getMaterialParam(override.getName()); if (paramDef == null || paramDef.getVarType() != type || !override.isEnabled()) { continue; } 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(); } } return unit; }