org.xith3d.loaders.shaders.impl.assembly
Class AssemblyShaderLoader

java.lang.Object
  extended by org.xith3d.loaders.shaders.base.ShaderLoader<AssemblyShader>
      extended by org.xith3d.loaders.shaders.impl.assembly.AssemblyShaderLoader

public class AssemblyShaderLoader
extends ShaderLoader<AssemblyShader>

Loads a assembly shaders.


Constructor Summary
AssemblyShaderLoader()
          Constructs a Loader with default values for all variables.
AssemblyShaderLoader(java.lang.String basePath)
          Constructs a Loader with the specified basePath.
AssemblyShaderLoader(java.net.URL baseURL)
          Constructs a Loader with the specified baseURL.
 
Method Summary
static AssemblyShaderLoader getInstance()
           
 AssemblyFragmentShader loadFragmentShader(java.lang.String name)
          Retrives the Shader with the given name.
 AssemblyFragmentShader loadFragmentShader(java.net.URL url)
          Retrives the Shader with the given name.
 AssemblyFragmentShader loadFragmentShaderFromString(java.lang.String source)
          Creates a Shader from the given String.
 AssemblyShader loadShader(java.io.InputStream in, Shader.ShaderType type)
          Retrives the Shader from the given InputStream.
 AssemblyShader loadShader(java.io.Reader reader, Shader.ShaderType type)
          Retrives the Shader from the given reader.
 AssemblyShader loadShader(java.lang.String name, Shader.ShaderType type)
          Retrives the Shader with the given name.
 AssemblyShader loadShader(java.net.URL url, Shader.ShaderType type)
          Retrives the Shader from the given URL.
 AssemblyShader loadShaderFromString(java.lang.String source, Shader.ShaderType typ)
          Creates a Shader from the given String.
 AssemblyVertexShader loadVertexShader(java.lang.String name)
          Retrives the Shader with the given name.
 AssemblyVertexShader loadVertexShader(java.net.URL url)
          Retrives the Shader with the given name.
 AssemblyVertexShader loadVertexShaderFromString(java.lang.String source)
          Creates a Shader from the given String.
 
Methods inherited from class org.xith3d.loaders.shaders.base.ShaderLoader
cacheShader, getBasePath, getBaseURL, getFromCache, popBasePath, popBaseURL, setBasePath, setBasePathFromShaderFile, setBaseURL, setBaseURLFromShaderURL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AssemblyShaderLoader

public AssemblyShaderLoader(java.net.URL baseURL)
Constructs a Loader with the specified baseURL.

Parameters:
baseURL - the new baseURL to take resources from

AssemblyShaderLoader

public AssemblyShaderLoader(java.lang.String basePath)
Constructs a Loader with the specified basePath.

Parameters:
basePath - the new basePath to take resources from

AssemblyShaderLoader

public AssemblyShaderLoader()
Constructs a Loader with default values for all variables.

Method Detail

loadShader

public AssemblyShader loadShader(java.io.Reader reader,
                                 Shader.ShaderType type)
                          throws java.io.IOException
Retrives the Shader from the given reader.

Specified by:
loadShader in class ShaderLoader<AssemblyShader>
Parameters:
reader - the reader to load the Shader from
type - the desired Shader type
Returns:
the Shader object
Throws:
java.io.IOException

loadShader

public AssemblyShader loadShader(java.io.InputStream in,
                                 Shader.ShaderType type)
                          throws java.io.IOException
Retrives the Shader from the given InputStream.

Specified by:
loadShader in class ShaderLoader<AssemblyShader>
Parameters:
in - the InputStream to load the Shader from
type - the desired Shader type
Returns:
the Shader object
Throws:
java.io.IOException

loadShader

public AssemblyShader loadShader(java.net.URL url,
                                 Shader.ShaderType type)
                          throws java.io.IOException
Retrives the Shader from the given URL.

Specified by:
loadShader in class ShaderLoader<AssemblyShader>
Parameters:
url - the URL to load the Shader from
type - the desired Shader type
Returns:
the Shader object
Throws:
java.io.IOException

loadShader

public AssemblyShader loadShader(java.lang.String name,
                                 Shader.ShaderType type)
                          throws java.io.IOException
Retrives the Shader with the given name. Loading works in the following order:
If the Shader was already loaded and is still in the cache then the existing Shader is returned. So don't modify Shaders returned by this method.
The Shader is loaded from the basePath or basURL.

Specified by:
loadShader in class ShaderLoader<AssemblyShader>
Parameters:
name - The name of the Shader
type - The desired Shader type
Returns:
the Shader object
Throws:
java.io.IOException

loadVertexShader

public AssemblyVertexShader loadVertexShader(java.net.URL url)
                                      throws java.io.IOException
Retrives the Shader with the given name.

Parameters:
url - The url of the Shader.
Returns:
The Shader object
Throws:
java.io.IOException

loadVertexShader

public AssemblyVertexShader loadVertexShader(java.lang.String name)
                                      throws java.io.IOException
Retrives the Shader with the given name.

Parameters:
name - The name of the Shader.
Returns:
The Shader object
Throws:
java.io.IOException

loadFragmentShader

public AssemblyFragmentShader loadFragmentShader(java.net.URL url)
                                          throws java.io.IOException
Retrives the Shader with the given name.

Parameters:
url - The url of the Shader.
Returns:
The Shader object
Throws:
java.io.IOException

loadFragmentShader

public AssemblyFragmentShader loadFragmentShader(java.lang.String name)
                                          throws java.io.IOException
Retrives the Shader with the given name.

Parameters:
name - The name of the Shader.
Returns:
The Shader object
Throws:
java.io.IOException

loadShaderFromString

public AssemblyShader loadShaderFromString(java.lang.String source,
                                           Shader.ShaderType typ)
Creates a Shader from the given String. The generated Shader is not cached.

Specified by:
loadShaderFromString in class ShaderLoader<AssemblyShader>
Parameters:
source - The String that should get parsed
Returns:
Shader A Shader object that is based on the current content of the given String

loadVertexShaderFromString

public AssemblyVertexShader loadVertexShaderFromString(java.lang.String source)
Creates a Shader from the given String. The generated Shader is not cached.

Parameters:
source - The String that should get parsed
Returns:
Shader A Shader object that is based on the current content of the given String

loadFragmentShaderFromString

public AssemblyFragmentShader loadFragmentShaderFromString(java.lang.String source)
Creates a Shader from the given String. The generated Shader is not cached.

Parameters:
source - The String that should get parsed
Returns:
Shader A Shader object that is based on the current content of the given String

getInstance

public static AssemblyShaderLoader getInstance()
Returns:
the singleton instance of the TextureLoader