/**
 * package for material classes
 */
package simogl.material;

/**
 * This class is used to represent materials
 * @author Frank Bruns
 *
 */
public class Material
{
	float[] materialAmbDiff = {0f,0f,0f,0f};
	float[] materialSpecular = {0f,0f,0f,1f};
	float[] materialEmission = {0f,0f,0f,1f};
	float shininess = 0.0f;
	
	/**
	 * Creates a new Material object with the specified color values
	 * @param red amount of red
	 * @param green amount of green
	 * @param blue amount of blue
	 * @param alpha alpha-value
	 */
	public Material(float red, float green, float blue, float alpha)
	{
		this.materialAmbDiff[0] = red;
		this.materialAmbDiff[1] = green;
		this.materialAmbDiff[2] = blue;
		this.materialAmbDiff[3] = alpha;
	}
	
	/**
	 * Returns the materials ambient and diffuse RGBA color, which have the 
	 * same values
	 * @return ambient and diffuse material color
	 */
	public float[] getMaterialColorAmbDiff()
	{
		return materialAmbDiff;
	}
	
	/**
	 * Sets the material's ambient and diffuse color to the specified parameters.
	 * Both the ambient and diffuse material get the same color, because this is
	 * the usual behavior for real world object.
	 * @param red amount of red
	 * @param green amount of green
	 * @param blue amount of blue
	 * @param alpha alpha-value
	 */
	public void setMaterialColorAmbDiff(float red, float green, float blue, float alpha)
	{
		
		this.materialAmbDiff[0] = red;
		this.materialAmbDiff[1] = green;
		this.materialAmbDiff[2] = blue;
		this.materialAmbDiff[3] = alpha;
	}

	/**
	 * Returns the emission material RGBA color
	 * @return emission material color
	 */
	public float[] getMaterialColorEmission()
	{
		return materialEmission;
	}

	/**
	 * Sets the material's emission RGBA color
	 * @param red amount of red
	 * @param green amount of green
	 * @param blue amount of blue
	 * @param alpha alpha-value 
	 */
	public void setMaterialColorEmission(float red, float green, float blue, float alpha)
	{
		this.materialEmission[0] = red;
		this.materialEmission[1] = green;
		this.materialEmission[2] = blue;
		this.materialEmission[3] = alpha;
	}

	/**
	 * Returns the material's specular RGBA color
	 * @return material's specular color
	 */
	public float[] getMaterialColorSpecular()
	{
		return materialSpecular;
	}

	/**
	 * Sets the material's specular RGBA color
	 * @param red amount of red
	 * @param green amount of green
	 * @param blue amount of blue
	 * @param alpha alpha-value
	 */
	public void setMaterialColorSpecular(float red, float green, float blue, float alpha)
	{
		this.materialSpecular[0] = red;
		this.materialSpecular[1] = green;
		this.materialSpecular[2] = blue;
		this.materialSpecular[3] = alpha;
	}

	/**
	 * Returns the material's shininess value
	 * @return shininess value
	 */
	public float getShininess()
	{
		return shininess;
	}

	/**
	 * Sets the material's shininess.
	 * @param value shininess factor
	 */
	public void setShininess(float value)
	{
		this.shininess = value;
	}
}