/*********************************************************************

Name:		Raytracer
Author:		Kamil Szatkowski "Netrix" (C)
Website:	http://www.netrix.org.pl/
License:	GNU GPL

*********************************************************************/
#pragma once
#include "NLib/nMath.hpp"
#include "NLib/nAlignedDynamicTable.hpp"
#include "NLib/nDynamicTable.hpp"

#define CAMERA_NAME_SIZE 32
#define SCREEN_POINTS_COUNT 3 

class Camera
{
public:
	Camera();

	bool loadCamera(const char* szFile);
	void releaseCamera();

	void applyDomainFactor(float fDomainFactor);

	NIne::NMVector3f getViewPoint() const { return m_v3ViewPoint; }
	NIne::NMVector3f getScreenPoint(NIne::NUint32 uPointIndex) const { return m_av3ScreenPoints[uPointIndex]; }

	void getScreenSize(NIne::NUint32* opWidth, NIne::NUint32* opHeight) const	{ *opWidth = m_auScreenSize[0]; *opHeight = m_auScreenSize[1]; }
	void setScreenSize(NIne::NUint32 uWidth, NIne::NUint32 uHeight)				{ m_auScreenSize[0] = uWidth; m_auScreenSize[1] = uHeight; }

	void setCamera(const NIne::NMVector3f& v3ViewPoint, const NIne::NMVector3f& v3ViewDir);

	operator bool() { return m_bLoaded; }

private:
	bool m_bLoaded;
	char m_aName[CAMERA_NAME_SIZE];
	NIne::NMVector3f m_v3ViewPoint;
	NIne::NMVector3f m_av3ScreenPoints[SCREEN_POINTS_COUNT];
	NIne::NUint32 m_auScreenSize[2];	
};