package projectzombie.model;

import gl_engine.texture.TextureRef3D;
import gl_engine.vec.Vec2d;

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