2.4 KB、81行 生 Blame 履歴
1/// @ref gtx_matrix_transform_2d
2/// @file glm/gtx/matrix_transform_2d.hpp
3/// @author Miguel Ángel Pérez Martínez
4///
5/// @see core (dependence)
6///
7/// @defgroup gtx_matrix_transform_2d GLM_GTX_matrix_transform_2d
8/// @ingroup gtx
9///
10/// Include <glm/gtx/matrix_transform_2d.hpp> to use the features of this extension.
11///
12/// Defines functions that generate common 2d transformation matrices.
13
14#pragma once
15
16// Dependency:
17#include "../mat3x3.hpp"
18#include "../vec2.hpp"
19
20#ifndef GLM_ENABLE_EXPERIMENTAL
21# error "GLM: GLM_GTX_matrix_transform_2d 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."
22#endif
23
24#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
25# pragma message("GLM: GLM_GTX_matrix_transform_2d extension included")
26#endif
27
28namespace glm
29{
30 /// @addtogroup gtx_matrix_transform_2d
31 /// @{
32
33 /// Builds a translation 3 * 3 matrix created from a vector of 2 components.
34 ///
35 /// @param m Input matrix multiplied by this translation matrix.
36 /// @param v Coordinates of a translation vector.
37 template<typename T, qualifier Q>
38 GLM_FUNC_QUALIFIER mat<3, 3, T, Q> translate(
39 mat<3, 3, T, Q> const& m,
40 vec<2, T, Q> const& v);
41
42 /// Builds a rotation 3 * 3 matrix created from an angle.
43 ///
44 /// @param m Input matrix multiplied by this translation matrix.
45 /// @param angle Rotation angle expressed in radians.
46 template<typename T, qualifier Q>
47 GLM_FUNC_QUALIFIER mat<3, 3, T, Q> rotate(
48 mat<3, 3, T, Q> const& m,
49 T angle);
50
51 /// Builds a scale 3 * 3 matrix created from a vector of 2 components.
52 ///
53 /// @param m Input matrix multiplied by this translation matrix.
54 /// @param v Coordinates of a scale vector.
55 template<typename T, qualifier Q>
56 GLM_FUNC_QUALIFIER mat<3, 3, T, Q> scale(
57 mat<3, 3, T, Q> const& m,
58 vec<2, T, Q> const& v);
59
60 /// Builds an horizontal (parallel to the x axis) shear 3 * 3 matrix.
61 ///
62 /// @param m Input matrix multiplied by this translation matrix.
63 /// @param y Shear factor.
64 template<typename T, qualifier Q>
65 GLM_FUNC_QUALIFIER mat<3, 3, T, Q> shearX(
66 mat<3, 3, T, Q> const& m,
67 T y);
68
69 /// Builds a vertical (parallel to the y axis) shear 3 * 3 matrix.
70 ///
71 /// @param m Input matrix multiplied by this translation matrix.
72 /// @param x Shear factor.
73 template<typename T, qualifier Q>
74 GLM_FUNC_QUALIFIER mat<3, 3, T, Q> shearY(
75 mat<3, 3, T, Q> const& m,
76 T x);
77
78 /// @}
79}//namespace glm
80
81#include "matrix_transform_2d.inl"