Class Texture
java.lang.Object
dev.prozilla.pine.common.asset.image.Texture
- All Implemented Interfaces:
Asset,TextureAsset,TextureBase,Cloneable<Texture>,Destructible,Printable
Represents an OpenGL texture.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTexture(int width, int height) Creates an empty texture.Texture(int width, int height, Texture.Wrap wrap, Texture.Filter filter) Creates an empty texture.Creates a texture based on an image.Texture(Image image, Texture.Wrap wrap, Texture.Filter filter) Creates a texture based on an image.Texture(String path, int width, int height, ByteBuffer pixels) Texture(String path, int width, int height, ByteBuffer pixels, Texture.Wrap wrap, Texture.Filter filter) -
Method Summary
Modifier and TypeMethodDescriptionvoidbind()Binds this texture.clone()Returns a new object that is equal to this object.voiddestroy()Removes this texture from the resource pool and deletes it.booleanChecks if the given object is equal to this object.booleanequals(TextureAsset other) booleangetArray()intReturns the height of this texture.intgetId()getPath()Returns the path to the file this asset was loaded from.intgetWidth()Returns the width of this texture.booleanhasEqualLocation(TextureAsset other) Checks whether two textures are from the same location.inthashCode()booleanvoidsetParameter(int name, int value) Sets the value of a parameter of this texture.@NotNull StringtoString()Returns a string representation of this object.voidunbind()Unbinds this texture.voiduploadData(int internalFormat, int width, int height, int format, ByteBuffer pixels) Uploads image data with specified internal format, width, height and image format.voiduploadData(int width, int height, ByteBuffer pixels) Uploads image data with specified width and height.Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface dev.prozilla.pine.common.asset.image.TextureBase
setFilter, setWrap
-
Field Details
-
DEFAULT_WRAP
-
DEFAULT_FILTER
-
-
Constructor Details
-
Texture
public Texture(int width, int height) Creates an empty texture. -
Texture
Creates an empty texture. -
Texture
Creates a texture based on an image. -
Texture
Creates a texture based on an image. -
Texture
-
Texture
public Texture(String path, int width, int height, ByteBuffer pixels, Texture.Wrap wrap, Texture.Filter filter)
-
-
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
-
uploadData
Uploads image data with specified width and height.- Parameters:
width- Width of the imageheight- Height of the imagepixels- Pixel data of the image
-
uploadData
Uploads image data with specified internal format, width, height and image format.- Parameters:
internalFormat- Internal format of the image datawidth- Width of the imageheight- Height of the imageformat- Format of the image datapixels- Pixel data of the image
-
destroy
public void destroy()Description copied from interface:TextureAssetRemoves this texture from the resource pool and deletes it.- Specified by:
destroyin interfaceAsset- Specified by:
destroyin interfaceDestructible- Specified by:
destroyin interfaceTextureAsset
-
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.
-
getPath
Description copied from interface:AssetReturns the path to the file this asset was loaded from.- Specified by:
getPathin interfaceAsset- Specified by:
getPathin interfaceTextureAsset- Returns:
- The path of the image file of this texture.
-
hasEqualLocation
Description copied from interface:TextureAssetChecks whether two textures are from the same location.- Specified by:
hasEqualLocationin interfaceTextureAsset- Parameters:
other- Other texture- Returns:
- True if
otheris equal to this texture or in the same texture array.
-
isInArray
public boolean isInArray()- Specified by:
isInArrayin interfaceTextureAsset- Returns:
- True if this texture is part of a texture array.
-
getArray
- Specified by:
getArrayin interfaceTextureAsset- Returns:
- The texture array this texture is part of, or
nullif this texture is not in a texture array.
-
hashCode
public int hashCode() -
equals
Description copied from interface:CloneableChecks if the given object is equal to this object. -
equals
-
equals
-
clone
Description copied from interface:CloneableReturns a new object that is equal to this object. -
toString
Description copied from interface:PrintableReturns a string representation of this object.
-