1b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/////////////////////////////////////////////////////////////////////////////////// 2b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// OpenGL Mathematics (glm.g-truc.net) 3b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// 4b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// Permission is hereby granted, free of charge, to any person obtaining a copy 6b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// of this software and associated documentation files (the "Software"), to deal 7b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// in the Software without restriction, including without limitation the rights 8b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// copies of the Software, and to permit persons to whom the Software is 10b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// furnished to do so, subject to the following conditions: 11b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// 12b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// The above copyright notice and this permission notice shall be included in 13b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// all copies or substantial portions of the Software. 14b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// 15b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// THE SOFTWARE. 22b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// 23b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// @ref gtx_rotate_vector 24b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// @file glm/gtx/rotate_vector.hpp 25b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// @date 2006-11-02 / 2011-06-07 26b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// @author Christophe Riccio 27b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// 28b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// @see core (dependence) 29b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// @see gtx_transform (dependence) 30b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// 31b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// @defgroup gtx_rotate_vector GLM_GTX_rotate_vector 32b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// @ingroup gtx 33b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// 34b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// @brief Function to directly rotate a vector 35b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// 36b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// <glm/gtx/rotate_vector.hpp> need to be included to use these functionalities. 37b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/////////////////////////////////////////////////////////////////////////////////// 38b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 39b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#ifndef GLM_GTX_rotate_vector 40b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#define GLM_GTX_rotate_vector 41b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 42b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG// Dependency: 43b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#include "../glm.hpp" 44b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#include "../gtx/transform.hpp" 45b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 46b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) 47b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG# pragma message("GLM: GLM_GTX_rotate_vector extension included") 48b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#endif 49b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 50b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarGnamespace glm 51b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG{ 52b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @addtogroup gtx_rotate_vector 53b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @{ 54b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 55b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG //! Rotate a two dimensional vector. 56b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG //! From GLM_GTX_rotate_vector extension. 57b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG template <typename T, precision P> 58b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG GLM_FUNC_DECL detail::tvec2<T, P> rotate( 59b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG detail::tvec2<T, P> const & v, 60b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG T const & angle); 61b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 62b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG //! Rotate a three dimensional vector around an axis. 63b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG //! From GLM_GTX_rotate_vector extension. 64b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG template <typename T, precision P> 65b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG GLM_FUNC_DECL detail::tvec3<T, P> rotate( 66b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG detail::tvec3<T, P> const & v, 67b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG T const & angle, 68b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG detail::tvec3<T, P> const & normal); 69b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 70b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG //! Rotate a four dimensional vector around an axis. 71b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG //! From GLM_GTX_rotate_vector extension. 72b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG template <typename T, precision P> 73b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG GLM_FUNC_DECL detail::tvec4<T, P> rotate( 74b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG detail::tvec4<T, P> const & v, 75b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG T const & angle, 76b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG detail::tvec3<T, P> const & normal); 77b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 78b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG //! Rotate a three dimensional vector around the X axis. 79b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG //! From GLM_GTX_rotate_vector extension. 80b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG template <typename T, precision P> 81b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG GLM_FUNC_DECL detail::tvec3<T, P> rotateX( 82b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG detail::tvec3<T, P> const & v, 83b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG T const & angle); 84b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 85b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG //! Rotate a three dimensional vector around the Y axis. 86b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG //! From GLM_GTX_rotate_vector extension. 87b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG template <typename T, precision P> 88b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG GLM_FUNC_DECL detail::tvec3<T, P> rotateY( 89b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG detail::tvec3<T, P> const & v, 90b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG T const & angle); 91b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 92b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG //! Rotate a three dimensional vector around the Z axis. 93b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG //! From GLM_GTX_rotate_vector extension. 94b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG template <typename T, precision P> 95b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG GLM_FUNC_DECL detail::tvec3<T, P> rotateZ( 96b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG detail::tvec3<T, P> const & v, 97b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG T const & angle); 98b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 99b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG //! Rotate a four dimentionnals vector around the X axis. 100b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG //! From GLM_GTX_rotate_vector extension. 101b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG template <typename T, precision P> 102b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG GLM_FUNC_DECL detail::tvec4<T, P> rotateX( 103b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG detail::tvec4<T, P> const & v, 104b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG T const & angle); 105b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 106b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG //! Rotate a four dimensional vector around the X axis. 107b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG //! From GLM_GTX_rotate_vector extension. 108b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG template <typename T, precision P> 109b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG GLM_FUNC_DECL detail::tvec4<T, P> rotateY( 110b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG detail::tvec4<T, P> const & v, 111b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG T const & angle); 112b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 113b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG //! Rotate a four dimensional vector around the X axis. 114b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG //! From GLM_GTX_rotate_vector extension. 115b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG template <typename T, precision P> 116b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG GLM_FUNC_DECL detail::tvec4<T, P> rotateZ( 117b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG detail::tvec4<T, P> const & v, 118b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG T const & angle); 119b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 120b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG //! Build a rotation matrix from a normal and a up vector. 121b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG //! From GLM_GTX_rotate_vector extension. 122b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG template <typename T, precision P> 123b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG GLM_FUNC_DECL detail::tmat4x4<T, P> orientation( 124b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG detail::tvec3<T, P> const & Normal, 125b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG detail::tvec3<T, P> const & Up); 126b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 127b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @} 128b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG}//namespace glm 129b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 130b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#include "rotate_vector.inl" 131b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 132b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#endif//GLM_GTX_rotate_vector 133