52 lines
966 B
Java
52 lines
966 B
Java
package electrosphere.engine.assetmanager.queue;
|
|
|
|
import java.awt.image.BufferedImage;
|
|
|
|
import electrosphere.renderer.texture.Texture;
|
|
|
|
/**
|
|
* A texture queued to be sent to the gpu
|
|
*/
|
|
public class QueuedTexture implements QueuedAsset {
|
|
|
|
//true if loaded
|
|
boolean hasLoaded = false;
|
|
|
|
//the resulting texture object
|
|
Texture texture = null;
|
|
|
|
//data to be loaded
|
|
BufferedImage data;
|
|
|
|
|
|
/**
|
|
* Creates the queued texture object
|
|
* @param image the image to load to gpu
|
|
*/
|
|
public QueuedTexture(BufferedImage image){
|
|
this.data = image;
|
|
}
|
|
|
|
@Override
|
|
public void load() {
|
|
texture = new Texture(data);
|
|
hasLoaded = true;
|
|
}
|
|
|
|
@Override
|
|
public boolean hasLoaded() {
|
|
return hasLoaded;
|
|
}
|
|
|
|
/**
|
|
* Gets the texture object
|
|
* @return The texture if it has been loaded, otherwise null
|
|
*/
|
|
public Texture getTexture(){
|
|
return texture;
|
|
}
|
|
|
|
|
|
|
|
}
|