From da99fe63be201fd1b84201f024b6b8297518bfa7 Mon Sep 17 00:00:00 2001 From: daemyung jang Date: Fri, 11 Mar 2022 10:07:03 +0900 Subject: [PATCH] Make public gltfio's math --- android/gltfio-android/CMakeLists.txt | 2 +- libs/gltfio/CMakeLists.txt | 2 +- libs/gltfio/{src => include/gltfio}/math.h | 6 +++--- libs/gltfio/src/Animator.cpp | 2 +- libs/gltfio/src/AssetLoader.cpp | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) rename libs/gltfio/{src => include/gltfio}/math.h (92%) diff --git a/android/gltfio-android/CMakeLists.txt b/android/gltfio-android/CMakeLists.txt index c5688a244b..b7a8c4471d 100644 --- a/android/gltfio-android/CMakeLists.txt +++ b/android/gltfio-android/CMakeLists.txt @@ -32,6 +32,7 @@ set(GLTFIO_SRCS ${GLTFIO_DIR}/include/gltfio/ResourceLoader.h ${GLTFIO_DIR}/include/gltfio/FilamentAsset.h ${GLTFIO_DIR}/include/gltfio/FilamentInstance.h + ${GLTFIO_DIR}/include/gltfio/math.h ${GLTFIO_DIR}/src/Animator.cpp ${GLTFIO_DIR}/src/AssetLoader.cpp @@ -51,7 +52,6 @@ set(GLTFIO_SRCS ${GLTFIO_DIR}/src/UbershaderLoader.cpp ${GLTFIO_DIR}/src/Wireframe.cpp ${GLTFIO_DIR}/src/Wireframe.h - ${GLTFIO_DIR}/src/math.h ${GLTFIO_DIR}/src/upcast.h ${GLTFIO_DIR}/src/Image.cpp diff --git a/libs/gltfio/CMakeLists.txt b/libs/gltfio/CMakeLists.txt index 92f6735972..1ee2113135 100644 --- a/libs/gltfio/CMakeLists.txt +++ b/libs/gltfio/CMakeLists.txt @@ -14,6 +14,7 @@ set(PUBLIC_HDRS include/gltfio/ResourceLoader.h include/gltfio/FilamentAsset.h include/gltfio/FilamentInstance.h + include/gltfio/math.h ) set(SRCS @@ -35,7 +36,6 @@ set(SRCS src/UbershaderLoader.cpp src/Wireframe.cpp src/Wireframe.h - src/math.h src/upcast.h src/Image.cpp ) diff --git a/libs/gltfio/src/math.h b/libs/gltfio/include/gltfio/math.h similarity index 92% rename from libs/gltfio/src/math.h rename to libs/gltfio/include/gltfio/math.h index cd35673bab..f94d3cc78a 100644 --- a/libs/gltfio/src/math.h +++ b/libs/gltfio/include/gltfio/math.h @@ -26,7 +26,7 @@ namespace gltfio { template -T cubicSpline(const T& vert0, const T& tang0, const T& vert1, const T& tang1, float t) { +UTILS_PUBLIC T cubicSpline(const T& vert0, const T& tang0, const T& vert1, const T& tang1, float t) { float tt = t * t, ttt = tt * t; float s2 = -2 * ttt + 3 * tt, s3 = ttt - tt; float s0 = 1 - s2, s1 = s3 - tt + t; @@ -37,7 +37,7 @@ T cubicSpline(const T& vert0, const T& tang0, const T& vert1, const T& tang1, fl return s0 * p0 + s1 * m0 * t + s2 * p1 + s3 * m1 * t; } -inline void decomposeMatrix(const filament::math::mat4f& mat, filament::math::float3* translation, +UTILS_PUBLIC inline void decomposeMatrix(const filament::math::mat4f& mat, filament::math::float3* translation, filament::math::quatf* rotation, filament::math::float3* scale) { using namespace filament::math; @@ -83,7 +83,7 @@ inline void decomposeMatrix(const filament::math::mat4f& mat, filament::math::fl } } -inline filament::math::mat4f composeMatrix(const filament::math::float3& translation, +UTILS_PUBLIC inline filament::math::mat4f composeMatrix(const filament::math::float3& translation, const filament::math::quatf& rotation, const filament::math::float3& scale) { float tx = translation[0]; float ty = translation[1]; diff --git a/libs/gltfio/src/Animator.cpp b/libs/gltfio/src/Animator.cpp index 756e05bd06..d436e64071 100644 --- a/libs/gltfio/src/Animator.cpp +++ b/libs/gltfio/src/Animator.cpp @@ -15,10 +15,10 @@ */ #include +#include #include "FFilamentAsset.h" #include "FFilamentInstance.h" -#include "math.h" #include "upcast.h" #include diff --git a/libs/gltfio/src/AssetLoader.cpp b/libs/gltfio/src/AssetLoader.cpp index a1d6376839..e3b06d6128 100644 --- a/libs/gltfio/src/AssetLoader.cpp +++ b/libs/gltfio/src/AssetLoader.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include "FFilamentAsset.h" #include "GltfEnums.h" @@ -51,7 +52,6 @@ #define CGLTF_IMPLEMENTATION #include -#include "math.h" #include "upcast.h" using namespace filament;