Package limn.render3d
Record Class TextureData
java.lang.Object
java.lang.Record
limn.render3d.TextureData
public record TextureData(int width, int height, byte[] rgba8, ColorSpace colorSpace)
extends Record
CPU-side pixels for a 2D texture: tightly packed 8-bit RGBA, row-major from the
top-left, tagged with the
ColorSpace the values are authored in. Upload
once with Graphics3D.uploadTexture(data, sampler) to get a
GpuTexture. Base-color maps are normally ColorSpace.SRGB (the
shader linearizes them); data maps (normal/metallic/roughness, added later) are
ColorSpace.LINEAR.-
Constructor Summary
ConstructorsConstructorDescriptionTextureData(int width, int height, byte[] rgba8, ColorSpace colorSpace) Creates an instance of aTextureDatarecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecolorSpacerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intheight()Returns the value of theheightrecord component.static TextureDatanormalMap(int width, int height, byte[] rgba8) A tangent-space normal map: rgb encodingn × 0.5 + 0.5, taggedColorSpace.LINEARso nothing gamma-decodes it.static TextureDatargba(int width, int height, byte[] rgba8, ColorSpace colorSpace) Convenience for a solid or generated buffer already in RGBA byte order.byte[]rgba8()Returns the value of thergba8record component.final StringtoString()Returns a string representation of this record class.intwidth()Returns the value of thewidthrecord component.
-
Constructor Details
-
TextureData
Creates an instance of aTextureDatarecord class.- Parameters:
width- the value for thewidthrecord componentheight- the value for theheightrecord componentrgba8- the value for thergba8record componentcolorSpace- the value for thecolorSpacerecord component
-
-
Method Details
-
rgba
Convenience for a solid or generated buffer already in RGBA byte order. -
normalMap
A tangent-space normal map: rgb encodingn × 0.5 + 0.5, taggedColorSpace.LINEARso nothing gamma-decodes it. Because the pipeline decodes sRGB in the shader and never uses a GL sRGB internal format, that tag is the only thing separating a data map from a colour map, which is why it is worth a named factory rather than a fourth argument somebody gets wrong. -
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. -
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. -
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 '=='. -
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
-
rgba8
public byte[] rgba8()Returns the value of thergba8record component.- Returns:
- the value of the
rgba8record component
-
colorSpace
Returns the value of thecolorSpacerecord component.- Returns:
- the value of the
colorSpacerecord component
-