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 Classes
    Modifier and Type
    Class
    Description
    static interface 
    Pixel format — extensible via interface pattern.
  • Constructor Summary

    Constructors
    Constructor
    Description
    TextureData(int width, int height, int channels, TextureData.PixelFormat format, ByteBuffer pixels, int mipLevels, boolean compressed)
    Creates an instance of a TextureData record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the value of the channels record component.
    boolean
    Returns the value of the compressed record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    Returns the value of the format record component.
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the height record component.
    int
    Returns the value of the mipLevels record component.
    of(int width, int height, TextureData.PixelFormat format, ByteBuffer pixels)
    Creates with explicit format.
    Returns the value of the pixels record component.
    rgba(int width, int height, ByteBuffer pixels)
    Creates standard RGBA8 texture data.
    final String
    Returns a string representation of this record class.
    int
    Returns the value of the width record component.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface Component

    slotType
  • Constructor Details

    • TextureData

      public TextureData(int width, int height, int channels, TextureData.PixelFormat format, ByteBuffer pixels, int mipLevels, boolean compressed)
      Creates an instance of a TextureData record class.
      Parameters:
      width - the value for the width record component
      height - the value for the height record component
      channels - the value for the channels record component
      format - the value for the format record component
      pixels - the value for the pixels record component
      mipLevels - the value for the mipLevels record component
      compressed - the value for the compressed record component
  • Method Details

    • rgba

      public static TextureData rgba(int width, int height, ByteBuffer pixels)
      Creates standard RGBA8 texture data.
    • of

      public static TextureData of(int width, int height, TextureData.PixelFormat format, ByteBuffer pixels)
      Creates with explicit format.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • width

      public int width()
      Returns the value of the width record component.
      Returns:
      the value of the width record component
    • height

      public int height()
      Returns the value of the height record component.
      Returns:
      the value of the height record component
    • channels

      public int channels()
      Returns the value of the channels record component.
      Returns:
      the value of the channels record component
    • format

      public TextureData.PixelFormat format()
      Returns the value of the format record component.
      Returns:
      the value of the format record component
    • pixels

      public ByteBuffer pixels()
      Returns the value of the pixels record component.
      Returns:
      the value of the pixels record component
    • mipLevels

      public int mipLevels()
      Returns the value of the mipLevels record component.
      Returns:
      the value of the mipLevels record component
    • compressed

      public boolean compressed()
      Returns the value of the compressed record component.
      Returns:
      the value of the compressed record component