Class TextureLoader


  • public class TextureLoader
    extends Object
    Class for loading Textures from drive

    Supported Formats (From STB):

    JPEG baseline and progressive (12 bpc/arithmetic not supported, same as stock IJG lib
    PNG 1/2/4/8/16-bit-per-channel
    TGA (not sure what subset, if a subset)
    BMP non-1bpp, non-RLE
    PSD (composited view only, no extra channels, 8/16 bit-per-channel)
    GIF (*desired_channels always reports as 4-channel)
    HDR (radiance rgbE format)
    PIC (Softimage PIC)
    PNM (PPM and PGM binary only)

    Author:
    Darius Dinger
    • Constructor Detail

      • TextureLoader

        public TextureLoader()
    • Method Detail

      • loadTextureFileMeta

        public static TextureData loadTextureFileMeta​(String textureFile,
                                                      boolean mipmap,
                                                      int filtering,
                                                      boolean asResource)
        Load TextureData file and store into TextureData object
        Parameters:
        textureFile - Path to TextureData relative to application
        mipmap - Uses this TextureData mipmapping/anisotropic filtering (if supported)
        filtering - Wich filtering mathod (GL_NEARES, GL_LINEAR, ...)
        asResource - Loading TextureData from resources
        Returns:
        TextureData object
      • loadTextureFile

        public static void loadTextureFile​(String textureFile,
                                           boolean mipmap,
                                           int filtering,
                                           boolean asResource)
        Loading a TextureData file into an opengl texture and storing into asset database
        Parameters:
        textureFile - Path to TextureData relative to application
        mipmap - Uses this TextureData mipmapping/anisotropic filtering (if supported)
        filtering - Wich filtering mathod (GL_NEARES, GL_LINEAR, ...)
        asResource - Loading TextureData from resources
      • loadCubeMap

        public static void loadCubeMap​(String path,
                                       String ext,
                                       boolean asResource)
        Loading cube map texture from abstract path and extension and storing into asset database. The cube map file names will be generated by:
        path + ['_lf', '_rt', '_up', '_dn', '_ft', '_bk'] + '.' + ext
        Parameters:
        path - Abstract path to the cubemap
        ext - Extension of the cube map Textures
        asResource - Loading cube map Textures from resources
      • loadCubeMap

        public static void loadCubeMap​(String key,
                                       String left,
                                       String right,
                                       String top,
                                       String bottom,
                                       String front,
                                       String back,
                                       boolean asResource)
        Loadig cubemap texture from 6 texture files and storing into asset database
        Parameters:
        key - Key in the asset database
        left - Left sube map texture
        right - Right sube map texture
        top - Top sube map texture
        bottom - Bottom sube map texture
        front - Front sube map texture
        back - Back sube map texture
        asResource - Loading cube map Textures from resources