Class Texture

java.lang.Object
com.irurueta.geometry.io.Texture

public class Texture extends Object
Contains data related to a texture.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private File
    Reference to file actually containing the texture image.
    private final String
    Path to file containing texture image in any of the supported formats.
    private int
    Height of texture image expressed in pixels.
    private final int
    ID assigned to this texture.
    private boolean
    Indicates if texture is valid or not.
    private int
    With of texture image expressed in pixels.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Texture(int id)
    Constructor.
    Texture(String fileName, int id)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns reference to file actually containing the texture image.
    Returns path to file containing texture image in any of the supported formats.
    int
    Returns texture image height expressed in pixels.
    int
    Returns id assigned to this texture.
    int
    Returns texture image width expressed in pixels.
    boolean
    Indicates if file containing the texture image has already been provided.
    boolean
    Indicates if file name has been provided or not.
    boolean
    Indicates whether height has been provided (when its value is positive).
    boolean
    Indicates if texture is valid or not.
    boolean
    Indicates whether width has been provided (when its value is positive).
    void
    setFile(File file)
    Sets file containing the texture image.
    void
    setHeight(int height)
    Sets texture image height expressed in pixels.
    void
    setValid(boolean valid)
    Specifies whether a texture is valid or not.
    void
    setWidth(int width)
    Sets texture image width expressed in pixels.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • fileName

      private final String fileName
      Path to file containing texture image in any of the supported formats.
    • file

      private File file
      Reference to file actually containing the texture image.
    • width

      private int width
      With of texture image expressed in pixels.
    • height

      private int height
      Height of texture image expressed in pixels.
    • valid

      private boolean valid
      Indicates if texture is valid or not. A texture will be considered to be invalid when its image cannot be loaded because the file cannot be found, it is corrupted or its format is not supported.
    • id

      private final int id
      ID assigned to this texture. ID must be unique so that texture can be uniquely identified.
  • Constructor Details

    • Texture

      public Texture(int id)
      Constructor.
      Parameters:
      id - id to be set for this texture.
    • Texture

      public Texture(String fileName, int id)
      Constructor.
      Parameters:
      fileName - path to file containing texture image in any of the supported formats.
      id - id to be set for this texture.
  • Method Details

    • getFileName

      public String getFileName()
      Returns path to file containing texture image in any of the supported formats.
      Returns:
      path to file containing texture image in any of the supported formats.
    • isFileNameAvailable

      public boolean isFileNameAvailable()
      Indicates if file name has been provided or not.
      Returns:
      true if file names has been provided, false otherwise.
    • getId

      public int getId()
      Returns id assigned to this texture. ID must be unique so that texture can be uniquely identified.
      Returns:
      id assigned to this texture.
    • getFile

      public File getFile()
      Returns reference to file actually containing the texture image.
      Returns:
      reference to file actually containing the texture image.
    • setFile

      public void setFile(File file)
      Sets file containing the texture image.
      Parameters:
      file - file containing the texture image.
    • isFileAvailable

      public boolean isFileAvailable()
      Indicates if file containing the texture image has already been provided.
      Returns:
      true if file containing the texture image is available, false otherwise.
    • getWidth

      public int getWidth()
      Returns texture image width expressed in pixels.
      Returns:
      texture image width expressed in pixels.
    • setWidth

      public void setWidth(int width)
      Sets texture image width expressed in pixels.
      Parameters:
      width - texture image width to be set and expressed in pixels.
    • isWidthAvailable

      public boolean isWidthAvailable()
      Indicates whether width has been provided (when its value is positive).
      Returns:
      true if width is available, false otherwise.
    • getHeight

      public int getHeight()
      Returns texture image height expressed in pixels.
      Returns:
      texture image height expressed in pixels.
    • setHeight

      public void setHeight(int height)
      Sets texture image height expressed in pixels.
      Parameters:
      height - texture image height to be set and expressed in pixels.
    • isHeightAvailable

      public boolean isHeightAvailable()
      Indicates whether height has been provided (when its value is positive).
      Returns:
      true if height is available, false otherwise.
    • isValid

      public boolean isValid()
      Indicates if texture is valid or not. A texture will be considered to be invalid when its image cannot be loaded because the file cannot be found, it is corrupted or its format is not supported.
      Returns:
      true if texture is valid, false otherwise.
    • setValid

      public void setValid(boolean valid)
      Specifies whether a texture is valid or not. A texture will be considered to be invalid when its image cannot be loaded because the file cannot be found, it is corrupted or its format is not supported.
      Parameters:
      valid - whether texture is to be set as valid or not.