Completed implementation of building a GLM type from a pointer

This commit is contained in:
Christophe Riccio 2011-04-09 10:10:20 +01:00
parent 2bf467eb3c
commit bb99fbb289

View File

@ -300,7 +300,7 @@ namespace glm
inline detail::tvec2<T> make_vec2(T const * const ptr)
{
detail::tvec2<T> Result;
memcpy(&Result[0], ptr, sizeof(detail::tvec2<T>));
memcpy(value_ptr(Result), ptr, sizeof(detail::tvec2<T>));
return Result;
}
@ -310,7 +310,7 @@ namespace glm
inline detail::tvec3<T> make_vec3(T const * const ptr)
{
detail::tvec3<T> Result;
memcpy(&Result[0], ptr, sizeof(detail::tvec3<T>));
memcpy(value_ptr(Result), ptr, sizeof(detail::tvec3<T>));
return Result;
}
@ -320,28 +320,115 @@ namespace glm
inline detail::tvec4<T> make_vec4(T const * const ptr)
{
detail::tvec4<T> Result;
memcpy(&Result[0], ptr, sizeof(detail::tvec4<T>));
memcpy(value_ptr(Result), ptr, sizeof(detail::tvec4<T>));
return Result;
}
//! Build a matrix from a pointer.
//! From GLM_GTC_type_ptr extension.
template<typename T>
inline detail::tmat2<T> make_mat2(T const * const ptr)
inline detail::tmat2x2<T> make_mat2x2(T const * const ptr)
{
detail::tmat2<T> Result;
memcpy(&Result[0], ptr, sizeof(detail::tmat2<T>));
detail::tmat2x2<T> Result;
memcpy(value_ptr(Result), ptr, sizeof(detail::tmat2x2<T>));
return Result;
}
//! Build a matrix from a pointer.
//! From GLM_GTC_type_ptr extension.
template<typename T>
inline detail::tmat2x3<T> make_mat2x3(T const * const ptr)
{
detail::tmat2x3<T> Result;
memcpy(value_ptr(Result), ptr, sizeof(detail::tmat2x3<T>));
return Result;
}
//! Build a matrix from a pointer.
//! From GLM_GTC_type_ptr extension.
template<typename T>
inline detail::tmat2x4<T> make_mat2x4(T const * const ptr)
{
detail::tmat2x4<T> Result;
memcpy(value_ptr(Result), ptr, sizeof(detail::tmat2x4<T>));
return Result;
}
//! Build a matrix from a pointer.
//! From GLM_GTC_type_ptr extension.
template<typename T>
inline detail::tmat3x2<T> make_mat3x2(T const * const ptr)
{
detail::tmat3x2<T> Result;
memcpy(value_ptr(Result), ptr, sizeof(detail::tmat3x2<T>));
return Result;
}
//! Build a matrix from a pointer.
//! From GLM_GTC_type_ptr extension.
template<typename T>
inline detail::tmat3x3<T> make_mat3x3(T const * const ptr)
{
detail::tmat3x3<T> Result;
memcpy(value_ptr(Result), ptr, sizeof(detail::tmat3x3<T>));
return Result;
}
//! Build a matrix from a pointer.
//! From GLM_GTC_type_ptr extension.
template<typename T>
inline detail::tmat3x4<T> make_mat3x4(T const * const ptr)
{
detail::tmat3x4<T> Result;
memcpy(value_ptr(Result), ptr, sizeof(detail::tmat3x4<T>));
return Result;
}
//! Build a matrix from a pointer.
//! From GLM_GTC_type_ptr extension.
template<typename T>
inline detail::tmat4x2<T> make_mat4x2(T const * const ptr)
{
detail::tmat4x2<T> Result;
memcpy(value_ptr(Result), ptr, sizeof(detail::tmat4x2<T>));
return Result;
}
//! Build a matrix from a pointer.
//! From GLM_GTC_type_ptr extension.
template<typename T>
inline detail::tmat4x3<T> make_mat4x3(T const * const ptr)
{
detail::tmat4x3<T> Result;
memcpy(value_ptr(Result), ptr, sizeof(detail::tmat4x3<T>));
return Result;
}
//! Build a matrix from a pointer.
//! From GLM_GTC_type_ptr extension.
template<typename T>
inline detail::tmat4x4<T> make_mat4x4(T const * const ptr)
{
detail::tmat4x4<T> Result;
memcpy(value_ptr(Result), ptr, sizeof(detail::tmat4x4<T>));
return Result;
}
//! Build a matrix from a pointer.
//! From GLM_GTC_type_ptr extension.
template<typename T>
inline detail::tmat2x2<T> make_mat2(T const * const ptr)
{
return make_mat2x2(Result);
}
//! Build a matrix from a pointer.
//! From GLM_GTC_type_ptr extension.
template<typename T>
inline detail::tmat3<T> make_mat3(T const * const ptr)
{
detail::tmat3<T> Result;
memcpy(&Result[0], ptr, sizeof(detail::tmat3<T>));
return Result;
return make_mat3x3(Result);
}
//! Build a matrix from a pointer.
@ -349,9 +436,7 @@ namespace glm
template<typename T>
inline detail::tmat4<T> make_mat4(T const * const ptr)
{
detail::tmat4<T> Result;
memcpy(&Result[0], ptr, sizeof(detail::tmat4<T>));
return Result;
return make_mat4x4(Result);
}
///@}