Package com.irurueta.geometry.io
Class Texture
java.lang.Object
com.irurueta.geometry.io.Texture
Contains data related to a texture.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate FileReference to file actually containing the texture image.private final StringPath to file containing texture image in any of the supported formats.private intHeight of texture image expressed in pixels.private final intID assigned to this texture.private booleanIndicates if texture is valid or not.private intWith of texture image expressed in pixels. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetFile()Returns reference to file actually containing the texture image.Returns path to file containing texture image in any of the supported formats.intReturns texture image height expressed in pixels.intgetId()Returns id assigned to this texture.intgetWidth()Returns texture image width expressed in pixels.booleanIndicates if file containing the texture image has already been provided.booleanIndicates if file name has been provided or not.booleanIndicates whether height has been provided (when its value is positive).booleanisValid()Indicates if texture is valid or not.booleanIndicates whether width has been provided (when its value is positive).voidSets file containing the texture image.voidsetHeight(int height) Sets texture image height expressed in pixels.voidsetValid(boolean valid) Specifies whether a texture is valid or not.voidsetWidth(int width) Sets texture image width expressed in pixels.
-
Field Details
-
fileName
Path to file containing texture image in any of the supported formats. -
file
Reference to file actually containing the texture image. -
width
private int widthWith of texture image expressed in pixels. -
height
private int heightHeight of texture image expressed in pixels. -
valid
private boolean validIndicates 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 idID 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
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
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
Returns reference to file actually containing the texture image.- Returns:
- reference to file actually containing the texture image.
-
setFile
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.
-