package com.google.ar.core.examples.java.common.java3d;

public class Material extends NodeComponent {
	float shininess = 64.0f;
	float[] diffuse = null;
	float[] ambient = null;
	float[] specular = null;
	float[] emissive = null;
	boolean lightingEnable = true;
	
	public Material() {
		lightingEnable = true;
		setDiffuseColor(1.0f, 1.0f, 1.0f);
		setAmbientColor(0.2f, 0.2f, 0.2f);
		setSpecularColor(1.0f, 1.0f, 1.0f);
		setEmissiveColor(0.0f, 0.0f, 0.0f);
		setShininess(64.0f);
	}

	public void setDiffuseColor(float r, float g, float b) {
		diffuse = new float[]{r, g ,b, 1.0f};
	}

	public void setAmbientColor(float r, float g, float b) {
		ambient = new float[]{r, g ,b, 1.0f};
	}

	public void setSpecularColor(float r, float g, float b) {
		specular = new float[]{r, g ,b, 1.0f};
	}

	public void setEmissiveColor(float r, float g, float b) {
		emissive = new float[]{r, g ,b, 1.0f};
	}

	public void setShininess(float shininess) {
		this.shininess = shininess;
	}

	public boolean getLightingEnable() {
		return lightingEnable;
	}

	public void setLightingEnable(boolean lightingEnable) {
		this.lightingEnable = lightingEnable;
	}

	@Override
	public NodeComponent cloneNodeComponent() {
		Material m = new Material();
		m.setDiffuseColor(diffuse[0], diffuse[1], diffuse[2]);
		m.setAmbientColor(ambient[0], ambient[1], ambient[2]);
		m.setSpecularColor(specular[0], specular[1], specular[2]);
		m.setEmissiveColor(emissive[0], emissive[1], emissive[2]);
		m.setShininess(shininess);
		m.setLightingEnable(lightingEnable);
		return m;
	}

}
