0.9.9 API documenation
matrix_transform.hpp
Go to the documentation of this file.
1 
21 #pragma once
22 
23 // Dependencies
24 #include "../mat4x4.hpp"
25 #include "../vec2.hpp"
26 #include "../vec3.hpp"
27 #include "../vec4.hpp"
28 #include "../gtc/constants.hpp"
29 
30 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED)
31 # pragma message("GLM: GLM_GTC_matrix_transform extension included")
32 #endif
33 
34 namespace glm
35 {
38 
58  template<typename T, qualifier Q>
59  GLM_FUNC_DECL mat<4, 4, T, Q> translate(
60  mat<4, 4, T, Q> const& m, vec<3, T, Q> const& v);
61 
72  template<typename T, qualifier Q>
73  GLM_FUNC_DECL mat<4, 4, T, Q> rotate(
74  mat<4, 4, T, Q> const& m, T angle, vec<3, T, Q> const& axis);
75 
85  template<typename T, qualifier Q>
86  GLM_FUNC_DECL mat<4, 4, T, Q> scale(
87  mat<4, 4, T, Q> const& m, vec<3, T, Q> const& v);
88 
95  template<typename T>
96  GLM_FUNC_DECL mat<4, 4, T, defaultp> ortho(
97  T left, T right, T bottom, T top);
98 
105  template<typename T>
106  GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoLH_ZO(
107  T left, T right, T bottom, T top, T zNear, T zFar);
108 
115  template<typename T>
116  GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoLH_NO(
117  T left, T right, T bottom, T top, T zNear, T zFar);
118 
125  template<typename T>
126  GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoRH_ZO(
127  T left, T right, T bottom, T top, T zNear, T zFar);
128 
135  template<typename T>
136  GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoRH_NO(
137  T left, T right, T bottom, T top, T zNear, T zFar);
138 
145  template<typename T>
146  GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoZO(
147  T left, T right, T bottom, T top, T zNear, T zFar);
148 
155  template<typename T>
156  GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoNO(
157  T left, T right, T bottom, T top, T zNear, T zFar);
158 
166  template<typename T>
167  GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoLH(
168  T left, T right, T bottom, T top, T zNear, T zFar);
169 
177  template<typename T>
178  GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoRH(
179  T left, T right, T bottom, T top, T zNear, T zFar);
180 
188  template<typename T>
189  GLM_FUNC_DECL mat<4, 4, T, defaultp> ortho(
190  T left, T right, T bottom, T top, T zNear, T zFar);
191 
197  template<typename T>
198  GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumLH_ZO(
199  T left, T right, T bottom, T top, T near, T far);
200 
206  template<typename T>
207  GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumLH_NO(
208  T left, T right, T bottom, T top, T near, T far);
209 
215  template<typename T>
216  GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumRH_ZO(
217  T left, T right, T bottom, T top, T near, T far);
218 
224  template<typename T>
225  GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumRH_NO(
226  T left, T right, T bottom, T top, T near, T far);
227 
233  template<typename T>
234  GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumZO(
235  T left, T right, T bottom, T top, T near, T far);
236 
242  template<typename T>
243  GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumNO(
244  T left, T right, T bottom, T top, T near, T far);
245 
252  template<typename T>
253  GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumLH(
254  T left, T right, T bottom, T top, T near, T far);
255 
262  template<typename T>
263  GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumRH(
264  T left, T right, T bottom, T top, T near, T far);
265 
272  template<typename T>
273  GLM_FUNC_DECL mat<4, 4, T, defaultp> frustum(
274  T left, T right, T bottom, T top, T near, T far);
275 
276 
286  template<typename T>
287  GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveRH_ZO(
288  T fovy, T aspect, T near, T far);
289 
299  template<typename T>
300  GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveRH_NO(
301  T fovy, T aspect, T near, T far);
302 
312  template<typename T>
313  GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveLH_ZO(
314  T fovy, T aspect, T near, T far);
315 
325  template<typename T>
326  GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveLH_NO(
327  T fovy, T aspect, T near, T far);
328 
338  template<typename T>
339  GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveZO(
340  T fovy, T aspect, T near, T far);
341 
351  template<typename T>
352  GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveNO(
353  T fovy, T aspect, T near, T far);
354 
365  template<typename T>
366  GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveRH(
367  T fovy, T aspect, T near, T far);
368 
379  template<typename T>
380  GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveLH(
381  T fovy, T aspect, T near, T far);
382 
393  template<typename T>
394  GLM_FUNC_DECL mat<4, 4, T, defaultp> perspective(
395  T fovy, T aspect, T near, T far);
396 
407  template<typename T>
408  GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovRH_ZO(
409  T fov, T width, T height, T near, T far);
410 
421  template<typename T>
422  GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovRH_NO(
423  T fov, T width, T height, T near, T far);
424 
435  template<typename T>
436  GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovLH_ZO(
437  T fov, T width, T height, T near, T far);
438 
449  template<typename T>
450  GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovLH_NO(
451  T fov, T width, T height, T near, T far);
452 
463  template<typename T>
464  GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovZO(
465  T fov, T width, T height, T near, T far);
466 
477  template<typename T>
478  GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovNO(
479  T fov, T width, T height, T near, T far);
480 
492  template<typename T>
493  GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovRH(
494  T fov, T width, T height, T near, T far);
495 
507  template<typename T>
508  GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovLH(
509  T fov, T width, T height, T near, T far);
510 
521  template<typename T>
522  GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFov(
523  T fov, T width, T height, T near, T far);
524 
532  template<typename T>
533  GLM_FUNC_DECL mat<4, 4, T, defaultp> infinitePerspectiveLH(
534  T fovy, T aspect, T near);
535 
543  template<typename T>
544  GLM_FUNC_DECL mat<4, 4, T, defaultp> infinitePerspectiveRH(
545  T fovy, T aspect, T near);
546 
554  template<typename T>
555  GLM_FUNC_DECL mat<4, 4, T, defaultp> infinitePerspective(
556  T fovy, T aspect, T near);
557 
565  template<typename T>
566  GLM_FUNC_DECL mat<4, 4, T, defaultp> tweakedInfinitePerspective(
567  T fovy, T aspect, T near);
568 
577  template<typename T>
578  GLM_FUNC_DECL mat<4, 4, T, defaultp> tweakedInfinitePerspective(
579  T fovy, T aspect, T near, T ep);
580 
593  template<typename T, typename U, qualifier Q>
594  GLM_FUNC_DECL vec<3, T, Q> projectZO(
595  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);
596 
609  template<typename T, typename U, qualifier Q>
610  GLM_FUNC_DECL vec<3, T, Q> projectNO(
611  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);
612 
625  template<typename T, typename U, qualifier Q>
626  GLM_FUNC_DECL vec<3, T, Q> project(
627  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);
628 
641  template<typename T, typename U, qualifier Q>
642  GLM_FUNC_DECL vec<3, T, Q> unProjectZO(
643  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);
644 
657  template<typename T, typename U, qualifier Q>
658  GLM_FUNC_DECL vec<3, T, Q> unProjectNO(
659  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);
660 
673  template<typename T, typename U, qualifier Q>
674  GLM_FUNC_DECL vec<3, T, Q> unProject(
675  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);
676 
686  template<typename T, qualifier Q, typename U>
687  GLM_FUNC_DECL mat<4, 4, T, Q> pickMatrix(
688  vec<2, T, Q> const& center, vec<2, T, Q> const& delta, vec<4, U, Q> const& viewport);
689 
697  template<typename T, qualifier Q>
698  GLM_FUNC_DECL mat<4, 4, T, Q> lookAtRH(
699  vec<3, T, Q> const& eye, vec<3, T, Q> const& center, vec<3, T, Q> const& up);
700 
708  template<typename T, qualifier Q>
709  GLM_FUNC_DECL mat<4, 4, T, Q> lookAtLH(
710  vec<3, T, Q> const& eye, vec<3, T, Q> const& center, vec<3, T, Q> const& up);
711 
720  template<typename T, qualifier Q>
721  GLM_FUNC_DECL mat<4, 4, T, Q> lookAt(
722  vec<3, T, Q> const& eye, vec<3, T, Q> const& center, vec<3, T, Q> const& up);
723 
725 }//namespace glm
726 
727 #include "matrix_transform.inl"
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.
GLM_FUNC_DECL mat< 4, 4, T, defaultp > perspectiveFov(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 defaul...
GLM_FUNC_DECL mat< 4, 4, T, defaultp > frustum(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 f...
GLM_FUNC_DECL mat< 4, 4, T, defaultp > frustumRH_NO(T left, T right, T bottom, T top, T near, T far)
Creates a right handed frustum matrix.
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 left-handed coordinates.
GLM_FUNC_DECL T angle(tquat< T, Q > const &x)
Returns the quaternion rotation angle.
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.
GLM_FUNC_DECL mat< 4, 4, T, defaultp > perspectiveFovLH(T fov, T width, T height, T near, T far)
Builds a left handed perspective projection matrix based on a field of view.
GLM_FUNC_DECL vec< 3, T, Q > axis(tquat< T, Q > const &x)
Returns the q rotation axis.
GLM_FUNC_DECL mat< 4, 4, T, defaultp > frustumLH(T left, T right, T bottom, T top, T near, T far)
Creates a left handed frustum matrix.
GLM_FUNC_DECL mat< 4, 4, T, defaultp > ortho(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 defaul...
GLM_FUNC_DECL mat< 4, 4, T, defaultp > perspectiveLH(T fovy, T aspect, T near, T far)
Creates a matrix for a left handed, symetric perspective-view frustum.
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 right-handed coordinates.
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.
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.
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.
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 right-handed coordinates.
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-h...
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.
GLM_FUNC_DECL mat< 4, 4, T, defaultp > frustumNO(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-h...
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)
Build a look at view matrix based on the default handedness.
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 left-handed coordinates.
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)
Define a picking region.
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...
GLM_FUNC_DECL mat< 4, 4, T, defaultp > infinitePerspectiveRH(T fovy, T aspect, T near)
Creates a matrix for a right handed, symmetric perspective-view frustum with far plane at infinite...
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...
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_FO...
GLM_FUNC_DECL mat< 4, 4, T, defaultp > perspectiveLH_NO(T fovy, T aspect, T near, T far)
Creates a matrix for a left handed, symetric perspective-view frustum.
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.
Definition: common.hpp:20
GLM_FUNC_DECL mat< 4, 4, T, defaultp > perspectiveRH_NO(T fovy, T aspect, T near, T far)
Creates a matrix for a right handed, symetric perspective-view frustum.
GLM_FUNC_DECL genType proj(genType const &x, genType const &Normal)
Projects x on Normal.
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 right-handed coordinates...
GLM_FUNC_DECL mat< 4, 4, T, defaultp > infinitePerspectiveLH(T fovy, T aspect, T near)
Creates a matrix for a left handed, symmetric perspective-view frustum with far plane at infinite...
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 left-handed coordinates.
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 object coordinates (obj.x, obj.y, obj.z) into window coordinates using default near...
GLM_FUNC_DECL mat< 4, 4, T, Q > translate(mat< 4, 4, T, Q > const &m, vec< 3, T, Q > const &v)
Builds a translation 4 * 4 matrix created from a vector of 3 components.
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 rotation 4 * 4 matrix created from an axis vector and an angle.
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_...
GLM_FUNC_DECL mat< 4, 4, T, defaultp > perspectiveNO(T fovy, T aspect, T near, T far)
Creates a matrix for a symetric perspective-view frustum using left-handed coordinates if GLM_FORCE_L...
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.
GLM_FUNC_DECL mat< 4, 4, T, defaultp > frustumRH(T left, T right, T bottom, T top, T near, T far)
Creates a right handed frustum matrix.
GLM_FUNC_DECL mat< 4, 4, T, Q > scale(mat< 4, 4, T, Q > const &m, vec< 3, T, Q > const &v)
Builds a scale 4 * 4 matrix created from 3 scalars.
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 right-handed coordinates.
GLM_FUNC_DECL mat< 4, 4, T, defaultp > perspectiveRH(T fovy, T aspect, T near, T far)
Creates a matrix for a right handed, symetric perspective-view frustum.
GLM_FUNC_DECL mat< 4, 4, T, defaultp > tweakedInfinitePerspective(T fovy, T aspect, T near, T ep)
Creates a matrix for a symmetric perspective-view frustum with far plane at infinite for graphics har...
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)
Map the specified window coordinates (win.x, win.y, win.z) into object coordinates using default near...
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_L...
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 right handed look at view matrix.
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...
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.
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 left handed look at view matrix.
GLM_FUNC_DECL mat< 4, 4, T, defaultp > frustumLH_NO(T left, T right, T bottom, T top, T near, T far)
Creates a left handed frustum matrix.
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 with default han...
GLM_FUNC_DECL mat< 4, 4, T, defaultp > perspective(T fovy, T aspect, T near, T far)
Creates a matrix for a symetric perspective-view frustum based on the default handedness and default ...
GLM_FUNC_DECL mat< 4, 4, T, defaultp > perspectiveFovNO(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_...
GLM_FUNC_DECL mat< 4, 4, T, defaultp > perspectiveFovRH(T fov, T width, T height, T near, T far)
Builds a right handed perspective projection matrix based on a field of view.