Class Material

java.lang.Object
com.ijurnove.cpu3d.Material

public class Material extends Object
The Material class defines how light interacts with a surface. Specular, diffuse, and ambient values are given by the PhongComponents, but the emissive value is stored in a double array. A Material with an emissive value greater than 0 will always be illuminated by that color. The emissive component is represented by a double[] with three values, each corresponding to red, green, or blue respectively.

The shininess field determines the characteristics of the specular highlight. A larger shininess value results in a smaller, more concentrated highlight, and a smaller value will result in a larger, more diffused highlight.

  • Field Details

    • PLASTIC

      public static final Material PLASTIC
      An example material.

      Ambient: 255, 255, 255
      Diffuse: 255, 255, 255
      Specular: 255, 255, 255
      Emissive: 0, 0, 0
      Shininess: 32

    • STONE

      public static final Material STONE
      An example material.

      Ambient: 255, 255, 255
      Diffuse: 255, 255, 255
      Specular: 16, 16, 16
      Emissive: 0, 0, 0
      Shininess: 0.5

    • METAL

      public static final Material METAL
      An example material.

      Ambient: 255, 255, 255
      Diffuse: 255, 255, 255
      Specular: 128, 128, 128
      Emissive: 0, 0, 0
      Shininess: 8

  • Constructor Details

    • Material

      public Material(PhongComponents phongComponents, double[] emissive, double shininess)
      Constructs a Material with the specified PhongComponents, emissive value, and shininess. The emissive component is represented by a double[] with three values, each corresponding to red, green, or blue respectively.
      Parameters:
      phongComponents - the specified PhongComponents
      emissive - the emissive light color
      shininess - the shininess exponent
  • Method Details

    • getPhongComponents

      public PhongComponents getPhongComponents()
      Returns the PhongComponents.
      Returns:
      the PhongComponents
    • getShininess

      public double getShininess()
      Returns the shininess value.
      Returns:
      the shininess value
    • getEmissive

      public double[] getEmissive()
      Returns the emissive component, represented by a double[] with three values, each corresponding to red, green, or blue respectively.
      Returns:
      the emissive component