package projectzombie.model;

import gl_engine.texture.TextureRef3D;

public class ModelTile extends Model
{
	private int animationSize;
	private int animationSpeed;
	private TextureRef3D ref;
	protected int flags = 0;
	
	public ModelTile(TextureRef3D ref, int animationSize, int animationSpeed)
	{
		this.ref = ref;
		this.animationSize = animationSize;
		this.animationSpeed = animationSpeed;
	}
	
	public ModelTile(TextureRef3D tex) {
		this(tex, 1, 1);
	}
	
	@Override
	public int getSize() {
		return 4;
	}
	
	@Override
	public int[] getIndicies() {
		return new int[] {
				0, 1, 2,
				2, 3, 0,
		};
	}
	
	@Override
	public float[] getVerticies()
	{
		int asi = animationSize;
		int asp = animationSpeed;
		
		return new float[] {
				 0.5f, 0,  0.5f, 1, 1, 0, 0, 1, 0, 0, 0, asi, asp, 1, 0, flags,
				 0.5f, 0, -0.5f, 1, 0, 0, 0, 1, 0, 0, 0, asi, asp, 1, 0, flags,
				-0.5f, 0, -0.5f, 0, 0, 0, 0, 1, 0, 0, 0, asi, asp, 1, 0, flags,
				-0.5f, 0,  0.5f, 0, 1, 0, 0, 1, 0, 0, 0, asi, asp, 1, 0, flags,
		};
	}
	
	@Override
	public int getIndexSize() {
		return 6;
	}
	
	@Override
	public TextureRef3D[] getTextures()
	{
		return new TextureRef3D[] {
				ref, ref, ref, ref
		};
	}
	
	@Override
	public double getHeight() {
		return 1;
	}
	
	@Override
	public double getWidth() {
		return 1;
	}
}