Main Page Class List Class Members

- Main Page
- User's Guide
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

# sdk/extensions/authoring/source/VHACD/inc/btVector3.h

Go to the documentation of this file.

    00001 /*
    00002 Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans  http://continuousphysics.com/Bullet/
    00003
    00004 This software is provided 'as-is', without any express or implied warranty.
    00005 In no event will the authors be held liable for any damages arising from the use of this software.
    00006 Permission is granted to anyone to use this software for any purpose,
    00007 including commercial applications, and to alter it and redistribute it freely,
    00008 subject to the following restrictions:
    00009
    00010 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
    00011 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
    00012 3. This notice may not be removed or altered from any source distribution.
    00013 */
    00014
    00015 #ifndef BT_VECTOR3_H
    00016 #define BT_VECTOR3_H
    00017
    00018 #include "btMinMax.h"
    00019 #include "btScalar.h"
    00020
    00021 #ifdef BT_USE_DOUBLE_PRECISION
    00022 #define btVector3Data btVector3DoubleData
    00023 #define btVector3DataName "btVector3DoubleData"
    00024 #else
    00025 #define btVector3Data btVector3FloatData
    00026 #define btVector3DataName "btVector3FloatData"
    00027 #endif //BT_USE_DOUBLE_PRECISION
    00028
    00033 ATTRIBUTE_ALIGNED16(class)
    00034 btVector3
    00035 {
    00036 public:
    00037 #if defined(__SPU__) && defined(__CELLOS_LV2__)
    00038     btScalar m_floats[4];
    00039
    00040 public:
    00041     SIMD_FORCE_INLINE const vec_float4& get128() const
    00042     {
    00043         return *((const vec_float4*)&m_floats[0]);
    00044     }
    00045
    00046 public:
    00047 #else //__CELLOS_LV2__ __SPU__
    00048 #ifdef BT_USE_SSE // _WIN32
    00049     union {
    00050         __m128 mVec128;
    00051         btScalar m_floats[4];
    00052     };
    00053     SIMD_FORCE_INLINE __m128 get128() const
    00054     {
    00055         return mVec128;
    00056     }
    00057     SIMD_FORCE_INLINE void set128(__m128 v128)
    00058     {
    00059         mVec128 = v128;
    00060     }
    00061 #else
    00062     btScalar m_floats[4];
    00063 #endif
    00064 #endif //__CELLOS_LV2__ __SPU__
    00065
    00066 public:
    00068     SIMD_FORCE_INLINE btVector3() {}
    00069
    00075     SIMD_FORCE_INLINE btVector3(const btScalar& x, const btScalar& y, const btScalar& z)
    00076     {
    00077         m_floats[0] = x;
    00078         m_floats[1] = y;
    00079         m_floats[2] = z;
    00080         m_floats[3] = btScalar(0.);
    00081     }
    00082
    00085     SIMD_FORCE_INLINE btVector3& operator+=(const btVector3& v)
    00086     {
    00087
    00088         m_floats[0] += v.m_floats[0];
    00089         m_floats[1] += v.m_floats[1];
    00090         m_floats[2] += v.m_floats[2];
    00091         return *this;
    00092     }
    00093
    00096     SIMD_FORCE_INLINE btVector3& operator-=(const btVector3& v)
    00097     {
    00098         m_floats[0] -= v.m_floats[0];
    00099         m_floats[1] -= v.m_floats[1];
    00100         m_floats[2] -= v.m_floats[2];
    00101         return *this;
    00102     }
    00105     SIMD_FORCE_INLINE btVector3& operator*=(const btScalar& s)
    00106     {
    00107         m_floats[0] *= s;
    00108         m_floats[1] *= s;
    00109         m_floats[2] *= s;
    00110         return *this;
    00111     }
    00112
    00115     SIMD_FORCE_INLINE btVector3& operator/=(const btScalar& s)
    00116     {
    00117         btFullAssert(s != btScalar(0.0));
    00118         return * this *= btScalar(1.0) / s;
    00119     }
    00120
    00123     SIMD_FORCE_INLINE btScalar dot(const btVector3& v) const
    00124     {
    00125         return m_floats[0] * v.m_floats[0] + m_floats[1] * v.m_floats[1] + m_floats[2] * v.m_floats[2];
    00126     }
    00127
    00129     SIMD_FORCE_INLINE btScalar length2() const
    00130     {
    00131         return dot(*this);
    00132     }
    00133
    00135     SIMD_FORCE_INLINE btScalar length() const
    00136     {
    00137         return btSqrt(length2());
    00138     }
    00139
    00142     SIMD_FORCE_INLINE btScalar distance2(const btVector3& v) const;
    00143
    00146     SIMD_FORCE_INLINE btScalar distance(const btVector3& v) const;
    00147
    00148     SIMD_FORCE_INLINE btVector3& safeNormalize()
    00149     {
    00150         btVector3 absVec = this->absolute();
    00151         int32_t maxIndex = absVec.maxAxis();
    00152         if (absVec[maxIndex] > 0) {
    00153             *this /= absVec[maxIndex];
    00154             return * this /= length();
    00155         }
    00156         setValue(1, 0, 0);
    00157         return *this;
    00158     }
    00159
    00162     SIMD_FORCE_INLINE btVector3& normalize()
    00163     {
    00164         return * this /= length();
    00165     }
    00166
    00168     SIMD_FORCE_INLINE btVector3 normalized() const;
    00169
    00173     SIMD_FORCE_INLINE btVector3 rotate(const btVector3& wAxis, const btScalar angle) const;
    00174
    00177     SIMD_FORCE_INLINE btScalar angle(const btVector3& v) const
    00178     {
    00179         btScalar s = btSqrt(length2() * v.length2());
    00180         btFullAssert(s != btScalar(0.0));
    00181         return btAcos(dot(v) / s);
    00182     }
    00184     SIMD_FORCE_INLINE btVector3 absolute() const
    00185     {
    00186         return btVector3(
    00187             btFabs(m_floats[0]),
    00188             btFabs(m_floats[1]),
    00189             btFabs(m_floats[2]));
    00190     }
    00193     SIMD_FORCE_INLINE btVector3 cross(const btVector3& v) const
    00194     {
    00195         return btVector3(
    00196             m_floats[1] * v.m_floats[2] - m_floats[2] * v.m_floats[1],
    00197             m_floats[2] * v.m_floats[0] - m_floats[0] * v.m_floats[2],
    00198             m_floats[0] * v.m_floats[1] - m_floats[1] * v.m_floats[0]);
    00199     }
    00200
    00201     SIMD_FORCE_INLINE btScalar triple(const btVector3& v1, const btVector3& v2) const
    00202     {
    00203         return m_floats[0] * (v1.m_floats[1] * v2.m_floats[2] - v1.m_floats[2] * v2.m_floats[1]) + m_floats[1] * (v1.m_floats[2] * v2.m_floats[0] - v1.m_floats[0] * v2.m_floats[2]) + m_floats[2] * (v1.m_floats[0] * v2.m_floats[1] - v1.m_floats[1] * v2.m_floats[0]);
    00204     }
    00205
    00208     SIMD_FORCE_INLINE int32_t minAxis() const
    00209     {
    00210         return m_floats[0] < m_floats[1] ? (m_floats[0] < m_floats[2] ? 0 : 2) : (m_floats[1] < m_floats[2] ? 1 : 2);
    00211     }
    00212
    00215     SIMD_FORCE_INLINE int32_t maxAxis() const
    00216     {
    00217         return m_floats[0] < m_floats[1] ? (m_floats[1] < m_floats[2] ? 2 : 1) : (m_floats[0] < m_floats[2] ? 2 : 0);
    00218     }
    00219
    00220     SIMD_FORCE_INLINE int32_t furthestAxis() const
    00221     {
    00222         return absolute().minAxis();
    00223     }
    00224
    00225     SIMD_FORCE_INLINE int32_t closestAxis() const
    00226     {
    00227         return absolute().maxAxis();
    00228     }
    00229
    00230     SIMD_FORCE_INLINE void setInterpolate3(const btVector3& v0, const btVector3& v1, btScalar rt)
    00231     {
    00232         btScalar s = btScalar(1.0) - rt;
    00233         m_floats[0] = s * v0.m_floats[0] + rt * v1.m_floats[0];
    00234         m_floats[1] = s * v0.m_floats[1] + rt * v1.m_floats[1];
    00235         m_floats[2] = s * v0.m_floats[2] + rt * v1.m_floats[2];
    00236         //don't do the unused w component
    00237         //      m_co[3] = s * v0[3] + rt * v1[3];
    00238     }
    00239
    00243     SIMD_FORCE_INLINE btVector3 lerp(const btVector3& v, const btScalar& t) const
    00244     {
    00245         return btVector3(m_floats[0] + (v.m_floats[0] - m_floats[0]) * t,
    00246             m_floats[1] + (v.m_floats[1] - m_floats[1]) * t,
    00247             m_floats[2] + (v.m_floats[2] - m_floats[2]) * t);
    00248     }
    00249
    00252     SIMD_FORCE_INLINE btVector3& operator*=(const btVector3& v)
    00253     {
    00254         m_floats[0] *= v.m_floats[0];
    00255         m_floats[1] *= v.m_floats[1];
    00256         m_floats[2] *= v.m_floats[2];
    00257         return *this;
    00258     }
    00259
    00261     SIMD_FORCE_INLINE const btScalar& getX() const { return m_floats[0]; }
    00263     SIMD_FORCE_INLINE const btScalar& getY() const { return m_floats[1]; }
    00265     SIMD_FORCE_INLINE const btScalar& getZ() const { return m_floats[2]; }
    00267     SIMD_FORCE_INLINE void setX(btScalar x) { m_floats[0] = x; };
    00269     SIMD_FORCE_INLINE void setY(btScalar y) { m_floats[1] = y; };
    00271     SIMD_FORCE_INLINE void setZ(btScalar z) { m_floats[2] = z; };
    00273     SIMD_FORCE_INLINE void setW(btScalar w) { m_floats[3] = w; };
    00275     SIMD_FORCE_INLINE const btScalar& x() const { return m_floats[0]; }
    00277     SIMD_FORCE_INLINE const btScalar& y() const { return m_floats[1]; }
    00279     SIMD_FORCE_INLINE const btScalar& z() const { return m_floats[2]; }
    00281     SIMD_FORCE_INLINE const btScalar& w() const { return m_floats[3]; }
    00282
    00283     //SIMD_FORCE_INLINE btScalar&       operator[](int32_t i)       { return (&m_floats[0])[i]; }
    00284     //SIMD_FORCE_INLINE const btScalar& operator[](int32_t i) const { return (&m_floats[0])[i]; }
    00286     SIMD_FORCE_INLINE operator btScalar*() { return &m_floats[0]; }
    00287     SIMD_FORCE_INLINE operator const btScalar*() const { return &m_floats[0]; }
    00288
    00289     SIMD_FORCE_INLINE bool operator==(const btVector3& other) const
    00290     {
    00291         return ((m_floats[3] == other.m_floats[3]) && (m_floats[2] == other.m_floats[2]) && (m_floats[1] == other.m_floats[1]) && (m_floats[0] == other.m_floats[0]));
    00292     }
    00293
    00294     SIMD_FORCE_INLINE bool operator!=(const btVector3& other) const
    00295     {
    00296         return !(*this == other);
    00297     }
    00298
    00302     SIMD_FORCE_INLINE void setMax(const btVector3& other)
    00303     {
    00304         btSetMax(m_floats[0], other.m_floats[0]);
    00305         btSetMax(m_floats[1], other.m_floats[1]);
    00306         btSetMax(m_floats[2], other.m_floats[2]);
    00307         btSetMax(m_floats[3], other.w());
    00308     }
    00312     SIMD_FORCE_INLINE void setMin(const btVector3& other)
    00313     {
    00314         btSetMin(m_floats[0], other.m_floats[0]);
    00315         btSetMin(m_floats[1], other.m_floats[1]);
    00316         btSetMin(m_floats[2], other.m_floats[2]);
    00317         btSetMin(m_floats[3], other.w());
    00318     }
    00319
    00320     SIMD_FORCE_INLINE void setValue(const btScalar& x, const btScalar& y, const btScalar& z)
    00321     {
    00322         m_floats[0] = x;
    00323         m_floats[1] = y;
    00324         m_floats[2] = z;
    00325         m_floats[3] = btScalar(0.);
    00326     }
    00327
    00328     void getSkewSymmetricMatrix(btVector3 * v0, btVector3 * v1, btVector3 * v2) const
    00329     {
    00330         v0->setValue(0., -z(), y());
    00331         v1->setValue(z(), 0., -x());
    00332         v2->setValue(-y(), x(), 0.);
    00333     }
    00334
    00335     void setZero()
    00336     {
    00337         setValue(btScalar(0.), btScalar(0.), btScalar(0.));
    00338     }
    00339
    00340     SIMD_FORCE_INLINE bool isZero() const
    00341     {
    00342         return m_floats[0] == btScalar(0) && m_floats[1] == btScalar(0) && m_floats[2] == btScalar(0);
    00343     }
    00344
    00345     SIMD_FORCE_INLINE bool fuzzyZero() const
    00346     {
    00347         return length2() < SIMD_EPSILON;
    00348     }
    00349
    00350     SIMD_FORCE_INLINE void serialize(struct btVector3Data & dataOut) const;
    00351
    00352     SIMD_FORCE_INLINE void deSerialize(const struct btVector3Data& dataIn);
    00353
    00354     SIMD_FORCE_INLINE void serializeFloat(struct btVector3FloatData & dataOut) const;
    00355
    00356     SIMD_FORCE_INLINE void deSerializeFloat(const struct btVector3FloatData& dataIn);
    00357
    00358     SIMD_FORCE_INLINE void serializeDouble(struct btVector3DoubleData & dataOut) const;
    00359
    00360     SIMD_FORCE_INLINE void deSerializeDouble(const struct btVector3DoubleData& dataIn);
    00361 };
    00362
    00364 SIMD_FORCE_INLINE btVector3
    00365 operator+(const btVector3& v1, const btVector3& v2)
    00366 {
    00367     return btVector3(v1.m_floats[0] + v2.m_floats[0], v1.m_floats[1] + v2.m_floats[1], v1.m_floats[2] + v2.m_floats[2]);
    00368 }
    00369
    00371 SIMD_FORCE_INLINE btVector3
    00372 operator*(const btVector3& v1, const btVector3& v2)
    00373 {
    00374     return btVector3(v1.m_floats[0] * v2.m_floats[0], v1.m_floats[1] * v2.m_floats[1], v1.m_floats[2] * v2.m_floats[2]);
    00375 }
    00376
    00378 SIMD_FORCE_INLINE btVector3
    00379 operator-(const btVector3& v1, const btVector3& v2)
    00380 {
    00381     return btVector3(v1.m_floats[0] - v2.m_floats[0], v1.m_floats[1] - v2.m_floats[1], v1.m_floats[2] - v2.m_floats[2]);
    00382 }
    00384 SIMD_FORCE_INLINE btVector3
    00385 operator-(const btVector3& v)
    00386 {
    00387     return btVector3(-v.m_floats[0], -v.m_floats[1], -v.m_floats[2]);
    00388 }
    00389
    00391 SIMD_FORCE_INLINE btVector3
    00392 operator*(const btVector3& v, const btScalar& s)
    00393 {
    00394     return btVector3(v.m_floats[0] * s, v.m_floats[1] * s, v.m_floats[2] * s);
    00395 }
    00396
    00398 SIMD_FORCE_INLINE btVector3
    00399 operator*(const btScalar& s, const btVector3& v)
    00400 {
    00401     return v * s;
    00402 }
    00403
    00405 SIMD_FORCE_INLINE btVector3
    00406 operator/(const btVector3& v, const btScalar& s)
    00407 {
    00408     btFullAssert(s != btScalar(0.0));
    00409     return v * (btScalar(1.0) / s);
    00410 }
    00411
    00413 SIMD_FORCE_INLINE btVector3
    00414 operator/(const btVector3& v1, const btVector3& v2)
    00415 {
    00416     return btVector3(v1.m_floats[0] / v2.m_floats[0], v1.m_floats[1] / v2.m_floats[1], v1.m_floats[2] / v2.m_floats[2]);
    00417 }
    00418
    00420 SIMD_FORCE_INLINE btScalar
    00421 btDot(const btVector3& v1, const btVector3& v2)
    00422 {
    00423     return v1.dot(v2);
    00424 }
    00425
    00427 SIMD_FORCE_INLINE btScalar
    00428 btDistance2(const btVector3& v1, const btVector3& v2)
    00429 {
    00430     return v1.distance2(v2);
    00431 }
    00432
    00434 SIMD_FORCE_INLINE btScalar
    00435 btDistance(const btVector3& v1, const btVector3& v2)
    00436 {
    00437     return v1.distance(v2);
    00438 }
    00439
    00441 SIMD_FORCE_INLINE btScalar
    00442 btAngle(const btVector3& v1, const btVector3& v2)
    00443 {
    00444     return v1.angle(v2);
    00445 }
    00446
    00448 SIMD_FORCE_INLINE btVector3
    00449 btCross(const btVector3& v1, const btVector3& v2)
    00450 {
    00451     return v1.cross(v2);
    00452 }
    00453
    00454 SIMD_FORCE_INLINE btScalar
    00455 btTriple(const btVector3& v1, const btVector3& v2, const btVector3& v3)
    00456 {
    00457     return v1.triple(v2, v3);
    00458 }
    00459
    00464 SIMD_FORCE_INLINE btVector3
    00465 lerp(const btVector3& v1, const btVector3& v2, const btScalar& t)
    00466 {
    00467     return v1.lerp(v2, t);
    00468 }
    00469
    00470 SIMD_FORCE_INLINE btScalar btVector3::distance2(const btVector3& v) const
    00471 {
    00472     return (v - *this).length2();
    00473 }
    00474
    00475 SIMD_FORCE_INLINE btScalar btVector3::distance(const btVector3& v) const
    00476 {
    00477     return (v - *this).length();
    00478 }
    00479
    00480 SIMD_FORCE_INLINE btVector3 btVector3::normalized() const
    00481 {
    00482     return *this / length();
    00483 }
    00484
    00485 SIMD_FORCE_INLINE btVector3 btVector3::rotate(const btVector3& wAxis, const btScalar angle) const
    00486 {
    00487     // wAxis must be a unit lenght vector
    00488
    00489     btVector3 o = wAxis * wAxis.dot(*this);
    00490     btVector3 x = *this - o;
    00491     btVector3 y;
    00492
    00493     y = wAxis.cross(*this);
    00494
    00495     return (o + x * btCos(angle) + y * btSin(angle));
    00496 }
    00497
    00498 class btVector4 : public btVector3 {
    00499 public:
    00500     SIMD_FORCE_INLINE btVector4() {}
    00501
    00502     SIMD_FORCE_INLINE btVector4(const btScalar& x, const btScalar& y, const btScalar& z, const btScalar& w)
    00503         : btVector3(x, y, z)
    00504     {
    00505         m_floats[3] = w;
    00506     }
    00507
    00508     SIMD_FORCE_INLINE btVector4 absolute4() const
    00509     {
    00510         return btVector4(
    00511             btFabs(m_floats[0]),
    00512             btFabs(m_floats[1]),
    00513             btFabs(m_floats[2]),
    00514             btFabs(m_floats[3]));
    00515     }
    00516
    00517     btScalar getW() const { return m_floats[3]; }
    00518
    00519     SIMD_FORCE_INLINE int32_t maxAxis4() const
    00520     {
    00521         int32_t maxIndex = -1;
    00522         btScalar maxVal = btScalar(-BT_LARGE_FLOAT);
    00523         if (m_floats[0] > maxVal) {
    00524             maxIndex = 0;
    00525             maxVal = m_floats[0];
    00526         }
    00527         if (m_floats[1] > maxVal) {
    00528             maxIndex = 1;
    00529             maxVal = m_floats[1];
    00530         }
    00531         if (m_floats[2] > maxVal) {
    00532             maxIndex = 2;
    00533             maxVal = m_floats[2];
    00534         }
    00535         if (m_floats[3] > maxVal) {
    00536             maxIndex = 3;
    00537         }
    00538         return maxIndex;
    00539     }
    00540
    00541     SIMD_FORCE_INLINE int32_t minAxis4() const
    00542     {
    00543         int32_t minIndex = -1;
    00544         btScalar minVal = btScalar(BT_LARGE_FLOAT);
    00545         if (m_floats[0] < minVal) {
    00546             minIndex = 0;
    00547             minVal = m_floats[0];
    00548         }
    00549         if (m_floats[1] < minVal) {
    00550             minIndex = 1;
    00551             minVal = m_floats[1];
    00552         }
    00553         if (m_floats[2] < minVal) {
    00554             minIndex = 2;
    00555             minVal = m_floats[2];
    00556         }
    00557         if (m_floats[3] < minVal) {
    00558             minIndex = 3;
    00559         }
    00560
    00561         return minIndex;
    00562     }
    00563
    00564     SIMD_FORCE_INLINE int32_t closestAxis4() const
    00565     {
    00566         return absolute4().maxAxis4();
    00567     }
    00568
    00575     /*      void getValue(btScalar *m) const
    00576         {
    00577             m[0] = m_floats[0];
    00578             m[1] = m_floats[1];
    00579             m[2] =m_floats[2];
    00580         }
    00581 */
    00588     SIMD_FORCE_INLINE void setValue(const btScalar& x, const btScalar& y, const btScalar& z, const btScalar& w)
    00589     {
    00590         m_floats[0] = x;
    00591         m_floats[1] = y;
    00592         m_floats[2] = z;
    00593         m_floats[3] = w;
    00594     }
    00595 };
    00596
    00598 SIMD_FORCE_INLINE void btSwapScalarEndian(const btScalar& sourceVal, btScalar& destVal)
    00599 {
    00600 #ifdef BT_USE_DOUBLE_PRECISION
    00601     unsigned char* dest = (unsigned char*)&destVal;
    00602     unsigned char* src = (unsigned char*)&sourceVal;
    00603     dest[0] = src[7];
    00604     dest[1] = src[6];
    00605     dest[2] = src[5];
    00606     dest[3] = src[4];
    00607     dest[4] = src[3];
    00608     dest[5] = src[2];
    00609     dest[6] = src[1];
    00610     dest[7] = src[0];
    00611 #else
    00612     unsigned char* dest = (unsigned char*)&destVal;
    00613     unsigned char* src = (unsigned char*)&sourceVal;
    00614     dest[0] = src[3];
    00615     dest[1] = src[2];
    00616     dest[2] = src[1];
    00617     dest[3] = src[0];
    00618 #endif //BT_USE_DOUBLE_PRECISION
    00619 }
    00621 SIMD_FORCE_INLINE void btSwapVector3Endian(const btVector3& sourceVec, btVector3& destVec)
    00622 {
    00623     for (int32_t i = 0; i < 4; i++) {
    00624         btSwapScalarEndian(sourceVec[i], destVec[i]);
    00625     }
    00626 }
    00627
    00629 SIMD_FORCE_INLINE void btUnSwapVector3Endian(btVector3& vector)
    00630 {
    00631
    00632     btVector3 swappedVec;
    00633     for (int32_t i = 0; i < 4; i++) {
    00634         btSwapScalarEndian(vector[i], swappedVec[i]);
    00635     }
    00636     vector = swappedVec;
    00637 }
    00638
    00639 template <class T>
    00640 SIMD_FORCE_INLINE void btPlaneSpace1(const T& n, T& p, T& q)
    00641 {
    00642     if (btFabs(n[2]) > SIMDSQRT12) {
    00643         // choose p in y-z plane
    00644         btScalar a = n[1] * n[1] + n[2] * n[2];
    00645         btScalar k = btRecipSqrt(a);
    00646         p[0] = 0;
    00647         p[1] = -n[2] * k;
    00648         p[2] = n[1] * k;
    00649         // set q = n x p
    00650         q[0] = a * k;
    00651         q[1] = -n[0] * p[2];
    00652         q[2] = n[0] * p[1];
    00653     }
    00654     else {
    00655         // choose p in x-y plane
    00656         btScalar a = n[0] * n[0] + n[1] * n[1];
    00657         btScalar k = btRecipSqrt(a);
    00658         p[0] = -n[1] * k;
    00659         p[1] = n[0] * k;
    00660         p[2] = 0;
    00661         // set q = n x p
    00662         q[0] = -n[2] * p[1];
    00663         q[1] = n[2] * p[0];
    00664         q[2] = a * k;
    00665     }
    00666 }
    00667
    00668 struct btVector3FloatData {
    00669     float m_floats[4];
    00670 };
    00671
    00672 struct btVector3DoubleData {
    00673     double m_floats[4];
    00674 };
    00675
    00676 SIMD_FORCE_INLINE void btVector3::serializeFloat(struct btVector3FloatData& dataOut) const
    00677 {
    00679     for (int32_t i = 0; i < 4; i++)
    00680         dataOut.m_floats[i] = float(m_floats[i]);
    00681 }
    00682
    00683 SIMD_FORCE_INLINE void btVector3::deSerializeFloat(const struct btVector3FloatData& dataIn)
    00684 {
    00685     for (int32_t i = 0; i < 4; i++)
    00686         m_floats[i] = btScalar(dataIn.m_floats[i]);
    00687 }
    00688
    00689 SIMD_FORCE_INLINE void btVector3::serializeDouble(struct btVector3DoubleData& dataOut) const
    00690 {
    00692     for (int32_t i = 0; i < 4; i++)
    00693         dataOut.m_floats[i] = double(m_floats[i]);
    00694 }
    00695
    00696 SIMD_FORCE_INLINE void btVector3::deSerializeDouble(const struct btVector3DoubleData& dataIn)
    00697 {
    00698     for (int32_t i = 0; i < 4; i++)
    00699         m_floats[i] = btScalar(dataIn.m_floats[i]);
    00700 }
    00701
    00702 SIMD_FORCE_INLINE void btVector3::serialize(struct btVector3Data& dataOut) const
    00703 {
    00705     for (int32_t i = 0; i < 4; i++)
    00706         dataOut.m_floats[i] = m_floats[i];
    00707 }
    00708
    00709 SIMD_FORCE_INLINE void btVector3::deSerialize(const struct btVector3Data& dataIn)
    00710 {
    00711     for (int32_t i = 0; i < 4; i++)
    00712         m_floats[i] = dataIn.m_floats[i];
    00713 }
    00714
    00715 #endif //BT_VECTOR3_H

Copyright © 2015-2017 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com