Magnum/GlmIntegration/Integration.h file

Conversion of basic GLM vector and matrix types.

Contents

Provides conversion for the following types:

Magnum vector typeEquivalent GLM type
Math::BoolVector<2>, Math::BoolVector<3>, Math::BoolVector<4>glm::bvec2, glm::bvec3, glm::bvec4
Vector2, Vector3, Color3, Vector4, Color4glm::vec2, glm::vec3, glm::vec4
Vector2ui, Vector3ui, Vector4uiglm::uvec2, glm::uvec3, glm::uvec4
Vector2i, Vector3i, Vector4iglm::ivec2, glm::ivec3, glm::ivec4
Vector2d, Vector3d, Vector4dglm::dvec2, glm::dvec3, glm::dvec4
Magnum matrix typeEquivalent GLM type
Matrix2x2 or Matrix2x2dglm::mat2 / glm::mat2x2 or glm::dmat2 / glm::dmat2x2
Matrix3 / Matrix3x3 or Matrix3d / Matrix3x3dglm::mat3 / glm::mat3x3 or glm::dmat3 / glm::dmat3x3
Matrix4 / Matrix4x4 or Matrix4d / Matrix4x4dglm::mat4 / glm::mat4x4 or glm::dmat4 / glm::dmat4x4
Matrix2x3 or Matrix2x3dglm::mat2x3 or glm::dmat2x3
Matrix3x2 or Matrix3x2dglm::mat3x2 or glm::dmat3x2
Matrix2x4 or Matrix2x4dglm::mat2x4 or glm::dmat2x4
Matrix4x2 or Matrix4x2dglm::mat4x2 or glm::dmat4x2
Matrix3x4 or Matrix3x4dglm::mat3x4 or glm::dmat3x4
Matrix4x3 or Matrix4x3dglm::mat4x3 or glm::dmat4x3

Types with extra qualifiers (such as glm::mediump_dmat3x4) are treated the same as types with no qualifier. Debug output using Corrade::Utility::Debug for all types is provided as well. Example usage:

glm::vec3 a{1.0f, 2.0f, 3.0f};
Vector3 b(a);

glm::mat3 c = glm::mat3(Matrix3::rotation(35.0_degf));

Debug{} << glm::lowp_ivec3{1, 42, -3}; // prints ivec3(1, 42, -3)

See Magnum/GlmIntegration/GtcIntegration.h and Magnum/GlmIntegration/GtxIntegration.h for conversion of more complex types.

Namespaces

namespace Magnum
Root namespace.
namespace Magnum::Math
Math library.
namespace glm
GLM namespace.

Functions

template<class T, glm::precision q>
auto operator<<(Corrade::Utility::Debug& debug, const tvec2<T, q>& value) -> Corrade::Utility::Debug&
Debug output operator for GLM vector types.
template<class T, glm::precision q>
auto operator<<(Corrade::Utility::Debug& debug, const tmat2x2<T, q>& value) -> Corrade::Utility::Debug&
Debug output operator for GLM matrix types.