Skip to content

Commit

Permalink
Auto-update from libvoxelstorm: latest vectorstorm improvements from …
Browse files Browse the repository at this point in the history
…Armchair Engine: switchable sqrt modes and removing older deprecated functions and aliases (6c2fde6)
  • Loading branch information
slowriot committed Dec 20, 2024
1 parent a0b68d4 commit ec9af84
Show file tree
Hide file tree
Showing 17 changed files with 238 additions and 474 deletions.
3 changes: 0 additions & 3 deletions vectorstorm/aabb/aabb2.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,6 @@ class aabb2 {
inline constexpr vector2<T> centre() const noexcept __attribute__((__always_inline__)) {
return (min + max) / static_cast<T>(2);
}
inline vector2<T> constexpr center() const noexcept __attribute__((__always_inline__)) __attribute__((__deprecated__("Proper English, please!"))) {
return centre();
}

/**
* Gets extent of bounding-box.
Expand Down
8 changes: 0 additions & 8 deletions vectorstorm/aabb/aabb2_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@ using aabb2i = aabb2<int>;
/// 2D axis-aligned bounding box of unsigned integers
using aabb2ui = aabb2<unsigned int>;

// deprecated transitional declarations
template<typename T>
using Aabb2 __attribute__((deprecated("Use aabb2 instead."))) = aabb2<T>;
using Aabb2f __attribute__((deprecated("Use aabb2 instead."))) = aabb2f;
using Aabb2d __attribute__((deprecated("Use aabb2 instead."))) = aabb2d;
using Aabb2ld __attribute__((deprecated("Use aabb2 instead."))) = aabb2ld;
using Aabb2i __attribute__((deprecated("Use aabb2 instead."))) = aabb2i;

#ifdef VECTORSTORM_NAMESPACE
}
#endif //VECTORSTORM_NAMESPACE
3 changes: 0 additions & 3 deletions vectorstorm/aabb/aabb3.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,6 @@ class aabb3 {
inline vector3<T> constexpr centre() const noexcept __attribute__((__always_inline__)) {
return (min + max) / static_cast<T>(2);
}
inline vector3<T> constexpr center() const noexcept __attribute__((__always_inline__)) __attribute__((__deprecated__("Proper English, please!"))) {
return centre();
}

/**
* Gets extent of bounding-box.
Expand Down
8 changes: 0 additions & 8 deletions vectorstorm/aabb/aabb3_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@ using aabb3i = aabb3<int>;
/// 2D axis-aligned bounding box of unsigned integers
using aabb3ui = aabb3<unsigned int>;

// deprecated transitional declarations
template<typename T>
using Aabb3 __attribute__((deprecated("Use aabb3 instead."))) = aabb3<T>;
using Aabb3f __attribute__((deprecated("Use aabb3 instead."))) = aabb3f;
using Aabb3d __attribute__((deprecated("Use aabb3 instead."))) = aabb3d;
using Aabb3ld __attribute__((deprecated("Use aabb3 instead."))) = aabb3ld;
using Aabb3i __attribute__((deprecated("Use aabb3 instead."))) = aabb3i;

#ifdef VECTORSTORM_NAMESPACE
}
#endif //VECTORSTORM_NAMESPACE
43 changes: 0 additions & 43 deletions vectorstorm/matrix/matrix3.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,6 @@ class matrix3 {
inline static matrix3<T> constexpr create_rotation_from_euler_angles(T xDeg, T yDeg, T zDeg) noexcept __attribute__((__always_inline__)) {
return create_rotation_from_euler_angles_rad(deg2rad(xDeg), deg2rad(yDeg), deg2rad(zDeg));
}
inline static matrix3<T> constexpr create_rotation_around_axis(T xDeg, T yDeg, T zDeg) noexcept __attribute__((__always_inline__)) __attribute__((__deprecated__("Use create_rotation_from_euler_angles()"))) {
return create_rotation_from_euler_angles(xDeg, yDeg, zDeg);
}
inline static matrix3<T> constexpr createRotationAroundAxis(T xDeg, T yDeg, T zDeg) noexcept __attribute__((__always_inline__)) __attribute__((__deprecated__("Use create_rotation_from_euler_angles()"))) {
return create_rotation_from_euler_angles(xDeg, yDeg, zDeg);
}

/**
* Creates rotation matrix by rotation around three axes, radian version.
Expand Down Expand Up @@ -183,12 +177,6 @@ class matrix3 {
temp_cos_z_cos_y * sin_xRads,
temp_cos_z_cos_y * cos_xRads);
}
inline static matrix3<T> constexpr create_rotation_around_axis_rad(T xRads, T yRads, T zRads) noexcept __attribute__((__always_inline__)) __attribute__((__deprecated__("Use create_rotation_from_euler_angles_rad()"))) {
return create_rotation_from_euler_angles_rad(xRads, yRads, zRads);
}
inline static matrix3<T> constexpr createRotationAroundAxis_rad(T xRads, T yRads, T zRads) noexcept __attribute__((__always_inline__)) __attribute__((__deprecated__("Use create_rotation_from_euler_angles_rad()"))) {
return create_rotation_from_euler_angles_rad(xRads, yRads, zRads);
}

/**
* Creates rotation matrix by rotation around an axis.
Expand All @@ -198,9 +186,6 @@ class matrix3 {
inline static matrix3<T> constexpr create_rotation_around_axis(vector3<T> const &axis, T angle) noexcept __attribute__((__always_inline__)) {
return create_rotation_around_axis_rad(axis, deg2rad(angle));
}
inline static matrix3<T> constexpr createRotationAroundAxis(vector3<T> const &axis, T angle) noexcept __attribute__((__always_inline__)) __attribute__((__deprecated__("Use create_rotation_around_axis()"))) {
return create_rotation_around_axis(axis, angle);
}

/**
* Creates rotation matrix by rotation around an axis, radian version.
Expand All @@ -227,9 +212,6 @@ class matrix3 {
axis.y * axis.z * cos_a_inv + sin_a * axis.x,
axis.z * axis.z * cos_a_inv + cos_a);
}
inline static matrix3<T> constexpr createRotationAroundAxis_rad(vector3<T> const &axis, T angle) noexcept __attribute__((__always_inline__)) __attribute__((__deprecated__("Use create_rotation_around_axis_rad()"))) {
return create_rotation_around_axis_rad(axis, angle);
}

/**
* Creates rotation matrix by aligning one vector to another.
Expand Down Expand Up @@ -260,9 +242,6 @@ class matrix3 {
cross.z * cross.z * temp_k + dot);

}
inline static matrix3<T> constexpr createRotationBetweenVectors(vector3<T> const &from, vector3<T> const &to) noexcept __attribute__((__always_inline__)) __attribute__((__deprecated__("Use create_rotation_between_vectors()"))) {
return create_rotation_between_vectors(from, to);
}

/**
* Creates a rotation matrix to align with a target vector direction @a target
Expand Down Expand Up @@ -297,10 +276,6 @@ class matrix3 {
static_cast<T>(mat[1]), static_cast<T>(mat[5]), static_cast<T>(mat[9]),
static_cast<T>(mat[2]), static_cast<T>(mat[6]), static_cast<T>(mat[10]));
}
template<typename It> __attribute__((__always_inline__)) __attribute__((__deprecated__("Use from_ode()")))
inline static matrix3<T> constexpr fromOde(It const *mat) noexcept {
return from_ode(mat);
}

/**
* Creates new matrix 3x3 from array that represents such matrix 3x3
Expand All @@ -314,10 +289,6 @@ class matrix3 {
static_cast<T>(arr[1]), static_cast<T>(arr[4]), static_cast<T>(arr[7]),
static_cast<T>(arr[2]), static_cast<T>(arr[5]), static_cast<T>(arr[8]));
}
template<typename FromT> __attribute__((__always_inline__)) __attribute__((__deprecated__("Use from_row_major_array()")))
inline static matrix3<T> constexpr fromRowMajorArray(FromT const *arr) noexcept {
return from_row_major_array(arr);
}

/**
* Creates new matrix 3x3 from array that represents such matrix 3x3
Expand All @@ -331,10 +302,6 @@ class matrix3 {
static_cast<T>(arr[3]), static_cast<T>(arr[4]), static_cast<T>(arr[5]),
static_cast<T>(arr[6]), static_cast<T>(arr[7]), static_cast<T>(arr[8]));
}
template<typename FromT> __attribute__((__always_inline__)) __attribute__((__deprecated__("Use from_column_major_array()")))
inline static matrix3<T> constexpr fromColumnMajorArray(FromT const *arr) noexcept {
return from_column_major_array(arr);
}

//---------------------[ equality operators ]------------------------------
/**
Expand Down Expand Up @@ -427,9 +394,6 @@ class matrix3 {
data[6], data[7], data[8], static_cast<T>(0),
static_cast<T>(0), static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
}
inline matrix4<T> constexpr getTranslation() const noexcept __attribute__((__always_inline__)) __attribute__((__deprecated__("Use get_transform()"))) {
return get_transform();
}

/**
* Copy operator
Expand Down Expand Up @@ -719,10 +683,6 @@ class matrix3 {
data[4] = data[8] * data[0] - data[2] * data[6];
data[5] = data[6] * data[1] - data[0] * data[7];
}
[[deprecated("Proper English, please!")]]
inline void constexpr orthonormalize() noexcept __attribute__((__always_inline__)) {
orthonormalise();
}

/**
* Returns a quaternion such that its corresponding matrix can be used to diagonalise the input matrix.
Expand Down Expand Up @@ -815,9 +775,6 @@ class matrix3 {
oss << *this;
return oss.str();
}
inline std::string CONSTEXPR_IF_NO_CLANG toString() const noexcept __attribute__((__always_inline__)) __attribute__((__deprecated__("Use to_string()"))) {
return to_string();
}
};

/**
Expand Down
8 changes: 0 additions & 8 deletions vectorstorm/matrix/matrix3_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@ using mat3ui = matrix3ui;
// Special WebGPU padded 3x3 matrix - only float is needed
using mat3fwgpu = matrix3wgpu<float>;

// deprecated transitional declarations
template<typename T>
using Matrix3 __attribute__((deprecated("Use matrix3 or mat3 instead."))) = matrix3<T>;
using Matrix3f __attribute__((deprecated("Use matrix3 or mat3 instead."))) = matrix3f;
using Matrix3d __attribute__((deprecated("Use matrix3 or mat3 instead."))) = matrix3d;
using Matrix3ld __attribute__((deprecated("Use matrix3 or mat3 instead."))) = matrix3ld;
using Matrix3i __attribute__((deprecated("Use matrix3 or mat3 instead."))) = matrix3i;

#ifdef VECTORSTORM_NAMESPACE
}
#endif //VECTORSTORM_NAMESPACE
56 changes: 0 additions & 56 deletions vectorstorm/matrix/matrix4.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,6 @@ class matrix4 {
inline static matrix4<T> constexpr create_rotation_from_euler_angles(T xDeg, T yDeg, T zDeg) noexcept __attribute__((__always_inline__)) {
return create_rotation_from_euler_angles_rad(deg2rad(xDeg), deg2rad(yDeg), deg2rad(zDeg));
}
inline static matrix4<T> constexpr create_rotation_around_axis(T xDeg, T yDeg, T zDeg) noexcept __attribute__((__always_inline__)) __attribute__((__deprecated__("Use create_rotation_from_euler_angles()"))) {
return create_rotation_from_euler_angles(xDeg, yDeg, zDeg);
}
inline static matrix4<T> constexpr createRotationAroundAxis(T xDeg, T yDeg, T zDeg) noexcept __attribute__((__always_inline__)) __attribute__((__deprecated__("Use create_rotation_from_euler_angles()"))) {
return create_rotation_from_euler_angles(xDeg, yDeg, zDeg);
}

/**
* Creates rotation matrix by rotation around three axes, radian version.
Expand All @@ -210,12 +204,6 @@ class matrix4 {
inline static matrix4<T> constexpr create_rotation_from_euler_angles_rad(T xRads, T yRads, T zRads) noexcept __attribute__((__always_inline__)) {
return matrix3<T>::create_rotation_from_euler_angles_rad(xRads, yRads, zRads).get_transform();
}
inline static matrix4<T> constexpr create_rotation_around_axis_rad(T xRads, T yRads, T zRads) noexcept __attribute__((__always_inline__)) __attribute__((__deprecated__("Use create_rotation_from_euler_angles_rad()"))) {
return create_rotation_from_euler_angles_rad(xRads, yRads, zRads);
}
inline static matrix4<T> constexpr createRotationAroundAxis_rad(T xRads, T yRads, T zRads) noexcept __attribute__((__always_inline__)) __attribute__((__deprecated__("Use create_rotation_from_euler_angles_rad()"))) {
return create_rotation_from_euler_angles_rad(xRads, yRads, zRads);
}

/**
* Creates rotation matrix by rotation around an axis.
Expand All @@ -225,9 +213,6 @@ class matrix4 {
inline static matrix4<T> constexpr create_rotation_around_axis(vector3<T> const &axis, T angle) noexcept __attribute__((__always_inline__)) {
return create_rotation_around_axis_rad(axis, deg2rad(angle));
}
inline static matrix4<T> constexpr createRotationAroundAxis(vector3<T> const &axis, T angle) noexcept __attribute__((__always_inline__)) __attribute__((__deprecated__("Use create_rotation_around_axis()"))) {
return create_rotation_around_axis(axis, angle);
}

/**
* Creates rotation matrix by rotation around an axis, radian version.
Expand All @@ -237,9 +222,6 @@ class matrix4 {
inline static matrix4<T> constexpr create_rotation_around_axis_rad(vector3<T> const &axis, T angle) noexcept __attribute__((__always_inline__)) {
return matrix3<T>::create_rotation_around_axis_rad(axis, angle).get_transform();
}
inline static matrix4<T> constexpr createRotationAroundAxis_rad(vector3<T> const &axis, T angle) noexcept __attribute__((__always_inline__)) __attribute__((__deprecated__("Use create_rotation_around_axis_rad()"))) {
return create_rotation_around_axis_rad(axis, angle);
}

/// Creates translation matrix
/**
Expand All @@ -255,9 +237,6 @@ class matrix4 {
static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(0),
x, y, z, w);
}
inline static matrix4<T> constexpr createTranslation(T x, T y, T z, T w = 1) noexcept __attribute__((__always_inline__)) __attribute__((__deprecated__("Use create_translation()"))) {
return create_translation(x, y, z, w);
}

/**
* Creates translation matrix from a vector3
Expand Down Expand Up @@ -291,9 +270,6 @@ class matrix4 {
static_cast<T>(0), static_cast<T>(0), sz, static_cast<T>(0),
static_cast<T>(0), static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
}
inline static matrix4<T> constexpr createScale(T sx, T sy, T sz) noexcept __attribute__((__always_inline__)) __attribute__((__deprecated__("Use create_scale()"))) {
return create_scale(sx, sy, sz);
}

/**
* Creates rotation matrix by aligning one vector to another.
Expand Down Expand Up @@ -347,9 +323,6 @@ class matrix4 {
static_cast<T>(0),
static_cast<T>(1)) * matrix4<T>::create_translation(-eye_pos.x, -eye_pos.y, -eye_pos.z);
}
inline static matrix4<T> constexpr createLookAt(vector3<T> const &eye_pos, vector3<T> const &centre_pos, vector3<T> const &up_dir) noexcept __attribute__((__always_inline__)) __attribute__((__deprecated__("Use create_look_at()"))) {
return create_look_at(eye_pos, centre_pos, up_dir);
}

/**
* Creates OpenGL compatible perspective projection according to specified frustum parameters.
Expand Down Expand Up @@ -401,9 +374,6 @@ class matrix4 {
(static_cast<T>(-2) * far_plane * near_plane) / (far_plane - near_plane),
static_cast<T>(0));
}
inline static matrix4<T> constexpr createFrustum(T left, T right, T bottom, T top, T near_plane, T far_plane) noexcept __attribute__((__always_inline__)) __attribute__((__deprecated__("Use create_frustum()"))) {
return create_frustum(left, right, bottom, top, near_plane, far_plane);
}

/**
* Creates OpenGL compatible orthographic projection matrix.
Expand Down Expand Up @@ -452,9 +422,6 @@ class matrix4 {
-(far_plane + near_plane) / (far_plane - near_plane),
static_cast<T>(1));
}
inline static matrix4<T> constexpr createOrtho(T left, T right, T bottom, T top, T near_plane, T far_plane) noexcept __attribute__((__always_inline__)) __attribute__((__deprecated__("Use create_ortho()"))) {
return create_ortho(left, right, bottom, top, near_plane, far_plane);
}

/**
* Creates new matrix 4x4 from array that represents such matrix 4x4
Expand All @@ -469,10 +436,6 @@ class matrix4 {
static_cast<T>(arr[2]), static_cast<T>(arr[6]), static_cast<T>(arr[10]), static_cast<T>(arr[14]),
static_cast<T>(arr[3]), static_cast<T>(arr[7]), static_cast<T>(arr[11]), static_cast<T>(arr[15]));
}
template<typename FromT> __attribute__((__always_inline__)) __attribute__((__deprecated__("Use from_row_major_array()")))
inline static matrix4<T> constexpr fromRowMajorArray(FromT const *arr) noexcept {
return from_row_major_array(arr);
}

/**
* Creates new matrix 4x4 from array that represents such matrix 4x4
Expand All @@ -487,10 +450,6 @@ class matrix4 {
static_cast<T>(arr[ 8]), static_cast<T>(arr[ 9]), static_cast<T>(arr[10]), static_cast<T>(arr[11]),
static_cast<T>(arr[12]), static_cast<T>(arr[13]), static_cast<T>(arr[14]), static_cast<T>(arr[15]));
}
template<typename FromT> __attribute__((__always_inline__)) __attribute__((__deprecated__("Use from_column_major_array()")))
inline static matrix4<T> constexpr fromColumnMajorArray(FromT const *arr) noexcept {
return from_column_major_array(arr);
}

/**
* Creates new matrix 4x4 from array that represents such matrix 3x4
Expand Down Expand Up @@ -613,19 +572,13 @@ class matrix4 {
data[14] = v.z;
data[15] = 1;
}
inline void constexpr setTranslation(vector3<T> const &v) noexcept __attribute__((__always_inline__)) __attribute__((__deprecated__("Use set_translation()"))) {
set_translation(v);
}

/**
* Returns translation part of matrix.
*/
inline vector3<T> constexpr get_translation() const noexcept __attribute__((__always_inline__)) {
return vector3<T>(data[12], data[13], data[14]);
}
inline vector3<T> constexpr getTranslation() const noexcept __attribute__((__always_inline__)) __attribute__((__deprecated__("Use get_translation()"))) {
return get_translation();
}

/**
* Sets rotation part (matrix 3x3) of matrix.
Expand All @@ -643,9 +596,6 @@ class matrix4 {
data[ 9] = m.data[7];
data[10] = m.data[8];
}
inline void constexpr setRotation(matrix3<T> const &m) noexcept __attribute__((__always_inline__)) __attribute__((__deprecated__("Use set_rotation()"))) {
set_rotation(m);
}

/**
* Returns rotation (matrix 3x3) part of matrix.
Expand All @@ -655,9 +605,6 @@ class matrix4 {
data[ 4], data[ 5], data[ 6],
data[ 8], data[ 9], data[10]);
}
inline matrix3<T> constexpr getRotation() const noexcept __attribute__((__always_inline__)) __attribute__((__deprecated__("Use get_rotation()"))) {
return get_rotation();
}

/**
* Sets scale part of matrix.
Expand Down Expand Up @@ -1058,9 +1005,6 @@ class matrix4 {
oss << *this;
return oss.str();
}
inline std::string CONSTEXPR_IF_NO_CLANG toString() const noexcept __attribute__((__always_inline__)) __attribute__((__deprecated__("Use to_string()"))) {
return to_string();
}
};

#ifdef VECTORSTORM_NAMESPACE
Expand Down
8 changes: 0 additions & 8 deletions vectorstorm/matrix/matrix4_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@ using mat4ld = matrix4ld;
using mat4i = matrix4i;
using mat4ui = matrix4ui;

// deprecated transitional declarations
template<typename T>
using Matrix4 __attribute__((deprecated("Use matrix4 or mat4 instead."))) = matrix4<T>;
using Matrix4f __attribute__((deprecated("Use matrix4 or mat4 instead."))) = matrix4f;
using Matrix4d __attribute__((deprecated("Use matrix4 or mat4 instead."))) = matrix4d;
using Matrix4ld __attribute__((deprecated("Use matrix4 or mat4 instead."))) = matrix4ld;
using Matrix4i __attribute__((deprecated("Use matrix4 or mat4 instead."))) = matrix4i;

#ifdef VECTORSTORM_NAMESPACE
}
#endif //VECTORSTORM_NAMESPACE
Loading

0 comments on commit ec9af84

Please sign in to comment.