Updated ozz-animation to version 0.14.1 @35b2efd4

This commit is contained in:
Martin Felis
2023-03-26 13:28:12 +02:00
parent bf3189ff49
commit 15871f349c
194 changed files with 3495 additions and 1957 deletions
+2 -2
View File
@@ -39,7 +39,7 @@ namespace math {
struct Float4x4;
// Defines an axis aligned box.
struct Box {
struct OZZ_BASE_DLL Box {
// Constructs an invalid box.
Box();
@@ -78,7 +78,7 @@ OZZ_INLINE Box Merge(const Box& _a, const Box& _b) {
}
// Compute box transformation by a matrix.
Box TransformBox(const Float4x4& _matrix, const Box& _box);
OZZ_BASE_DLL Box TransformBox(const Float4x4& _matrix, const Box& _box);
} // namespace math
} // namespace ozz
#endif // OZZ_OZZ_BASE_MATHS_BOX_H_
@@ -152,7 +152,8 @@ typedef const SimdInt4& _SimdInt4;
} // namespace ozz
#endif // OZZ_SIMD_x
// Native SIMD operator already exist on some compilers, so they have to be disable from ozz implementation
// Native SIMD operator already exist on some compilers, so they have to be
// disable from ozz implementation
#if !defined(OZZ_SIMD_REF) && (defined(__GNUC__) || defined(__llvm__))
#define OZZ_DISABLE_SSE_NATIVE_OPERATORS
#endif
@@ -31,6 +31,7 @@
// SIMD refence implementation, based on scalar floats.
#include <stdint.h>
#include <cassert>
#include <cmath>
#include <cstddef>
@@ -1820,22 +1821,9 @@ OZZ_INLINE bool ToAffine(const Float4x4& _m, SimdFloat4* _translation,
}
OZZ_INLINE Float4x4 Float4x4::FromEuler(_SimdFloat4 _v) {
const float ch = std::cos(_v.x);
const float sh = std::sin(_v.x);
const float ca = std::cos(_v.y);
const float sa = std::sin(_v.y);
const float cb = std::cos(_v.z);
const float sb = std::sin(_v.z);
const float sa_cb = sa * cb;
const float sa_sb = sa * sb;
const Float4x4 ret = {
{{ch * ca, sh * sb - ch * sa_cb, ch * sa_sb + sh * cb, 0.f},
{sa, ca * cb, -ca * sb, 0.f},
{-sh * ca, sh * sa_cb + ch * sb, -sh * sa_sb + ch * cb, 0.f},
{0.f, 0.f, 0.f, 1.f}}};
return ret;
return Float4x4::FromAxisAngle(simd_float4::y_axis(), SplatX(_v)) *
Float4x4::FromAxisAngle(simd_float4::x_axis(), SplatY(_v)) *
Float4x4::FromAxisAngle(simd_float4::z_axis(), SplatZ(_v));
}
OZZ_INLINE Float4x4 Float4x4::FromAxisAngle(_SimdFloat4 _axis,
@@ -31,6 +31,7 @@
// SIMD SSE2+ implementation, based on scalar floats.
#include <stdint.h>
#include <cassert>
// Temporarly needed while trigonometric functions aren't implemented.
@@ -1294,7 +1295,7 @@ OZZ_INLINE SimdInt4 Sign(_SimdInt4 _v) {
OZZ_INLINE SimdInt4 Min(_SimdInt4 _a, _SimdInt4 _b) {
#ifdef OZZ_SIMD_SSE4_1
return _mm_min_epi32(_a, _b);
#else // OZZ_SIMD_SSE4_1
#else // OZZ_SIMD_SSE4_1
return OZZ_SSE_SELECT_I(_mm_cmplt_epi32(_a, _b), _a, _b);
#endif // OZZ_SIMD_SSE4_1
}
@@ -1302,7 +1303,7 @@ OZZ_INLINE SimdInt4 Min(_SimdInt4 _a, _SimdInt4 _b) {
OZZ_INLINE SimdInt4 Max(_SimdInt4 _a, _SimdInt4 _b) {
#ifdef OZZ_SIMD_SSE4_1
return _mm_max_epi32(_a, _b);
#else // OZZ_SIMD_SSE4_1
#else // OZZ_SIMD_SSE4_1
return OZZ_SSE_SELECT_I(_mm_cmpgt_epi32(_a, _b), _a, _b);
#endif // OZZ_SIMD_SSE4_1
}
@@ -1775,26 +1776,9 @@ inline bool ToAffine(const Float4x4& _m, SimdFloat4* _translation,
}
inline Float4x4 Float4x4::FromEuler(_SimdFloat4 _v) {
const __m128 cos = Cos(_v);
const __m128 sin = Sin(_v);
const float cx = GetX(cos);
const float sx = GetX(sin);
const float cy = GetY(cos);
const float sy = GetY(sin);
const float cz = GetZ(cos);
const float sz = GetZ(sin);
const float sycz = sy * cz;
const float sysz = sy * sz;
const Float4x4 ret = {{simd_float4::Load(cx * cy, sx * sz - cx * sycz,
cx * sysz + sx * cz, 0.f),
simd_float4::Load(sy, cy * cz, -cy * sz, 0.f),
simd_float4::Load(-sx * cy, sx * sycz + cx * sz,
-sx * sysz + cx * cz, 0.f),
simd_float4::w_axis()}};
return ret;
return Float4x4::FromAxisAngle(simd_float4::y_axis(), SplatX(_v)) *
Float4x4::FromAxisAngle(simd_float4::x_axis(), SplatY(_v)) *
Float4x4::FromAxisAngle(simd_float4::z_axis(), SplatZ(_v));
}
inline Float4x4 Float4x4::FromAxisAngle(_SimdFloat4 _axis, _SimdFloat4 _angle) {
@@ -45,7 +45,7 @@ struct RectInt;
namespace io {
OZZ_IO_TYPE_NOT_VERSIONABLE(math::Float2)
template <>
struct Extern<math::Float2> {
struct OZZ_BASE_DLL Extern<math::Float2> {
static void Save(OArchive& _archive, const math::Float2* _values,
size_t _count);
static void Load(IArchive& _archive, math::Float2* _values, size_t _count,
@@ -54,7 +54,7 @@ struct Extern<math::Float2> {
OZZ_IO_TYPE_NOT_VERSIONABLE(math::Float3)
template <>
struct Extern<math::Float3> {
struct OZZ_BASE_DLL Extern<math::Float3> {
static void Save(OArchive& _archive, const math::Float3* _values,
size_t _count);
static void Load(IArchive& _archive, math::Float3* _values, size_t _count,
@@ -63,7 +63,7 @@ struct Extern<math::Float3> {
OZZ_IO_TYPE_NOT_VERSIONABLE(math::Float4)
template <>
struct Extern<math::Float4> {
struct OZZ_BASE_DLL Extern<math::Float4> {
static void Save(OArchive& _archive, const math::Float4* _values,
size_t _count);
static void Load(IArchive& _archive, math::Float4* _values, size_t _count,
@@ -72,7 +72,7 @@ struct Extern<math::Float4> {
OZZ_IO_TYPE_NOT_VERSIONABLE(math::Quaternion)
template <>
struct Extern<math::Quaternion> {
struct OZZ_BASE_DLL Extern<math::Quaternion> {
static void Save(OArchive& _archive, const math::Quaternion* _values,
size_t _count);
static void Load(IArchive& _archive, math::Quaternion* _values, size_t _count,
@@ -81,7 +81,7 @@ struct Extern<math::Quaternion> {
OZZ_IO_TYPE_NOT_VERSIONABLE(math::Transform)
template <>
struct Extern<math::Transform> {
struct OZZ_BASE_DLL Extern<math::Transform> {
static void Save(OArchive& _archive, const math::Transform* _values,
size_t _count);
static void Load(IArchive& _archive, math::Transform* _values, size_t _count,
@@ -90,7 +90,7 @@ struct Extern<math::Transform> {
OZZ_IO_TYPE_NOT_VERSIONABLE(math::Box)
template <>
struct Extern<math::Box> {
struct OZZ_BASE_DLL Extern<math::Box> {
static void Save(OArchive& _archive, const math::Box* _values, size_t _count);
static void Load(IArchive& _archive, math::Box* _values, size_t _count,
uint32_t _version);
@@ -98,7 +98,7 @@ struct Extern<math::Box> {
OZZ_IO_TYPE_NOT_VERSIONABLE(math::RectFloat)
template <>
struct Extern<math::RectFloat> {
struct OZZ_BASE_DLL Extern<math::RectFloat> {
static void Save(OArchive& _archive, const math::RectFloat* _values,
size_t _count);
static void Load(IArchive& _archive, math::RectFloat* _values, size_t _count,
@@ -107,7 +107,7 @@ struct Extern<math::RectFloat> {
OZZ_IO_TYPE_NOT_VERSIONABLE(math::RectInt)
template <>
struct Extern<math::RectInt> {
struct OZZ_BASE_DLL Extern<math::RectInt> {
static void Save(OArchive& _archive, const math::RectInt* _values,
size_t _count);
static void Load(IArchive& _archive, math::RectInt* _values, size_t _count,
+1 -1
View File
@@ -38,7 +38,7 @@
namespace ozz {
namespace math {
struct Quaternion {
struct OZZ_BASE_DLL Quaternion {
float x, y, z, w;
// Constructs an uninitialized quaternion.
+4 -2
View File
@@ -28,12 +28,14 @@
#ifndef OZZ_OZZ_BASE_MATHS_RECT_H_
#define OZZ_OZZ_BASE_MATHS_RECT_H_
#include "../platform.h"
namespace ozz {
namespace math {
// Defines a rectangle by the integer coordinates of its lower-left and
// width-height.
struct RectInt {
struct OZZ_BASE_DLL RectInt {
// Constructs a uninitialized rectangle.
RectInt() {}
@@ -65,7 +67,7 @@ struct RectInt {
// Defines a rectangle by the floating point coordinates of its lower-left
// and width-height.
struct RectFloat {
struct OZZ_BASE_DLL RectFloat {
// Constructs a uninitialized rectangle.
RectFloat() {}
+1 -5
View File
@@ -35,7 +35,7 @@ namespace ozz {
namespace math {
// Returns SIMDimplementation name has decided at library build time.
const char* SimdImplementationName();
OZZ_BASE_DLL const char* SimdImplementationName();
namespace simd_float4 {
// Returns a SimdFloat4 vector with all components set to 0.
@@ -241,10 +241,6 @@ OZZ_INLINE void Transpose4x1(const SimdFloat4 _in[4], SimdFloat4 _out[1]);
// Remaining y, z and w are set to 0.
OZZ_INLINE void Transpose1x4(const SimdFloat4 _in[1], SimdFloat4 _out[4]);
// Transposes the 1 SimdFloat4 of _in into the x components of the 4
// SimdFloat4 of _out. Remaining y, z and w are set to 0.
OZZ_INLINE void Transpose2x4(const SimdFloat4 _in[2], SimdFloat4 _out[4]);
// Transposes the x and y components of the 4 SimdFloat4 of _in into the 2
// SimdFloat4 of _out.
OZZ_INLINE void Transpose4x2(const SimdFloat4 _in[4], SimdFloat4 _out[2]);
@@ -36,7 +36,7 @@ namespace ozz {
namespace io {
OZZ_IO_TYPE_NOT_VERSIONABLE(math::SimdFloat4)
template <>
struct Extern<math::SimdFloat4> {
struct OZZ_BASE_DLL Extern<math::SimdFloat4> {
static void Save(OArchive& _archive, const math::SimdFloat4* _values,
size_t _count);
static void Load(IArchive& _archive, math::SimdFloat4* _values, size_t _count,
@@ -45,7 +45,7 @@ struct Extern<math::SimdFloat4> {
OZZ_IO_TYPE_NOT_VERSIONABLE(math::SimdInt4)
template <>
struct Extern<math::SimdInt4> {
struct OZZ_BASE_DLL Extern<math::SimdInt4> {
static void Save(OArchive& _archive, const math::SimdInt4* _values,
size_t _count);
static void Load(IArchive& _archive, math::SimdInt4* _values, size_t _count,
@@ -54,7 +54,7 @@ struct Extern<math::SimdInt4> {
OZZ_IO_TYPE_NOT_VERSIONABLE(math::Float4x4)
template <>
struct Extern<math::Float4x4> {
struct OZZ_BASE_DLL Extern<math::Float4x4> {
static void Save(OArchive& _archive, const math::Float4x4* _values,
size_t _count);
static void Load(IArchive& _archive, math::Float4x4* _values, size_t _count,
@@ -43,7 +43,7 @@ struct SoaTransform;
namespace io {
OZZ_IO_TYPE_NOT_VERSIONABLE(math::SoaFloat2)
template <>
struct Extern<math::SoaFloat2> {
struct OZZ_BASE_DLL Extern<math::SoaFloat2> {
static void Save(OArchive& _archive, const math::SoaFloat2* _values,
size_t _count);
static void Load(IArchive& _archive, math::SoaFloat2* _values, size_t _count,
@@ -52,7 +52,7 @@ struct Extern<math::SoaFloat2> {
OZZ_IO_TYPE_NOT_VERSIONABLE(math::SoaFloat3)
template <>
struct Extern<math::SoaFloat3> {
struct OZZ_BASE_DLL Extern<math::SoaFloat3> {
static void Save(OArchive& _archive, const math::SoaFloat3* _values,
size_t _count);
static void Load(IArchive& _archive, math::SoaFloat3* _values, size_t _count,
@@ -61,7 +61,7 @@ struct Extern<math::SoaFloat3> {
OZZ_IO_TYPE_NOT_VERSIONABLE(math::SoaFloat4)
template <>
struct Extern<math::SoaFloat4> {
struct OZZ_BASE_DLL Extern<math::SoaFloat4> {
static void Save(OArchive& _archive, const math::SoaFloat4* _values,
size_t _count);
static void Load(IArchive& _archive, math::SoaFloat4* _values, size_t _count,
@@ -70,7 +70,7 @@ struct Extern<math::SoaFloat4> {
OZZ_IO_TYPE_NOT_VERSIONABLE(math::SoaQuaternion)
template <>
struct Extern<math::SoaQuaternion> {
struct OZZ_BASE_DLL Extern<math::SoaQuaternion> {
static void Save(OArchive& _archive, const math::SoaQuaternion* _values,
size_t _count);
static void Load(IArchive& _archive, math::SoaQuaternion* _values,
@@ -79,7 +79,7 @@ struct Extern<math::SoaQuaternion> {
OZZ_IO_TYPE_NOT_VERSIONABLE(math::SoaFloat4x4)
template <>
struct Extern<math::SoaFloat4x4> {
struct OZZ_BASE_DLL Extern<math::SoaFloat4x4> {
static void Save(OArchive& _archive, const math::SoaFloat4x4* _values,
size_t _count);
static void Load(IArchive& _archive, math::SoaFloat4x4* _values,
@@ -88,7 +88,7 @@ struct Extern<math::SoaFloat4x4> {
OZZ_IO_TYPE_NOT_VERSIONABLE(math::SoaTransform)
template <>
struct Extern<math::SoaTransform> {
struct OZZ_BASE_DLL Extern<math::SoaTransform> {
static void Save(OArchive& _archive, const math::SoaTransform* _values,
size_t _count);
static void Load(IArchive& _archive, math::SoaTransform* _values,
+1 -1
View File
@@ -37,7 +37,7 @@ namespace math {
// Stores an affine transformation with separate translation, rotation and scale
// attributes.
struct Transform {
struct OZZ_BASE_DLL Transform {
// Translation affine transformation component.
Float3 translation;
+3 -3
View File
@@ -38,7 +38,7 @@ namespace ozz {
namespace math {
// Declares a 2d float vector.
struct Float2 {
struct OZZ_BASE_DLL Float2 {
float x, y;
// Constructs an uninitialized vector.
@@ -64,7 +64,7 @@ struct Float2 {
};
// Declares a 3d float vector.
struct Float3 {
struct OZZ_BASE_DLL Float3 {
float x, y, z;
// Constructs an uninitialized vector.
@@ -96,7 +96,7 @@ struct Float3 {
};
// Declares a 4d float vector.
struct Float4 {
struct OZZ_BASE_DLL Float4 {
float x, y, z, w;
// Constructs an uninitialized vector.