Class TextureCache


  • public final class TextureCache
    extends java.lang.Object
    Maintains a cache of all loaded texture maps. This is usefull if the same texture might be used more than once in your scene.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.HashMap<java.lang.String,​Texture> textures  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private TextureCache()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void flush()
      Flush all textures from the cache, this will cause them to be reloaded anew the next time they are accessed.
      static Texture getTexture​(java.lang.String filename, boolean isLinear)
      Gets a reference to the texture specified by the given filename.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • textures

        private static java.util.HashMap<java.lang.String,​Texture> textures
    • Constructor Detail

      • TextureCache

        private TextureCache()
    • Method Detail

      • getTexture

        public static Texture getTexture​(java.lang.String filename,
                                         boolean isLinear)
        Gets a reference to the texture specified by the given filename. If the texture has already been loaded the previous reference is returned, otherwise, a new texture is created.
        Parameters:
        filename - image file to load
        isLinear - is the texture gamma corrected?
        Returns:
        texture object
        See Also:
        Texture
      • flush

        public static void flush()
        Flush all textures from the cache, this will cause them to be reloaded anew the next time they are accessed.