void SpriteBatch::DrawAgent(Agent* a_agent)
{

	Vec2 pos = a_agent->m_pos;

	float width		= (float)m_agentWidth;
	float height	= (float)m_agentHeight;

	int xOff = (int)width	/ 2;
	int yOff = (int)height	/ 2;

	Vec2 tl = Vec2(-xOff,			-yOff);
	Vec2 tr = Vec2(xOff ,			-yOff);
	Vec2 br = Vec2(-xOff,			yOff);
	Vec2 bl = Vec2(xOff ,			yOff);	

	float rot = Vec2(0,1).GetAngleBetween(a_agent->m_heading);

	//create matrix for start point
	Mat3 rotMat; 	
	rotMat.Rotate(rot + 3.141592654);
	rotMat.SetTranslation(pos);


	//set the 4 vert points to correct rotation
	tl = rotMat.TransformPoint(tl);
	tr = rotMat.TransformPoint(tr);
	br = rotMat.TransformPoint(br);
	bl = rotMat.TransformPoint(bl);	


	processSprite(&tl, &tr, &bl, &br, m_agentIBO, m_agentVBO, m_texID_agent, SPRITE_COLOUR_WHITE);
}
//Draw Line
void SpriteBatch::DrawLine(Vec2 a_start, Vec2 a_end, SPRITE_COLOUR a_col, float a_width)
{
	//width used to offsetting
	float width;

	if(a_width > 0)
		width = a_width;
	else
		width = (float)m_line_width / 2;	

	//width override for debugging
	//width = 50;

	float size = (a_start - a_end).Length();

	Vec2 origin = Vec2(-width / 2, 0);

	//set the line around the zero point with the pivot
	//at the top center (0,0)
	//oriented for rotation zero along the x axis
	Vec2 tl = Vec2(0,					0) + origin;
	Vec2 tr = Vec2(width,				0) + origin;
	Vec2 br = Vec2(0,				size)  + origin;
	Vec2 bl = Vec2(width,			size)  + origin;

	//get difference normalised
//	Vec2 diff = Vec2(a_end.x - a_start.x, a_end.y - a_start.y).GetNormalised();

	Vec2 diff = (a_start - a_end).GetNormalised();


	float rot = Vec2(0,1).GetAngleBetween(diff);

	//create matrix for start point
	Mat3 rotMat; 	
	rotMat.Rotate(rot + 3.141592654);
	rotMat.SetTranslation(a_start);
		

	//transform line start point
	tl = rotMat.TransformPoint(tl);
	tr = rotMat.TransformPoint(tr);

	//transform line end point
	br = rotMat.TransformPoint(br);
	bl = rotMat.TransformPoint(bl);

	processSprite(&tl, &tr, &bl, &br, m_lineIBO, m_lineVBO, m_texID_line, a_col);
}