From 039ac92480a09266146fc5b0c9ec67a32a2565ad Mon Sep 17 00:00:00 2001 From: saurabhb17 Date: Wed, 26 Feb 2020 16:04:40 +0530 Subject: Added secondary files --- include/gal/opengl/glm/gtx/transform2.inl | 154 ++++++++++++++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 include/gal/opengl/glm/gtx/transform2.inl (limited to 'include/gal/opengl/glm/gtx/transform2.inl') diff --git a/include/gal/opengl/glm/gtx/transform2.inl b/include/gal/opengl/glm/gtx/transform2.inl new file mode 100644 index 0000000..06b65f5 --- /dev/null +++ b/include/gal/opengl/glm/gtx/transform2.inl @@ -0,0 +1,154 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-02-28 +// Updated : 2005-04-23 +// Licence : This source is under MIT License +// File : glm/gtx/transform2.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + template + GLM_FUNC_QUALIFIER detail::tmat3x3 shearX2D( + const detail::tmat3x3& m, + T s) + { + detail::tmat3x3 r(1); + r[0][1] = s; + return m * r; + } + + template + GLM_FUNC_QUALIFIER detail::tmat3x3 shearY2D( + const detail::tmat3x3& m, + T s) + { + detail::tmat3x3 r(1); + r[1][0] = s; + return m * r; + } + + template + GLM_FUNC_QUALIFIER detail::tmat4x4 shearX3D( + const detail::tmat4x4& m, + T s, + T t) + { + detail::tmat4x4 r(1); + r[1][0] = s; + r[2][0] = t; + return m * r; + } + + template + GLM_FUNC_QUALIFIER detail::tmat4x4 shearY3D( + const detail::tmat4x4& m, + T s, + T t) + { + detail::tmat4x4 r(1); + r[0][1] = s; + r[2][1] = t; + return m * r; + } + + template + GLM_FUNC_QUALIFIER detail::tmat4x4 shearZ3D( + const detail::tmat4x4& m, + T s, + T t) + { + detail::tmat4x4 r(1); + r[0][2] = s; + r[1][2] = t; + return m * r; + } + + template + GLM_FUNC_QUALIFIER detail::tmat3x3 reflect2D( + const detail::tmat3x3& m, + const detail::tvec3& normal) + { + detail::tmat3x3 r(1); + r[0][0] = 1 - 2 * normal.x * normal.x; + r[0][1] = -2 * normal.x * normal.y; + r[1][0] = -2 * normal.x * normal.y; + r[1][1] = 1 - 2 * normal.y * normal.y; + return m * r; + } + + template + GLM_FUNC_QUALIFIER detail::tmat4x4 reflect3D( + const detail::tmat4x4& m, + const detail::tvec3& normal) + { + detail::tmat4x4 r(1); + r[0][0] = 1 - 2 * normal.x * normal.x; + r[0][1] = -2 * normal.x * normal.y; + r[0][2] = -2 * normal.x * normal.z; + + r[1][0] = -2 * normal.x * normal.y; + r[1][1] = 1 - 2 * normal.y * normal.y; + r[1][2] = -2 * normal.y * normal.z; + + r[2][0] = -2 * normal.x * normal.z; + r[2][1] = -2 * normal.y * normal.z; + r[2][2] = 1 - 2 * normal.z * normal.z; + return m * r; + } + + template + GLM_FUNC_QUALIFIER detail::tmat3x3 proj2D( + const detail::tmat3x3& m, + const detail::tvec3& normal) + { + detail::tmat3x3 r(1); + r[0][0] = 1 - normal.x * normal.x; + r[0][1] = - normal.x * normal.y; + r[1][0] = - normal.x * normal.y; + r[1][1] = 1 - normal.y * normal.y; + return m * r; + } + + template + GLM_FUNC_QUALIFIER detail::tmat4x4 proj3D( + const detail::tmat4x4& m, + const detail::tvec3& normal) + { + detail::tmat4x4 r(1); + r[0][0] = 1 - normal.x * normal.x; + r[0][1] = - normal.x * normal.y; + r[0][2] = - normal.x * normal.z; + r[1][0] = - normal.x * normal.y; + r[1][1] = 1 - normal.y * normal.y; + r[1][2] = - normal.y * normal.z; + r[2][0] = - normal.x * normal.z; + r[2][1] = - normal.y * normal.z; + r[2][2] = 1 - normal.z * normal.z; + return m * r; + } + + template + GLM_FUNC_QUALIFIER detail::tmat4x4 scaleBias( + T scale, + T bias) + { + detail::tmat4x4 result; + result[3] = detail::tvec4(detail::tvec3(bias), T(1)); + result[0][0] = scale; + result[1][1] = scale; + result[2][2] = scale; + return result; + } + + template + GLM_FUNC_QUALIFIER detail::tmat4x4 scaleBias( + const detail::tmat4x4& m, + T scale, + T bias) + { + return m * scaleBias(scale, bias); + } +}//namespace glm + -- cgit