Record Class TextureData
java.lang.Object
java.lang.Record
dev.engine.core.asset.TextureData
- All Implemented Interfaces:
Component
public record TextureData(int width, int height, int channels, TextureData.PixelFormat format, ByteBuffer pixels, int mipLevels, boolean compressed)
extends Record
implements Component
Raw texture data — pixels + metadata. No GPU resources.
Can be used as a component on entities (for textures assigned to materials)
or standalone for compute shader access.
Supports uncompressed RGBA and GPU-compressed formats (BC, ASTC, ETC).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacePixel format — extensible via interface pattern. -
Constructor Summary
ConstructorsConstructorDescriptionTextureData(int width, int height, int channels, TextureData.PixelFormat format, ByteBuffer pixels, int mipLevels, boolean compressed) Creates an instance of aTextureDatarecord class. -
Method Summary
Modifier and TypeMethodDescriptionintchannels()Returns the value of thechannelsrecord component.booleanReturns the value of thecompressedrecord component.final booleanIndicates whether some other object is "equal to" this one.format()Returns the value of theformatrecord component.final inthashCode()Returns a hash code value for this object.intheight()Returns the value of theheightrecord component.intReturns the value of themipLevelsrecord component.static TextureDataof(int width, int height, TextureData.PixelFormat format, ByteBuffer pixels) Creates with explicit format.pixels()Returns the value of thepixelsrecord component.static TextureDatargba(int width, int height, ByteBuffer pixels) Creates standard RGBA8 texture data.final StringtoString()Returns a string representation of this record class.intwidth()Returns the value of thewidthrecord component.
-
Constructor Details
-
TextureData
public TextureData(int width, int height, int channels, TextureData.PixelFormat format, ByteBuffer pixels, int mipLevels, boolean compressed) Creates an instance of aTextureDatarecord class.- Parameters:
width- the value for thewidthrecord componentheight- the value for theheightrecord componentchannels- the value for thechannelsrecord componentformat- the value for theformatrecord componentpixels- the value for thepixelsrecord componentmipLevels- the value for themipLevelsrecord componentcompressed- the value for thecompressedrecord component
-
-
Method Details
-
rgba
Creates standard RGBA8 texture data. -
of
public static TextureData of(int width, int height, TextureData.PixelFormat format, ByteBuffer pixels) Creates with explicit format. -
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
width
public int width()Returns the value of thewidthrecord component.- Returns:
- the value of the
widthrecord component
-
height
public int height()Returns the value of theheightrecord component.- Returns:
- the value of the
heightrecord component
-
channels
public int channels()Returns the value of thechannelsrecord component.- Returns:
- the value of the
channelsrecord component
-
format
Returns the value of theformatrecord component.- Returns:
- the value of the
formatrecord component
-
pixels
Returns the value of thepixelsrecord component.- Returns:
- the value of the
pixelsrecord component
-
mipLevels
public int mipLevels()Returns the value of themipLevelsrecord component.- Returns:
- the value of the
mipLevelsrecord component
-
compressed
public boolean compressed()Returns the value of thecompressedrecord component.- Returns:
- the value of the
compressedrecord component
-