Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwin Coumans <blender@erwincoumans.com>2009-03-03 06:41:24 +0300
committerErwin Coumans <blender@erwincoumans.com>2009-03-03 06:41:24 +0300
commit982a5cc60dd93b21ce110b3fff831d05720047bf (patch)
tree5d6245b0006f249c48e900b748aedd4484c10da3 /extern/bullet2/src/LinearMath/btQuadWord.h
parentf8ef887880ac217cc831b2ab9677e1f9e825537b (diff)
Upgraded to Bullet 2.74. The upgrade introduced a few bugs, which need to be fixed before Blender 2.49.
In particular, the Bullet vehicle seems broken, and some soft-body demos don't work. No new features or benefits are added yet, but a few improvements are planned before Blender 2.49 release. Please update the build systems, and add those 3 files: extern/bullet2/src/BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.cpp extern/bullet2/src/BulletCollision/CollisionDispatch/btGhostObject.cpp extern/bullet2/src/BulletCollision/CollisionShapes/btConvexPointCloudShape.cpp I'll watch the Blender mailing list, in case this commit causes some issues.
Diffstat (limited to 'extern/bullet2/src/LinearMath/btQuadWord.h')
-rw-r--r--extern/bullet2/src/LinearMath/btQuadWord.h196
1 files changed, 117 insertions, 79 deletions
diff --git a/extern/bullet2/src/LinearMath/btQuadWord.h b/extern/bullet2/src/LinearMath/btQuadWord.h
index 2e80fc2ca47..c657afd2bb1 100644
--- a/extern/bullet2/src/LinearMath/btQuadWord.h
+++ b/extern/bullet2/src/LinearMath/btQuadWord.h
@@ -18,121 +18,159 @@ subject to the following restrictions:
#include "btScalar.h"
#include "btMinMax.h"
-#include <math.h>
+#if defined (__CELLOS_LV2) && defined (__SPU__)
+#include <altivec.h>
+#endif
-///The btQuadWordStorage class is base class for btVector3 and btQuaternion.
-///Some issues under PS3 Linux with IBM 2.1 SDK, gcc compiler prevent from using aligned quadword. todo: look into this
-///ATTRIBUTE_ALIGNED16(class) btQuadWordStorage
-class btQuadWordStorage
+/**@brief The btQuadWord class is base class for btVector3 and btQuaternion.
+ * Some issues under PS3 Linux with IBM 2.1 SDK, gcc compiler prevent from using aligned quadword.
+ */
+#ifndef USE_LIBSPE2
+ATTRIBUTE_ALIGNED16(class) btQuadWord
+#else
+class btQuadWord
+#endif
{
protected:
- btScalar m_x;
- btScalar m_y;
- btScalar m_z;
- btScalar m_unusedW;
-
+#if defined (__SPU__) && defined (__CELLOS_LV2__)
+ union {
+ vec_float4 mVec128;
+ btScalar m_floats[4];
+ };
public:
+ vec_float4 get128() const
+ {
+ return mVec128;
+ }
+protected:
+#else //__CELLOS_LV2__ __SPU__
+ btScalar m_floats[4];
+#endif //__CELLOS_LV2__ __SPU__
-};
-
-
-///btQuadWord is base-class for vectors, points
-class btQuadWord : public btQuadWordStorage
-{
public:
-
-// SIMD_FORCE_INLINE btScalar& operator[](int i) { return (&m_x)[i]; }
-// SIMD_FORCE_INLINE const btScalar& operator[](int i) const { return (&m_x)[i]; }
-
- SIMD_FORCE_INLINE const btScalar& getX() const { return m_x; }
-
- SIMD_FORCE_INLINE const btScalar& getY() const { return m_y; }
-
- SIMD_FORCE_INLINE const btScalar& getZ() const { return m_z; }
-
- SIMD_FORCE_INLINE void setX(btScalar x) { m_x = x;};
-
- SIMD_FORCE_INLINE void setY(btScalar y) { m_y = y;};
-
- SIMD_FORCE_INLINE void setZ(btScalar z) { m_z = z;};
-
- SIMD_FORCE_INLINE void setW(btScalar w) { m_unusedW = w;};
-
- SIMD_FORCE_INLINE const btScalar& x() const { return m_x; }
-
- SIMD_FORCE_INLINE const btScalar& y() const { return m_y; }
-
- SIMD_FORCE_INLINE const btScalar& z() const { return m_z; }
-
- SIMD_FORCE_INLINE const btScalar& w() const { return m_unusedW; }
-
-
- SIMD_FORCE_INLINE operator btScalar *() { return &m_x; }
- SIMD_FORCE_INLINE operator const btScalar *() const { return &m_x; }
-
-
-
+
+
+ /**@brief Return the x value */
+ SIMD_FORCE_INLINE const btScalar& getX() const { return m_floats[0]; }
+ /**@brief Return the y value */
+ SIMD_FORCE_INLINE const btScalar& getY() const { return m_floats[1]; }
+ /**@brief Return the z value */
+ SIMD_FORCE_INLINE const btScalar& getZ() const { return m_floats[2]; }
+ /**@brief Set the x value */
+ SIMD_FORCE_INLINE void setX(btScalar x) { m_floats[0] = x;};
+ /**@brief Set the y value */
+ SIMD_FORCE_INLINE void setY(btScalar y) { m_floats[1] = y;};
+ /**@brief Set the z value */
+ SIMD_FORCE_INLINE void setZ(btScalar z) { m_floats[2] = z;};
+ /**@brief Set the w value */
+ SIMD_FORCE_INLINE void setW(btScalar w) { m_floats[3] = w;};
+ /**@brief Return the x value */
+ SIMD_FORCE_INLINE const btScalar& x() const { return m_floats[0]; }
+ /**@brief Return the y value */
+ SIMD_FORCE_INLINE const btScalar& y() const { return m_floats[1]; }
+ /**@brief Return the z value */
+ SIMD_FORCE_INLINE const btScalar& z() const { return m_floats[2]; }
+ /**@brief Return the w value */
+ SIMD_FORCE_INLINE const btScalar& w() const { return m_floats[3]; }
+
+ //SIMD_FORCE_INLINE btScalar& operator[](int i) { return (&m_floats[0])[i]; }
+ //SIMD_FORCE_INLINE const btScalar& operator[](int i) const { return (&m_floats[0])[i]; }
+ ///operator btScalar*() replaces operator[], using implicit conversion. We added operator != and operator == to avoid pointer comparisons.
+ SIMD_FORCE_INLINE operator btScalar *() { return &m_floats[0]; }
+ SIMD_FORCE_INLINE operator const btScalar *() const { return &m_floats[0]; }
+
+ SIMD_FORCE_INLINE bool operator==(const btQuadWord& other) const
+ {
+ 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]));
+ }
+
+ SIMD_FORCE_INLINE bool operator!=(const btQuadWord& other) const
+ {
+ return !(*this == other);
+ }
+
+ /**@brief Set x,y,z and zero w
+ * @param x Value of x
+ * @param y Value of y
+ * @param z Value of z
+ */
SIMD_FORCE_INLINE void setValue(const btScalar& x, const btScalar& y, const btScalar& z)
{
- m_x=x;
- m_y=y;
- m_z=z;
- m_unusedW = 0.f;
+ m_floats[0]=x;
+ m_floats[1]=y;
+ m_floats[2]=z;
+ m_floats[3] = 0.f;
}
/* void getValue(btScalar *m) const
{
- m[0] = m_x;
- m[1] = m_y;
- m[2] = m_z;
+ m[0] = m_floats[0];
+ m[1] = m_floats[1];
+ m[2] = m_floats[2];
}
*/
+/**@brief Set the values
+ * @param x Value of x
+ * @param y Value of y
+ * @param z Value of z
+ * @param w Value of w
+ */
SIMD_FORCE_INLINE void setValue(const btScalar& x, const btScalar& y, const btScalar& z,const btScalar& w)
{
- m_x=x;
- m_y=y;
- m_z=z;
- m_unusedW=w;
+ m_floats[0]=x;
+ m_floats[1]=y;
+ m_floats[2]=z;
+ m_floats[3]=w;
}
-
+ /**@brief No initialization constructor */
SIMD_FORCE_INLINE btQuadWord()
- // :m_x(btScalar(0.)),m_y(btScalar(0.)),m_z(btScalar(0.)),m_unusedW(btScalar(0.))
- {
- }
-
- SIMD_FORCE_INLINE btQuadWord(const btQuadWordStorage& q)
+ // :m_floats[0](btScalar(0.)),m_floats[1](btScalar(0.)),m_floats[2](btScalar(0.)),m_floats[3](btScalar(0.))
{
- *((btQuadWordStorage*)this) = q;
}
-
+
+ /**@brief Three argument constructor (zeros w)
+ * @param x Value of x
+ * @param y Value of y
+ * @param z Value of z
+ */
SIMD_FORCE_INLINE btQuadWord(const btScalar& x, const btScalar& y, const btScalar& z)
{
- m_x = x, m_y = y, m_z = z, m_unusedW = 0.0f;
+ m_floats[0] = x, m_floats[1] = y, m_floats[2] = z, m_floats[3] = 0.0f;
}
+/**@brief Initializing constructor
+ * @param x Value of x
+ * @param y Value of y
+ * @param z Value of z
+ * @param w Value of w
+ */
SIMD_FORCE_INLINE btQuadWord(const btScalar& x, const btScalar& y, const btScalar& z,const btScalar& w)
{
- m_x = x, m_y = y, m_z = z, m_unusedW = w;
+ m_floats[0] = x, m_floats[1] = y, m_floats[2] = z, m_floats[3] = w;
}
-
+ /**@brief Set each element to the max of the current values and the values of another btQuadWord
+ * @param other The other btQuadWord to compare with
+ */
SIMD_FORCE_INLINE void setMax(const btQuadWord& other)
{
- btSetMax(m_x, other.m_x);
- btSetMax(m_y, other.m_y);
- btSetMax(m_z, other.m_z);
- btSetMax(m_unusedW, other.m_unusedW);
+ btSetMax(m_floats[0], other.m_floats[0]);
+ btSetMax(m_floats[1], other.m_floats[1]);
+ btSetMax(m_floats[2], other.m_floats[2]);
+ btSetMax(m_floats[3], other.m_floats[3]);
}
-
+ /**@brief Set each element to the min of the current values and the values of another btQuadWord
+ * @param other The other btQuadWord to compare with
+ */
SIMD_FORCE_INLINE void setMin(const btQuadWord& other)
{
- btSetMin(m_x, other.m_x);
- btSetMin(m_y, other.m_y);
- btSetMin(m_z, other.m_z);
- btSetMin(m_unusedW, other.m_unusedW);
+ btSetMin(m_floats[0], other.m_floats[0]);
+ btSetMin(m_floats[1], other.m_floats[1]);
+ btSetMin(m_floats[2], other.m_floats[2]);
+ btSetMin(m_floats[3], other.m_floats[3]);
}