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

import org.lwjgl.opengl.GL20;

import speiger.src.coreengine.rendering.utils.AllocationTracker;

public class UniformFloat extends Uniform {
	float lastValue = 0F;
	boolean first = true;

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

	public void storeData(float value) {
		if (Float.floatToIntBits(lastValue) != Float.floatToIntBits(value) || first) {
			lastValue = value;
			first = false;
			GL20.glUniform1f(getPosition(), value);
			AllocationTracker.INSTANCE.addGPUBytes(4L);
		}
	}
}
