///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2005-12-21
// Updated : 2008-10-22
// Licence : This source is under MIT License
// File    : glm/gtx/matrix_projection.h
///////////////////////////////////////////////////////////////////////////////////////////////////
// Dependency:
// - GLM core
///////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef glm_gtx_matrix_projection
#define glm_gtx_matrix_projection

// Dependency:
#include "../../glm.h"

namespace glm
{
   	namespace test{
		void main_ext_gtx_matrix_projection();
	}//namespace test

    namespace gtx{
	//! GLM_GTX_matrix_projection: Varius ways to build and operate on projection matrices
    namespace matrix_projection
    {
		//! Creates a matrix for projecting two-dimensional coordinates onto the screen.
		//! From GLM_GTX_matrix_projection extension.
        template <typename valType> 
		detail::tmat4x4<valType> ortho2D(
			valType left, valType right, valType bottom, valType top);

		//! Creates a matrix for an orthographic parallel viewing volume.
		//! From GLM_GTX_matrix_projection extension.
		template <typename valType> 
		detail::tmat4x4<valType> ortho3D(
			valType left, valType right, valType bottom, valType top, valType zNear, valType zFar);

		//! Creates a frustum matrix.
		//! From GLM_GTX_matrix_projection extension.
		template <typename T> 
		detail::tmat4x4<T> frustum(
			T left, T right, T bottom, T top, T nearVal, T farVal);
        
		//! Creates a matrix for a symetric perspective-view frustum.
		//! From GLM_GTX_matrix_projection extension.
		template <typename T> 
		detail::tmat4x4<T> perspective(
			T fovy, T aspect, T zNear, T zFar);

		//! Builds a perspective projection matrix based on a field of view
		//! From GLM_GTX_matrix_projection extension.
		template <typename valType> 
		detail::tmat4x4<valType> perspectiveFov(
			valType const & fov, 
			valType const & width, 
			valType const & height, 
			valType const & zNear, 
			valType const & zFar);

		//! Creates a matrix for a symmetric perspective-view frustum with far plane at infinite .
		//! From GLM_GTX_matrix_projection extension.
        template <typename T> 
		detail::tmat4x4<T> infinitePerspective(
			T fovy, T aspect, T zNear);

		//! Creates a matrix for a symmetric perspective-view frustum with far plane at infinite for graphics hardware that doesn't support depth clamping.
		//! From GLM_GTX_matrix_projection extension.
        template <typename T> 
		detail::tmat4x4<T> tweakedInfinitePerspective(
			T fovy, T aspect, T zNear);

		//! Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates.
		//! From GLM_GTX_matrix_projection extension.
		template <typename T, typename U> 
		detail::tvec3<T> project(
			const detail::tvec3<T>& obj, 
			const detail::tmat4x4<T>& model, 
			const detail::tmat4x4<T>& proj, 
			const detail::tvec4<U>& viewport);
        
		//! Map the specified window coordinates (win.x, win.y, win.z) into object coordinates.
		//! From GLM_GTX_matrix_projection extension.
		template <typename T, typename U> 
		detail::tvec3<T> unProject(
			const detail::tvec3<T>& win, 
			const detail::tmat4x4<T>& model, 
			const detail::tmat4x4<T>& proj, 
			const detail::tvec4<U>& viewport);

    }//namespace matrix_projection
    }//namespace gtx
}//namespace glm

#define GLM_GTX_matrix_projection namespace gtx::matrix_projection

#include "matrix_projection.inl"

#endif//glm_gtx_matrix_projection
