#ifndef __PLAYER__
#define __PLAYER__

#include <stdlib.h>
#include "Vec3f.h"

#define MAX_MOVE_HORIZONTAL 20
#define MAX_MOVE_UP 25
#define MAX_MOVE_DOWN 8

#define MAX_SPEED_HORIZONTAL 1
#define MAX_SPEED_VERTICAL 1

#define ACCELERATION_HORIZONTAL 0.04
#define ACCELERATION_VERTICAL 0.04

#define BREAK_FACTOR 1.5

#define MIN_SPEED 1.5
#define MAX_SPEED 4

class Camera;
class Input;
class Ship;
class Material;
class AABoundBox;
class TextureObject;
class Billboard;

class Player
{
public:

	Player(Camera* cam, Input* keyboard);

	virtual ~Player();

	void spawn(Vec3f position, Vec3f direction, Vec3f upDir = Vec3f(0,1.0f,0));

	float getSpeed();
	void setSpeed(float newSpeed);

	Vec3f getPosition();

	void update();

	void render();

	void startControl();

	void stopControl();

	bool isControled();

	AABoundBox* getBoundingVolume();

	protected:

		Ship* ship;
		Material* shipMaterial;
		TextureObject* texture;

		Billboard* flame_bottom;
		Billboard* flame;

		Vec3f position;
		Vec3f direction;
		Vec3f upDir;

		Camera* cam;
		Input* keyboard;

		bool spawned;

		bool controled;

		void move();
		void rotate();

		Vec3f velocity;

		int flipAngle;
};

#endif __PLAYER__