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

public class Appearance extends NodeComponent {
	private Material material = null;
	private Texture texture = null;
	private TextureAttributes textureAttribute = null;
	private TexCoordGeneration texCoordGeneration = null;
	private TextureUnitState[] stateArray;
	private TransparencyAttributes transparencyAttributes = null;
	private ColoringAttributes coloringAttributes = null;

	public void setMaterial(Material m) {
		this.material = m;
	}

	public Material getMaterial() {
		return material;
	}

	public void setTexture(Texture texture) {
		this.texture = texture;
	}

	public Texture getTexture() {
		return texture;
	}
	
	public int getTextureUnitCount() {
		if (stateArray == null) return 0;
		return stateArray.length;
	}

	public TextureUnitState getTextureUnitState(int textureUnit) {
		if (stateArray == null) return null;
		return stateArray[textureUnit];
	}
	
	public void setTextureUnitState(TextureUnitState[] stateArray) {
		this.stateArray = stateArray;
	}

	public void setTextureUnitState(int textureUnit, TextureUnitState textureUnitState) {
		stateArray[textureUnit] = textureUnitState;
	}

	public TextureAttributes getTextureAttributes() {
		return textureAttribute;
	}

	public void setTextureAttributes(TextureAttributes textureAttribute) {
		this.textureAttribute = textureAttribute;
	}
	
	public TexCoordGeneration getTexCoordGeneration() {
		return texCoordGeneration;
	}
	
	public void setTexCoordGeneration(TexCoordGeneration texCoordGeneration) {
		this.texCoordGeneration = texCoordGeneration;
	}

	public TransparencyAttributes getTransparencyAttributes() {
		return transparencyAttributes;
	}

	public void setTransparencyAttributes(TransparencyAttributes transparencyAttributes) {
		this.transparencyAttributes = transparencyAttributes;
	}

	public ColoringAttributes getColoringAttributes() {
		return coloringAttributes;
	}

	public void setColoringAttributes(ColoringAttributes coloringAttributes) {
		this.coloringAttributes = coloringAttributes;
	}

	@Override
	public NodeComponent cloneNodeComponent() {
		Appearance ap = new Appearance();
		if (material != null) {
			ap.material = (Material)material.cloneNodeComponent();
		}
		if (texture != null) {
			ap.texture = (Texture)texture.cloneNodeComponent();
		}
		if (textureAttribute != null) {
			ap.textureAttribute = (TextureAttributes)textureAttribute.cloneNodeComponent();
		}
		if (texCoordGeneration != null) {
			ap.texCoordGeneration  = (TexCoordGeneration)texCoordGeneration.cloneNodeComponent();
		}
		return ap;
	}
}
