package projectzombie.model;

import gl_engine.texture.TextureRef3D;

public class ModelRock extends Model
{
	private int animationSize;
	private int animationSpeed;
	private TextureRef3D ref;
	
	public ModelRock(TextureRef3D ref, int animationSize, int animationSpeed)
	{
		this.ref = ref;
		
		this.animationSize = animationSize;
		this.animationSpeed = animationSpeed;
	}
	
	public ModelRock(TextureRef3D tex) {
		this(tex, 1, 1);
	}
	
	@Override
	public int getSize() {
		return 20;
	}
	
	@Override
	public int getIndexSize() {
		return 30;
	}
	
	@Override
	public float[] getVerticies()
	{
		float w = 0.25f;
		float h = 0.25f;
		
		int asi = animationSize;
		int asp = animationSpeed;
		
		return new float[] {
				-w,   0, -w,   0.00f, 0, 0, 0, 1, 0, 0, 0, asi, asp, 1, 0, 0,
				-w,   0,  w,   1.00f, 0, 0, 0, 1, 0, 0, 0, asi, asp, 1, 0, 0,
				-w/2, h,  w/2, 0.75f, 1, 0, 0, 1, 0, 0, 0, asi, asp, 1, 0, 0,
				-w/2, h, -w/2, 0.25f, 1, 0, 0, 1, 0, 0, 0, asi, asp, 1, 0, 0,
				
				 w,   0, -w,   0.00f, 0, 0, 0, 1, 0, 0, 0, asi, asp, 1, 0, 0,
				 w,   0,  w,   1.00f, 0, 0, 0, 1, 0, 0, 0, asi, asp, 1, 0, 0,
				 w/2, h,  w/2, 0.75f, 1, 0, 0, 1, 0, 0, 0, asi, asp, 1, 0, 0,
				 w/2, h, -w/2, 0.25f, 1, 0, 0, 1, 0, 0, 0, asi, asp, 1, 0, 0,
				 
				-w,   0, -w,   0.00f, 0, 0, 0, 1, 0, 0, 0, asi, asp, 1, 0, 0,
				 w,   0, -w,   1.00f, 0, 0, 0, 1, 0, 0, 0, asi, asp, 1, 0, 0,
				 w/2, h, -w/2, 0.75f, 1, 0, 0, 1, 0, 0, 0, asi, asp, 1, 0, 0,
				-w/2, h, -w/2, 0.25f, 1, 0, 0, 1, 0, 0, 0, asi, asp, 1, 0, 0,
				
				-w,   0,  w,   0.00f, 0, 0, 0, 1, 0, 0, 0, asi, asp, 1, 0, 0,
				 w,   0,  w,   1.00f, 0, 0, 0, 1, 0, 0, 0, asi, asp, 1, 0, 0,
				 w/2, h,  w/2, 0.75f, 1, 0, 0, 1, 0, 0, 0, asi, asp, 1, 0, 0,
				-w/2, h,  w/2, 0.25f, 1, 0, 0, 1, 0, 0, 0, asi, asp, 1, 0, 0,
				
				-w/2, h, -w/2, 0.25f, 0.25f, 0, 0, 1, 0, 0, 0, asi, asp, 1, 0, 0,
				 w/2, h, -w/2, 0.75f, 0.25f, 0, 0, 1, 0, 0, 0, asi, asp, 1, 0, 0,
				 w/2, h,  w/2, 0.75f, 0.75f, 0, 0, 1, 0, 0, 0, asi, asp, 1, 0, 0,
				-w/2, h,  w/2, 0.25f, 0.75f, 0, 0, 1, 0, 0, 0, asi, asp, 1, 0, 0,
		};
	}
	
	@Override
	public int[] getIndicies() {
		return new int[] {
				0, 1, 2,
				2, 3, 0,
				
				4, 5, 6,
				6, 7, 4,
				
				8, 9, 10,
				10, 11, 8,
				
				12, 13, 14,
				14, 15, 12,
				
				16, 17, 18,
				18, 19, 16,
		};
	}
	
	@Override
	public TextureRef3D[] getTextures()
	{
		return new TextureRef3D[] {
				ref, ref, ref, ref,
				ref, ref, ref, ref,
				ref, ref, ref, ref,
				ref, ref, ref, ref,
				ref, ref, ref, ref,
		};
	}
	
	@Override
	public double getHeight() {
		return 1;
	}
	
	@Override
	public double getWidth() {
		return 1;
	}
}
