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

import speiger.src.coreengine.rendering.texturesOld.base.ITexture;
import speiger.src.coreengine.rendering.texturesOld.base.TextureManager;

public class UniformTexture extends UniformInt {
	int bank;

	public UniformTexture(String id, int bank) {
		super(id);
		this.bank = bank;
	}

	public void storeTexture(int id) {
		if (id == 0) {
			disable();
			return;
		}
		TextureManager.bindTexture(id, bank);
		if (hasChanged(id)) {
			storeData(id);
		}
	}

	public void storeTexture(ITexture textureID) {
		if (textureID == null) {
			disable();
			return;
		}
		storeTexture(textureID.getTextureId());
	}

	public void disable() {
		TextureManager.unbindTexture();
	}
}
