tf2
master
tf2 maintains the relationship between coordinate frames in a tree structure buffered in time, and lets the user transform points, vectors, etc between any two coordinate frames at any desired point in time.
|
Go to the documentation of this file.
20 #ifdef TF2_MANAGED_CODE
32 #if defined(DEBUG) || defined (_DEBUG)
39 #if defined(__MINGW32__) || defined(__CYGWIN__) || (defined (_MSC_VER) && _MSC_VER < 1300)
41 #define TF2SIMD_FORCE_INLINE inline
42 #define ATTRIBUTE_ALIGNED16(a) a
43 #define ATTRIBUTE_ALIGNED64(a) a
44 #define ATTRIBUTE_ALIGNED128(a) a
47 #pragma warning(disable : 4324) // disable padding warning
52 #define TF2SIMD_FORCE_INLINE __forceinline
53 #define ATTRIBUTE_ALIGNED16(a) __declspec(align(16)) a
54 #define ATTRIBUTE_ALIGNED64(a) __declspec(align(64)) a
55 #define ATTRIBUTE_ALIGNED128(a) __declspec (align(128)) a
57 #define TF2_USE_VMX128
59 #include <ppcintrinsics.h>
60 #define TF2_HAVE_NATIVE_FSEL
61 #define tf2Fsel(a,b,c) __fsel((a),(b),(c))
71 #define tf2Assert assert
76 #define tf2FullAssert(x)
78 #define tf2Likely(_c) _c
79 #define tf2Unlikely(_c) _c
83 #if defined (__CELLOS_LV2__)
84 #define TF2SIMD_FORCE_INLINE inline
85 #define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16)))
86 #define ATTRIBUTE_ALIGNED64(a) a __attribute__ ((aligned (64)))
87 #define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (128)))
92 #define tf2Assert assert
97 #define tf2FullAssert(x)
99 #define tf2Likely(_c) _c
100 #define tf2Unlikely(_c) _c
106 #define TF2SIMD_FORCE_INLINE __inline
107 #define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16)))
108 #define ATTRIBUTE_ALIGNED64(a) a __attribute__ ((aligned (64)))
109 #define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (128)))
114 #define tf2Assert assert
119 #define tf2FullAssert(x)
122 #define tf2Likely(_c) __builtin_expect((_c), 1)
123 #define tf2Unlikely(_c) __builtin_expect((_c), 0)
129 #define TF2SIMD_FORCE_INLINE inline
130 #define ATTRIBUTE_ALIGNED16(a) a
135 #define ATTRIBUTE_ALIGNED64(a) a
136 #define ATTRIBUTE_ALIGNED128(a) a
141 #if defined(DEBUG) || defined (_DEBUG)
142 #define tf2Assert assert
148 #define tf2FullAssert(x)
149 #define tf2Likely(_c) _c
150 #define tf2Unlikely(_c) _c
154 #endif //__CELLOS_LV2__
161 #define TF2_LARGE_FLOAT 1e30
164 #define TF2_DECLARE_ALIGNED_ALLOCATOR() \
165 TF2SIMD_FORCE_INLINE void* operator new(size_t sizeInBytes) { return tf2AlignedAlloc(sizeInBytes,16); } \
166 TF2SIMD_FORCE_INLINE void operator delete(void* ptr) { tf2AlignedFree(ptr); } \
167 TF2SIMD_FORCE_INLINE void* operator new(size_t, void* ptr) { return ptr; } \
168 TF2SIMD_FORCE_INLINE void operator delete(void*, void*) { } \
169 TF2SIMD_FORCE_INLINE void* operator new[](size_t sizeInBytes) { return tf2AlignedAlloc(sizeInBytes,16); } \
170 TF2SIMD_FORCE_INLINE void operator delete[](void* ptr) { tf2AlignedFree(ptr); } \
171 TF2SIMD_FORCE_INLINE void* operator new[](size_t, void* ptr) { return ptr; } \
172 TF2SIMD_FORCE_INLINE void operator delete[](void*, void*) { } \
192 #define TF2SIMD_2_PI tf2Scalar(6.283185307179586232)
193 #define TF2SIMD_PI (TF2SIMD_2_PI * tf2Scalar(0.5))
194 #define TF2SIMD_HALF_PI (TF2SIMD_2_PI * tf2Scalar(0.25))
195 #define TF2SIMD_RADS_PER_DEG (TF2SIMD_2_PI / tf2Scalar(360.0))
196 #define TF2SIMD_DEGS_PER_RAD (tf2Scalar(360.0) / TF2SIMD_2_PI)
197 #define TF2SIMDSQRT12 tf2Scalar(0.7071067811865475244008443621048490)
199 #define tf2RecipSqrt(x) ((tf2Scalar)(tf2Scalar(1.0)/tf2Sqrt(tf2Scalar(x))))
202 #define TF2SIMD_EPSILON DBL_EPSILON
203 #define TF2SIMD_INFINITY DBL_MAX
213 angle = coeff_1 - coeff_1 * r;
216 angle = coeff_2 - coeff_1 * r;
224 return (((a) <= eps) && !((a) < -eps));
227 return (!((a) <= eps));
238 #define TF2_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name
243 return a >= 0 ? b : c;
246 #define tf2Fsels(a,b,c) (tf2Scalar)tf2Fsel(a,b,c)
252 const char *p = (
const char *) &i;
269 unsigned testNz = (unsigned)(((
int)condition | -(
int)condition) >> 31);
270 unsigned testEqz = ~testNz;
271 return ((valueIfConditionNonZero & testNz) | (valueIfConditionZero & testEqz));
275 unsigned testNz = (unsigned)(((
int)condition | -(
int)condition) >> 31);
276 unsigned testEqz = ~testNz;
277 return static_cast<int>((valueIfConditionNonZero & testNz) | (valueIfConditionZero & testEqz));
281 #ifdef TF2_HAVE_NATIVE_FSEL
284 return (condition != 0) ? valueIfConditionNonZero : valueIfConditionZero;
299 return (((val & 0xff000000) >> 24) | ((val & 0x00ff0000) >> 8) | ((val & 0x0000ff00) << 8) | ((val & 0x000000ff) << 24));
304 return static_cast<unsigned short>(((val & 0xff00) >> 8) | ((val & 0x00ff) << 8));
326 unsigned char *dst = (
unsigned char *)&a;
327 unsigned char *src = (
unsigned char *)&d;
340 unsigned char *src = (
unsigned char *)&a;
341 unsigned char *dst = (
unsigned char *)&d;
355 unsigned char *src = (
unsigned char *)&d;
372 unsigned char *dst = (
unsigned char *)&d;
400 return angleInRadians;
417 #endif //TF2SIMD___SCALAR_H
TF2SIMD_FORCE_INLINE tf2Scalar tf2Asin(tf2Scalar x)
Definition: Scalar.h:183
TF2SIMD_FORCE_INLINE tf2Scalar tf2Atan2(tf2Scalar x, tf2Scalar y)
Definition: Scalar.h:185
#define TF2SIMD_2_PI
Definition: Scalar.h:192
TF2SIMD_FORCE_INLINE bool tf2MachineIsLittleEndian()
Definition: Scalar.h:249
#define TF2SIMD_EPSILON
Definition: Scalar.h:202
TF2SIMD_FORCE_INLINE tf2Scalar tf2Radians(tf2Scalar x)
Definition: Scalar.h:235
TF2SIMD_FORCE_INLINE bool tf2Equal(tf2Scalar a, tf2Scalar eps)
Definition: Scalar.h:223
TF2SIMD_FORCE_INLINE unsigned tf2SwapEndian(unsigned val)
Definition: Scalar.h:297
TF2SIMD_FORCE_INLINE tf2Scalar tf2Sin(tf2Scalar x)
Definition: Scalar.h:180
TF2SIMD_FORCE_INLINE tf2Scalar tf2Fmod(tf2Scalar x, tf2Scalar y)
Definition: Scalar.h:189
TF2SIMD_FORCE_INLINE void tf2Swap(T &a, T &b)
Definition: Scalar.h:288
TF2SIMD_FORCE_INLINE tf2Scalar tf2Sqrt(tf2Scalar x)
Definition: Scalar.h:177
#define TF2SIMD_RADS_PER_DEG
Definition: Scalar.h:195
TF2SIMD_FORCE_INLINE tf2Scalar tf2Degrees(tf2Scalar x)
Definition: Scalar.h:236
TF2SIMD_FORCE_INLINE tf2Scalar tf2Acos(tf2Scalar x)
Definition: Scalar.h:182
TF2SIMD_FORCE_INLINE float tf2UnswapEndianFloat(unsigned int a)
Definition: Scalar.h:337
TF2SIMD_FORCE_INLINE tf2Scalar tf2NormalizeAngle(tf2Scalar angleInRadians)
Definition: Scalar.h:387
TF2SIMD_FORCE_INLINE double tf2UnswapEndianDouble(const unsigned char *src)
Definition: Scalar.h:369
#define TF2SIMD_FORCE_INLINE
Definition: Scalar.h:129
int getObjectType() const
Definition: Scalar.h:412
TF2SIMD_FORCE_INLINE unsigned tf2Select(unsigned condition, unsigned valueIfConditionNonZero, unsigned valueIfConditionZero)
Definition: Scalar.h:263
TF2SIMD_FORCE_INLINE bool tf2FuzzyZero(tf2Scalar x)
Definition: Scalar.h:221
TF2SIMD_FORCE_INLINE tf2Scalar tf2Atan(tf2Scalar x)
Definition: Scalar.h:184
tf2TypedObject(int objectType)
Definition: Scalar.h:407
TF2SIMD_FORCE_INLINE tf2Scalar tf2Tan(tf2Scalar x)
Definition: Scalar.h:181
TF2SIMD_FORCE_INLINE tf2Scalar tf2Cos(tf2Scalar x)
Definition: Scalar.h:179
TF2SIMD_FORCE_INLINE tf2Scalar tf2Atan2Fast(tf2Scalar y, tf2Scalar x)
Definition: Scalar.h:205
TF2SIMD_FORCE_INLINE tf2Scalar tf2Fsel(tf2Scalar a, tf2Scalar b, tf2Scalar c)
Definition: Scalar.h:241
TF2SIMD_FORCE_INLINE unsigned int tf2SwapEndianFloat(float d)
tf2SwapFloat uses using char pointers to swap the endianness
Definition: Scalar.h:323
TF2SIMD_FORCE_INLINE void tf2SwapEndianDouble(double d, unsigned char *dst)
Definition: Scalar.h:353
TF2SIMD_FORCE_INLINE tf2Scalar tf2Fabs(tf2Scalar x)
Definition: Scalar.h:178
TF2SIMD_FORCE_INLINE bool tf2GreaterEqual(tf2Scalar a, tf2Scalar eps)
Definition: Scalar.h:226
TF2SIMD_FORCE_INLINE tf2Scalar angle(const Quaternion &q1, const Quaternion &q2)
Return the half angle between two quaternions.
Definition: Quaternion.h:410
TF2SIMD_FORCE_INLINE tf2Scalar tf2Log(tf2Scalar x)
Definition: Scalar.h:187
rudimentary class to provide type info
Definition: Scalar.h:405
double tf2Scalar
The tf2Scalar type abstracts floating point numbers, to easily switch between double and single float...
Definition: Scalar.h:159
#define TF2SIMD_PI
Definition: Scalar.h:193
#define TF2SIMD_DEGS_PER_RAD
Definition: Scalar.h:196
TF2SIMD_FORCE_INLINE tf2Scalar tf2Pow(tf2Scalar x, tf2Scalar y)
Definition: Scalar.h:188
TF2SIMD_FORCE_INLINE int tf2IsNegative(tf2Scalar x)
Definition: Scalar.h:231
TF2SIMD_FORCE_INLINE tf2Scalar tf2Exp(tf2Scalar x)
Definition: Scalar.h:186
int m_objectType
Definition: Scalar.h:411