#include "Vertex.h"

#ifndef _DRIVER
#define _DRIVER

	class Driver {
	private:
		float forcemax;				//maximum value for all forces
		float forcestep;			//step by which any force is increased / decreased
		float accforce;				//force that attacks forwards at quader[0-3]
		float brakeforce;			//force that attacks backwards at quader[4-7]
		float leftforce;			//force that attacks left on quader[1,3] and right on quader[4,6]
		float rightforce;			//force that attacks right on quader[0,2] and left on quader[5,7]
		SbVec3f *center;			//center of the quad
		SbVec3f *frontcenter; //center of the frontplane of the quad
		SbVec3f *backcenter;	//center of the back of the quad

		SbVec3f *forward;			//Forward direction, calculated from quader[0-7]
		SbVec3f *upward;			//Upward direction
		SbVec3f *right;				//Right direction (calculated by forward and upward

	public:
		Vertex* quader[8];		//References to Vertices for movement
													//viewed from front:
													//frontplane: top left(0), top right(1), bottom left(2), bottom right(3)
													//backplane: top left(4), top right(5), bottom left(6), bottom right(7)

		//Constructor
		Driver();
		
		//Methods
		void Setquader(Vertex* quader[8]);	//sets the quader points
		void Accelerate();									//Increases the acceleration force
		void Brake();												//Increases the brake force
		void Right();												//Steers right
		void Left();												//Steers left
		void Recalc();											//Calculates center, forward, right, upward
		void UpdatePoints();								//Adds Forces to quader Vertices, according to accforce, brakeforce etc
		void DampForward();									// when not accelerating nor braking, damp the forces
		void DampSideward();								// "
		SbVec3f GetForward();								// returns forward vector
		SbVec3f GetPosition();							// returns center vector
		SbVec3f GetRight();									// returns right vector
	};

#endif