package simogl.model.building;

import java.io.File;
import java.io.IOException;
import simogl.model.AbstractMD2Model;
import simogl.model.animation.Animation;
import simogl.model.modelloader.MD2Importer;
import com.sun.opengl.util.texture.TextureIO;

/**
 * This class represents a md2 model of a house
 * @author Frank Bruns
 *
 */
public class MD2CityHall extends AbstractMD2Model
{
	/**
	 * Creates a new house md2 model at the specified loaction
	 * @param x x-coordinate
	 * @param y y-coordinate
	 * @param z z-coordinate
	 */
	public MD2CityHall(float x, float y, float z)
	{
		super(x,y,z);
		this.texPath = "./resources/models/cityhall/cityhall.jpg";
		this.modFile = new File("./resources/models/cityhall/cityhall.md2");
		this.scaleFactor = 5f;
		
		try
		{
			this.texture = TextureIO.newTexture(new File(texPath),true);
		}
		catch(IOException exc)
		{
			System.out.println("House texture file not found.");
		}
		
		this.createAnimStand();
		this.createAnimWalk();
		
		this.setPosition(x, y, z);
	}

	@Override
	protected void createAnimStand()
	{
		this.animStand = new Animation();
		this.animStand.addAnimFrame(MD2Importer.importModel(this.modFile, 0, 0, this.texture,this.scaleFactor),100000);		
	}

	@Override
	protected void createAnimWalk()
	{
		this.animWalk = new Animation();
		this.animWalk.addAnimFrame(MD2Importer.importModel(this.modFile, 0, 0, this.texture,this.scaleFactor),100000);				
	}

	@Override
	public void update(long elapsedTime)
	{
		super.update(elapsedTime);
	}
}