rhodonite
    Preparing search index...

    Class TextureDataFloat

    A class for handling floating-point texture data with support for multi-channel pixels. This class provides methods to manipulate texture data stored as Float32Array, allowing for high-precision color and data storage in textures.

    Index

    Constructors

    • Creates a new TextureDataFloat instance with the specified dimensions and channel count.

      Parameters

      • width: number

        The width of the texture in pixels

      • height: number

        The height of the texture in pixels

      • channels: number

        The number of channels per pixel (e.g., 3 for RGB, 4 for RGBA)

      Returns TextureDataFloat

    Accessors

    • get data(): Float32Array<ArrayBufferLike>

      Gets the underlying Float32Array containing the texture data.

      Returns Float32Array<ArrayBufferLike>

      The raw texture data as Float32Array

    Methods

    • Gets the value of a specific channel at the given pixel coordinates.

      Parameters

      • x: number

        The x-coordinate of the pixel

      • y: number

        The y-coordinate of the pixel

      • channelIdx: number

        The index of the channel to retrieve (0-based)

      Returns number

      The floating-point value of the specified channel

    • Gets pixel data as a color object (ColorRgb or ColorRgba) at the specified coordinates.

      Parameters

      • x: number

        The x-coordinate of the pixel

      • y: number

        The y-coordinate of the pixel

      • channels: number

        The number of channels to read (3 for RGB, 4 for RGBA)

      • typeClass: typeof ColorRgb | typeof ColorRgba

        The color class constructor (ColorRgb or ColorRgba)

      Returns any

      A new instance of the specified color class containing the pixel data

    • Gets all channel values for a pixel at the specified coordinates as an array.

      Parameters

      • x: number

        The x-coordinate of the pixel

      • y: number

        The y-coordinate of the pixel

      Returns number[]

      An array containing all channel values for the pixel

    • Initializes the texture data with new dimensions and channel count. This method creates a new Float32Array, discarding any existing data.

      Parameters

      • width: number

        The width of the texture in pixels

      • height: number

        The height of the texture in pixels

      • channels: number

        The number of channels per pixel

      Returns void

    • Resizes the texture data to new dimensions and channel count. Existing data is preserved where possible during the resize operation.

      Parameters

      • width: number

        The new width of the texture in pixels

      • height: number

        The new height of the texture in pixels

      • channels: number

        The new number of channels per pixel

      Returns void

    • Sets the value of a specific channel at the given pixel coordinates.

      Parameters

      • x: number

        The x-coordinate of the pixel

      • y: number

        The y-coordinate of the pixel

      • channelIdx: number

        The index of the channel to set (0-based)

      • value: number

        The floating-point value to set for the channel

      Returns void

    • Transfers data from a source ArrayBuffer to a new ArrayBuffer with the specified length. This is a utility method for efficiently copying array buffer data with different word sizes.

      Parameters

      • source: any

        The source ArrayBuffer to copy data from

      • length: number

        The length of the destination ArrayBuffer in bytes

      Returns ArrayBuffer

      A new ArrayBuffer containing the transferred data

      If source or destination is not an ArrayBuffer instance