Initial commit

This commit is contained in:
Robert 2020-09-04 21:13:22 +02:00
parent 0889e4de0d
commit 10bc916711
456 changed files with 119668 additions and 0 deletions

View file

@ -0,0 +1,522 @@
/// @ref ext_matrix_clip_space
/// @file glm/ext/matrix_clip_space.hpp
///
/// @defgroup ext_matrix_clip_space GLM_EXT_matrix_clip_space
/// @ingroup ext
///
/// Defines functions that generate clip space transformation matrices.
///
/// The matrices generated by this extension use standard OpenGL fixed-function
/// conventions. For example, the lookAt function generates a transform from world
/// space into the specific eye space that the projective matrix functions
/// (perspective, ortho, etc) are designed to expect. The OpenGL compatibility
/// specifications defines the particular layout of this eye space.
///
/// Include <glm/ext/matrix_clip_space.hpp> to use the features of this extension.
///
/// @see ext_matrix_transform
/// @see ext_matrix_projection
#pragma once
// Dependencies
#include "../ext/scalar_constants.hpp"
#include "../geometric.hpp"
#include "../trigonometric.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_clip_space extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_clip_space
/// @{
/// Creates a matrix for projecting two-dimensional coordinates onto the screen.
///
/// @tparam T A floating-point scalar type
///
/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top, T const& zNear, T const& zFar)
/// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluOrtho2D.xml">gluOrtho2D man page</a>
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> ortho(
T left, T right, T bottom, T top);
/// Creates a matrix for an orthographic parallel viewing volume, using left-handed coordinates.
/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
///
/// @tparam T A floating-point scalar type
///
/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoLH_ZO(
T left, T right, T bottom, T top, T zNear, T zFar);
/// Creates a matrix for an orthographic parallel viewing volume using right-handed coordinates.
/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
///
/// @tparam T A floating-point scalar type
///
/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoLH_NO(
T left, T right, T bottom, T top, T zNear, T zFar);
/// Creates a matrix for an orthographic parallel viewing volume, using left-handed coordinates.
/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
///
/// @tparam T A floating-point scalar type
///
/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoRH_ZO(
T left, T right, T bottom, T top, T zNear, T zFar);
/// Creates a matrix for an orthographic parallel viewing volume, using right-handed coordinates.
/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
///
/// @tparam T A floating-point scalar type
///
/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoRH_NO(
T left, T right, T bottom, T top, T zNear, T zFar);
/// Creates a matrix for an orthographic parallel viewing volume, using left-handed coordinates.
/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
///
/// @tparam T A floating-point scalar type
///
/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoZO(
T left, T right, T bottom, T top, T zNear, T zFar);
/// Creates a matrix for an orthographic parallel viewing volume, using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise.
/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
///
/// @tparam T A floating-point scalar type
///
/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoNO(
T left, T right, T bottom, T top, T zNear, T zFar);
/// Creates a matrix for an orthographic parallel viewing volume, using left-handed coordinates.
/// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
/// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
///
/// @tparam T A floating-point scalar type
///
/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoLH(
T left, T right, T bottom, T top, T zNear, T zFar);
/// Creates a matrix for an orthographic parallel viewing volume, using right-handed coordinates.
/// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
/// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
///
/// @tparam T A floating-point scalar type
///
/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoRH(
T left, T right, T bottom, T top, T zNear, T zFar);
/// Creates a matrix for an orthographic parallel viewing volume, using the default handedness and default near and far clip planes definition.
/// To change default handedness use GLM_FORCE_LEFT_HANDED. To change default near and far clip planes definition use GLM_FORCE_DEPTH_ZERO_TO_ONE.
///
/// @tparam T A floating-point scalar type
///
/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)
/// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glOrtho.xml">glOrtho man page</a>
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> ortho(
T left, T right, T bottom, T top, T zNear, T zFar);
/// Creates a left handed frustum matrix.
/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumLH_ZO(
T left, T right, T bottom, T top, T near, T far);
/// Creates a left handed frustum matrix.
/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumLH_NO(
T left, T right, T bottom, T top, T near, T far);
/// Creates a right handed frustum matrix.
/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumRH_ZO(
T left, T right, T bottom, T top, T near, T far);
/// Creates a right handed frustum matrix.
/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumRH_NO(
T left, T right, T bottom, T top, T near, T far);
/// Creates a frustum matrix using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise.
/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumZO(
T left, T right, T bottom, T top, T near, T far);
/// Creates a frustum matrix using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise.
/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumNO(
T left, T right, T bottom, T top, T near, T far);
/// Creates a left handed frustum matrix.
/// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
/// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumLH(
T left, T right, T bottom, T top, T near, T far);
/// Creates a right handed frustum matrix.
/// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
/// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumRH(
T left, T right, T bottom, T top, T near, T far);
/// Creates a frustum matrix with default handedness, using the default handedness and default near and far clip planes definition.
/// To change default handedness use GLM_FORCE_LEFT_HANDED. To change default near and far clip planes definition use GLM_FORCE_DEPTH_ZERO_TO_ONE.
///
/// @tparam T A floating-point scalar type
/// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glFrustum.xml">glFrustum man page</a>
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> frustum(
T left, T right, T bottom, T top, T near, T far);
/// Creates a matrix for a right handed, symetric perspective-view frustum.
/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
///
/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.
/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveRH_ZO(
T fovy, T aspect, T near, T far);
/// Creates a matrix for a right handed, symetric perspective-view frustum.
/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
///
/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.
/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveRH_NO(
T fovy, T aspect, T near, T far);
/// Creates a matrix for a left handed, symetric perspective-view frustum.
/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
///
/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.
/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveLH_ZO(
T fovy, T aspect, T near, T far);
/// Creates a matrix for a left handed, symetric perspective-view frustum.
/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
///
/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.
/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveLH_NO(
T fovy, T aspect, T near, T far);
/// Creates a matrix for a symetric perspective-view frustum using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise.
/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
///
/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.
/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveZO(
T fovy, T aspect, T near, T far);
/// Creates a matrix for a symetric perspective-view frustum using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise.
/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
///
/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.
/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveNO(
T fovy, T aspect, T near, T far);
/// Creates a matrix for a right handed, symetric perspective-view frustum.
/// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
/// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
///
/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.
/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveRH(
T fovy, T aspect, T near, T far);
/// Creates a matrix for a left handed, symetric perspective-view frustum.
/// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
/// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
///
/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.
/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveLH(
T fovy, T aspect, T near, T far);
/// Creates a matrix for a symetric perspective-view frustum based on the default handedness and default near and far clip planes definition.
/// To change default handedness use GLM_FORCE_LEFT_HANDED. To change default near and far clip planes definition use GLM_FORCE_DEPTH_ZERO_TO_ONE.
///
/// @param fovy Specifies the field of view angle in the y direction. Expressed in radians.
/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
///
/// @tparam T A floating-point scalar type
/// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluPerspective.xml">gluPerspective man page</a>
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> perspective(
T fovy, T aspect, T near, T far);
/// Builds a perspective projection matrix based on a field of view using right-handed coordinates.
/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
///
/// @param fov Expressed in radians.
/// @param width Width of the viewport
/// @param height Height of the viewport
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovRH_ZO(
T fov, T width, T height, T near, T far);
/// Builds a perspective projection matrix based on a field of view using right-handed coordinates.
/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
///
/// @param fov Expressed in radians.
/// @param width Width of the viewport
/// @param height Height of the viewport
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovRH_NO(
T fov, T width, T height, T near, T far);
/// Builds a perspective projection matrix based on a field of view using left-handed coordinates.
/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
///
/// @param fov Expressed in radians.
/// @param width Width of the viewport
/// @param height Height of the viewport
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovLH_ZO(
T fov, T width, T height, T near, T far);
/// Builds a perspective projection matrix based on a field of view using left-handed coordinates.
/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
///
/// @param fov Expressed in radians.
/// @param width Width of the viewport
/// @param height Height of the viewport
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovLH_NO(
T fov, T width, T height, T near, T far);
/// Builds a perspective projection matrix based on a field of view using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise.
/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
///
/// @param fov Expressed in radians.
/// @param width Width of the viewport
/// @param height Height of the viewport
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovZO(
T fov, T width, T height, T near, T far);
/// Builds a perspective projection matrix based on a field of view using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise.
/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
///
/// @param fov Expressed in radians.
/// @param width Width of the viewport
/// @param height Height of the viewport
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovNO(
T fov, T width, T height, T near, T far);
/// Builds a right handed perspective projection matrix based on a field of view.
/// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
/// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
///
/// @param fov Expressed in radians.
/// @param width Width of the viewport
/// @param height Height of the viewport
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovRH(
T fov, T width, T height, T near, T far);
/// Builds a left handed perspective projection matrix based on a field of view.
/// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
/// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
///
/// @param fov Expressed in radians.
/// @param width Width of the viewport
/// @param height Height of the viewport
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovLH(
T fov, T width, T height, T near, T far);
/// Builds a perspective projection matrix based on a field of view and the default handedness and default near and far clip planes definition.
/// To change default handedness use GLM_FORCE_LEFT_HANDED. To change default near and far clip planes definition use GLM_FORCE_DEPTH_ZERO_TO_ONE.
///
/// @param fov Expressed in radians.
/// @param width Width of the viewport
/// @param height Height of the viewport
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFov(
T fov, T width, T height, T near, T far);
/// Creates a matrix for a left handed, symmetric perspective-view frustum with far plane at infinite.
///
/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.
/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> infinitePerspectiveLH(
T fovy, T aspect, T near);
/// Creates a matrix for a right handed, symmetric perspective-view frustum with far plane at infinite.
///
/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.
/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> infinitePerspectiveRH(
T fovy, T aspect, T near);
/// Creates a matrix for a symmetric perspective-view frustum with far plane at infinite with default handedness.
///
/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.
/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> infinitePerspective(
T fovy, T aspect, T near);
/// Creates a matrix for a symmetric perspective-view frustum with far plane at infinite for graphics hardware that doesn't support depth clamping.
///
/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.
/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> tweakedInfinitePerspective(
T fovy, T aspect, T near);
/// Creates a matrix for a symmetric perspective-view frustum with far plane at infinite for graphics hardware that doesn't support depth clamping.
///
/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.
/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
/// @param ep Epsilon
///
/// @tparam T A floating-point scalar type
template<typename T>
GLM_FUNC_DECL mat<4, 4, T, defaultp> tweakedInfinitePerspective(
T fovy, T aspect, T near, T ep);
/// @}
}//namespace glm
#include "matrix_clip_space.inl"

View file

@ -0,0 +1,555 @@
namespace glm
{
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> ortho(T left, T right, T bottom, T top)
{
mat<4, 4, T, defaultp> Result(static_cast<T>(1));
Result[0][0] = static_cast<T>(2) / (right - left);
Result[1][1] = static_cast<T>(2) / (top - bottom);
Result[2][2] = - static_cast<T>(1);
Result[3][0] = - (right + left) / (right - left);
Result[3][1] = - (top + bottom) / (top - bottom);
return Result;
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> orthoLH_ZO(T left, T right, T bottom, T top, T zNear, T zFar)
{
mat<4, 4, T, defaultp> Result(1);
Result[0][0] = static_cast<T>(2) / (right - left);
Result[1][1] = static_cast<T>(2) / (top - bottom);
Result[2][2] = static_cast<T>(1) / (zFar - zNear);
Result[3][0] = - (right + left) / (right - left);
Result[3][1] = - (top + bottom) / (top - bottom);
Result[3][2] = - zNear / (zFar - zNear);
return Result;
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> orthoLH_NO(T left, T right, T bottom, T top, T zNear, T zFar)
{
mat<4, 4, T, defaultp> Result(1);
Result[0][0] = static_cast<T>(2) / (right - left);
Result[1][1] = static_cast<T>(2) / (top - bottom);
Result[2][2] = static_cast<T>(2) / (zFar - zNear);
Result[3][0] = - (right + left) / (right - left);
Result[3][1] = - (top + bottom) / (top - bottom);
Result[3][2] = - (zFar + zNear) / (zFar - zNear);
return Result;
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> orthoRH_ZO(T left, T right, T bottom, T top, T zNear, T zFar)
{
mat<4, 4, T, defaultp> Result(1);
Result[0][0] = static_cast<T>(2) / (right - left);
Result[1][1] = static_cast<T>(2) / (top - bottom);
Result[2][2] = - static_cast<T>(1) / (zFar - zNear);
Result[3][0] = - (right + left) / (right - left);
Result[3][1] = - (top + bottom) / (top - bottom);
Result[3][2] = - zNear / (zFar - zNear);
return Result;
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> orthoRH_NO(T left, T right, T bottom, T top, T zNear, T zFar)
{
mat<4, 4, T, defaultp> Result(1);
Result[0][0] = static_cast<T>(2) / (right - left);
Result[1][1] = static_cast<T>(2) / (top - bottom);
Result[2][2] = - static_cast<T>(2) / (zFar - zNear);
Result[3][0] = - (right + left) / (right - left);
Result[3][1] = - (top + bottom) / (top - bottom);
Result[3][2] = - (zFar + zNear) / (zFar - zNear);
return Result;
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> orthoZO(T left, T right, T bottom, T top, T zNear, T zFar)
{
# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT
return orthoLH_ZO(left, right, bottom, top, zNear, zFar);
# else
return orthoRH_ZO(left, right, bottom, top, zNear, zFar);
# endif
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> orthoNO(T left, T right, T bottom, T top, T zNear, T zFar)
{
# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT
return orthoLH_NO(left, right, bottom, top, zNear, zFar);
# else
return orthoRH_NO(left, right, bottom, top, zNear, zFar);
# endif
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> orthoLH(T left, T right, T bottom, T top, T zNear, T zFar)
{
# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT
return orthoLH_ZO(left, right, bottom, top, zNear, zFar);
# else
return orthoLH_NO(left, right, bottom, top, zNear, zFar);
# endif
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> orthoRH(T left, T right, T bottom, T top, T zNear, T zFar)
{
# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT
return orthoRH_ZO(left, right, bottom, top, zNear, zFar);
# else
return orthoRH_NO(left, right, bottom, top, zNear, zFar);
# endif
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> ortho(T left, T right, T bottom, T top, T zNear, T zFar)
{
# if GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_ZO
return orthoLH_ZO(left, right, bottom, top, zNear, zFar);
# elif GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_NO
return orthoLH_NO(left, right, bottom, top, zNear, zFar);
# elif GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_ZO
return orthoRH_ZO(left, right, bottom, top, zNear, zFar);
# elif GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_NO
return orthoRH_NO(left, right, bottom, top, zNear, zFar);
# endif
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustumLH_ZO(T left, T right, T bottom, T top, T nearVal, T farVal)
{
mat<4, 4, T, defaultp> Result(0);
Result[0][0] = (static_cast<T>(2) * nearVal) / (right - left);
Result[1][1] = (static_cast<T>(2) * nearVal) / (top - bottom);
Result[2][0] = (right + left) / (right - left);
Result[2][1] = (top + bottom) / (top - bottom);
Result[2][2] = farVal / (farVal - nearVal);
Result[2][3] = static_cast<T>(1);
Result[3][2] = -(farVal * nearVal) / (farVal - nearVal);
return Result;
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustumLH_NO(T left, T right, T bottom, T top, T nearVal, T farVal)
{
mat<4, 4, T, defaultp> Result(0);
Result[0][0] = (static_cast<T>(2) * nearVal) / (right - left);
Result[1][1] = (static_cast<T>(2) * nearVal) / (top - bottom);
Result[2][0] = (right + left) / (right - left);
Result[2][1] = (top + bottom) / (top - bottom);
Result[2][2] = (farVal + nearVal) / (farVal - nearVal);
Result[2][3] = static_cast<T>(1);
Result[3][2] = - (static_cast<T>(2) * farVal * nearVal) / (farVal - nearVal);
return Result;
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustumRH_ZO(T left, T right, T bottom, T top, T nearVal, T farVal)
{
mat<4, 4, T, defaultp> Result(0);
Result[0][0] = (static_cast<T>(2) * nearVal) / (right - left);
Result[1][1] = (static_cast<T>(2) * nearVal) / (top - bottom);
Result[2][0] = (right + left) / (right - left);
Result[2][1] = (top + bottom) / (top - bottom);
Result[2][2] = farVal / (nearVal - farVal);
Result[2][3] = static_cast<T>(-1);
Result[3][2] = -(farVal * nearVal) / (farVal - nearVal);
return Result;
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustumRH_NO(T left, T right, T bottom, T top, T nearVal, T farVal)
{
mat<4, 4, T, defaultp> Result(0);
Result[0][0] = (static_cast<T>(2) * nearVal) / (right - left);
Result[1][1] = (static_cast<T>(2) * nearVal) / (top - bottom);
Result[2][0] = (right + left) / (right - left);
Result[2][1] = (top + bottom) / (top - bottom);
Result[2][2] = - (farVal + nearVal) / (farVal - nearVal);
Result[2][3] = static_cast<T>(-1);
Result[3][2] = - (static_cast<T>(2) * farVal * nearVal) / (farVal - nearVal);
return Result;
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustumZO(T left, T right, T bottom, T top, T nearVal, T farVal)
{
# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT
return frustumLH_ZO(left, right, bottom, top, nearVal, farVal);
# else
return frustumRH_ZO(left, right, bottom, top, nearVal, farVal);
# endif
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustumNO(T left, T right, T bottom, T top, T nearVal, T farVal)
{
# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT
return frustumLH_NO(left, right, bottom, top, nearVal, farVal);
# else
return frustumRH_NO(left, right, bottom, top, nearVal, farVal);
# endif
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustumLH(T left, T right, T bottom, T top, T nearVal, T farVal)
{
# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT
return frustumLH_ZO(left, right, bottom, top, nearVal, farVal);
# else
return frustumLH_NO(left, right, bottom, top, nearVal, farVal);
# endif
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustumRH(T left, T right, T bottom, T top, T nearVal, T farVal)
{
# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT
return frustumRH_ZO(left, right, bottom, top, nearVal, farVal);
# else
return frustumRH_NO(left, right, bottom, top, nearVal, farVal);
# endif
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustum(T left, T right, T bottom, T top, T nearVal, T farVal)
{
# if GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_ZO
return frustumLH_ZO(left, right, bottom, top, nearVal, farVal);
# elif GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_NO
return frustumLH_NO(left, right, bottom, top, nearVal, farVal);
# elif GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_ZO
return frustumRH_ZO(left, right, bottom, top, nearVal, farVal);
# elif GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_NO
return frustumRH_NO(left, right, bottom, top, nearVal, farVal);
# endif
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveRH_ZO(T fovy, T aspect, T zNear, T zFar)
{
assert(abs(aspect - std::numeric_limits<T>::epsilon()) > static_cast<T>(0));
T const tanHalfFovy = tan(fovy / static_cast<T>(2));
mat<4, 4, T, defaultp> Result(static_cast<T>(0));
Result[0][0] = static_cast<T>(1) / (aspect * tanHalfFovy);
Result[1][1] = static_cast<T>(1) / (tanHalfFovy);
Result[2][2] = zFar / (zNear - zFar);
Result[2][3] = - static_cast<T>(1);
Result[3][2] = -(zFar * zNear) / (zFar - zNear);
return Result;
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveRH_NO(T fovy, T aspect, T zNear, T zFar)
{
assert(abs(aspect - std::numeric_limits<T>::epsilon()) > static_cast<T>(0));
T const tanHalfFovy = tan(fovy / static_cast<T>(2));
mat<4, 4, T, defaultp> Result(static_cast<T>(0));
Result[0][0] = static_cast<T>(1) / (aspect * tanHalfFovy);
Result[1][1] = static_cast<T>(1) / (tanHalfFovy);
Result[2][2] = - (zFar + zNear) / (zFar - zNear);
Result[2][3] = - static_cast<T>(1);
Result[3][2] = - (static_cast<T>(2) * zFar * zNear) / (zFar - zNear);
return Result;
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveLH_ZO(T fovy, T aspect, T zNear, T zFar)
{
assert(abs(aspect - std::numeric_limits<T>::epsilon()) > static_cast<T>(0));
T const tanHalfFovy = tan(fovy / static_cast<T>(2));
mat<4, 4, T, defaultp> Result(static_cast<T>(0));
Result[0][0] = static_cast<T>(1) / (aspect * tanHalfFovy);
Result[1][1] = static_cast<T>(1) / (tanHalfFovy);
Result[2][2] = zFar / (zFar - zNear);
Result[2][3] = static_cast<T>(1);
Result[3][2] = -(zFar * zNear) / (zFar - zNear);
return Result;
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveLH_NO(T fovy, T aspect, T zNear, T zFar)
{
assert(abs(aspect - std::numeric_limits<T>::epsilon()) > static_cast<T>(0));
T const tanHalfFovy = tan(fovy / static_cast<T>(2));
mat<4, 4, T, defaultp> Result(static_cast<T>(0));
Result[0][0] = static_cast<T>(1) / (aspect * tanHalfFovy);
Result[1][1] = static_cast<T>(1) / (tanHalfFovy);
Result[2][2] = (zFar + zNear) / (zFar - zNear);
Result[2][3] = static_cast<T>(1);
Result[3][2] = - (static_cast<T>(2) * zFar * zNear) / (zFar - zNear);
return Result;
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveZO(T fovy, T aspect, T zNear, T zFar)
{
# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT
return perspectiveLH_ZO(fovy, aspect, zNear, zFar);
# else
return perspectiveRH_ZO(fovy, aspect, zNear, zFar);
# endif
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveNO(T fovy, T aspect, T zNear, T zFar)
{
# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT
return perspectiveLH_NO(fovy, aspect, zNear, zFar);
# else
return perspectiveRH_NO(fovy, aspect, zNear, zFar);
# endif
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveLH(T fovy, T aspect, T zNear, T zFar)
{
# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT
return perspectiveLH_ZO(fovy, aspect, zNear, zFar);
# else
return perspectiveLH_NO(fovy, aspect, zNear, zFar);
# endif
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveRH(T fovy, T aspect, T zNear, T zFar)
{
# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT
return perspectiveRH_ZO(fovy, aspect, zNear, zFar);
# else
return perspectiveRH_NO(fovy, aspect, zNear, zFar);
# endif
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspective(T fovy, T aspect, T zNear, T zFar)
{
# if GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_ZO
return perspectiveLH_ZO(fovy, aspect, zNear, zFar);
# elif GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_NO
return perspectiveLH_NO(fovy, aspect, zNear, zFar);
# elif GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_ZO
return perspectiveRH_ZO(fovy, aspect, zNear, zFar);
# elif GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_NO
return perspectiveRH_NO(fovy, aspect, zNear, zFar);
# endif
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFovRH_ZO(T fov, T width, T height, T zNear, T zFar)
{
assert(width > static_cast<T>(0));
assert(height > static_cast<T>(0));
assert(fov > static_cast<T>(0));
T const rad = fov;
T const h = glm::cos(static_cast<T>(0.5) * rad) / glm::sin(static_cast<T>(0.5) * rad);
T const w = h * height / width; ///todo max(width , Height) / min(width , Height)?
mat<4, 4, T, defaultp> Result(static_cast<T>(0));
Result[0][0] = w;
Result[1][1] = h;
Result[2][2] = zFar / (zNear - zFar);
Result[2][3] = - static_cast<T>(1);
Result[3][2] = -(zFar * zNear) / (zFar - zNear);
return Result;
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFovRH_NO(T fov, T width, T height, T zNear, T zFar)
{
assert(width > static_cast<T>(0));
assert(height > static_cast<T>(0));
assert(fov > static_cast<T>(0));
T const rad = fov;
T const h = glm::cos(static_cast<T>(0.5) * rad) / glm::sin(static_cast<T>(0.5) * rad);
T const w = h * height / width; ///todo max(width , Height) / min(width , Height)?
mat<4, 4, T, defaultp> Result(static_cast<T>(0));
Result[0][0] = w;
Result[1][1] = h;
Result[2][2] = - (zFar + zNear) / (zFar - zNear);
Result[2][3] = - static_cast<T>(1);
Result[3][2] = - (static_cast<T>(2) * zFar * zNear) / (zFar - zNear);
return Result;
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFovLH_ZO(T fov, T width, T height, T zNear, T zFar)
{
assert(width > static_cast<T>(0));
assert(height > static_cast<T>(0));
assert(fov > static_cast<T>(0));
T const rad = fov;
T const h = glm::cos(static_cast<T>(0.5) * rad) / glm::sin(static_cast<T>(0.5) * rad);
T const w = h * height / width; ///todo max(width , Height) / min(width , Height)?
mat<4, 4, T, defaultp> Result(static_cast<T>(0));
Result[0][0] = w;
Result[1][1] = h;
Result[2][2] = zFar / (zFar - zNear);
Result[2][3] = static_cast<T>(1);
Result[3][2] = -(zFar * zNear) / (zFar - zNear);
return Result;
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFovLH_NO(T fov, T width, T height, T zNear, T zFar)
{
assert(width > static_cast<T>(0));
assert(height > static_cast<T>(0));
assert(fov > static_cast<T>(0));
T const rad = fov;
T const h = glm::cos(static_cast<T>(0.5) * rad) / glm::sin(static_cast<T>(0.5) * rad);
T const w = h * height / width; ///todo max(width , Height) / min(width , Height)?
mat<4, 4, T, defaultp> Result(static_cast<T>(0));
Result[0][0] = w;
Result[1][1] = h;
Result[2][2] = (zFar + zNear) / (zFar - zNear);
Result[2][3] = static_cast<T>(1);
Result[3][2] = - (static_cast<T>(2) * zFar * zNear) / (zFar - zNear);
return Result;
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFovZO(T fov, T width, T height, T zNear, T zFar)
{
# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT
return perspectiveFovLH_ZO(fov, width, height, zNear, zFar);
# else
return perspectiveFovRH_ZO(fov, width, height, zNear, zFar);
# endif
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFovNO(T fov, T width, T height, T zNear, T zFar)
{
# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT
return perspectiveFovLH_NO(fov, width, height, zNear, zFar);
# else
return perspectiveFovRH_NO(fov, width, height, zNear, zFar);
# endif
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFovLH(T fov, T width, T height, T zNear, T zFar)
{
# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT
return perspectiveFovLH_ZO(fov, width, height, zNear, zFar);
# else
return perspectiveFovLH_NO(fov, width, height, zNear, zFar);
# endif
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFovRH(T fov, T width, T height, T zNear, T zFar)
{
# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT
return perspectiveFovRH_ZO(fov, width, height, zNear, zFar);
# else
return perspectiveFovRH_NO(fov, width, height, zNear, zFar);
# endif
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFov(T fov, T width, T height, T zNear, T zFar)
{
# if GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_ZO
return perspectiveFovLH_ZO(fov, width, height, zNear, zFar);
# elif GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_LH_NO
return perspectiveFovLH_NO(fov, width, height, zNear, zFar);
# elif GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_ZO
return perspectiveFovRH_ZO(fov, width, height, zNear, zFar);
# elif GLM_CONFIG_CLIP_CONTROL == GLM_CLIP_CONTROL_RH_NO
return perspectiveFovRH_NO(fov, width, height, zNear, zFar);
# endif
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> infinitePerspectiveRH(T fovy, T aspect, T zNear)
{
T const range = tan(fovy / static_cast<T>(2)) * zNear;
T const left = -range * aspect;
T const right = range * aspect;
T const bottom = -range;
T const top = range;
mat<4, 4, T, defaultp> Result(static_cast<T>(0));
Result[0][0] = (static_cast<T>(2) * zNear) / (right - left);
Result[1][1] = (static_cast<T>(2) * zNear) / (top - bottom);
Result[2][2] = - static_cast<T>(1);
Result[2][3] = - static_cast<T>(1);
Result[3][2] = - static_cast<T>(2) * zNear;
return Result;
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> infinitePerspectiveLH(T fovy, T aspect, T zNear)
{
T const range = tan(fovy / static_cast<T>(2)) * zNear;
T const left = -range * aspect;
T const right = range * aspect;
T const bottom = -range;
T const top = range;
mat<4, 4, T, defaultp> Result(T(0));
Result[0][0] = (static_cast<T>(2) * zNear) / (right - left);
Result[1][1] = (static_cast<T>(2) * zNear) / (top - bottom);
Result[2][2] = static_cast<T>(1);
Result[2][3] = static_cast<T>(1);
Result[3][2] = - static_cast<T>(2) * zNear;
return Result;
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> infinitePerspective(T fovy, T aspect, T zNear)
{
# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT
return infinitePerspectiveLH(fovy, aspect, zNear);
# else
return infinitePerspectiveRH(fovy, aspect, zNear);
# endif
}
// Infinite projection matrix: http://www.terathon.com/gdc07_lengyel.pdf
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> tweakedInfinitePerspective(T fovy, T aspect, T zNear, T ep)
{
T const range = tan(fovy / static_cast<T>(2)) * zNear;
T const left = -range * aspect;
T const right = range * aspect;
T const bottom = -range;
T const top = range;
mat<4, 4, T, defaultp> Result(static_cast<T>(0));
Result[0][0] = (static_cast<T>(2) * zNear) / (right - left);
Result[1][1] = (static_cast<T>(2) * zNear) / (top - bottom);
Result[2][2] = ep - static_cast<T>(1);
Result[2][3] = static_cast<T>(-1);
Result[3][2] = (ep - static_cast<T>(2)) * zNear;
return Result;
}
template<typename T>
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> tweakedInfinitePerspective(T fovy, T aspect, T zNear)
{
return tweakedInfinitePerspective(fovy, aspect, zNear, epsilon<T>());
}
}//namespace glm

View file

@ -0,0 +1,36 @@
/// @ref ext_matrix_common
/// @file glm/ext/matrix_common.hpp
///
/// @defgroup ext_matrix_common GLM_EXT_matrix_common
/// @ingroup ext
///
/// Defines functions for common matrix operations.
///
/// Include <glm/ext/matrix_common.hpp> to use the features of this extension.
///
/// @see ext_matrix_common
#pragma once
#include "../detail/qualifier.hpp"
#include "../detail/_fixes.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_transform extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_common
/// @{
template<length_t C, length_t R, typename T, typename U, qualifier Q>
GLM_FUNC_DECL mat<C, R, T, Q> mix(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y, mat<C, R, U, Q> const& a);
template<length_t C, length_t R, typename T, typename U, qualifier Q>
GLM_FUNC_DECL mat<C, R, T, Q> mix(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y, U a);
/// @}
}//namespace glm
#include "matrix_common.inl"

View file

@ -0,0 +1,16 @@
#include "../matrix.hpp"
namespace glm
{
template<length_t C, length_t R, typename T, typename U, qualifier Q>
GLM_FUNC_QUALIFIER mat<C, R, T, Q> mix(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y, U a)
{
return mat<C, R, U, Q>(x) * (static_cast<U>(1) - a) + mat<C, R, U, Q>(y) * a;
}
template<length_t C, length_t R, typename T, typename U, qualifier Q>
GLM_FUNC_QUALIFIER mat<C, R, T, Q> mix(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y, mat<C, R, U, Q> const& a)
{
return matrixCompMult(mat<C, R, U, Q>(x), static_cast<U>(1) - a) + matrixCompMult(mat<C, R, U, Q>(y), a);
}
}//namespace glm

View file

@ -0,0 +1,23 @@
/// @ref core
/// @file glm/ext/matrix_double2x2.hpp
#pragma once
#include "../detail/type_mat2x2.hpp"
namespace glm
{
/// @addtogroup core_matrix
/// @{
/// 2 columns of 2 components matrix of double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mat<2, 2, double, defaultp> dmat2x2;
/// 2 columns of 2 components matrix of double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mat<2, 2, double, defaultp> dmat2;
/// @}
}//namespace glm

View file

@ -0,0 +1,49 @@
/// @ref core
/// @file glm/ext/matrix_double2x2_precision.hpp
#pragma once
#include "../detail/type_mat2x2.hpp"
namespace glm
{
/// @addtogroup core_matrix_precision
/// @{
/// 2 columns of 2 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<2, 2, double, lowp> lowp_dmat2;
/// 2 columns of 2 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<2, 2, double, mediump> mediump_dmat2;
/// 2 columns of 2 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<2, 2, double, highp> highp_dmat2;
/// 2 columns of 2 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<2, 2, double, lowp> lowp_dmat2x2;
/// 2 columns of 2 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<2, 2, double, mediump> mediump_dmat2x2;
/// 2 columns of 2 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<2, 2, double, highp> highp_dmat2x2;
/// @}
}//namespace glm

View file

@ -0,0 +1,18 @@
/// @ref core
/// @file glm/ext/matrix_double2x3.hpp
#pragma once
#include "../detail/type_mat2x3.hpp"
namespace glm
{
/// @addtogroup core_matrix
/// @{
/// 2 columns of 3 components matrix of double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mat<2, 3, double, defaultp> dmat2x3;
/// @}
}//namespace glm

View file

@ -0,0 +1,31 @@
/// @ref core
/// @file glm/ext/matrix_double2x3_precision.hpp
#pragma once
#include "../detail/type_mat2x3.hpp"
namespace glm
{
/// @addtogroup core_matrix_precision
/// @{
/// 2 columns of 3 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<2, 3, double, lowp> lowp_dmat2x3;
/// 2 columns of 3 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<2, 3, double, mediump> mediump_dmat2x3;
/// 2 columns of 3 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<2, 3, double, highp> highp_dmat2x3;
/// @}
}//namespace glm

View file

@ -0,0 +1,18 @@
/// @ref core
/// @file glm/ext/matrix_double2x4.hpp
#pragma once
#include "../detail/type_mat2x4.hpp"
namespace glm
{
/// @addtogroup core_matrix
/// @{
/// 2 columns of 4 components matrix of double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mat<2, 4, double, defaultp> dmat2x4;
/// @}
}//namespace glm

View file

@ -0,0 +1,31 @@
/// @ref core
/// @file glm/ext/matrix_double2x4_precision.hpp
#pragma once
#include "../detail/type_mat2x4.hpp"
namespace glm
{
/// @addtogroup core_matrix_precision
/// @{
/// 2 columns of 4 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<2, 4, double, lowp> lowp_dmat2x4;
/// 2 columns of 4 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<2, 4, double, mediump> mediump_dmat2x4;
/// 2 columns of 4 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<2, 4, double, highp> highp_dmat2x4;
/// @}
}//namespace glm

View file

@ -0,0 +1,18 @@
/// @ref core
/// @file glm/ext/matrix_double3x2.hpp
#pragma once
#include "../detail/type_mat3x2.hpp"
namespace glm
{
/// @addtogroup core_matrix
/// @{
/// 3 columns of 2 components matrix of double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mat<3, 2, double, defaultp> dmat3x2;
/// @}
}//namespace glm

View file

@ -0,0 +1,31 @@
/// @ref core
/// @file glm/ext/matrix_double3x2_precision.hpp
#pragma once
#include "../detail/type_mat3x2.hpp"
namespace glm
{
/// @addtogroup core_matrix_precision
/// @{
/// 3 columns of 2 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<3, 2, double, lowp> lowp_dmat3x2;
/// 3 columns of 2 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<3, 2, double, mediump> mediump_dmat3x2;
/// 3 columns of 2 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<3, 2, double, highp> highp_dmat3x2;
/// @}
}//namespace glm

View file

@ -0,0 +1,23 @@
/// @ref core
/// @file glm/ext/matrix_double3x3.hpp
#pragma once
#include "../detail/type_mat3x3.hpp"
namespace glm
{
/// @addtogroup core_matrix
/// @{
/// 3 columns of 3 components matrix of double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mat<3, 3, double, defaultp> dmat3x3;
/// 3 columns of 3 components matrix of double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mat<3, 3, double, defaultp> dmat3;
/// @}
}//namespace glm

View file

@ -0,0 +1,49 @@
/// @ref core
/// @file glm/ext/matrix_double3x3_precision.hpp
#pragma once
#include "../detail/type_mat3x3.hpp"
namespace glm
{
/// @addtogroup core_matrix_precision
/// @{
/// 3 columns of 3 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<3, 3, double, lowp> lowp_dmat3;
/// 3 columns of 3 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<3, 3, double, mediump> mediump_dmat3;
/// 3 columns of 3 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<3, 3, double, highp> highp_dmat3;
/// 3 columns of 3 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<3, 3, double, lowp> lowp_dmat3x3;
/// 3 columns of 3 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<3, 3, double, mediump> mediump_dmat3x3;
/// 3 columns of 3 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<3, 3, double, highp> highp_dmat3x3;
/// @}
}//namespace glm

View file

@ -0,0 +1,18 @@
/// @ref core
/// @file glm/ext/matrix_double3x4.hpp
#pragma once
#include "../detail/type_mat3x4.hpp"
namespace glm
{
/// @addtogroup core_matrix
/// @{
/// 3 columns of 4 components matrix of double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mat<3, 4, double, defaultp> dmat3x4;
/// @}
}//namespace glm

View file

@ -0,0 +1,31 @@
/// @ref core
/// @file glm/ext/matrix_double3x4_precision.hpp
#pragma once
#include "../detail/type_mat3x4.hpp"
namespace glm
{
/// @addtogroup core_matrix_precision
/// @{
/// 3 columns of 4 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<3, 4, double, lowp> lowp_dmat3x4;
/// 3 columns of 4 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<3, 4, double, mediump> mediump_dmat3x4;
/// 3 columns of 4 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<3, 4, double, highp> highp_dmat3x4;
/// @}
}//namespace glm

View file

@ -0,0 +1,18 @@
/// @ref core
/// @file glm/ext/matrix_double4x2.hpp
#pragma once
#include "../detail/type_mat4x2.hpp"
namespace glm
{
/// @addtogroup core_matrix
/// @{
/// 4 columns of 2 components matrix of double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mat<4, 2, double, defaultp> dmat4x2;
/// @}
}//namespace glm

View file

@ -0,0 +1,31 @@
/// @ref core
/// @file glm/ext/matrix_double4x2_precision.hpp
#pragma once
#include "../detail/type_mat4x2.hpp"
namespace glm
{
/// @addtogroup core_matrix_precision
/// @{
/// 4 columns of 2 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<4, 2, double, lowp> lowp_dmat4x2;
/// 4 columns of 2 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<4, 2, double, mediump> mediump_dmat4x2;
/// 4 columns of 2 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<4, 2, double, highp> highp_dmat4x2;
/// @}
}//namespace glm

View file

@ -0,0 +1,18 @@
/// @ref core
/// @file glm/ext/matrix_double4x3.hpp
#pragma once
#include "../detail/type_mat4x3.hpp"
namespace glm
{
/// @addtogroup core_matrix
/// @{
/// 4 columns of 3 components matrix of double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mat<4, 3, double, defaultp> dmat4x3;
/// @}
}//namespace glm

View file

@ -0,0 +1,31 @@
/// @ref core
/// @file glm/ext/matrix_double4x3_precision.hpp
#pragma once
#include "../detail/type_mat4x3.hpp"
namespace glm
{
/// @addtogroup core_matrix_precision
/// @{
/// 4 columns of 3 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<4, 3, double, lowp> lowp_dmat4x3;
/// 4 columns of 3 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<4, 3, double, mediump> mediump_dmat4x3;
/// 4 columns of 3 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<4, 3, double, highp> highp_dmat4x3;
/// @}
}//namespace glm

View file

@ -0,0 +1,23 @@
/// @ref core
/// @file glm/ext/matrix_double4x4.hpp
#pragma once
#include "../detail/type_mat4x4.hpp"
namespace glm
{
/// @addtogroup core_matrix
/// @{
/// 4 columns of 4 components matrix of double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mat<4, 4, double, defaultp> dmat4x4;
/// 4 columns of 4 components matrix of double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mat<4, 4, double, defaultp> dmat4;
/// @}
}//namespace glm

View file

@ -0,0 +1,49 @@
/// @ref core
/// @file glm/ext/matrix_double4x4_precision.hpp
#pragma once
#include "../detail/type_mat4x4.hpp"
namespace glm
{
/// @addtogroup core_matrix_precision
/// @{
/// 4 columns of 4 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<4, 4, double, lowp> lowp_dmat4;
/// 4 columns of 4 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<4, 4, double, mediump> mediump_dmat4;
/// 4 columns of 4 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<4, 4, double, highp> highp_dmat4;
/// 4 columns of 4 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<4, 4, double, lowp> lowp_dmat4x4;
/// 4 columns of 4 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<4, 4, double, mediump> mediump_dmat4x4;
/// 4 columns of 4 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<4, 4, double, highp> highp_dmat4x4;
/// @}
}//namespace glm

View file

@ -0,0 +1,23 @@
/// @ref core
/// @file glm/ext/matrix_float2x2.hpp
#pragma once
#include "../detail/type_mat2x2.hpp"
namespace glm
{
/// @addtogroup core_matrix
/// @{
/// 2 columns of 2 components matrix of single-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mat<2, 2, float, defaultp> mat2x2;
/// 2 columns of 2 components matrix of single-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mat<2, 2, float, defaultp> mat2;
/// @}
}//namespace glm

View file

@ -0,0 +1,49 @@
/// @ref core
/// @file glm/ext/matrix_float2x2_precision.hpp
#pragma once
#include "../detail/type_mat2x2.hpp"
namespace glm
{
/// @addtogroup core_matrix_precision
/// @{
/// 2 columns of 2 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<2, 2, float, lowp> lowp_mat2;
/// 2 columns of 2 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<2, 2, float, mediump> mediump_mat2;
/// 2 columns of 2 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<2, 2, float, highp> highp_mat2;
/// 2 columns of 2 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<2, 2, float, lowp> lowp_mat2x2;
/// 2 columns of 2 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<2, 2, float, mediump> mediump_mat2x2;
/// 2 columns of 2 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<2, 2, float, highp> highp_mat2x2;
/// @}
}//namespace glm

View file

@ -0,0 +1,18 @@
/// @ref core
/// @file glm/ext/matrix_float2x3.hpp
#pragma once
#include "../detail/type_mat2x3.hpp"
namespace glm
{
/// @addtogroup core_matrix
/// @{
/// 2 columns of 3 components matrix of single-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mat<2, 3, float, defaultp> mat2x3;
/// @}
}//namespace glm

View file

@ -0,0 +1,31 @@
/// @ref core
/// @file glm/ext/matrix_float2x3_precision.hpp
#pragma once
#include "../detail/type_mat2x3.hpp"
namespace glm
{
/// @addtogroup core_matrix_precision
/// @{
/// 2 columns of 3 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<2, 3, float, lowp> lowp_mat2x3;
/// 2 columns of 3 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<2, 3, float, mediump> mediump_mat2x3;
/// 2 columns of 3 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<2, 3, float, highp> highp_mat2x3;
/// @}
}//namespace glm

View file

@ -0,0 +1,18 @@
/// @ref core
/// @file glm/ext/matrix_float2x4.hpp
#pragma once
#include "../detail/type_mat2x4.hpp"
namespace glm
{
/// @addtogroup core_matrix
/// @{
/// 2 columns of 4 components matrix of single-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mat<2, 4, float, defaultp> mat2x4;
/// @}
}//namespace glm

View file

@ -0,0 +1,31 @@
/// @ref core
/// @file glm/ext/matrix_float2x4_precision.hpp
#pragma once
#include "../detail/type_mat2x4.hpp"
namespace glm
{
/// @addtogroup core_matrix_precision
/// @{
/// 2 columns of 4 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<2, 4, float, lowp> lowp_mat2x4;
/// 2 columns of 4 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<2, 4, float, mediump> mediump_mat2x4;
/// 2 columns of 4 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<2, 4, float, highp> highp_mat2x4;
/// @}
}//namespace glm

View file

@ -0,0 +1,18 @@
/// @ref core
/// @file glm/ext/matrix_float3x2.hpp
#pragma once
#include "../detail/type_mat3x2.hpp"
namespace glm
{
/// @addtogroup core
/// @{
/// 3 columns of 2 components matrix of single-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mat<3, 2, float, defaultp> mat3x2;
/// @}
}//namespace glm

View file

@ -0,0 +1,31 @@
/// @ref core
/// @file glm/ext/matrix_float3x2_precision.hpp
#pragma once
#include "../detail/type_mat3x2.hpp"
namespace glm
{
/// @addtogroup core_matrix_precision
/// @{
/// 3 columns of 2 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<3, 2, float, lowp> lowp_mat3x2;
/// 3 columns of 2 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<3, 2, float, mediump> mediump_mat3x2;
/// 3 columns of 2 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<3, 2, float, highp> highp_mat3x2;
/// @}
}//namespace glm

View file

@ -0,0 +1,23 @@
/// @ref core
/// @file glm/ext/matrix_float3x3.hpp
#pragma once
#include "../detail/type_mat3x3.hpp"
namespace glm
{
/// @addtogroup core_matrix
/// @{
/// 3 columns of 3 components matrix of single-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mat<3, 3, float, defaultp> mat3x3;
/// 3 columns of 3 components matrix of single-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mat<3, 3, float, defaultp> mat3;
/// @}
}//namespace glm

View file

@ -0,0 +1,49 @@
/// @ref core
/// @file glm/ext/matrix_float3x3_precision.hpp
#pragma once
#include "../detail/type_mat3x3.hpp"
namespace glm
{
/// @addtogroup core_matrix_precision
/// @{
/// 3 columns of 3 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<3, 3, float, lowp> lowp_mat3;
/// 3 columns of 3 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<3, 3, float, mediump> mediump_mat3;
/// 3 columns of 3 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<3, 3, float, highp> highp_mat3;
/// 3 columns of 3 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<3, 3, float, lowp> lowp_mat3x3;
/// 3 columns of 3 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<3, 3, float, mediump> mediump_mat3x3;
/// 3 columns of 3 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<3, 3, float, highp> highp_mat3x3;
/// @}
}//namespace glm

View file

@ -0,0 +1,18 @@
/// @ref core
/// @file glm/ext/matrix_float3x4.hpp
#pragma once
#include "../detail/type_mat3x4.hpp"
namespace glm
{
/// @addtogroup core_matrix
/// @{
/// 3 columns of 4 components matrix of single-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mat<3, 4, float, defaultp> mat3x4;
/// @}
}//namespace glm

View file

@ -0,0 +1,31 @@
/// @ref core
/// @file glm/ext/matrix_float3x4_precision.hpp
#pragma once
#include "../detail/type_mat3x4.hpp"
namespace glm
{
/// @addtogroup core_matrix_precision
/// @{
/// 3 columns of 4 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<3, 4, float, lowp> lowp_mat3x4;
/// 3 columns of 4 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<3, 4, float, mediump> mediump_mat3x4;
/// 3 columns of 4 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<3, 4, float, highp> highp_mat3x4;
/// @}
}//namespace glm

View file

@ -0,0 +1,18 @@
/// @ref core
/// @file glm/ext/matrix_float4x2.hpp
#pragma once
#include "../detail/type_mat4x2.hpp"
namespace glm
{
/// @addtogroup core_matrix
/// @{
/// 4 columns of 2 components matrix of single-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mat<4, 2, float, defaultp> mat4x2;
/// @}
}//namespace glm

View file

@ -0,0 +1,31 @@
/// @ref core
/// @file glm/ext/matrix_float2x2_precision.hpp
#pragma once
#include "../detail/type_mat2x2.hpp"
namespace glm
{
/// @addtogroup core_matrix_precision
/// @{
/// 4 columns of 2 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<4, 2, float, lowp> lowp_mat4x2;
/// 4 columns of 2 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<4, 2, float, mediump> mediump_mat4x2;
/// 4 columns of 2 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<4, 2, float, highp> highp_mat4x2;
/// @}
}//namespace glm

View file

@ -0,0 +1,18 @@
/// @ref core
/// @file glm/ext/matrix_float4x3.hpp
#pragma once
#include "../detail/type_mat4x3.hpp"
namespace glm
{
/// @addtogroup core_matrix
/// @{
/// 4 columns of 3 components matrix of single-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mat<4, 3, float, defaultp> mat4x3;
/// @}
}//namespace glm

View file

@ -0,0 +1,31 @@
/// @ref core
/// @file glm/ext/matrix_float4x3_precision.hpp
#pragma once
#include "../detail/type_mat4x3.hpp"
namespace glm
{
/// @addtogroup core_matrix_precision
/// @{
/// 4 columns of 3 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<4, 3, float, lowp> lowp_mat4x3;
/// 4 columns of 3 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<4, 3, float, mediump> mediump_mat4x3;
/// 4 columns of 3 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<4, 3, float, highp> highp_mat4x3;
/// @}
}//namespace glm

View file

@ -0,0 +1,23 @@
/// @ref core
/// @file glm/ext/matrix_float4x4.hpp
#pragma once
#include "../detail/type_mat4x4.hpp"
namespace glm
{
/// @ingroup core_matrix
/// @{
/// 4 columns of 4 components matrix of single-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mat<4, 4, float, defaultp> mat4x4;
/// 4 columns of 4 components matrix of single-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mat<4, 4, float, defaultp> mat4;
/// @}
}//namespace glm

View file

@ -0,0 +1,49 @@
/// @ref core
/// @file glm/ext/matrix_float4x4_precision.hpp
#pragma once
#include "../detail/type_mat4x4.hpp"
namespace glm
{
/// @addtogroup core_matrix_precision
/// @{
/// 4 columns of 4 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<4, 4, float, lowp> lowp_mat4;
/// 4 columns of 4 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<4, 4, float, mediump> mediump_mat4;
/// 4 columns of 4 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<4, 4, float, highp> highp_mat4;
/// 4 columns of 4 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<4, 4, float, lowp> lowp_mat4x4;
/// 4 columns of 4 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<4, 4, float, mediump> mediump_mat4x4;
/// 4 columns of 4 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef mat<4, 4, float, highp> highp_mat4x4;
/// @}
}//namespace glm

View file

@ -0,0 +1,38 @@
/// @ref ext_matrix_int2x2
/// @file glm/ext/matrix_int2x2.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_int2x2 GLM_EXT_matrix_int2x2
/// @ingroup ext
///
/// Include <glm/ext/matrix_int2x2.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat2x2.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_int2x2 extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_int2x2
/// @{
/// Signed integer 2x2 matrix.
///
/// @see ext_matrix_int2x2
typedef mat<2, 2, int, defaultp> imat2x2;
/// Signed integer 2x2 matrix.
///
/// @see ext_matrix_int2x2
typedef mat<2, 2, int, defaultp> imat2;
/// @}
}//namespace glm

View file

@ -0,0 +1,70 @@
/// @ref ext_matrix_int2x2_sized
/// @file glm/ext/matrix_int2x2_sized.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_int2x2_sized GLM_EXT_matrix_int2x2_sized
/// @ingroup ext
///
/// Include <glm/ext/matrix_int2x2_sized.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat2x2.hpp"
#include "../ext/scalar_int_sized.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_int2x2_sized extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_int2x2_sized
/// @{
/// 8 bit signed integer 2x2 matrix.
///
/// @see ext_matrix_int2x2_sized
typedef mat<2, 2, int8, defaultp> i8mat2x2;
/// 16 bit signed integer 2x2 matrix.
///
/// @see ext_matrix_int2x2_sized
typedef mat<2, 2, int16, defaultp> i16mat2x2;
/// 32 bit signed integer 2x2 matrix.
///
/// @see ext_matrix_int2x2_sized
typedef mat<2, 2, int32, defaultp> i32mat2x2;
/// 64 bit signed integer 2x2 matrix.
///
/// @see ext_matrix_int2x2_sized
typedef mat<2, 2, int64, defaultp> i64mat2x2;
/// 8 bit signed integer 2x2 matrix.
///
/// @see ext_matrix_int2x2_sized
typedef mat<2, 2, int8, defaultp> i8mat2;
/// 16 bit signed integer 2x2 matrix.
///
/// @see ext_matrix_int2x2_sized
typedef mat<2, 2, int16, defaultp> i16mat2;
/// 32 bit signed integer 2x2 matrix.
///
/// @see ext_matrix_int2x2_sized
typedef mat<2, 2, int32, defaultp> i32mat2;
/// 64 bit signed integer 2x2 matrix.
///
/// @see ext_matrix_int2x2_sized
typedef mat<2, 2, int64, defaultp> i64mat2;
/// @}
}//namespace glm

View file

@ -0,0 +1,33 @@
/// @ref ext_matrix_int2x3
/// @file glm/ext/matrix_int2x3.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_int2x3 GLM_EXT_matrix_int2x3
/// @ingroup ext
///
/// Include <glm/ext/matrix_int2x3.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat2x3.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_int2x3 extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_int2x3
/// @{
/// Signed integer 2x3 matrix.
///
/// @see ext_matrix_int2x3
typedef mat<2, 3, int, defaultp> imat2x3;
/// @}
}//namespace glm

View file

@ -0,0 +1,49 @@
/// @ref ext_matrix_int2x3_sized
/// @file glm/ext/matrix_int2x3_sized.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_int2x3_sized GLM_EXT_matrix_int2x3_sized
/// @ingroup ext
///
/// Include <glm/ext/matrix_int2x3_sized.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat2x3.hpp"
#include "../ext/scalar_int_sized.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_int2x3_sized extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_int2x3_sized
/// @{
/// 8 bit signed integer 2x3 matrix.
///
/// @see ext_matrix_int2x3_sized
typedef mat<2, 3, int8, defaultp> i8mat2x3;
/// 16 bit signed integer 2x3 matrix.
///
/// @see ext_matrix_int2x3_sized
typedef mat<2, 3, int16, defaultp> i16mat2x3;
/// 32 bit signed integer 2x3 matrix.
///
/// @see ext_matrix_int2x3_sized
typedef mat<2, 3, int32, defaultp> i32mat2x3;
/// 64 bit signed integer 2x3 matrix.
///
/// @see ext_matrix_int2x3_sized
typedef mat<2, 3, int64, defaultp> i64mat2x3;
/// @}
}//namespace glm

View file

@ -0,0 +1,33 @@
/// @ref ext_matrix_int2x4
/// @file glm/ext/matrix_int2x4.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_int2x4 GLM_EXT_matrix_int2x4
/// @ingroup ext
///
/// Include <glm/ext/matrix_int2x4.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat2x4.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_int2x4 extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_int2x4
/// @{
/// Signed integer 2x4 matrix.
///
/// @see ext_matrix_int2x4
typedef mat<2, 4, int, defaultp> imat2x4;
/// @}
}//namespace glm

View file

@ -0,0 +1,49 @@
/// @ref ext_matrix_int2x4_sized
/// @file glm/ext/matrix_int2x4_sized.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_int2x4_sized GLM_EXT_matrix_int2x4_sized
/// @ingroup ext
///
/// Include <glm/ext/matrix_int2x4_sized.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat2x4.hpp"
#include "../ext/scalar_int_sized.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_int2x4_sized extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_int2x4_sized
/// @{
/// 8 bit signed integer 2x4 matrix.
///
/// @see ext_matrix_int2x4_sized
typedef mat<2, 4, int8, defaultp> i8mat2x4;
/// 16 bit signed integer 2x4 matrix.
///
/// @see ext_matrix_int2x4_sized
typedef mat<2, 4, int16, defaultp> i16mat2x4;
/// 32 bit signed integer 2x4 matrix.
///
/// @see ext_matrix_int2x4_sized
typedef mat<2, 4, int32, defaultp> i32mat2x4;
/// 64 bit signed integer 2x4 matrix.
///
/// @see ext_matrix_int2x4_sized
typedef mat<2, 4, int64, defaultp> i64mat2x4;
/// @}
}//namespace glm

View file

@ -0,0 +1,33 @@
/// @ref ext_matrix_int3x2
/// @file glm/ext/matrix_int3x2.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_int3x2 GLM_EXT_matrix_int3x2
/// @ingroup ext
///
/// Include <glm/ext/matrix_int3x2.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat3x2.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_int3x2 extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_int3x2
/// @{
/// Signed integer 3x2 matrix.
///
/// @see ext_matrix_int3x2
typedef mat<3, 2, int, defaultp> imat3x2;
/// @}
}//namespace glm

View file

@ -0,0 +1,49 @@
/// @ref ext_matrix_int3x2_sized
/// @file glm/ext/matrix_int3x2_sized.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_int3x2_sized GLM_EXT_matrix_int3x2_sized
/// @ingroup ext
///
/// Include <glm/ext/matrix_int3x2_sized.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat3x2.hpp"
#include "../ext/scalar_int_sized.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_int3x2_sized extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_int3x2_sized
/// @{
/// 8 bit signed integer 3x2 matrix.
///
/// @see ext_matrix_int3x2_sized
typedef mat<3, 2, int8, defaultp> i8mat3x2;
/// 16 bit signed integer 3x2 matrix.
///
/// @see ext_matrix_int3x2_sized
typedef mat<3, 2, int16, defaultp> i16mat3x2;
/// 32 bit signed integer 3x2 matrix.
///
/// @see ext_matrix_int3x2_sized
typedef mat<3, 2, int32, defaultp> i32mat3x2;
/// 64 bit signed integer 3x2 matrix.
///
/// @see ext_matrix_int3x2_sized
typedef mat<3, 2, int64, defaultp> i64mat3x2;
/// @}
}//namespace glm

View file

@ -0,0 +1,38 @@
/// @ref ext_matrix_int3x3
/// @file glm/ext/matrix_int3x3.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_int3x3 GLM_EXT_matrix_int3x3
/// @ingroup ext
///
/// Include <glm/ext/matrix_int3x3.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat3x3.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_int3x3 extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_int3x3
/// @{
/// Signed integer 3x3 matrix.
///
/// @see ext_matrix_int3x3
typedef mat<3, 3, int, defaultp> imat3x3;
/// Signed integer 3x3 matrix.
///
/// @see ext_matrix_int3x3
typedef mat<3, 3, int, defaultp> imat3;
/// @}
}//namespace glm

View file

@ -0,0 +1,70 @@
/// @ref ext_matrix_int3x3_sized
/// @file glm/ext/matrix_int3x3_sized.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_int3x3_sized GLM_EXT_matrix_int3x3_sized
/// @ingroup ext
///
/// Include <glm/ext/matrix_int3x3_sized.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat3x3.hpp"
#include "../ext/scalar_int_sized.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_int3x3_sized extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_int3x3_sized
/// @{
/// 8 bit signed integer 3x3 matrix.
///
/// @see ext_matrix_int3x3_sized
typedef mat<3, 3, int8, defaultp> i8mat3x3;
/// 16 bit signed integer 3x3 matrix.
///
/// @see ext_matrix_int3x3_sized
typedef mat<3, 3, int16, defaultp> i16mat3x3;
/// 32 bit signed integer 3x3 matrix.
///
/// @see ext_matrix_int3x3_sized
typedef mat<3, 3, int32, defaultp> i32mat3x3;
/// 64 bit signed integer 3x3 matrix.
///
/// @see ext_matrix_int3x3_sized
typedef mat<3, 3, int64, defaultp> i64mat3x3;
/// 8 bit signed integer 3x3 matrix.
///
/// @see ext_matrix_int3x3_sized
typedef mat<3, 3, int8, defaultp> i8mat3;
/// 16 bit signed integer 3x3 matrix.
///
/// @see ext_matrix_int3x3_sized
typedef mat<3, 3, int16, defaultp> i16mat3;
/// 32 bit signed integer 3x3 matrix.
///
/// @see ext_matrix_int3x3_sized
typedef mat<3, 3, int32, defaultp> i32mat3;
/// 64 bit signed integer 3x3 matrix.
///
/// @see ext_matrix_int3x3_sized
typedef mat<3, 3, int64, defaultp> i64mat3;
/// @}
}//namespace glm

View file

@ -0,0 +1,33 @@
/// @ref ext_matrix_int3x4
/// @file glm/ext/matrix_int3x4.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_int3x4 GLM_EXT_matrix_int3x4
/// @ingroup ext
///
/// Include <glm/ext/matrix_int3x4.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat3x4.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_int3x4 extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_int3x4
/// @{
/// Signed integer 3x4 matrix.
///
/// @see ext_matrix_int3x4
typedef mat<3, 4, int, defaultp> imat3x4;
/// @}
}//namespace glm

View file

@ -0,0 +1,49 @@
/// @ref ext_matrix_int3x4_sized
/// @file glm/ext/matrix_int3x2_sized.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_int3x4_sized GLM_EXT_matrix_int3x4_sized
/// @ingroup ext
///
/// Include <glm/ext/matrix_int3x4_sized.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat3x4.hpp"
#include "../ext/scalar_int_sized.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_int3x4_sized extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_int3x4_sized
/// @{
/// 8 bit signed integer 3x4 matrix.
///
/// @see ext_matrix_int3x4_sized
typedef mat<3, 4, int8, defaultp> i8mat3x4;
/// 16 bit signed integer 3x4 matrix.
///
/// @see ext_matrix_int3x4_sized
typedef mat<3, 4, int16, defaultp> i16mat3x4;
/// 32 bit signed integer 3x4 matrix.
///
/// @see ext_matrix_int3x4_sized
typedef mat<3, 4, int32, defaultp> i32mat3x4;
/// 64 bit signed integer 3x4 matrix.
///
/// @see ext_matrix_int3x4_sized
typedef mat<3, 4, int64, defaultp> i64mat3x4;
/// @}
}//namespace glm

View file

@ -0,0 +1,33 @@
/// @ref ext_matrix_int4x2
/// @file glm/ext/matrix_int4x2.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_int4x2 GLM_EXT_matrix_int4x2
/// @ingroup ext
///
/// Include <glm/ext/matrix_int4x2.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat4x2.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_int4x2 extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_int4x2
/// @{
/// Signed integer 4x2 matrix.
///
/// @see ext_matrix_int4x2
typedef mat<4, 2, int, defaultp> imat4x2;
/// @}
}//namespace glm

View file

@ -0,0 +1,49 @@
/// @ref ext_matrix_int4x2_sized
/// @file glm/ext/matrix_int4x2_sized.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_int4x2_sized GLM_EXT_matrix_int4x2_sized
/// @ingroup ext
///
/// Include <glm/ext/matrix_int4x2_sized.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat4x2.hpp"
#include "../ext/scalar_int_sized.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_int4x2_sized extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_int4x2_sized
/// @{
/// 8 bit signed integer 4x2 matrix.
///
/// @see ext_matrix_int4x2_sized
typedef mat<4, 2, int8, defaultp> i8mat4x2;
/// 16 bit signed integer 4x2 matrix.
///
/// @see ext_matrix_int4x2_sized
typedef mat<4, 2, int16, defaultp> i16mat4x2;
/// 32 bit signed integer 4x2 matrix.
///
/// @see ext_matrix_int4x2_sized
typedef mat<4, 2, int32, defaultp> i32mat4x2;
/// 64 bit signed integer 4x2 matrix.
///
/// @see ext_matrix_int4x2_sized
typedef mat<4, 2, int64, defaultp> i64mat4x2;
/// @}
}//namespace glm

View file

@ -0,0 +1,33 @@
/// @ref ext_matrix_int4x3
/// @file glm/ext/matrix_int4x3.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_int4x3 GLM_EXT_matrix_int4x3
/// @ingroup ext
///
/// Include <glm/ext/matrix_int4x3.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat4x3.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_int4x3 extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_int4x3
/// @{
/// Signed integer 4x3 matrix.
///
/// @see ext_matrix_int4x3
typedef mat<4, 3, int, defaultp> imat4x3;
/// @}
}//namespace glm

View file

@ -0,0 +1,49 @@
/// @ref ext_matrix_int4x3_sized
/// @file glm/ext/matrix_int4x3_sized.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_int4x3_sized GLM_EXT_matrix_int4x3_sized
/// @ingroup ext
///
/// Include <glm/ext/matrix_int4x3_sized.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat4x3.hpp"
#include "../ext/scalar_int_sized.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_int4x3_sized extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_int4x3_sized
/// @{
/// 8 bit signed integer 4x3 matrix.
///
/// @see ext_matrix_int4x3_sized
typedef mat<4, 3, int8, defaultp> i8mat4x3;
/// 16 bit signed integer 4x3 matrix.
///
/// @see ext_matrix_int4x3_sized
typedef mat<4, 3, int16, defaultp> i16mat4x3;
/// 32 bit signed integer 4x3 matrix.
///
/// @see ext_matrix_int4x3_sized
typedef mat<4, 3, int32, defaultp> i32mat4x3;
/// 64 bit signed integer 4x3 matrix.
///
/// @see ext_matrix_int4x3_sized
typedef mat<4, 3, int64, defaultp> i64mat4x3;
/// @}
}//namespace glm

View file

@ -0,0 +1,38 @@
/// @ref ext_matrix_int4x4
/// @file glm/ext/matrix_int4x4.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_int4x4 GLM_EXT_matrix_int4x4
/// @ingroup ext
///
/// Include <glm/ext/matrix_int4x4.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat4x4.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_int4x4 extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_int4x4
/// @{
/// Signed integer 4x4 matrix.
///
/// @see ext_matrix_int4x4
typedef mat<4, 4, int, defaultp> imat4x4;
/// Signed integer 4x4 matrix.
///
/// @see ext_matrix_int4x4
typedef mat<4, 4, int, defaultp> imat4;
/// @}
}//namespace glm

View file

@ -0,0 +1,70 @@
/// @ref ext_matrix_int4x4_sized
/// @file glm/ext/matrix_int4x4_sized.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_int4x4_sized GLM_EXT_matrix_int4x4_sized
/// @ingroup ext
///
/// Include <glm/ext/matrix_int4x4_sized.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat4x4.hpp"
#include "../ext/scalar_int_sized.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_int4x4_sized extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_int4x4_sized
/// @{
/// 8 bit signed integer 4x4 matrix.
///
/// @see ext_matrix_int4x4_sized
typedef mat<4, 4, int8, defaultp> i8mat4x4;
/// 16 bit signed integer 4x4 matrix.
///
/// @see ext_matrix_int4x4_sized
typedef mat<4, 4, int16, defaultp> i16mat4x4;
/// 32 bit signed integer 4x4 matrix.
///
/// @see ext_matrix_int4x4_sized
typedef mat<4, 4, int32, defaultp> i32mat4x4;
/// 64 bit signed integer 4x4 matrix.
///
/// @see ext_matrix_int4x4_sized
typedef mat<4, 4, int64, defaultp> i64mat4x4;
/// 8 bit signed integer 4x4 matrix.
///
/// @see ext_matrix_int4x4_sized
typedef mat<4, 4, int8, defaultp> i8mat4;
/// 16 bit signed integer 4x4 matrix.
///
/// @see ext_matrix_int4x4_sized
typedef mat<4, 4, int16, defaultp> i16mat4;
/// 32 bit signed integer 4x4 matrix.
///
/// @see ext_matrix_int4x4_sized
typedef mat<4, 4, int32, defaultp> i32mat4;
/// 64 bit signed integer 4x4 matrix.
///
/// @see ext_matrix_int4x4_sized
typedef mat<4, 4, int64, defaultp> i64mat4;
/// @}
}//namespace glm

View file

@ -0,0 +1,149 @@
/// @ref ext_matrix_projection
/// @file glm/ext/matrix_projection.hpp
///
/// @defgroup ext_matrix_projection GLM_EXT_matrix_projection
/// @ingroup ext
///
/// Functions that generate common projection transformation matrices.
///
/// The matrices generated by this extension use standard OpenGL fixed-function
/// conventions. For example, the lookAt function generates a transform from world
/// space into the specific eye space that the projective matrix functions
/// (perspective, ortho, etc) are designed to expect. The OpenGL compatibility
/// specifications defines the particular layout of this eye space.
///
/// Include <glm/ext/matrix_projection.hpp> to use the features of this extension.
///
/// @see ext_matrix_transform
/// @see ext_matrix_clip_space
#pragma once
// Dependencies
#include "../gtc/constants.hpp"
#include "../geometric.hpp"
#include "../trigonometric.hpp"
#include "../matrix.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_projection extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_projection
/// @{
/// Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates.
/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
///
/// @param obj Specify the object coordinates.
/// @param model Specifies the current modelview matrix
/// @param proj Specifies the current projection matrix
/// @param viewport Specifies the current viewport
/// @return Return the computed window coordinates.
/// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.
/// @tparam U Currently supported: Floating-point types and integer types.
///
/// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluProject.xml">gluProject man page</a>
template<typename T, typename U, qualifier Q>
GLM_FUNC_DECL vec<3, T, Q> projectZO(
vec<3, T, Q> const& obj, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport);
/// Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates.
/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
///
/// @param obj Specify the object coordinates.
/// @param model Specifies the current modelview matrix
/// @param proj Specifies the current projection matrix
/// @param viewport Specifies the current viewport
/// @return Return the computed window coordinates.
/// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.
/// @tparam U Currently supported: Floating-point types and integer types.
///
/// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluProject.xml">gluProject man page</a>
template<typename T, typename U, qualifier Q>
GLM_FUNC_DECL vec<3, T, Q> projectNO(
vec<3, T, Q> const& obj, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport);
/// Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates using default near and far clip planes definition.
/// To change default near and far clip planes definition use GLM_FORCE_DEPTH_ZERO_TO_ONE.
///
/// @param obj Specify the object coordinates.
/// @param model Specifies the current modelview matrix
/// @param proj Specifies the current projection matrix
/// @param viewport Specifies the current viewport
/// @return Return the computed window coordinates.
/// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.
/// @tparam U Currently supported: Floating-point types and integer types.
///
/// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluProject.xml">gluProject man page</a>
template<typename T, typename U, qualifier Q>
GLM_FUNC_DECL vec<3, T, Q> project(
vec<3, T, Q> const& obj, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport);
/// Map the specified window coordinates (win.x, win.y, win.z) into object coordinates.
/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
///
/// @param win Specify the window coordinates to be mapped.
/// @param model Specifies the modelview matrix
/// @param proj Specifies the projection matrix
/// @param viewport Specifies the viewport
/// @return Returns the computed object coordinates.
/// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.
/// @tparam U Currently supported: Floating-point types and integer types.
///
/// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluUnProject.xml">gluUnProject man page</a>
template<typename T, typename U, qualifier Q>
GLM_FUNC_DECL vec<3, T, Q> unProjectZO(
vec<3, T, Q> const& win, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport);
/// Map the specified window coordinates (win.x, win.y, win.z) into object coordinates.
/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
///
/// @param win Specify the window coordinates to be mapped.
/// @param model Specifies the modelview matrix
/// @param proj Specifies the projection matrix
/// @param viewport Specifies the viewport
/// @return Returns the computed object coordinates.
/// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.
/// @tparam U Currently supported: Floating-point types and integer types.
///
/// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluUnProject.xml">gluUnProject man page</a>
template<typename T, typename U, qualifier Q>
GLM_FUNC_DECL vec<3, T, Q> unProjectNO(
vec<3, T, Q> const& win, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport);
/// Map the specified window coordinates (win.x, win.y, win.z) into object coordinates using default near and far clip planes definition.
/// To change default near and far clip planes definition use GLM_FORCE_DEPTH_ZERO_TO_ONE.
///
/// @param win Specify the window coordinates to be mapped.
/// @param model Specifies the modelview matrix
/// @param proj Specifies the projection matrix
/// @param viewport Specifies the viewport
/// @return Returns the computed object coordinates.
/// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.
/// @tparam U Currently supported: Floating-point types and integer types.
///
/// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluUnProject.xml">gluUnProject man page</a>
template<typename T, typename U, qualifier Q>
GLM_FUNC_DECL vec<3, T, Q> unProject(
vec<3, T, Q> const& win, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport);
/// Define a picking region
///
/// @param center Specify the center of a picking region in window coordinates.
/// @param delta Specify the width and height, respectively, of the picking region in window coordinates.
/// @param viewport Rendering viewport
/// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.
/// @tparam U Currently supported: Floating-point types and integer types.
///
/// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluPickMatrix.xml">gluPickMatrix man page</a>
template<typename T, qualifier Q, typename U>
GLM_FUNC_DECL mat<4, 4, T, Q> pickMatrix(
vec<2, T, Q> const& center, vec<2, T, Q> const& delta, vec<4, U, Q> const& viewport);
/// @}
}//namespace glm
#include "matrix_projection.inl"

View file

@ -0,0 +1,106 @@
namespace glm
{
template<typename T, typename U, qualifier Q>
GLM_FUNC_QUALIFIER vec<3, T, Q> projectZO(vec<3, T, Q> const& obj, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport)
{
vec<4, T, Q> tmp = vec<4, T, Q>(obj, static_cast<T>(1));
tmp = model * tmp;
tmp = proj * tmp;
tmp /= tmp.w;
tmp.x = tmp.x * static_cast<T>(0.5) + static_cast<T>(0.5);
tmp.y = tmp.y * static_cast<T>(0.5) + static_cast<T>(0.5);
tmp[0] = tmp[0] * T(viewport[2]) + T(viewport[0]);
tmp[1] = tmp[1] * T(viewport[3]) + T(viewport[1]);
return vec<3, T, Q>(tmp);
}
template<typename T, typename U, qualifier Q>
GLM_FUNC_QUALIFIER vec<3, T, Q> projectNO(vec<3, T, Q> const& obj, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport)
{
vec<4, T, Q> tmp = vec<4, T, Q>(obj, static_cast<T>(1));
tmp = model * tmp;
tmp = proj * tmp;
tmp /= tmp.w;
tmp = tmp * static_cast<T>(0.5) + static_cast<T>(0.5);
tmp[0] = tmp[0] * T(viewport[2]) + T(viewport[0]);
tmp[1] = tmp[1] * T(viewport[3]) + T(viewport[1]);
return vec<3, T, Q>(tmp);
}
template<typename T, typename U, qualifier Q>
GLM_FUNC_QUALIFIER vec<3, T, Q> project(vec<3, T, Q> const& obj, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport)
{
# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT
return projectZO(obj, model, proj, viewport);
# else
return projectNO(obj, model, proj, viewport);
# endif
}
template<typename T, typename U, qualifier Q>
GLM_FUNC_QUALIFIER vec<3, T, Q> unProjectZO(vec<3, T, Q> const& win, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport)
{
mat<4, 4, T, Q> Inverse = inverse(proj * model);
vec<4, T, Q> tmp = vec<4, T, Q>(win, T(1));
tmp.x = (tmp.x - T(viewport[0])) / T(viewport[2]);
tmp.y = (tmp.y - T(viewport[1])) / T(viewport[3]);
tmp.x = tmp.x * static_cast<T>(2) - static_cast<T>(1);
tmp.y = tmp.y * static_cast<T>(2) - static_cast<T>(1);
vec<4, T, Q> obj = Inverse * tmp;
obj /= obj.w;
return vec<3, T, Q>(obj);
}
template<typename T, typename U, qualifier Q>
GLM_FUNC_QUALIFIER vec<3, T, Q> unProjectNO(vec<3, T, Q> const& win, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport)
{
mat<4, 4, T, Q> Inverse = inverse(proj * model);
vec<4, T, Q> tmp = vec<4, T, Q>(win, T(1));
tmp.x = (tmp.x - T(viewport[0])) / T(viewport[2]);
tmp.y = (tmp.y - T(viewport[1])) / T(viewport[3]);
tmp = tmp * static_cast<T>(2) - static_cast<T>(1);
vec<4, T, Q> obj = Inverse * tmp;
obj /= obj.w;
return vec<3, T, Q>(obj);
}
template<typename T, typename U, qualifier Q>
GLM_FUNC_QUALIFIER vec<3, T, Q> unProject(vec<3, T, Q> const& win, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport)
{
# if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT
return unProjectZO(win, model, proj, viewport);
# else
return unProjectNO(win, model, proj, viewport);
# endif
}
template<typename T, qualifier Q, typename U>
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> pickMatrix(vec<2, T, Q> const& center, vec<2, T, Q> const& delta, vec<4, U, Q> const& viewport)
{
assert(delta.x > static_cast<T>(0) && delta.y > static_cast<T>(0));
mat<4, 4, T, Q> Result(static_cast<T>(1));
if(!(delta.x > static_cast<T>(0) && delta.y > static_cast<T>(0)))
return Result; // Error
vec<3, T, Q> Temp(
(static_cast<T>(viewport[2]) - static_cast<T>(2) * (center.x - static_cast<T>(viewport[0]))) / delta.x,
(static_cast<T>(viewport[3]) - static_cast<T>(2) * (center.y - static_cast<T>(viewport[1]))) / delta.y,
static_cast<T>(0));
// Translate and scale the picked region to the entire window
Result = translate(Result, Temp);
return scale(Result, vec<3, T, Q>(static_cast<T>(viewport[2]) / delta.x, static_cast<T>(viewport[3]) / delta.y, static_cast<T>(1)));
}
}//namespace glm

View file

@ -0,0 +1,132 @@
/// @ref ext_matrix_relational
/// @file glm/ext/matrix_relational.hpp
///
/// @defgroup ext_matrix_relational GLM_EXT_matrix_relational
/// @ingroup ext
///
/// Exposes comparison functions for matrix types that take a user defined epsilon values.
///
/// Include <glm/ext/matrix_relational.hpp> to use the features of this extension.
///
/// @see ext_vector_relational
/// @see ext_scalar_relational
/// @see ext_quaternion_relational
#pragma once
// Dependencies
#include "../detail/qualifier.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_relational extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_relational
/// @{
/// Perform a component-wise equal-to comparison of two matrices.
/// Return a boolean vector which components value is True if this expression is satisfied per column of the matrices.
///
/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix
/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix
/// @tparam T Floating-point or integer scalar types
/// @tparam Q Value from qualifier enum
template<length_t C, length_t R, typename T, qualifier Q>
GLM_FUNC_DECL GLM_CONSTEXPR vec<C, bool, Q> equal(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y);
/// Perform a component-wise not-equal-to comparison of two matrices.
/// Return a boolean vector which components value is True if this expression is satisfied per column of the matrices.
///
/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix
/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix
/// @tparam T Floating-point or integer scalar types
/// @tparam Q Value from qualifier enum
template<length_t C, length_t R, typename T, qualifier Q>
GLM_FUNC_DECL GLM_CONSTEXPR vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y);
/// Returns the component-wise comparison of |x - y| < epsilon.
/// True if this expression is satisfied.
///
/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix
/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix
/// @tparam T Floating-point or integer scalar types
/// @tparam Q Value from qualifier enum
template<length_t C, length_t R, typename T, qualifier Q>
GLM_FUNC_DECL GLM_CONSTEXPR vec<C, bool, Q> equal(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y, T epsilon);
/// Returns the component-wise comparison of |x - y| < epsilon.
/// True if this expression is satisfied.
///
/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix
/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix
/// @tparam T Floating-point or integer scalar types
/// @tparam Q Value from qualifier enum
template<length_t C, length_t R, typename T, qualifier Q>
GLM_FUNC_DECL GLM_CONSTEXPR vec<C, bool, Q> equal(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y, vec<C, T, Q> const& epsilon);
/// Returns the component-wise comparison of |x - y| < epsilon.
/// True if this expression is not satisfied.
///
/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix
/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix
/// @tparam T Floating-point or integer scalar types
/// @tparam Q Value from qualifier enum
template<length_t C, length_t R, typename T, qualifier Q>
GLM_FUNC_DECL GLM_CONSTEXPR vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y, T epsilon);
/// Returns the component-wise comparison of |x - y| >= epsilon.
/// True if this expression is not satisfied.
///
/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix
/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix
/// @tparam T Floating-point or integer scalar types
/// @tparam Q Value from qualifier enum
template<length_t C, length_t R, typename T, qualifier Q>
GLM_FUNC_DECL GLM_CONSTEXPR vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y, vec<C, T, Q> const& epsilon);
/// Returns the component-wise comparison between two vectors in term of ULPs.
/// True if this expression is satisfied.
///
/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix
/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix
/// @tparam T Floating-point
/// @tparam Q Value from qualifier enum
template<length_t C, length_t R, typename T, qualifier Q>
GLM_FUNC_DECL GLM_CONSTEXPR vec<C, bool, Q> equal(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y, int ULPs);
/// Returns the component-wise comparison between two vectors in term of ULPs.
/// True if this expression is satisfied.
///
/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix
/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix
/// @tparam T Floating-point
/// @tparam Q Value from qualifier enum
template<length_t C, length_t R, typename T, qualifier Q>
GLM_FUNC_DECL GLM_CONSTEXPR vec<C, bool, Q> equal(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y, vec<C, int, Q> const& ULPs);
/// Returns the component-wise comparison between two vectors in term of ULPs.
/// True if this expression is not satisfied.
///
/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix
/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix
/// @tparam T Floating-point
/// @tparam Q Value from qualifier enum
template<length_t C, length_t R, typename T, qualifier Q>
GLM_FUNC_DECL GLM_CONSTEXPR vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y, int ULPs);
/// Returns the component-wise comparison between two vectors in term of ULPs.
/// True if this expression is not satisfied.
///
/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix
/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix
/// @tparam T Floating-point
/// @tparam Q Value from qualifier enum
template<length_t C, length_t R, typename T, qualifier Q>
GLM_FUNC_DECL GLM_CONSTEXPR vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y, vec<C, int, Q> const& ULPs);
/// @}
}//namespace glm
#include "matrix_relational.inl"

View file

@ -0,0 +1,82 @@
/// @ref ext_vector_relational
/// @file glm/ext/vector_relational.inl
// Dependency:
#include "../ext/vector_relational.hpp"
#include "../common.hpp"
namespace glm
{
template<length_t C, length_t R, typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> equal(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b)
{
return equal(a, b, static_cast<T>(0));
}
template<length_t C, length_t R, typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> equal(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b, T Epsilon)
{
return equal(a, b, vec<C, T, Q>(Epsilon));
}
template<length_t C, length_t R, typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> equal(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b, vec<C, T, Q> const& Epsilon)
{
vec<C, bool, Q> Result(true);
for(length_t i = 0; i < C; ++i)
Result[i] = all(equal(a[i], b[i], Epsilon[i]));
return Result;
}
template<length_t C, length_t R, typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y)
{
return notEqual(x, y, static_cast<T>(0));
}
template<length_t C, length_t R, typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y, T Epsilon)
{
return notEqual(x, y, vec<C, T, Q>(Epsilon));
}
template<length_t C, length_t R, typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b, vec<C, T, Q> const& Epsilon)
{
vec<C, bool, Q> Result(true);
for(length_t i = 0; i < C; ++i)
Result[i] = any(notEqual(a[i], b[i], Epsilon[i]));
return Result;
}
template<length_t C, length_t R, typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> equal(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b, int MaxULPs)
{
return equal(a, b, vec<C, int, Q>(MaxULPs));
}
template<length_t C, length_t R, typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> equal(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b, vec<C, int, Q> const& MaxULPs)
{
vec<C, bool, Q> Result(true);
for(length_t i = 0; i < C; ++i)
Result[i] = all(equal(a[i], b[i], MaxULPs[i]));
return Result;
}
template<length_t C, length_t R, typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y, int MaxULPs)
{
return notEqual(x, y, vec<C, int, Q>(MaxULPs));
}
template<length_t C, length_t R, typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b, vec<C, int, Q> const& MaxULPs)
{
vec<C, bool, Q> Result(true);
for(length_t i = 0; i < C; ++i)
Result[i] = any(notEqual(a[i], b[i], MaxULPs[i]));
return Result;
}
}//namespace glm

View file

@ -0,0 +1,144 @@
/// @ref ext_matrix_transform
/// @file glm/ext/matrix_transform.hpp
///
/// @defgroup ext_matrix_transform GLM_EXT_matrix_transform
/// @ingroup ext
///
/// Defines functions that generate common transformation matrices.
///
/// The matrices generated by this extension use standard OpenGL fixed-function
/// conventions. For example, the lookAt function generates a transform from world
/// space into the specific eye space that the projective matrix functions
/// (perspective, ortho, etc) are designed to expect. The OpenGL compatibility
/// specifications defines the particular layout of this eye space.
///
/// Include <glm/ext/matrix_transform.hpp> to use the features of this extension.
///
/// @see ext_matrix_projection
/// @see ext_matrix_clip_space
#pragma once
// Dependencies
#include "../gtc/constants.hpp"
#include "../geometric.hpp"
#include "../trigonometric.hpp"
#include "../matrix.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_transform extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_transform
/// @{
/// Builds an identity matrix.
template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType identity();
/// Builds a translation 4 * 4 matrix created from a vector of 3 components.
///
/// @param m Input matrix multiplied by this translation matrix.
/// @param v Coordinates of a translation vector.
///
/// @tparam T A floating-point scalar type
/// @tparam Q A value from qualifier enum
///
/// @code
/// #include <glm/glm.hpp>
/// #include <glm/gtc/matrix_transform.hpp>
/// ...
/// glm::mat4 m = glm::translate(glm::mat4(1.0f), glm::vec3(1.0f));
/// // m[0][0] == 1.0f, m[0][1] == 0.0f, m[0][2] == 0.0f, m[0][3] == 0.0f
/// // m[1][0] == 0.0f, m[1][1] == 1.0f, m[1][2] == 0.0f, m[1][3] == 0.0f
/// // m[2][0] == 0.0f, m[2][1] == 0.0f, m[2][2] == 1.0f, m[2][3] == 0.0f
/// // m[3][0] == 1.0f, m[3][1] == 1.0f, m[3][2] == 1.0f, m[3][3] == 1.0f
/// @endcode
///
/// @see - translate(mat<4, 4, T, Q> const& m, T x, T y, T z)
/// @see - translate(vec<3, T, Q> const& v)
/// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glTranslate.xml">glTranslate man page</a>
template<typename T, qualifier Q>
GLM_FUNC_DECL mat<4, 4, T, Q> translate(
mat<4, 4, T, Q> const& m, vec<3, T, Q> const& v);
/// Builds a rotation 4 * 4 matrix created from an axis vector and an angle.
///
/// @param m Input matrix multiplied by this rotation matrix.
/// @param angle Rotation angle expressed in radians.
/// @param axis Rotation axis, recommended to be normalized.
///
/// @tparam T A floating-point scalar type
/// @tparam Q A value from qualifier enum
///
/// @see - rotate(mat<4, 4, T, Q> const& m, T angle, T x, T y, T z)
/// @see - rotate(T angle, vec<3, T, Q> const& v)
/// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glRotate.xml">glRotate man page</a>
template<typename T, qualifier Q>
GLM_FUNC_DECL mat<4, 4, T, Q> rotate(
mat<4, 4, T, Q> const& m, T angle, vec<3, T, Q> const& axis);
/// Builds a scale 4 * 4 matrix created from 3 scalars.
///
/// @param m Input matrix multiplied by this scale matrix.
/// @param v Ratio of scaling for each axis.
///
/// @tparam T A floating-point scalar type
/// @tparam Q A value from qualifier enum
///
/// @see - scale(mat<4, 4, T, Q> const& m, T x, T y, T z)
/// @see - scale(vec<3, T, Q> const& v)
/// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glScale.xml">glScale man page</a>
template<typename T, qualifier Q>
GLM_FUNC_DECL mat<4, 4, T, Q> scale(
mat<4, 4, T, Q> const& m, vec<3, T, Q> const& v);
/// Build a right handed look at view matrix.
///
/// @param eye Position of the camera
/// @param center Position where the camera is looking at
/// @param up Normalized up vector, how the camera is oriented. Typically (0, 0, 1)
///
/// @tparam T A floating-point scalar type
/// @tparam Q A value from qualifier enum
///
/// @see - frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal) frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal)
template<typename T, qualifier Q>
GLM_FUNC_DECL mat<4, 4, T, Q> lookAtRH(
vec<3, T, Q> const& eye, vec<3, T, Q> const& center, vec<3, T, Q> const& up);
/// Build a left handed look at view matrix.
///
/// @param eye Position of the camera
/// @param center Position where the camera is looking at
/// @param up Normalized up vector, how the camera is oriented. Typically (0, 0, 1)
///
/// @tparam T A floating-point scalar type
/// @tparam Q A value from qualifier enum
///
/// @see - frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal) frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal)
template<typename T, qualifier Q>
GLM_FUNC_DECL mat<4, 4, T, Q> lookAtLH(
vec<3, T, Q> const& eye, vec<3, T, Q> const& center, vec<3, T, Q> const& up);
/// Build a look at view matrix based on the default handedness.
///
/// @param eye Position of the camera
/// @param center Position where the camera is looking at
/// @param up Normalized up vector, how the camera is oriented. Typically (0, 0, 1)
///
/// @tparam T A floating-point scalar type
/// @tparam Q A value from qualifier enum
///
/// @see - frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal) frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal)
/// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluLookAt.xml">gluLookAt man page</a>
template<typename T, qualifier Q>
GLM_FUNC_DECL mat<4, 4, T, Q> lookAt(
vec<3, T, Q> const& eye, vec<3, T, Q> const& center, vec<3, T, Q> const& up);
/// @}
}//namespace glm
#include "matrix_transform.inl"

View file

@ -0,0 +1,152 @@
namespace glm
{
template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType identity()
{
return detail::init_gentype<genType, detail::genTypeTrait<genType>::GENTYPE>::identity();
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> translate(mat<4, 4, T, Q> const& m, vec<3, T, Q> const& v)
{
mat<4, 4, T, Q> Result(m);
Result[3] = m[0] * v[0] + m[1] * v[1] + m[2] * v[2] + m[3];
return Result;
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> rotate(mat<4, 4, T, Q> const& m, T angle, vec<3, T, Q> const& v)
{
T const a = angle;
T const c = cos(a);
T const s = sin(a);
vec<3, T, Q> axis(normalize(v));
vec<3, T, Q> temp((T(1) - c) * axis);
mat<4, 4, T, Q> Rotate;
Rotate[0][0] = c + temp[0] * axis[0];
Rotate[0][1] = temp[0] * axis[1] + s * axis[2];
Rotate[0][2] = temp[0] * axis[2] - s * axis[1];
Rotate[1][0] = temp[1] * axis[0] - s * axis[2];
Rotate[1][1] = c + temp[1] * axis[1];
Rotate[1][2] = temp[1] * axis[2] + s * axis[0];
Rotate[2][0] = temp[2] * axis[0] + s * axis[1];
Rotate[2][1] = temp[2] * axis[1] - s * axis[0];
Rotate[2][2] = c + temp[2] * axis[2];
mat<4, 4, T, Q> Result;
Result[0] = m[0] * Rotate[0][0] + m[1] * Rotate[0][1] + m[2] * Rotate[0][2];
Result[1] = m[0] * Rotate[1][0] + m[1] * Rotate[1][1] + m[2] * Rotate[1][2];
Result[2] = m[0] * Rotate[2][0] + m[1] * Rotate[2][1] + m[2] * Rotate[2][2];
Result[3] = m[3];
return Result;
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> rotate_slow(mat<4, 4, T, Q> const& m, T angle, vec<3, T, Q> const& v)
{
T const a = angle;
T const c = cos(a);
T const s = sin(a);
mat<4, 4, T, Q> Result;
vec<3, T, Q> axis = normalize(v);
Result[0][0] = c + (static_cast<T>(1) - c) * axis.x * axis.x;
Result[0][1] = (static_cast<T>(1) - c) * axis.x * axis.y + s * axis.z;
Result[0][2] = (static_cast<T>(1) - c) * axis.x * axis.z - s * axis.y;
Result[0][3] = static_cast<T>(0);
Result[1][0] = (static_cast<T>(1) - c) * axis.y * axis.x - s * axis.z;
Result[1][1] = c + (static_cast<T>(1) - c) * axis.y * axis.y;
Result[1][2] = (static_cast<T>(1) - c) * axis.y * axis.z + s * axis.x;
Result[1][3] = static_cast<T>(0);
Result[2][0] = (static_cast<T>(1) - c) * axis.z * axis.x + s * axis.y;
Result[2][1] = (static_cast<T>(1) - c) * axis.z * axis.y - s * axis.x;
Result[2][2] = c + (static_cast<T>(1) - c) * axis.z * axis.z;
Result[2][3] = static_cast<T>(0);
Result[3] = vec<4, T, Q>(0, 0, 0, 1);
return m * Result;
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> scale(mat<4, 4, T, Q> const& m, vec<3, T, Q> const& v)
{
mat<4, 4, T, Q> Result;
Result[0] = m[0] * v[0];
Result[1] = m[1] * v[1];
Result[2] = m[2] * v[2];
Result[3] = m[3];
return Result;
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> scale_slow(mat<4, 4, T, Q> const& m, vec<3, T, Q> const& v)
{
mat<4, 4, T, Q> Result(T(1));
Result[0][0] = v.x;
Result[1][1] = v.y;
Result[2][2] = v.z;
return m * Result;
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> lookAtRH(vec<3, T, Q> const& eye, vec<3, T, Q> const& center, vec<3, T, Q> const& up)
{
vec<3, T, Q> const f(normalize(center - eye));
vec<3, T, Q> const s(normalize(cross(f, up)));
vec<3, T, Q> const u(cross(s, f));
mat<4, 4, T, Q> Result(1);
Result[0][0] = s.x;
Result[1][0] = s.y;
Result[2][0] = s.z;
Result[0][1] = u.x;
Result[1][1] = u.y;
Result[2][1] = u.z;
Result[0][2] =-f.x;
Result[1][2] =-f.y;
Result[2][2] =-f.z;
Result[3][0] =-dot(s, eye);
Result[3][1] =-dot(u, eye);
Result[3][2] = dot(f, eye);
return Result;
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> lookAtLH(vec<3, T, Q> const& eye, vec<3, T, Q> const& center, vec<3, T, Q> const& up)
{
vec<3, T, Q> const f(normalize(center - eye));
vec<3, T, Q> const s(normalize(cross(up, f)));
vec<3, T, Q> const u(cross(f, s));
mat<4, 4, T, Q> Result(1);
Result[0][0] = s.x;
Result[1][0] = s.y;
Result[2][0] = s.z;
Result[0][1] = u.x;
Result[1][1] = u.y;
Result[2][1] = u.z;
Result[0][2] = f.x;
Result[1][2] = f.y;
Result[2][2] = f.z;
Result[3][0] = -dot(s, eye);
Result[3][1] = -dot(u, eye);
Result[3][2] = -dot(f, eye);
return Result;
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> lookAt(vec<3, T, Q> const& eye, vec<3, T, Q> const& center, vec<3, T, Q> const& up)
{
GLM_IF_CONSTEXPR(GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT)
return lookAtLH(eye, center, up);
else
return lookAtRH(eye, center, up);
}
}//namespace glm

View file

@ -0,0 +1,38 @@
/// @ref ext_matrix_uint2x2
/// @file glm/ext/matrix_uint2x2.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_uint2x2 GLM_EXT_matrix_uint2x2
/// @ingroup ext
///
/// Include <glm/ext/matrix_uint2x2.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat2x2.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_uint2x2 extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_uint2x2
/// @{
/// Unsigned integer 2x2 matrix.
///
/// @see ext_matrix_uint2x2
typedef mat<2, 2, uint, defaultp> umat2x2;
/// Unsigned integer 2x2 matrix.
///
/// @see ext_matrix_uint2x2
typedef mat<2, 2, uint, defaultp> umat2;
/// @}
}//namespace glm

View file

@ -0,0 +1,70 @@
/// @ref ext_matrix_uint2x2_sized
/// @file glm/ext/matrix_uint2x2_sized.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_uint2x2_sized GLM_EXT_matrix_uint2x2_sized
/// @ingroup ext
///
/// Include <glm/ext/matrix_uint2x2_sized.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat2x2.hpp"
#include "../ext/scalar_uint_sized.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_uint2x2_sized extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_uint2x2_sized
/// @{
/// 8 bit unsigned integer 2x2 matrix.
///
/// @see ext_matrix_uint2x2_sized
typedef mat<2, 2, uint8, defaultp> u8mat2x2;
/// 16 bit unsigned integer 2x2 matrix.
///
/// @see ext_matrix_uint2x2_sized
typedef mat<2, 2, uint16, defaultp> u16mat2x2;
/// 32 bit unsigned integer 2x2 matrix.
///
/// @see ext_matrix_uint2x2_sized
typedef mat<2, 2, uint32, defaultp> u32mat2x2;
/// 64 bit unsigned integer 2x2 matrix.
///
/// @see ext_matrix_uint2x2_sized
typedef mat<2, 2, uint64, defaultp> u64mat2x2;
/// 8 bit unsigned integer 2x2 matrix.
///
/// @see ext_matrix_uint2x2_sized
typedef mat<2, 2, uint8, defaultp> u8mat2;
/// 16 bit unsigned integer 2x2 matrix.
///
/// @see ext_matrix_uint2x2_sized
typedef mat<2, 2, uint16, defaultp> u16mat2;
/// 32 bit unsigned integer 2x2 matrix.
///
/// @see ext_matrix_uint2x2_sized
typedef mat<2, 2, uint32, defaultp> u32mat2;
/// 64 bit unsigned integer 2x2 matrix.
///
/// @see ext_matrix_uint2x2_sized
typedef mat<2, 2, uint64, defaultp> u64mat2;
/// @}
}//namespace glm

View file

@ -0,0 +1,33 @@
/// @ref ext_matrix_uint2x3
/// @file glm/ext/matrix_uint2x3.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_int2x3 GLM_EXT_matrix_uint2x3
/// @ingroup ext
///
/// Include <glm/ext/matrix_uint2x3.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat2x3.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_uint2x3 extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_uint2x3
/// @{
/// Unsigned integer 2x3 matrix.
///
/// @see ext_matrix_uint2x3
typedef mat<2, 3, uint, defaultp> umat2x3;
/// @}
}//namespace glm

View file

@ -0,0 +1,49 @@
/// @ref ext_matrix_uint2x3_sized
/// @file glm/ext/matrix_uint2x3_sized.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_uint2x3_sized GLM_EXT_matrix_uint2x3_sized
/// @ingroup ext
///
/// Include <glm/ext/matrix_uint2x3_sized.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat2x3.hpp"
#include "../ext/scalar_uint_sized.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_uint2x3_sized extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_uint2x3_sized
/// @{
/// 8 bit unsigned integer 2x3 matrix.
///
/// @see ext_matrix_uint2x3_sized
typedef mat<2, 3, uint8, defaultp> u8mat2x3;
/// 16 bit unsigned integer 2x3 matrix.
///
/// @see ext_matrix_uint2x3_sized
typedef mat<2, 3, uint16, defaultp> u16mat2x3;
/// 32 bit unsigned integer 2x3 matrix.
///
/// @see ext_matrix_uint2x3_sized
typedef mat<2, 3, uint32, defaultp> u32mat2x3;
/// 64 bit unsigned integer 2x3 matrix.
///
/// @see ext_matrix_uint2x3_sized
typedef mat<2, 3, uint64, defaultp> u64mat2x3;
/// @}
}//namespace glm

View file

@ -0,0 +1,33 @@
/// @ref ext_matrix_uint2x4
/// @file glm/ext/matrix_uint2x4.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_uint2x4 GLM_EXT_matrix_int2x4
/// @ingroup ext
///
/// Include <glm/ext/matrix_uint2x4.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat2x4.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_uint2x4 extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_uint2x4
/// @{
/// Unsigned integer 2x4 matrix.
///
/// @see ext_matrix_uint2x4
typedef mat<2, 4, uint, defaultp> umat2x4;
/// @}
}//namespace glm

View file

@ -0,0 +1,49 @@
/// @ref ext_matrix_uint2x4_sized
/// @file glm/ext/matrixu_uint2x4_sized.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_uint2x4_sized GLM_EXT_matrix_uint2x4_sized
/// @ingroup ext
///
/// Include <glm/ext/matrix_uint2x4_sized.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat2x4.hpp"
#include "../ext/scalar_uint_sized.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_uint2x4_sized extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_uint2x4_sized
/// @{
/// 8 bit unsigned integer 2x4 matrix.
///
/// @see ext_matrix_uint2x4_sized
typedef mat<2, 4, uint8, defaultp> u8mat2x4;
/// 16 bit unsigned integer 2x4 matrix.
///
/// @see ext_matrix_uint2x4_sized
typedef mat<2, 4, uint16, defaultp> u16mat2x4;
/// 32 bit unsigned integer 2x4 matrix.
///
/// @see ext_matrix_uint2x4_sized
typedef mat<2, 4, uint32, defaultp> u32mat2x4;
/// 64 bit unsigned integer 2x4 matrix.
///
/// @see ext_matrix_uint2x4_sized
typedef mat<2, 4, uint64, defaultp> u64mat2x4;
/// @}
}//namespace glm

View file

@ -0,0 +1,33 @@
/// @ref ext_matrix_uint3x2
/// @file glm/ext/matrix_uint3x2.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_int3x2 GLM_EXT_matrix_uint3x2
/// @ingroup ext
///
/// Include <glm/ext/matrix_uint3x2.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat3x2.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_uint3x2 extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_uint3x2
/// @{
/// Unsigned integer 3x2 matrix.
///
/// @see ext_matrix_uint3x2
typedef mat<3, 2, uint, defaultp> umat3x2;
/// @}
}//namespace glm

View file

@ -0,0 +1,49 @@
/// @ref ext_matrix_uint3x2_sized
/// @file glm/ext/matrix_uint3x2_sized.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_uint3x2_sized GLM_EXT_matrix_uint3x2_sized
/// @ingroup ext
///
/// Include <glm/ext/matrix_uint3x2_sized.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat3x2.hpp"
#include "../ext/scalar_uint_sized.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_uint3x2_sized extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_uint3x2_sized
/// @{
/// 8 bit signed integer 3x2 matrix.
///
/// @see ext_matrix_uint3x2_sized
typedef mat<3, 2, uint8, defaultp> u8mat3x2;
/// 16 bit signed integer 3x2 matrix.
///
/// @see ext_matrix_uint3x2_sized
typedef mat<3, 2, uint16, defaultp> u16mat3x2;
/// 32 bit signed integer 3x2 matrix.
///
/// @see ext_matrix_uint3x2_sized
typedef mat<3, 2, uint32, defaultp> u32mat3x2;
/// 64 bit signed integer 3x2 matrix.
///
/// @see ext_matrix_uint3x2_sized
typedef mat<3, 2, uint64, defaultp> u64mat3x2;
/// @}
}//namespace glm

View file

@ -0,0 +1,38 @@
/// @ref ext_matrix_uint3x3
/// @file glm/ext/matrix_uint3x3.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_uint3x3 GLM_EXT_matrix_uint3x3
/// @ingroup ext
///
/// Include <glm/ext/matrix_uint3x3.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat3x3.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_uint3x3 extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_uint3x3
/// @{
/// Unsigned integer 3x3 matrix.
///
/// @see ext_matrix_uint3x3
typedef mat<3, 3, uint, defaultp> umat3x3;
/// Unsigned integer 3x3 matrix.
///
/// @see ext_matrix_uint3x3
typedef mat<3, 3, uint, defaultp> umat3;
/// @}
}//namespace glm

View file

@ -0,0 +1,70 @@
/// @ref ext_matrix_uint3x3_sized
/// @file glm/ext/matrix_uint3x3_sized.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_uint3x3_sized GLM_EXT_matrix_uint3x3_sized
/// @ingroup ext
///
/// Include <glm/ext/matrix_uint3x3_sized.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat3x3.hpp"
#include "../ext/scalar_uint_sized.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_uint3x3_sized extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_uint3x3_sized
/// @{
/// 8 bit unsigned integer 3x3 matrix.
///
/// @see ext_matrix_uint3x3_sized
typedef mat<3, 3, uint8, defaultp> u8mat3x3;
/// 16 bit unsigned integer 3x3 matrix.
///
/// @see ext_matrix_uint3x3_sized
typedef mat<3, 3, uint16, defaultp> u16mat3x3;
/// 32 bit unsigned integer 3x3 matrix.
///
/// @see ext_matrix_uint3x3_sized
typedef mat<3, 3, uint32, defaultp> u32mat3x3;
/// 64 bit unsigned integer 3x3 matrix.
///
/// @see ext_matrix_uint3x3_sized
typedef mat<3, 3, uint64, defaultp> u64mat3x3;
/// 8 bit unsigned integer 3x3 matrix.
///
/// @see ext_matrix_uint3x3_sized
typedef mat<3, 3, uint8, defaultp> u8mat3;
/// 16 bit unsigned integer 3x3 matrix.
///
/// @see ext_matrix_uint3x3_sized
typedef mat<3, 3, uint16, defaultp> u16mat3;
/// 32 bit unsigned integer 3x3 matrix.
///
/// @see ext_matrix_uint3x3_sized
typedef mat<3, 3, uint32, defaultp> u32mat3;
/// 64 bit unsigned integer 3x3 matrix.
///
/// @see ext_matrix_uint3x3_sized
typedef mat<3, 3, uint64, defaultp> u64mat3;
/// @}
}//namespace glm

View file

@ -0,0 +1,33 @@
/// @ref ext_matrix_uint3x4
/// @file glm/ext/matrix_uint3x4.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_uint3x4 GLM_EXT_matrix_uint3x4
/// @ingroup ext
///
/// Include <glm/ext/matrix_uint3x4.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat3x4.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_uint3x4 extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_uint3x4
/// @{
/// Signed integer 3x4 matrix.
///
/// @see ext_matrix_uint3x4
typedef mat<3, 4, uint, defaultp> umat3x4;
/// @}
}//namespace glm

View file

@ -0,0 +1,49 @@
/// @ref ext_matrix_uint3x4_sized
/// @file glm/ext/matrix_uint3x2_sized.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_uint3x4_sized GLM_EXT_matrix_uint3x4_sized
/// @ingroup ext
///
/// Include <glm/ext/matrix_uint3x4_sized.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat3x4.hpp"
#include "../ext/scalar_uint_sized.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_uint3x4_sized extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_uint3x4_sized
/// @{
/// 8 bit unsigned integer 3x4 matrix.
///
/// @see ext_matrix_uint3x4_sized
typedef mat<3, 4, uint8, defaultp> u8mat3x4;
/// 16 bit unsigned integer 3x4 matrix.
///
/// @see ext_matrix_uint3x4_sized
typedef mat<3, 4, uint16, defaultp> u16mat3x4;
/// 32 bit unsigned integer 3x4 matrix.
///
/// @see ext_matrix_uint3x4_sized
typedef mat<3, 4, uint32, defaultp> u32mat3x4;
/// 64 bit unsigned integer 3x4 matrix.
///
/// @see ext_matrix_uint3x4_sized
typedef mat<3, 4, uint64, defaultp> u64mat3x4;
/// @}
}//namespace glm

View file

@ -0,0 +1,33 @@
/// @ref ext_matrix_uint4x2
/// @file glm/ext/matrix_uint4x2.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_uint4x2 GLM_EXT_matrix_uint4x2
/// @ingroup ext
///
/// Include <glm/ext/matrix_uint4x2.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat4x2.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_uint4x2 extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_uint4x2
/// @{
/// Unsigned integer 4x2 matrix.
///
/// @see ext_matrix_uint4x2
typedef mat<4, 2, uint, defaultp> umat4x2;
/// @}
}//namespace glm

View file

@ -0,0 +1,49 @@
/// @ref ext_matrix_uint4x2_sized
/// @file glm/ext/matrix_uint4x2_sized.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_uint4x2_sized GLM_EXT_matrix_uint4x2_sized
/// @ingroup ext
///
/// Include <glm/ext/matrix_uint4x2_sized.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat4x2.hpp"
#include "../ext/scalar_uint_sized.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_uint4x2_sized extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_uint4x2_sized
/// @{
/// 8 bit unsigned integer 4x2 matrix.
///
/// @see ext_matrix_uint4x2_sized
typedef mat<4, 2, uint8, defaultp> u8mat4x2;
/// 16 bit unsigned integer 4x2 matrix.
///
/// @see ext_matrix_uint4x2_sized
typedef mat<4, 2, uint16, defaultp> u16mat4x2;
/// 32 bit unsigned integer 4x2 matrix.
///
/// @see ext_matrix_uint4x2_sized
typedef mat<4, 2, uint32, defaultp> u32mat4x2;
/// 64 bit unsigned integer 4x2 matrix.
///
/// @see ext_matrix_uint4x2_sized
typedef mat<4, 2, uint64, defaultp> u64mat4x2;
/// @}
}//namespace glm

View file

@ -0,0 +1,33 @@
/// @ref ext_matrix_uint4x3
/// @file glm/ext/matrix_uint4x3.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_uint4x3 GLM_EXT_matrix_uint4x3
/// @ingroup ext
///
/// Include <glm/ext/matrix_uint4x3.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat4x3.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_uint4x3 extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_uint4x3
/// @{
/// Unsigned integer 4x3 matrix.
///
/// @see ext_matrix_uint4x3
typedef mat<4, 3, uint, defaultp> umat4x3;
/// @}
}//namespace glm

View file

@ -0,0 +1,49 @@
/// @ref ext_matrix_uint4x3_sized
/// @file glm/ext/matrix_uint4x3_sized.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_uint4x3_sized GLM_EXT_matrix_uint4x3_sized
/// @ingroup ext
///
/// Include <glm/ext/matrix_uint4x3_sized.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat4x3.hpp"
#include "../ext/scalar_uint_sized.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_uint4x3_sized extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_uint4x3_sized
/// @{
/// 8 bit unsigned integer 4x3 matrix.
///
/// @see ext_matrix_uint4x3_sized
typedef mat<4, 3, uint8, defaultp> u8mat4x3;
/// 16 bit unsigned integer 4x3 matrix.
///
/// @see ext_matrix_uint4x3_sized
typedef mat<4, 3, uint16, defaultp> u16mat4x3;
/// 32 bit unsigned integer 4x3 matrix.
///
/// @see ext_matrix_uint4x3_sized
typedef mat<4, 3, uint32, defaultp> u32mat4x3;
/// 64 bit unsigned integer 4x3 matrix.
///
/// @see ext_matrix_uint4x3_sized
typedef mat<4, 3, uint64, defaultp> u64mat4x3;
/// @}
}//namespace glm

View file

@ -0,0 +1,38 @@
/// @ref ext_matrix_uint4x4
/// @file glm/ext/matrix_uint4x4.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_uint4x4 GLM_EXT_matrix_uint4x4
/// @ingroup ext
///
/// Include <glm/ext/matrix_uint4x4.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat4x4.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_uint4x4 extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_uint4x4
/// @{
/// Unsigned integer 4x4 matrix.
///
/// @see ext_matrix_uint4x4
typedef mat<4, 4, uint, defaultp> umat4x4;
/// Unsigned integer 4x4 matrix.
///
/// @see ext_matrix_uint4x4
typedef mat<4, 4, uint, defaultp> umat4;
/// @}
}//namespace glm

View file

@ -0,0 +1,70 @@
/// @ref ext_matrix_uint4x4_sized
/// @file glm/ext/matrix_uint4x4_sized.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_matrix_uint4x4_sized GLM_EXT_matrix_uint4x4_sized
/// @ingroup ext
///
/// Include <glm/ext/matrix_uint4x4_sized.hpp> to use the features of this extension.
///
/// Defines a number of matrices with integer types.
#pragma once
// Dependency:
#include "../mat4x4.hpp"
#include "../ext/scalar_uint_sized.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_uint4x4_sized extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_uint4x4_sized
/// @{
/// 8 bit unsigned integer 4x4 matrix.
///
/// @see ext_matrix_uint4x4_sized
typedef mat<4, 4, uint8, defaultp> u8mat4x4;
/// 16 bit unsigned integer 4x4 matrix.
///
/// @see ext_matrix_uint4x4_sized
typedef mat<4, 4, uint16, defaultp> u16mat4x4;
/// 32 bit unsigned integer 4x4 matrix.
///
/// @see ext_matrix_uint4x4_sized
typedef mat<4, 4, uint32, defaultp> u32mat4x4;
/// 64 bit unsigned integer 4x4 matrix.
///
/// @see ext_matrix_uint4x4_sized
typedef mat<4, 4, uint64, defaultp> u64mat4x4;
/// 8 bit unsigned integer 4x4 matrix.
///
/// @see ext_matrix_uint4x4_sized
typedef mat<4, 4, uint8, defaultp> u8mat4;
/// 16 bit unsigned integer 4x4 matrix.
///
/// @see ext_matrix_uint4x4_sized
typedef mat<4, 4, uint16, defaultp> u16mat4;
/// 32 bit unsigned integer 4x4 matrix.
///
/// @see ext_matrix_uint4x4_sized
typedef mat<4, 4, uint32, defaultp> u32mat4;
/// 64 bit unsigned integer 4x4 matrix.
///
/// @see ext_matrix_uint4x4_sized
typedef mat<4, 4, uint64, defaultp> u64mat4;
/// @}
}//namespace glm

View file

@ -0,0 +1,135 @@
/// @ref ext_quaternion_common
/// @file glm/ext/quaternion_common.hpp
///
/// @defgroup ext_quaternion_common GLM_EXT_quaternion_common
/// @ingroup ext
///
/// Provides common functions for quaternion types
///
/// Include <glm/ext/quaternion_common.hpp> to use the features of this extension.
///
/// @see ext_scalar_common
/// @see ext_vector_common
/// @see ext_quaternion_float
/// @see ext_quaternion_double
/// @see ext_quaternion_exponential
/// @see ext_quaternion_geometric
/// @see ext_quaternion_relational
/// @see ext_quaternion_trigonometric
/// @see ext_quaternion_transform
#pragma once
// Dependency:
#include "../ext/scalar_constants.hpp"
#include "../ext/quaternion_geometric.hpp"
#include "../common.hpp"
#include "../trigonometric.hpp"
#include "../exponential.hpp"
#include <limits>
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_quaternion_common extension included")
#endif
namespace glm
{
/// @addtogroup ext_quaternion_common
/// @{
/// Spherical linear interpolation of two quaternions.
/// The interpolation is oriented and the rotation is performed at constant speed.
/// For short path spherical linear interpolation, use the slerp function.
///
/// @param x A quaternion
/// @param y A quaternion
/// @param a Interpolation factor. The interpolation is defined beyond the range [0, 1].
///
/// @tparam T A floating-point scalar type
/// @tparam Q A value from qualifier enum
///
/// @see - slerp(qua<T, Q> const& x, qua<T, Q> const& y, T const& a)
template<typename T, qualifier Q>
GLM_FUNC_DECL qua<T, Q> mix(qua<T, Q> const& x, qua<T, Q> const& y, T a);
/// Linear interpolation of two quaternions.
/// The interpolation is oriented.
///
/// @param x A quaternion
/// @param y A quaternion
/// @param a Interpolation factor. The interpolation is defined in the range [0, 1].
///
/// @tparam T A floating-point scalar type
/// @tparam Q A value from qualifier enum
template<typename T, qualifier Q>
GLM_FUNC_DECL qua<T, Q> lerp(qua<T, Q> const& x, qua<T, Q> const& y, T a);
/// Spherical linear interpolation of two quaternions.
/// The interpolation always take the short path and the rotation is performed at constant speed.
///
/// @param x A quaternion
/// @param y A quaternion
/// @param a Interpolation factor. The interpolation is defined beyond the range [0, 1].
///
/// @tparam T A floating-point scalar type
/// @tparam Q A value from qualifier enum
template<typename T, qualifier Q>
GLM_FUNC_DECL qua<T, Q> slerp(qua<T, Q> const& x, qua<T, Q> const& y, T a);
/// Spherical linear interpolation of two quaternions with multiple spins over rotation axis.
/// The interpolation always take the short path when the spin count is positive and long path
/// when count is negative. Rotation is performed at constant speed.
///
/// @param x A quaternion
/// @param y A quaternion
/// @param a Interpolation factor. The interpolation is defined beyond the range [0, 1].
/// @param k Additional spin count. If Value is negative interpolation will be on "long" path.
///
/// @tparam T A floating-point scalar type
/// @tparam S An integer scalar type
/// @tparam Q A value from qualifier enum
template<typename T, typename S, qualifier Q>
GLM_FUNC_DECL qua<T, Q> slerp(qua<T, Q> const& x, qua<T, Q> const& y, T a, S k);
/// Returns the q conjugate.
///
/// @tparam T A floating-point scalar type
/// @tparam Q A value from qualifier enum
template<typename T, qualifier Q>
GLM_FUNC_DECL qua<T, Q> conjugate(qua<T, Q> const& q);
/// Returns the q inverse.
///
/// @tparam T A floating-point scalar type
/// @tparam Q A value from qualifier enum
template<typename T, qualifier Q>
GLM_FUNC_DECL qua<T, Q> inverse(qua<T, Q> const& q);
/// Returns true if x holds a NaN (not a number)
/// representation in the underlying implementation's set of
/// floating point representations. Returns false otherwise,
/// including for implementations with no NaN
/// representations.
///
/// /!\ When using compiler fast math, this function may fail.
///
/// @tparam T A floating-point scalar type
/// @tparam Q A value from qualifier enum
template<typename T, qualifier Q>
GLM_FUNC_DECL vec<4, bool, Q> isnan(qua<T, Q> const& x);
/// Returns true if x holds a positive infinity or negative
/// infinity representation in the underlying implementation's
/// set of floating point representations. Returns false
/// otherwise, including for implementations with no infinity
/// representations.
///
/// @tparam T A floating-point scalar type
/// @tparam Q A value from qualifier enum
template<typename T, qualifier Q>
GLM_FUNC_DECL vec<4, bool, Q> isinf(qua<T, Q> const& x);
/// @}
} //namespace glm
#include "quaternion_common.inl"

View file

@ -0,0 +1,144 @@
namespace glm
{
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER qua<T, Q> mix(qua<T, Q> const& x, qua<T, Q> const& y, T a)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'mix' only accept floating-point inputs");
T const cosTheta = dot(x, y);
// Perform a linear interpolation when cosTheta is close to 1 to avoid side effect of sin(angle) becoming a zero denominator
if(cosTheta > static_cast<T>(1) - epsilon<T>())
{
// Linear interpolation
return qua<T, Q>(
mix(x.w, y.w, a),
mix(x.x, y.x, a),
mix(x.y, y.y, a),
mix(x.z, y.z, a));
}
else
{
// Essential Mathematics, page 467
T angle = acos(cosTheta);
return (sin((static_cast<T>(1) - a) * angle) * x + sin(a * angle) * y) / sin(angle);
}
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER qua<T, Q> lerp(qua<T, Q> const& x, qua<T, Q> const& y, T a)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'lerp' only accept floating-point inputs");
// Lerp is only defined in [0, 1]
assert(a >= static_cast<T>(0));
assert(a <= static_cast<T>(1));
return x * (static_cast<T>(1) - a) + (y * a);
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER qua<T, Q> slerp(qua<T, Q> const& x, qua<T, Q> const& y, T a)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'slerp' only accept floating-point inputs");
qua<T, Q> z = y;
T cosTheta = dot(x, y);
// If cosTheta < 0, the interpolation will take the long way around the sphere.
// To fix this, one quat must be negated.
if(cosTheta < static_cast<T>(0))
{
z = -y;
cosTheta = -cosTheta;
}
// Perform a linear interpolation when cosTheta is close to 1 to avoid side effect of sin(angle) becoming a zero denominator
if(cosTheta > static_cast<T>(1) - epsilon<T>())
{
// Linear interpolation
return qua<T, Q>(
mix(x.w, z.w, a),
mix(x.x, z.x, a),
mix(x.y, z.y, a),
mix(x.z, z.z, a));
}
else
{
// Essential Mathematics, page 467
T angle = acos(cosTheta);
return (sin((static_cast<T>(1) - a) * angle) * x + sin(a * angle) * z) / sin(angle);
}
}
template<typename T, typename S, qualifier Q>
GLM_FUNC_QUALIFIER qua<T, Q> slerp(qua<T, Q> const& x, qua<T, Q> const& y, T a, S k)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'slerp' only accept floating-point inputs");
GLM_STATIC_ASSERT(std::numeric_limits<S>::is_integer, "'slerp' only accept integer for spin count");
qua<T, Q> z = y;
T cosTheta = dot(x, y);
// If cosTheta < 0, the interpolation will take the long way around the sphere.
// To fix this, one quat must be negated.
if (cosTheta < static_cast<T>(0))
{
z = -y;
cosTheta = -cosTheta;
}
// Perform a linear interpolation when cosTheta is close to 1 to avoid side effect of sin(angle) becoming a zero denominator
if (cosTheta > static_cast<T>(1) - epsilon<T>())
{
// Linear interpolation
return qua<T, Q>(
mix(x.w, z.w, a),
mix(x.x, z.x, a),
mix(x.y, z.y, a),
mix(x.z, z.z, a));
}
else
{
// Graphics Gems III, page 96
T angle = acos(cosTheta);
T phi = angle + k * glm::pi<T>();
return (sin(angle - a * phi)* x + sin(a * phi) * z) / sin(angle);
}
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER qua<T, Q> conjugate(qua<T, Q> const& q)
{
return qua<T, Q>(q.w, -q.x, -q.y, -q.z);
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER qua<T, Q> inverse(qua<T, Q> const& q)
{
return conjugate(q) / dot(q, q);
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<4, bool, Q> isnan(qua<T, Q> const& q)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isnan' only accept floating-point inputs");
return vec<4, bool, Q>(isnan(q.x), isnan(q.y), isnan(q.z), isnan(q.w));
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<4, bool, Q> isinf(qua<T, Q> const& q)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isinf' only accept floating-point inputs");
return vec<4, bool, Q>(isinf(q.x), isinf(q.y), isinf(q.z), isinf(q.w));
}
}//namespace glm
#if GLM_CONFIG_SIMD == GLM_ENABLE
# include "quaternion_common_simd.inl"
#endif

View file

@ -0,0 +1,18 @@
#if GLM_ARCH & GLM_ARCH_SSE2_BIT
namespace glm{
namespace detail
{
template<qualifier Q>
struct compute_dot<qua<float, Q>, float, true>
{
static GLM_FUNC_QUALIFIER float call(qua<float, Q> const& x, qua<float, Q> const& y)
{
return _mm_cvtss_f32(glm_vec1_dot(x.data, y.data));
}
};
}//namespace detail
}//namespace glm
#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT

View file

@ -0,0 +1,39 @@
/// @ref ext_quaternion_double
/// @file glm/ext/quaternion_double.hpp
///
/// @defgroup ext_quaternion_double GLM_EXT_quaternion_double
/// @ingroup ext
///
/// Exposes double-precision floating point quaternion type.
///
/// Include <glm/ext/quaternion_double.hpp> to use the features of this extension.
///
/// @see ext_quaternion_float
/// @see ext_quaternion_double_precision
/// @see ext_quaternion_common
/// @see ext_quaternion_exponential
/// @see ext_quaternion_geometric
/// @see ext_quaternion_relational
/// @see ext_quaternion_transform
/// @see ext_quaternion_trigonometric
#pragma once
// Dependency:
#include "../detail/type_quat.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_quaternion_double extension included")
#endif
namespace glm
{
/// @addtogroup ext_quaternion_double
/// @{
/// Quaternion of double-precision floating-point numbers.
typedef qua<double, defaultp> dquat;
/// @}
} //namespace glm

View file

@ -0,0 +1,42 @@
/// @ref ext_quaternion_double_precision
/// @file glm/ext/quaternion_double_precision.hpp
///
/// @defgroup ext_quaternion_double_precision GLM_EXT_quaternion_double_precision
/// @ingroup ext
///
/// Exposes double-precision floating point quaternion type with various precision in term of ULPs.
///
/// Include <glm/ext/quaternion_double_precision.hpp> to use the features of this extension.
#pragma once
// Dependency:
#include "../detail/type_quat.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_quaternion_double_precision extension included")
#endif
namespace glm
{
/// @addtogroup ext_quaternion_double_precision
/// @{
/// Quaternion of double-precision floating-point numbers using high precision arithmetic in term of ULPs.
///
/// @see ext_quaternion_double_precision
typedef qua<double, lowp> lowp_dquat;
/// Quaternion of medium double-qualifier floating-point numbers using high precision arithmetic in term of ULPs.
///
/// @see ext_quaternion_double_precision
typedef qua<double, mediump> mediump_dquat;
/// Quaternion of high double-qualifier floating-point numbers using high precision arithmetic in term of ULPs.
///
/// @see ext_quaternion_double_precision
typedef qua<double, highp> highp_dquat;
/// @}
} //namespace glm

View file

@ -0,0 +1,63 @@
/// @ref ext_quaternion_exponential
/// @file glm/ext/quaternion_exponential.hpp
///
/// @defgroup ext_quaternion_exponential GLM_EXT_quaternion_exponential
/// @ingroup ext
///
/// Provides exponential functions for quaternion types
///
/// Include <glm/ext/quaternion_exponential.hpp> to use the features of this extension.
///
/// @see core_exponential
/// @see ext_quaternion_float
/// @see ext_quaternion_double
#pragma once
// Dependency:
#include "../common.hpp"
#include "../trigonometric.hpp"
#include "../geometric.hpp"
#include "../ext/scalar_constants.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_quaternion_exponential extension included")
#endif
namespace glm
{
/// @addtogroup ext_quaternion_transform
/// @{
/// Returns a exponential of a quaternion.
///
/// @tparam T A floating-point scalar type
/// @tparam Q A value from qualifier enum
template<typename T, qualifier Q>
GLM_FUNC_DECL qua<T, Q> exp(qua<T, Q> const& q);
/// Returns a logarithm of a quaternion
///
/// @tparam T A floating-point scalar type
/// @tparam Q A value from qualifier enum
template<typename T, qualifier Q>
GLM_FUNC_DECL qua<T, Q> log(qua<T, Q> const& q);
/// Returns a quaternion raised to a power.
///
/// @tparam T A floating-point scalar type
/// @tparam Q A value from qualifier enum
template<typename T, qualifier Q>
GLM_FUNC_DECL qua<T, Q> pow(qua<T, Q> const& q, T y);
/// Returns the square root of a quaternion
///
/// @tparam T A floating-point scalar type
/// @tparam Q A value from qualifier enum
template<typename T, qualifier Q>
GLM_FUNC_DECL qua<T, Q> sqrt(qua<T, Q> const& q);
/// @}
} //namespace glm
#include "quaternion_exponential.inl"

View file

@ -0,0 +1,85 @@
#include "scalar_constants.hpp"
namespace glm
{
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER qua<T, Q> exp(qua<T, Q> const& q)
{
vec<3, T, Q> u(q.x, q.y, q.z);
T const Angle = glm::length(u);
if (Angle < epsilon<T>())
return qua<T, Q>();
vec<3, T, Q> const v(u / Angle);
return qua<T, Q>(cos(Angle), sin(Angle) * v);
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER qua<T, Q> log(qua<T, Q> const& q)
{
vec<3, T, Q> u(q.x, q.y, q.z);
T Vec3Len = length(u);
if (Vec3Len < epsilon<T>())
{
if(q.w > static_cast<T>(0))
return qua<T, Q>(log(q.w), static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
else if(q.w < static_cast<T>(0))
return qua<T, Q>(log(-q.w), pi<T>(), static_cast<T>(0), static_cast<T>(0));
else
return qua<T, Q>(std::numeric_limits<T>::infinity(), std::numeric_limits<T>::infinity(), std::numeric_limits<T>::infinity(), std::numeric_limits<T>::infinity());
}
else
{
T t = atan(Vec3Len, T(q.w)) / Vec3Len;
T QuatLen2 = Vec3Len * Vec3Len + q.w * q.w;
return qua<T, Q>(static_cast<T>(0.5) * log(QuatLen2), t * q.x, t * q.y, t * q.z);
}
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER qua<T, Q> pow(qua<T, Q> const& x, T y)
{
//Raising to the power of 0 should yield 1
//Needed to prevent a division by 0 error later on
if(y > -epsilon<T>() && y < epsilon<T>())
return qua<T, Q>(1,0,0,0);
//To deal with non-unit quaternions
T magnitude = sqrt(x.x * x.x + x.y * x.y + x.z * x.z + x.w *x.w);
T Angle;
if(abs(x.w / magnitude) > cos_one_over_two<T>())
{
//Scalar component is close to 1; using it to recover angle would lose precision
//Instead, we use the non-scalar components since sin() is accurate around 0
//Prevent a division by 0 error later on
T VectorMagnitude = x.x * x.x + x.y * x.y + x.z * x.z;
if (glm::abs(VectorMagnitude - static_cast<T>(0)) < glm::epsilon<T>()) {
//Equivalent to raising a real number to a power
return qua<T, Q>(pow(x.w, y), 0, 0, 0);
}
Angle = asin(sqrt(VectorMagnitude) / magnitude);
}
else
{
//Scalar component is small, shouldn't cause loss of precision
Angle = acos(x.w / magnitude);
}
T NewAngle = Angle * y;
T Div = sin(NewAngle) / sin(Angle);
T Mag = pow(magnitude, y - static_cast<T>(1));
return qua<T, Q>(cos(NewAngle) * magnitude * Mag, x.x * Div * Mag, x.y * Div * Mag, x.z * Div * Mag);
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER qua<T, Q> sqrt(qua<T, Q> const& x)
{
return pow(x, static_cast<T>(0.5));
}
}//namespace glm

View file

@ -0,0 +1,39 @@
/// @ref ext_quaternion_float
/// @file glm/ext/quaternion_float.hpp
///
/// @defgroup ext_quaternion_float GLM_EXT_quaternion_float
/// @ingroup ext
///
/// Exposes single-precision floating point quaternion type.
///
/// Include <glm/ext/quaternion_float.hpp> to use the features of this extension.
///
/// @see ext_quaternion_double
/// @see ext_quaternion_float_precision
/// @see ext_quaternion_common
/// @see ext_quaternion_exponential
/// @see ext_quaternion_geometric
/// @see ext_quaternion_relational
/// @see ext_quaternion_transform
/// @see ext_quaternion_trigonometric
#pragma once
// Dependency:
#include "../detail/type_quat.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_quaternion_float extension included")
#endif
namespace glm
{
/// @addtogroup ext_quaternion_float
/// @{
/// Quaternion of single-precision floating-point numbers.
typedef qua<float, defaultp> quat;
/// @}
} //namespace glm

View file

@ -0,0 +1,36 @@
/// @ref ext_quaternion_float_precision
/// @file glm/ext/quaternion_float_precision.hpp
///
/// @defgroup ext_quaternion_float_precision GLM_EXT_quaternion_float_precision
/// @ingroup ext
///
/// Exposes single-precision floating point quaternion type with various precision in term of ULPs.
///
/// Include <glm/ext/quaternion_float_precision.hpp> to use the features of this extension.
#pragma once
// Dependency:
#include "../detail/type_quat.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_quaternion_float_precision extension included")
#endif
namespace glm
{
/// @addtogroup ext_quaternion_float_precision
/// @{
/// Quaternion of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
typedef qua<float, lowp> lowp_quat;
/// Quaternion of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
typedef qua<float, mediump> mediump_quat;
/// Quaternion of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
typedef qua<float, highp> highp_quat;
/// @}
} //namespace glm

View file

@ -0,0 +1,70 @@
/// @ref ext_quaternion_geometric
/// @file glm/ext/quaternion_geometric.hpp
///
/// @defgroup ext_quaternion_geometric GLM_EXT_quaternion_geometric
/// @ingroup ext
///
/// Provides geometric functions for quaternion types
///
/// Include <glm/ext/quaternion_geometric.hpp> to use the features of this extension.
///
/// @see core_geometric
/// @see ext_quaternion_float
/// @see ext_quaternion_double
#pragma once
// Dependency:
#include "../geometric.hpp"
#include "../exponential.hpp"
#include "../ext/vector_relational.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_quaternion_geometric extension included")
#endif
namespace glm
{
/// @addtogroup ext_quaternion_geometric
/// @{
/// Returns the norm of a quaternions
///
/// @tparam T Floating-point scalar types
/// @tparam Q Value from qualifier enum
///
/// @see ext_quaternion_geometric
template<typename T, qualifier Q>
GLM_FUNC_DECL T length(qua<T, Q> const& q);
/// Returns the normalized quaternion.
///
/// @tparam T Floating-point scalar types
/// @tparam Q Value from qualifier enum
///
/// @see ext_quaternion_geometric
template<typename T, qualifier Q>
GLM_FUNC_DECL qua<T, Q> normalize(qua<T, Q> const& q);
/// Returns dot product of q1 and q2, i.e., q1[0] * q2[0] + q1[1] * q2[1] + ...
///
/// @tparam T Floating-point scalar types.
/// @tparam Q Value from qualifier enum
///
/// @see ext_quaternion_geometric
template<typename T, qualifier Q>
GLM_FUNC_DECL T dot(qua<T, Q> const& x, qua<T, Q> const& y);
/// Compute a cross product.
///
/// @tparam T Floating-point scalar types
/// @tparam Q Value from qualifier enum
///
/// @see ext_quaternion_geometric
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER qua<T, Q> cross(qua<T, Q> const& q1, qua<T, Q> const& q2);
/// @}
} //namespace glm
#include "quaternion_geometric.inl"

View file

@ -0,0 +1,36 @@
namespace glm
{
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER T dot(qua<T, Q> const& x, qua<T, Q> const& y)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' accepts only floating-point inputs");
return detail::compute_dot<qua<T, Q>, T, detail::is_aligned<Q>::value>::call(x, y);
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER T length(qua<T, Q> const& q)
{
return glm::sqrt(dot(q, q));
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER qua<T, Q> normalize(qua<T, Q> const& q)
{
T len = length(q);
if(len <= static_cast<T>(0)) // Problem
return qua<T, Q>(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
T oneOverLen = static_cast<T>(1) / len;
return qua<T, Q>(q.w * oneOverLen, q.x * oneOverLen, q.y * oneOverLen, q.z * oneOverLen);
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER qua<T, Q> cross(qua<T, Q> const& q1, qua<T, Q> const& q2)
{
return qua<T, Q>(
q1.w * q2.w - q1.x * q2.x - q1.y * q2.y - q1.z * q2.z,
q1.w * q2.x + q1.x * q2.w + q1.y * q2.z - q1.z * q2.y,
q1.w * q2.y + q1.y * q2.w + q1.z * q2.x - q1.x * q2.z,
q1.w * q2.z + q1.z * q2.w + q1.x * q2.y - q1.y * q2.x);
}
}//namespace glm

View file

@ -0,0 +1,62 @@
/// @ref ext_quaternion_relational
/// @file glm/ext/quaternion_relational.hpp
///
/// @defgroup ext_quaternion_relational GLM_EXT_quaternion_relational
/// @ingroup ext
///
/// Exposes comparison functions for quaternion types that take a user defined epsilon values.
///
/// Include <glm/ext/quaternion_relational.hpp> to use the features of this extension.
///
/// @see core_vector_relational
/// @see ext_vector_relational
/// @see ext_matrix_relational
/// @see ext_quaternion_float
/// @see ext_quaternion_double
#pragma once
// Dependency:
#include "../vector_relational.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_quaternion_relational extension included")
#endif
namespace glm
{
/// @addtogroup ext_quaternion_relational
/// @{
/// Returns the component-wise comparison of result x == y.
///
/// @tparam T Floating-point scalar types
/// @tparam Q Value from qualifier enum
template<typename T, qualifier Q>
GLM_FUNC_DECL vec<4, bool, Q> equal(qua<T, Q> const& x, qua<T, Q> const& y);
/// Returns the component-wise comparison of |x - y| < epsilon.
///
/// @tparam T Floating-point scalar types
/// @tparam Q Value from qualifier enum
template<typename T, qualifier Q>
GLM_FUNC_DECL vec<4, bool, Q> equal(qua<T, Q> const& x, qua<T, Q> const& y, T epsilon);
/// Returns the component-wise comparison of result x != y.
///
/// @tparam T Floating-point scalar types
/// @tparam Q Value from qualifier enum
template<typename T, qualifier Q>
GLM_FUNC_DECL vec<4, bool, Q> notEqual(qua<T, Q> const& x, qua<T, Q> const& y);
/// Returns the component-wise comparison of |x - y| >= epsilon.
///
/// @tparam T Floating-point scalar types
/// @tparam Q Value from qualifier enum
template<typename T, qualifier Q>
GLM_FUNC_DECL vec<4, bool, Q> notEqual(qua<T, Q> const& x, qua<T, Q> const& y, T epsilon);
/// @}
} //namespace glm
#include "quaternion_relational.inl"

View file

@ -0,0 +1,35 @@
namespace glm
{
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<4, bool, Q> equal(qua<T, Q> const& x, qua<T, Q> const& y)
{
vec<4, bool, Q> Result;
for(length_t i = 0; i < x.length(); ++i)
Result[i] = x[i] == y[i];
return Result;
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<4, bool, Q> equal(qua<T, Q> const& x, qua<T, Q> const& y, T epsilon)
{
vec<4, T, Q> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w);
return lessThan(abs(v), vec<4, T, Q>(epsilon));
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<4, bool, Q> notEqual(qua<T, Q> const& x, qua<T, Q> const& y)
{
vec<4, bool, Q> Result;
for(length_t i = 0; i < x.length(); ++i)
Result[i] = x[i] != y[i];
return Result;
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<4, bool, Q> notEqual(qua<T, Q> const& x, qua<T, Q> const& y, T epsilon)
{
vec<4, T, Q> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w);
return greaterThanEqual(abs(v), vec<4, T, Q>(epsilon));
}
}//namespace glm

View file

@ -0,0 +1,47 @@
/// @ref ext_quaternion_transform
/// @file glm/ext/quaternion_transform.hpp
///
/// @defgroup ext_quaternion_transform GLM_EXT_quaternion_transform
/// @ingroup ext
///
/// Provides transformation functions for quaternion types
///
/// Include <glm/ext/quaternion_transform.hpp> to use the features of this extension.
///
/// @see ext_quaternion_float
/// @see ext_quaternion_double
/// @see ext_quaternion_exponential
/// @see ext_quaternion_geometric
/// @see ext_quaternion_relational
/// @see ext_quaternion_trigonometric
#pragma once
// Dependency:
#include "../common.hpp"
#include "../trigonometric.hpp"
#include "../geometric.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_quaternion_transform extension included")
#endif
namespace glm
{
/// @addtogroup ext_quaternion_transform
/// @{
/// Rotates a quaternion from a vector of 3 components axis and an angle.
///
/// @param q Source orientation
/// @param angle Angle expressed in radians.
/// @param axis Axis of the rotation
///
/// @tparam T Floating-point scalar types
/// @tparam Q Value from qualifier enum
template<typename T, qualifier Q>
GLM_FUNC_DECL qua<T, Q> rotate(qua<T, Q> const& q, T const& angle, vec<3, T, Q> const& axis);
/// @}
} //namespace glm
#include "quaternion_transform.inl"

View file

@ -0,0 +1,24 @@
namespace glm
{
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER qua<T, Q> rotate(qua<T, Q> const& q, T const& angle, vec<3, T, Q> const& v)
{
vec<3, T, Q> Tmp = v;
// Axis of rotation must be normalised
T len = glm::length(Tmp);
if(abs(len - static_cast<T>(1)) > static_cast<T>(0.001))
{
T oneOverLen = static_cast<T>(1) / len;
Tmp.x *= oneOverLen;
Tmp.y *= oneOverLen;
Tmp.z *= oneOverLen;
}
T const AngleRad(angle);
T const Sin = sin(AngleRad * static_cast<T>(0.5));
return q * qua<T, Q>(cos(AngleRad * static_cast<T>(0.5)), Tmp.x * Sin, Tmp.y * Sin, Tmp.z * Sin);
}
}//namespace glm

View file

@ -0,0 +1,63 @@
/// @ref ext_quaternion_trigonometric
/// @file glm/ext/quaternion_trigonometric.hpp
///
/// @defgroup ext_quaternion_trigonometric GLM_EXT_quaternion_trigonometric
/// @ingroup ext
///
/// Provides trigonometric functions for quaternion types
///
/// Include <glm/ext/quaternion_trigonometric.hpp> to use the features of this extension.
///
/// @see ext_quaternion_float
/// @see ext_quaternion_double
/// @see ext_quaternion_exponential
/// @see ext_quaternion_geometric
/// @see ext_quaternion_relational
/// @see ext_quaternion_transform
#pragma once
// Dependency:
#include "../trigonometric.hpp"
#include "../exponential.hpp"
#include "scalar_constants.hpp"
#include "vector_relational.hpp"
#include <limits>
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_quaternion_trigonometric extension included")
#endif
namespace glm
{
/// @addtogroup ext_quaternion_trigonometric
/// @{
/// Returns the quaternion rotation angle.
///
/// @tparam T A floating-point scalar type
/// @tparam Q A value from qualifier enum
template<typename T, qualifier Q>
GLM_FUNC_DECL T angle(qua<T, Q> const& x);
/// Returns the q rotation axis.
///
/// @tparam T A floating-point scalar type
/// @tparam Q A value from qualifier enum
template<typename T, qualifier Q>
GLM_FUNC_DECL vec<3, T, Q> axis(qua<T, Q> const& x);
/// Build a quaternion from an angle and a normalized axis.
///
/// @param angle Angle expressed in radians.
/// @param axis Axis of the quaternion, must be normalized.
///
/// @tparam T A floating-point scalar type
/// @tparam Q A value from qualifier enum
template<typename T, qualifier Q>
GLM_FUNC_DECL qua<T, Q> angleAxis(T const& angle, vec<3, T, Q> const& axis);
/// @}
} //namespace glm
#include "quaternion_trigonometric.inl"

View file

@ -0,0 +1,34 @@
#include "scalar_constants.hpp"
namespace glm
{
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER T angle(qua<T, Q> const& x)
{
if (abs(x.w) > cos_one_over_two<T>())
{
return asin(sqrt(x.x * x.x + x.y * x.y + x.z * x.z)) * static_cast<T>(2);
}
return acos(x.w) * static_cast<T>(2);
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<3, T, Q> axis(qua<T, Q> const& x)
{
T const tmp1 = static_cast<T>(1) - x.w * x.w;
if(tmp1 <= static_cast<T>(0))
return vec<3, T, Q>(0, 0, 1);
T const tmp2 = static_cast<T>(1) / sqrt(tmp1);
return vec<3, T, Q>(x.x * tmp2, x.y * tmp2, x.z * tmp2);
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER qua<T, Q> angleAxis(T const& angle, vec<3, T, Q> const& v)
{
T const a(angle);
T const s = glm::sin(a * static_cast<T>(0.5));
return qua<T, Q>(glm::cos(a * static_cast<T>(0.5)), v * s);
}
}//namespace glm

157
vendor/include/glm/ext/scalar_common.hpp vendored Normal file
View file

@ -0,0 +1,157 @@
/// @ref ext_scalar_common
/// @file glm/ext/scalar_common.hpp
///
/// @defgroup ext_scalar_common GLM_EXT_scalar_common
/// @ingroup ext
///
/// Exposes min and max functions for 3 to 4 scalar parameters.
///
/// Include <glm/ext/scalar_common.hpp> to use the features of this extension.
///
/// @see core_func_common
/// @see ext_vector_common
#pragma once
// Dependency:
#include "../common.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_scalar_common extension included")
#endif
namespace glm
{
/// @addtogroup ext_scalar_common
/// @{
/// Returns the minimum component-wise values of 3 inputs
///
/// @tparam T A floating-point scalar type.
///
/// @see ext_scalar_common
template<typename T>
GLM_FUNC_DECL T min(T a, T b, T c);
/// Returns the minimum component-wise values of 4 inputs
///
/// @tparam T A floating-point scalar type.
///
/// @see ext_scalar_common
template<typename T>
GLM_FUNC_DECL T min(T a, T b, T c, T d);
/// Returns the maximum component-wise values of 3 inputs
///
/// @tparam T A floating-point scalar type.
///
/// @see ext_scalar_common
template<typename T>
GLM_FUNC_DECL T max(T a, T b, T c);
/// Returns the maximum component-wise values of 4 inputs
///
/// @tparam T A floating-point scalar type.
///
/// @see ext_scalar_common
template<typename T>
GLM_FUNC_DECL T max(T a, T b, T c, T d);
/// Returns the minimum component-wise values of 2 inputs. If one of the two arguments is NaN, the value of the other argument is returned.
///
/// @tparam T A floating-point scalar type.
///
/// @see <a href="http://en.cppreference.com/w/cpp/numeric/math/fmin">std::fmin documentation</a>
/// @see ext_scalar_common
template<typename T>
GLM_FUNC_DECL T fmin(T a, T b);
/// Returns the minimum component-wise values of 3 inputs. If one of the two arguments is NaN, the value of the other argument is returned.
///
/// @tparam T A floating-point scalar type.
///
/// @see <a href="http://en.cppreference.com/w/cpp/numeric/math/fmin">std::fmin documentation</a>
/// @see ext_scalar_common
template<typename T>
GLM_FUNC_DECL T fmin(T a, T b, T c);
/// Returns the minimum component-wise values of 4 inputs. If one of the two arguments is NaN, the value of the other argument is returned.
///
/// @tparam T A floating-point scalar type.
///
/// @see <a href="http://en.cppreference.com/w/cpp/numeric/math/fmin">std::fmin documentation</a>
/// @see ext_scalar_common
template<typename T>
GLM_FUNC_DECL T fmin(T a, T b, T c, T d);
/// Returns the maximum component-wise values of 2 inputs. If one of the two arguments is NaN, the value of the other argument is returned.
///
/// @tparam T A floating-point scalar type.
///
/// @see <a href="http://en.cppreference.com/w/cpp/numeric/math/fmax">std::fmax documentation</a>
/// @see ext_scalar_common
template<typename T>
GLM_FUNC_DECL T fmax(T a, T b);
/// Returns the maximum component-wise values of 3 inputs. If one of the two arguments is NaN, the value of the other argument is returned.
///
/// @tparam T A floating-point scalar type.
///
/// @see <a href="http://en.cppreference.com/w/cpp/numeric/math/fmax">std::fmax documentation</a>
/// @see ext_scalar_common
template<typename T>
GLM_FUNC_DECL T fmax(T a, T b, T C);
/// Returns the maximum component-wise values of 4 inputs. If one of the two arguments is NaN, the value of the other argument is returned.
///
/// @tparam T A floating-point scalar type.
///
/// @see <a href="http://en.cppreference.com/w/cpp/numeric/math/fmax">std::fmax documentation</a>
/// @see ext_scalar_common
template<typename T>
GLM_FUNC_DECL T fmax(T a, T b, T C, T D);
/// Returns min(max(x, minVal), maxVal) for each component in x. If one of the two arguments is NaN, the value of the other argument is returned.
///
/// @tparam genType Floating-point scalar types.
///
/// @see ext_scalar_common
template<typename genType>
GLM_FUNC_DECL genType fclamp(genType x, genType minVal, genType maxVal);
/// Simulate GL_CLAMP OpenGL wrap mode
///
/// @tparam genType Floating-point scalar types.
///
/// @see ext_scalar_common extension.
template<typename genType>
GLM_FUNC_DECL genType clamp(genType const& Texcoord);
/// Simulate GL_REPEAT OpenGL wrap mode
///
/// @tparam genType Floating-point scalar types.
///
/// @see ext_scalar_common extension.
template<typename genType>
GLM_FUNC_DECL genType repeat(genType const& Texcoord);
/// Simulate GL_MIRRORED_REPEAT OpenGL wrap mode
///
/// @tparam genType Floating-point scalar types.
///
/// @see ext_scalar_common extension.
template<typename genType>
GLM_FUNC_DECL genType mirrorClamp(genType const& Texcoord);
/// Simulate GL_MIRROR_REPEAT OpenGL wrap mode
///
/// @tparam genType Floating-point scalar types.
///
/// @see ext_scalar_common extension.
template<typename genType>
GLM_FUNC_DECL genType mirrorRepeat(genType const& Texcoord);
/// @}
}//namespace glm
#include "scalar_common.inl"

Some files were not shown because too many files have changed in this diff Show more