master
ブランチ master
ShaderPlayground / deps / glm / glm / gtx / rotate_vector.hpp
3.5 KB、123行 生 Blame 履歴
1/// @ref gtx_rotate_vector
2/// @file glm/gtx/rotate_vector.hpp
3///
4/// @see core (dependence)
5/// @see gtx_transform (dependence)
6///
7/// @defgroup gtx_rotate_vector GLM_GTX_rotate_vector
8/// @ingroup gtx
9///
10/// Include <glm/gtx/rotate_vector.hpp> to use the features of this extension.
11///
12/// Function to directly rotate a vector
13
14#pragma once
15
16// Dependency:
17#include "../gtx/transform.hpp"
18#include "../gtc/epsilon.hpp"
19#include "../ext/vector_relational.hpp"
20#include "../glm.hpp"
21
22#ifndef GLM_ENABLE_EXPERIMENTAL
23# error "GLM: GLM_GTX_rotate_vector is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it."
24#endif
25
26#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
27# pragma message("GLM: GLM_GTX_rotate_vector extension included")
28#endif
29
30namespace glm
31{
32 /// @addtogroup gtx_rotate_vector
33 /// @{
34
35 /// Returns Spherical interpolation between two vectors
36 ///
37 /// @param x A first vector
38 /// @param y A second vector
39 /// @param a Interpolation factor. The interpolation is defined beyond the range [0, 1].
40 ///
41 /// @see gtx_rotate_vector
42 template<typename T, qualifier Q>
43 GLM_FUNC_DECL vec<3, T, Q> slerp(
44 vec<3, T, Q> const& x,
45 vec<3, T, Q> const& y,
46 T const& a);
47
48 //! Rotate a two dimensional vector.
49 //! From GLM_GTX_rotate_vector extension.
50 template<typename T, qualifier Q>
51 GLM_FUNC_DECL vec<2, T, Q> rotate(
52 vec<2, T, Q> const& v,
53 T const& angle);
54
55 //! Rotate a three dimensional vector around an axis.
56 //! From GLM_GTX_rotate_vector extension.
57 template<typename T, qualifier Q>
58 GLM_FUNC_DECL vec<3, T, Q> rotate(
59 vec<3, T, Q> const& v,
60 T const& angle,
61 vec<3, T, Q> const& normal);
62
63 //! Rotate a four dimensional vector around an axis.
64 //! From GLM_GTX_rotate_vector extension.
65 template<typename T, qualifier Q>
66 GLM_FUNC_DECL vec<4, T, Q> rotate(
67 vec<4, T, Q> const& v,
68 T const& angle,
69 vec<3, T, Q> const& normal);
70
71 //! Rotate a three dimensional vector around the X axis.
72 //! From GLM_GTX_rotate_vector extension.
73 template<typename T, qualifier Q>
74 GLM_FUNC_DECL vec<3, T, Q> rotateX(
75 vec<3, T, Q> const& v,
76 T const& angle);
77
78 //! Rotate a three dimensional vector around the Y axis.
79 //! From GLM_GTX_rotate_vector extension.
80 template<typename T, qualifier Q>
81 GLM_FUNC_DECL vec<3, T, Q> rotateY(
82 vec<3, T, Q> const& v,
83 T const& angle);
84
85 //! Rotate a three dimensional vector around the Z axis.
86 //! From GLM_GTX_rotate_vector extension.
87 template<typename T, qualifier Q>
88 GLM_FUNC_DECL vec<3, T, Q> rotateZ(
89 vec<3, T, Q> const& v,
90 T const& angle);
91
92 //! Rotate a four dimensional vector around the X axis.
93 //! From GLM_GTX_rotate_vector extension.
94 template<typename T, qualifier Q>
95 GLM_FUNC_DECL vec<4, T, Q> rotateX(
96 vec<4, T, Q> const& v,
97 T const& angle);
98
99 //! Rotate a four dimensional vector around the Y axis.
100 //! From GLM_GTX_rotate_vector extension.
101 template<typename T, qualifier Q>
102 GLM_FUNC_DECL vec<4, T, Q> rotateY(
103 vec<4, T, Q> const& v,
104 T const& angle);
105
106 //! Rotate a four dimensional vector around the Z axis.
107 //! From GLM_GTX_rotate_vector extension.
108 template<typename T, qualifier Q>
109 GLM_FUNC_DECL vec<4, T, Q> rotateZ(
110 vec<4, T, Q> const& v,
111 T const& angle);
112
113 //! Build a rotation matrix from a normal and a up vector.
114 //! From GLM_GTX_rotate_vector extension.
115 template<typename T, qualifier Q>
116 GLM_FUNC_DECL mat<4, 4, T, Q> orientation(
117 vec<3, T, Q> const& Normal,
118 vec<3, T, Q> const& Up);
119
120 /// @}
121}//namespace glm
122
123#include "rotate_vector.inl"