mirror of
https://github.com/g-truc/glm.git
synced 2024-11-16 14:54:35 +00:00
add glm::ortho_2d
This commit is contained in:
parent
cd907a8f0f
commit
9da11ffdb1
@ -152,6 +152,21 @@ namespace glm
|
||||
T bottom,
|
||||
T top);
|
||||
|
||||
/// Creates a matrix for projecting two-dimensional coordinates onto the screen.
|
||||
///
|
||||
/// @param left
|
||||
/// @param right
|
||||
/// @param bottom
|
||||
/// @param top
|
||||
/// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
|
||||
/// @see gtc_matrix_transform
|
||||
template <typename T>
|
||||
GLM_FUNC_DECL tmat3x3<T, defaultp> ortho_2d(
|
||||
T left,
|
||||
T right,
|
||||
T bottom,
|
||||
T top);
|
||||
|
||||
/// Creates a frustum matrix.
|
||||
///
|
||||
/// @param left
|
||||
|
@ -186,6 +186,23 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, defaultp> ortho_2d
|
||||
(
|
||||
T left,
|
||||
T right,
|
||||
T bottom,
|
||||
T top
|
||||
)
|
||||
{
|
||||
tmat3x3<T, defaultp> Result(1);
|
||||
Result[0][0] = static_cast<T>(2) / (right - left);
|
||||
Result[1][1] = static_cast<T>(2) / (top - bottom);
|
||||
Result[2][0] = -(right + left) / (right - left);
|
||||
Result[2][1] = -(top + bottom) / (top - bottom);
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> frustum
|
||||
(
|
||||
|
Loading…
Reference in New Issue
Block a user