Class Shader
  
  
  
  
    Inheritance
    java.lang.Object
    
    
    Shader
   
  
  Syntax
  
    public class Shader implements AssetI
   
  Constructors
  
  
  
  
  Shader(String shaderName)
  Loads Or References a shader in the private context, which means where ever this shader was created thats were it will be usable since the context handle for this is 0. This shader cannot be used universally.
Declaration
  
    public Shader(String shaderName)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | shaderName |  | 
    
  
  
  
  
  Shader(String shaderName, long context)
  Creates a shader found in the shader assets directory.
Declaration
  
    public Shader(String shaderName, long context)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | shaderName |  | 
      
        | long | context |  | 
    
  
  Fields
  
  
  
  DEFAULT_SHADER
  
  
  Declaration
  
    public static final Shader DEFAULT_SHADER= null
   
  Field Value
  
  
  
  DEFAULT_SHADER_ASSET_DIRECTORY_PATH
  
  
  Declaration
  
    public static final PathHandle DEFAULT_SHADER_ASSET_DIRECTORY_PATH= new PathHandle("res/shaders/",
			PathType.Internal)
   
  Field Value
  
  Methods
  
  
  
  
  addAllAttributes(ShaderSource source)
  
  
  Declaration
  
    public void addAllAttributes(ShaderSource source)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | ShaderSource | source |  | 
    
  
  
  
  
  addAllAttributes(String shaderText)
  
  
  Declaration
  
    public void addAllAttributes(String shaderText)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | shaderText |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void addAllUniforms(ShaderSource source)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | ShaderSource | source |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void addAllUniforms(String shaderText)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | shaderText |  | 
    
  
  
  
  
  addFragmentShader(ShaderSource source)
  
  
  Declaration
  
    public void addFragmentShader(ShaderSource source)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | ShaderSource | source |  | 
    
  
  
  
  
  addFragmentShader(String text)
  
  
  Declaration
  
    public void addFragmentShader(String text)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | text |  | 
    
  
  
  
  
  addGeometryShader(ShaderSource source)
  
  
  Declaration
  
    public void addGeometryShader(ShaderSource source)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | ShaderSource | source |  | 
    
  
  
  
  
  addGeometryShader(String text)
  
  
  Declaration
  
    public void addGeometryShader(String text)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | text |  | 
    
  
  
  
  
  addProgram(String text, int type, String text_type)
  
  
  Declaration
  
    public void addProgram(String text, int type, String text_type)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | text |  | 
      
        | int | type |  | 
      
        | String | text_type |  | 
    
  
  
  
  
  addShader(ShaderType type, ShaderSource source)
  
  
  Declaration
  
    public void addShader(ShaderType type, ShaderSource source)
   
  Parameters
  
  
  
  
  addTesselationControlShader(ShaderSource source)
  
  
  Declaration
  
    public void addTesselationControlShader(ShaderSource source)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | ShaderSource | source |  | 
    
  
  
  
  
  addTesselationControlShader(String text)
  
  
  Declaration
  
    public void addTesselationControlShader(String text)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | text |  | 
    
  
  
  
  
  addTesselationEvaluationShader(ShaderSource source)
  
  
  Declaration
  
    public void addTesselationEvaluationShader(ShaderSource source)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | ShaderSource | source |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void addUniform(String uniform)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | uniform |  | 
    
  
  
  
  
  
  Previously Known As addUniformWithStructCheck.
Declaration
  
    public void addUniform(String uniformName, String uniformType, HashMap<String, ArrayList<GLSLStruct>> structs)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | uniformName |  | 
      
        | String | uniformType |  | 
      
        | HashMap<String, ArrayList<GLSLStruct>> | structs |  | 
    
  
  
  
  
  addVertexShader(ShaderSource source)
  
  
  Declaration
  
    public void addVertexShader(ShaderSource source)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | ShaderSource | source |  | 
    
  
  
  
  
  addVertexShader(String text)
  
  
  Declaration
  
    public void addVertexShader(String text)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | text |  | 
    
  
  
  
  
  bind()
  
  
  Declaration
  
  
  
  
  compileShader()
  
  
  Declaration
  
    public void compileShader()
   
  
  
  
  decAndGetRef()
  
  
  Declaration
  
    public int decAndGetRef()
   
  Returns
  
  Overrides
  
  
  
  
  decRef()
  Decrements the asset's reference count by one. 
Declaration
  
  Overrides
  
  
  
  
  dispose()
  
  
  Declaration
  
  Overrides
  
  
  
  
  
  
  
  Declaration
  
    public HashMap<String, ArrayList<GLSLStruct>> findUniformStructs(String shaderText)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | shaderText |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | HashMap<String, ArrayList<GLSLStruct>> |  | 
    
  
  
  
  
  getProgram()
  
  
  Declaration
  
  Returns
  
  
  
  
  getRefs()
  Returns the integer representation of the references.
Declaration
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | int | The count of refrences.  | 
    
  
  Overrides
  
  
  
  
  
  
  
  Declaration
  
    public HashMap<String, Integer> getUniforms()
   
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | HashMap<String, Integer> |  | 
    
  
  
  
  
  incAndGetRef()
  
  
  Declaration
  
    public int incAndGetRef()
   
  Returns
  
  Overrides
  
  
  
  
  incRef()
  Increments the asset's reference count by one. 
Declaration
  
  Overrides
  
  
  
  
  loadShaderSource(PathHandle pathToShader, ShaderType type)
  Loads a shader from the path to the shader directory and the type. Resolves a file from the path and then loads.
Declaration
  
    public static ShaderSource loadShaderSource(PathHandle pathToShader, ShaderType type)
   
  Parameters
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | ShaderSource |  | 
    
  
  
  
  
  setAttribLocation(String attribName, int location)
  
  
  Declaration
  
    public void setAttribLocation(String attribName, int location)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | attribName |  | 
      
        | int | location |  | 
    
  
  
  
  
  setProgram(int program)
  
  
  Declaration
  
    public void setProgram(int program)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | int | program |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void setUniform1i(String uniformName, int value)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | uniformName |  | 
      
        | int | value |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void setUniform2f(String uniformName, Vector2f value)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | uniformName |  | 
      
        | Vector2f | value |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void setUniform2fv(String uniformName, float[] value)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | uniformName |  | 
      
        | float [] | value |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void setUniform2iv(String uniformName, int[] value)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | uniformName |  | 
      
        | int [] | value |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void setUniform3f(String uniformName, Vector3f value)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | uniformName |  | 
      
        | Vector3f | value |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void setUniform3fv(String uniformName, float[] value)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | uniformName |  | 
      
        | float [] | value |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void setUniform3i(String uniformName, Vector3i value)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | uniformName |  | 
      
        | Vector3i | value |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void setUniform3iv(String uniformName, int[] value)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | uniformName |  | 
      
        | int [] | value |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void setUniform3ui(String uniformName, Vector3i value)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | uniformName |  | 
      
        | Vector3i | value |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void setUniform3uiv(String uniformName, int[] value)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | uniformName |  | 
      
        | int [] | value |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void setUniform4f(String uniformName, Vector4f value)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | uniformName |  | 
      
        | Vector4f | value |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void setUniformBoolean(String uniformName, boolean value)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | uniformName |  | 
      
        | boolean | value |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void setUniformDirectionalLight(String uniformName, DirectionalLight directionalLight)
   
  Parameters
  
  
  
  
  
  
  
  Declaration
  
    public void setUniformf(String uniformName, float value)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | uniformName |  | 
      
        | float | value |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void setUniformfv(String uniformName, float[] value)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | uniformName |  | 
      
        | float [] | value |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void setUniformi(String uniformName, int value)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | uniformName |  | 
      
        | int | value |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void setUniformiv(String uniformName, int[] value)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | uniformName |  | 
      
        | int [] | value |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void setUniformLight(String uniformName, Light baseLight)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | uniformName |  | 
      
        | Light | baseLight |  | 
    
  
  
  
  
  
  All Matrices by default are transposed while loading. 
Declaration
  
    public void setUniformMatrix4fv(String uniformName, Matrix value)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | uniformName |  | 
      
        | Matrix | value |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void setUniformPointLight(String uniformName, PointLight pointLight)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | uniformName |  | 
      
        | PointLight | pointLight |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void setUniforms(HashMap<String, Integer> uniforms)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | HashMap<String, Integer> | uniforms |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void setUniformSpotLight(String uniformName, SpotLight spotLight)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | String | uniformName |  | 
      
        | SpotLight | spotLight |  | 
    
  
  
  
  
  
  
  
  Declaration
  
    public void updateUniforms(Transform transform, Material mat, RenderingEngine engine)
   
  Parameters