Class PhongComponents

java.lang.Object
com.ijurnove.cpu3d.PhongComponents

public class PhongComponents extends Object
A PhongComponents object contains information about lighting, for the Blinn-Phong lighting model. Each PhongComponents has an ambient color, a diffuse color, and a specular color. Ambient lighting illuminates the entire scene at once, diffuse lighting is matte, and specular lighting is a shiny highlight seen on smooth objects.

RGB components range from 0-1, but can be set higher for a more intense light/reflection.

  • Constructor Summary

    Constructors
    Constructor
    Description
    PhongComponents(double[] ambient, double[] diffuse, double[] specular)
    Constructs a PhongComponents with the given ambient, diffuse, and specular RGB values.
    PhongComponents(int[] ambient, int[] diffuse, int[] specular)
    Constructs a PhongComponents with the given ambient, diffuse, and specular RGB values.
  • Method Summary

    Modifier and Type
    Method
    Description
    double[]
    Returns the ambient color component.
    double[]
    Returns the diffuse color component.
    double[]
    Returns the specular color component.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PhongComponents

      public PhongComponents(double[] ambient, double[] diffuse, double[] specular)
      Constructs a PhongComponents with the given ambient, diffuse, and specular RGB values. Values range from 0-1.
      Parameters:
      ambient - the ambient color
      diffuse - the diffuse color
      specular - the specular color
    • PhongComponents

      public PhongComponents(int[] ambient, int[] diffuse, int[] specular)
      Constructs a PhongComponents with the given ambient, diffuse, and specular RGB values. Values range from 0-255.
      Parameters:
      ambient - the ambient color
      diffuse - the diffuse color
      specular - the specular color
  • Method Details

    • getAmb

      public double[] getAmb()
      Returns the ambient color component. Values range from 0-1.
      Returns:
      the ambient color component
    • getDiff

      public double[] getDiff()
      Returns the diffuse color component. Values range from 0-1.
      Returns:
      the diffuse color component
    • getSpec

      public double[] getSpec()
      Returns the specular color component. Values range from 0-1.
      Returns:
      the specular color component