package speiger.src.coreengine.rendering.shaderOld.uniforms;

import java.util.Objects;

public abstract class UniformBase<T extends Object> extends Uniform {
	T lastValue;
	boolean first = true;

	public UniformBase(String id) {
		super(id);
	}

	protected boolean hasChanged(T value) {
		if (first || !Objects.equals(lastValue, value)) {
			first = false;
			lastValue = setValue(lastValue, value);
			return true;
		}
		return false;
	}

	protected T setValue(T oldValue, T newValue) {
		return newValue;
	}
}
