diff options
author | chai <chaifix@163.com> | 2021-12-03 18:17:33 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-12-03 18:17:33 +0800 |
commit | b30a3c8743d8837e4b1ef871d133ae5e7ef9a06b (patch) | |
tree | 160417e7b6bfc4ad9ef9ab6f20f93ab16d12a8c0 /Client/Source | |
parent | e8e2283d264be24fc2f69d536b4bf58d3c403616 (diff) |
*misc
Diffstat (limited to 'Client/Source')
-rw-r--r-- | Client/Source/PND/Common/Type.h | 7 | ||||
-rw-r--r-- | Client/Source/PND/Math/Vector2.h | 6 | ||||
-rw-r--r-- | Client/Source/PND/main.cpp | 2 | ||||
-rw-r--r-- | Client/Source/Phy2D/Common/Settings.h | 103 | ||||
-rw-r--r-- | Client/Source/Phy2D/Common/Type.h | 9 | ||||
-rw-r--r-- | Client/Source/Phy2D/Documents/Phy2D.xlsx | bin | 0 -> 15199 bytes | |||
-rw-r--r-- | Client/Source/Phy2D/Documents/UnityPhysics2D.xlsx | bin | 0 -> 64233 bytes | |||
-rw-r--r-- | Client/Source/Phy2D/Math/Mat22.cpp | 0 | ||||
-rw-r--r-- | Client/Source/Phy2D/Math/Mat22.h | 0 | ||||
-rw-r--r-- | Client/Source/Phy2D/Math/Mat33.cpp | 0 | ||||
-rw-r--r-- | Client/Source/Phy2D/Math/Mat33.h | 0 | ||||
-rw-r--r-- | Client/Source/Phy2D/Math/Vec2.cpp | 0 | ||||
-rw-r--r-- | Client/Source/Phy2D/Math/Vec2.h | 0 | ||||
-rw-r--r-- | Client/Source/Phy2D/Phy2D.h | 3 |
14 files changed, 19 insertions, 111 deletions
diff --git a/Client/Source/PND/Common/Type.h b/Client/Source/PND/Common/Type.h index 9b768e9..5ac3660 100644 --- a/Client/Source/PND/Common/Type.h +++ b/Client/Source/PND/Common/Type.h @@ -3,6 +3,7 @@ #include "libfixmath/libfixmath/fix16.hpp"
#include "fix32/fix32.hpp"
-typedef Fix32 fixed32;
-typedef Fix16 fixed16;
-typedef fixed32 fixed;
+typedef Fix32 fixed32; // Q32.32
+typedef Fix16 fixed16; // Q16.16
+
+using fixed = fixed32;
diff --git a/Client/Source/PND/Math/Vector2.h b/Client/Source/PND/Math/Vector2.h index 67ac4b7..ab5ec5c 100644 --- a/Client/Source/PND/Math/Vector2.h +++ b/Client/Source/PND/Math/Vector2.h @@ -1,14 +1,12 @@ #pragma once
-
+//
#include <vector>
#include <unordered_map>
#include "../Common/Type.h"
-
class Vector2
{
public:
- fixed32 x, y;
-
+ fixed x,y;
};
diff --git a/Client/Source/PND/main.cpp b/Client/Source/PND/main.cpp index 5f2628a..4655eb9 100644 --- a/Client/Source/PND/main.cpp +++ b/Client/Source/PND/main.cpp @@ -10,4 +10,4 @@ int main() getchar();
return 0;
-}
\ No newline at end of file +}
diff --git a/Client/Source/Phy2D/Common/Settings.h b/Client/Source/Phy2D/Common/Settings.h index b03ecad..7368f9c 100644 --- a/Client/Source/Phy2D/Common/Settings.h +++ b/Client/Source/Phy2D/Common/Settings.h @@ -1,111 +1,10 @@ #pragma once
-#define NUMBER_FLOAT 1
-#define NUMBER_LIBFIX 2
-#define NUMBER_FPM 3
-#define NUMBER_FIX32 4
-
-#define NUMBER_ALIAS NUMBER_FIX32
-
-#if NUMBER_ALIAS == NUMBER_LIBFIX
-#include "libfixmath/libfixmath/fixmath.h"
-#elif NUMBER_ALIAS == NUMBER_FPM
-#include "fpm/include/fpm/fixed.hpp"
-#include "fpm/include/fpm/math.hpp"
-#elif NUMBER_ALIAS == NUMBER_FIX32
-#include "fix32/fix32.hpp"
-#endif
+#include "Type.h"
namespace Phy2D
{
-#if NUMBER_ALIAS == NUMBER_FLOAT
-
- typedef float fixed;
-#define NUMBER_MAX (FLT_MAX)
-#define NUMBER_MIN (FLT_MIN)
-#define SQRT(a) (sqrt((a)))
-#define SIN(a) (sin((a)))
-#define COS(a) (cos((a)))
-#define PI (3.1415925f)
-
-#elif NUMBER_ALIAS == NUMBER_LIBFIX
-
- typedef Fix16 fixed;
-#define NUMBER_MAX (fix16_maximum)
-#define NUMBER_MIN (fix16_minimum)
-#define SQRT(a) ((a).sqrt())
-#define SIN(a) ((a).sin())
-#define COS(a) ((a).cos())
-#define PI (fix16_pi)
-
-#elif NUMBER_ALIAS == NUMBER_FPM
- - template <typename T> - struct Limits {}; - - template <> - struct Limits<fpm::fixed_16_16> - { - static constexpr bool is_signed() noexcept { return true; } - static constexpr int digits() noexcept { return 31; } - static constexpr int max_digits10() noexcept { return 5 + 5; } - static constexpr int min_exponent() noexcept { return -15; } - static constexpr int max_exponent() noexcept { return 15; } - static constexpr int min_exponent10() noexcept { return -4; } - static constexpr int max_exponent10() noexcept { return 4; } - static constexpr fpm::fixed_16_16 min() noexcept { return fpm::fixed_16_16::from_raw_value(-2147483647 - 1); } - static constexpr fpm::fixed_16_16 max() noexcept { return fpm::fixed_16_16::from_raw_value(2147483647); } - }; - - template <> - struct Limits<fpm::fixed_24_8> - { - static constexpr bool is_signed() noexcept { return true; } - static constexpr int digits() noexcept { return 31; } - static constexpr int max_digits10() noexcept { return 7 + 3; } - static constexpr int min_exponent() noexcept { return -7; } - static constexpr int max_exponent() noexcept { return 23; } - static constexpr int min_exponent10() noexcept { return -2; } - static constexpr int max_exponent10() noexcept { return 6; } - static constexpr fpm::fixed_24_8 min() noexcept { return fpm::fixed_24_8::from_raw_value(-2147483647 - 1); } - static constexpr fpm::fixed_24_8 max() noexcept { return fpm::fixed_24_8::from_raw_value(2147483647); } - }; - - template <> - struct Limits<fpm::fixed_8_24> - { - static constexpr bool is_signed() noexcept { return true; } - static constexpr int digits() noexcept { return 31; } - static constexpr int max_digits10() noexcept { return 3 + 8; } - static constexpr int min_exponent() noexcept { return -23; } - static constexpr int max_exponent() noexcept { return 7; } - static constexpr int min_exponent10() noexcept { return -7; } - static constexpr int max_exponent10() noexcept { return 2; } - static constexpr fpm::fixed_8_24 min() noexcept { return fpm::fixed_8_24::from_raw_value(-2147483647 - 1); } - static constexpr fpm::fixed_8_24 max() noexcept { return fpm::fixed_8_24::from_raw_value(2147483647); } - }; -
- typedef fpm::fixed_16_16 fixed;
-#define NUMBER_MAX (Limits<fixed>::max())
-#define NUMBER_MIN (Limits<fixed>::min())
-#define SQRT(a) (fpm::sqrt((a)))
-#define SIN(a) (fpm::sin((a)))
-#define COS(a) (fpm::cos((a)))
-#define PI (fixed::pi())
-
-#elif NUMBER_ALIAS == NUMBER_FIX32
-
- typedef Fix32 fixed32; // Q32.32
- typedef fixed32 fixed;
-
-#define NUMBER_MAX (CONST_MAX)
-#define NUMBER_MIN (CONST_MIN)
-#define SQRT(a) ((a).sqrt())
-#define SIN(a) ((a).sin())
-#define COS(a) ((a).cos())
-#define PI (CONST_PI)
-#endif
}
\ No newline at end of file diff --git a/Client/Source/Phy2D/Common/Type.h b/Client/Source/Phy2D/Common/Type.h index e69de29..c985d99 100644 --- a/Client/Source/Phy2D/Common/Type.h +++ b/Client/Source/Phy2D/Common/Type.h @@ -0,0 +1,9 @@ +#include "fix32/fix32.hpp"
+
+namespace Phy2D
+{
+
+ using fixed = Fix32;
+
+}
+
diff --git a/Client/Source/Phy2D/Documents/Phy2D.xlsx b/Client/Source/Phy2D/Documents/Phy2D.xlsx Binary files differnew file mode 100644 index 0000000..5b6ba93 --- /dev/null +++ b/Client/Source/Phy2D/Documents/Phy2D.xlsx diff --git a/Client/Source/Phy2D/Documents/UnityPhysics2D.xlsx b/Client/Source/Phy2D/Documents/UnityPhysics2D.xlsx Binary files differnew file mode 100644 index 0000000..25bc056 --- /dev/null +++ b/Client/Source/Phy2D/Documents/UnityPhysics2D.xlsx diff --git a/Client/Source/Phy2D/Math/Mat22.cpp b/Client/Source/Phy2D/Math/Mat22.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Client/Source/Phy2D/Math/Mat22.cpp diff --git a/Client/Source/Phy2D/Math/Mat22.h b/Client/Source/Phy2D/Math/Mat22.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Client/Source/Phy2D/Math/Mat22.h diff --git a/Client/Source/Phy2D/Math/Mat33.cpp b/Client/Source/Phy2D/Math/Mat33.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Client/Source/Phy2D/Math/Mat33.cpp diff --git a/Client/Source/Phy2D/Math/Mat33.h b/Client/Source/Phy2D/Math/Mat33.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Client/Source/Phy2D/Math/Mat33.h diff --git a/Client/Source/Phy2D/Math/Vec2.cpp b/Client/Source/Phy2D/Math/Vec2.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Client/Source/Phy2D/Math/Vec2.cpp diff --git a/Client/Source/Phy2D/Math/Vec2.h b/Client/Source/Phy2D/Math/Vec2.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Client/Source/Phy2D/Math/Vec2.h diff --git a/Client/Source/Phy2D/Phy2D.h b/Client/Source/Phy2D/Phy2D.h index 0fc0011..2f41e80 100644 --- a/Client/Source/Phy2D/Phy2D.h +++ b/Client/Source/Phy2D/Phy2D.h @@ -1,4 +1,5 @@ #pragma once
-
// 定点数的物理引擎
+
+
|