master
ブランチ master
ShaderPlayground / deps / glm / glm / ext / matrix_projection.hpp
7.9 KB、149行 生 Blame 履歴
1/// @ref ext_matrix_projection
2/// @file glm/ext/matrix_projection.hpp
3///
4/// @defgroup ext_matrix_projection GLM_EXT_matrix_projection
5/// @ingroup ext
6///
7/// Functions that generate common projection transformation matrices.
8///
9/// The matrices generated by this extension use standard OpenGL fixed-function
10/// conventions. For example, the lookAt function generates a transform from world
11/// space into the specific eye space that the projective matrix functions
12/// (perspective, ortho, etc) are designed to expect. The OpenGL compatibility
13/// specifications defines the particular layout of this eye space.
14///
15/// Include <glm/ext/matrix_projection.hpp> to use the features of this extension.
16///
17/// @see ext_matrix_transform
18/// @see ext_matrix_clip_space
19
20#pragma once
21
22// Dependencies
23#include "../gtc/constants.hpp"
24#include "../geometric.hpp"
25#include "../trigonometric.hpp"
26#include "../matrix.hpp"
27
28#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
29# pragma message("GLM: GLM_EXT_matrix_projection extension included")
30#endif
31
32namespace glm
33{
34 /// @addtogroup ext_matrix_projection
35 /// @{
36
37 /// Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates.
38 /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
39 ///
40 /// @param obj Specify the object coordinates.
41 /// @param model Specifies the current modelview matrix
42 /// @param proj Specifies the current projection matrix
43 /// @param viewport Specifies the current viewport
44 /// @return Return the computed window coordinates.
45 /// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.
46 /// @tparam U Currently supported: Floating-point types and integer types.
47 ///
48 /// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluProject.xml">gluProject man page</a>
49 template<typename T, typename U, qualifier Q>
50 GLM_FUNC_DECL vec<3, T, Q> projectZO(
51 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);
52
53 /// Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates.
54 /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
55 ///
56 /// @param obj Specify the object coordinates.
57 /// @param model Specifies the current modelview matrix
58 /// @param proj Specifies the current projection matrix
59 /// @param viewport Specifies the current viewport
60 /// @return Return the computed window coordinates.
61 /// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.
62 /// @tparam U Currently supported: Floating-point types and integer types.
63 ///
64 /// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluProject.xml">gluProject man page</a>
65 template<typename T, typename U, qualifier Q>
66 GLM_FUNC_DECL vec<3, T, Q> projectNO(
67 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);
68
69 /// Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates using default near and far clip planes definition.
70 /// To change default near and far clip planes definition use GLM_FORCE_DEPTH_ZERO_TO_ONE.
71 ///
72 /// @param obj Specify the object coordinates.
73 /// @param model Specifies the current modelview matrix
74 /// @param proj Specifies the current projection matrix
75 /// @param viewport Specifies the current viewport
76 /// @return Return the computed window coordinates.
77 /// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.
78 /// @tparam U Currently supported: Floating-point types and integer types.
79 ///
80 /// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluProject.xml">gluProject man page</a>
81 template<typename T, typename U, qualifier Q>
82 GLM_FUNC_DECL vec<3, T, Q> project(
83 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);
84
85 /// Map the specified window coordinates (win.x, win.y, win.z) into object coordinates.
86 /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
87 ///
88 /// @param win Specify the window coordinates to be mapped.
89 /// @param model Specifies the modelview matrix
90 /// @param proj Specifies the projection matrix
91 /// @param viewport Specifies the viewport
92 /// @return Returns the computed object coordinates.
93 /// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.
94 /// @tparam U Currently supported: Floating-point types and integer types.
95 ///
96 /// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluUnProject.xml">gluUnProject man page</a>
97 template<typename T, typename U, qualifier Q>
98 GLM_FUNC_DECL vec<3, T, Q> unProjectZO(
99 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);
100
101 /// Map the specified window coordinates (win.x, win.y, win.z) into object coordinates.
102 /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
103 ///
104 /// @param win Specify the window coordinates to be mapped.
105 /// @param model Specifies the modelview matrix
106 /// @param proj Specifies the projection matrix
107 /// @param viewport Specifies the viewport
108 /// @return Returns the computed object coordinates.
109 /// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.
110 /// @tparam U Currently supported: Floating-point types and integer types.
111 ///
112 /// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluUnProject.xml">gluUnProject man page</a>
113 template<typename T, typename U, qualifier Q>
114 GLM_FUNC_DECL vec<3, T, Q> unProjectNO(
115 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);
116
117 /// Map the specified window coordinates (win.x, win.y, win.z) into object coordinates using default near and far clip planes definition.
118 /// To change default near and far clip planes definition use GLM_FORCE_DEPTH_ZERO_TO_ONE.
119 ///
120 /// @param win Specify the window coordinates to be mapped.
121 /// @param model Specifies the modelview matrix
122 /// @param proj Specifies the projection matrix
123 /// @param viewport Specifies the viewport
124 /// @return Returns the computed object coordinates.
125 /// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.
126 /// @tparam U Currently supported: Floating-point types and integer types.
127 ///
128 /// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluUnProject.xml">gluUnProject man page</a>
129 template<typename T, typename U, qualifier Q>
130 GLM_FUNC_DECL vec<3, T, Q> unProject(
131 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);
132
133 /// Define a picking region
134 ///
135 /// @param center Specify the center of a picking region in window coordinates.
136 /// @param delta Specify the width and height, respectively, of the picking region in window coordinates.
137 /// @param viewport Rendering viewport
138 /// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.
139 /// @tparam U Currently supported: Floating-point types and integer types.
140 ///
141 /// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluPickMatrix.xml">gluPickMatrix man page</a>
142 template<typename T, qualifier Q, typename U>
143 GLM_FUNC_DECL mat<4, 4, T, Q> pickMatrix(
144 vec<2, T, Q> const& center, vec<2, T, Q> const& delta, vec<4, U, Q> const& viewport);
145
146 /// @}
147}//namespace glm
148
149#include "matrix_projection.inl"