Class TextureArray
java.lang.Object
dev.prozilla.pine.common.asset.image.TextureArray
- All Implemented Interfaces:
TextureBase,Cloneable<TextureArray>,Destructible
public class TextureArray
extends Object
implements Cloneable<TextureArray>, Destructible, TextureBase
Represents a OpenGL Array Texture.
An Array Texture contains multiple images of the same size.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTextureArray(int width, int height) TextureArray(int width, int height, int layers) TextureArray(int width, int height, int layers, Texture.Wrap wrap, Texture.Filter filter) -
Method Summary
Modifier and TypeMethodDescriptionAdds a texture to this texture array in the next available layer.voidbind()Binds this texture.booleanChecks if a given image can be added to this texture array.clone()Returns a new object that is equal to this object.voiddestroy()Removes this texture array from the resource pool and deletes it.booleanequals(TextureArray textureArray) Checks if the given object is equal to this object.booleanintReturns the height of this texture.intgetId()intintintgetWidth()Returns the width of this texture.inthashCode()booleanvoidsetParameter(int name, int value) Sets the value of a parameter of this texture.voidunbind()Unbinds this texture.Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.prozilla.pine.common.asset.image.TextureBase
setFilter, setWrap
-
Field Details
-
DEFAULT_LAYER_COUNT
public static final int DEFAULT_LAYER_COUNT- See Also:
-
-
Constructor Details
-
TextureArray
public TextureArray(int width, int height) -
TextureArray
public TextureArray(int width, int height, int layers) -
TextureArray
-
-
Method Details
-
bind
public void bind()Description copied from interface:TextureBaseBinds this texture.- Specified by:
bindin interfaceTextureBase
-
unbind
public void unbind()Description copied from interface:TextureBaseUnbinds this texture.- Specified by:
unbindin interfaceTextureBase
-
setParameter
public void setParameter(int name, int value) Description copied from interface:TextureBaseSets the value of a parameter of this texture.- Specified by:
setParameterin interfaceTextureBase- Parameters:
name- The name of the parametervalue- The value to assign
-
addLayer
-
addLayer
public TextureArrayLayer addLayer(Image image) throws IllegalStateException, IllegalArgumentException Adds a texture to this texture array in the next available layer.- Throws:
IllegalStateException- If all layers in this texture array are already being used.IllegalArgumentException- If the image has a different width or height than this texture array.
-
getLayer
-
hasImage
-
canAdd
Checks if a given image can be added to this texture array. -
getId
public int getId()- Specified by:
getIdin interfaceTextureBase
-
getWidth
public int getWidth()Description copied from interface:TextureBaseReturns the width of this texture.- Specified by:
getWidthin interfaceTextureBase- Returns:
- The width of this texture, in pixels.
-
getHeight
public int getHeight()Description copied from interface:TextureBaseReturns the height of this texture.- Specified by:
getHeightin interfaceTextureBase- Returns:
- The height of this texture, in pixels.
-
getLayers
-
getUsedLayerCount
public int getUsedLayerCount() -
getLayerCount
public int getLayerCount() -
equals
-
equals
Description copied from interface:CloneableChecks if the given object is equal to this object.- Specified by:
equalsin interfaceCloneable<TextureArray>- Parameters:
textureArray- Other object- Returns:
trueif both objects are equal.
-
hashCode
public int hashCode() -
clone
Description copied from interface:CloneableReturns a new object that is equal to this object.- Specified by:
clonein interfaceCloneable<TextureArray>- Overrides:
clonein classObject- Returns:
- Clone of this object
-
destroy
public void destroy()Removes this texture array from the resource pool and deletes it.- Specified by:
destroyin interfaceDestructible
-