Class Material

java.lang.Object
com.irurueta.geometry.io.Material
Direct Known Subclasses:
Material3DS, MaterialOBJ

public class Material extends Object
Structure containing parameters defining a material, such as color, texture, etc.
  • Field Details

    • id

      private int id
      Material ID. This value is generated automatically when loading a 3D file, and it is intended to uniquely identify a material.
    • ambientRedColor

      private short ambientRedColor
      Ambient red color component value. If defined, must be between 0 and 255 (both included).
    • ambientGreenColor

      private short ambientGreenColor
      Ambient green color component value. If defined, must be between 0 and 255 (both included).
    • ambientBlueColor

      private short ambientBlueColor
      Ambient blue color component value. If defined, must be between 0 and 255 (both included).
    • diffuseRedColor

      private short diffuseRedColor
      Diffuse red color component value. If defined, must be between 0 and 255 (both included).
    • diffuseGreenColor

      private short diffuseGreenColor
      Diffuse green color component value. If defined, must be between 0 and 255 (both included).
    • diffuseBlueColor

      private short diffuseBlueColor
      Diffuse blue color component value. If defined, must be between 0 and 255 (both included).
    • specularRedColor

      private short specularRedColor
      Specular red color component value. If defined, must be between 0 and 255 (both included).
    • specularGreenColor

      private short specularGreenColor
      Specular green color component value. If defined, must be between 0 and 255 (both included).
    • specularBlueColor

      private short specularBlueColor
      Specular blue color component value. If defined, must be between 0 and 255 (both included).
    • specularCoefficient

      private float specularCoefficient
      Specular coefficient that determines how much shininess the material has.
    • specularCoefficientAvailable

      private boolean specularCoefficientAvailable
      Indicates if specular coefficient is available or not.
    • ambientTextureMap

      private Texture ambientTextureMap
      Ambient texture.
    • diffuseTextureMap

      private Texture diffuseTextureMap
      Diffuse texture.
    • specularTextureMap

      private Texture specularTextureMap
      Specular texture.
    • alphaTextureMap

      private Texture alphaTextureMap
      Alpha texture.
    • bumpTextureMap

      private Texture bumpTextureMap
      Bump texture.
    • transparency

      private short transparency
      Transparency value. If defined, must be a value between 0 and 100 (both included).
    • illumination

      private Illumination illumination
      Illumination of this material.
  • Constructor Details

    • Material

      public Material()
  • Method Details

    • getId

      public int getId()
      Returns id of material. This value is generated automatically when loading a 3D file, and it is intended to uniquely identify a material
      Returns:
      id of material.
    • setId

      public void setId(int id)
      Sets id of material. This value must be generated when loading a 3D file, and it is intended to uniquely identify a material.
      Parameters:
      id - id of material to be set.
    • getAmbientRedColor

      public short getAmbientRedColor()
      Returns ambient red color component value. If defined, must be between 0 and 255 (both included).
      Returns:
      ambient red color component value.
    • setAmbientRedColor

      public void setAmbientRedColor(short ambientRedColor)
      Sets ambient red color component value. If defined, must be between 0 and 255 (both included).
      Parameters:
      ambientRedColor - ambient red color component value to be set.
    • isAmbientRedColorAvailable

      public boolean isAmbientRedColorAvailable()
      Indicates if ambient red color component value is available. Returns true if ambient red color is not negative.
      Returns:
      true if ambient red color is not negative.
    • getAmbientGreenColor

      public short getAmbientGreenColor()
      Returns ambient green color component value. If defined, must be between 0 and 255 (both included).
      Returns:
      ambient green color component value.
    • setAmbientGreenColor

      public void setAmbientGreenColor(short ambientGreenColor)
      Sets ambient green color component value. If defined, must be between 0 and 255 (both included).
      Parameters:
      ambientGreenColor - ambient green color component value to be set.
    • isAmbientGreenColorAvailable

      public boolean isAmbientGreenColorAvailable()
      Indicates if ambient green color component value is available. Returns true if ambient green color is not negative.
      Returns:
      true if ambient green color is not negative.
    • getAmbientBlueColor

      public short getAmbientBlueColor()
      Returns ambient blue color component value. If defined, must be between 0 and 255 (both included).
      Returns:
      ambient blue color component value.
    • setAmbientBlueColor

      public void setAmbientBlueColor(short ambientBlueColor)
      Sets ambient blue color component value. If defined, must be between 0 and 255 (both included).
      Parameters:
      ambientBlueColor - ambient blue color component value to be set.
    • isAmbientBlueColorAvailable

      public boolean isAmbientBlueColorAvailable()
      Indicates if ambient blue color component value is available. Returns true if ambient blue color is not negative.
      Returns:
      true if ambient blue color is not negative.
    • setAmbientColor

      public void setAmbientColor(short red, short green, short blue)
      Sets all color components of ambient color. Ambient color usually refers to the color of the light that gives a certain tonality to all the objects of a scene.
      Parameters:
      red - ambient red color component to be set. If defined, must be between 0 and 255 (both included).
      green - ambient green color component to be set. If defined, must be between 0 and 255 (both included).
      blue - ambient blue color component to be set. If defined, must be between 0 and 255 (both included).
    • isAmbientColorAvailable

      public boolean isAmbientColorAvailable()
      Indicates if ambient color has been defined.
      Returns:
      true if all components of ambient color have been defined (are not negative).
    • getDiffuseRedColor

      public short getDiffuseRedColor()
      Returns diffuse red color component value. If defined, must be between 0 and 255 (both included).
      Returns:
      diffuse red color component value.
    • setDiffuseRedColor

      public void setDiffuseRedColor(short diffuseRedColor)
      Sets diffuse red color component value. If defined, must be between 0 and 255 (both included).
      Parameters:
      diffuseRedColor - diffuse red color component value to be set.
    • isDiffuseRedColorAvailable

      public boolean isDiffuseRedColorAvailable()
      Indicates if diffuse red color component value is available. Returns true if diffuse red color is not negative.
      Returns:
      true if diffuse red color is not negative.
    • getDiffuseGreenColor

      public short getDiffuseGreenColor()
      Returns diffuse green color component value. If defined, must be between 0 and 255 (both included).
      Returns:
      diffuse green color component value.
    • setDiffuseGreenColor

      public void setDiffuseGreenColor(short diffuseGreenColor)
      Sets diffuse green color component value. If defined, must be between 0 and 255 (both included).
      Parameters:
      diffuseGreenColor - diffuse green color component value to be set.
    • isDiffuseGreenColorAvailable

      public boolean isDiffuseGreenColorAvailable()
      Indicates if diffuse green color component value is available. Returns true if diffuse green color is not negative.
      Returns:
      true if diffuse green color is not negative.
    • getDiffuseBlueColor

      public short getDiffuseBlueColor()
      Returns diffuse blue color component value. If defined, must be between 0 and 255 (both included).
      Returns:
      diffuse blue color component value.
    • setDiffuseBlueColor

      public void setDiffuseBlueColor(short diffuseBlueColor)
      Sets diffuse blue color component value. If defined, must be between 0 and 255 (both included).
      Parameters:
      diffuseBlueColor - diffuse blue color component value to be set.
    • isDiffuseBlueColorAvailable

      public boolean isDiffuseBlueColorAvailable()
      Indicates if diffuse blue color component value is available. Returns true if diffuse blue color is not negative.
      Returns:
      true if diffuse blue color is not negative.
    • setDiffuseColor

      public void setDiffuseColor(short red, short green, short blue)
      Sets all color components of diffuse color. Diffuse color usually refers to the surface color of a given object without accounting for highlights or shininess.
      Parameters:
      red - diffuse red color component to be set. If defined, must be between 0 and 255 (both included).
      green - diffuse green color component to be set. If defined, must be between 0 and 255 (both included).
      blue - diffuse blue color component to be set. If defined, must be between 0 and 255 (both included).
    • isDiffuseColorAvailable

      public boolean isDiffuseColorAvailable()
      Indicates if diffuse color has been defined.
      Returns:
      true if all components of diffuse color have been defined (are not negative).
    • getSpecularRedColor

      public short getSpecularRedColor()
      Returns specular red color component value. If defined, must be between 0 and 255 (both included).
      Returns:
      specular red color component value.
    • setSpecularRedColor

      public void setSpecularRedColor(short specularRedColor)
      Sets specular red color component value. If defined, must be between 0 and 255 (both included).
      Parameters:
      specularRedColor - specular red color component value to be set.
    • isSpecularRedColorAvailable

      public boolean isSpecularRedColorAvailable()
      Indicates if specular red color component value is available. Returns true if specular red color is not negative.
      Returns:
      true if specular red color is not negative.
    • getSpecularGreenColor

      public short getSpecularGreenColor()
      Returns specular green color component value. If defined, must be between 0 and 255 (both included).
      Returns:
      specular green color component value.
    • setSpecularGreenColor

      public void setSpecularGreenColor(short specularGreenColor)
      Sets specular green color component value. If defined, must be between 0 and 255 (both included).
      Parameters:
      specularGreenColor - specular green color component value to be set.
    • isSpecularGreenColorAvailable

      public boolean isSpecularGreenColorAvailable()
      Indicates if specular green color component value is available. Returns true if specular green color is not negative.
      Returns:
      true if specular green color is not negative.
    • getSpecularBlueColor

      public short getSpecularBlueColor()
      Returns specular blue color component value. If defined, must be between 0 and 255 (both included).
      Returns:
      specular blue color component value.
    • setSpecularBlueColor

      public void setSpecularBlueColor(short specularBlueColor)
      Sets specular blue color component value. If defined, must be between 0 and 255 (both included).
      Parameters:
      specularBlueColor - specular blue color component value to be set.
    • isSpecularBlueColorAvailable

      public boolean isSpecularBlueColorAvailable()
      Indicates if specular blue color component value is available. Returns true if specular blue color is not negative.
      Returns:
      true if specular blue color is not negative.
    • setSpecularColor

      public void setSpecularColor(short red, short green, short blue)
      Sets all color components of specular color. Specular color usually refers to the color of the highlights on an object surface when it shines because of the light.
      Parameters:
      red - specular red color component to be set. If defined, must be between 0 and 255 (both included).
      green - specular green color component to be set. If defined, must be between 0 and 255 (both included).
      blue - specular blue color component to be set. If defined, must be between 0 and 255 (both included).
    • isSpecularColorAvailable

      public boolean isSpecularColorAvailable()
      Indicates if specular color has been defined.
      Returns:
      true if all components of specular color have been defined (are not negative).
    • getSpecularCoefficient

      public float getSpecularCoefficient()
      Returns specular coefficient. This indicates the amount of shininess of an object.
      Returns:
      specular coefficient.
    • setSpecularCoefficient

      public void setSpecularCoefficient(float specularCoefficient)
      Sets specular coefficient. This indicates the amount of shininess of an object.
      Parameters:
      specularCoefficient - specular coefficient to be set.
    • isSpecularCoefficientAvailable

      public boolean isSpecularCoefficientAvailable()
      Indicates if specular coefficient has been defined for this material.
      Returns:
      true if specular coefficient has been defined and is available, false otherwise.
    • getAmbientTextureMap

      public Texture getAmbientTextureMap()
      Returns ambient texture. Ambient texture usually refers to the texture used to give a certain tonality to an object, as if it was lit by some source of light.
      Returns:
      ambient texture.
    • setAmbientTextureMap

      public void setAmbientTextureMap(Texture ambientTextureMap)
      Sets ambient texture. Ambient texture usually refers to the texture used to give a certain tonality to anb object, as if it was lit by some source of light.
      Parameters:
      ambientTextureMap - ambient texture to be set.
    • isAmbientTextureMapAvailable

      public boolean isAmbientTextureMapAvailable()
      Indicates if ambient texture has been defined and is available.
      Returns:
      true if ambient texture has been defined and is available, false otherwise.
    • getDiffuseTextureMap

      public Texture getDiffuseTextureMap()
      Returns diffuse texture. Diffuse texture usually refers to the texture applied on the surface of an object as its color.
      Returns:
      diffuse texture.
    • setDiffuseTextureMap

      public void setDiffuseTextureMap(Texture diffuseTextureMap)
      Sets diffuse texture. Diffuse texture usually refers to the texture applied on the surface of an object as its color.
      Parameters:
      diffuseTextureMap - diffuse texture to be set.
    • isDiffuseTextureMapAvailable

      public boolean isDiffuseTextureMapAvailable()
      Indicates if diffuse texture has been defined and is available.
      Returns:
      true if diffuse texture has been defined and is available, false otherwise.
    • getSpecularTextureMap

      public Texture getSpecularTextureMap()
      Returns specular texture. Specular texture usually refers to the highlights or sparkles applied on the surface of an object.
      Returns:
      specular texture.
    • setSpecularTextureMap

      public void setSpecularTextureMap(Texture specularTextureMap)
      Sets specular texture. Specular texture usually refers to the highlights or sparkles applied on the surface of an object.
      Parameters:
      specularTextureMap - specular texture to be set.
    • isSpecularTextureMapAvailable

      public boolean isSpecularTextureMapAvailable()
      Indicates if specular texture has been defined and is available
      Returns:
      true if specular texture has been defined and is available, false otherwise.
    • getAlphaTextureMap

      public Texture getAlphaTextureMap()
      Returns alpha texture. Alpha texture usually contains information related to transparency.
      Returns:
      alpha texture.
    • setAlphaTextureMap

      public void setAlphaTextureMap(Texture alphaTextureMap)
      Sets alpha texture. Alpha texture usually contains information related to transparency.
      Parameters:
      alphaTextureMap - alpha texture to be set.
    • isAlphaTextureMapAvailable

      public boolean isAlphaTextureMapAvailable()
      Indicates if alpha texture has been defined and is available.
      Returns:
      true if alpha texture has been defined and is available, false otherwise.
    • getBumpTextureMap

      public Texture getBumpTextureMap()
      Returns bump texture. Bump textures are used to give the appearance of bumpiness or rugosity to plain surfaces.
      Returns:
      bump texture.
    • setBumpTextureMap

      public void setBumpTextureMap(Texture bumpTextureMap)
      Sets bump texture. Bump textures are used to give the appearance of bumpiness or rugosity to plain surfaces.
      Parameters:
      bumpTextureMap - bump texture.
    • isBumpTextureMapAvailable

      public boolean isBumpTextureMapAvailable()
      Indicates if bump texture has been defined and is available.
      Returns:
      true if bump texture has been defined and is available, false otherwise.
    • getTransparency

      public short getTransparency()
      Returns transparency of this material. If defined, value must be between 0 (no transparency) and 100 (totally transparent).
      Returns:
      transparency of this material.
    • setTransparency

      public void setTransparency(short transparency)
      Sets transparency of this material. If defined, value must be between 0 (no transparency) and 100 (totally transparent).
      Parameters:
      transparency - transparency of this material to be set.
    • isTransparencyAvailable

      public boolean isTransparencyAvailable()
      Indicates if transparency has been defined and is available.
      Returns:
      true if transparency is not negative, false otherwise.
    • getIllumination

      public Illumination getIllumination()
      Returns illumination method to be used for this material.
      Returns:
      illumination.
    • setIllumination

      public void setIllumination(Illumination illumination)
      Sets illumination method to be used for this material.
      Parameters:
      illumination - illumination method to be used.
    • isIlluminationAvailable

      public boolean isIlluminationAvailable()
      Indicates if an illumination has been defined and is available.
      Returns:
      true if illumination has been defined, false otherwise.