Interface SourceResolver

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface SourceResolver
Loads shader source text by a /-separated name.
  • Method Details

    • resolve

      String resolve(String name)
      Loads a file.
      Parameters:
      name - the normalized name, with no leading slash
      Returns:
      the text, or null when there is no such file
    • classpath

      static SourceResolver classpath(ClassLoader loader, String root)
      Resolves names as class path resources under a root, through a class loader.
      Parameters:
      loader - the class loader
      root - the resource root, such as "lol/trq/helios/shaders"
      Returns:
      the resolver
    • directory

      static SourceResolver directory(Path root)
      Resolves names as files under a directory, which is what hot reload during development uses.
      Parameters:
      root - the directory
      Returns:
      the resolver
    • or

      default SourceResolver or(SourceResolver next)
      Tries this resolver, then another.
      Parameters:
      next - the fallback
      Returns:
      the combined resolver