Class ShaderNodeVariable

java.lang.Object
com.jme3.shader.ShaderNodeVariable
All Implemented Interfaces:
Savable, Cloneable

public class ShaderNodeVariable extends Object implements Savable, Cloneable
A shader node variable
  • Constructor Details

    • ShaderNodeVariable

      public ShaderNodeVariable(String type, String name)
      creates a ShaderNodeVariable
      Parameters:
      type - the glsl type of the variable
      name - the name of the variable
    • ShaderNodeVariable

      public ShaderNodeVariable(String type, String nameSpace, String name, String multiplicity)
      creates a ShaderNodeVariable
      Parameters:
      type - the glsl type of the variable
      nameSpace - the nameSpace (can be the name of the shaderNode or Global,Attr,MatParam,WorldParam)
      name - the name of the variable
      multiplicity - the number of element if this variable is an array. Can be an Int of a declared material parameter
    • ShaderNodeVariable

      public ShaderNodeVariable(String type, String nameSpace, String name, String multiplicity, String prefix)
      creates a ShaderNodeVariable
      Parameters:
      type - the glsl type of the variable
      nameSpace - the nameSpace (can be the name of the shaderNode or Global,Attr,MatParam,WorldParam)
      name - the name of the variable
      multiplicity - the number of element if this variable is an array. Can be an Int of a declared material parameter
      prefix - the variable prefix to append at generation times. This is mostly to add the g_ and m_ for uniforms
    • ShaderNodeVariable

      public ShaderNodeVariable(String type, String nameSpace, String name)
      creates a ShaderNodeVariable
      Parameters:
      type - the glsl type of the variable
      nameSpace - the nameSpace (can be the name of the shaderNode or Global,Attr,MatParam,WorldParam)
      name - the name of the variable
  • Method Details

    • getName

      public String getName()
      returns the name
      Returns:
      the name
    • setName

      public void setName(String name)
      sets the name
      Parameters:
      name - the name
    • getType

      public String getType()
      Returns:
      the glsl type
    • setType

      public void setType(String type)
      sets the glsl type
      Parameters:
      type - the type
    • getNameSpace

      public String getNameSpace()
      Returns:
      the name space (can be the name of the shaderNode or Global,Attr,MatParam,WorldParam)
    • getPrefix

      public String getPrefix()
      Returns:
      the variable prefix
    • setPrefix

      public void setPrefix(String prefix)
      Sets the variable prefix (m_ or g_)
      Parameters:
      prefix - the desired prefix
    • setNameSpace

      public void setNameSpace(String nameSpace)
      sets the nameSpace (can be the name of the shaderNode or Global,Attr,MatParam,WorldParam)
      Parameters:
      nameSpace - the desired nameSpace
    • getDefaultValue

      public String getDefaultValue()
      Gets the default value of this variable.
      Returns:
      the default value of this variable.
    • setDefaultValue

      public void setDefaultValue(String defaultValue)
      Sets the default value of this variable.
      Parameters:
      defaultValue - the default value of this variable.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • write

      public void write(JmeExporter ex) throws IOException
      jme serialization (not used)
      Specified by:
      write in interface Savable
      Parameters:
      ex - the exporter
      Throws:
      IOException - from the exporter
    • read

      public void read(JmeImporter im) throws IOException
      jme serialization (not used)
      Specified by:
      read in interface Savable
      Parameters:
      im - the importer
      Throws:
      IOException - from the importer
    • getCondition

      public String getCondition()
      Returns:
      the condition for this variable to be declared
    • setCondition

      public void setCondition(String condition)
      sets the condition
      Parameters:
      condition - the condition
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isShaderOutput

      public boolean isShaderOutput()
      Returns:
      true if this variable is a shader output
    • setShaderOutput

      public void setShaderOutput(boolean shaderOutput)
      sets to true if this variable is a shader output
      Parameters:
      shaderOutput - true if this variable is a shader output
    • getMultiplicity

      public String getMultiplicity()
      Returns:
      the number of elements if this variable is an array
    • setMultiplicity

      public void setMultiplicity(String multiplicity)
      sets the number of elements of this variable making it an array this value can be a number of can be a define
      Parameters:
      multiplicity - the desired expression
    • clone

      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException