Class Texture

java.lang.Object
dev.prozilla.pine.common.asset.image.Texture
All Implemented Interfaces:
Asset, TextureAsset, TextureBase, Cloneable<Texture>, Destructible, Printable

public class Texture extends Object implements TextureAsset, Printable, Cloneable<Texture>
Represents an OpenGL texture.
  • Field Details

  • Constructor Details

  • Method Details

    • bind

      public void bind()
      Description copied from interface: TextureBase
      Binds this texture.
      Specified by:
      bind in interface TextureBase
    • unbind

      public void unbind()
      Description copied from interface: TextureBase
      Unbinds this texture.
      Specified by:
      unbind in interface TextureBase
    • setParameter

      public void setParameter(int name, int value)
      Description copied from interface: TextureBase
      Sets the value of a parameter of this texture.
      Specified by:
      setParameter in interface TextureBase
      Parameters:
      name - The name of the parameter
      value - The value to assign
    • uploadData

      public void uploadData(int width, int height, ByteBuffer pixels)
      Uploads image data with specified width and height.
      Parameters:
      width - Width of the image
      height - Height of the image
      pixels - Pixel data of the image
    • uploadData

      public void uploadData(int internalFormat, int width, int height, int format, ByteBuffer pixels)
      Uploads image data with specified internal format, width, height and image format.
      Parameters:
      internalFormat - Internal format of the image data
      width - Width of the image
      height - Height of the image
      format - Format of the image data
      pixels - Pixel data of the image
    • destroy

      public void destroy()
      Description copied from interface: TextureAsset
      Removes this texture from the resource pool and deletes it.
      Specified by:
      destroy in interface Asset
      Specified by:
      destroy in interface Destructible
      Specified by:
      destroy in interface TextureAsset
    • getId

      public int getId()
      Specified by:
      getId in interface TextureBase
    • getWidth

      public int getWidth()
      Description copied from interface: TextureBase
      Returns the width of this texture.
      Specified by:
      getWidth in interface TextureBase
      Returns:
      The width of this texture, in pixels.
    • getHeight

      public int getHeight()
      Description copied from interface: TextureBase
      Returns the height of this texture.
      Specified by:
      getHeight in interface TextureBase
      Returns:
      The height of this texture, in pixels.
    • getPath

      public String getPath()
      Description copied from interface: Asset
      Returns the path to the file this asset was loaded from.
      Specified by:
      getPath in interface Asset
      Specified by:
      getPath in interface TextureAsset
      Returns:
      The path of the image file of this texture.
    • hasEqualLocation

      public boolean hasEqualLocation(TextureAsset other)
      Description copied from interface: TextureAsset
      Checks whether two textures are from the same location.
      Specified by:
      hasEqualLocation in interface TextureAsset
      Parameters:
      other - Other texture
      Returns:
      True if other is equal to this texture or in the same texture array.
    • isInArray

      public boolean isInArray()
      Specified by:
      isInArray in interface TextureAsset
      Returns:
      True if this texture is part of a texture array.
    • getArray

      public TextureArray getArray()
      Specified by:
      getArray in interface TextureAsset
      Returns:
      The texture array this texture is part of, or null if this texture is not in a texture array.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Texture texture)
      Description copied from interface: Cloneable
      Checks if the given object is equal to this object.
      Specified by:
      equals in interface Cloneable<Texture>
      Parameters:
      texture - Other object
      Returns:
      true if both objects are equal.
    • equals

      public boolean equals(TextureAsset other)
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • clone

      public Texture clone()
      Description copied from interface: Cloneable
      Returns a new object that is equal to this object.
      Specified by:
      clone in interface Cloneable<Texture>
      Overrides:
      clone in class Object
      Returns:
      Clone of this object
    • toString

      @NotNull public @NotNull String toString()
      Description copied from interface: Printable
      Returns a string representation of this object.
      Specified by:
      toString in interface Printable
      Overrides:
      toString in class Object
      Returns:
      String representation of this object.