46 lines
1.5 KiB
C++
46 lines
1.5 KiB
C++
/**
|
|
This file is a part of our_dick
|
|
Copyright (C) 2020 rexy712
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU Affero General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU Affero General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef OUR_DICK_MATH_PROJECTION_HPP
|
|
#define OUR_DICK_MATH_PROJECTION_HPP
|
|
|
|
#include "mat.hpp"
|
|
#include "vec.hpp"
|
|
|
|
namespace math{
|
|
|
|
template<typename T>
|
|
matrix<T,4,4> fov_projection(T fov, T asp, T near, T far);
|
|
template<typename T>
|
|
matrix<T,4,4> fov_asymetric_projection(T fovl, T fovr, T fovb, T fovt, T asp, T near, T far);
|
|
template<typename T>
|
|
matrix<T,4,4> ortho_projection(T w, T h, T n, T f);
|
|
template<typename T>
|
|
matrix<T,4,4> ortho_asymetric_projection(T l, T r, T b, T t, T n, T f);
|
|
|
|
template<typename T>
|
|
vec3<T> project(const mat4<T>& viewproj_mat, const vec3<T>& world_coords, const vec4<T>& viewport);
|
|
template<typename T>
|
|
vec3<T> unproject(const mat4<T>& viewproj_mat, const vec3<T>& viewport_coords, const vec4<T>& viewport);
|
|
|
|
}
|
|
|
|
#include "projection.tpp"
|
|
|
|
#endif
|