package shadersmod.client;

import java.util.HashMap;
import java.util.Map;

import net.minecraft.client.renderer.vertex.VertexFormatElement;
import shadersmod.common.SMCLog;

public class SVertexElement extends VertexFormatElement {
	SVertexElementUsage sveUsage;

	public SVertexElement(int indexIn, VertexFormatElement.EnumType typeIn, VertexFormatElement.EnumUsage usageIn, int count) {
		this(indexIn, typeIn, SVertexElementUsage.toSVEUsage(usageIn), count);
	}

	public SVertexElement(int indexIn, VertexFormatElement.EnumType typeIn, SVertexElementUsage sveUsageIn, int count) {
		super(indexIn, typeIn, sveUsageIn.getUsage(), count);
		sveUsage = sveUsageIn;
//		SMCLog.finest("SVertexElement %d %s %s %d",indexIn,typeIn.getDisplayName(),sveUsageIn.getDisplayName(),count);
	}

    public final SVertexElementUsage getSVEUsage()
    {
        return this.sveUsage;
    }

    public boolean equals(Object p1)
    {
        if (this == p1)
        {
            return true;
        }
        else if (p1 != null && this.getClass() == p1.getClass())
        {
            SVertexElement ep1 = (SVertexElement)p1;
            return (this.getElementCount() != ep1.getElementCount()) ? false :
            	(this.getIndex() != ep1.getIndex()) ? false : 
            	(this.getType()  != ep1.getType() ) ? false : 
            	(this.sveUsage == ep1.sveUsage);
        }
        else
        {
            return false;
        }
    }
    
    public int hashCode()
    {
        int i = this.getType().hashCode();
        i = i * 31 + this.getSVEUsage().hashCode();
        i = i * 31 + this.getIndex();
        i = i * 31 + this.getElementCount();
        return i;
    }

}
