#include <sstream>

#include "../Logger.h"
#include "Building.h"
#include "../drawstuff/helperFunctions.h"
#include "../drawstuff/drawstuff.h"

Building::Building(const dVector3 size, const dVector3 pos, const dReal direction, const dReal weight):
	FixedSimulationObject(size, pos, direction, weight)
{}

Building::~Building() {};

void Building::visualize()
{
	dsSetColor(DARKGREY[0], DARKGREY[1], DARKGREY[2]);
  	//we need to convert the dReal to float
  	const dReal* rPos = dBodyGetPosition(_body);
  	const dReal* rRot = dBodyGetRotation(_body);
  	const float fPosBody[3] = {rPos[0], rPos[1], rPos[2]};
  	const float fRotBody[12] = {rRot[0], rRot[1], rRot[2], rRot[3], rRot[4], rRot[5], rRot[6], rRot[7], rRot[8], rRot[9], rRot[10], rRot[11]};
  	const float fSize[3] = {_size[0], _size[1], _size[2]};
//  	_DEBUG(rPos[0] << rPos[1] << rPos[2]);
//	_DEBUG(rRot[0] << rRot[1] << rRot[2] << rRot[3] << rRot[4] << rRot[5] << rRot[6] << rRot[7] << rRot[8] << rRot[9] << rRot[10] << rRot[11] << rRot[12]);
//  	_DEBUG(fSize[0] << fSize[1] << fSize[2]);
  	dsDrawBox(fPosBody, fRotBody, fSize);
}

std::string Building::toString() const
{
	std::ostringstream oss;
	oss << "Building ID=" << getID();
	return oss.str();
}
