45 lines
735 B
Java
45 lines
735 B
Java
package speiger.src.coreengine.rendering.shader.uniforms;
|
|
|
|
import speiger.src.coreengine.rendering.textures.base.ITexture;
|
|
import speiger.src.coreengine.rendering.textures.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();
|
|
}
|
|
}
|