diff --git a/include/vsg/maths/box.h b/include/vsg/maths/box.h index 46d47a999..538ab72ae 100644 --- a/include/vsg/maths/box.h +++ b/include/vsg/maths/box.h @@ -90,9 +90,11 @@ namespace vsg using box = t_box; /// float box class using dbox = t_box; /// double box class + using ldbox = t_box; /// double box class VSG_type_name(vsg::box); VSG_type_name(vsg::dbox); + VSG_type_name(vsg::ldbox); template constexpr bool operator==(const t_box& lhs, const t_box& rhs) diff --git a/include/vsg/maths/mat4.h b/include/vsg/maths/mat4.h index 589ea1ff0..ef3b1410a 100644 --- a/include/vsg/maths/mat4.h +++ b/include/vsg/maths/mat4.h @@ -121,9 +121,11 @@ namespace vsg using mat4 = t_mat4; /// float 4x4 matrix using dmat4 = t_mat4; /// double 4x4 matrix + using ldmat4 = t_mat4; /// long double 4x4 matrix VSG_type_name(vsg::mat4); VSG_type_name(vsg::dmat4); + VSG_type_name(vsg::ldmat4); template bool operator==(const t_mat4& lhs, const t_mat4& rhs) diff --git a/include/vsg/maths/plane.h b/include/vsg/maths/plane.h index da3522e96..89456a0b3 100644 --- a/include/vsg/maths/plane.h +++ b/include/vsg/maths/plane.h @@ -110,6 +110,7 @@ namespace vsg using plane = t_plane; using dplane = t_plane; + using ldplane = t_plane; VSG_type_name(vsg::plane); VSG_type_name(vsg::dplane); diff --git a/include/vsg/maths/quat.h b/include/vsg/maths/quat.h index e80456b33..5d831e19f 100644 --- a/include/vsg/maths/quat.h +++ b/include/vsg/maths/quat.h @@ -147,9 +147,11 @@ namespace vsg using quat = t_quat; /// float quaternion using dquat = t_quat; /// double quaternion + using ldquat = t_quat; /// long double quaternion VSG_type_name(vsg::quat); VSG_type_name(vsg::dquat); + VSG_type_name(vsg::ldquat); template constexpr bool operator==(const t_quat& lhs, const t_quat& rhs) diff --git a/include/vsg/maths/sphere.h b/include/vsg/maths/sphere.h index acc0054aa..23714aec3 100644 --- a/include/vsg/maths/sphere.h +++ b/include/vsg/maths/sphere.h @@ -122,9 +122,11 @@ namespace vsg using sphere = t_sphere; /// float sphere class using dsphere = t_sphere; /// double sphere class + using ldsphere = t_sphere; /// long double sphere class VSG_type_name(vsg::sphere); VSG_type_name(vsg::dsphere); + VSG_type_name(vsg::ldsphere); template constexpr bool operator==(const t_sphere& lhs, const t_sphere& rhs) diff --git a/include/vsg/maths/transform.h b/include/vsg/maths/transform.h index 2ede4463e..bd979e79b 100644 --- a/include/vsg/maths/transform.h +++ b/include/vsg/maths/transform.h @@ -248,6 +248,11 @@ namespace vsg /// assumes matrix has no skew or perspective components extern VSG_DECLSPEC bool decompose(const dmat4& m, dvec3& translation, dquat& rotation, dvec3& scale); + /// decompose long double matrix into translation, rotation and scale components. + /// maps to TRS form: vsg::translate(translation) * vsg::rotate(rotation) * vsg::scale(scale); + /// assumes matrix has no skew or perspective components + extern VSG_DECLSPEC bool decompose(const ldmat4& m, ldvec3& translation, ldquat& rotation, ldvec3& scale); + /// compute the bounding sphere that encloses a frustum defined by specified float ModelViewMatrixProjection extern VSG_DECLSPEC sphere computeFrustumBound(const mat4& m); diff --git a/include/vsg/maths/vec2.h b/include/vsg/maths/vec2.h index 47a4569af..1f789641f 100644 --- a/include/vsg/maths/vec2.h +++ b/include/vsg/maths/vec2.h @@ -138,6 +138,7 @@ namespace vsg using vec2 = t_vec2; // float 2D vector using dvec2 = t_vec2; // double 2D vector + using ldvec2 = t_vec2; // long double 2D vector using bvec2 = t_vec2; // signed 8 bit integer 2D vector using svec2 = t_vec2; // signed 16 bit integer 2D vector using ivec2 = t_vec2; // signed 32 bit integer 2D vector diff --git a/include/vsg/maths/vec3.h b/include/vsg/maths/vec3.h index aede3da74..3d927f91f 100644 --- a/include/vsg/maths/vec3.h +++ b/include/vsg/maths/vec3.h @@ -146,6 +146,7 @@ namespace vsg using vec3 = t_vec3; // float 3D vector using dvec3 = t_vec3; // double 3D vector + using ldvec3 = t_vec3; // long double 3D vector using bvec3 = t_vec3; // signed 8 bit integer 3D vector using svec3 = t_vec3; // signed 16 bit integer 3D vector using ivec3 = t_vec3; // signed 32 bit integer 3D vector @@ -155,6 +156,7 @@ namespace vsg VSG_type_name(vsg::vec3); VSG_type_name(vsg::dvec3); + VSG_type_name(vsg::ldvec3); VSG_type_name(vsg::bvec3); VSG_type_name(vsg::svec3); VSG_type_name(vsg::ivec3); diff --git a/include/vsg/maths/vec4.h b/include/vsg/maths/vec4.h index 831d286fa..149c3009c 100644 --- a/include/vsg/maths/vec4.h +++ b/include/vsg/maths/vec4.h @@ -176,6 +176,7 @@ namespace vsg using vec4 = t_vec4; // float 4D vector using dvec4 = t_vec4; // double 4D vector + using ldvec4 = t_vec4; // long double 4D vector using bvec4 = t_vec4; // signed 8 bit integer 4D vector using svec4 = t_vec4; // signed 16 bit integer 4D vector using ivec4 = t_vec4; // signed 32 bit integer 4D vector @@ -185,6 +186,7 @@ namespace vsg VSG_type_name(vsg::vec4); VSG_type_name(vsg::dvec4); + VSG_type_name(vsg::ldvec4); VSG_type_name(vsg::bvec4); VSG_type_name(vsg::svec4); VSG_type_name(vsg::ivec4); diff --git a/src/vsg/maths/maths_transform.cpp b/src/vsg/maths/maths_transform.cpp index ab543c45a..f7b8074a0 100644 --- a/src/vsg/maths/maths_transform.cpp +++ b/src/vsg/maths/maths_transform.cpp @@ -297,6 +297,11 @@ bool vsg::decompose(const dmat4& m, dvec3& translation, dquat& rotation, dvec3& return t_decompose(m, translation, rotation, scale); } +bool vsg::decompose(const ldmat4& m, ldvec3& translation, ldquat& rotation, ldvec3& scale) +{ + return t_decompose(m, translation, rotation, scale); +} + /////////////////////////////////////////////////////////////////////////////////////////////////// // // computeFrustumBound