///////////////////////////////////////////////////////////////////////////////
//  CProjection.h

#pragma once

#include <vector>
#include "S3D.h"
#include "SMatrix.h"
#include "SPlane.h"

namespace math3d {

class CCamera;

class CProjection {
	SMatrix		m_matProjection;

	int			m_Width,
				m_Height;

	float		m_fNear,
				m_fFar;

	float		m_Deg;

	std::vector<S3D>	m_NormalList;

public:
	CProjection(void);
	virtual ~CProjection();

	void	Set(int nWidth, int nHeight, float fNear, float fFar, float fDeg);

	void	Resize(int Width, int Height);

	int		GetWidth() const;
	int		GetHeight() const;

	float	GetNear() const;
	float	GetFar() const;
	float	GetDeg() const;

	const SMatrix&	GetMatrix() const;

	const std::vector<S3D>&		GetNormalList() const;

	S3D		GetPosOnNearPlane(int X, int Y) const;

	// ビューフラスタム
	std::vector<SPlane>		CalcViewFrustumPlaneList(const CCamera& Camera) const;

	//
	static SMatrix		CalcFOVMatrix(float UpTan, float DownTan, float LeftTan, float RightTan, float Near, float Far);
};

}

