com.threerings.opengl.util
Class ShaderCache

java.lang.Object
  extended by com.threerings.opengl.util.ResourceCache
      extended by com.threerings.opengl.util.ShaderCache

public class ShaderCache
extends ResourceCache

Caches loaded shaders and shader programs.


Constructor Summary
ShaderCache(GlContext ctx, boolean checkTimestamps)
          Creates a new shader cache.
 
Method Summary
 Program getProgram(Shader vertex, Shader fragment)
          Returns an instance of a program with the supplied vertex and fragment shaders.
 Shader getShader(String path, String... defs)
          Loads and returns the shader at the specified path with the supplied preprocessor definitions.
 Shader getShader(String path, String[] defs, String[] ddefs)
          Loads and returns the shader at the specified path with the supplied preprocessor definitions as well as a set of derived definitions (not used to find the shader, but included if the shader is compiled).
 String getSource(String path)
          Retrieves the shader source at the specified path.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShaderCache

public ShaderCache(GlContext ctx,
                   boolean checkTimestamps)
Creates a new shader cache.

Parameters:
checkTimestamps - if true, check the last-modified timestamp of each resource file when we retrieve it from the cache, reloading the resource if the file has been modified externally.
Method Detail

getShader

public Shader getShader(String path,
                        String... defs)
Loads and returns the shader at the specified path with the supplied preprocessor definitions.


getShader

public Shader getShader(String path,
                        String[] defs,
                        String[] ddefs)
Loads and returns the shader at the specified path with the supplied preprocessor definitions as well as a set of derived definitions (not used to find the shader, but included if the shader is compiled).


getSource

public String getSource(String path)
Retrieves the shader source at the specified path.


getProgram

public Program getProgram(Shader vertex,
                          Shader fragment)
Returns an instance of a program with the supplied vertex and fragment shaders.



Copyright © 2011. All Rights Reserved.