| 1 | /// @ref ext_matrix_clip_space |
| 2 | /// @file glm/ext/matrix_clip_space.hpp |
| 3 | /// |
| 4 | /// @defgroup ext_matrix_clip_space GLM_EXT_matrix_clip_space |
| 5 | /// @ingroup ext |
| 6 | /// |
| 7 | /// Defines functions that generate clip space 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_clip_space.hpp> to use the features of this extension. |
| 16 | /// |
| 17 | /// @see ext_matrix_transform |
| 18 | /// @see ext_matrix_projection |
| 19 | |
| 20 | #pragma once |
| 21 | |
| 22 | // Dependencies |
| 23 | #include "../ext/scalar_constants.hpp" |
| 24 | #include "../geometric.hpp" |
| 25 | #include "../trigonometric.hpp" |
| 26 | |
| 27 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) |
| 28 | # pragma message("GLM: GLM_EXT_matrix_clip_space extension included") |
| 29 | #endif |
| 30 | |
| 31 | namespace glm |
| 32 | { |
| 33 | /// @addtogroup ext_matrix_clip_space |
| 34 | /// @{ |
| 35 | |
| 36 | /// Creates a matrix for projecting two-dimensional coordinates onto the screen. |
| 37 | /// |
| 38 | /// @tparam T A floating-point scalar type |
| 39 | /// |
| 40 | /// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top, T const& zNear, T const& zFar) |
| 41 | /// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluOrtho2D.xml">gluOrtho2D man page</a> |
| 42 | template<typename T> |
| 43 | GLM_FUNC_DECL mat<4, 4, T, defaultp> ortho( |
| 44 | T left, T right, T bottom, T top); |
| 45 | |
| 46 | /// Creates a matrix for an orthographic parallel viewing volume, using left-handed coordinates. |
| 47 | /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition) |
| 48 | /// |
| 49 | /// @tparam T A floating-point scalar type |
| 50 | /// |
| 51 | /// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top) |
| 52 | template<typename T> |
| 53 | GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoLH_ZO( |
| 54 | T left, T right, T bottom, T top, T zNear, T zFar); |
| 55 | |
| 56 | /// Creates a matrix for an orthographic parallel viewing volume using left-handed coordinates. |
| 57 | /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition) |
| 58 | /// |
| 59 | /// @tparam T A floating-point scalar type |
| 60 | /// |
| 61 | /// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top) |
| 62 | template<typename T> |
| 63 | GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoLH_NO( |
| 64 | T left, T right, T bottom, T top, T zNear, T zFar); |
| 65 | |
| 66 | /// Creates a matrix for an orthographic parallel viewing volume, using right-handed coordinates. |
| 67 | /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition) |
| 68 | /// |
| 69 | /// @tparam T A floating-point scalar type |
| 70 | /// |
| 71 | /// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top) |
| 72 | template<typename T> |
| 73 | GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoRH_ZO( |
| 74 | T left, T right, T bottom, T top, T zNear, T zFar); |
| 75 | |
| 76 | /// Creates a matrix for an orthographic parallel viewing volume, using right-handed coordinates. |
| 77 | /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition) |
| 78 | /// |
| 79 | /// @tparam T A floating-point scalar type |
| 80 | /// |
| 81 | /// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top) |
| 82 | template<typename T> |
| 83 | GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoRH_NO( |
| 84 | T left, T right, T bottom, T top, T zNear, T zFar); |
| 85 | |
| 86 | /// Creates a matrix for an orthographic parallel viewing volume, using left-handed coordinates. |
| 87 | /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition) |
| 88 | /// |
| 89 | /// @tparam T A floating-point scalar type |
| 90 | /// |
| 91 | /// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top) |
| 92 | template<typename T> |
| 93 | GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoZO( |
| 94 | T left, T right, T bottom, T top, T zNear, T zFar); |
| 95 | |
| 96 | /// 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. |
| 97 | /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition) |
| 98 | /// |
| 99 | /// @tparam T A floating-point scalar type |
| 100 | /// |
| 101 | /// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top) |
| 102 | template<typename T> |
| 103 | GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoNO( |
| 104 | T left, T right, T bottom, T top, T zNear, T zFar); |
| 105 | |
| 106 | /// Creates a matrix for an orthographic parallel viewing volume, using left-handed coordinates. |
| 107 | /// 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) |
| 108 | /// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition) |
| 109 | /// |
| 110 | /// @tparam T A floating-point scalar type |
| 111 | /// |
| 112 | /// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top) |
| 113 | template<typename T> |
| 114 | GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoLH( |
| 115 | T left, T right, T bottom, T top, T zNear, T zFar); |
| 116 | |
| 117 | /// Creates a matrix for an orthographic parallel viewing volume, using right-handed coordinates. |
| 118 | /// 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) |
| 119 | /// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition) |
| 120 | /// |
| 121 | /// @tparam T A floating-point scalar type |
| 122 | /// |
| 123 | /// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top) |
| 124 | template<typename T> |
| 125 | GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoRH( |
| 126 | T left, T right, T bottom, T top, T zNear, T zFar); |
| 127 | |
| 128 | /// Creates a matrix for an orthographic parallel viewing volume, using the default handedness and default near and far clip planes definition. |
| 129 | /// 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. |
| 130 | /// |
| 131 | /// @tparam T A floating-point scalar type |
| 132 | /// |
| 133 | /// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top) |
| 134 | /// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glOrtho.xml">glOrtho man page</a> |
| 135 | template<typename T> |
| 136 | GLM_FUNC_DECL mat<4, 4, T, defaultp> ortho( |
| 137 | T left, T right, T bottom, T top, T zNear, T zFar); |
| 138 | |
| 139 | /// Creates a left-handed frustum matrix. |
| 140 | /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition) |
| 141 | /// |
| 142 | /// @tparam T A floating-point scalar type |
| 143 | template<typename T> |
| 144 | GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumLH_ZO( |
| 145 | T left, T right, T bottom, T top, T near, T far); |
| 146 | |
| 147 | /// Creates a left-handed frustum matrix. |
| 148 | /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition) |
| 149 | /// |
| 150 | /// @tparam T A floating-point scalar type |
| 151 | template<typename T> |
| 152 | GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumLH_NO( |
| 153 | T left, T right, T bottom, T top, T near, T far); |
| 154 | |
| 155 | /// Creates a right-handed frustum matrix. |
| 156 | /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition) |
| 157 | /// |
| 158 | /// @tparam T A floating-point scalar type |
| 159 | template<typename T> |
| 160 | GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumRH_ZO( |
| 161 | T left, T right, T bottom, T top, T near, T far); |
| 162 | |
| 163 | /// Creates a right-handed frustum matrix. |
| 164 | /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition) |
| 165 | /// |
| 166 | /// @tparam T A floating-point scalar type |
| 167 | template<typename T> |
| 168 | GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumRH_NO( |
| 169 | T left, T right, T bottom, T top, T near, T far); |
| 170 | |
| 171 | /// Creates a frustum matrix using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise. |
| 172 | /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition) |
| 173 | /// |
| 174 | /// @tparam T A floating-point scalar type |
| 175 | template<typename T> |
| 176 | GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumZO( |
| 177 | T left, T right, T bottom, T top, T near, T far); |
| 178 | |
| 179 | /// Creates a frustum matrix using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise. |
| 180 | /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition) |
| 181 | /// |
| 182 | /// @tparam T A floating-point scalar type |
| 183 | template<typename T> |
| 184 | GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumNO( |
| 185 | T left, T right, T bottom, T top, T near, T far); |
| 186 | |
| 187 | /// Creates a left-handed frustum matrix. |
| 188 | /// 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) |
| 189 | /// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition) |
| 190 | /// |
| 191 | /// @tparam T A floating-point scalar type |
| 192 | template<typename T> |
| 193 | GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumLH( |
| 194 | T left, T right, T bottom, T top, T near, T far); |
| 195 | |
| 196 | /// Creates a right-handed frustum matrix. |
| 197 | /// 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) |
| 198 | /// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition) |
| 199 | /// |
| 200 | /// @tparam T A floating-point scalar type |
| 201 | template<typename T> |
| 202 | GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumRH( |
| 203 | T left, T right, T bottom, T top, T near, T far); |
| 204 | |
| 205 | /// Creates a frustum matrix with default handedness, using the default handedness and default near and far clip planes definition. |
| 206 | /// 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. |
| 207 | /// |
| 208 | /// @tparam T A floating-point scalar type |
| 209 | /// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glFrustum.xml">glFrustum man page</a> |
| 210 | template<typename T> |
| 211 | GLM_FUNC_DECL mat<4, 4, T, defaultp> frustum( |
| 212 | T left, T right, T bottom, T top, T near, T far); |
| 213 | |
| 214 | |
| 215 | /// Creates a matrix for a right-handed, symmetric perspective-view frustum. |
| 216 | /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition) |
| 217 | /// |
| 218 | /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians. |
| 219 | /// @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). |
| 220 | /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). |
| 221 | /// @param far Specifies the distance from the viewer to the far clipping plane (always positive). |
| 222 | /// |
| 223 | /// @tparam T A floating-point scalar type |
| 224 | template<typename T> |
| 225 | GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveRH_ZO( |
| 226 | T fovy, T aspect, T near, T far); |
| 227 | |
| 228 | /// Creates a matrix for a right-handed, symmetric perspective-view frustum. |
| 229 | /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition) |
| 230 | /// |
| 231 | /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians. |
| 232 | /// @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). |
| 233 | /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). |
| 234 | /// @param far Specifies the distance from the viewer to the far clipping plane (always positive). |
| 235 | /// |
| 236 | /// @tparam T A floating-point scalar type |
| 237 | template<typename T> |
| 238 | GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveRH_NO( |
| 239 | T fovy, T aspect, T near, T far); |
| 240 | |
| 241 | /// Creates a matrix for a left-handed, symmetric perspective-view frustum. |
| 242 | /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition) |
| 243 | /// |
| 244 | /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians. |
| 245 | /// @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). |
| 246 | /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). |
| 247 | /// @param far Specifies the distance from the viewer to the far clipping plane (always positive). |
| 248 | /// |
| 249 | /// @tparam T A floating-point scalar type |
| 250 | template<typename T> |
| 251 | GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveLH_ZO( |
| 252 | T fovy, T aspect, T near, T far); |
| 253 | |
| 254 | /// Creates a matrix for a left-handed, symmetric perspective-view frustum. |
| 255 | /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition) |
| 256 | /// |
| 257 | /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians. |
| 258 | /// @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). |
| 259 | /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). |
| 260 | /// @param far Specifies the distance from the viewer to the far clipping plane (always positive). |
| 261 | /// |
| 262 | /// @tparam T A floating-point scalar type |
| 263 | template<typename T> |
| 264 | GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveLH_NO( |
| 265 | T fovy, T aspect, T near, T far); |
| 266 | |
| 267 | /// Creates a matrix for a symmetric perspective-view frustum using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise. |
| 268 | /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition) |
| 269 | /// |
| 270 | /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians. |
| 271 | /// @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). |
| 272 | /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). |
| 273 | /// @param far Specifies the distance from the viewer to the far clipping plane (always positive). |
| 274 | /// |
| 275 | /// @tparam T A floating-point scalar type |
| 276 | template<typename T> |
| 277 | GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveZO( |
| 278 | T fovy, T aspect, T near, T far); |
| 279 | |
| 280 | /// Creates a matrix for a symmetric perspective-view frustum using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise. |
| 281 | /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition) |
| 282 | /// |
| 283 | /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians. |
| 284 | /// @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). |
| 285 | /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). |
| 286 | /// @param far Specifies the distance from the viewer to the far clipping plane (always positive). |
| 287 | /// |
| 288 | /// @tparam T A floating-point scalar type |
| 289 | template<typename T> |
| 290 | GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveNO( |
| 291 | T fovy, T aspect, T near, T far); |
| 292 | |
| 293 | /// Creates a matrix for a right-handed, symmetric perspective-view frustum. |
| 294 | /// 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) |
| 295 | /// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition) |
| 296 | /// |
| 297 | /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians. |
| 298 | /// @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). |
| 299 | /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). |
| 300 | /// @param far Specifies the distance from the viewer to the far clipping plane (always positive). |
| 301 | /// |
| 302 | /// @tparam T A floating-point scalar type |
| 303 | template<typename T> |
| 304 | GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveRH( |
| 305 | T fovy, T aspect, T near, T far); |
| 306 | |
| 307 | /// Creates a matrix for a left-handed, symmetric perspective-view frustum. |
| 308 | /// 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) |
| 309 | /// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition) |
| 310 | /// |
| 311 | /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians. |
| 312 | /// @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). |
| 313 | /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). |
| 314 | /// @param far Specifies the distance from the viewer to the far clipping plane (always positive). |
| 315 | /// |
| 316 | /// @tparam T A floating-point scalar type |
| 317 | template<typename T> |
| 318 | GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveLH( |
| 319 | T fovy, T aspect, T near, T far); |
| 320 | |
| 321 | /// Creates a matrix for a symmetric perspective-view frustum based on the default handedness and default near and far clip planes definition. |
| 322 | /// 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. |
| 323 | /// |
| 324 | /// @param fovy Specifies the field of view angle in the y direction. Expressed in radians. |
| 325 | /// @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). |
| 326 | /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). |
| 327 | /// @param far Specifies the distance from the viewer to the far clipping plane (always positive). |
| 328 | /// |
| 329 | /// @tparam T A floating-point scalar type |
| 330 | /// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluPerspective.xml">gluPerspective man page</a> |
| 331 | template<typename T> |
| 332 | GLM_FUNC_DECL mat<4, 4, T, defaultp> perspective( |
| 333 | T fovy, T aspect, T near, T far); |
| 334 | |
| 335 | /// Builds a perspective projection matrix based on a field of view using right-handed coordinates. |
| 336 | /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition) |
| 337 | /// |
| 338 | /// @param fov Expressed in radians. |
| 339 | /// @param width Width of the viewport |
| 340 | /// @param height Height of the viewport |
| 341 | /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). |
| 342 | /// @param far Specifies the distance from the viewer to the far clipping plane (always positive). |
| 343 | /// |
| 344 | /// @tparam T A floating-point scalar type |
| 345 | template<typename T> |
| 346 | GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovRH_ZO( |
| 347 | T fov, T width, T height, T near, T far); |
| 348 | |
| 349 | /// Builds a perspective projection matrix based on a field of view using right-handed coordinates. |
| 350 | /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition) |
| 351 | /// |
| 352 | /// @param fov Expressed in radians. |
| 353 | /// @param width Width of the viewport |
| 354 | /// @param height Height of the viewport |
| 355 | /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). |
| 356 | /// @param far Specifies the distance from the viewer to the far clipping plane (always positive). |
| 357 | /// |
| 358 | /// @tparam T A floating-point scalar type |
| 359 | template<typename T> |
| 360 | GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovRH_NO( |
| 361 | T fov, T width, T height, T near, T far); |
| 362 | |
| 363 | /// Builds a perspective projection matrix based on a field of view using left-handed coordinates. |
| 364 | /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition) |
| 365 | /// |
| 366 | /// @param fov Expressed in radians. |
| 367 | /// @param width Width of the viewport |
| 368 | /// @param height Height of the viewport |
| 369 | /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). |
| 370 | /// @param far Specifies the distance from the viewer to the far clipping plane (always positive). |
| 371 | /// |
| 372 | /// @tparam T A floating-point scalar type |
| 373 | template<typename T> |
| 374 | GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovLH_ZO( |
| 375 | T fov, T width, T height, T near, T far); |
| 376 | |
| 377 | /// Builds a perspective projection matrix based on a field of view using left-handed coordinates. |
| 378 | /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition) |
| 379 | /// |
| 380 | /// @param fov Expressed in radians. |
| 381 | /// @param width Width of the viewport |
| 382 | /// @param height Height of the viewport |
| 383 | /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). |
| 384 | /// @param far Specifies the distance from the viewer to the far clipping plane (always positive). |
| 385 | /// |
| 386 | /// @tparam T A floating-point scalar type |
| 387 | template<typename T> |
| 388 | GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovLH_NO( |
| 389 | T fov, T width, T height, T near, T far); |
| 390 | |
| 391 | /// 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. |
| 392 | /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition) |
| 393 | /// |
| 394 | /// @param fov Expressed in radians. |
| 395 | /// @param width Width of the viewport |
| 396 | /// @param height Height of the viewport |
| 397 | /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). |
| 398 | /// @param far Specifies the distance from the viewer to the far clipping plane (always positive). |
| 399 | /// |
| 400 | /// @tparam T A floating-point scalar type |
| 401 | template<typename T> |
| 402 | GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovZO( |
| 403 | T fov, T width, T height, T near, T far); |
| 404 | |
| 405 | /// 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. |
| 406 | /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition) |
| 407 | /// |
| 408 | /// @param fov Expressed in radians. |
| 409 | /// @param width Width of the viewport |
| 410 | /// @param height Height of the viewport |
| 411 | /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). |
| 412 | /// @param far Specifies the distance from the viewer to the far clipping plane (always positive). |
| 413 | /// |
| 414 | /// @tparam T A floating-point scalar type |
| 415 | template<typename T> |
| 416 | GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovNO( |
| 417 | T fov, T width, T height, T near, T far); |
| 418 | |
| 419 | /// Builds a right-handed perspective projection matrix based on a field of view. |
| 420 | /// 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) |
| 421 | /// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition) |
| 422 | /// |
| 423 | /// @param fov Expressed in radians. |
| 424 | /// @param width Width of the viewport |
| 425 | /// @param height Height of the viewport |
| 426 | /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). |
| 427 | /// @param far Specifies the distance from the viewer to the far clipping plane (always positive). |
| 428 | /// |
| 429 | /// @tparam T A floating-point scalar type |
| 430 | template<typename T> |
| 431 | GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovRH( |
| 432 | T fov, T width, T height, T near, T far); |
| 433 | |
| 434 | /// Builds a left-handed perspective projection matrix based on a field of view. |
| 435 | /// 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) |
| 436 | /// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition) |
| 437 | /// |
| 438 | /// @param fov Expressed in radians. |
| 439 | /// @param width Width of the viewport |
| 440 | /// @param height Height of the viewport |
| 441 | /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). |
| 442 | /// @param far Specifies the distance from the viewer to the far clipping plane (always positive). |
| 443 | /// |
| 444 | /// @tparam T A floating-point scalar type |
| 445 | template<typename T> |
| 446 | GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovLH( |
| 447 | T fov, T width, T height, T near, T far); |
| 448 | |
| 449 | /// Builds a perspective projection matrix based on a field of view and the default handedness and default near and far clip planes definition. |
| 450 | /// 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. |
| 451 | /// |
| 452 | /// @param fov Expressed in radians. |
| 453 | /// @param width Width of the viewport |
| 454 | /// @param height Height of the viewport |
| 455 | /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). |
| 456 | /// @param far Specifies the distance from the viewer to the far clipping plane (always positive). |
| 457 | /// |
| 458 | /// @tparam T A floating-point scalar type |
| 459 | template<typename T> |
| 460 | GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFov( |
| 461 | T fov, T width, T height, T near, T far); |
| 462 | |
| 463 | /// Creates a matrix for a left-handed, symmetric perspective-view frustum with far plane at infinite. |
| 464 | /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition) |
| 465 | /// |
| 466 | /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians. |
| 467 | /// @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). |
| 468 | /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). |
| 469 | /// |
| 470 | /// @tparam T A floating-point scalar type |
| 471 | template<typename T> |
| 472 | GLM_FUNC_DECL mat<4, 4, T, defaultp> infinitePerspectiveLH_ZO( |
| 473 | T fovy, T aspect, T near); |
| 474 | |
| 475 | /// Creates a matrix for a left-handed, symmetric perspective-view frustum with far plane at infinite. |
| 476 | /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition) |
| 477 | /// |
| 478 | /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians. |
| 479 | /// @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). |
| 480 | /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). |
| 481 | /// |
| 482 | /// @tparam T A floating-point scalar type |
| 483 | template<typename T> |
| 484 | GLM_FUNC_DECL mat<4, 4, T, defaultp> infinitePerspectiveLH_NO( |
| 485 | T fovy, T aspect, T near); |
| 486 | |
| 487 | /// Creates a matrix for a right-handed, symmetric perspective-view frustum with far plane at infinite. |
| 488 | /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition) |
| 489 | /// |
| 490 | /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians. |
| 491 | /// @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). |
| 492 | /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). |
| 493 | /// |
| 494 | /// @tparam T A floating-point scalar type |
| 495 | template<typename T> |
| 496 | GLM_FUNC_DECL mat<4, 4, T, defaultp> infinitePerspectiveRH_ZO( |
| 497 | T fovy, T aspect, T near); |
| 498 | |
| 499 | /// Creates a matrix for a right-handed, symmetric perspective-view frustum with far plane at infinite. |
| 500 | /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition) |
| 501 | /// |
| 502 | /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians. |
| 503 | /// @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). |
| 504 | /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). |
| 505 | /// |
| 506 | /// @tparam T A floating-point scalar type |
| 507 | template<typename T> |
| 508 | GLM_FUNC_DECL mat<4, 4, T, defaultp> infinitePerspectiveRH_NO( |
| 509 | T fovy, T aspect, T near); |
| 510 | |
| 511 | /// Creates a matrix for a left-handed, symmetric perspective-view frustum with far plane at infinite. |
| 512 | /// 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) |
| 513 | /// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition) |
| 514 | /// |
| 515 | /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians. |
| 516 | /// @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). |
| 517 | /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). |
| 518 | /// |
| 519 | /// @tparam T A floating-point scalar type |
| 520 | template<typename T> |
| 521 | GLM_FUNC_DECL mat<4, 4, T, defaultp> infinitePerspectiveLH( |
| 522 | T fovy, T aspect, T near); |
| 523 | |
| 524 | /// Creates a matrix for a right-handed, symmetric perspective-view frustum with far plane at infinite. |
| 525 | /// 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) |
| 526 | /// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition) |
| 527 | /// |
| 528 | /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians. |
| 529 | /// @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). |
| 530 | /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). |
| 531 | /// |
| 532 | /// @tparam T A floating-point scalar type |
| 533 | template<typename T> |
| 534 | GLM_FUNC_DECL mat<4, 4, T, defaultp> infinitePerspectiveRH( |
| 535 | T fovy, T aspect, T near); |
| 536 | |
| 537 | /// Creates a matrix for a symmetric perspective-view frustum with far plane at infinite with default handedness. |
| 538 | /// 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) |
| 539 | /// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition) |
| 540 | /// |
| 541 | /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians. |
| 542 | /// @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). |
| 543 | /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). |
| 544 | /// |
| 545 | /// @tparam T A floating-point scalar type |
| 546 | template<typename T> |
| 547 | GLM_FUNC_DECL mat<4, 4, T, defaultp> infinitePerspective( |
| 548 | T fovy, T aspect, T near); |
| 549 | |
| 550 | /// Creates a matrix for a symmetric perspective-view frustum with far plane at infinite for graphics hardware that doesn't support depth clamping. |
| 551 | /// |
| 552 | /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians. |
| 553 | /// @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). |
| 554 | /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). |
| 555 | /// |
| 556 | /// @tparam T A floating-point scalar type |
| 557 | template<typename T> |
| 558 | GLM_FUNC_DECL mat<4, 4, T, defaultp> tweakedInfinitePerspective( |
| 559 | T fovy, T aspect, T near); |
| 560 | |
| 561 | /// Creates a matrix for a symmetric perspective-view frustum with far plane at infinite for graphics hardware that doesn't support depth clamping. |
| 562 | /// |
| 563 | /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians. |
| 564 | /// @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). |
| 565 | /// @param near Specifies the distance from the viewer to the near clipping plane (always positive). |
| 566 | /// @param ep Epsilon |
| 567 | /// |
| 568 | /// @tparam T A floating-point scalar type |
| 569 | template<typename T> |
| 570 | GLM_FUNC_DECL mat<4, 4, T, defaultp> tweakedInfinitePerspective( |
| 571 | T fovy, T aspect, T near, T ep); |
| 572 | |
| 573 | /// @} |
| 574 | }//namespace glm |
| 575 | |
| 576 | #include "matrix_clip_space.inl" |