Skip to content

⬅️ Back to Table of Contents

📄 TIFFLoader.js

📊 Analysis Summary

Metric Count
🔧 Functions 1
🧱 Classes 1
📦 Imports 4

📚 Table of Contents

🛠️ File Location:

📂 examples/jsm/loaders/TIFFLoader.js

📦 Imports

Name Source
DataTextureLoader three
LinearFilter three
LinearMipmapLinearFilter three
UTIF ../libs/utif.module.js

Functions

TIFFLoader.parse(buffer: ArrayBuffer): DataTextureLoader

JSDoc:

/**
     * Parses the given TIFF texture data.
     *
     * @param {ArrayBuffer} buffer - The raw texture data.
     * @return {DataTextureLoader~TexData} An object representing the parsed texture data.
     */

Parameters:

  • buffer ArrayBuffer

Returns: DataTextureLoader

Calls:

  • UTIF.decode
  • UTIF.decodeImage
  • UTIF.toRGBA8
Code
parse( buffer ) {

        const ifds = UTIF.decode( buffer );
        UTIF.decodeImage( buffer, ifds[ 0 ] );
        const rgba = UTIF.toRGBA8( ifds[ 0 ] );

        return {
            width: ifds[ 0 ].width,
            height: ifds[ 0 ].height,
            data: rgba,
            flipY: true,
            magFilter: LinearFilter,
            minFilter: LinearMipmapLinearFilter
        };

    }

Classes

TIFFLoader

Class Code
class TIFFLoader extends DataTextureLoader {

    /**
     * Constructs a new TIFF loader.
     *
     * @param {LoadingManager} [manager] - The loading manager.
     */
    constructor( manager ) {

        super( manager );

    }

    /**
     * Parses the given TIFF texture data.
     *
     * @param {ArrayBuffer} buffer - The raw texture data.
     * @return {DataTextureLoader~TexData} An object representing the parsed texture data.
     */
    parse( buffer ) {

        const ifds = UTIF.decode( buffer );
        UTIF.decodeImage( buffer, ifds[ 0 ] );
        const rgba = UTIF.toRGBA8( ifds[ 0 ] );

        return {
            width: ifds[ 0 ].width,
            height: ifds[ 0 ].height,
            data: rgba,
            flipY: true,
            magFilter: LinearFilter,
            minFilter: LinearMipmapLinearFilter
        };

    }

}

Methods

parse(buffer: ArrayBuffer): DataTextureLoader
Code
parse( buffer ) {

        const ifds = UTIF.decode( buffer );
        UTIF.decodeImage( buffer, ifds[ 0 ] );
        const rgba = UTIF.toRGBA8( ifds[ 0 ] );

        return {
            width: ifds[ 0 ].width,
            height: ifds[ 0 ].height,
            data: rgba,
            flipY: true,
            magFilter: LinearFilter,
            minFilter: LinearMipmapLinearFilter
        };

    }