mirror of
https://github.com/g-truc/glm.git
synced 2024-11-26 18:24:35 +00:00
Added quaternion dependence
This commit is contained in:
parent
a1d172153e
commit
8b4687e6a3
@ -1,14 +1,34 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2009-05-06
|
||||
// Updated : 2010-04-30
|
||||
// Licence : This source is under MIT License
|
||||
// File : glm/gtc/type_ptr.hpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Dependency:
|
||||
// - GLM core
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref gtc_type_ptr
|
||||
/// @file glm/gtc/type_ptr.hpp
|
||||
/// @date 2009-05-06 / 2011-06-05
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
/// @see core (dependence)
|
||||
/// @see gtc_half_float (dependence)
|
||||
/// @see gtc_quaternion (dependence)
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_gtc_type_ptr
|
||||
#define glm_gtc_type_ptr
|
||||
@ -28,7 +48,7 @@ namespace type_ptr ///< GLM_GTC_type_ptr extension: Get access to vectors & matr
|
||||
/// \addtogroup gtc_type_ptr
|
||||
///@{
|
||||
|
||||
//! Get the const address of the vector content.
|
||||
//! Return the constant address to the data of the input parameter.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
@ -39,7 +59,7 @@ namespace type_ptr ///< GLM_GTC_type_ptr extension: Get access to vectors & matr
|
||||
return &(vec.x);
|
||||
}
|
||||
|
||||
//! Get the address of the vector content.
|
||||
//! Return the constant address to the data of the input parameter.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
@ -50,7 +70,7 @@ namespace type_ptr ///< GLM_GTC_type_ptr extension: Get access to vectors & matr
|
||||
return &(vec.x);
|
||||
}
|
||||
|
||||
//! Get the const address of the vector content.
|
||||
//! Return the constant address to the data of the input parameter.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
@ -61,7 +81,7 @@ namespace type_ptr ///< GLM_GTC_type_ptr extension: Get access to vectors & matr
|
||||
return &(vec.x);
|
||||
}
|
||||
|
||||
//! Get the address of the vector content.
|
||||
//! Return the constant address to the data of the input parameter.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
@ -72,7 +92,7 @@ namespace type_ptr ///< GLM_GTC_type_ptr extension: Get access to vectors & matr
|
||||
return &(vec.x);
|
||||
}
|
||||
|
||||
//! Get the const address of the vector content.
|
||||
//! Return the constant address to the data of the input parameter.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
@ -83,7 +103,7 @@ namespace type_ptr ///< GLM_GTC_type_ptr extension: Get access to vectors & matr
|
||||
return &(vec.x);
|
||||
}
|
||||
|
||||
//! Get the address of the vector content.
|
||||
//! Return the constant address to the data of the input parameter.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
@ -94,7 +114,7 @@ namespace type_ptr ///< GLM_GTC_type_ptr extension: Get access to vectors & matr
|
||||
return &(vec.x);
|
||||
}
|
||||
|
||||
//! Get the const address of the matrix content.
|
||||
//! Return the constant address to the data of the input parameter.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
@ -105,7 +125,7 @@ namespace type_ptr ///< GLM_GTC_type_ptr extension: Get access to vectors & matr
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the address of the matrix content.
|
||||
//! Return the constant address to the data of the input parameter.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
@ -116,7 +136,7 @@ namespace type_ptr ///< GLM_GTC_type_ptr extension: Get access to vectors & matr
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the const address of the matrix content.
|
||||
//! Return the constant address to the data of the input parameter.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
@ -127,7 +147,7 @@ namespace type_ptr ///< GLM_GTC_type_ptr extension: Get access to vectors & matr
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the address of the matrix content.
|
||||
//! Return the constant address to the data of the input parameter.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
@ -138,7 +158,7 @@ namespace type_ptr ///< GLM_GTC_type_ptr extension: Get access to vectors & matr
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the const address of the matrix content.
|
||||
//! Return the constant address to the data of the input parameter.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
@ -149,7 +169,7 @@ namespace type_ptr ///< GLM_GTC_type_ptr extension: Get access to vectors & matr
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the address of the matrix content.
|
||||
//! Return the constant address to the data of the input parameter.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
@ -160,7 +180,7 @@ namespace type_ptr ///< GLM_GTC_type_ptr extension: Get access to vectors & matr
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the const address of the matrix content.
|
||||
//! Return the constant address to the data of the input parameter.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
@ -171,7 +191,7 @@ namespace type_ptr ///< GLM_GTC_type_ptr extension: Get access to vectors & matr
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the address of the matrix content.
|
||||
//! Return the constant address to the data of the input parameter.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
@ -182,7 +202,7 @@ namespace type_ptr ///< GLM_GTC_type_ptr extension: Get access to vectors & matr
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the const address of the matrix content.
|
||||
//! Return the constant address to the data of the input parameter.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
@ -193,7 +213,7 @@ namespace type_ptr ///< GLM_GTC_type_ptr extension: Get access to vectors & matr
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the address of the matrix content.
|
||||
//! Return the constant address to the data of the input parameter.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
@ -204,7 +224,7 @@ namespace type_ptr ///< GLM_GTC_type_ptr extension: Get access to vectors & matr
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the const address of the matrix content.
|
||||
//! Return the constant address to the data of the input parameter.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
@ -215,7 +235,7 @@ namespace type_ptr ///< GLM_GTC_type_ptr extension: Get access to vectors & matr
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the address of the matrix content.
|
||||
//! Return the constant address to the data of the input parameter.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
@ -226,7 +246,7 @@ namespace type_ptr ///< GLM_GTC_type_ptr extension: Get access to vectors & matr
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the const address of the matrix content.
|
||||
//! Return the constant address to the data of the input parameter.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
@ -237,7 +257,7 @@ namespace type_ptr ///< GLM_GTC_type_ptr extension: Get access to vectors & matr
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the address of the matrix content.
|
||||
//! Return the constant address to the data of the input parameter.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
@ -248,7 +268,7 @@ namespace type_ptr ///< GLM_GTC_type_ptr extension: Get access to vectors & matr
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the const address of the matrix content.
|
||||
//! Return the constant address to the data of the input parameter.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
@ -259,7 +279,7 @@ namespace type_ptr ///< GLM_GTC_type_ptr extension: Get access to vectors & matr
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the address of the matrix content.
|
||||
//! Return the constant address to the data of the input parameter.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
@ -270,7 +290,7 @@ namespace type_ptr ///< GLM_GTC_type_ptr extension: Get access to vectors & matr
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the const address of the matrix content.
|
||||
//! Return the constant address to the data of the input parameter.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
@ -280,7 +300,18 @@ namespace type_ptr ///< GLM_GTC_type_ptr extension: Get access to vectors & matr
|
||||
{
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
|
||||
//! Return the constant address to the data of the input parameter.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
(
|
||||
detail::tquat<T> const & q
|
||||
)
|
||||
{
|
||||
return &(q[0]);
|
||||
}
|
||||
|
||||
//! Get the address of the matrix content.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
@ -378,7 +409,6 @@ namespace type_ptr ///< GLM_GTC_type_ptr extension: Get access to vectors & matr
|
||||
memcpy(value_ptr(Result), ptr, sizeof(detail::tmat3x4<T>));
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
//! Build a matrix from a pointer.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
@ -433,9 +463,18 @@ namespace type_ptr ///< GLM_GTC_type_ptr extension: Get access to vectors & matr
|
||||
{
|
||||
return make_mat4x4(ptr);
|
||||
}
|
||||
|
||||
///@}
|
||||
|
||||
|
||||
//! Build a quaternion from a pointer.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tquat<T> make_quat(T const * const ptr)
|
||||
{
|
||||
detail::tquat<T> Result;
|
||||
memcpy(value_ptr(Result), ptr, sizeof(detail::tquat<T>));
|
||||
return Result;
|
||||
}
|
||||
|
||||
/// @}
|
||||
}//namespace type_ptr
|
||||
}//namespace gtc
|
||||
}//namespace glm
|
||||
|
Loading…
Reference in New Issue
Block a user