[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-physics / third-party / bullet3 / src / BulletInverseDynamics / IDConfig.hpp
1 ///@file Configuration for Inverse Dynamics Library,
2 ///       such as choice of linear algebra library and underlying scalar type
3 #ifndef IDCONFIG_HPP_
4 #define IDCONFIG_HPP_
5
6 // If true, enable jacobian calculations.
7 // This adds a 3xN matrix to every body, + 2 3-Vectors.
8 // so it is not advised for large systems if it is not absolutely necessary.
9 // Also, this is not required for standard inverse dynamics calculations.
10 // Will only work with vector math libraries that support 3xN matrices.
11 #define BT_ID_WITH_JACOBIANS
12
13 // If we have a custom configuration, compile without using other parts of bullet.
14 #ifdef BT_CUSTOM_INVERSE_DYNAMICS_CONFIG_H
15 #include <cmath>
16 #define BT_ID_WO_BULLET
17 #define BT_ID_SQRT(x) std::sqrt(x)
18 #define BT_ID_FABS(x) std::fabs(x)
19 #define BT_ID_COS(x) std::cos(x)
20 #define BT_ID_SIN(x) std::sin(x)
21 #define BT_ID_ATAN2(x, y) std::atan2(x, y)
22 #define BT_ID_POW(x, y) std::pow(x, y)
23 #define BT_ID_SNPRINTF snprintf
24 #define BT_ID_PI M_PI
25 #define BT_ID_USE_DOUBLE_PRECISION
26 #else
27 #define BT_ID_SQRT(x) btSqrt(x)
28 #define BT_ID_FABS(x) btFabs(x)
29 #define BT_ID_COS(x) btCos(x)
30 #define BT_ID_SIN(x) btSin(x)
31 #define BT_ID_ATAN2(x, y) btAtan2(x, y)
32 #define BT_ID_POW(x, y) btPow(x, y)
33 #define BT_ID_PI SIMD_PI
34 #ifdef _WIN32
35 #define BT_ID_SNPRINTF _snprintf
36 #else
37 #define BT_ID_SNPRINTF snprintf
38 #endif  //
39 #endif
40 // error messages
41 #include "IDErrorMessages.hpp"
42
43 #ifdef BT_CUSTOM_INVERSE_DYNAMICS_CONFIG_H
44 /*
45 #include "IDConfigEigen.hpp"
46 #include "IDConfigBuiltin.hpp"
47 */
48 #define INVDYN_INCLUDE_HELPER_2(x) #x
49 #define INVDYN_INCLUDE_HELPER(x) INVDYN_INCLUDE_HELPER_2(x)
50 #include INVDYN_INCLUDE_HELPER(BT_CUSTOM_INVERSE_DYNAMICS_CONFIG_H)
51 #ifndef btInverseDynamics
52 #error "custom inverse dynamics config, but no custom namespace defined"
53 #endif
54
55 #define BT_ID_MAX(a, b) std::max(a, b)
56 #define BT_ID_MIN(a, b) std::min(a, b)
57
58 #else
59 #define btInverseDynamics btInverseDynamicsBullet3
60 // Use default configuration with bullet's types
61 // Use the same scalar type as rest of bullet library
62 #include "LinearMath/btScalar.h"
63 typedef btScalar idScalar;
64 #include "LinearMath/btMinMax.h"
65 #define BT_ID_MAX(a, b) btMax(a, b)
66 #define BT_ID_MIN(a, b) btMin(a, b)
67
68 #ifdef BT_USE_DOUBLE_PRECISION
69 #define BT_ID_USE_DOUBLE_PRECISION
70 #endif
71
72 #ifndef BT_USE_INVERSE_DYNAMICS_WITH_BULLET2
73
74 // use bullet types for arrays and array indices
75 #include "Bullet3Common/b3AlignedObjectArray.h"
76 // this is to make it work with C++2003, otherwise we could do this:
77 // template <typename T>
78 // using idArray = b3AlignedObjectArray<T>;
79 template <typename T>
80 struct idArray
81 {
82         typedef b3AlignedObjectArray<T> type;
83 };
84 typedef int idArrayIdx;
85 #define ID_DECLARE_ALIGNED_ALLOCATOR() B3_DECLARE_ALIGNED_ALLOCATOR()
86
87 #else  // BT_USE_INVERSE_DYNAMICS_WITH_BULLET2
88
89 #include "LinearMath/btAlignedObjectArray.h"
90 template <typename T>
91 struct idArray
92 {
93         typedef btAlignedObjectArray<T> type;
94 };
95 typedef int idArrayIdx;
96 #define ID_DECLARE_ALIGNED_ALLOCATOR() BT_DECLARE_ALIGNED_ALLOCATOR()
97
98 #endif  // BT_USE_INVERSE_DYNAMICS_WITH_BULLET2
99
100 // use bullet's allocator functions
101 #define idMalloc btAllocFunc
102 #define idFree btFreeFunc
103
104 #define ID_LINEAR_MATH_USE_BULLET
105 #include "details/IDLinearMathInterface.hpp"
106 #endif
107 #endif