From d8d1b652b61d3e0289daeb8c621d501675f617cf Mon Sep 17 00:00:00 2001 From: Daniele Bartolini Date: Sun, 26 Jan 2025 20:19:47 +0200 Subject: [PATCH] 3rdparty: bullet3: rename m_floats[4] to 'x, y, z, w' in btVector3 and btQuaternion Part-of: #259 --- .../btAxisSweep3Internal.h | 14 +- .../BroadphaseCollision/btDbvt.cpp | 4 +- .../BroadphaseCollision/btDbvt.h | 118 ++++---- .../BroadphaseCollision/btQuantizedBvh.h | 54 ++-- .../btBox2dBox2dCollisionAlgorithm.cpp | 2 +- .../CollisionDispatch/btBoxBoxDetector.cpp | 12 +- .../btConvexConvexAlgorithm.cpp | 4 +- .../btInternalEdgeUtility.cpp | 20 +- .../btSphereBoxCollisionAlgorithm.cpp | 36 +-- .../CollisionShapes/btBox2dShape.cpp | 6 +- .../CollisionShapes/btBox2dShape.h | 64 ++-- .../CollisionShapes/btBoxShape.cpp | 6 +- .../CollisionShapes/btBoxShape.h | 50 ++-- .../btBvhTriangleMeshShape.cpp | 22 +- .../CollisionShapes/btCollisionShape.cpp | 30 +- .../CollisionShapes/btCompoundShape.cpp | 12 +- .../CollisionShapes/btConeShape.h | 12 +- .../CollisionShapes/btConvexHullShape.cpp | 2 +- .../CollisionShapes/btConvexPolyhedron.cpp | 14 +- .../CollisionShapes/btConvexShape.cpp | 22 +- .../CollisionShapes/btCylinderShape.cpp | 6 +- .../CollisionShapes/btCylinderShape.h | 6 +- .../btHeightfieldTerrainShape.cpp | 12 +- .../CollisionShapes/btMiniSDF.cpp | 6 +- .../CollisionShapes/btMinkowskiSumShape.cpp | 6 +- .../CollisionShapes/btMultiSphereShape.cpp | 6 +- .../CollisionShapes/btOptimizedBvh.cpp | 38 +-- .../btPolyhedralConvexShape.cpp | 22 +- .../btScaledBvhTriangleMeshShape.cpp | 26 +- .../CollisionShapes/btSphereShape.h | 6 +- .../btStridingMeshInterface.cpp | 48 +-- .../CollisionShapes/btTriangleMesh.cpp | 6 +- .../btComputeGjkEpaPenetration.h | 6 +- .../NarrowPhaseCollision/btGjkEpa2.cpp | 6 +- .../NarrowPhaseCollision/btGjkEpa3.h | 6 +- .../btGjkPairDetector.cpp | 30 +- .../NarrowPhaseCollision/btMprPenetration.h | 10 +- .../btPersistentManifold.cpp | 12 +- .../btPolyhedralContactClipping.cpp | 12 +- .../btKinematicCharacterController.cpp | 8 +- .../ConstraintSolver/btBatchedConstraints.cpp | 26 +- .../btConeTwistConstraint.cpp | 24 +- .../btGeneric6DofConstraint.h | 8 +- .../btGeneric6DofSpring2Constraint.h | 52 ++-- .../ConstraintSolver/btHingeConstraint.cpp | 26 +- .../ConstraintSolver/btHingeConstraint.h | 12 +- .../btSequentialImpulseConstraintSolver.cpp | 10 +- .../ConstraintSolver/btSolverBody.h | 4 +- .../BulletDynamics/Dynamics/btRigidBody.cpp | 20 +- .../src/BulletDynamics/Dynamics/btRigidBody.h | 12 +- .../Featherstone/btMultiBody.cpp | 94 +++--- .../Featherstone/btMultiBodyDynamicsWorld.cpp | 14 +- .../btMultiBodySphericalJointLimit.cpp | 2 +- .../btReducedDeformableBody.h | 12 +- .../btReducedDeformableBodyHelpers.cpp | 8 +- .../btDefaultSoftBodySolver.cpp | 12 +- .../BulletSoftBody/btDeformableBodySolver.cpp | 6 +- .../btDeformableLagrangianForce.h | 12 +- .../bullet3/src/BulletSoftBody/btSoftBody.cpp | 70 ++--- .../bullet3/src/BulletSoftBody/btSoftBody.h | 6 +- .../btSoftBodyConcaveCollisionAlgorithm.cpp | 2 +- .../src/BulletSoftBody/btSoftBodyHelpers.cpp | 36 +-- .../src/BulletSoftBody/btSoftBodyInternals.h | 64 ++-- .../bullet3/src/BulletSoftBody/btSparseSDF.h | 18 +- 3rdparty/bullet3/src/LinearMath/btAabbUtil2.h | 42 +-- .../bullet3/src/LinearMath/btConvexHull.cpp | 8 +- 3rdparty/bullet3/src/LinearMath/btMatrix3x3.h | 134 ++++----- .../bullet3/src/LinearMath/btQuaternion.h | 230 ++++++++------- 3rdparty/bullet3/src/LinearMath/btTransform.h | 6 +- .../bullet3/src/LinearMath/btTransformUtil.h | 12 +- 3rdparty/bullet3/src/LinearMath/btVector3.h | 274 ++++++++++-------- src/world/physics_world_bullet.cpp | 28 +- 72 files changed, 1054 insertions(+), 1012 deletions(-) diff --git a/3rdparty/bullet3/src/BulletCollision/BroadphaseCollision/btAxisSweep3Internal.h b/3rdparty/bullet3/src/BulletCollision/BroadphaseCollision/btAxisSweep3Internal.h index 62ed38fc5d..e9d8b46e66 100644 --- a/3rdparty/bullet3/src/BulletCollision/BroadphaseCollision/btAxisSweep3Internal.h +++ b/3rdparty/bullet3/src/BulletCollision/BroadphaseCollision/btAxisSweep3Internal.h @@ -180,8 +180,8 @@ class btAxisSweep3Internal : public btBroadphaseInterface { /* printf("btAxisSweep3.h\n"); printf("numHandles = %d, maxHandles = %d\n",m_numHandles,m_maxHandles); - printf("aabbMin=%f,%f,%f,aabbMax=%f,%f,%f\n",m_worldAabbMin.m_floats[0],m_worldAabbMin.m_floats[1],m_worldAabbMin.m_floats[2], - m_worldAabbMax.m_floats[0],m_worldAabbMax.m_floats[1],m_worldAabbMax.m_floats[2]); + printf("aabbMin=%f,%f,%f,aabbMax=%f,%f,%f\n",m_worldAabbMin.x,m_worldAabbMin.y,m_worldAabbMin.z, + m_worldAabbMax.x,m_worldAabbMax.y,m_worldAabbMax.z); */ } }; @@ -320,10 +320,10 @@ void btAxisSweep3Internal::unQuantize(btBroadphaseProxy* proxy, vecInMin[2] = m_pEdges[2][pHandle->m_minEdges[2]].m_pos; vecInMax[2] = m_pEdges[2][pHandle->m_maxEdges[2]].m_pos + 1; - aabbMin.setValue((btScalar)(vecInMin[0]) / (m_quantize.m_floats[0]), (btScalar)(vecInMin[1]) / (m_quantize.m_floats[1]), (btScalar)(vecInMin[2]) / (m_quantize.m_floats[2])); + aabbMin.setValue((btScalar)(vecInMin[0]) / (m_quantize.x), (btScalar)(vecInMin[1]) / (m_quantize.y), (btScalar)(vecInMin[2]) / (m_quantize.z)); aabbMin += m_worldAabbMin; - aabbMax.setValue((btScalar)(vecInMax[0]) / (m_quantize.m_floats[0]), (btScalar)(vecInMax[1]) / (m_quantize.m_floats[1]), (btScalar)(vecInMax[2]) / (m_quantize.m_floats[2])); + aabbMax.setValue((btScalar)(vecInMax[0]) / (m_quantize.x), (btScalar)(vecInMax[1]) / (m_quantize.y), (btScalar)(vecInMax[2]) / (m_quantize.z)); aabbMax += m_worldAabbMin; } @@ -442,9 +442,9 @@ void btAxisSweep3Internal::quantize(BP_FP_INT_TYPE* out, const b clampedPoint.setMax(m_worldAabbMin); clampedPoint.setMin(m_worldAabbMax); btVector3 v = (clampedPoint - m_worldAabbMin) * m_quantize; - out[0] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.m_floats[0] & m_bpHandleMask) | isMax); - out[1] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.m_floats[1] & m_bpHandleMask) | isMax); - out[2] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.m_floats[2] & m_bpHandleMask) | isMax); + out[0] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.x & m_bpHandleMask) | isMax); + out[1] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.y & m_bpHandleMask) | isMax); + out[2] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.z & m_bpHandleMask) | isMax); #else btVector3 v = (point - m_worldAabbMin) * m_quantize; out[0] = (v[0] <= 0) ? (BP_FP_INT_TYPE)isMax : (v[0] >= m_handleSentinel) ? (BP_FP_INT_TYPE)((m_handleSentinel & m_bpHandleMask) | isMax) : (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v[0] & m_bpHandleMask) | isMax); diff --git a/3rdparty/bullet3/src/BulletCollision/BroadphaseCollision/btDbvt.cpp b/3rdparty/bullet3/src/BulletCollision/BroadphaseCollision/btDbvt.cpp index d910758091..0b9fef23dd 100644 --- a/3rdparty/bullet3/src/BulletCollision/BroadphaseCollision/btDbvt.cpp +++ b/3rdparty/bullet3/src/BulletCollision/BroadphaseCollision/btDbvt.cpp @@ -52,8 +52,8 @@ static DBVT_INLINE btDbvtVolume merge(const btDbvtVolume& a, static DBVT_INLINE btScalar size(const btDbvtVolume& a) { const btVector3 edges = a.Lengths(); - return (edges.m_floats[0] * edges.m_floats[1] * edges.m_floats[2] + - edges.m_floats[0] + edges.m_floats[1] + edges.m_floats[2]); + return (edges.x * edges.y * edges.z + + edges.x + edges.y + edges.z); } // diff --git a/3rdparty/bullet3/src/BulletCollision/BroadphaseCollision/btDbvt.h b/3rdparty/bullet3/src/BulletCollision/BroadphaseCollision/btDbvt.h index 38b4bd3f69..d6133d0add 100644 --- a/3rdparty/bullet3/src/BulletCollision/BroadphaseCollision/btDbvt.h +++ b/3rdparty/bullet3/src/BulletCollision/BroadphaseCollision/btDbvt.h @@ -520,29 +520,29 @@ DBVT_INLINE void btDbvtAabbMm::Expand(const btVector3& e) // DBVT_INLINE void btDbvtAabbMm::SignedExpand(const btVector3& e) { - if (e.m_floats[0] > 0) - mx.m_floats[0] = (mx.m_floats[0] + e[0]); + if (e.x > 0) + mx.x = (mx.x + e[0]); else - mi.m_floats[0] = (mi.m_floats[0] + e[0]); - if (e.m_floats[1] > 0) - mx.m_floats[1] = (mx.m_floats[1] + e[1]); + mi.x = (mi.x + e[0]); + if (e.y > 0) + mx.y = (mx.y + e[1]); else - mi.m_floats[1] = (mi.m_floats[1] + e[1]); - if (e.m_floats[2] > 0) - mx.m_floats[2] = (mx.m_floats[2] + e[2]); + mi.y = (mi.y + e[1]); + if (e.z > 0) + mx.z = (mx.z + e[2]); else - mi.m_floats[2] = (mi.m_floats[2] + e[2]); + mi.z = (mi.z + e[2]); } // DBVT_INLINE bool btDbvtAabbMm::Contain(const btDbvtAabbMm& a) const { - return ((mi.m_floats[0] <= a.mi.m_floats[0]) && - (mi.m_floats[1] <= a.mi.m_floats[1]) && - (mi.m_floats[2] <= a.mi.m_floats[2]) && - (mx.m_floats[0] >= a.mx.m_floats[0]) && - (mx.m_floats[1] >= a.mx.m_floats[1]) && - (mx.m_floats[2] >= a.mx.m_floats[2])); + return ((mi.x <= a.mi.x) && + (mi.y <= a.mi.y) && + (mi.z <= a.mi.z) && + (mx.x >= a.mx.x) && + (mx.y >= a.mx.y) && + (mx.z >= a.mx.z)); } // @@ -552,36 +552,36 @@ DBVT_INLINE int btDbvtAabbMm::Classify(const btVector3& n, btScalar o, int s) co switch (s) { case (0 + 0 + 0): - px = btVector3(mi.m_floats[0], mi.m_floats[1], mi.m_floats[2]); - pi = btVector3(mx.m_floats[0], mx.m_floats[1], mx.m_floats[2]); + px = btVector3(mi.x, mi.y, mi.z); + pi = btVector3(mx.x, mx.y, mx.z); break; case (1 + 0 + 0): - px = btVector3(mx.m_floats[0], mi.m_floats[1], mi.m_floats[2]); - pi = btVector3(mi.m_floats[0], mx.m_floats[1], mx.m_floats[2]); + px = btVector3(mx.x, mi.y, mi.z); + pi = btVector3(mi.x, mx.y, mx.z); break; case (0 + 2 + 0): - px = btVector3(mi.m_floats[0], mx.m_floats[1], mi.m_floats[2]); - pi = btVector3(mx.m_floats[0], mi.m_floats[1], mx.m_floats[2]); + px = btVector3(mi.x, mx.y, mi.z); + pi = btVector3(mx.x, mi.y, mx.z); break; case (1 + 2 + 0): - px = btVector3(mx.m_floats[0], mx.m_floats[1], mi.m_floats[2]); - pi = btVector3(mi.m_floats[0], mi.m_floats[1], mx.m_floats[2]); + px = btVector3(mx.x, mx.y, mi.z); + pi = btVector3(mi.x, mi.y, mx.z); break; case (0 + 0 + 4): - px = btVector3(mi.m_floats[0], mi.m_floats[1], mx.m_floats[2]); - pi = btVector3(mx.m_floats[0], mx.m_floats[1], mi.m_floats[2]); + px = btVector3(mi.x, mi.y, mx.z); + pi = btVector3(mx.x, mx.y, mi.z); break; case (1 + 0 + 4): - px = btVector3(mx.m_floats[0], mi.m_floats[1], mx.m_floats[2]); - pi = btVector3(mi.m_floats[0], mx.m_floats[1], mi.m_floats[2]); + px = btVector3(mx.x, mi.y, mx.z); + pi = btVector3(mi.x, mx.y, mi.z); break; case (0 + 2 + 4): - px = btVector3(mi.m_floats[0], mx.m_floats[1], mx.m_floats[2]); - pi = btVector3(mx.m_floats[0], mi.m_floats[1], mi.m_floats[2]); + px = btVector3(mi.x, mx.y, mx.z); + pi = btVector3(mx.x, mi.y, mi.z); break; case (1 + 2 + 4): - px = btVector3(mx.m_floats[0], mx.m_floats[1], mx.m_floats[2]); - pi = btVector3(mi.m_floats[0], mi.m_floats[1], mi.m_floats[2]); + px = btVector3(mx.x, mx.y, mx.z); + pi = btVector3(mi.x, mi.y, mi.z); break; } if ((btDot(n, px) + o) < 0) return (-1); @@ -593,9 +593,9 @@ DBVT_INLINE int btDbvtAabbMm::Classify(const btVector3& n, btScalar o, int s) co DBVT_INLINE btScalar btDbvtAabbMm::ProjectMinimum(const btVector3& v, unsigned signs) const { const btVector3* b[] = {&mx, &mi}; - const btVector3 p(b[(signs >> 0) & 1]->m_floats[0], - b[(signs >> 1) & 1]->m_floats[1], - b[(signs >> 2) & 1]->m_floats[2]); + const btVector3 p(b[(signs >> 0) & 1]->x, + b[(signs >> 1) & 1]->y, + b[(signs >> 2) & 1]->z); return (btDot(p, v)); } @@ -631,12 +631,12 @@ DBVT_INLINE bool Intersect(const btDbvtAabbMm& a, #endif return ((pu[0] | pu[1] | pu[2]) == 0); #else - return ((a.mi.m_floats[0] <= b.mx.m_floats[0]) && - (a.mx.m_floats[0] >= b.mi.m_floats[0]) && - (a.mi.m_floats[1] <= b.mx.m_floats[1]) && - (a.mx.m_floats[1] >= b.mi.m_floats[1]) && - (a.mi.m_floats[2] <= b.mx.m_floats[2]) && - (a.mx.m_floats[2] >= b.mi.m_floats[2])); + return ((a.mi.x <= b.mx.x) && + (a.mx.x >= b.mi.x) && + (a.mi.y <= b.mx.y) && + (a.mx.y >= b.mi.y) && + (a.mi.z <= b.mx.z) && + (a.mx.z >= b.mi.z)); #endif } @@ -644,12 +644,12 @@ DBVT_INLINE bool Intersect(const btDbvtAabbMm& a, DBVT_INLINE bool Intersect(const btDbvtAabbMm& a, const btVector3& b) { - return ((b.m_floats[0] >= a.mi.m_floats[0]) && - (b.m_floats[1] >= a.mi.m_floats[1]) && - (b.m_floats[2] >= a.mi.m_floats[2]) && - (b.m_floats[0] <= a.mx.m_floats[0]) && - (b.m_floats[1] <= a.mx.m_floats[1]) && - (b.m_floats[2] <= a.mx.m_floats[2])); + return ((b.x >= a.mi.x) && + (b.y >= a.mi.y) && + (b.z >= a.mi.z) && + (b.x <= a.mx.x) && + (b.y <= a.mx.y) && + (b.z <= a.mx.z)); } ////////////////////////////////////// @@ -659,7 +659,7 @@ DBVT_INLINE btScalar Proximity(const btDbvtAabbMm& a, const btDbvtAabbMm& b) { const btVector3 d = (a.mi + a.mx) - (b.mi + b.mx); - return (btFabs(d.m_floats[0]) + btFabs(d.m_floats[1]) + btFabs(d.m_floats[2])); + return (btFabs(d.x) + btFabs(d.y) + btFabs(d.z)); } // @@ -774,12 +774,12 @@ DBVT_INLINE void Merge(const btDbvtAabbMm& a, DBVT_INLINE bool NotEqual(const btDbvtAabbMm& a, const btDbvtAabbMm& b) { - return ((a.mi.m_floats[0] != b.mi.m_floats[0]) || - (a.mi.m_floats[1] != b.mi.m_floats[1]) || - (a.mi.m_floats[2] != b.mi.m_floats[2]) || - (a.mx.m_floats[0] != b.mx.m_floats[0]) || - (a.mx.m_floats[1] != b.mx.m_floats[1]) || - (a.mx.m_floats[2] != b.mx.m_floats[2])); + return ((a.mi.x != b.mi.x) || + (a.mi.y != b.mi.y) || + (a.mi.z != b.mi.z) || + (a.mx.x != b.mx.x) || + (a.mx.y != b.mx.y) || + (a.mx.z != b.mx.z)); } // @@ -1362,9 +1362,9 @@ inline void btDbvt::collideKDOP(const btDbvtNode* root, btAssert(count < int(sizeof(signs) / sizeof(signs[0]))); for (int i = 0; i < count; ++i) { - signs[i] = ((normals[i].m_floats[0] >= 0) ? 1 : 0) + - ((normals[i].m_floats[1] >= 0) ? 2 : 0) + - ((normals[i].m_floats[2] >= 0) ? 4 : 0); + signs[i] = ((normals[i].x >= 0) ? 1 : 0) + + ((normals[i].y >= 0) ? 2 : 0) + + ((normals[i].z >= 0) ? 4 : 0); } stack.reserve(SIMPLE_STACKSIZE); stack.push_back(sStkNP(root, 0)); @@ -1429,9 +1429,9 @@ inline void btDbvt::collideOCL(const btDbvtNode* root, btAssert(count < int(sizeof(signs) / sizeof(signs[0]))); for (int i = 0; i < count; ++i) { - signs[i] = ((normals[i].m_floats[0] >= 0) ? 1 : 0) + - ((normals[i].m_floats[1] >= 0) ? 2 : 0) + - ((normals[i].m_floats[2] >= 0) ? 4 : 0); + signs[i] = ((normals[i].x >= 0) ? 1 : 0) + + ((normals[i].y >= 0) ? 2 : 0) + + ((normals[i].z >= 0) ? 4 : 0); } stock.reserve(SIMPLE_STACKSIZE); stack.reserve(SIMPLE_STACKSIZE); diff --git a/3rdparty/bullet3/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h b/3rdparty/bullet3/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h index c6758c3755..e0e4b9c962 100644 --- a/3rdparty/bullet3/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h +++ b/3rdparty/bullet3/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h @@ -329,13 +329,13 @@ btQuantizedBvh { btAssert(m_useQuantization); - btAssert(point.m_floats[0] <= m_bvhAabbMax.m_floats[0]); - btAssert(point.m_floats[1] <= m_bvhAabbMax.m_floats[1]); - btAssert(point.m_floats[2] <= m_bvhAabbMax.m_floats[2]); + btAssert(point.x <= m_bvhAabbMax.x); + btAssert(point.y <= m_bvhAabbMax.y); + btAssert(point.z <= m_bvhAabbMax.z); - btAssert(point.m_floats[0] >= m_bvhAabbMin.m_floats[0]); - btAssert(point.m_floats[1] >= m_bvhAabbMin.m_floats[1]); - btAssert(point.m_floats[2] >= m_bvhAabbMin.m_floats[2]); + btAssert(point.x >= m_bvhAabbMin.x); + btAssert(point.y >= m_bvhAabbMin.y); + btAssert(point.z >= m_bvhAabbMin.z); btVector3 v = (point - m_bvhAabbMin) * m_bvhQuantization; ///Make sure rounding is done in a way that unQuantize(quantizeWithClamp(...)) is conservative @@ -343,47 +343,47 @@ btQuantizedBvh ///@todo: double-check this if (isMax) { - out[0] = (unsigned short)(((unsigned short)(v.m_floats[0] + btScalar(1.)) | 1)); - out[1] = (unsigned short)(((unsigned short)(v.m_floats[1] + btScalar(1.)) | 1)); - out[2] = (unsigned short)(((unsigned short)(v.m_floats[2] + btScalar(1.)) | 1)); + out[0] = (unsigned short)(((unsigned short)(v.x + btScalar(1.)) | 1)); + out[1] = (unsigned short)(((unsigned short)(v.y + btScalar(1.)) | 1)); + out[2] = (unsigned short)(((unsigned short)(v.z + btScalar(1.)) | 1)); } else { - out[0] = (unsigned short)(((unsigned short)(v.m_floats[0]) & 0xfffe)); - out[1] = (unsigned short)(((unsigned short)(v.m_floats[1]) & 0xfffe)); - out[2] = (unsigned short)(((unsigned short)(v.m_floats[2]) & 0xfffe)); + out[0] = (unsigned short)(((unsigned short)(v.x) & 0xfffe)); + out[1] = (unsigned short)(((unsigned short)(v.y) & 0xfffe)); + out[2] = (unsigned short)(((unsigned short)(v.z) & 0xfffe)); } #ifdef DEBUG_CHECK_DEQUANTIZATION btVector3 newPoint = unQuantize(out); if (isMax) { - if (newPoint.m_floats[0] < point.m_floats[0]) + if (newPoint.x < point.x) { - printf("unconservative X, diffX = %f, oldX=%f,newX=%f\n", newPoint.m_floats[0] - point.m_floats[0], newPoint.m_floats[0], point.m_floats[0]); + printf("unconservative X, diffX = %f, oldX=%f,newX=%f\n", newPoint.x - point.x, newPoint.x, point.x); } - if (newPoint.m_floats[1] < point.m_floats[1]) + if (newPoint.y < point.y) { - printf("unconservative Y, diffY = %f, oldY=%f,newY=%f\n", newPoint.m_floats[1] - point.m_floats[1], newPoint.m_floats[1], point.m_floats[1]); + printf("unconservative Y, diffY = %f, oldY=%f,newY=%f\n", newPoint.y - point.y, newPoint.y, point.y); } - if (newPoint.m_floats[2] < point.m_floats[2]) + if (newPoint.z < point.z) { - printf("unconservative Z, diffZ = %f, oldZ=%f,newZ=%f\n", newPoint.m_floats[2] - point.m_floats[2], newPoint.m_floats[2], point.m_floats[2]); + printf("unconservative Z, diffZ = %f, oldZ=%f,newZ=%f\n", newPoint.z - point.z, newPoint.z, point.z); } } else { - if (newPoint.m_floats[0] > point.m_floats[0]) + if (newPoint.x > point.x) { - printf("unconservative X, diffX = %f, oldX=%f,newX=%f\n", newPoint.m_floats[0] - point.m_floats[0], newPoint.m_floats[0], point.m_floats[0]); + printf("unconservative X, diffX = %f, oldX=%f,newX=%f\n", newPoint.x - point.x, newPoint.x, point.x); } - if (newPoint.m_floats[1] > point.m_floats[1]) + if (newPoint.y > point.y) { - printf("unconservative Y, diffY = %f, oldY=%f,newY=%f\n", newPoint.m_floats[1] - point.m_floats[1], newPoint.m_floats[1], point.m_floats[1]); + printf("unconservative Y, diffY = %f, oldY=%f,newY=%f\n", newPoint.y - point.y, newPoint.y, point.y); } - if (newPoint.m_floats[2] > point.m_floats[2]) + if (newPoint.z > point.z) { - printf("unconservative Z, diffZ = %f, oldZ=%f,newZ=%f\n", newPoint.m_floats[2] - point.m_floats[2], newPoint.m_floats[2], point.m_floats[2]); + printf("unconservative Z, diffZ = %f, oldZ=%f,newZ=%f\n", newPoint.z - point.z, newPoint.z, point.z); } } #endif //DEBUG_CHECK_DEQUANTIZATION @@ -404,9 +404,9 @@ btQuantizedBvh { btVector3 vecOut; vecOut.setValue( - (btScalar)(vecIn[0]) / (m_bvhQuantization.m_floats[0]), - (btScalar)(vecIn[1]) / (m_bvhQuantization.m_floats[1]), - (btScalar)(vecIn[2]) / (m_bvhQuantization.m_floats[2])); + (btScalar)(vecIn[0]) / (m_bvhQuantization.x), + (btScalar)(vecIn[1]) / (m_bvhQuantization.y), + (btScalar)(vecIn[2]) / (m_bvhQuantization.z)); vecOut += m_bvhAabbMin; return vecOut; } diff --git a/3rdparty/bullet3/src/BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.cpp b/3rdparty/bullet3/src/BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.cpp index b4c43e25f2..6102e9c903 100644 --- a/3rdparty/bullet3/src/BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.cpp +++ b/3rdparty/bullet3/src/BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.cpp @@ -87,7 +87,7 @@ struct ClipVertex #define b2Mul(a, b) (a) * (b) #define b2MulT(a, b) (a).transpose() * (b) #define b2Cross(a, b) (a).cross(b) -#define btCrossS(a, s) btVector3(s* a.m_floats[1], -s* a.m_floats[0], 0.f) +#define btCrossS(a, s) btVector3(s* a.y, -s* a.x, 0.f) int b2_maxManifoldPoints = 2; diff --git a/3rdparty/bullet3/src/BulletCollision/CollisionDispatch/btBoxBoxDetector.cpp b/3rdparty/bullet3/src/BulletCollision/CollisionDispatch/btBoxBoxDetector.cpp index 6659271a3e..b5b9e1a8db 100644 --- a/3rdparty/bullet3/src/BulletCollision/CollisionDispatch/btBoxBoxDetector.cpp +++ b/3rdparty/bullet3/src/BulletCollision/CollisionDispatch/btBoxBoxDetector.cpp @@ -740,14 +740,14 @@ void btBoxBoxDetector::getClosestPoints(const ClosestPointInput& input, Result& for (int j = 0; j < 3; j++) { - R1[0 + 4 * j] = transformA.m_basis[j].m_floats[0]; - R2[0 + 4 * j] = transformB.m_basis[j].m_floats[0]; + R1[0 + 4 * j] = transformA.m_basis[j].x; + R2[0 + 4 * j] = transformB.m_basis[j].x; - R1[1 + 4 * j] = transformA.m_basis[j].m_floats[1]; - R2[1 + 4 * j] = transformB.m_basis[j].m_floats[1]; + R1[1 + 4 * j] = transformA.m_basis[j].y; + R2[1 + 4 * j] = transformB.m_basis[j].y; - R1[2 + 4 * j] = transformA.m_basis[j].m_floats[2]; - R2[2 + 4 * j] = transformB.m_basis[j].m_floats[2]; + R1[2 + 4 * j] = transformA.m_basis[j].z; + R2[2 + 4 * j] = transformB.m_basis[j].z; } btVector3 normal; diff --git a/3rdparty/bullet3/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp b/3rdparty/bullet3/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp index 8a517ebd8a..d78147286f 100644 --- a/3rdparty/bullet3/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp +++ b/3rdparty/bullet3/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp @@ -520,7 +520,7 @@ void btConvexConvexAlgorithm ::processCollision(const btCollisionObjectWrapper* } if (foundSepAxis) { - // printf("sepNormalWorldSpace=%f,%f,%f\n",sepNormalWorldSpace.m_floats[0],sepNormalWorldSpace.m_floats[1],sepNormalWorldSpace.m_floats[2]); + // printf("sepNormalWorldSpace=%f,%f,%f\n",sepNormalWorldSpace.x,sepNormalWorldSpace.y,sepNormalWorldSpace.z); worldVertsB1.resize(0); btPolyhedralContactClipping::clipHullAgainstHull(sepNormalWorldSpace, *polyhedronA->getConvexPolyhedron(), *polyhedronB->getConvexPolyhedron(), @@ -638,7 +638,7 @@ void btConvexConvexAlgorithm ::processCollision(const btCollisionObjectWrapper* body0Wrap->m_worldTransform, body1Wrap->m_worldTransform, sepNormalWorldSpace, *resultOut); - // printf("sepNormalWorldSpace=%f,%f,%f\n",sepNormalWorldSpace.m_floats[0],sepNormalWorldSpace.m_floats[1],sepNormalWorldSpace.m_floats[2]); + // printf("sepNormalWorldSpace=%f,%f,%f\n",sepNormalWorldSpace.x,sepNormalWorldSpace.y,sepNormalWorldSpace.z); } else { diff --git a/3rdparty/bullet3/src/BulletCollision/CollisionDispatch/btInternalEdgeUtility.cpp b/3rdparty/bullet3/src/BulletCollision/CollisionDispatch/btInternalEdgeUtility.cpp index a8ec26b088..beb1b0801c 100644 --- a/3rdparty/bullet3/src/BulletCollision/CollisionDispatch/btInternalEdgeUtility.cpp +++ b/3rdparty/bullet3/src/BulletCollision/CollisionDispatch/btInternalEdgeUtility.cpp @@ -80,15 +80,15 @@ struct btConnectivityProcessor : public btTriangleCallback #if 0 printf("triangle A[0] = (%f,%f,%f)\ntriangle A[1] = (%f,%f,%f)\ntriangle A[2] = (%f,%f,%f)\n", - m_triangleVerticesA[0].m_floats[0],m_triangleVerticesA[0].m_floats[1],m_triangleVerticesA[0].m_floats[2], - m_triangleVerticesA[1].m_floats[0],m_triangleVerticesA[1].m_floats[1],m_triangleVerticesA[1].m_floats[2], - m_triangleVerticesA[2].m_floats[0],m_triangleVerticesA[2].m_floats[1],m_triangleVerticesA[2].m_floats[2]); + m_triangleVerticesA[0].x,m_triangleVerticesA[0].y,m_triangleVerticesA[0].z, + m_triangleVerticesA[1].x,m_triangleVerticesA[1].y,m_triangleVerticesA[1].z, + m_triangleVerticesA[2].x,m_triangleVerticesA[2].y,m_triangleVerticesA[2].z); printf("partId=%d, triangleIndex=%d\n",partId,triangleIndex); printf("triangle B[0] = (%f,%f,%f)\ntriangle B[1] = (%f,%f,%f)\ntriangle B[2] = (%f,%f,%f)\n", - triangle[0].m_floats[0],triangle[0].m_floats[1],triangle[0].m_floats[2], - triangle[1].m_floats[0],triangle[1].m_floats[1],triangle[1].m_floats[2], - triangle[2].m_floats[0],triangle[2].m_floats[1],triangle[2].m_floats[2]); + triangle[0].x,triangle[0].y,triangle[0].z, + triangle[1].x,triangle[1].y,triangle[1].z, + triangle[2].x,triangle[2].y,triangle[2].z); #endif for (int i = 0; i < 3; i++) @@ -372,14 +372,14 @@ void btGenerateInternalEdgeInfo(btBvhTriangleMeshShape* trimeshShape, btTriangle { float* graphicsbase = (float*)(vertexbase + graphicsindex * stride); triangleVerts[j] = btVector3( - graphicsbase[0] * meshScaling.m_floats[0], - graphicsbase[1] * meshScaling.m_floats[1], - graphicsbase[2] * meshScaling.m_floats[2]); + graphicsbase[0] * meshScaling.x, + graphicsbase[1] * meshScaling.y, + graphicsbase[2] * meshScaling.z); } else { double* graphicsbase = (double*)(vertexbase + graphicsindex * stride); - triangleVerts[j] = btVector3(btScalar(graphicsbase[0] * meshScaling.m_floats[0]), btScalar(graphicsbase[1] * meshScaling.m_floats[1]), btScalar(graphicsbase[2] * meshScaling.m_floats[2])); + triangleVerts[j] = btVector3(btScalar(graphicsbase[0] * meshScaling.x), btScalar(graphicsbase[1] * meshScaling.y), btScalar(graphicsbase[2] * meshScaling.z)); } } aabbMin.setValue(btScalar(BT_LARGE_FLOAT), btScalar(BT_LARGE_FLOAT), btScalar(BT_LARGE_FLOAT)); diff --git a/3rdparty/bullet3/src/BulletCollision/CollisionDispatch/btSphereBoxCollisionAlgorithm.cpp b/3rdparty/bullet3/src/BulletCollision/CollisionDispatch/btSphereBoxCollisionAlgorithm.cpp index 00f7140920..daf52457e0 100644 --- a/3rdparty/bullet3/src/BulletCollision/CollisionDispatch/btSphereBoxCollisionAlgorithm.cpp +++ b/3rdparty/bullet3/src/BulletCollision/CollisionDispatch/btSphereBoxCollisionAlgorithm.cpp @@ -106,12 +106,12 @@ bool btSphereBoxCollisionAlgorithm::getSphereDistance(const btCollisionObjectWra // Determine the closest point to the sphere center in the box btVector3 closestPoint = sphereRelPos; - closestPoint.m_floats[0] = (btMin(boxHalfExtent.m_floats[0], closestPoint.m_floats[0])); - closestPoint.m_floats[0] = (btMax(-boxHalfExtent.m_floats[0], closestPoint.m_floats[0])); - closestPoint.m_floats[1] = (btMin(boxHalfExtent.m_floats[1], closestPoint.m_floats[1])); - closestPoint.m_floats[1] = (btMax(-boxHalfExtent.m_floats[1], closestPoint.m_floats[1])); - closestPoint.m_floats[2] = (btMin(boxHalfExtent.m_floats[2], closestPoint.m_floats[2])); - closestPoint.m_floats[2] = (btMax(-boxHalfExtent.m_floats[2], closestPoint.m_floats[2])); + closestPoint.x = (btMin(boxHalfExtent.x, closestPoint.x)); + closestPoint.x = (btMax(-boxHalfExtent.x, closestPoint.x)); + closestPoint.y = (btMin(boxHalfExtent.y, closestPoint.y)); + closestPoint.y = (btMax(-boxHalfExtent.y, closestPoint.y)); + closestPoint.z = (btMin(boxHalfExtent.z, closestPoint.z)); + closestPoint.z = (btMax(-boxHalfExtent.z, closestPoint.z)); btScalar intersectionDist = fRadius + boxMargin; btScalar contactDist = intersectionDist + maxContactDistance; @@ -155,53 +155,53 @@ bool btSphereBoxCollisionAlgorithm::getSphereDistance(const btCollisionObjectWra btScalar btSphereBoxCollisionAlgorithm::getSpherePenetration(btVector3 const& boxHalfExtent, btVector3 const& sphereRelPos, btVector3& closestPoint, btVector3& normal) { //project the center of the sphere on the closest face of the box - btScalar faceDist = boxHalfExtent.m_floats[0] - sphereRelPos.m_floats[0]; + btScalar faceDist = boxHalfExtent.x - sphereRelPos.x; btScalar minDist = faceDist; - closestPoint.m_floats[0] = (boxHalfExtent.m_floats[0]); + closestPoint.x = (boxHalfExtent.x); normal.setValue(btScalar(1.0f), btScalar(0.0f), btScalar(0.0f)); - faceDist = boxHalfExtent.m_floats[0] + sphereRelPos.m_floats[0]; + faceDist = boxHalfExtent.x + sphereRelPos.x; if (faceDist < minDist) { minDist = faceDist; closestPoint = sphereRelPos; - closestPoint.m_floats[0] = (-boxHalfExtent.m_floats[0]); + closestPoint.x = (-boxHalfExtent.x); normal.setValue(btScalar(-1.0f), btScalar(0.0f), btScalar(0.0f)); } - faceDist = boxHalfExtent.m_floats[1] - sphereRelPos.m_floats[1]; + faceDist = boxHalfExtent.y - sphereRelPos.y; if (faceDist < minDist) { minDist = faceDist; closestPoint = sphereRelPos; - closestPoint.m_floats[1] = (boxHalfExtent.m_floats[1]); + closestPoint.y = (boxHalfExtent.y); normal.setValue(btScalar(0.0f), btScalar(1.0f), btScalar(0.0f)); } - faceDist = boxHalfExtent.m_floats[1] + sphereRelPos.m_floats[1]; + faceDist = boxHalfExtent.y + sphereRelPos.y; if (faceDist < minDist) { minDist = faceDist; closestPoint = sphereRelPos; - closestPoint.m_floats[1] = (-boxHalfExtent.m_floats[1]); + closestPoint.y = (-boxHalfExtent.y); normal.setValue(btScalar(0.0f), btScalar(-1.0f), btScalar(0.0f)); } - faceDist = boxHalfExtent.m_floats[2] - sphereRelPos.m_floats[2]; + faceDist = boxHalfExtent.z - sphereRelPos.z; if (faceDist < minDist) { minDist = faceDist; closestPoint = sphereRelPos; - closestPoint.m_floats[2] = (boxHalfExtent.m_floats[2]); + closestPoint.z = (boxHalfExtent.z); normal.setValue(btScalar(0.0f), btScalar(0.0f), btScalar(1.0f)); } - faceDist = boxHalfExtent.m_floats[2] + sphereRelPos.m_floats[2]; + faceDist = boxHalfExtent.z + sphereRelPos.z; if (faceDist < minDist) { minDist = faceDist; closestPoint = sphereRelPos; - closestPoint.m_floats[2] = (-boxHalfExtent.m_floats[2]); + closestPoint.z = (-boxHalfExtent.z); normal.setValue(btScalar(0.0f), btScalar(0.0f), btScalar(-1.0f)); } diff --git a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btBox2dShape.cpp b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btBox2dShape.cpp index 27927fa51b..6fb4147c39 100644 --- a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btBox2dShape.cpp +++ b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btBox2dShape.cpp @@ -27,9 +27,9 @@ void btBox2dShape::calculateLocalInertia(btScalar mass, btVector3& inertia) cons //btScalar margin = btScalar(0.); btVector3 halfExtents = getHalfExtentsWithMargin(); - btScalar lx = btScalar(2.) * (halfExtents.m_floats[0]); - btScalar ly = btScalar(2.) * (halfExtents.m_floats[1]); - btScalar lz = btScalar(2.) * (halfExtents.m_floats[2]); + btScalar lx = btScalar(2.) * (halfExtents.x); + btScalar ly = btScalar(2.) * (halfExtents.y); + btScalar lz = btScalar(2.) * (halfExtents.z); inertia.setValue(mass / (btScalar(12.0)) * (ly * ly + lz * lz), mass / (btScalar(12.0)) * (lx * lx + lz * lz), diff --git a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btBox2dShape.h b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btBox2dShape.h index ada83ed072..cf2d9772a5 100644 --- a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btBox2dShape.h +++ b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btBox2dShape.h @@ -54,18 +54,18 @@ btBox2dShape : public btPolyhedralConvexShape btVector3 margin(getMargin(), getMargin(), getMargin()); halfExtents += margin; - return btVector3(btFsels(vec.m_floats[0], halfExtents.m_floats[0], -halfExtents.m_floats[0]), - btFsels(vec.m_floats[1], halfExtents.m_floats[1], -halfExtents.m_floats[1]), - btFsels(vec.m_floats[2], halfExtents.m_floats[2], -halfExtents.m_floats[2])); + return btVector3(btFsels(vec.x, halfExtents.x, -halfExtents.x), + btFsels(vec.y, halfExtents.y, -halfExtents.y), + btFsels(vec.z, halfExtents.z, -halfExtents.z)); } SIMD_FORCE_INLINE btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec) const { const btVector3& halfExtents = getHalfExtentsWithoutMargin(); - return btVector3(btFsels(vec.m_floats[0], halfExtents.m_floats[0], -halfExtents.m_floats[0]), - btFsels(vec.m_floats[1], halfExtents.m_floats[1], -halfExtents.m_floats[1]), - btFsels(vec.m_floats[2], halfExtents.m_floats[2], -halfExtents.m_floats[2])); + return btVector3(btFsels(vec.x, halfExtents.x, -halfExtents.x), + btFsels(vec.y, halfExtents.y, -halfExtents.y), + btFsels(vec.z, halfExtents.z, -halfExtents.z)); } virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors, btVector3* supportVerticesOut, int numVectors) const @@ -75,9 +75,9 @@ btBox2dShape : public btPolyhedralConvexShape for (int i = 0; i < numVectors; i++) { const btVector3& vec = vectors[i]; - supportVerticesOut[i].setValue(btFsels(vec.m_floats[0], halfExtents.m_floats[0], -halfExtents.m_floats[0]), - btFsels(vec.m_floats[1], halfExtents.m_floats[1], -halfExtents.m_floats[1]), - btFsels(vec.m_floats[2], halfExtents.m_floats[2], -halfExtents.m_floats[2])); + supportVerticesOut[i].setValue(btFsels(vec.x, halfExtents.x, -halfExtents.x), + btFsels(vec.y, halfExtents.y, -halfExtents.y), + btFsels(vec.z, halfExtents.z, -halfExtents.z)); } } @@ -86,19 +86,19 @@ btBox2dShape : public btPolyhedralConvexShape : btPolyhedralConvexShape(), m_centroid(0, 0, 0) { - m_vertices[0].setValue(-boxHalfExtents.m_floats[0], -boxHalfExtents.m_floats[1], 0); - m_vertices[1].setValue(boxHalfExtents.m_floats[0], -boxHalfExtents.m_floats[1], 0); - m_vertices[2].setValue(boxHalfExtents.m_floats[0], boxHalfExtents.m_floats[1], 0); - m_vertices[3].setValue(-boxHalfExtents.m_floats[0], boxHalfExtents.m_floats[1], 0); + m_vertices[0].setValue(-boxHalfExtents.x, -boxHalfExtents.y, 0); + m_vertices[1].setValue(boxHalfExtents.x, -boxHalfExtents.y, 0); + m_vertices[2].setValue(boxHalfExtents.x, boxHalfExtents.y, 0); + m_vertices[3].setValue(-boxHalfExtents.x, boxHalfExtents.y, 0); m_normals[0].setValue(0, -1, 0); m_normals[1].setValue(1, 0, 0); m_normals[2].setValue(0, 1, 0); m_normals[3].setValue(-1, 0, 0); - btScalar minDimension = boxHalfExtents.m_floats[0]; - if (minDimension > boxHalfExtents.m_floats[1]) - minDimension = boxHalfExtents.m_floats[1]; + btScalar minDimension = boxHalfExtents.x; + if (minDimension > boxHalfExtents.y) + minDimension = boxHalfExtents.y; m_shapeType = BOX_2D_SHAPE_PROXYTYPE; btVector3 margin(getMargin(), getMargin(), getMargin()); @@ -157,7 +157,7 @@ btBox2dShape : public btPolyhedralConvexShape //this plane might not be aligned... btVector4 plane; getPlaneEquation(plane, i); - planeNormal = btVector3(plane.m_floats[0], plane.m_floats[1], plane.m_floats[2]); + planeNormal = btVector3(plane.x, plane.y, plane.z); planeSupport = localGetSupportingVertex(-planeNormal); } @@ -181,9 +181,9 @@ btBox2dShape : public btPolyhedralConvexShape btVector3 halfExtents = getHalfExtentsWithoutMargin(); vtx = btVector3( - halfExtents.m_floats[0] * (1 - (i & 1)) - halfExtents.m_floats[0] * (i & 1), - halfExtents.m_floats[1] * (1 - ((i & 2) >> 1)) - halfExtents.m_floats[1] * ((i & 2) >> 1), - halfExtents.m_floats[2] * (1 - ((i & 4) >> 2)) - halfExtents.m_floats[2] * ((i & 4) >> 2)); + halfExtents.x * (1 - (i & 1)) - halfExtents.x * (i & 1), + halfExtents.y * (1 - ((i & 2) >> 1)) - halfExtents.y * ((i & 2) >> 1), + halfExtents.z * (1 - ((i & 4) >> 2)) - halfExtents.z * ((i & 4) >> 2)); } virtual void getPlaneEquation(btVector4 & plane, int i) const @@ -193,22 +193,22 @@ btBox2dShape : public btPolyhedralConvexShape switch (i) { case 0: - plane.setValue(btScalar(1.), btScalar(0.), btScalar(0.), -halfExtents.m_floats[0]); + plane.setValue(btScalar(1.), btScalar(0.), btScalar(0.), -halfExtents.x); break; case 1: - plane.setValue(btScalar(-1.), btScalar(0.), btScalar(0.), -halfExtents.m_floats[0]); + plane.setValue(btScalar(-1.), btScalar(0.), btScalar(0.), -halfExtents.x); break; case 2: - plane.setValue(btScalar(0.), btScalar(1.), btScalar(0.), -halfExtents.m_floats[1]); + plane.setValue(btScalar(0.), btScalar(1.), btScalar(0.), -halfExtents.y); break; case 3: - plane.setValue(btScalar(0.), btScalar(-1.), btScalar(0.), -halfExtents.m_floats[1]); + plane.setValue(btScalar(0.), btScalar(-1.), btScalar(0.), -halfExtents.y); break; case 4: - plane.setValue(btScalar(0.), btScalar(0.), btScalar(1.), -halfExtents.m_floats[2]); + plane.setValue(btScalar(0.), btScalar(0.), btScalar(1.), -halfExtents.z); break; case 5: - plane.setValue(btScalar(0.), btScalar(0.), btScalar(-1.), -halfExtents.m_floats[2]); + plane.setValue(btScalar(0.), btScalar(0.), btScalar(-1.), -halfExtents.z); break; default: btAssert(0); @@ -287,12 +287,12 @@ btBox2dShape : public btPolyhedralConvexShape //btScalar minDist = 2*tolerance; - bool result = (pt.m_floats[0] <= (halfExtents.m_floats[0] + tolerance)) && - (pt.m_floats[0] >= (-halfExtents.m_floats[0] - tolerance)) && - (pt.m_floats[1] <= (halfExtents.m_floats[1] + tolerance)) && - (pt.m_floats[1] >= (-halfExtents.m_floats[1] - tolerance)) && - (pt.m_floats[2] <= (halfExtents.m_floats[2] + tolerance)) && - (pt.m_floats[2] >= (-halfExtents.m_floats[2] - tolerance)); + bool result = (pt.x <= (halfExtents.x + tolerance)) && + (pt.x >= (-halfExtents.x - tolerance)) && + (pt.y <= (halfExtents.y + tolerance)) && + (pt.y >= (-halfExtents.y - tolerance)) && + (pt.z <= (halfExtents.z + tolerance)) && + (pt.z >= (-halfExtents.z - tolerance)); return result; } diff --git a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btBoxShape.cpp b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btBoxShape.cpp index 59fb85c4d6..04a63bd0ac 100644 --- a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btBoxShape.cpp +++ b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btBoxShape.cpp @@ -35,9 +35,9 @@ void btBoxShape::calculateLocalInertia(btScalar mass, btVector3& inertia) const //btScalar margin = btScalar(0.); btVector3 halfExtents = getHalfExtentsWithMargin(); - btScalar lx = btScalar(2.) * (halfExtents.m_floats[0]); - btScalar ly = btScalar(2.) * (halfExtents.m_floats[1]); - btScalar lz = btScalar(2.) * (halfExtents.m_floats[2]); + btScalar lx = btScalar(2.) * (halfExtents.x); + btScalar ly = btScalar(2.) * (halfExtents.y); + btScalar lz = btScalar(2.) * (halfExtents.z); inertia.setValue(mass / (btScalar(12.0)) * (ly * ly + lz * lz), mass / (btScalar(12.0)) * (lx * lx + lz * lz), diff --git a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btBoxShape.h b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btBoxShape.h index 860bdd93f5..f99069feba 100644 --- a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btBoxShape.h +++ b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btBoxShape.h @@ -50,18 +50,18 @@ btBoxShape : public btPolyhedralConvexShape btVector3 margin(getMargin(), getMargin(), getMargin()); halfExtents += margin; - return btVector3(btFsels(vec.m_floats[0], halfExtents.m_floats[0], -halfExtents.m_floats[0]), - btFsels(vec.m_floats[1], halfExtents.m_floats[1], -halfExtents.m_floats[1]), - btFsels(vec.m_floats[2], halfExtents.m_floats[2], -halfExtents.m_floats[2])); + return btVector3(btFsels(vec.x, halfExtents.x, -halfExtents.x), + btFsels(vec.y, halfExtents.y, -halfExtents.y), + btFsels(vec.z, halfExtents.z, -halfExtents.z)); } SIMD_FORCE_INLINE btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec) const { const btVector3& halfExtents = getHalfExtentsWithoutMargin(); - return btVector3(btFsels(vec.m_floats[0], halfExtents.m_floats[0], -halfExtents.m_floats[0]), - btFsels(vec.m_floats[1], halfExtents.m_floats[1], -halfExtents.m_floats[1]), - btFsels(vec.m_floats[2], halfExtents.m_floats[2], -halfExtents.m_floats[2])); + return btVector3(btFsels(vec.x, halfExtents.x, -halfExtents.x), + btFsels(vec.y, halfExtents.y, -halfExtents.y), + btFsels(vec.z, halfExtents.z, -halfExtents.z)); } virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors, btVector3* supportVerticesOut, int numVectors) const @@ -71,9 +71,9 @@ btBoxShape : public btPolyhedralConvexShape for (int i = 0; i < numVectors; i++) { const btVector3& vec = vectors[i]; - supportVerticesOut[i].setValue(btFsels(vec.m_floats[0], halfExtents.m_floats[0], -halfExtents.m_floats[0]), - btFsels(vec.m_floats[1], halfExtents.m_floats[1], -halfExtents.m_floats[1]), - btFsels(vec.m_floats[2], halfExtents.m_floats[2], -halfExtents.m_floats[2])); + supportVerticesOut[i].setValue(btFsels(vec.x, halfExtents.x, -halfExtents.x), + btFsels(vec.y, halfExtents.y, -halfExtents.y), + btFsels(vec.z, halfExtents.z, -halfExtents.z)); } } @@ -109,7 +109,7 @@ btBoxShape : public btPolyhedralConvexShape //this plane might not be aligned... btVector4 plane; getPlaneEquation(plane, i); - planeNormal = btVector3(plane.m_floats[0], plane.m_floats[1], plane.m_floats[2]); + planeNormal = btVector3(plane.x, plane.y, plane.z); planeSupport = localGetSupportingVertex(-planeNormal); } @@ -133,9 +133,9 @@ btBoxShape : public btPolyhedralConvexShape btVector3 halfExtents = getHalfExtentsWithMargin(); vtx = btVector3( - halfExtents.m_floats[0] * (1 - (i & 1)) - halfExtents.m_floats[0] * (i & 1), - halfExtents.m_floats[1] * (1 - ((i & 2) >> 1)) - halfExtents.m_floats[1] * ((i & 2) >> 1), - halfExtents.m_floats[2] * (1 - ((i & 4) >> 2)) - halfExtents.m_floats[2] * ((i & 4) >> 2)); + halfExtents.x * (1 - (i & 1)) - halfExtents.x * (i & 1), + halfExtents.y * (1 - ((i & 2) >> 1)) - halfExtents.y * ((i & 2) >> 1), + halfExtents.z * (1 - ((i & 4) >> 2)) - halfExtents.z * ((i & 4) >> 2)); } virtual void getPlaneEquation(btVector4 & plane, int i) const @@ -145,22 +145,22 @@ btBoxShape : public btPolyhedralConvexShape switch (i) { case 0: - plane.setValue(btScalar(1.), btScalar(0.), btScalar(0.), -halfExtents.m_floats[0]); + plane.setValue(btScalar(1.), btScalar(0.), btScalar(0.), -halfExtents.x); break; case 1: - plane.setValue(btScalar(-1.), btScalar(0.), btScalar(0.), -halfExtents.m_floats[0]); + plane.setValue(btScalar(-1.), btScalar(0.), btScalar(0.), -halfExtents.x); break; case 2: - plane.setValue(btScalar(0.), btScalar(1.), btScalar(0.), -halfExtents.m_floats[1]); + plane.setValue(btScalar(0.), btScalar(1.), btScalar(0.), -halfExtents.y); break; case 3: - plane.setValue(btScalar(0.), btScalar(-1.), btScalar(0.), -halfExtents.m_floats[1]); + plane.setValue(btScalar(0.), btScalar(-1.), btScalar(0.), -halfExtents.y); break; case 4: - plane.setValue(btScalar(0.), btScalar(0.), btScalar(1.), -halfExtents.m_floats[2]); + plane.setValue(btScalar(0.), btScalar(0.), btScalar(1.), -halfExtents.z); break; case 5: - plane.setValue(btScalar(0.), btScalar(0.), btScalar(-1.), -halfExtents.m_floats[2]); + plane.setValue(btScalar(0.), btScalar(0.), btScalar(-1.), -halfExtents.z); break; default: btAssert(0); @@ -239,12 +239,12 @@ btBoxShape : public btPolyhedralConvexShape //btScalar minDist = 2*tolerance; - bool result = (pt.m_floats[0] <= (halfExtents.m_floats[0] + tolerance)) && - (pt.m_floats[0] >= (-halfExtents.m_floats[0] - tolerance)) && - (pt.m_floats[1] <= (halfExtents.m_floats[1] + tolerance)) && - (pt.m_floats[1] >= (-halfExtents.m_floats[1] - tolerance)) && - (pt.m_floats[2] <= (halfExtents.m_floats[2] + tolerance)) && - (pt.m_floats[2] >= (-halfExtents.m_floats[2] - tolerance)); + bool result = (pt.x <= (halfExtents.x + tolerance)) && + (pt.x >= (-halfExtents.x - tolerance)) && + (pt.y <= (halfExtents.y + tolerance)) && + (pt.y >= (-halfExtents.y - tolerance)) && + (pt.z <= (halfExtents.z + tolerance)) && + (pt.z >= (-halfExtents.z - tolerance)); return result; } diff --git a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp index 4a45136c2b..9ad118db17 100644 --- a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp +++ b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp @@ -140,13 +140,13 @@ void btBvhTriangleMeshShape::performRaycast(btTriangleCallback* callback, const { float* graphicsbase = (float*)(vertexbase + graphicsindex * stride); - m_triangle[j] = btVector3(graphicsbase[0] * meshScaling.m_floats[0], graphicsbase[1] * meshScaling.m_floats[1], graphicsbase[2] * meshScaling.m_floats[2]); + m_triangle[j] = btVector3(graphicsbase[0] * meshScaling.x, graphicsbase[1] * meshScaling.y, graphicsbase[2] * meshScaling.z); } else { double* graphicsbase = (double*)(vertexbase + graphicsindex * stride); - m_triangle[j] = btVector3(btScalar(graphicsbase[0]) * meshScaling.m_floats[0], btScalar(graphicsbase[1]) * meshScaling.m_floats[1], btScalar(graphicsbase[2]) * meshScaling.m_floats[2]); + m_triangle[j] = btVector3(btScalar(graphicsbase[0]) * meshScaling.x, btScalar(graphicsbase[1]) * meshScaling.y, btScalar(graphicsbase[2]) * meshScaling.z); } } @@ -214,13 +214,13 @@ void btBvhTriangleMeshShape::performConvexcast(btTriangleCallback* callback, con { float* graphicsbase = (float*)(vertexbase + graphicsindex * stride); - m_triangle[j] = btVector3(graphicsbase[0] * meshScaling.m_floats[0], graphicsbase[1] * meshScaling.m_floats[1], graphicsbase[2] * meshScaling.m_floats[2]); + m_triangle[j] = btVector3(graphicsbase[0] * meshScaling.x, graphicsbase[1] * meshScaling.y, graphicsbase[2] * meshScaling.z); } else { double* graphicsbase = (double*)(vertexbase + graphicsindex * stride); - m_triangle[j] = btVector3(btScalar(graphicsbase[0]) * meshScaling.m_floats[0], btScalar(graphicsbase[1]) * meshScaling.m_floats[1], btScalar(graphicsbase[2]) * meshScaling.m_floats[2]); + m_triangle[j] = btVector3(btScalar(graphicsbase[0]) * meshScaling.x, btScalar(graphicsbase[1]) * meshScaling.y, btScalar(graphicsbase[2]) * meshScaling.z); } } @@ -298,21 +298,21 @@ void btBvhTriangleMeshShape::processAllTriangles(btTriangleCallback* callback, c float* graphicsbase = (float*)(vertexbase + graphicsindex * stride); m_triangle[j] = btVector3( - graphicsbase[0] * meshScaling.m_floats[0], - graphicsbase[1] * meshScaling.m_floats[1], - graphicsbase[2] * meshScaling.m_floats[2]); + graphicsbase[0] * meshScaling.x, + graphicsbase[1] * meshScaling.y, + graphicsbase[2] * meshScaling.z); } else { double* graphicsbase = (double*)(vertexbase + graphicsindex * stride); m_triangle[j] = btVector3( - btScalar(graphicsbase[0]) * meshScaling.m_floats[0], - btScalar(graphicsbase[1]) * meshScaling.m_floats[1], - btScalar(graphicsbase[2]) * meshScaling.m_floats[2]); + btScalar(graphicsbase[0]) * meshScaling.x, + btScalar(graphicsbase[1]) * meshScaling.y, + btScalar(graphicsbase[2]) * meshScaling.z); } #ifdef DEBUG_TRIANGLE_MESH - printf("triangle vertices:%f,%f,%f\n", triangle[j].m_floats[0], triangle[j].m_floats[1], triangle[j].m_floats[2]); + printf("triangle vertices:%f,%f,%f\n", triangle[j].x, triangle[j].y, triangle[j].z); #endif //DEBUG_TRIANGLE_MESH } diff --git a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btCollisionShape.cpp b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btCollisionShape.cpp index c04cf69af6..8269cf1269 100644 --- a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btCollisionShape.cpp +++ b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btCollisionShape.cpp @@ -59,28 +59,28 @@ void btCollisionShape::calculateTemporalAabb(const btTransform& curTrans, const //start with static aabb getAabb(curTrans, temporalAabbMin, temporalAabbMax); - btScalar temporalAabbMaxx = temporalAabbMax.m_floats[0]; - btScalar temporalAabbMaxy = temporalAabbMax.m_floats[1]; - btScalar temporalAabbMaxz = temporalAabbMax.m_floats[2]; - btScalar temporalAabbMinx = temporalAabbMin.m_floats[0]; - btScalar temporalAabbMiny = temporalAabbMin.m_floats[1]; - btScalar temporalAabbMinz = temporalAabbMin.m_floats[2]; + btScalar temporalAabbMaxx = temporalAabbMax.x; + btScalar temporalAabbMaxy = temporalAabbMax.y; + btScalar temporalAabbMaxz = temporalAabbMax.z; + btScalar temporalAabbMinx = temporalAabbMin.x; + btScalar temporalAabbMiny = temporalAabbMin.y; + btScalar temporalAabbMinz = temporalAabbMin.z; // add linear motion btVector3 linMotion = linvel * timeStep; ///@todo: simd would have a vector max/min operation, instead of per-element access - if (linMotion.m_floats[0] > btScalar(0.)) - temporalAabbMaxx += linMotion.m_floats[0]; + if (linMotion.x > btScalar(0.)) + temporalAabbMaxx += linMotion.x; else - temporalAabbMinx += linMotion.m_floats[0]; - if (linMotion.m_floats[1] > btScalar(0.)) - temporalAabbMaxy += linMotion.m_floats[1]; + temporalAabbMinx += linMotion.x; + if (linMotion.y > btScalar(0.)) + temporalAabbMaxy += linMotion.y; else - temporalAabbMiny += linMotion.m_floats[1]; - if (linMotion.m_floats[2] > btScalar(0.)) - temporalAabbMaxz += linMotion.m_floats[2]; + temporalAabbMiny += linMotion.y; + if (linMotion.z > btScalar(0.)) + temporalAabbMaxz += linMotion.z; else - temporalAabbMinz += linMotion.m_floats[2]; + temporalAabbMinz += linMotion.z; //add conservative angular motion btScalar angularMotion = angvel.length() * getAngularMotionDisc() * timeStep; diff --git a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btCompoundShape.cpp b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btCompoundShape.cpp index a3672adf0e..36d06dd701 100644 --- a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btCompoundShape.cpp +++ b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btCompoundShape.cpp @@ -190,9 +190,9 @@ void btCompoundShape::calculateLocalInertia(btScalar mass, btVector3& inertia) c btVector3 halfExtents = (aabbMax - aabbMin) * btScalar(0.5); - btScalar lx = btScalar(2.) * (halfExtents.m_floats[0]); - btScalar ly = btScalar(2.) * (halfExtents.m_floats[1]); - btScalar lz = btScalar(2.) * (halfExtents.m_floats[2]); + btScalar lx = btScalar(2.) * (halfExtents.x); + btScalar ly = btScalar(2.) * (halfExtents.y); + btScalar lz = btScalar(2.) * (halfExtents.z); inertia[0] = mass / (btScalar(12.0)) * (ly * ly + lz * lz); inertia[1] = mass / (btScalar(12.0)) * (lx * lx + lz * lz); @@ -245,9 +245,9 @@ void btCompoundShape::calculatePrincipalAxisTransform(const btScalar* masses, bt j[0].setValue(o2, 0, 0); j[1].setValue(0, o2, 0); j[2].setValue(0, 0, o2); - j[0] += o * -o.m_floats[0]; - j[1] += o * -o.m_floats[1]; - j[2] += o * -o.m_floats[2]; + j[0] += o * -o.x; + j[1] += o * -o.y; + j[2] += o * -o.z; //add inertia tensor of pointmass tensor[0] += masses[k] * j[0]; diff --git a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btConeShape.h b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btConeShape.h index b49eac7d07..3beda3464e 100644 --- a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btConeShape.h +++ b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btConeShape.h @@ -62,9 +62,9 @@ btConeShape : public btConvexInternalShape btScalar margin = getMargin(); - btScalar lx = btScalar(2.) * (halfExtents.m_floats[0] + margin); - btScalar ly = btScalar(2.) * (halfExtents.m_floats[1] + margin); - btScalar lz = btScalar(2.) * (halfExtents.m_floats[2] + margin); + btScalar lx = btScalar(2.) * (halfExtents.x + margin); + btScalar ly = btScalar(2.) * (halfExtents.y + margin); + btScalar lz = btScalar(2.) * (halfExtents.z + margin); const btScalar x2 = lx * lx; const btScalar y2 = ly * ly; const btScalar z2 = lz * lz; @@ -72,9 +72,9 @@ btConeShape : public btConvexInternalShape inertia = scaledmass * (btVector3(y2 + z2, x2 + z2, x2 + y2)); - // inertia.m_floats[0] = scaledmass * (y2+z2); - // inertia.m_floats[1] = scaledmass * (x2+z2); - // inertia.m_floats[2] = scaledmass * (x2+y2); + // inertia.x = scaledmass * (y2+z2); + // inertia.y = scaledmass * (x2+z2); + // inertia.z = scaledmass * (x2+y2); } virtual const char* getName() const diff --git a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp index 9dd6ea06d3..32b62e51dc 100644 --- a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp +++ b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp @@ -116,7 +116,7 @@ btVector3 btConvexHullShape::localGetSupportingVertex(const btVector3& vec) cons void btConvexHullShape::optimizeConvexHull() { btConvexHullComputer conv; - conv.compute(&m_unscaledPoints[0].m_floats[0], sizeof(btVector3), m_unscaledPoints.size(), 0.f, 0.f); + conv.compute(&m_unscaledPoints[0].x, sizeof(btVector3), m_unscaledPoints.size(), 0.f, 0.f); int numVerts = conv.vertices.size(); m_unscaledPoints.resize(0); for (int i = 0; i < numVerts; i++) diff --git a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btConvexPolyhedron.cpp b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btConvexPolyhedron.cpp index 457936c9f7..3f07f5dd25 100644 --- a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btConvexPolyhedron.cpp +++ b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btConvexPolyhedron.cpp @@ -29,7 +29,7 @@ btConvexPolyhedron::~btConvexPolyhedron() inline bool IsAlmostZero1(const btVector3& v) { - if (btFabs(v.m_floats[0]) > 1e-6 || btFabs(v.m_floats[1]) > 1e-6 || btFabs(v.m_floats[2]) > 1e-6) return false; + if (btFabs(v.x) > 1e-6 || btFabs(v.y) > 1e-6 || btFabs(v.z) > 1e-6) return false; return true; } @@ -218,12 +218,12 @@ void btConvexPolyhedron::initialize2() for (int i = 0; i < m_vertices.size(); i++) { const btVector3& pt = m_vertices[i]; - if (pt.m_floats[0] < MinX) MinX = pt.m_floats[0]; - if (pt.m_floats[0] > MaxX) MaxX = pt.m_floats[0]; - if (pt.m_floats[1] < MinY) MinY = pt.m_floats[1]; - if (pt.m_floats[1] > MaxY) MaxY = pt.m_floats[1]; - if (pt.m_floats[2] < MinZ) MinZ = pt.m_floats[2]; - if (pt.m_floats[2] > MaxZ) MaxZ = pt.m_floats[2]; + if (pt.x < MinX) MinX = pt.x; + if (pt.x > MaxX) MaxX = pt.x; + if (pt.y < MinY) MinY = pt.y; + if (pt.y > MaxY) MaxY = pt.y; + if (pt.z < MinZ) MinZ = pt.z; + if (pt.z > MaxZ) MaxZ = pt.z; } mC.setValue(MaxX + MinX, MaxY + MinY, MaxZ + MinZ); mE.setValue(MaxX - MinX, MaxY - MinY, MaxZ - MinZ); diff --git a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btConvexShape.cpp b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btConvexShape.cpp index 81f48a5364..dafb5a81a3 100644 --- a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btConvexShape.cpp +++ b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btConvexShape.cpp @@ -150,19 +150,19 @@ btVector3 btConvexShape::localGetSupportVertexWithoutMarginNonVirtual(const btVe #error unknown vector arch #endif #else - return btVector3(btFsels(localDir.m_floats[0], halfExtents.m_floats[0], -halfExtents.m_floats[0]), - btFsels(localDir.m_floats[1], halfExtents.m_floats[1], -halfExtents.m_floats[1]), - btFsels(localDir.m_floats[2], halfExtents.m_floats[2], -halfExtents.m_floats[2])); + return btVector3(btFsels(localDir.x, halfExtents.x, -halfExtents.x), + btFsels(localDir.y, halfExtents.y, -halfExtents.y), + btFsels(localDir.z, halfExtents.z, -halfExtents.z)); #endif } case TRIANGLE_SHAPE_PROXYTYPE: { btTriangleShape* triangleShape = (btTriangleShape*)this; - btVector3 dir(localDir.m_floats[0], localDir.m_floats[1], localDir.m_floats[2]); + btVector3 dir(localDir.x, localDir.y, localDir.z); btVector3* vertices = &triangleShape->m_vertices1[0]; btVector3 dots = dir.dot3(vertices[0], vertices[1], vertices[2]); btVector3 sup = vertices[dots.maxAxis()]; - return btVector3(sup.m_floats[0], sup.m_floats[1], sup.m_floats[2]); + return btVector3(sup.x, sup.y, sup.z); } case CYLINDER_SHAPE_PROXYTYPE: { @@ -170,7 +170,7 @@ btVector3 btConvexShape::localGetSupportVertexWithoutMarginNonVirtual(const btVe //mapping of halfextents/dimension onto radius/height depends on how cylinder local orientation is (upAxis) btVector3 halfExtents = cylShape->getImplicitShapeDimensions(); - btVector3 v(localDir.m_floats[0], localDir.m_floats[1], localDir.m_floats[2]); + btVector3 v(localDir.x, localDir.y, localDir.z); int cylinderUpAxis = cylShape->getUpAxis(); int XX(1), YY(0), ZZ(2); @@ -215,19 +215,19 @@ btVector3 btConvexShape::localGetSupportVertexWithoutMarginNonVirtual(const btVe tmp[XX] = v[XX] * d; tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight; tmp[ZZ] = v[ZZ] * d; - return btVector3(tmp.m_floats[0], tmp.m_floats[1], tmp.m_floats[2]); + return btVector3(tmp.x, tmp.y, tmp.z); } else { tmp[XX] = radius; tmp[YY] = v[YY] < 0.0 ? -halfHeight : halfHeight; tmp[ZZ] = btScalar(0.0); - return btVector3(tmp.m_floats[0], tmp.m_floats[1], tmp.m_floats[2]); + return btVector3(tmp.x, tmp.y, tmp.z); } } case CAPSULE_SHAPE_PROXYTYPE: { - btVector3 vec0(localDir.m_floats[0], localDir.m_floats[1], localDir.m_floats[2]); + btVector3 vec0(localDir.x, localDir.y, localDir.z); btCapsuleShape* capsuleShape = (btCapsuleShape*)this; btScalar halfHeight = capsuleShape->getHalfHeight(); @@ -275,7 +275,7 @@ btVector3 btConvexShape::localGetSupportVertexWithoutMarginNonVirtual(const btVe supVec = vtx; } } - return btVector3(supVec.m_floats[0], supVec.m_floats[1], supVec.m_floats[2]); + return btVector3(supVec.x, supVec.y, supVec.z); } case CONVEX_POINT_CLOUD_SHAPE_PROXYTYPE: { @@ -378,7 +378,7 @@ void btConvexShape::getAabbNonVirtual(const btTransform& t, btVector3& aabbMin, case SPHERE_SHAPE_PROXYTYPE: { btSphereShape* sphereShape = (btSphereShape*)this; - btScalar radius = sphereShape->getImplicitShapeDimensions().m_floats[0]; // * convexShape->getLocalScaling().m_floats[0]; + btScalar radius = sphereShape->getImplicitShapeDimensions().x; // * convexShape->getLocalScaling().x; btScalar margin = radius + sphereShape->getMarginNonVirtual(); const btVector3& center = t.m_origin; btVector3 extent(margin, margin, margin); diff --git a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btCylinderShape.cpp b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btCylinderShape.cpp index 5a01c1bd06..f738c73c90 100644 --- a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btCylinderShape.cpp +++ b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btCylinderShape.cpp @@ -105,9 +105,9 @@ void btCylinderShape::calculateLocalInertia(btScalar mass, btVector3& inertia) c //approximation of box shape btVector3 halfExtents = getHalfExtentsWithMargin(); - btScalar lx = btScalar(2.) * (halfExtents.m_floats[0]); - btScalar ly = btScalar(2.) * (halfExtents.m_floats[1]); - btScalar lz = btScalar(2.) * (halfExtents.m_floats[2]); + btScalar lx = btScalar(2.) * (halfExtents.x); + btScalar ly = btScalar(2.) * (halfExtents.y); + btScalar lz = btScalar(2.) * (halfExtents.z); inertia.setValue(mass / (btScalar(12.0)) * (ly * ly + lz * lz), mass / (btScalar(12.0)) * (lx * lx + lz * lz), diff --git a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btCylinderShape.h b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btCylinderShape.h index 68a09dbfd9..b53c1af62e 100644 --- a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btCylinderShape.h +++ b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btCylinderShape.h @@ -100,7 +100,7 @@ btCylinderShape : public btConvexInternalShape virtual btScalar getRadius() const { - return getHalfExtentsWithMargin().m_floats[0]; + return getHalfExtentsWithMargin().x; } virtual void setLocalScaling(const btVector3& scaling) @@ -144,7 +144,7 @@ class btCylinderShapeX : public btCylinderShape virtual btScalar getRadius() const { - return getHalfExtentsWithMargin().m_floats[1]; + return getHalfExtentsWithMargin().y; } }; @@ -166,7 +166,7 @@ class btCylinderShapeZ : public btCylinderShape virtual btScalar getRadius() const { - return getHalfExtentsWithMargin().m_floats[0]; + return getHalfExtentsWithMargin().x; } }; diff --git a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp index 295f4ea9d8..07c0bf71c5 100644 --- a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp +++ b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp @@ -244,7 +244,7 @@ void btHeightfieldTerrainShape::getVertex(int x, int y, btVector3& vertex) const case 0: { vertex.setValue( - height - m_localOrigin.m_floats[0], + height - m_localOrigin.x, (-m_width / btScalar(2.0)) + x, (-m_length / btScalar(2.0)) + y); break; @@ -253,7 +253,7 @@ void btHeightfieldTerrainShape::getVertex(int x, int y, btVector3& vertex) const { vertex.setValue( (-m_width / btScalar(2.0)) + x, - height - m_localOrigin.m_floats[1], + height - m_localOrigin.y, (-m_length / btScalar(2.0)) + y); break; }; @@ -262,7 +262,7 @@ void btHeightfieldTerrainShape::getVertex(int x, int y, btVector3& vertex) const vertex.setValue( (-m_width / btScalar(2.0)) + x, (-m_length / btScalar(2.0)) + y, - height - m_localOrigin.m_floats[2]); + height - m_localOrigin.z); break; } default: @@ -325,9 +325,9 @@ void btHeightfieldTerrainShape::quantizeWithClamp(int* out, const btVector3& poi clampedPoint.setMax(m_localAabbMin); clampedPoint.setMin(m_localAabbMax); - out[0] = getQuantized(clampedPoint.m_floats[0]); - out[1] = getQuantized(clampedPoint.m_floats[1]); - out[2] = getQuantized(clampedPoint.m_floats[2]); + out[0] = getQuantized(clampedPoint.x); + out[1] = getQuantized(clampedPoint.y); + out[2] = getQuantized(clampedPoint.z); } /// process all triangles within the provided axis-aligned bounding box diff --git a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btMiniSDF.cpp b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btMiniSDF.cpp index 13c0a343f1..1d4ea36cf1 100644 --- a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btMiniSDF.cpp +++ b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btMiniSDF.cpp @@ -162,9 +162,9 @@ btMiniSDF::subdomain(btMultiIndex const& ijk) const { btAssert(m_isValid); btVector3 tmp; - tmp.m_floats[0] = m_cell_size[0] * (double)ijk.ijk[0]; - tmp.m_floats[1] = m_cell_size[1] * (double)ijk.ijk[1]; - tmp.m_floats[2] = m_cell_size[2] * (double)ijk.ijk[2]; + tmp.x = m_cell_size[0] * (double)ijk.ijk[0]; + tmp.y = m_cell_size[1] * (double)ijk.ijk[1]; + tmp.z = m_cell_size[2] * (double)ijk.ijk[2]; btVector3 origin = m_domain.min() + tmp; diff --git a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp index 621f0f33c9..f533d58d60 100644 --- a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp +++ b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp @@ -59,9 +59,9 @@ void btMinkowskiSumShape::calculateLocalInertia(btScalar mass, btVector3& inerti btScalar margin = getMargin(); - btScalar lx = btScalar(2.) * (halfExtents.m_floats[0] + margin); - btScalar ly = btScalar(2.) * (halfExtents.m_floats[1] + margin); - btScalar lz = btScalar(2.) * (halfExtents.m_floats[2] + margin); + btScalar lx = btScalar(2.) * (halfExtents.x + margin); + btScalar ly = btScalar(2.) * (halfExtents.y + margin); + btScalar lz = btScalar(2.) * (halfExtents.z + margin); const btScalar x2 = lx * lx; const btScalar y2 = ly * ly; const btScalar z2 = lz * lz; diff --git a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp index 0b77f95b23..0789d53331 100644 --- a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp +++ b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp @@ -131,9 +131,9 @@ void btMultiSphereShape::calculateLocalInertia(btScalar mass, btVector3& inertia getCachedLocalAabb(localAabbMin, localAabbMax); btVector3 halfExtents = (localAabbMax - localAabbMin) * btScalar(0.5); - btScalar lx = btScalar(2.) * (halfExtents.m_floats[0]); - btScalar ly = btScalar(2.) * (halfExtents.m_floats[1]); - btScalar lz = btScalar(2.) * (halfExtents.m_floats[2]); + btScalar lx = btScalar(2.) * (halfExtents.x); + btScalar ly = btScalar(2.) * (halfExtents.y); + btScalar lz = btScalar(2.) * (halfExtents.z); inertia.setValue(mass / (btScalar(12.0)) * (ly * ly + lz * lz), mass / (btScalar(12.0)) * (lx * lx + lz * lz), diff --git a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btOptimizedBvh.cpp b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btOptimizedBvh.cpp index a1b926b4ed..b817c87a15 100644 --- a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btOptimizedBvh.cpp +++ b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btOptimizedBvh.cpp @@ -111,20 +111,20 @@ void btOptimizedBvh::build(btStridingMeshInterface* triangles, bool useQuantized //PCK: add these checks for zero dimensions of aabb const btScalar MIN_AABB_DIMENSION = btScalar(0.002); const btScalar MIN_AABB_HALF_DIMENSION = btScalar(0.001); - if (aabbMax.m_floats[0] - aabbMin.m_floats[0] < MIN_AABB_DIMENSION) + if (aabbMax.x - aabbMin.x < MIN_AABB_DIMENSION) { - aabbMax.m_floats[0] = (aabbMax.m_floats[0] + MIN_AABB_HALF_DIMENSION); - aabbMin.m_floats[0] = (aabbMin.m_floats[0] - MIN_AABB_HALF_DIMENSION); + aabbMax.x = (aabbMax.x + MIN_AABB_HALF_DIMENSION); + aabbMin.x = (aabbMin.x - MIN_AABB_HALF_DIMENSION); } - if (aabbMax.m_floats[1] - aabbMin.m_floats[1] < MIN_AABB_DIMENSION) + if (aabbMax.y - aabbMin.y < MIN_AABB_DIMENSION) { - aabbMax.m_floats[1] = (aabbMax.m_floats[1] + MIN_AABB_HALF_DIMENSION); - aabbMin.m_floats[1] = (aabbMin.m_floats[1] - MIN_AABB_HALF_DIMENSION); + aabbMax.y = (aabbMax.y + MIN_AABB_HALF_DIMENSION); + aabbMin.y = (aabbMin.y - MIN_AABB_HALF_DIMENSION); } - if (aabbMax.m_floats[2] - aabbMin.m_floats[2] < MIN_AABB_DIMENSION) + if (aabbMax.z - aabbMin.z < MIN_AABB_DIMENSION) { - aabbMax.m_floats[2] = (aabbMax.m_floats[2] + MIN_AABB_HALF_DIMENSION); - aabbMin.m_floats[2] = (aabbMin.m_floats[2] - MIN_AABB_HALF_DIMENSION); + aabbMax.z = (aabbMax.z + MIN_AABB_HALF_DIMENSION); + aabbMin.z = (aabbMin.z - MIN_AABB_HALF_DIMENSION); } m_optimizedTree->quantize(&node.m_quantizedAabbMin[0], aabbMin, 0); @@ -215,13 +215,13 @@ void btOptimizedBvh::refitPartial(btStridingMeshInterface* meshInterface, const //incrementally initialize quantization values btAssert(m_useQuantization); - btAssert(aabbMin.m_floats[0] > m_bvhAabbMin.m_floats[0]); - btAssert(aabbMin.m_floats[1] > m_bvhAabbMin.m_floats[1]); - btAssert(aabbMin.m_floats[2] > m_bvhAabbMin.m_floats[2]); + btAssert(aabbMin.x > m_bvhAabbMin.x); + btAssert(aabbMin.y > m_bvhAabbMin.y); + btAssert(aabbMin.z > m_bvhAabbMin.z); - btAssert(aabbMax.m_floats[0] < m_bvhAabbMax.m_floats[0]); - btAssert(aabbMax.m_floats[1] < m_bvhAabbMax.m_floats[1]); - btAssert(aabbMax.m_floats[2] < m_bvhAabbMax.m_floats[2]); + btAssert(aabbMax.x < m_bvhAabbMax.x); + btAssert(aabbMax.y < m_bvhAabbMax.y); + btAssert(aabbMax.z < m_bvhAabbMax.z); ///we should update all quantization values, using updateBvhNodes(meshInterface); ///but we only update chunks that overlap the given aabb @@ -304,14 +304,14 @@ void btOptimizedBvh::updateBvhNodes(btStridingMeshInterface* meshInterface, int { float* graphicsbase = (float*)(vertexbase + graphicsindex * stride); triangleVerts[j] = btVector3( - graphicsbase[0] * meshScaling.m_floats[0], - graphicsbase[1] * meshScaling.m_floats[1], - graphicsbase[2] * meshScaling.m_floats[2]); + graphicsbase[0] * meshScaling.x, + graphicsbase[1] * meshScaling.y, + graphicsbase[2] * meshScaling.z); } else { double* graphicsbase = (double*)(vertexbase + graphicsindex * stride); - triangleVerts[j] = btVector3(btScalar(graphicsbase[0] * meshScaling.m_floats[0]), btScalar(graphicsbase[1] * meshScaling.m_floats[1]), btScalar(graphicsbase[2] * meshScaling.m_floats[2])); + triangleVerts[j] = btVector3(btScalar(graphicsbase[0] * meshScaling.x), btScalar(graphicsbase[1] * meshScaling.y), btScalar(graphicsbase[2] * meshScaling.z)); } } diff --git a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp index d16c770c78..690bf3ec63 100644 --- a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp +++ b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp @@ -89,11 +89,11 @@ bool btPolyhedralConvexShape::initializePolyhedralFeatures(int shiftVerticesByMa btGeometryUtil::getVerticesFromPlaneEquations(shiftedPlaneEquations, tmpVertices); - conv.compute(&tmpVertices[0].m_floats[0], sizeof(btVector3), tmpVertices.size(), 0.f, 0.f); + conv.compute(&tmpVertices[0].x, sizeof(btVector3), tmpVertices.size(), 0.f, 0.f); } else { - conv.compute(&orgVertices[0].m_floats[0], sizeof(btVector3), orgVertices.size(), 0.f, 0.f); + conv.compute(&orgVertices[0].x, sizeof(btVector3), orgVertices.size(), 0.f, 0.f); } #ifndef BT_RECONSTRUCT_FACES @@ -148,9 +148,9 @@ bool btPolyhedralConvexShape::initializePolyhedralFeatures(int shiftVerticesByMa planeEq = eq; } } - combinedFace.m_plane[0] = faceNormal.m_floats[0]; - combinedFace.m_plane[1] = faceNormal.m_floats[1]; - combinedFace.m_plane[2] = faceNormal.m_floats[2]; + combinedFace.m_plane[0] = faceNormal.x; + combinedFace.m_plane[1] = faceNormal.y; + combinedFace.m_plane[2] = faceNormal.z; combinedFace.m_plane[3] = -planeEq; m_polyhedron->m_faces.push_back(combinedFace); @@ -206,9 +206,9 @@ bool btPolyhedralConvexShape::initializePolyhedralFeatures(int shiftVerticesByMa { faceNormals[i] = edges[0].cross(edges[1]); faceNormals[i].normalize(); - tmpFaces[i].m_plane[0] = faceNormals[i].m_floats[0]; - tmpFaces[i].m_plane[1] = faceNormals[i].m_floats[1]; - tmpFaces[i].m_plane[2] = faceNormals[i].m_floats[2]; + tmpFaces[i].m_plane[0] = faceNormals[i].x; + tmpFaces[i].m_plane[1] = faceNormals[i].y; + tmpFaces[i].m_plane[2] = faceNormals[i].z; tmpFaces[i].m_plane[3] = planeEq; } else @@ -471,9 +471,9 @@ void btPolyhedralConvexShape::calculateLocalInertia(btScalar mass, btVector3& in getAabb(ident, aabbMin, aabbMax); btVector3 halfExtents = (aabbMax - aabbMin) * btScalar(0.5); - btScalar lx = btScalar(2.) * (halfExtents.m_floats[0] + margin); - btScalar ly = btScalar(2.) * (halfExtents.m_floats[1] + margin); - btScalar lz = btScalar(2.) * (halfExtents.m_floats[2] + margin); + btScalar lx = btScalar(2.) * (halfExtents.x + margin); + btScalar ly = btScalar(2.) * (halfExtents.y + margin); + btScalar lz = btScalar(2.) * (halfExtents.z + margin); const btScalar x2 = lx * lx; const btScalar y2 = ly * ly; const btScalar z2 = lz * lz; diff --git a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp index d6e2cf2428..83000b8f4b 100644 --- a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp +++ b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp @@ -52,18 +52,18 @@ void btScaledBvhTriangleMeshShape::processAllTriangles(btTriangleCallback* callb { btScaledTriangleCallback scaledCallback(callback, m_localScaling); - btVector3 invLocalScaling(1.f / m_localScaling.m_floats[0], 1.f / m_localScaling.m_floats[1], 1.f / m_localScaling.m_floats[2]); + btVector3 invLocalScaling(1.f / m_localScaling.x, 1.f / m_localScaling.y, 1.f / m_localScaling.z); btVector3 scaledAabbMin, scaledAabbMax; ///support negative scaling - scaledAabbMin[0] = m_localScaling.m_floats[0] >= 0. ? aabbMin[0] * invLocalScaling[0] : aabbMax[0] * invLocalScaling[0]; - scaledAabbMin[1] = m_localScaling.m_floats[1] >= 0. ? aabbMin[1] * invLocalScaling[1] : aabbMax[1] * invLocalScaling[1]; - scaledAabbMin[2] = m_localScaling.m_floats[2] >= 0. ? aabbMin[2] * invLocalScaling[2] : aabbMax[2] * invLocalScaling[2]; + scaledAabbMin[0] = m_localScaling.x >= 0. ? aabbMin[0] * invLocalScaling[0] : aabbMax[0] * invLocalScaling[0]; + scaledAabbMin[1] = m_localScaling.y >= 0. ? aabbMin[1] * invLocalScaling[1] : aabbMax[1] * invLocalScaling[1]; + scaledAabbMin[2] = m_localScaling.z >= 0. ? aabbMin[2] * invLocalScaling[2] : aabbMax[2] * invLocalScaling[2]; scaledAabbMin[3] = 0.f; - scaledAabbMax[0] = m_localScaling.m_floats[0] <= 0. ? aabbMin[0] * invLocalScaling[0] : aabbMax[0] * invLocalScaling[0]; - scaledAabbMax[1] = m_localScaling.m_floats[1] <= 0. ? aabbMin[1] * invLocalScaling[1] : aabbMax[1] * invLocalScaling[1]; - scaledAabbMax[2] = m_localScaling.m_floats[2] <= 0. ? aabbMin[2] * invLocalScaling[2] : aabbMax[2] * invLocalScaling[2]; + scaledAabbMax[0] = m_localScaling.x <= 0. ? aabbMin[0] * invLocalScaling[0] : aabbMax[0] * invLocalScaling[0]; + scaledAabbMax[1] = m_localScaling.y <= 0. ? aabbMin[1] * invLocalScaling[1] : aabbMax[1] * invLocalScaling[1]; + scaledAabbMax[2] = m_localScaling.z <= 0. ? aabbMin[2] * invLocalScaling[2] : aabbMax[2] * invLocalScaling[2]; scaledAabbMax[3] = 0.f; m_bvhTriMeshShape->processAllTriangles(&scaledCallback, scaledAabbMin, scaledAabbMax); @@ -77,12 +77,12 @@ void btScaledBvhTriangleMeshShape::getAabb(const btTransform& trans, btVector3& btVector3 tmpLocalAabbMin = localAabbMin * m_localScaling; btVector3 tmpLocalAabbMax = localAabbMax * m_localScaling; - localAabbMin[0] = (m_localScaling.m_floats[0] >= 0.) ? tmpLocalAabbMin[0] : tmpLocalAabbMax[0]; - localAabbMin[1] = (m_localScaling.m_floats[1] >= 0.) ? tmpLocalAabbMin[1] : tmpLocalAabbMax[1]; - localAabbMin[2] = (m_localScaling.m_floats[2] >= 0.) ? tmpLocalAabbMin[2] : tmpLocalAabbMax[2]; - localAabbMax[0] = (m_localScaling.m_floats[0] <= 0.) ? tmpLocalAabbMin[0] : tmpLocalAabbMax[0]; - localAabbMax[1] = (m_localScaling.m_floats[1] <= 0.) ? tmpLocalAabbMin[1] : tmpLocalAabbMax[1]; - localAabbMax[2] = (m_localScaling.m_floats[2] <= 0.) ? tmpLocalAabbMin[2] : tmpLocalAabbMax[2]; + localAabbMin[0] = (m_localScaling.x >= 0.) ? tmpLocalAabbMin[0] : tmpLocalAabbMax[0]; + localAabbMin[1] = (m_localScaling.y >= 0.) ? tmpLocalAabbMin[1] : tmpLocalAabbMax[1]; + localAabbMin[2] = (m_localScaling.z >= 0.) ? tmpLocalAabbMin[2] : tmpLocalAabbMax[2]; + localAabbMax[0] = (m_localScaling.x <= 0.) ? tmpLocalAabbMin[0] : tmpLocalAabbMax[0]; + localAabbMax[1] = (m_localScaling.y <= 0.) ? tmpLocalAabbMin[1] : tmpLocalAabbMax[1]; + localAabbMax[2] = (m_localScaling.z <= 0.) ? tmpLocalAabbMin[2] : tmpLocalAabbMax[2]; btVector3 localHalfExtents = btScalar(0.5) * (localAabbMax - localAabbMin); btScalar margin = m_bvhTriMeshShape->getMargin(); diff --git a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btSphereShape.h b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btSphereShape.h index a98089876b..3f2da2c6eb 100644 --- a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btSphereShape.h +++ b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btSphereShape.h @@ -31,7 +31,7 @@ btSphereShape : public btConvexInternalShape m_shapeType = SPHERE_SHAPE_PROXYTYPE; m_localScaling.setValue(1.0, 1.0, 1.0); m_implicitShapeDimensions.setZero(); - m_implicitShapeDimensions.m_floats[0] = (radius); + m_implicitShapeDimensions.x = (radius); m_collisionMargin = radius; m_padding = 0; } @@ -45,11 +45,11 @@ btSphereShape : public btConvexInternalShape virtual void getAabb(const btTransform& t, btVector3& aabbMin, btVector3& aabbMax) const; - btScalar getRadius() const { return m_implicitShapeDimensions.m_floats[0] * m_localScaling.m_floats[0]; } + btScalar getRadius() const { return m_implicitShapeDimensions.x * m_localScaling.x; } void setUnscaledRadius(btScalar radius) { - m_implicitShapeDimensions.m_floats[0] = (radius); + m_implicitShapeDimensions.x = (radius); btConvexInternalShape::setMargin(radius); } diff --git a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btStridingMeshInterface.cpp b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btStridingMeshInterface.cpp index b378dd7711..bfe3c37c91 100644 --- a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btStridingMeshInterface.cpp +++ b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btStridingMeshInterface.cpp @@ -61,11 +61,11 @@ void btStridingMeshInterface::InternalProcessAllTriangles(btInternalTriangleInde { unsigned int* tri_indices = (unsigned int*)(indexbase + gfxindex * indexstride); graphicsbase = (float*)(vertexbase + tri_indices[0] * stride); - triangle[0].setValue(graphicsbase[0] * meshScaling.m_floats[0], graphicsbase[1] * meshScaling.m_floats[1], graphicsbase[2] * meshScaling.m_floats[2]); + triangle[0].setValue(graphicsbase[0] * meshScaling.x, graphicsbase[1] * meshScaling.y, graphicsbase[2] * meshScaling.z); graphicsbase = (float*)(vertexbase + tri_indices[1] * stride); - triangle[1].setValue(graphicsbase[0] * meshScaling.m_floats[0], graphicsbase[1] * meshScaling.m_floats[1], graphicsbase[2] * meshScaling.m_floats[2]); + triangle[1].setValue(graphicsbase[0] * meshScaling.x, graphicsbase[1] * meshScaling.y, graphicsbase[2] * meshScaling.z); graphicsbase = (float*)(vertexbase + tri_indices[2] * stride); - triangle[2].setValue(graphicsbase[0] * meshScaling.m_floats[0], graphicsbase[1] * meshScaling.m_floats[1], graphicsbase[2] * meshScaling.m_floats[2]); + triangle[2].setValue(graphicsbase[0] * meshScaling.x, graphicsbase[1] * meshScaling.y, graphicsbase[2] * meshScaling.z); callback->internalProcessTriangleIndex(triangle, part, gfxindex); } break; @@ -76,11 +76,11 @@ void btStridingMeshInterface::InternalProcessAllTriangles(btInternalTriangleInde { unsigned short int* tri_indices = (unsigned short int*)(indexbase + gfxindex * indexstride); graphicsbase = (float*)(vertexbase + tri_indices[0] * stride); - triangle[0].setValue(graphicsbase[0] * meshScaling.m_floats[0], graphicsbase[1] * meshScaling.m_floats[1], graphicsbase[2] * meshScaling.m_floats[2]); + triangle[0].setValue(graphicsbase[0] * meshScaling.x, graphicsbase[1] * meshScaling.y, graphicsbase[2] * meshScaling.z); graphicsbase = (float*)(vertexbase + tri_indices[1] * stride); - triangle[1].setValue(graphicsbase[0] * meshScaling.m_floats[0], graphicsbase[1] * meshScaling.m_floats[1], graphicsbase[2] * meshScaling.m_floats[2]); + triangle[1].setValue(graphicsbase[0] * meshScaling.x, graphicsbase[1] * meshScaling.y, graphicsbase[2] * meshScaling.z); graphicsbase = (float*)(vertexbase + tri_indices[2] * stride); - triangle[2].setValue(graphicsbase[0] * meshScaling.m_floats[0], graphicsbase[1] * meshScaling.m_floats[1], graphicsbase[2] * meshScaling.m_floats[2]); + triangle[2].setValue(graphicsbase[0] * meshScaling.x, graphicsbase[1] * meshScaling.y, graphicsbase[2] * meshScaling.z); callback->internalProcessTriangleIndex(triangle, part, gfxindex); } break; @@ -91,11 +91,11 @@ void btStridingMeshInterface::InternalProcessAllTriangles(btInternalTriangleInde { unsigned char* tri_indices = (unsigned char*)(indexbase + gfxindex * indexstride); graphicsbase = (float*)(vertexbase + tri_indices[0] * stride); - triangle[0].setValue(graphicsbase[0] * meshScaling.m_floats[0], graphicsbase[1] * meshScaling.m_floats[1], graphicsbase[2] * meshScaling.m_floats[2]); + triangle[0].setValue(graphicsbase[0] * meshScaling.x, graphicsbase[1] * meshScaling.y, graphicsbase[2] * meshScaling.z); graphicsbase = (float*)(vertexbase + tri_indices[1] * stride); - triangle[1].setValue(graphicsbase[0] * meshScaling.m_floats[0], graphicsbase[1] * meshScaling.m_floats[1], graphicsbase[2] * meshScaling.m_floats[2]); + triangle[1].setValue(graphicsbase[0] * meshScaling.x, graphicsbase[1] * meshScaling.y, graphicsbase[2] * meshScaling.z); graphicsbase = (float*)(vertexbase + tri_indices[2] * stride); - triangle[2].setValue(graphicsbase[0] * meshScaling.m_floats[0], graphicsbase[1] * meshScaling.m_floats[1], graphicsbase[2] * meshScaling.m_floats[2]); + triangle[2].setValue(graphicsbase[0] * meshScaling.x, graphicsbase[1] * meshScaling.y, graphicsbase[2] * meshScaling.z); callback->internalProcessTriangleIndex(triangle, part, gfxindex); } break; @@ -118,11 +118,11 @@ void btStridingMeshInterface::InternalProcessAllTriangles(btInternalTriangleInde { unsigned int* tri_indices = (unsigned int*)(indexbase + gfxindex * indexstride); graphicsbase = (double*)(vertexbase + tri_indices[0] * stride); - triangle[0].setValue((btScalar)graphicsbase[0] * meshScaling.m_floats[0], (btScalar)graphicsbase[1] * meshScaling.m_floats[1], (btScalar)graphicsbase[2] * meshScaling.m_floats[2]); + triangle[0].setValue((btScalar)graphicsbase[0] * meshScaling.x, (btScalar)graphicsbase[1] * meshScaling.y, (btScalar)graphicsbase[2] * meshScaling.z); graphicsbase = (double*)(vertexbase + tri_indices[1] * stride); - triangle[1].setValue((btScalar)graphicsbase[0] * meshScaling.m_floats[0], (btScalar)graphicsbase[1] * meshScaling.m_floats[1], (btScalar)graphicsbase[2] * meshScaling.m_floats[2]); + triangle[1].setValue((btScalar)graphicsbase[0] * meshScaling.x, (btScalar)graphicsbase[1] * meshScaling.y, (btScalar)graphicsbase[2] * meshScaling.z); graphicsbase = (double*)(vertexbase + tri_indices[2] * stride); - triangle[2].setValue((btScalar)graphicsbase[0] * meshScaling.m_floats[0], (btScalar)graphicsbase[1] * meshScaling.m_floats[1], (btScalar)graphicsbase[2] * meshScaling.m_floats[2]); + triangle[2].setValue((btScalar)graphicsbase[0] * meshScaling.x, (btScalar)graphicsbase[1] * meshScaling.y, (btScalar)graphicsbase[2] * meshScaling.z); callback->internalProcessTriangleIndex(triangle, part, gfxindex); } break; @@ -133,11 +133,11 @@ void btStridingMeshInterface::InternalProcessAllTriangles(btInternalTriangleInde { unsigned short int* tri_indices = (unsigned short int*)(indexbase + gfxindex * indexstride); graphicsbase = (double*)(vertexbase + tri_indices[0] * stride); - triangle[0].setValue((btScalar)graphicsbase[0] * meshScaling.m_floats[0], (btScalar)graphicsbase[1] * meshScaling.m_floats[1], (btScalar)graphicsbase[2] * meshScaling.m_floats[2]); + triangle[0].setValue((btScalar)graphicsbase[0] * meshScaling.x, (btScalar)graphicsbase[1] * meshScaling.y, (btScalar)graphicsbase[2] * meshScaling.z); graphicsbase = (double*)(vertexbase + tri_indices[1] * stride); - triangle[1].setValue((btScalar)graphicsbase[0] * meshScaling.m_floats[0], (btScalar)graphicsbase[1] * meshScaling.m_floats[1], (btScalar)graphicsbase[2] * meshScaling.m_floats[2]); + triangle[1].setValue((btScalar)graphicsbase[0] * meshScaling.x, (btScalar)graphicsbase[1] * meshScaling.y, (btScalar)graphicsbase[2] * meshScaling.z); graphicsbase = (double*)(vertexbase + tri_indices[2] * stride); - triangle[2].setValue((btScalar)graphicsbase[0] * meshScaling.m_floats[0], (btScalar)graphicsbase[1] * meshScaling.m_floats[1], (btScalar)graphicsbase[2] * meshScaling.m_floats[2]); + triangle[2].setValue((btScalar)graphicsbase[0] * meshScaling.x, (btScalar)graphicsbase[1] * meshScaling.y, (btScalar)graphicsbase[2] * meshScaling.z); callback->internalProcessTriangleIndex(triangle, part, gfxindex); } break; @@ -148,11 +148,11 @@ void btStridingMeshInterface::InternalProcessAllTriangles(btInternalTriangleInde { unsigned char* tri_indices = (unsigned char*)(indexbase + gfxindex * indexstride); graphicsbase = (double*)(vertexbase + tri_indices[0] * stride); - triangle[0].setValue((btScalar)graphicsbase[0] * meshScaling.m_floats[0], (btScalar)graphicsbase[1] * meshScaling.m_floats[1], (btScalar)graphicsbase[2] * meshScaling.m_floats[2]); + triangle[0].setValue((btScalar)graphicsbase[0] * meshScaling.x, (btScalar)graphicsbase[1] * meshScaling.y, (btScalar)graphicsbase[2] * meshScaling.z); graphicsbase = (double*)(vertexbase + tri_indices[1] * stride); - triangle[1].setValue((btScalar)graphicsbase[0] * meshScaling.m_floats[0], (btScalar)graphicsbase[1] * meshScaling.m_floats[1], (btScalar)graphicsbase[2] * meshScaling.m_floats[2]); + triangle[1].setValue((btScalar)graphicsbase[0] * meshScaling.x, (btScalar)graphicsbase[1] * meshScaling.y, (btScalar)graphicsbase[2] * meshScaling.z); graphicsbase = (double*)(vertexbase + tri_indices[2] * stride); - triangle[2].setValue((btScalar)graphicsbase[0] * meshScaling.m_floats[0], (btScalar)graphicsbase[1] * meshScaling.m_floats[1], (btScalar)graphicsbase[2] * meshScaling.m_floats[2]); + triangle[2].setValue((btScalar)graphicsbase[0] * meshScaling.x, (btScalar)graphicsbase[1] * meshScaling.y, (btScalar)graphicsbase[2] * meshScaling.z); callback->internalProcessTriangleIndex(triangle, part, gfxindex); } break; @@ -334,9 +334,9 @@ const char* btStridingMeshInterface::serialize(void* dataBuffer, btSerializer* s for (int i = 0; i < numverts; i++) { graphicsbase = (float*)(vertexbase + i * stride); - tmpVertices[i].m_floats[0] = graphicsbase[0]; - tmpVertices[i].m_floats[1] = graphicsbase[1]; - tmpVertices[i].m_floats[2] = graphicsbase[2]; + tmpVertices[i].x = graphicsbase[0]; + tmpVertices[i].y = graphicsbase[1]; + tmpVertices[i].z = graphicsbase[2]; } serializer->finalizeChunk(chunk, "btVector3FloatData", BT_ARRAY_CODE, (void*)chunk->m_oldPtr); } @@ -353,9 +353,9 @@ const char* btStridingMeshInterface::serialize(void* dataBuffer, btSerializer* s for (int i = 0; i < numverts; i++) { double* graphicsbase = (double*)(vertexbase + i * stride); //for now convert to float, might leave it at double - tmpVertices[i].m_floats[0] = graphicsbase[0]; - tmpVertices[i].m_floats[1] = graphicsbase[1]; - tmpVertices[i].m_floats[2] = graphicsbase[2]; + tmpVertices[i].x = graphicsbase[0]; + tmpVertices[i].y = graphicsbase[1]; + tmpVertices[i].z = graphicsbase[2]; } serializer->finalizeChunk(chunk, "btVector3DoubleData", BT_ARRAY_CODE, (void*)chunk->m_oldPtr); } diff --git a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btTriangleMesh.cpp b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btTriangleMesh.cpp index e1db0e571e..4266a3112d 100644 --- a/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btTriangleMesh.cpp +++ b/3rdparty/bullet3/src/BulletCollision/CollisionShapes/btTriangleMesh.cpp @@ -116,9 +116,9 @@ int btTriangleMesh::findOrAddVertex(const btVector3& vertex, bool removeDuplicat } } } - m_3componentVertices.push_back(vertex.m_floats[0]); - m_3componentVertices.push_back(vertex.m_floats[1]); - m_3componentVertices.push_back(vertex.m_floats[2]); + m_3componentVertices.push_back(vertex.x); + m_3componentVertices.push_back(vertex.y); + m_3componentVertices.push_back(vertex.z); m_indexedMeshes[0].m_numVertices++; m_indexedMeshes[0].m_vertexBase = (unsigned char*)&m_3componentVertices[0]; return (m_3componentVertices.size() / 3) - 1; diff --git a/3rdparty/bullet3/src/BulletCollision/NarrowPhaseCollision/btComputeGjkEpaPenetration.h b/3rdparty/bullet3/src/BulletCollision/NarrowPhaseCollision/btComputeGjkEpaPenetration.h index e0df704a7c..6ea427fd9a 100644 --- a/3rdparty/bullet3/src/BulletCollision/NarrowPhaseCollision/btComputeGjkEpaPenetration.h +++ b/3rdparty/bullet3/src/BulletCollision/NarrowPhaseCollision/btComputeGjkEpaPenetration.h @@ -195,9 +195,9 @@ int btComputeGjkEpaPenetration(const btConvexTemplate& a, const btConvexTemplate printf("btGjkPairDetector maxIter exceeded:%i\n", m_curIter); printf("sepAxis=(%f,%f,%f), squaredDistance = %f\n", - m_cachedSeparatingAxis.m_floats[0], - m_cachedSeparatingAxis.m_floats[1], - m_cachedSeparatingAxis.m_floats[2], + m_cachedSeparatingAxis.x, + m_cachedSeparatingAxis.y, + m_cachedSeparatingAxis.z, squaredDistance); #endif diff --git a/3rdparty/bullet3/src/BulletCollision/NarrowPhaseCollision/btGjkEpa2.cpp b/3rdparty/bullet3/src/BulletCollision/NarrowPhaseCollision/btGjkEpa2.cpp index 02098a81c6..2d4db96bd5 100644 --- a/3rdparty/bullet3/src/BulletCollision/NarrowPhaseCollision/btGjkEpa2.cpp +++ b/3rdparty/bullet3/src/BulletCollision/NarrowPhaseCollision/btGjkEpa2.cpp @@ -418,9 +418,9 @@ struct GJK } static btScalar det(const btVector3& a, const btVector3& b, const btVector3& c) { - return (a.m_floats[1] * b.m_floats[2] * c.m_floats[0] + a.m_floats[2] * b.m_floats[0] * c.m_floats[1] - - a.m_floats[0] * b.m_floats[2] * c.m_floats[1] - a.m_floats[1] * b.m_floats[0] * c.m_floats[2] + - a.m_floats[0] * b.m_floats[1] * c.m_floats[2] - a.m_floats[2] * b.m_floats[1] * c.m_floats[0]); + return (a.y * b.z * c.x + a.z * b.x * c.y - + a.x * b.z * c.y - a.y * b.x * c.z + + a.x * b.y * c.z - a.z * b.y * c.x); } static btScalar projectorigin(const btVector3& a, const btVector3& b, diff --git a/3rdparty/bullet3/src/BulletCollision/NarrowPhaseCollision/btGjkEpa3.h b/3rdparty/bullet3/src/BulletCollision/NarrowPhaseCollision/btGjkEpa3.h index 6b1b0fa659..7581febb9b 100644 --- a/3rdparty/bullet3/src/BulletCollision/NarrowPhaseCollision/btGjkEpa3.h +++ b/3rdparty/bullet3/src/BulletCollision/NarrowPhaseCollision/btGjkEpa3.h @@ -392,9 +392,9 @@ struct GJK } static btScalar det(const btVector3& a, const btVector3& b, const btVector3& c) { - return (a.m_floats[1] * b.m_floats[2] * c.m_floats[0] + a.m_floats[2] * b.m_floats[0] * c.m_floats[1] - - a.m_floats[0] * b.m_floats[2] * c.m_floats[1] - a.m_floats[1] * b.m_floats[0] * c.m_floats[2] + - a.m_floats[0] * b.m_floats[1] * c.m_floats[2] - a.m_floats[2] * b.m_floats[1] * c.m_floats[0]); + return (a.y * b.z * c.x + a.z * b.x * c.y - + a.x * b.z * c.y - a.y * b.x * c.z + + a.x * b.y * c.z - a.z * b.y * c.x); } static btScalar projectorigin(const btVector3& a, const btVector3& b, diff --git a/3rdparty/bullet3/src/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp b/3rdparty/bullet3/src/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp index 3a7841ebd5..9098ad2256 100644 --- a/3rdparty/bullet3/src/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp +++ b/3rdparty/bullet3/src/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp @@ -142,9 +142,9 @@ inline void btVec3Copy(btVector3 *v, const btVector3 *w) inline void ccdVec3Add(btVector3 *v, const btVector3 *w) { - v->m_floats[0] += w->m_floats[0]; - v->m_floats[1] += w->m_floats[1]; - v->m_floats[2] += w->m_floats[2]; + v->x += w->x; + v->y += w->y; + v->z += w->z; } inline void ccdVec3Sub(btVector3 *v, const btVector3 *w) @@ -172,16 +172,16 @@ inline btScalar ccdVec3Dist2(const btVector3 *a, const btVector3 *b) inline void btVec3Scale(btVector3 *d, btScalar k) { - d->m_floats[0] *= k; - d->m_floats[1] *= k; - d->m_floats[2] *= k; + d->x *= k; + d->y *= k; + d->z *= k; } inline void btVec3Cross(btVector3 *d, const btVector3 *a, const btVector3 *b) { - d->m_floats[0] = (a->m_floats[1] * b->m_floats[2]) - (a->m_floats[2] * b->m_floats[1]); - d->m_floats[1] = (a->m_floats[2] * b->m_floats[0]) - (a->m_floats[0] * b->m_floats[2]); - d->m_floats[2] = (a->m_floats[0] * b->m_floats[1]) - (a->m_floats[1] * b->m_floats[0]); + d->x = (a->y * b->z) - (a->z * b->y); + d->y = (a->z * b->x) - (a->x * b->z); + d->z = (a->x * b->y) - (a->y * b->x); } inline void btTripleCross(const btVector3 *a, const btVector3 *b, @@ -215,17 +215,17 @@ inline int ccdEq(btScalar _a, btScalar _b) btScalar ccdVec3X(const btVector3 *v) { - return v->m_floats[0]; + return v->x; } btScalar ccdVec3Y(const btVector3 *v) { - return v->m_floats[1]; + return v->y; } btScalar ccdVec3Z(const btVector3 *v) { - return v->m_floats[2]; + return v->z; } inline int btVec3Eq(const btVector3 *a, const btVector3 *b) { @@ -945,9 +945,9 @@ void btGjkPairDetector::getClosestPointsNonVirtual(const ClosestPointInput &inpu printf("btGjkPairDetector maxIter exceeded:%i\n", m_curIter); printf("sepAxis=(%f,%f,%f), squaredDistance = %f, shapeTypeA=%i,shapeTypeB=%i\n", - m_cachedSeparatingAxis.m_floats[0], - m_cachedSeparatingAxis.m_floats[1], - m_cachedSeparatingAxis.m_floats[2], + m_cachedSeparatingAxis.x, + m_cachedSeparatingAxis.y, + m_cachedSeparatingAxis.z, squaredDistance, m_minkowskiA->m_shapeType, m_minkowskiB->m_shapeType); diff --git a/3rdparty/bullet3/src/BulletCollision/NarrowPhaseCollision/btMprPenetration.h b/3rdparty/bullet3/src/BulletCollision/NarrowPhaseCollision/btMprPenetration.h index e8d676b0c9..b4a04063cf 100644 --- a/3rdparty/bullet3/src/BulletCollision/NarrowPhaseCollision/btMprPenetration.h +++ b/3rdparty/bullet3/src/BulletCollision/NarrowPhaseCollision/btMprPenetration.h @@ -94,9 +94,9 @@ inline void btMprSimplexSetSize(btMprSimplex_t *s, int size) #ifdef DEBUG_MPR inline void btPrintPortalVertex(_btMprSimplex_t *portal, int index) { - printf("portal[%d].v = %f,%f,%f, v1=%f,%f,%f, v2=%f,%f,%f\n", index, portal->ps[index].v.m_floats[0], portal->ps[index].v.m_floats[1], portal->ps[index].v.m_floats[2], - portal->ps[index].v1.m_floats[0], portal->ps[index].v1.m_floats[1], portal->ps[index].v1.m_floats[2], - portal->ps[index].v2.m_floats[0], portal->ps[index].v2.m_floats[1], portal->ps[index].v2.m_floats[2]); + printf("portal[%d].v = %f,%f,%f, v1=%f,%f,%f, v2=%f,%f,%f\n", index, portal->ps[index].v.x, portal->ps[index].v.y, portal->ps[index].v.z, + portal->ps[index].v1.x, portal->ps[index].v1.y, portal->ps[index].v1.z, + portal->ps[index].v2.x, portal->ps[index].v2.y, portal->ps[index].v2.z); } #endif //DEBUG_MPR @@ -158,7 +158,7 @@ inline int btMprEq(float _a, float _b) inline int btMprVec3Eq(const btVector3 *a, const btVector3 *b) { - return btMprEq((*a).m_floats[0], (*b).m_floats[0]) && btMprEq((*a).m_floats[1], (*b).m_floats[1]) && btMprEq((*a).m_floats[2], (*b).m_floats[2]); + return btMprEq((*a).x, (*b).x) && btMprEq((*a).y, (*b).y) && btMprEq((*a).z, (*b).z); } template @@ -754,7 +754,7 @@ static void btFindPenetr(const btConvexTemplate &a, const btConvexTemplate &b, *depth = btMprVec3PointTriDist2(origin, &btMprSimplexPoint(portal, 1)->v, &btMprSimplexPoint(portal, 2)->v, &btMprSimplexPoint(portal, 3)->v, pdir); *depth = BT_MPR_SQRT(*depth); - if (btMprIsZero((*pdir).m_floats[0]) && btMprIsZero((*pdir).m_floats[1]) && btMprIsZero((*pdir).m_floats[2])) + if (btMprIsZero((*pdir).x) && btMprIsZero((*pdir).y) && btMprIsZero((*pdir).z)) { *pdir = dir; } diff --git a/3rdparty/bullet3/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp b/3rdparty/bullet3/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp index 784769b44a..a6fd7fe8c7 100644 --- a/3rdparty/bullet3/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp +++ b/3rdparty/bullet3/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp @@ -249,12 +249,12 @@ void btPersistentManifold::refreshContactPoints(const btTransform& trA, const bt int i; #ifdef DEBUG_PERSISTENCY printf("refreshContactPoints posA = (%f,%f,%f) posB = (%f,%f,%f)\n", - trA.m_origin.m_floats[0], - trA.m_origin.m_floats[1], - trA.m_origin.m_floats[2], - trB.m_origin.m_floats[0], - trB.m_origin.m_floats[1], - trB.m_origin.m_floats[2]); + trA.m_origin.x, + trA.m_origin.y, + trA.m_origin.z, + trB.m_origin.x, + trB.m_origin.y, + trB.m_origin.z); #endif //DEBUG_PERSISTENCY /// first refresh worldspace positions and distance for (i = getNumContacts() - 1; i >= 0; i--) diff --git a/3rdparty/bullet3/src/BulletCollision/NarrowPhaseCollision/btPolyhedralContactClipping.cpp b/3rdparty/bullet3/src/BulletCollision/NarrowPhaseCollision/btPolyhedralContactClipping.cpp index 72f9c3d167..2433fa3dec 100644 --- a/3rdparty/bullet3/src/BulletCollision/NarrowPhaseCollision/btPolyhedralContactClipping.cpp +++ b/3rdparty/bullet3/src/BulletCollision/NarrowPhaseCollision/btPolyhedralContactClipping.cpp @@ -110,7 +110,7 @@ static int gActualSATPairTests = 0; inline bool IsAlmostZero(const btVector3& v) { - if (btFabs(v.m_floats[0]) > 1e-6 || btFabs(v.m_floats[1]) > 1e-6 || btFabs(v.m_floats[2]) > 1e-6) return false; + if (btFabs(v.x) > 1e-6 || btFabs(v.y) > 1e-6 || btFabs(v.z) > 1e-6) return false; return true; } @@ -134,9 +134,9 @@ void InverseTransformPoint3x3(btVector3& out, const btVector3& in, const btTrans const btVector3& r1 = rot[1]; const btVector3& r2 = rot[2]; - const btScalar x = r0.m_floats[0] * in.m_floats[0] + r1.m_floats[0] * in.m_floats[1] + r2.m_floats[0] * in.m_floats[2]; - const btScalar y = r0.m_floats[1] * in.m_floats[0] + r1.m_floats[1] * in.m_floats[1] + r2.m_floats[1] * in.m_floats[2]; - const btScalar z = r0.m_floats[2] * in.m_floats[0] + r1.m_floats[2] * in.m_floats[1] + r2.m_floats[2] * in.m_floats[2]; + const btScalar x = r0.x * in.x + r1.x * in.y + r2.x * in.z; + const btScalar y = r0.y * in.x + r1.y * in.y + r2.y * in.z; + const btScalar z = r0.z * in.x + r1.z * in.y + r2.z * in.z; out.setValue(x, y, z); } @@ -155,8 +155,8 @@ bool TestInternalObjects(const btTransform& trans0, const btTransform& trans1, c btScalar p1[3]; BoxSupport(convex1.m_extents, localAxis1, p1); - const btScalar Radius0 = p0[0] * localAxis0.m_floats[0] + p0[1] * localAxis0.m_floats[1] + p0[2] * localAxis0.m_floats[2]; - const btScalar Radius1 = p1[0] * localAxis1.m_floats[0] + p1[1] * localAxis1.m_floats[1] + p1[2] * localAxis1.m_floats[2]; + const btScalar Radius0 = p0[0] * localAxis0.x + p0[1] * localAxis0.y + p0[2] * localAxis0.z; + const btScalar Radius1 = p1[0] * localAxis1.x + p1[1] * localAxis1.y + p1[2] * localAxis1.z; const btScalar MinRadius = Radius0 > convex0.m_radius ? Radius0 : convex0.m_radius; const btScalar MaxRadius = Radius1 > convex1.m_radius ? Radius1 : convex1.m_radius; diff --git a/3rdparty/bullet3/src/BulletDynamics/Character/btKinematicCharacterController.cpp b/3rdparty/bullet3/src/BulletDynamics/Character/btKinematicCharacterController.cpp index 6c23345ef8..b3be500e48 100644 --- a/3rdparty/bullet3/src/BulletDynamics/Character/btKinematicCharacterController.cpp +++ b/3rdparty/bullet3/src/BulletDynamics/Character/btKinematicCharacterController.cpp @@ -563,9 +563,9 @@ void btKinematicCharacterController::stepDown(btCollisionWorld* collisionWorld, if ((m_ghostObject->hasContactResponse() && (callback.hasHit() && needsCollision(m_ghostObject, callback.m_hitCollisionObject))) || runonce == true) { // we dropped a fraction of the height -> hit floor - btScalar fraction = (m_currentPosition.m_floats[1] - callback.m_hitPointWorld.m_floats[1]) / 2; + btScalar fraction = (m_currentPosition.y - callback.m_hitPointWorld.y) / 2; - //printf("hitpoint: %g - pos %g\n", callback.m_hitPointWorld.m_floats[1], m_currentPosition.m_floats[1]); + //printf("hitpoint: %g - pos %g\n", callback.m_hitPointWorld.y, m_currentPosition.y); if (bounce_fix == true) { @@ -601,7 +601,7 @@ void btKinematicCharacterController::stepDown(btCollisionWorld* collisionWorld, m_targetPosition -= step_drop; } } - //printf("full drop - %g, %g\n", m_currentPosition.m_floats[1], m_targetPosition.m_floats[1]); + //printf("full drop - %g, %g\n", m_currentPosition.y, m_targetPosition.y); m_currentPosition = m_targetPosition; } @@ -622,7 +622,7 @@ void btKinematicCharacterController::setVelocityForTimeInterval( // printf("setVelocity!\n"); // printf(" interval: %f\n", timeInterval); // printf(" velocity: (%f, %f, %f)\n", - // velocity.m_floats[0], velocity.m_floats[1], velocity.m_floats[2]); + // velocity.x, velocity.y, velocity.z); m_useWalkDirection = false; m_walkDirection = velocity; diff --git a/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btBatchedConstraints.cpp b/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btBatchedConstraints.cpp index b3464aefb2..eeddc8fd39 100644 --- a/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btBatchedConstraints.cpp +++ b/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btBatchedConstraints.cpp @@ -158,8 +158,8 @@ static void debugDrawAllBatches(const btBatchedConstraints* bc, bboxMax.setMax(pos); } btVector3 bboxExtent = bboxMax - bboxMin; - btVector3 offsetBase = btVector3(0, bboxExtent.m_floats[1] * 1.1f, 0); - btVector3 offsetStep = btVector3(0, 0, bboxExtent.m_floats[2] * 1.1f); + btVector3 offsetBase = btVector3(0, bboxExtent.y * 1.1f, 0); + btVector3 offsetStep = btVector3(0, 0, bboxExtent.z * 1.1f); int numPhases = bc->m_phases.size(); for (int iPhase = 0; iPhase < numPhases; ++iPhase) { @@ -180,7 +180,7 @@ static void initBatchedBodyDynamicFlags(btAlignedObjectArray* outBodyDynam for (int i = 0; i < bodies.size(); ++i) { const btSolverBody& body = bodies[i]; - bodyDynamicFlags[i] = (body.internalGetInvMass().m_floats[0] > btScalar(0)); + bodyDynamicFlags[i] = (body.internalGetInvMass().x > btScalar(0)); } } @@ -873,7 +873,7 @@ static void setupSpatialGridBatchesMt( { const btSolverBody& body = bodies[i]; btVector3 bodyPos = body.m_worldTransform.m_origin; - bool isDynamic = (body.internalGetInvMass().m_floats[0] > btScalar(0)); + bool isDynamic = (body.internalGetInvMass().x > btScalar(0)); bodyPositions[i] = bodyPos; bodyDynamicFlags[i] = isDynamic; if (isDynamic) @@ -894,9 +894,9 @@ static void setupSpatialGridBatchesMt( btVector3 gridCellSize = consExtent; int gridDim[3]; - gridDim[0] = int(1.0 + gridExtent.m_floats[0] / gridCellSize.m_floats[0]); - gridDim[1] = int(1.0 + gridExtent.m_floats[1] / gridCellSize.m_floats[1]); - gridDim[2] = int(1.0 + gridExtent.m_floats[2] / gridCellSize.m_floats[2]); + gridDim[0] = int(1.0 + gridExtent.x / gridCellSize.x); + gridDim[1] = int(1.0 + gridExtent.y / gridCellSize.y); + gridDim[2] = int(1.0 + gridExtent.z / gridCellSize.z); // if we can collapse an axis, it will cut our number of phases in half which could be more efficient int phaseMask = 7; @@ -924,9 +924,9 @@ static void setupSpatialGridBatchesMt( btIntVec3 gridChunkDim; // each chunk is 2x2x2 group of cells while (true) { - gridDim[0] = int(1.0 + gridExtent.m_floats[0] / gridCellSize.m_floats[0]); - gridDim[1] = int(1.0 + gridExtent.m_floats[1] / gridCellSize.m_floats[1]); - gridDim[2] = int(1.0 + gridExtent.m_floats[2] / gridCellSize.m_floats[2]); + gridDim[0] = int(1.0 + gridExtent.x / gridCellSize.x); + gridDim[1] = int(1.0 + gridExtent.y / gridCellSize.y); + gridDim[2] = int(1.0 + gridExtent.z / gridCellSize.z); gridChunkDim[0] = btMax(1, (gridDim[0] + 0) / 2); gridChunkDim[1] = btMax(1, (gridDim[1] + 0) / 2); gridChunkDim[2] = btMax(1, (gridDim[2] + 0) / 2); @@ -950,9 +950,9 @@ static void setupSpatialGridBatchesMt( if (bodyDynamicFlags[iBody]) { btVector3 v = (bodyPositions[iBody] - bboxMin) * invGridCellSize; - coords.m_ints[0] = int(v.m_floats[0]); - coords.m_ints[1] = int(v.m_floats[1]); - coords.m_ints[2] = int(v.m_floats[2]); + coords.m_ints[0] = int(v.x); + coords.m_ints[1] = int(v.y); + coords.m_ints[2] = int(v.z); btAssert(coords.m_ints[0] >= 0 && coords.m_ints[0] < gridDim[0]); btAssert(coords.m_ints[1] >= 0 && coords.m_ints[1] < gridDim[1]); btAssert(coords.m_ints[2] >= 0 && coords.m_ints[2] < gridDim[2]); diff --git a/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp b/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp index 0980261c92..64190f4005 100644 --- a/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp +++ b/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp @@ -618,7 +618,7 @@ void btConeTwistConstraint::calcAngleInfo2(const btTransform& transA, const btTr btTransform trB = transB * m_rbBFrame; btTransform trDeltaAB = trB * trPose * trA.inverse(); btQuaternion qDeltaAB = trDeltaAB.getRotation(); - btVector3 swingAxis = btVector3(qDeltaAB.m_floats[0], qDeltaAB.m_floats[1], qDeltaAB.m_floats[2]); + btVector3 swingAxis = btVector3(qDeltaAB.x, qDeltaAB.y, qDeltaAB.z); btScalar swingAxisLen2 = swingAxis.length2(); if (btFuzzyZero(swingAxisLen2)) { @@ -812,11 +812,11 @@ void btConeTwistConstraint::computeConeLimitInfo(const btQuaternion& qCone, swingAngle = qCone.getAngle(); if (swingAngle > SIMD_EPSILON) { - vSwingAxis = btVector3(qCone.m_floats[0], qCone.m_floats[1], qCone.m_floats[2]); + vSwingAxis = btVector3(qCone.x, qCone.y, qCone.z); vSwingAxis.normalize(); #if 0 // non-zero twist?! this should never happen. - btAssert(fabs(vSwingAxis.m_floats[0]) <= SIMD_EPSILON)); + btAssert(fabs(vSwingAxis.x) <= SIMD_EPSILON)); #endif // Compute limit for given swing. tricky: @@ -826,8 +826,8 @@ void btConeTwistConstraint::computeConeLimitInfo(const btQuaternion& qCone, // For starters, compute the direction from center to surface of ellipse. // This is just the perpendicular (ie. rotate 2D vector by PI/2) of the swing axis. // (vSwingAxis is the cone rotation (in z,y); change vars and rotate to (x,y) coords.) - btScalar xEllipse = vSwingAxis.m_floats[1]; - btScalar yEllipse = -vSwingAxis.m_floats[2]; + btScalar xEllipse = vSwingAxis.y; + btScalar yEllipse = -vSwingAxis.z; // Now, we use the slope of the vector (using x/yEllipse) and find the length // of the line that intersects the ellipse: @@ -848,12 +848,12 @@ void btConeTwistConstraint::computeConeLimitInfo(const btQuaternion& qCone, // test! /*swingLimit = m_swingSpan2; - if (fabs(vSwingAxis.m_floats[2]) > SIMD_EPSILON) + if (fabs(vSwingAxis.z) > SIMD_EPSILON) { btScalar mag_2 = m_swingSpan1*m_swingSpan1 + m_swingSpan2*m_swingSpan2; btScalar sinphi = m_swingSpan2 / sqrt(mag_2); btScalar phi = asin(sinphi); - btScalar theta = atan2(fabs(vSwingAxis.m_floats[1]),fabs(vSwingAxis.m_floats[2])); + btScalar theta = atan2(fabs(vSwingAxis.y),fabs(vSwingAxis.z)); btScalar alpha = 3.14159f - theta - phi; btScalar sinalpha = sin(alpha); swingLimit = m_swingSpan1 * sinphi/sinalpha; @@ -921,7 +921,7 @@ void btConeTwistConstraint::computeTwistLimitInfo(const btQuaternion& qTwist, #endif } - vTwistAxis = btVector3(qMinTwist.m_floats[0], qMinTwist.m_floats[1], qMinTwist.m_floats[2]); + vTwistAxis = btVector3(qMinTwist.x, qMinTwist.y, qMinTwist.z); if (twistAngle > SIMD_EPSILON) vTwistAxis.normalize(); } @@ -935,8 +935,8 @@ void btConeTwistConstraint::adjustSwingAxisToUseEllipseNormal(btVector3& vSwingA // convert swing axis to direction from center to surface of ellipse // (ie. rotate 2D vector by PI/2) - btScalar y = -vSwingAxis.m_floats[2]; - btScalar z = vSwingAxis.m_floats[1]; + btScalar y = -vSwingAxis.z; + btScalar z = vSwingAxis.y; // do the math... if (fabs(z) > SIMD_EPSILON) // avoid division by 0. and we don't need an update if z == 0. @@ -952,8 +952,8 @@ void btConeTwistConstraint::adjustSwingAxisToUseEllipseNormal(btVector3& vSwingA y = -fabs(grad * z); // convert ellipse direction back to swing axis - vSwingAxis.m_floats[2] = (-y); - vSwingAxis.m_floats[1] = (z); + vSwingAxis.z = (-y); + vSwingAxis.y = (z); vSwingAxis.normalize(); } } diff --git a/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h b/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h index 1febc2bc0d..0eb144db5a 100644 --- a/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h +++ b/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h @@ -600,10 +600,10 @@ SIMD_FORCE_INLINE const char* btGeneric6DofConstraint::serialize(void* dataBuffe int i; for (i = 0; i < 3; i++) { - dof->m_angularLowerLimit.m_floats[i] = m_angularLimits[i].m_loLimit; - dof->m_angularUpperLimit.m_floats[i] = m_angularLimits[i].m_hiLimit; - dof->m_linearLowerLimit.m_floats[i] = m_linearLimits.m_lowerLimit[i]; - dof->m_linearUpperLimit.m_floats[i] = m_linearLimits.m_upperLimit[i]; + dof->m_angularLowerLimit.toPtr()[i] = m_angularLimits[i].m_loLimit; + dof->m_angularUpperLimit.toPtr()[i] = m_angularLimits[i].m_hiLimit; + dof->m_linearLowerLimit.toPtr()[i] = m_linearLimits.m_lowerLimit[i]; + dof->m_linearUpperLimit.toPtr()[i] = m_linearLimits.m_upperLimit[i]; } dof->m_useLinearReferenceFrameA = m_useLinearReferenceFrameA ? 1 : 0; diff --git a/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.h b/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.h index d2fe24b8ea..5831266066 100644 --- a/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.h +++ b/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.h @@ -596,33 +596,33 @@ SIMD_FORCE_INLINE const char* btGeneric6DofSpring2Constraint::serialize(void* da int i; for (i = 0; i < 3; i++) { - dof->m_angularLowerLimit.m_floats[i] = m_angularLimits[i].m_loLimit; - dof->m_angularUpperLimit.m_floats[i] = m_angularLimits[i].m_hiLimit; - dof->m_angularBounce.m_floats[i] = m_angularLimits[i].m_bounce; - dof->m_angularStopERP.m_floats[i] = m_angularLimits[i].m_stopERP; - dof->m_angularStopCFM.m_floats[i] = m_angularLimits[i].m_stopCFM; - dof->m_angularMotorERP.m_floats[i] = m_angularLimits[i].m_motorERP; - dof->m_angularMotorCFM.m_floats[i] = m_angularLimits[i].m_motorCFM; - dof->m_angularTargetVelocity.m_floats[i] = m_angularLimits[i].m_targetVelocity; - dof->m_angularMaxMotorForce.m_floats[i] = m_angularLimits[i].m_maxMotorForce; - dof->m_angularServoTarget.m_floats[i] = m_angularLimits[i].m_servoTarget; - dof->m_angularSpringStiffness.m_floats[i] = m_angularLimits[i].m_springStiffness; - dof->m_angularSpringDamping.m_floats[i] = m_angularLimits[i].m_springDamping; - dof->m_angularEquilibriumPoint.m_floats[i] = m_angularLimits[i].m_equilibriumPoint; + dof->m_angularLowerLimit.toPtr()[i] = m_angularLimits[i].m_loLimit; + dof->m_angularUpperLimit.toPtr()[i] = m_angularLimits[i].m_hiLimit; + dof->m_angularBounce.toPtr()[i] = m_angularLimits[i].m_bounce; + dof->m_angularStopERP.toPtr()[i] = m_angularLimits[i].m_stopERP; + dof->m_angularStopCFM.toPtr()[i] = m_angularLimits[i].m_stopCFM; + dof->m_angularMotorERP.toPtr()[i] = m_angularLimits[i].m_motorERP; + dof->m_angularMotorCFM.toPtr()[i] = m_angularLimits[i].m_motorCFM; + dof->m_angularTargetVelocity.toPtr()[i] = m_angularLimits[i].m_targetVelocity; + dof->m_angularMaxMotorForce.toPtr()[i] = m_angularLimits[i].m_maxMotorForce; + dof->m_angularServoTarget.toPtr()[i] = m_angularLimits[i].m_servoTarget; + dof->m_angularSpringStiffness.toPtr()[i] = m_angularLimits[i].m_springStiffness; + dof->m_angularSpringDamping.toPtr()[i] = m_angularLimits[i].m_springDamping; + dof->m_angularEquilibriumPoint.toPtr()[i] = m_angularLimits[i].m_equilibriumPoint; } - dof->m_angularLowerLimit.m_floats[3] = 0; - dof->m_angularUpperLimit.m_floats[3] = 0; - dof->m_angularBounce.m_floats[3] = 0; - dof->m_angularStopERP.m_floats[3] = 0; - dof->m_angularStopCFM.m_floats[3] = 0; - dof->m_angularMotorERP.m_floats[3] = 0; - dof->m_angularMotorCFM.m_floats[3] = 0; - dof->m_angularTargetVelocity.m_floats[3] = 0; - dof->m_angularMaxMotorForce.m_floats[3] = 0; - dof->m_angularServoTarget.m_floats[3] = 0; - dof->m_angularSpringStiffness.m_floats[3] = 0; - dof->m_angularSpringDamping.m_floats[3] = 0; - dof->m_angularEquilibriumPoint.m_floats[3] = 0; + dof->m_angularLowerLimit.w = 0; + dof->m_angularUpperLimit.w = 0; + dof->m_angularBounce.w = 0; + dof->m_angularStopERP.w = 0; + dof->m_angularStopCFM.w = 0; + dof->m_angularMotorERP.w = 0; + dof->m_angularMotorCFM.w = 0; + dof->m_angularTargetVelocity.w = 0; + dof->m_angularMaxMotorForce.w = 0; + dof->m_angularServoTarget.w = 0; + dof->m_angularSpringStiffness.w = 0; + dof->m_angularSpringDamping.w = 0; + dof->m_angularEquilibriumPoint.w = 0; for (i = 0; i < 4; i++) { dof->m_angularEnableMotor[i] = i < 3 ? (m_angularLimits[i].m_enableMotor ? 1 : 0) : 0; diff --git a/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btHingeConstraint.cpp b/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btHingeConstraint.cpp index adca79176f..47323e91ac 100644 --- a/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btHingeConstraint.cpp +++ b/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btHingeConstraint.cpp @@ -67,18 +67,18 @@ btHingeConstraint::btHingeConstraint(btRigidBody& rbA, btRigidBody& rbB, const b rbAxisA1 = rbAxisA2.cross(axisInA); } - m_rbAFrame.m_basis.setValue(rbAxisA1.m_floats[0], rbAxisA2.m_floats[0], axisInA.m_floats[0], - rbAxisA1.m_floats[1], rbAxisA2.m_floats[1], axisInA.m_floats[1], - rbAxisA1.m_floats[2], rbAxisA2.m_floats[2], axisInA.m_floats[2]); + m_rbAFrame.m_basis.setValue(rbAxisA1.x, rbAxisA2.x, axisInA.x, + rbAxisA1.y, rbAxisA2.y, axisInA.y, + rbAxisA1.z, rbAxisA2.z, axisInA.z); btQuaternion rotationArc = shortestArcQuat(axisInA, axisInB); btVector3 rbAxisB1 = quatRotate(rotationArc, rbAxisA1); btVector3 rbAxisB2 = axisInB.cross(rbAxisB1); m_rbBFrame.m_origin = pivotInB; - m_rbBFrame.m_basis.setValue(rbAxisB1.m_floats[0], rbAxisB2.m_floats[0], axisInB.m_floats[0], - rbAxisB1.m_floats[1], rbAxisB2.m_floats[1], axisInB.m_floats[1], - rbAxisB1.m_floats[2], rbAxisB2.m_floats[2], axisInB.m_floats[2]); + m_rbBFrame.m_basis.setValue(rbAxisB1.x, rbAxisB2.x, axisInB.x, + rbAxisB1.y, rbAxisB2.y, axisInB.y, + rbAxisB1.z, rbAxisB2.z, axisInB.z); #ifndef _BT_USE_CENTER_LIMIT_ //start with free @@ -114,9 +114,9 @@ btHingeConstraint::btHingeConstraint(btRigidBody& rbA, const btVector3& pivotInA btPlaneSpace1(axisInA, rbAxisA1, rbAxisA2); m_rbAFrame.m_origin = pivotInA; - m_rbAFrame.m_basis.setValue(rbAxisA1.m_floats[0], rbAxisA2.m_floats[0], axisInA.m_floats[0], - rbAxisA1.m_floats[1], rbAxisA2.m_floats[1], axisInA.m_floats[1], - rbAxisA1.m_floats[2], rbAxisA2.m_floats[2], axisInA.m_floats[2]); + m_rbAFrame.m_basis.setValue(rbAxisA1.x, rbAxisA2.x, axisInA.x, + rbAxisA1.y, rbAxisA2.y, axisInA.y, + rbAxisA1.z, rbAxisA2.z, axisInA.z); btVector3 axisInB = rbA.getCenterOfMassTransform().m_basis * axisInA; @@ -125,9 +125,9 @@ btHingeConstraint::btHingeConstraint(btRigidBody& rbA, const btVector3& pivotInA btVector3 rbAxisB2 = axisInB.cross(rbAxisB1); m_rbBFrame.m_origin = rbA.getCenterOfMassTransform()(pivotInA); - m_rbBFrame.m_basis.setValue(rbAxisB1.m_floats[0], rbAxisB2.m_floats[0], axisInB.m_floats[0], - rbAxisB1.m_floats[1], rbAxisB2.m_floats[1], axisInB.m_floats[1], - rbAxisB1.m_floats[2], rbAxisB2.m_floats[2], axisInB.m_floats[2]); + m_rbBFrame.m_basis.setValue(rbAxisB1.x, rbAxisB2.x, axisInB.x, + rbAxisB1.y, rbAxisB2.y, axisInB.y, + rbAxisB1.z, rbAxisB2.z, axisInB.z); #ifndef _BT_USE_CENTER_LIMIT_ //start with free @@ -706,7 +706,7 @@ void btHingeConstraint::setMotorTarget(const btQuaternion& qAinB, btScalar dt) qHinge = -(qHinge); targetAngle = qHinge.getAngle(); } - if (qHinge.m_floats[2] < 0) + if (qHinge.z < 0) targetAngle = -targetAngle; setMotorTarget(targetAngle, dt); diff --git a/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btHingeConstraint.h b/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btHingeConstraint.h index e3a35f8104..12b78632f4 100644 --- a/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btHingeConstraint.h +++ b/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btHingeConstraint.h @@ -218,9 +218,9 @@ btHingeConstraint : public btTypedConstraint btPlaneSpace1(axisInA, rbAxisA1, rbAxisA2); btVector3 pivotInA = m_rbAFrame.m_origin; // m_rbAFrame.m_origin = pivotInA; - m_rbAFrame.m_basis.setValue(rbAxisA1.m_floats[0], rbAxisA2.m_floats[0], axisInA.m_floats[0], - rbAxisA1.m_floats[1], rbAxisA2.m_floats[1], axisInA.m_floats[1], - rbAxisA1.m_floats[2], rbAxisA2.m_floats[2], axisInA.m_floats[2]); + m_rbAFrame.m_basis.setValue(rbAxisA1.x, rbAxisA2.x, axisInA.x, + rbAxisA1.y, rbAxisA2.y, axisInA.y, + rbAxisA1.z, rbAxisA2.z, axisInA.z); btVector3 axisInB = m_rbA.getCenterOfMassTransform().m_basis * axisInA; @@ -230,9 +230,9 @@ btHingeConstraint : public btTypedConstraint m_rbBFrame.m_origin = m_rbB.getCenterOfMassTransform().inverse()(m_rbA.getCenterOfMassTransform()(pivotInA)); - m_rbBFrame.m_basis.setValue(rbAxisB1.m_floats[0], rbAxisB2.m_floats[0], axisInB.m_floats[0], - rbAxisB1.m_floats[1], rbAxisB2.m_floats[1], axisInB.m_floats[1], - rbAxisB1.m_floats[2], rbAxisB2.m_floats[2], axisInB.m_floats[2]); + m_rbBFrame.m_basis.setValue(rbAxisB1.x, rbAxisB2.x, axisInB.x, + rbAxisB1.y, rbAxisB2.y, axisInB.y, + rbAxisB1.z, rbAxisB2.z, axisInB.z); m_rbBFrame.m_basis = m_rbB.getCenterOfMassTransform().m_basis.inverse() * m_rbBFrame.m_basis; } diff --git a/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp b/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp index e07f3fd8b1..01c6ca959b 100644 --- a/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp +++ b/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp @@ -174,7 +174,7 @@ static btScalar gResolveSingleConstraintRowGeneric_sse2(btSolverBody& bodyA, btS bodyA.internalGetDeltaAngularVelocity().mVec128 = _mm_add_ps(bodyA.internalGetDeltaAngularVelocity().mVec128, _mm_mul_ps(c.m_angularComponentA.mVec128, impulseMagnitude)); bodyB.internalGetDeltaLinearVelocity().mVec128 = _mm_add_ps(bodyB.internalGetDeltaLinearVelocity().mVec128, _mm_mul_ps(linearComponentB, impulseMagnitude)); bodyB.internalGetDeltaAngularVelocity().mVec128 = _mm_add_ps(bodyB.internalGetDeltaAngularVelocity().mVec128, _mm_mul_ps(c.m_angularComponentB.mVec128, impulseMagnitude)); - return deltaImpulse.m_floats[0] / c.m_jacDiagABInv; + return deltaImpulse.x / c.m_jacDiagABInv; } // Enhanced version of gResolveSingleConstraintRowGeneric_sse2 with SSE4.1 and FMA3 @@ -199,7 +199,7 @@ static btScalar gResolveSingleConstraintRowGeneric_sse4_1_fma3(btSolverBody& bod bodyB.internalGetDeltaLinearVelocity().mVec128 = FMADD(_mm_mul_ps(c.m_contactNormal2.mVec128, bodyB.internalGetInvMass().mVec128), deltaImpulse, bodyB.internalGetDeltaLinearVelocity().mVec128); bodyB.internalGetDeltaAngularVelocity().mVec128 = FMADD(c.m_angularComponentB.mVec128, deltaImpulse, bodyB.internalGetDeltaAngularVelocity().mVec128); btSimdScalar deltaImp = deltaImpulse; - return deltaImp.m_floats[0] * (1. / c.m_jacDiagABInv); + return deltaImp.x * (1. / c.m_jacDiagABInv); #else return gResolveSingleConstraintRowGeneric_sse2(bodyA, bodyB, c); #endif @@ -229,7 +229,7 @@ static btScalar gResolveSingleConstraintRowLowerLimit_sse2(btSolverBody& bodyA, bodyA.internalGetDeltaAngularVelocity().mVec128 = _mm_add_ps(bodyA.internalGetDeltaAngularVelocity().mVec128, _mm_mul_ps(c.m_angularComponentA.mVec128, impulseMagnitude)); bodyB.internalGetDeltaLinearVelocity().mVec128 = _mm_add_ps(bodyB.internalGetDeltaLinearVelocity().mVec128, _mm_mul_ps(linearComponentB, impulseMagnitude)); bodyB.internalGetDeltaAngularVelocity().mVec128 = _mm_add_ps(bodyB.internalGetDeltaAngularVelocity().mVec128, _mm_mul_ps(c.m_angularComponentB.mVec128, impulseMagnitude)); - return deltaImpulse.m_floats[0] / c.m_jacDiagABInv; + return deltaImpulse.x / c.m_jacDiagABInv; } // Enhanced version of gResolveSingleConstraintRowGeneric_sse2 with SSE4.1 and FMA3 @@ -252,7 +252,7 @@ static btScalar gResolveSingleConstraintRowLowerLimit_sse4_1_fma3(btSolverBody& bodyB.internalGetDeltaLinearVelocity().mVec128 = FMADD(_mm_mul_ps(c.m_contactNormal2.mVec128, bodyB.internalGetInvMass().mVec128), deltaImpulse, bodyB.internalGetDeltaLinearVelocity().mVec128); bodyB.internalGetDeltaAngularVelocity().mVec128 = FMADD(c.m_angularComponentB.mVec128, deltaImpulse, bodyB.internalGetDeltaAngularVelocity().mVec128); btSimdScalar deltaImp = deltaImpulse; - return deltaImp.m_floats[0] * (1. / c.m_jacDiagABInv); + return deltaImp.x * (1. / c.m_jacDiagABInv); #else return gResolveSingleConstraintRowLowerLimit_sse2(bodyA, bodyB, c); #endif //BT_ALLOW_SSE4 @@ -344,7 +344,7 @@ static btScalar gResolveSplitPenetrationImpulse_sse2(btSolverBody& bodyA, btSolv bodyB.internalGetPushVelocity().mVec128 = _mm_add_ps(bodyB.internalGetPushVelocity().mVec128, _mm_mul_ps(linearComponentB, impulseMagnitude)); bodyB.internalGetTurnVelocity().mVec128 = _mm_add_ps(bodyB.internalGetTurnVelocity().mVec128, _mm_mul_ps(c.m_angularComponentB.mVec128, impulseMagnitude)); btSimdScalar deltaImp = deltaImpulse; - return deltaImp.m_floats[0] * (1. / c.m_jacDiagABInv); + return deltaImp.x * (1. / c.m_jacDiagABInv); #else return gResolveSplitPenetrationImpulse_scalar_reference(bodyA, bodyB, c); #endif diff --git a/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btSolverBody.h b/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btSolverBody.h index 59ab38e073..be1e67664b 100644 --- a/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btSolverBody.h +++ b/3rdparty/bullet3/src/BulletDynamics/ConstraintSolver/btSolverBody.h @@ -47,7 +47,7 @@ struct btSimdScalar } union { __m128 m_vec128; - float m_floats[4]; + struct { float x, y, z, w; }; int m_ints[4]; btScalar m_unusedPadding; }; @@ -77,7 +77,7 @@ struct btSimdScalar SIMD_FORCE_INLINE operator float() const { - return m_floats[0]; + return x; } }; diff --git a/3rdparty/bullet3/src/BulletDynamics/Dynamics/btRigidBody.cpp b/3rdparty/bullet3/src/BulletDynamics/Dynamics/btRigidBody.cpp index 109f025858..68b941dd3d 100644 --- a/3rdparty/bullet3/src/BulletDynamics/Dynamics/btRigidBody.cpp +++ b/3rdparty/bullet3/src/BulletDynamics/Dynamics/btRigidBody.cpp @@ -116,7 +116,7 @@ void btRigidBody::saveKinematicState(btScalar timeStep) m_interpolationLinearVelocity = m_linearVelocity; m_interpolationAngularVelocity = m_angularVelocity; m_interpolationWorldTransform = m_worldTransform; - //printf("angular = %f %f %f\n",m_angularVelocity.m_floats[0],m_angularVelocity.m_floats[1],m_angularVelocity.m_floats[2]); + //printf("angular = %f %f %f\n",m_angularVelocity.x,m_angularVelocity.y,m_angularVelocity.z); } } @@ -239,9 +239,9 @@ void btRigidBody::setMassProps(btScalar mass, const btVector3& inertia) //Fg = m * a m_gravity = mass * m_gravity_acceleration; - m_invInertiaLocal.setValue(inertia.m_floats[0] != btScalar(0.0) ? btScalar(1.0) / inertia.m_floats[0] : btScalar(0.0), - inertia.m_floats[1] != btScalar(0.0) ? btScalar(1.0) / inertia.m_floats[1] : btScalar(0.0), - inertia.m_floats[2] != btScalar(0.0) ? btScalar(1.0) / inertia.m_floats[2] : btScalar(0.0)); + m_invInertiaLocal.setValue(inertia.x != btScalar(0.0) ? btScalar(1.0) / inertia.x : btScalar(0.0), + inertia.y != btScalar(0.0) ? btScalar(1.0) / inertia.y : btScalar(0.0), + inertia.z != btScalar(0.0) ? btScalar(1.0) / inertia.z : btScalar(0.0)); m_invMass = m_linearFactor * m_inverseMass; } @@ -255,9 +255,9 @@ btVector3 btRigidBody::getLocalInertia() const { btVector3 inertiaLocal; const btVector3 inertia = m_invInertiaLocal; - inertiaLocal.setValue(inertia.m_floats[0] != btScalar(0.0) ? btScalar(1.0) / inertia.m_floats[0] : btScalar(0.0), - inertia.m_floats[1] != btScalar(0.0) ? btScalar(1.0) / inertia.m_floats[1] : btScalar(0.0), - inertia.m_floats[2] != btScalar(0.0) ? btScalar(1.0) / inertia.m_floats[2] : btScalar(0.0)); + inertiaLocal.setValue(inertia.x != btScalar(0.0) ? btScalar(1.0) / inertia.x : btScalar(0.0), + inertia.y != btScalar(0.0) ? btScalar(1.0) / inertia.y : btScalar(0.0), + inertia.z != btScalar(0.0) ? btScalar(1.0) / inertia.z : btScalar(0.0)); return inertiaLocal; } @@ -303,9 +303,9 @@ btVector3 btRigidBody::computeGyroscopicImpulseImplicit_Body(btScalar step) cons // Convert to body coordinates btVector3 omegab = quatRotate(q.inverse(), omega1); btMatrix3x3 Ib; - Ib.setValue(idl.m_floats[0], 0, 0, - 0, idl.m_floats[1], 0, - 0, 0, idl.m_floats[2]); + Ib.setValue(idl.x, 0, 0, + 0, idl.y, 0, + 0, 0, idl.z); btVector3 ibo = Ib * omegab; diff --git a/3rdparty/bullet3/src/BulletDynamics/Dynamics/btRigidBody.h b/3rdparty/bullet3/src/BulletDynamics/Dynamics/btRigidBody.h index 3c8b934a74..e03ed0c7e5 100644 --- a/3rdparty/bullet3/src/BulletDynamics/Dynamics/btRigidBody.h +++ b/3rdparty/bullet3/src/BulletDynamics/Dynamics/btRigidBody.h @@ -294,17 +294,17 @@ class btRigidBody : public btCollisionObject #if defined(BT_CLAMP_VELOCITY_TO) && BT_CLAMP_VELOCITY_TO > 0 void clampVelocity(btVector3& v) const { - v.m_floats[0] = ( + v.x = ( fmax(-BT_CLAMP_VELOCITY_TO, - fmin(BT_CLAMP_VELOCITY_TO, v.m_floats[0])) + fmin(BT_CLAMP_VELOCITY_TO, v.x)) ); - v.m_floats[1] = ( + v.y = ( fmax(-BT_CLAMP_VELOCITY_TO, - fmin(BT_CLAMP_VELOCITY_TO, v.m_floats[1])) + fmin(BT_CLAMP_VELOCITY_TO, v.y)) ); - v.m_floats[2] = ( + v.z = ( fmax(-BT_CLAMP_VELOCITY_TO, - fmin(BT_CLAMP_VELOCITY_TO, v.m_floats[2])) + fmin(BT_CLAMP_VELOCITY_TO, v.z)) ); } #endif diff --git a/3rdparty/bullet3/src/BulletDynamics/Featherstone/btMultiBody.cpp b/3rdparty/bullet3/src/BulletDynamics/Featherstone/btMultiBody.cpp index 1e37665e7e..a48e9271cf 100644 --- a/3rdparty/bullet3/src/BulletDynamics/Featherstone/btMultiBody.cpp +++ b/3rdparty/bullet3/src/BulletDynamics/Featherstone/btMultiBody.cpp @@ -704,17 +704,17 @@ void btMultiBody::setBaseDynamicType(int dynamicType) inline btMatrix3x3 outerProduct(const btVector3 &v0, const btVector3 &v1) //renamed it from vecMulVecTranspose (http://en.wikipedia.org/wiki/Outer_product); maybe it should be moved to btVector3 like dot and cross? { btVector3 row0 = btVector3( - v0.m_floats[0] * v1.m_floats[0], - v0.m_floats[0] * v1.m_floats[1], - v0.m_floats[0] * v1.m_floats[2]); + v0.x * v1.x, + v0.x * v1.y, + v0.x * v1.z); btVector3 row1 = btVector3( - v0.m_floats[1] * v1.m_floats[0], - v0.m_floats[1] * v1.m_floats[1], - v0.m_floats[1] * v1.m_floats[2]); + v0.y * v1.x, + v0.y * v1.y, + v0.y * v1.z); btVector3 row2 = btVector3( - v0.m_floats[2] * v1.m_floats[0], - v0.m_floats[2] * v1.m_floats[1], - v0.m_floats[2] * v1.m_floats[2]); + v0.z * v1.x, + v0.z * v1.y, + v0.z * v1.z); btMatrix3x3 m(row0[0], row0[1], row0[2], row1[0], row1[1], row1[2], @@ -963,9 +963,9 @@ void btMultiBody::computeAccelerationsArticulatedBodyAlgorithmMultiDof(btScalar 0, m_links[i].m_inertiaLocal[1], 0, 0, 0, m_links[i].m_inertiaLocal[2])); - //printf("w[%d] = [%.4f %.4f %.4f]\n", i, vel_top_angular[i+1].m_floats[0], vel_top_angular[i+1].m_floats[1], vel_top_angular[i+1].m_floats[2]); - //printf("v[%d] = [%.4f %.4f %.4f]\n", i, vel_bottom_linear[i+1].m_floats[0], vel_bottom_linear[i+1].m_floats[1], vel_bottom_linear[i+1].m_floats[2]); - //printf("c[%d] = [%.4f %.4f %.4f]\n", i, coriolis_bottom_linear[i].m_floats[0], coriolis_bottom_linear[i].m_floats[1], coriolis_bottom_linear[i].m_floats[2]); + //printf("w[%d] = [%.4f %.4f %.4f]\n", i, vel_top_angular[i+1].x, vel_top_angular[i+1].y, vel_top_angular[i+1].z); + //printf("v[%d] = [%.4f %.4f %.4f]\n", i, vel_bottom_linear[i+1].x, vel_bottom_linear[i+1].y, vel_bottom_linear[i+1].z); + //printf("c[%d] = [%.4f %.4f %.4f]\n", i, coriolis_bottom_linear[i].x, coriolis_bottom_linear[i].y, coriolis_bottom_linear[i].z); } // 'Downward' loop. @@ -1199,7 +1199,7 @@ void btMultiBody::computeAccelerationsArticulatedBodyAlgorithmMultiDof(btScalar ///////////////// //printf("q = ["); - //printf("%.6f, %.6f, %.6f, %.6f, %.6f, %.6f, %.6f ", m_baseQuat.m_floats[0], m_baseQuat.m_floats[1], m_baseQuat.m_floats[2], m_baseQuat.m_floats[3], m_basePos.m_floats[0], m_basePos.m_floats[1], m_basePos.m_floats[2]); + //printf("%.6f, %.6f, %.6f, %.6f, %.6f, %.6f, %.6f ", m_baseQuat.x, m_baseQuat.y, m_baseQuat.z, m_baseQuat.w, m_basePos.x, m_basePos.y, m_basePos.z); //for(int link = 0; link < getNumLinks(); ++link) // for(int dof = 0; dof < m_links[link].m_dofCount; ++dof) // printf("%.6f ", m_links[link].m_jointPos[dof]); @@ -1657,10 +1657,10 @@ void btMultiBody::predictPositionsMultiDof(btScalar dt) } if (!baseBody) - quat = btQuaternion(axis.m_floats[0], axis.m_floats[1], axis.m_floats[2], btCos(fAngle * dt * btScalar(0.5))) * quat; + quat = btQuaternion(axis.x, axis.y, axis.z, btCos(fAngle * dt * btScalar(0.5))) * quat; else - quat = quat * btQuaternion(-axis.m_floats[0], -axis.m_floats[1], -axis.m_floats[2], btCos(fAngle * dt * btScalar(0.5))); - //equivalent to: quat = (btQuaternion(axis.m_floats[0],axis.m_floats[1],axis.m_floats[2],btCos( fAngle*dt*btScalar(0.5) )) * quat.inverse()).inverse(); + quat = quat * btQuaternion(-axis.x, -axis.y, -axis.z, btCos(fAngle * dt * btScalar(0.5))); + //equivalent to: quat = (btQuaternion(axis.x,axis.y,axis.z,btCos( fAngle*dt*btScalar(0.5) )) * quat.inverse()).inverse(); quat.normalize(); } @@ -1687,10 +1687,10 @@ void btMultiBody::predictPositionsMultiDof(btScalar dt) btVector3 baseOmega; baseOmega.setValue(pBaseOmega[0], pBaseOmega[1], pBaseOmega[2]); pQuatUpdateFun(baseOmega, baseQuat, true, dt); - pBaseQuat[0] = baseQuat.m_floats[0]; - pBaseQuat[1] = baseQuat.m_floats[1]; - pBaseQuat[2] = baseQuat.m_floats[2]; - pBaseQuat[3] = baseQuat.m_floats[3]; + pBaseQuat[0] = baseQuat.x; + pBaseQuat[1] = baseQuat.y; + pBaseQuat[2] = baseQuat.z; + pBaseQuat[3] = baseQuat.w; } // Finally we can update m_jointPos for each of the m_links @@ -1758,10 +1758,10 @@ void btMultiBody::predictPositionsMultiDof(btScalar dt) btQuaternion jointOri; jointOri.setValue(pJointPos[0], pJointPos[1], pJointPos[2], pJointPos[3]); pQuatUpdateFun(jointVel, jointOri, false, dt); - pJointPos[0] = jointOri.m_floats[0]; - pJointPos[1] = jointOri.m_floats[1]; - pJointPos[2] = jointOri.m_floats[2]; - pJointPos[3] = jointOri.m_floats[3]; + pJointPos[0] = jointOri.x; + pJointPos[1] = jointOri.y; + pJointPos[2] = jointOri.z; + pJointPos[3] = jointOri.w; break; } case btMultibodyLink::ePlanar: @@ -1842,10 +1842,10 @@ void btMultiBody::stepPositionsMultiDof(btScalar dt, btScalar *pq, btScalar *pqd } if (!baseBody) - quat = btQuaternion(axis.m_floats[0], axis.m_floats[1], axis.m_floats[2], btCos(fAngle * dt * btScalar(0.5))) * quat; + quat = btQuaternion(axis.x, axis.y, axis.z, btCos(fAngle * dt * btScalar(0.5))) * quat; else - quat = quat * btQuaternion(-axis.m_floats[0], -axis.m_floats[1], -axis.m_floats[2], btCos(fAngle * dt * btScalar(0.5))); - //equivalent to: quat = (btQuaternion(axis.m_floats[0],axis.m_floats[1],axis.m_floats[2],btCos( fAngle*dt*btScalar(0.5) )) * quat.inverse()).inverse(); + quat = quat * btQuaternion(-axis.x, -axis.y, -axis.z, btCos(fAngle * dt * btScalar(0.5))); + //equivalent to: quat = (btQuaternion(axis.x,axis.y,axis.z,btCos( fAngle*dt*btScalar(0.5) )) * quat.inverse()).inverse(); quat.normalize(); } @@ -1864,14 +1864,14 @@ void btMultiBody::stepPositionsMultiDof(btScalar dt, btScalar *pq, btScalar *pqd btVector3 baseOmega; baseOmega.setValue(pBaseOmega[0], pBaseOmega[1], pBaseOmega[2]); pQuatUpdateFun(baseOmega, baseQuat, true, dt); - pBaseQuat[0] = baseQuat.m_floats[0]; - pBaseQuat[1] = baseQuat.m_floats[1]; - pBaseQuat[2] = baseQuat.m_floats[2]; - pBaseQuat[3] = baseQuat.m_floats[3]; + pBaseQuat[0] = baseQuat.x; + pBaseQuat[1] = baseQuat.y; + pBaseQuat[2] = baseQuat.z; + pBaseQuat[3] = baseQuat.w; - //printf("pBaseOmega = %.4f %.4f %.4f\n", pBaseOmega->m_floats[0], pBaseOmega->m_floats[1], pBaseOmega->m_floats[2]); - //printf("pBaseVel = %.4f %.4f %.4f\n", pBaseVel->m_floats[0], pBaseVel->m_floats[1], pBaseVel->m_floats[2]); - //printf("baseQuat = %.4f %.4f %.4f %.4f\n", pBaseQuat->m_floats[0], pBaseQuat->m_floats[1], pBaseQuat->m_floats[2], pBaseQuat->m_floats[3]); + //printf("pBaseOmega = %.4f %.4f %.4f\n", pBaseOmega->x, pBaseOmega->y, pBaseOmega->z); + //printf("pBaseVel = %.4f %.4f %.4f\n", pBaseVel->x, pBaseVel->y, pBaseVel->z); + //printf("baseQuat = %.4f %.4f %.4f %.4f\n", pBaseQuat->x, pBaseQuat->y, pBaseQuat->z, pBaseQuat->w); } if (pq) @@ -1907,10 +1907,10 @@ void btMultiBody::stepPositionsMultiDof(btScalar dt, btScalar *pq, btScalar *pqd btQuaternion jointOri; jointOri.setValue(pJointPos[0], pJointPos[1], pJointPos[2], pJointPos[3]); pQuatUpdateFun(jointVel, jointOri, false, dt); - pJointPos[0] = jointOri.m_floats[0]; - pJointPos[1] = jointOri.m_floats[1]; - pJointPos[2] = jointOri.m_floats[2]; - pJointPos[3] = jointOri.m_floats[3]; + pJointPos[0] = jointOri.x; + pJointPos[1] = jointOri.y; + pJointPos[2] = jointOri.z; + pJointPos[3] = jointOri.w; break; } case btMultibodyLink::ePlanar: @@ -2165,7 +2165,7 @@ void btMultiBody::forwardKinematics(btAlignedObjectArray &world_to int index = link + 1; btVector3 posr = local_origin[index]; - btScalar quat[4] = {-world_to_local[index].m_floats[0], -world_to_local[index].m_floats[1], -world_to_local[index].m_floats[2], world_to_local[index].m_floats[3]}; + btScalar quat[4] = {-world_to_local[index].x, -world_to_local[index].y, -world_to_local[index].z, world_to_local[index].w}; btTransform tr; tr.setIdentity(); tr.m_origin = (posr); @@ -2185,8 +2185,8 @@ void btMultiBody::updateCollisionObjectWorldTransforms(btAlignedObjectArraygetWorldToBaseRot().m_floats[0]; - scratch_q0[1] = bod->getWorldToBaseRot().m_floats[1]; - scratch_q0[2] = bod->getWorldToBaseRot().m_floats[2]; - scratch_q0[3] = bod->getWorldToBaseRot().m_floats[3]; - scratch_q0[4] = bod->getBasePos().m_floats[0]; - scratch_q0[5] = bod->getBasePos().m_floats[1]; - scratch_q0[6] = bod->getBasePos().m_floats[2]; + scratch_q0[0] = bod->getWorldToBaseRot().x; + scratch_q0[1] = bod->getWorldToBaseRot().y; + scratch_q0[2] = bod->getWorldToBaseRot().z; + scratch_q0[3] = bod->getWorldToBaseRot().w; + scratch_q0[4] = bod->getBasePos().x; + scratch_q0[5] = bod->getBasePos().y; + scratch_q0[6] = bod->getBasePos().z; // for (int link = 0; link < bod->getNumLinks(); ++link) { diff --git a/3rdparty/bullet3/src/BulletDynamics/Featherstone/btMultiBodySphericalJointLimit.cpp b/3rdparty/bullet3/src/BulletDynamics/Featherstone/btMultiBodySphericalJointLimit.cpp index 6f02ae3c18..45c38c487f 100644 --- a/3rdparty/bullet3/src/BulletDynamics/Featherstone/btMultiBodySphericalJointLimit.cpp +++ b/3rdparty/bullet3/src/BulletDynamics/Featherstone/btMultiBodySphericalJointLimit.cpp @@ -165,7 +165,7 @@ void btMultiBodySphericalJointLimit::createConstraintRows(btMultiBodyConstraintA qMinTwist = -(qABTwist); twistAngle = qMinTwist.getAngle(); } - btVector3 vTwistAxis = btVector3(qMinTwist.m_floats[0], qMinTwist.m_floats[1], qMinTwist.m_floats[2]); + btVector3 vTwistAxis = btVector3(qMinTwist.x, qMinTwist.y, qMinTwist.z); if (twistAngle > SIMD_EPSILON) vTwistAxis.normalize(); diff --git a/3rdparty/bullet3/src/BulletSoftBody/BulletReducedDeformableBody/btReducedDeformableBody.h b/3rdparty/bullet3/src/BulletSoftBody/BulletReducedDeformableBody/btReducedDeformableBody.h index 630c148c7b..2d90b7622c 100644 --- a/3rdparty/bullet3/src/BulletSoftBody/BulletReducedDeformableBody/btReducedDeformableBody.h +++ b/3rdparty/bullet3/src/BulletSoftBody/BulletReducedDeformableBody/btReducedDeformableBody.h @@ -238,17 +238,17 @@ class btReducedDeformableBody : public btSoftBody #if defined(BT_CLAMP_VELOCITY_TO) && BT_CLAMP_VELOCITY_TO > 0 void clampVelocity(btVector3& v) const { - v.m_floats[0] = ( + v.x = ( fmax(-BT_CLAMP_VELOCITY_TO, - fmin(BT_CLAMP_VELOCITY_TO, v.m_floats[0])) + fmin(BT_CLAMP_VELOCITY_TO, v.x)) ); - v.m_floats[1] = ( + v.y = ( fmax(-BT_CLAMP_VELOCITY_TO, - fmin(BT_CLAMP_VELOCITY_TO, v.m_floats[1])) + fmin(BT_CLAMP_VELOCITY_TO, v.y)) ); - v.m_floats[2] = ( + v.z = ( fmax(-BT_CLAMP_VELOCITY_TO, - fmin(BT_CLAMP_VELOCITY_TO, v.m_floats[2])) + fmin(BT_CLAMP_VELOCITY_TO, v.z)) ); } #endif diff --git a/3rdparty/bullet3/src/BulletSoftBody/BulletReducedDeformableBody/btReducedDeformableBodyHelpers.cpp b/3rdparty/bullet3/src/BulletSoftBody/BulletReducedDeformableBody/btReducedDeformableBodyHelpers.cpp index 9d119fc2f2..8537343320 100644 --- a/3rdparty/bullet3/src/BulletSoftBody/BulletReducedDeformableBody/btReducedDeformableBodyHelpers.cpp +++ b/3rdparty/bullet3/src/BulletSoftBody/BulletReducedDeformableBody/btReducedDeformableBodyHelpers.cpp @@ -64,12 +64,12 @@ btReducedDeformableBody* btReducedDeformableBodyHelpers::createFromVtkFile(btSof { btScalar p; ss >> p; - position.m_floats[0] = (p); + position.x = (p); ss >> p; - position.m_floats[1] = (p); + position.y = (p); ss >> p; - position.m_floats[2] = (p); - //printf("v %f %f %f\n", position.m_floats[0], position.m_floats[1], position.m_floats[2]); + position.z = (p); + //printf("v %f %f %f\n", position.x, position.y, position.z); X[x_count++] = position; } else if (reading_tets) diff --git a/3rdparty/bullet3/src/BulletSoftBody/btDefaultSoftBodySolver.cpp b/3rdparty/bullet3/src/BulletSoftBody/btDefaultSoftBodySolver.cpp index 53b4bb6daa..31403dd559 100644 --- a/3rdparty/bullet3/src/BulletSoftBody/btDefaultSoftBodySolver.cpp +++ b/3rdparty/bullet3/src/BulletSoftBody/btDefaultSoftBodySolver.cpp @@ -97,9 +97,9 @@ void btDefaultSoftBodySolver::copySoftBodyToVertexBuffer(const btSoftBody *const for (int vertexIndex = 0; vertexIndex < numVertices; ++vertexIndex) { btVector3 position = clothVertices[vertexIndex].m_x; - *(vertexPointer + 0) = (float)position.m_floats[0]; - *(vertexPointer + 1) = (float)position.m_floats[1]; - *(vertexPointer + 2) = (float)position.m_floats[2]; + *(vertexPointer + 0) = (float)position.x; + *(vertexPointer + 1) = (float)position.y; + *(vertexPointer + 2) = (float)position.z; vertexPointer += vertexStride; } } @@ -112,9 +112,9 @@ void btDefaultSoftBodySolver::copySoftBodyToVertexBuffer(const btSoftBody *const for (int vertexIndex = 0; vertexIndex < numVertices; ++vertexIndex) { btVector3 normal = clothVertices[vertexIndex].m_n; - *(normalPointer + 0) = (float)normal.m_floats[0]; - *(normalPointer + 1) = (float)normal.m_floats[1]; - *(normalPointer + 2) = (float)normal.m_floats[2]; + *(normalPointer + 0) = (float)normal.x; + *(normalPointer + 1) = (float)normal.y; + *(normalPointer + 2) = (float)normal.z; normalPointer += normalStride; } } diff --git a/3rdparty/bullet3/src/BulletSoftBody/btDeformableBodySolver.cpp b/3rdparty/bullet3/src/BulletSoftBody/btDeformableBodySolver.cpp index a247980974..99afcfdaea 100644 --- a/3rdparty/bullet3/src/BulletSoftBody/btDeformableBodySolver.cpp +++ b/3rdparty/bullet3/src/BulletSoftBody/btDeformableBodySolver.cpp @@ -574,9 +574,9 @@ void btDeformableBodySolver::applyTransforms(btScalar timeStep) btScalar* u_t1 = &jacobianData_t1.m_deltaVelocitiesUnitImpulse[0]; btScalar* u_t2 = &jacobianData_t2.m_deltaVelocitiesUnitImpulse[0]; - btMatrix3x3 rot(normal.m_floats[0], normal.m_floats[1], normal.m_floats[2], - t1.m_floats[0], t1.m_floats[1], t1.m_floats[2], - t2.m_floats[0], t2.m_floats[1], t2.m_floats[2]); // world frame to local frame + btMatrix3x3 rot(normal.x, normal.y, normal.z, + t1.x, t1.y, t1.z, + t2.x, t2.y, t2.z); // world frame to local frame const int ndof = multibodyLinkCol->m_multiBody->getNumDofs() + 6; btMatrix3x3 local_impulse_matrix = (Diagonal(n->m_im) + OuterProduct(J_n, J_t1, J_t2, u_n, u_t1, u_t2, ndof)).inverse(); a.m_c0 = rot.transpose() * local_impulse_matrix * rot; diff --git a/3rdparty/bullet3/src/BulletSoftBody/btDeformableLagrangianForce.h b/3rdparty/bullet3/src/BulletSoftBody/btDeformableLagrangianForce.h index ca396f4c98..0db07b232d 100644 --- a/3rdparty/bullet3/src/BulletSoftBody/btDeformableLagrangianForce.h +++ b/3rdparty/bullet3/src/BulletSoftBody/btDeformableLagrangianForce.h @@ -160,9 +160,9 @@ class btDeformableLagrangianForce // populate dx with random vectors for (int i = 0; i < dx.size(); ++i) { - dx[i].m_floats[0] = (randomDouble(-1, 1)); - dx[i].m_floats[1] = (randomDouble(-1, 1)); - dx[i].m_floats[2] = (randomDouble(-1, 1)); + dx[i].x = (randomDouble(-1, 1)); + dx[i].y = (randomDouble(-1, 1)); + dx[i].z = (randomDouble(-1, 1)); } btAlignedObjectArray errors; @@ -269,9 +269,9 @@ class btDeformableLagrangianForce // populate dx with random vectors for (int i = 0; i < dx.size(); ++i) { - dx[i].m_floats[0] = (randomDouble(-1, 1)); - dx[i].m_floats[1] = (randomDouble(-1, 1)); - dx[i].m_floats[2] = (randomDouble(-1, 1)); + dx[i].x = (randomDouble(-1, 1)); + dx[i].y = (randomDouble(-1, 1)); + dx[i].z = (randomDouble(-1, 1)); } btAlignedObjectArray errors; diff --git a/3rdparty/bullet3/src/BulletSoftBody/btSoftBody.cpp b/3rdparty/bullet3/src/BulletSoftBody/btSoftBody.cpp index 124d4d83db..8f1423a756 100644 --- a/3rdparty/bullet3/src/BulletSoftBody/btSoftBody.cpp +++ b/3rdparty/bullet3/src/BulletSoftBody/btSoftBody.cpp @@ -324,10 +324,10 @@ void btSoftBody::appendNote(const char* text, n.m_rank = 0; n.m_text = text; n.m_offset = o; - n.m_coords[0] = c.m_floats[0]; - n.m_coords[1] = c.m_floats[1]; - n.m_coords[2] = c.m_floats[2]; - n.m_coords[3] = c.m_floats[3]; + n.m_coords[0] = c.x; + n.m_coords[1] = c.y; + n.m_coords[2] = c.z; + n.m_coords[3] = c.w; n.m_nodes[0] = n0; n.m_rank += n0 ? 1 : 0; n.m_nodes[1] = n1; @@ -619,9 +619,9 @@ void btSoftBody::appendDeformableAnchor(int node, btMultiBodyLinkCollider* link) btScalar* u_t1 = &jacobianData_t1.m_deltaVelocitiesUnitImpulse[0]; btScalar* u_t2 = &jacobianData_t2.m_deltaVelocitiesUnitImpulse[0]; - btMatrix3x3 rot(normal.m_floats[0], normal.m_floats[1], normal.m_floats[2], - t1.m_floats[0], t1.m_floats[1], t1.m_floats[2], - t2.m_floats[0], t2.m_floats[1], t2.m_floats[2]); // world frame to local frame + btMatrix3x3 rot(normal.x, normal.y, normal.z, + t1.x, t1.y, t1.z, + t2.x, t2.y, t2.z); // world frame to local frame const int ndof = link->m_multiBody->getNumDofs() + 6; btMatrix3x3 local_impulse_matrix = (Diagonal(n.m_im) + OuterProduct(J_n, J_t1, J_t2, u_n, u_t1, u_t2, ndof)).inverse(); c.m_c0 = rot.transpose() * local_impulse_matrix * rot; @@ -1221,9 +1221,9 @@ void btSoftBody::setPose(bool bvolume, bool bframe) { const btVector3& q = m_pose.m_pos[i]; const btVector3 mq = m_pose.m_wgh[i] * q; - m_pose.m_aqq[0] += mq.m_floats[0] * q; - m_pose.m_aqq[1] += mq.m_floats[1] * q; - m_pose.m_aqq[2] += mq.m_floats[2] * q; + m_pose.m_aqq[0] += mq.x * q; + m_pose.m_aqq[1] += mq.y * q; + m_pose.m_aqq[2] += mq.z * q; } m_pose.m_aqq = m_pose.m_aqq.inverse(); @@ -2819,15 +2819,15 @@ static void getBarycentric(const btVector3& p, const btVector3& a, const btVecto // In the case of a degenerate triangle, pick a vertex. if (btFabs(denom) < SIMD_EPSILON) { - bary.m_floats[1] = (btScalar(0.0)); - bary.m_floats[2] = (btScalar(0.0)); + bary.y = (btScalar(0.0)); + bary.z = (btScalar(0.0)); } else { - bary.m_floats[1] = ((d11 * d20 - d01 * d21) / denom); - bary.m_floats[2] = ((d00 * d21 - d01 * d20) / denom); + bary.y = ((d11 * d20 - d01 * d21) / denom); + bary.z = ((d00 * d21 - d01 * d20) / denom); } - bary.m_floats[0] = (btScalar(1) - bary.m_floats[1] - bary.m_floats[2]); + bary.x = (btScalar(1) - bary.y - bary.z); } // @@ -3058,16 +3058,16 @@ void btSoftBody::updatePose() btMatrix3x3 Apq; const btScalar eps = SIMD_EPSILON; Apq[0] = Apq[1] = Apq[2] = btVector3(0, 0, 0); - Apq[0].m_floats[0] = (eps); - Apq[1].m_floats[1] = (eps * 2); - Apq[2].m_floats[2] = (eps * 3); + Apq[0].x = (eps); + Apq[1].y = (eps * 2); + Apq[2].z = (eps * 3); for (int i = 0, ni = m_nodes.size(); i < ni; ++i) { const btVector3 a = pose.m_wgh[i] * (m_nodes[i].m_x - com); const btVector3& b = pose.m_pos[i]; - Apq[0] += a.m_floats[0] * b; - Apq[1] += a.m_floats[1] * b; - Apq[2] += a.m_floats[2] * b; + Apq[0] += a.x * b; + Apq[1] += a.y * b; + Apq[2] += a.z * b; } btMatrix3x3 r, s; PolarDecompose(Apq, r, s); @@ -3488,9 +3488,9 @@ void btSoftBody::initializeDmInverse() btVector3 c1 = t.m_n[1]->m_x - t.m_n[0]->m_x; btVector3 c2 = t.m_n[2]->m_x - t.m_n[0]->m_x; btVector3 c3 = t.m_n[3]->m_x - t.m_n[0]->m_x; - btMatrix3x3 Dm(c1.m_floats[0], c2.m_floats[0], c3.m_floats[0], - c1.m_floats[1], c2.m_floats[1], c3.m_floats[1], - c1.m_floats[2], c2.m_floats[2], c3.m_floats[2]); + btMatrix3x3 Dm(c1.x, c2.x, c3.x, + c1.y, c2.y, c3.y, + c1.z, c2.z, c3.z); t.m_element_measure = Dm.determinant() * unit_simplex_measure; t.m_Dm_inverse = Dm.inverse(); @@ -3539,16 +3539,16 @@ void btSoftBody::updateDeformation() btVector3 c1 = t.m_n[1]->m_q - t.m_n[0]->m_q; btVector3 c2 = t.m_n[2]->m_q - t.m_n[0]->m_q; btVector3 c3 = t.m_n[3]->m_q - t.m_n[0]->m_q; - btMatrix3x3 Ds(c1.m_floats[0], c2.m_floats[0], c3.m_floats[0], - c1.m_floats[1], c2.m_floats[1], c3.m_floats[1], - c1.m_floats[2], c2.m_floats[2], c3.m_floats[2]); + btMatrix3x3 Ds(c1.x, c2.x, c3.x, + c1.y, c2.y, c3.y, + c1.z, c2.z, c3.z); t.m_F = Ds * t.m_Dm_inverse; btSoftBody::TetraScratch& s = m_tetraScratches[i]; s.m_F = t.m_F; s.m_J = t.m_F.determinant(); btMatrix3x3 C = t.m_F.transpose() * t.m_F; - s.m_trace = C[0].m_floats[0] + C[1].m_floats[1] + C[2].m_floats[2]; + s.m_trace = C[0].x + C[1].y + C[2].z; s.m_cofF = t.m_F.adjoint().transpose(); btVector3 a = t.m_n[0]->m_q; @@ -3713,8 +3713,8 @@ void btSoftBody::CJoint::Solve(btScalar dt, btScalar sor) if (m_bodies[0].m_soft == m_bodies[1].m_soft) { - if ((impulse.m_velocity.m_floats[0] == impulse.m_velocity.m_floats[0]) && (impulse.m_velocity.m_floats[1] == impulse.m_velocity.m_floats[1]) && - (impulse.m_velocity.m_floats[2] == impulse.m_velocity.m_floats[2])) + if ((impulse.m_velocity.x == impulse.m_velocity.x) && (impulse.m_velocity.y == impulse.m_velocity.y) && + (impulse.m_velocity.z == impulse.m_velocity.z)) { if (impulse.m_asVelocity) { @@ -3994,9 +3994,9 @@ void btSoftBody::PSolve_SContacts(btSoftBody* psb, btScalar, btScalar ti) } corr -= ProjectOnPlane(vr, nr) * c.m_friction; n.m_x += corr * c.m_cfm[0]; - f.m_n[0]->m_x -= corr * (c.m_cfm[1] * c.m_weights.m_floats[0]); - f.m_n[1]->m_x -= corr * (c.m_cfm[1] * c.m_weights.m_floats[1]); - f.m_n[2]->m_x -= corr * (c.m_cfm[1] * c.m_weights.m_floats[2]); + f.m_n[0]->m_x -= corr * (c.m_cfm[1] * c.m_weights.x); + f.m_n[1]->m_x -= corr * (c.m_cfm[1] * c.m_weights.y); + f.m_n[2]->m_x -= corr * (c.m_cfm[1] * c.m_weights.z); } } @@ -4670,8 +4670,8 @@ const char* btSoftBody::serialize(void* dataBuffer, class btSerializer* serializ for (int j = 0; j < 4; j++) { - memPtr->m_relPosition[0].m_floats[j] = 0.f; - memPtr->m_relPosition[1].m_floats[j] = 0.f; + memPtr->m_relPosition[0].toPtr()[j] = 0.f; + memPtr->m_relPosition[1].toPtr()[j] = 0.f; } memPtr->m_bodyA = 0; memPtr->m_bodyB = 0; diff --git a/3rdparty/bullet3/src/BulletSoftBody/btSoftBody.h b/3rdparty/bullet3/src/BulletSoftBody/btSoftBody.h index f096c94775..f54a374400 100644 --- a/3rdparty/bullet3/src/BulletSoftBody/btSoftBody.h +++ b/3rdparty/bullet3/src/BulletSoftBody/btSoftBody.h @@ -588,12 +588,12 @@ class btSoftBody : public btCollisionObject { if (impulse.m_asVelocity) { - // printf("impulse.m_velocity = %f,%f,%f\n",impulse.m_velocity.m_floats[0],impulse.m_velocity.m_floats[1],impulse.m_velocity.m_floats[2]); + // printf("impulse.m_velocity = %f,%f,%f\n",impulse.m_velocity.x,impulse.m_velocity.y,impulse.m_velocity.z); applyVImpulse(impulse.m_velocity, rpos); } if (impulse.m_asDrift) { - // printf("impulse.m_drift = %f,%f,%f\n",impulse.m_drift.m_floats[0],impulse.m_drift.m_floats[1],impulse.m_drift.m_floats[2]); + // printf("impulse.m_drift = %f,%f,%f\n",impulse.m_drift.x,impulse.m_drift.y,impulse.m_drift.z); applyDImpulse(impulse.m_drift, rpos); } } @@ -1313,7 +1313,7 @@ class btSoftBody : public btCollisionObject const T& c, const btVector3& coord) { - return (a * coord.m_floats[0] + b * coord.m_floats[1] + c * coord.m_floats[2]); + return (a * coord.x + b * coord.y + c * coord.z); } void applyRepulsionForce(btScalar timeStep, bool applySpringForce) diff --git a/3rdparty/bullet3/src/BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.cpp b/3rdparty/bullet3/src/BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.cpp index fbe4547d35..e6ad5a1a41 100644 --- a/3rdparty/bullet3/src/BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.cpp +++ b/3rdparty/bullet3/src/BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.cpp @@ -138,7 +138,7 @@ void btSoftBodyTriangleCallback::processTriangle(btVector3* triangle, int partId triangle[1] - normal, triangle[2] - normal}; - btConvexHullShape* tm = new btConvexHullShape(&pts[0].m_floats[0], 6); + btConvexHullShape* tm = new btConvexHullShape(&pts[0].x, 6); // btBU_Simplex1to4 tm(triangle[0],triangle[1],triangle[2],other); diff --git a/3rdparty/bullet3/src/BulletSoftBody/btSoftBodyHelpers.cpp b/3rdparty/bullet3/src/BulletSoftBody/btSoftBodyHelpers.cpp index f389534d27..d768e10173 100644 --- a/3rdparty/bullet3/src/BulletSoftBody/btSoftBodyHelpers.cpp +++ b/3rdparty/bullet3/src/BulletSoftBody/btSoftBodyHelpers.cpp @@ -42,14 +42,14 @@ static void drawBox(btIDebugDraw* idraw, const btVector3& maxs, const btVector3& color) { - const btVector3 c[] = {btVector3(mins.m_floats[0], mins.m_floats[1], mins.m_floats[2]), - btVector3(maxs.m_floats[0], mins.m_floats[1], mins.m_floats[2]), - btVector3(maxs.m_floats[0], maxs.m_floats[1], mins.m_floats[2]), - btVector3(mins.m_floats[0], maxs.m_floats[1], mins.m_floats[2]), - btVector3(mins.m_floats[0], mins.m_floats[1], maxs.m_floats[2]), - btVector3(maxs.m_floats[0], mins.m_floats[1], maxs.m_floats[2]), - btVector3(maxs.m_floats[0], maxs.m_floats[1], maxs.m_floats[2]), - btVector3(mins.m_floats[0], maxs.m_floats[1], maxs.m_floats[2])}; + const btVector3 c[] = {btVector3(mins.x, mins.y, mins.z), + btVector3(maxs.x, mins.y, mins.z), + btVector3(maxs.x, maxs.y, mins.z), + btVector3(mins.x, maxs.y, mins.z), + btVector3(mins.x, mins.y, maxs.z), + btVector3(maxs.x, mins.y, maxs.z), + btVector3(maxs.x, maxs.y, maxs.z), + btVector3(mins.x, maxs.y, maxs.z)}; idraw->drawLine(c[0], c[1], color); idraw->drawLine(c[1], c[2], color); idraw->drawLine(c[2], c[3], color); @@ -205,7 +205,7 @@ void btSoftBodyHelpers::Draw(btSoftBody* psb, int count = vertices.size(); btScalar shrink = 0.f; btScalar shrinkClamp = 0.f; - computer.compute(&vertices[0].m_floats[0], stride, count, shrink, shrinkClamp); + computer.compute(&vertices[0].x, stride, count, shrink, shrinkClamp); for (int i = 0; i < computer.faces.size(); i++) { int face = computer.faces[i]; @@ -750,10 +750,10 @@ btSoftBody* btSoftBodyHelpers::CreatePatch(btSoftBodyWorldInfo& worldInfo, const const btScalar tx = ix / (btScalar)(rx - 1); btScalar pert = perturbation * btScalar(rand()) / RAND_MAX; btVector3 temp1 = py1; - temp1.m_floats[1] = (py1.m_floats[1] + pert); + temp1.y = (py1.y + pert); btVector3 temp = py0; pert = perturbation * btScalar(rand()) / RAND_MAX; - temp.m_floats[1] = (py0.m_floats[1] + pert); + temp.y = (py0.y + pert); x[IDX(ix, iy)] = lerp(temp, temp1, tx); m[IDX(ix, iy)] = 1; } @@ -1173,9 +1173,9 @@ btSoftBody* btSoftBodyHelpers::CreateFromTetGenData(btSoftBodyWorldInfo& worldIn //if(hasbounds) // sn>>bound; - pos[index].m_floats[0] = (btScalar(x)); - pos[index].m_floats[1] = (btScalar(y)); - pos[index].m_floats[2] = (btScalar(z)); + pos[index].x = (btScalar(x)); + pos[index].y = (btScalar(y)); + pos[index].z = (btScalar(z)); } btSoftBody* psb = new btSoftBody(&worldInfo, nnode, &pos[0], 0); #if 0 @@ -1292,12 +1292,12 @@ btSoftBody* btSoftBodyHelpers::CreateFromVtkFile(btSoftBodyWorldInfo& worldInfo, { btScalar p; ss >> p; - position.m_floats[0] = (p); + position.x = (p); ss >> p; - position.m_floats[1] = (p); + position.y = (p); ss >> p; - position.m_floats[2] = (p); - //printf("v %f %f %f\n", position.m_floats[0], position.m_floats[1], position.m_floats[2]); + position.z = (p); + //printf("v %f %f %f\n", position.x, position.y, position.z); X[x_count++] = position; } else if (reading_tets) diff --git a/3rdparty/bullet3/src/BulletSoftBody/btSoftBodyInternals.h b/3rdparty/bullet3/src/BulletSoftBody/btSoftBodyInternals.h index af09fd6e98..5e517dc6f1 100644 --- a/3rdparty/bullet3/src/BulletSoftBody/btSoftBodyInternals.h +++ b/3rdparty/bullet3/src/BulletSoftBody/btSoftBodyInternals.h @@ -46,9 +46,9 @@ static SIMD_FORCE_INLINE void findJacobian(const btMultiBodyLinkCollider* multib } static SIMD_FORCE_INLINE btVector3 generateUnitOrthogonalVector(const btVector3& u) { - btScalar ux = u.m_floats[0]; - btScalar uy = u.m_floats[1]; - btScalar uz = u.m_floats[2]; + btScalar ux = u.x; + btScalar uy = u.y; + btScalar uz = u.z; btScalar ax = std::abs(ux); btScalar ay = std::abs(uy); btScalar az = std::abs(uz); @@ -686,14 +686,14 @@ class btSoftBodyCollisionShape : public btConcaveShape /* t is usually identity, except when colliding against btCompoundShape. See Issue 512 */ const btVector3 mins = m_body->m_bounds[0]; const btVector3 maxs = m_body->m_bounds[1]; - const btVector3 crns[] = {t * btVector3(mins.m_floats[0], mins.m_floats[1], mins.m_floats[2]), - t * btVector3(maxs.m_floats[0], mins.m_floats[1], mins.m_floats[2]), - t * btVector3(maxs.m_floats[0], maxs.m_floats[1], mins.m_floats[2]), - t * btVector3(mins.m_floats[0], maxs.m_floats[1], mins.m_floats[2]), - t * btVector3(mins.m_floats[0], mins.m_floats[1], maxs.m_floats[2]), - t * btVector3(maxs.m_floats[0], mins.m_floats[1], maxs.m_floats[2]), - t * btVector3(maxs.m_floats[0], maxs.m_floats[1], maxs.m_floats[2]), - t * btVector3(mins.m_floats[0], maxs.m_floats[1], maxs.m_floats[2])}; + const btVector3 crns[] = {t * btVector3(mins.x, mins.y, mins.z), + t * btVector3(maxs.x, mins.y, mins.z), + t * btVector3(maxs.x, maxs.y, mins.z), + t * btVector3(mins.x, maxs.y, mins.z), + t * btVector3(mins.x, mins.y, maxs.z), + t * btVector3(maxs.x, mins.y, maxs.z), + t * btVector3(maxs.x, maxs.y, maxs.z), + t * btVector3(mins.x, maxs.y, maxs.z)}; aabbMin = aabbMax = crns[0]; for (int i = 1; i < 8; ++i) { @@ -873,12 +873,12 @@ static inline btScalar ClusterMetric(const btVector3& x, const btVector3& y) // static inline btMatrix3x3 ScaleAlongAxis(const btVector3& a, btScalar s) { - const btScalar xx = a.m_floats[0] * a.m_floats[0]; - const btScalar yy = a.m_floats[1] * a.m_floats[1]; - const btScalar zz = a.m_floats[2] * a.m_floats[2]; - const btScalar xy = a.m_floats[0] * a.m_floats[1]; - const btScalar yz = a.m_floats[1] * a.m_floats[2]; - const btScalar zx = a.m_floats[2] * a.m_floats[0]; + const btScalar xx = a.x * a.x; + const btScalar yy = a.y * a.y; + const btScalar zz = a.z * a.z; + const btScalar xy = a.x * a.y; + const btScalar yz = a.y * a.z; + const btScalar zx = a.z * a.x; btMatrix3x3 m; m[0] = btVector3(1 - xx + xx * s, xy * s - xy, zx * s - zx); m[1] = btVector3(xy * s - xy, 1 - yy + yy * s, yz * s - yz); @@ -889,9 +889,9 @@ static inline btMatrix3x3 ScaleAlongAxis(const btVector3& a, btScalar s) static inline btMatrix3x3 Cross(const btVector3& v) { btMatrix3x3 m; - m[0] = btVector3(0, -v.m_floats[2], +v.m_floats[1]); - m[1] = btVector3(+v.m_floats[2], 0, -v.m_floats[0]); - m[2] = btVector3(-v.m_floats[1], +v.m_floats[0], 0); + m[0] = btVector3(0, -v.z, +v.y); + m[1] = btVector3(+v.z, 0, -v.x); + m[2] = btVector3(-v.y, +v.x, 0); return (m); } // @@ -907,9 +907,9 @@ static inline btMatrix3x3 Diagonal(btScalar x) static inline btMatrix3x3 Diagonal(const btVector3& v) { btMatrix3x3 m; - m[0] = btVector3(v.m_floats[0], 0, 0); - m[1] = btVector3(0, v.m_floats[1], 0); - m[2] = btVector3(0, 0, v.m_floats[2]); + m[0] = btVector3(v.x, 0, 0); + m[1] = btVector3(0, v.y, 0); + m[2] = btVector3(0, 0, v.z); return (m); } @@ -1180,7 +1180,7 @@ static inline T BaryEval(const T& a, const T& c, const btVector3& coord) { - return (a * coord.m_floats[0] + b * coord.m_floats[1] + c * coord.m_floats[2]); + return (a * coord.x + b * coord.y + c * coord.z); } // static inline btVector3 BaryCoord(const btVector3& a, @@ -1472,7 +1472,7 @@ struct btSoftColliders joint.m_drift = depth * norm; joint.m_normal = norm; - // printf("normal=%f,%f,%f\n",res.normal.m_floats[0],res.normal.m_floats[1],res.normal.m_floats[2]); + // printf("normal=%f,%f,%f\n",res.normal.x,res.normal.y,res.normal.z); joint.m_delete = false; joint.m_friction = fv.length2() < (rvac * friction * rvac * friction) ? 1 : friction; joint.m_massmatrix = ImpulseMatrix(ba.invMass(), ba.invWorldInertia(), joint.m_rpos[0], @@ -1727,9 +1727,9 @@ struct btSoftColliders btScalar* u_t1 = &jacobianData_t1.m_deltaVelocitiesUnitImpulse[0]; btScalar* u_t2 = &jacobianData_t2.m_deltaVelocitiesUnitImpulse[0]; - btMatrix3x3 rot(normal.m_floats[0], normal.m_floats[1], normal.m_floats[2], - t1.m_floats[0], t1.m_floats[1], t1.m_floats[2], - t2.m_floats[0], t2.m_floats[1], t2.m_floats[2]); // world frame to local frame + btMatrix3x3 rot(normal.x, normal.y, normal.z, + t1.x, t1.y, t1.z, + t2.x, t2.y, t2.z); // world frame to local frame const int ndof = multibodyLinkCol->m_multiBody->getNumDofs() + 6; btMatrix3x3 local_impulse_matrix; @@ -1801,7 +1801,7 @@ struct btSoftColliders const btScalar fc = psb->m_cfg.kDF * m_colObj1Wrap->m_collisionObject->m_friction; // the effective inverse mass of the face as in https://graphics.stanford.edu/papers/cloth-sig02/cloth.pdf - ima = bary.m_floats[0] * c.m_weights.m_floats[0] * n0->m_im + bary.m_floats[1] * c.m_weights.m_floats[1] * n1->m_im + bary.m_floats[2] * c.m_weights.m_floats[2] * n2->m_im; + ima = bary.x * c.m_weights.x * n0->m_im + bary.y * c.m_weights.y * n1->m_im + bary.z * c.m_weights.z * n2->m_im; c.m_c2 = ima; c.m_c3 = fc; c.m_c4 = m_colObj1Wrap->m_collisionObject->isStaticOrKinematicObject() ? psb->m_cfg.kKHR : psb->m_cfg.kCHR; @@ -1838,9 +1838,9 @@ struct btSoftColliders btScalar* u_t1 = &jacobianData_t1.m_deltaVelocitiesUnitImpulse[0]; btScalar* u_t2 = &jacobianData_t2.m_deltaVelocitiesUnitImpulse[0]; - btMatrix3x3 rot(normal.m_floats[0], normal.m_floats[1], normal.m_floats[2], - t1.m_floats[0], t1.m_floats[1], t1.m_floats[2], - t2.m_floats[0], t2.m_floats[1], t2.m_floats[2]); // world frame to local frame + btMatrix3x3 rot(normal.x, normal.y, normal.z, + t1.x, t1.y, t1.z, + t2.x, t2.y, t2.z); // world frame to local frame const int ndof = multibodyLinkCol->m_multiBody->getNumDofs() + 6; btMatrix3x3 local_impulse_matrix = (Diagonal(ima) + OuterProduct(J_n, J_t1, J_t2, u_n, u_t1, u_t2, ndof)).inverse(); c.m_c0 = rot.transpose() * local_impulse_matrix * rot; diff --git a/3rdparty/bullet3/src/BulletSoftBody/btSparseSDF.h b/3rdparty/bullet3/src/BulletSoftBody/btSparseSDF.h index 4a692c0e6a..1df91a90f5 100644 --- a/3rdparty/bullet3/src/BulletSoftBody/btSparseSDF.h +++ b/3rdparty/bullet3/src/BulletSoftBody/btSparseSDF.h @@ -200,9 +200,9 @@ struct btSparseSdf { /* Lookup cell */ const btVector3 scx = x / voxelsz; - const IntFrac ix = Decompose(scx.m_floats[0]); - const IntFrac iy = Decompose(scx.m_floats[1]); - const IntFrac iz = Decompose(scx.m_floats[2]); + const IntFrac ix = Decompose(scx.x); + const IntFrac iy = Decompose(scx.y); + const IntFrac iz = Decompose(scx.z); const unsigned h = Hash(ix.b, iy.b, iz.b, shape); Cell*& root = cells[static_cast(h % cells.size())]; Cell* c = root; @@ -268,11 +268,11 @@ struct btSparseSdf d[7] - d[4], d[6] - d[5]}; const btScalar gz[] = {d[4] - d[0], d[5] - d[1], d[7] - d[3], d[6] - d[2]}; - normal.m_floats[0] = (Lerp(Lerp(gx[0], gx[1], iy.f), + normal.x = (Lerp(Lerp(gx[0], gx[1], iy.f), Lerp(gx[2], gx[3], iy.f), iz.f)); - normal.m_floats[1] = (Lerp(Lerp(gy[0], gy[1], ix.f), + normal.y = (Lerp(Lerp(gy[0], gy[1], ix.f), Lerp(gy[2], gy[3], ix.f), iz.f)); - normal.m_floats[2] = (Lerp(Lerp(gz[0], gz[1], ix.f), + normal.z = (Lerp(Lerp(gz[0], gz[1], ix.f), Lerp(gz[2], gz[3], ix.f), iy.f)); normal.safeNormalize(); #else @@ -294,13 +294,13 @@ struct btSparseSdf CELLSIZE * voxelsz; for (int k = 0; k <= CELLSIZE; ++k) { - const btScalar z = voxelsz * k + org.m_floats[2]; + const btScalar z = voxelsz * k + org.z; for (int j = 0; j <= CELLSIZE; ++j) { - const btScalar y = voxelsz * j + org.m_floats[1]; + const btScalar y = voxelsz * j + org.y; for (int i = 0; i <= CELLSIZE; ++i) { - const btScalar x = voxelsz * i + org.m_floats[0]; + const btScalar x = voxelsz * i + org.x; c.d[i][j][k] = DistanceToShape(btVector3(x, y, z), c.pclient); } diff --git a/3rdparty/bullet3/src/LinearMath/btAabbUtil2.h b/3rdparty/bullet3/src/LinearMath/btAabbUtil2.h index b42bbd2b61..105245f5f2 100644 --- a/3rdparty/bullet3/src/LinearMath/btAabbUtil2.h +++ b/3rdparty/bullet3/src/LinearMath/btAabbUtil2.h @@ -33,9 +33,9 @@ SIMD_FORCE_INLINE bool TestPointAgainstAabb2(const btVector3& aabbMin1, const bt const btVector3& point) { bool overlap = true; - overlap = (aabbMin1.m_floats[0] > point.m_floats[0] || aabbMax1.m_floats[0] < point.m_floats[0]) ? false : overlap; - overlap = (aabbMin1.m_floats[2] > point.m_floats[2] || aabbMax1.m_floats[2] < point.m_floats[2]) ? false : overlap; - overlap = (aabbMin1.m_floats[1] > point.m_floats[1] || aabbMax1.m_floats[1] < point.m_floats[1]) ? false : overlap; + overlap = (aabbMin1.x > point.x || aabbMax1.x < point.x) ? false : overlap; + overlap = (aabbMin1.z > point.z || aabbMax1.z < point.z) ? false : overlap; + overlap = (aabbMin1.y > point.y || aabbMax1.y < point.y) ? false : overlap; return overlap; } @@ -44,9 +44,9 @@ SIMD_FORCE_INLINE bool TestAabbAgainstAabb2(const btVector3& aabbMin1, const btV const btVector3& aabbMin2, const btVector3& aabbMax2) { bool overlap = true; - overlap = (aabbMin1.m_floats[0] > aabbMax2.m_floats[0] || aabbMax1.m_floats[0] < aabbMin2.m_floats[0]) ? false : overlap; - overlap = (aabbMin1.m_floats[2] > aabbMax2.m_floats[2] || aabbMax1.m_floats[2] < aabbMin2.m_floats[2]) ? false : overlap; - overlap = (aabbMin1.m_floats[1] > aabbMax2.m_floats[1] || aabbMax1.m_floats[1] < aabbMin2.m_floats[1]) ? false : overlap; + overlap = (aabbMin1.x > aabbMax2.x || aabbMax1.x < aabbMin2.x) ? false : overlap; + overlap = (aabbMin1.z > aabbMax2.z || aabbMax1.z < aabbMin2.z) ? false : overlap; + overlap = (aabbMin1.y > aabbMax2.y || aabbMax1.y < aabbMin2.y) ? false : overlap; return overlap; } @@ -71,12 +71,12 @@ SIMD_FORCE_INLINE bool TestTriangleAgainstAabb2(const btVector3* vertices, SIMD_FORCE_INLINE int btOutcode(const btVector3& p, const btVector3& halfExtent) { - return (p.m_floats[0] < -halfExtent.m_floats[0] ? 0x01 : 0x0) | - (p.m_floats[0] > halfExtent.m_floats[0] ? 0x08 : 0x0) | - (p.m_floats[1] < -halfExtent.m_floats[1] ? 0x02 : 0x0) | - (p.m_floats[1] > halfExtent.m_floats[1] ? 0x10 : 0x0) | - (p.m_floats[2] < -halfExtent.m_floats[2] ? 0x4 : 0x0) | - (p.m_floats[2] > halfExtent.m_floats[2] ? 0x20 : 0x0); + return (p.x < -halfExtent.x ? 0x01 : 0x0) | + (p.x > halfExtent.x ? 0x08 : 0x0) | + (p.y < -halfExtent.y ? 0x02 : 0x0) | + (p.y > halfExtent.y ? 0x10 : 0x0) | + (p.z < -halfExtent.z ? 0x4 : 0x0) | + (p.z > halfExtent.z ? 0x20 : 0x0); } SIMD_FORCE_INLINE bool btRayAabb2(const btVector3& rayFrom, @@ -88,10 +88,10 @@ SIMD_FORCE_INLINE bool btRayAabb2(const btVector3& rayFrom, btScalar lambda_max) { btScalar tmax, tymin, tymax, tzmin, tzmax; - tmin = (bounds[raySign[0]].m_floats[0] - rayFrom.m_floats[0]) * rayInvDirection.m_floats[0]; - tmax = (bounds[1 - raySign[0]].m_floats[0] - rayFrom.m_floats[0]) * rayInvDirection.m_floats[0]; - tymin = (bounds[raySign[1]].m_floats[1] - rayFrom.m_floats[1]) * rayInvDirection.m_floats[1]; - tymax = (bounds[1 - raySign[1]].m_floats[1] - rayFrom.m_floats[1]) * rayInvDirection.m_floats[1]; + tmin = (bounds[raySign[0]].x - rayFrom.x) * rayInvDirection.x; + tmax = (bounds[1 - raySign[0]].x - rayFrom.x) * rayInvDirection.x; + tymin = (bounds[raySign[1]].y - rayFrom.y) * rayInvDirection.y; + tymax = (bounds[1 - raySign[1]].y - rayFrom.y) * rayInvDirection.y; if ((tmin > tymax) || (tymin > tmax)) return false; @@ -102,8 +102,8 @@ SIMD_FORCE_INLINE bool btRayAabb2(const btVector3& rayFrom, if (tymax < tmax) tmax = tymax; - tzmin = (bounds[raySign[2]].m_floats[2] - rayFrom.m_floats[2]) * rayInvDirection.m_floats[2]; - tzmax = (bounds[1 - raySign[2]].m_floats[2] - rayFrom.m_floats[2]) * rayInvDirection.m_floats[2]; + tzmin = (bounds[raySign[2]].z - rayFrom.z) * rayInvDirection.z; + tzmax = (bounds[1 - raySign[2]].z - rayFrom.z) * rayInvDirection.z; if ((tmin > tzmax) || (tzmin > tmax)) return false; @@ -181,9 +181,9 @@ SIMD_FORCE_INLINE void btTransformAabb(const btVector3& halfExtents, btScalar ma SIMD_FORCE_INLINE void btTransformAabb(const btVector3& localAabbMin, const btVector3& localAabbMax, btScalar margin, const btTransform& trans, btVector3& aabbMinOut, btVector3& aabbMaxOut) { - btAssert(localAabbMin.m_floats[0] <= localAabbMax.m_floats[0]); - btAssert(localAabbMin.m_floats[1] <= localAabbMax.m_floats[1]); - btAssert(localAabbMin.m_floats[2] <= localAabbMax.m_floats[2]); + btAssert(localAabbMin.x <= localAabbMax.x); + btAssert(localAabbMin.y <= localAabbMax.y); + btAssert(localAabbMin.z <= localAabbMax.z); btVector3 localHalfExtents = btScalar(0.5) * (localAabbMax - localAabbMin); localHalfExtents += btVector3(margin, margin, margin); diff --git a/3rdparty/bullet3/src/LinearMath/btConvexHull.cpp b/3rdparty/bullet3/src/LinearMath/btConvexHull.cpp index d789b6a0bb..670fec7478 100644 --- a/3rdparty/bullet3/src/LinearMath/btConvexHull.cpp +++ b/3rdparty/bullet3/src/LinearMath/btConvexHull.cpp @@ -75,7 +75,7 @@ btVector3 ThreePlaneIntersection(const btPlane &p0, const btPlane &p1, const btP potentialVertex += n1n2; potentialVertex *= quotient; - btVector3 result(potentialVertex.m_floats[0], potentialVertex.m_floats[1], potentialVertex.m_floats[2]); + btVector3 result(potentialVertex.x, potentialVertex.y, potentialVertex.z); return result; } @@ -941,9 +941,9 @@ bool HullLibrary::CleanupVertices(unsigned int svcount, const btVector3 *p = (const btVector3 *)vtx; vtx += stride; - btScalar px = p->m_floats[0]; - btScalar py = p->m_floats[1]; - btScalar pz = p->m_floats[2]; + btScalar px = p->x; + btScalar py = p->y; + btScalar pz = p->z; if (scale) { diff --git a/3rdparty/bullet3/src/LinearMath/btMatrix3x3.h b/3rdparty/bullet3/src/LinearMath/btMatrix3x3.h index 5a99bde629..f07bb21980 100644 --- a/3rdparty/bullet3/src/LinearMath/btMatrix3x3.h +++ b/3rdparty/bullet3/src/LinearMath/btMatrix3x3.h @@ -270,10 +270,10 @@ btMatrix3x3 m_el[1] = V2; m_el[2] = V3; #else - btScalar xs = q.m_floats[0] * s, ys = q.m_floats[1] * s, zs = q.m_floats[2] * s; - btScalar wx = q.m_floats[3] * xs, wy = q.m_floats[3] * ys, wz = q.m_floats[3] * zs; - btScalar xx = q.m_floats[0] * xs, xy = q.m_floats[0] * ys, xz = q.m_floats[0] * zs; - btScalar yy = q.m_floats[1] * ys, yz = q.m_floats[1] * zs, zz = q.m_floats[2] * zs; + btScalar xs = q.x * s, ys = q.y * s, zs = q.z * s; + btScalar wx = q.w * xs, wy = q.w * ys, wz = q.w * zs; + btScalar xx = q.x * xs, xy = q.x * ys, xz = q.x * zs; + btScalar yy = q.y * ys, yz = q.y * zs, zz = q.z * zs; setValue( btScalar(1.0) - (yy + zz), xy - wz, xz + wy, xy + wz, btScalar(1.0) - (xx + zz), yz - wx, @@ -400,17 +400,17 @@ btMatrix3x3 vm[1] = v1; vm[2] = v2; #else - m[0] = btScalar(m_el[0].m_floats[0]); - m[1] = btScalar(m_el[1].m_floats[0]); - m[2] = btScalar(m_el[2].m_floats[0]); + m[0] = btScalar(m_el[0].x); + m[1] = btScalar(m_el[1].x); + m[2] = btScalar(m_el[2].x); m[3] = btScalar(0.0); - m[4] = btScalar(m_el[0].m_floats[1]); - m[5] = btScalar(m_el[1].m_floats[1]); - m[6] = btScalar(m_el[2].m_floats[1]); + m[4] = btScalar(m_el[0].y); + m[5] = btScalar(m_el[1].y); + m[6] = btScalar(m_el[2].y); m[7] = btScalar(0.0); - m[8] = btScalar(m_el[0].m_floats[2]); - m[9] = btScalar(m_el[1].m_floats[2]); - m[10] = btScalar(m_el[2].m_floats[2]); + m[8] = btScalar(m_el[0].z); + m[9] = btScalar(m_el[1].z); + m[10] = btScalar(m_el[2].z); m[11] = btScalar(0.0); #endif } @@ -420,7 +420,7 @@ btMatrix3x3 void getRotation(btQuaternion & q) const { #if (defined(BT_USE_SSE_IN_API) && defined(BT_USE_SSE)) || defined(BT_USE_NEON) - btScalar trace = m_el[0].m_floats[0] + m_el[1].m_floats[1] + m_el[2].m_floats[2]; + btScalar trace = m_el[0].x + m_el[1].y + m_el[2].z; btScalar s, x; union { @@ -432,18 +432,18 @@ btMatrix3x3 { x = trace + btScalar(1.0); - temp.f[0] = m_el[2].m_floats[1] - m_el[1].m_floats[2]; - temp.f[1] = m_el[0].m_floats[2] - m_el[2].m_floats[0]; - temp.f[2] = m_el[1].m_floats[0] - m_el[0].m_floats[1]; + temp.f[0] = m_el[2].y - m_el[1].z; + temp.f[1] = m_el[0].z - m_el[2].x; + temp.f[2] = m_el[1].x - m_el[0].y; temp.f[3] = x; //temp.f[3]= s * btScalar(0.5); } else { int i, j, k; - if (m_el[0].m_floats[0] < m_el[1].m_floats[1]) + if (m_el[0].x < m_el[1].y) { - if (m_el[1].m_floats[1] < m_el[2].m_floats[2]) + if (m_el[1].y < m_el[2].z) { i = 2; j = 0; @@ -458,7 +458,7 @@ btMatrix3x3 } else { - if (m_el[0].m_floats[0] < m_el[2].m_floats[2]) + if (m_el[0].x < m_el[2].z) { i = 2; j = 0; @@ -487,7 +487,7 @@ btMatrix3x3 q *= s; #else - btScalar trace = m_el[0].m_floats[0] + m_el[1].m_floats[1] + m_el[2].m_floats[2]; + btScalar trace = m_el[0].x + m_el[1].y + m_el[2].z; btScalar temp[4]; @@ -497,13 +497,13 @@ btMatrix3x3 temp[3] = (s * btScalar(0.5)); s = btScalar(0.5) / s; - temp[0] = ((m_el[2].m_floats[1] - m_el[1].m_floats[2]) * s); - temp[1] = ((m_el[0].m_floats[2] - m_el[2].m_floats[0]) * s); - temp[2] = ((m_el[1].m_floats[0] - m_el[0].m_floats[1]) * s); + temp[0] = ((m_el[2].y - m_el[1].z) * s); + temp[1] = ((m_el[0].z - m_el[2].x) * s); + temp[2] = ((m_el[1].x - m_el[0].y) * s); } else { - int i = m_el[0].m_floats[0] < m_el[1].m_floats[1] ? (m_el[1].m_floats[1] < m_el[2].m_floats[2] ? 2 : 1) : (m_el[0].m_floats[0] < m_el[2].m_floats[2] ? 2 : 0); + int i = m_el[0].x < m_el[1].y ? (m_el[1].y < m_el[2].z ? 2 : 1) : (m_el[0].x < m_el[2].z ? 2 : 0); int j = (i + 1) % 3; int k = (i + 2) % 3; @@ -526,9 +526,9 @@ btMatrix3x3 void getEulerYPR(btScalar & yaw, btScalar & pitch, btScalar & roll) const { // first use the normal calculus - yaw = btScalar(btAtan2(m_el[1].m_floats[0], m_el[0].m_floats[0])); - pitch = btScalar(btAsin(-m_el[2].m_floats[0])); - roll = btScalar(btAtan2(m_el[2].m_floats[1], m_el[2].m_floats[2])); + yaw = btScalar(btAtan2(m_el[1].x, m_el[0].x)); + pitch = btScalar(btAsin(-m_el[2].x)); + roll = btScalar(btAtan2(m_el[2].y, m_el[2].z)); // on pitch = +/-HalfPI if (btFabs(pitch) == SIMD_HALF_PI) @@ -564,14 +564,14 @@ btMatrix3x3 //get the pointer to the raw data // Check that pitch is not at a singularity - if (btFabs(m_el[2].m_floats[0]) >= 1) + if (btFabs(m_el[2].x) >= 1) { euler_out.yaw = 0; euler_out2.yaw = 0; // From difference of angles formula - btScalar delta = btAtan2(m_el[0].m_floats[0], m_el[0].m_floats[2]); - if (m_el[2].m_floats[0] > 0) //gimbal locked up + btScalar delta = btAtan2(m_el[0].x, m_el[0].z); + if (m_el[2].x > 0) //gimbal locked up { euler_out.pitch = SIMD_PI / btScalar(2.0); euler_out2.pitch = SIMD_PI / btScalar(2.0); @@ -588,18 +588,18 @@ btMatrix3x3 } else { - euler_out.pitch = -btAsin(m_el[2].m_floats[0]); + euler_out.pitch = -btAsin(m_el[2].x); euler_out2.pitch = SIMD_PI - euler_out.pitch; - euler_out.roll = btAtan2(m_el[2].m_floats[1] / btCos(euler_out.pitch), - m_el[2].m_floats[2] / btCos(euler_out.pitch)); - euler_out2.roll = btAtan2(m_el[2].m_floats[1] / btCos(euler_out2.pitch), - m_el[2].m_floats[2] / btCos(euler_out2.pitch)); + euler_out.roll = btAtan2(m_el[2].y / btCos(euler_out.pitch), + m_el[2].z / btCos(euler_out.pitch)); + euler_out2.roll = btAtan2(m_el[2].y / btCos(euler_out2.pitch), + m_el[2].z / btCos(euler_out2.pitch)); - euler_out.yaw = btAtan2(m_el[1].m_floats[0] / btCos(euler_out.pitch), - m_el[0].m_floats[0] / btCos(euler_out.pitch)); - euler_out2.yaw = btAtan2(m_el[1].m_floats[0] / btCos(euler_out2.pitch), - m_el[0].m_floats[0] / btCos(euler_out2.pitch)); + euler_out.yaw = btAtan2(m_el[1].x / btCos(euler_out.pitch), + m_el[0].x / btCos(euler_out.pitch)); + euler_out2.yaw = btAtan2(m_el[1].x / btCos(euler_out2.pitch), + m_el[0].x / btCos(euler_out2.pitch)); } if (solution_number == 1) @@ -625,9 +625,9 @@ btMatrix3x3 return btMatrix3x3(m_el[0] * s, m_el[1] * s, m_el[2] * s); #else return btMatrix3x3( - m_el[0].m_floats[0] * s.m_floats[0], m_el[0].m_floats[1] * s.m_floats[1], m_el[0].m_floats[2] * s.m_floats[2], - m_el[1].m_floats[0] * s.m_floats[0], m_el[1].m_floats[1] * s.m_floats[1], m_el[1].m_floats[2] * s.m_floats[2], - m_el[2].m_floats[0] * s.m_floats[0], m_el[2].m_floats[1] * s.m_floats[1], m_el[2].m_floats[2] * s.m_floats[2]); + m_el[0].x * s.x, m_el[0].y * s.y, m_el[0].z * s.z, + m_el[1].x * s.x, m_el[1].y * s.y, m_el[1].z * s.z, + m_el[2].x * s.x, m_el[2].y * s.y, m_el[2].z * s.z); #endif } @@ -668,15 +668,15 @@ btMatrix3x3 SIMD_FORCE_INLINE btScalar tdotx(const btVector3& v) const { - return m_el[0].m_floats[0] * v.m_floats[0] + m_el[1].m_floats[0] * v.m_floats[1] + m_el[2].m_floats[0] * v.m_floats[2]; + return m_el[0].x * v.x + m_el[1].x * v.y + m_el[2].x * v.z; } SIMD_FORCE_INLINE btScalar tdoty(const btVector3& v) const { - return m_el[0].m_floats[1] * v.m_floats[0] + m_el[1].m_floats[1] * v.m_floats[1] + m_el[2].m_floats[1] * v.m_floats[2]; + return m_el[0].y * v.x + m_el[1].y * v.y + m_el[2].y * v.z; } SIMD_FORCE_INLINE btScalar tdotz(const btVector3& v) const { - return m_el[0].m_floats[2] * v.m_floats[0] + m_el[1].m_floats[2] * v.m_floats[1] + m_el[2].m_floats[2] * v.m_floats[2]; + return m_el[0].z * v.x + m_el[1].z * v.y + m_el[2].z * v.z; } ///extractRotation is from "A robust method to extract the rotational part of deformations" @@ -942,9 +942,9 @@ operator*(const btMatrix3x3& m, const btScalar& k) vmulq_n_f32(m[2].mVec128, k)); #else return btMatrix3x3( - m[0].m_floats[0] * k, m[0].m_floats[1] * k, m[0].m_floats[2] * k, - m[1].m_floats[0] * k, m[1].m_floats[1] * k, m[1].m_floats[2] * k, - m[2].m_floats[0] * k, m[2].m_floats[1] * k, m[2].m_floats[2] * k); + m[0].x * k, m[0].y * k, m[0].z * k, + m[1].x * k, m[1].y * k, m[1].z * k, + m[2].x * k, m[2].y * k, m[2].z * k); #endif } @@ -1039,9 +1039,9 @@ btMatrix3x3::absolute() const (float32x4_t)vandq_s32((int32x4_t)m_el[2].mVec128, btv3AbsMask)); #else return btMatrix3x3( - btFabs(m_el[0].m_floats[0]), btFabs(m_el[0].m_floats[1]), btFabs(m_el[0].m_floats[2]), - btFabs(m_el[1].m_floats[0]), btFabs(m_el[1].m_floats[1]), btFabs(m_el[1].m_floats[2]), - btFabs(m_el[2].m_floats[0]), btFabs(m_el[2].m_floats[1]), btFabs(m_el[2].m_floats[2])); + btFabs(m_el[0].x), btFabs(m_el[0].y), btFabs(m_el[0].z), + btFabs(m_el[1].x), btFabs(m_el[1].y), btFabs(m_el[1].z), + btFabs(m_el[2].x), btFabs(m_el[2].y), btFabs(m_el[2].z)); #endif } @@ -1075,9 +1075,9 @@ btMatrix3x3::transpose() const float32x4_t v2 = vcombine_f32(vget_high_f32(top.val[0]), q); // z0 z1 z2 0 return btMatrix3x3(v0, v1, v2); #else - return btMatrix3x3(m_el[0].m_floats[0], m_el[1].m_floats[0], m_el[2].m_floats[0], - m_el[0].m_floats[1], m_el[1].m_floats[1], m_el[2].m_floats[1], - m_el[0].m_floats[2], m_el[1].m_floats[2], m_el[2].m_floats[2]); + return btMatrix3x3(m_el[0].x, m_el[1].x, m_el[2].x, + m_el[0].y, m_el[1].y, m_el[2].y, + m_el[0].z, m_el[1].z, m_el[2].z); #endif } @@ -1097,9 +1097,9 @@ btMatrix3x3::inverse() const //btFullAssert(det != btScalar(0.0)); btAssert(det != btScalar(0.0)); btScalar s = btScalar(1.0) / det; - return btMatrix3x3(co.m_floats[0] * s, cofac(0, 2, 2, 1) * s, cofac(0, 1, 1, 2) * s, - co.m_floats[1] * s, cofac(0, 0, 2, 2) * s, cofac(0, 2, 1, 0) * s, - co.m_floats[2] * s, cofac(0, 1, 2, 0) * s, cofac(0, 0, 1, 1) * s); + return btMatrix3x3(co.x * s, cofac(0, 2, 2, 1) * s, cofac(0, 1, 1, 2) * s, + co.y * s, cofac(0, 0, 2, 2) * s, cofac(0, 2, 1, 0) * s, + co.z * s, cofac(0, 1, 2, 0) * s, cofac(0, 0, 1, 1) * s); } SIMD_FORCE_INLINE btMatrix3x3 @@ -1146,15 +1146,15 @@ btMatrix3x3::transposeTimes(const btMatrix3x3& m) const return btMatrix3x3(r0, r1, r2); #else return btMatrix3x3( - m_el[0].m_floats[0] * m[0].m_floats[0] + m_el[1].m_floats[0] * m[1].m_floats[0] + m_el[2].m_floats[0] * m[2].m_floats[0], - m_el[0].m_floats[0] * m[0].m_floats[1] + m_el[1].m_floats[0] * m[1].m_floats[1] + m_el[2].m_floats[0] * m[2].m_floats[1], - m_el[0].m_floats[0] * m[0].m_floats[2] + m_el[1].m_floats[0] * m[1].m_floats[2] + m_el[2].m_floats[0] * m[2].m_floats[2], - m_el[0].m_floats[1] * m[0].m_floats[0] + m_el[1].m_floats[1] * m[1].m_floats[0] + m_el[2].m_floats[1] * m[2].m_floats[0], - m_el[0].m_floats[1] * m[0].m_floats[1] + m_el[1].m_floats[1] * m[1].m_floats[1] + m_el[2].m_floats[1] * m[2].m_floats[1], - m_el[0].m_floats[1] * m[0].m_floats[2] + m_el[1].m_floats[1] * m[1].m_floats[2] + m_el[2].m_floats[1] * m[2].m_floats[2], - m_el[0].m_floats[2] * m[0].m_floats[0] + m_el[1].m_floats[2] * m[1].m_floats[0] + m_el[2].m_floats[2] * m[2].m_floats[0], - m_el[0].m_floats[2] * m[0].m_floats[1] + m_el[1].m_floats[2] * m[1].m_floats[1] + m_el[2].m_floats[2] * m[2].m_floats[1], - m_el[0].m_floats[2] * m[0].m_floats[2] + m_el[1].m_floats[2] * m[1].m_floats[2] + m_el[2].m_floats[2] * m[2].m_floats[2]); + m_el[0].x * m[0].x + m_el[1].x * m[1].x + m_el[2].x * m[2].x, + m_el[0].x * m[0].y + m_el[1].x * m[1].y + m_el[2].x * m[2].y, + m_el[0].x * m[0].z + m_el[1].x * m[1].z + m_el[2].x * m[2].z, + m_el[0].y * m[0].x + m_el[1].y * m[1].x + m_el[2].y * m[2].x, + m_el[0].y * m[0].y + m_el[1].y * m[1].y + m_el[2].y * m[2].y, + m_el[0].y * m[0].z + m_el[1].y * m[1].z + m_el[2].y * m[2].z, + m_el[0].z * m[0].x + m_el[1].z * m[1].x + m_el[2].z * m[2].x, + m_el[0].z * m[0].y + m_el[1].z * m[1].y + m_el[2].z * m[2].y, + m_el[0].z * m[0].z + m_el[1].z * m[1].z + m_el[2].z * m[2].z); #endif } diff --git a/3rdparty/bullet3/src/LinearMath/btQuaternion.h b/3rdparty/bullet3/src/LinearMath/btQuaternion.h index 7fd18bb9eb..77c83a033f 100644 --- a/3rdparty/bullet3/src/LinearMath/btQuaternion.h +++ b/3rdparty/bullet3/src/LinearMath/btQuaternion.h @@ -62,7 +62,7 @@ class btQuaternion #if defined(__SPU__) && defined(__CELLOS_LV2__) union { vec_float4 mVec128; - btScalar m_floats[4]; + struct { btScalar x, y, z, w; }; }; public: @@ -77,7 +77,7 @@ class btQuaternion #if defined(BT_USE_SSE) || defined(BT_USE_NEON) union { btSimdFloat4 mVec128; - btScalar m_floats[4]; + struct { btScalar x, y, z, w; }; }; public: @@ -90,28 +90,28 @@ class btQuaternion mVec128 = v128; } #else - btScalar m_floats[4]; + btScalar x, y, z, w; #endif // BT_USE_SSE #endif //__CELLOS_LV2__ __SPU__ public: - //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]; } + //SIMD_FORCE_INLINE btScalar& operator[](int i) { return (&x)[i]; } + //SIMD_FORCE_INLINE const btScalar& operator[](int i) const { return (&x)[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 operator btScalar*() { return &x; } + SIMD_FORCE_INLINE operator const btScalar*() const { return &x; } SIMD_FORCE_INLINE bool operator==(const btQuaternion& other) const { #ifdef BT_USE_SSE return (0xf == _mm_movemask_ps((__m128)_mm_cmpeq_ps(mVec128, other.mVec128))); #else - 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])); + return ((w == other.w) && + (z == other.z) && + (y == other.y) && + (x == other.x)); #endif } @@ -127,17 +127,17 @@ class btQuaternion */ SIMD_FORCE_INLINE void setValue(const btScalar& _x, const btScalar& _y, const btScalar& _z) { - m_floats[0] = _x; - m_floats[1] = _y; - m_floats[2] = _z; - m_floats[3] = 0.f; + x = _x; + y = _y; + z = _z; + w = 0.f; } /* void getValue(btScalar *m) const { - m[0] = m_floats[0]; - m[1] = m_floats[1]; - m[2] = m_floats[2]; + m[0] = x; + m[1] = y; + m[2] = z; } */ /**@brief Set the values @@ -148,10 +148,10 @@ class btQuaternion */ SIMD_FORCE_INLINE void setValue(const btScalar& _x, const btScalar& _y, const btScalar& _z, const btScalar& _w) { - m_floats[0] = _x; - m_floats[1] = _y; - m_floats[2] = _z; - m_floats[3] = _w; + x = _x; + y = _y; + z = _z; + w = _w; } /**@brief Set each element to the max of the current values and the values of another @@ -165,10 +165,10 @@ class btQuaternion #elif defined(BT_USE_NEON) mVec128 = vmaxq_f32(mVec128, other.mVec128); #else - 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]); + btSetMax(x, other.x); + btSetMax(y, other.y); + btSetMax(z, other.z); + btSetMax(w, other.w); #endif } /**@brief Set each element to the min of the current values and the values of another @@ -182,10 +182,10 @@ class btQuaternion #elif defined(BT_USE_NEON) mVec128 = vminq_f32(mVec128, other.mVec128); #else - 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]); + btSetMin(x, other.x); + btSetMin(y, other.y); + btSetMin(z, other.z); + btSetMin(w, other.w); #endif } public: @@ -221,7 +221,7 @@ class btQuaternion /**@brief Constructor from scalars */ btQuaternion(const btScalar& _x, const btScalar& _y, const btScalar& _z, const btScalar& _w) { - m_floats[0] = _x, m_floats[1] = _y, m_floats[2] = _z, m_floats[3] = _w; + x = _x, y = _y, z = _z, w = _w; } /**@brief Axis angle Constructor * @param axis The axis which the rotation is around @@ -250,7 +250,7 @@ class btQuaternion btScalar d = axis.length(); btAssert(d != btScalar(0.0)); btScalar s = btSin(_angle * btScalar(0.5)) / d; - setValue(axis.m_floats[0] * s, axis.m_floats[1] * s, axis.m_floats[2] * s, + setValue(axis.x * s, axis.y * s, axis.z * s, btCos(_angle * btScalar(0.5))); } /**@brief Set the quaternion using Euler angles @@ -305,11 +305,11 @@ class btQuaternion btScalar sqy; btScalar sqz; btScalar sarg; - sqx = m_floats[0] * m_floats[0]; - sqy = m_floats[1] * m_floats[1]; - sqz = m_floats[2] * m_floats[2]; - squ = m_floats[3] * m_floats[3]; - sarg = btScalar(-2.) * (m_floats[0] * m_floats[2] - m_floats[3] * m_floats[1]); + sqx = x * x; + sqy = y * y; + sqz = z * z; + squ = w * w; + sarg = btScalar(-2.) * (x * z - w * y); // If the pitch angle is PI/2 or -PI/2, we can only compute // the sum roll + yaw. However, any combination that gives @@ -319,19 +319,19 @@ class btQuaternion { pitchY = btScalar(-0.5) * SIMD_PI; rollX = 0; - yawZ = btScalar(2) * btAtan2(m_floats[0], -m_floats[1]); + yawZ = btScalar(2) * btAtan2(x, -y); } else if (sarg >= btScalar(0.99999)) { pitchY = btScalar(0.5) * SIMD_PI; rollX = 0; - yawZ = btScalar(2) * btAtan2(-m_floats[0], m_floats[1]); + yawZ = btScalar(2) * btAtan2(-x, y); } else { pitchY = btAsin(sarg); - rollX = btAtan2(2 * (m_floats[1] * m_floats[2] + m_floats[3] * m_floats[0]), squ - sqx - sqy + sqz); - yawZ = btAtan2(2 * (m_floats[0] * m_floats[1] + m_floats[3] * m_floats[2]), squ + sqx - sqy - sqz); + rollX = btAtan2(2 * (y * z + w * x), squ - sqx - sqy + sqz); + yawZ = btAtan2(2 * (x * y + w * z), squ + sqx - sqy - sqz); } } @@ -344,10 +344,10 @@ class btQuaternion #elif defined(BT_USE_NEON) mVec128 = vaddq_f32(mVec128, q.mVec128); #else - m_floats[0] += q.m_floats[0]; - m_floats[1] += q.m_floats[1]; - m_floats[2] += q.m_floats[2]; - m_floats[3] += q.m_floats[3]; + x += q.x; + y += q.y; + z += q.z; + w += q.w; #endif return *this; } @@ -361,10 +361,10 @@ class btQuaternion #elif defined(BT_USE_NEON) mVec128 = vsubq_f32(mVec128, q.mVec128); #else - m_floats[0] -= q.m_floats[0]; - m_floats[1] -= q.m_floats[1]; - m_floats[2] -= q.m_floats[2]; - m_floats[3] -= q.m_floats[3]; + x -= q.x; + y -= q.y; + z -= q.z; + w -= q.w; #endif return *this; } @@ -380,10 +380,10 @@ class btQuaternion #elif defined(BT_USE_NEON) mVec128 = vmulq_n_f32(mVec128, s); #else - m_floats[0] *= s; - m_floats[1] *= s; - m_floats[2] *= s; - m_floats[3] *= s; + x *= s; + y *= s; + z *= s; + w *= s; #endif return *this; } @@ -465,10 +465,10 @@ class btQuaternion mVec128 = A0; #else setValue( - m_floats[3] * q.m_floats[0] + m_floats[0] * q.m_floats[3] + m_floats[1] * q.m_floats[2] - m_floats[2] * q.m_floats[1], - m_floats[3] * q.m_floats[1] + m_floats[1] * q.m_floats[3] + m_floats[2] * q.m_floats[0] - m_floats[0] * q.m_floats[2], - m_floats[3] * q.m_floats[2] + m_floats[2] * q.m_floats[3] + m_floats[0] * q.m_floats[1] - m_floats[1] * q.m_floats[0], - m_floats[3] * q.m_floats[3] - m_floats[0] * q.m_floats[0] - m_floats[1] * q.m_floats[1] - m_floats[2] * q.m_floats[2]); + w * q.x + x * q.w + y * q.z - z * q.y, + w * q.y + y * q.w + z * q.x - x * q.z, + w * q.z + z * q.w + x * q.y - y * q.x, + w * q.w - x * q.x - y * q.y - z * q.z); #endif return *this; } @@ -493,10 +493,10 @@ class btQuaternion x = vpadd_f32(x, x); return vget_lane_f32(x, 0); #else - return m_floats[0] * q.m_floats[0] + - m_floats[1] * q.m_floats[1] + - m_floats[2] * q.m_floats[2] + - m_floats[3] * q.m_floats[3]; + return x * q.x + + y * q.y + + z * q.z + + w * q.w; #endif } @@ -558,7 +558,7 @@ class btQuaternion #elif defined(BT_USE_NEON) return btQuaternion(vmulq_n_f32(mVec128, s)); #else - return btQuaternion(m_floats[0] * s, m_floats[1] * s, m_floats[2] * s, m_floats[3] * s); + return btQuaternion(x * s, y * s, z * s, w * s); #endif } @@ -607,7 +607,7 @@ class btQuaternion /**@brief Return the angle [0, 2Pi] of rotation represented by this quaternion */ btScalar getAngle() const { - btScalar s = btScalar(2.) * btAcos(m_floats[3]); + btScalar s = btScalar(2.) * btAcos(w); return s; } @@ -615,22 +615,22 @@ class btQuaternion btScalar getAngleShortestPath() const { btScalar s; - if (m_floats[3] >= 0) - s = btScalar(2.) * btAcos(m_floats[3]); + if (w >= 0) + s = btScalar(2.) * btAcos(w); else - s = btScalar(2.) * btAcos(-m_floats[3]); + s = btScalar(2.) * btAcos(-w); return s; } /**@brief Return the axis of the rotation represented by this quaternion */ btVector3 getAxis() const { - btScalar s_squared = 1.f - m_floats[3] * m_floats[3]; + btScalar s_squared = 1.f - w * w; if (s_squared < btScalar(10.) * SIMD_EPSILON) //Check for divide by zero return btVector3(1.0, 0.0, 0.0); // Arbitrary btScalar s = 1.f / btSqrt(s_squared); - return btVector3(m_floats[0] * s, m_floats[1] * s, m_floats[2] * s); + return btVector3(x * s, y * s, z * s); } /**@brief Return the inverse of this quaternion */ @@ -641,7 +641,7 @@ class btQuaternion #elif defined(BT_USE_NEON) return btQuaternion((btSimdFloat4)veorq_s32((int32x4_t)mVec128, (int32x4_t)vQInv)); #else - return btQuaternion(-m_floats[0], -m_floats[1], -m_floats[2], m_floats[3]); + return btQuaternion(-x, -y, -z, w); #endif } @@ -656,7 +656,7 @@ class btQuaternion return btQuaternion(vaddq_f32(mVec128, q2.mVec128)); #else const btQuaternion& q1 = *this; - return btQuaternion(q1.m_floats[0] + q2.m_floats[0], q1.m_floats[1] + q2.m_floats[1], q1.m_floats[2] + q2.m_floats[2], q1.m_floats[3] + q2.m_floats[3]); + return btQuaternion(q1.x + q2.x, q1.y + q2.y, q1.z + q2.z, q1.w + q2.w); #endif } @@ -671,7 +671,7 @@ class btQuaternion return btQuaternion(vsubq_f32(mVec128, q2.mVec128)); #else const btQuaternion& q1 = *this; - return btQuaternion(q1.m_floats[0] - q2.m_floats[0], q1.m_floats[1] - q2.m_floats[1], q1.m_floats[2] - q2.m_floats[2], q1.m_floats[3] - q2.m_floats[3]); + return btQuaternion(q1.x - q2.x, q1.y - q2.y, q1.z - q2.z, q1.w - q2.w); #endif } @@ -685,7 +685,7 @@ class btQuaternion return btQuaternion((btSimdFloat4)veorq_s32((int32x4_t)mVec128, (int32x4_t)btvMzeroMask)); #else const btQuaternion& q2 = *this; - return btQuaternion(-q2.m_floats[0], -q2.m_floats[1], -q2.m_floats[2], -q2.m_floats[3]); + return btQuaternion(-q2.x, -q2.y, -q2.z, -q2.w); #endif } /**@todo document this and it's use */ @@ -734,10 +734,10 @@ class btQuaternion const btScalar s1 = btSin(sign * t * theta) / d; return btQuaternion( - (m_floats[0] * s0 + q.m_floats[0] * s1), - (m_floats[1] * s0 + q.m_floats[1] * s1), - (m_floats[2] * s0 + q.m_floats[2] * s1), - (m_floats[3] * s0 + q.m_floats[3] * s1)); + (x * s0 + q.x * s1), + (y * s0 + q.y * s1), + (z * s0 + q.z * s1), + (w * s0 + q.w * s1)); } else { @@ -751,7 +751,7 @@ class btQuaternion return identityQuat; } - SIMD_FORCE_INLINE const btScalar& getW() const { return m_floats[3]; } + SIMD_FORCE_INLINE const btScalar& getW() const { return w; } SIMD_FORCE_INLINE void serialize(struct btQuaternionData& dataOut) const; @@ -850,10 +850,10 @@ operator*(const btQuaternion& q1, const btQuaternion& q2) #else return btQuaternion( - q1.m_floats[3] * q2.m_floats[0] + q1.m_floats[0] * q2.m_floats[3] + q1.m_floats[1] * q2.m_floats[2] - q1.m_floats[2] * q2.m_floats[1], - q1.m_floats[3] * q2.m_floats[1] + q1.m_floats[1] * q2.m_floats[3] + q1.m_floats[2] * q2.m_floats[0] - q1.m_floats[0] * q2.m_floats[2], - q1.m_floats[3] * q2.m_floats[2] + q1.m_floats[2] * q2.m_floats[3] + q1.m_floats[0] * q2.m_floats[1] - q1.m_floats[1] * q2.m_floats[0], - q1.m_floats[3] * q2.m_floats[3] - q1.m_floats[0] * q2.m_floats[0] - q1.m_floats[1] * q2.m_floats[1] - q1.m_floats[2] * q2.m_floats[2]); + q1.w * q2.x + q1.x * q2.w + q1.y * q2.z - q1.z * q2.y, + q1.w * q2.y + q1.y * q2.w + q1.z * q2.x - q1.x * q2.z, + q1.w * q2.z + q1.z * q2.w + q1.x * q2.y - q1.y * q2.x, + q1.w * q2.w - q1.x * q2.x - q1.y * q2.y - q1.z * q2.z); #endif } @@ -933,10 +933,10 @@ operator*(const btQuaternion& q, const btVector3& w) #else return btQuaternion( - q.m_floats[3] * w.m_floats[0] + q.m_floats[1] * w.m_floats[2] - q.m_floats[2] * w.m_floats[1], - q.m_floats[3] * w.m_floats[1] + q.m_floats[2] * w.m_floats[0] - q.m_floats[0] * w.m_floats[2], - q.m_floats[3] * w.m_floats[2] + q.m_floats[0] * w.m_floats[1] - q.m_floats[1] * w.m_floats[0], - -q.m_floats[0] * w.m_floats[0] - q.m_floats[1] * w.m_floats[1] - q.m_floats[2] * w.m_floats[2]); + q.w * w.x + q.y * w.z - q.z * w.y, + q.w * w.y + q.z * w.x - q.x * w.z, + q.w * w.z + q.x * w.y - q.y * w.x, + -q.x * w.x - q.y * w.y - q.z * w.z); #endif } @@ -1016,10 +1016,10 @@ operator*(const btVector3& w, const btQuaternion& q) #else return btQuaternion( - +w.m_floats[0] * q.m_floats[3] + w.m_floats[1] * q.m_floats[2] - w.m_floats[2] * q.m_floats[1], - +w.m_floats[1] * q.m_floats[3] + w.m_floats[2] * q.m_floats[0] - w.m_floats[0] * q.m_floats[2], - +w.m_floats[2] * q.m_floats[3] + w.m_floats[0] * q.m_floats[1] - w.m_floats[1] * q.m_floats[0], - -w.m_floats[0] * q.m_floats[0] - w.m_floats[1] * q.m_floats[1] - w.m_floats[2] * q.m_floats[2]); + +w.x * q.w + w.y * q.z - w.z * q.y, + +w.y * q.w + w.z * q.x - w.x * q.z, + +w.z * q.w + w.x * q.y - w.y * q.x, + -w.x * q.x - w.y * q.y - w.z * q.z); #endif } @@ -1072,7 +1072,7 @@ quatRotate(const btQuaternion& rotation, const btVector3& v) #elif defined(BT_USE_NEON) return btVector3((float32x4_t)vandq_s32((int32x4_t)q.get128(), btvFFF0Mask)); #else - return btVector3(q.m_floats[0], q.m_floats[1], q.m_floats[2]); + return btVector3(q.x, q.y, q.z); #endif } @@ -1086,13 +1086,13 @@ shortestArcQuat(const btVector3& v0, const btVector3& v1) // Game Programming G { btVector3 n, unused; btPlaneSpace1(v0, n, unused); - return btQuaternion(n.m_floats[0], n.m_floats[1], n.m_floats[2], 0.0f); // just pick any vector that is orthogonal to v0 + return btQuaternion(n.x, n.y, n.z, 0.0f); // just pick any vector that is orthogonal to v0 } btScalar s = btSqrt((1.0f + d) * 2.0f); btScalar rs = 1.0f / s; - return btQuaternion(c.m_floats[0] * rs, c.m_floats[1] * rs, c.m_floats[2] * rs, s * 0.5f); + return btQuaternion(c.x * rs, c.y * rs, c.z * rs, s * 0.5f); } SIMD_FORCE_INLINE btQuaternion @@ -1105,57 +1105,71 @@ shortestArcQuatNormalize2(btVector3& v0, btVector3& v1) struct btQuaternionFloatData { - float m_floats[4]; + float x, y, z, w; }; struct btQuaternionDoubleData { - double m_floats[4]; + float x, y, z, w; }; SIMD_FORCE_INLINE void btQuaternion::serializeFloat(struct btQuaternionFloatData& dataOut) const { ///could also do a memcpy, check if it is worth it - for (int i = 0; i < 4; i++) - dataOut.m_floats[i] = float(m_floats[i]); + dataOut.x = float(x); + dataOut.y = float(y); + dataOut.z = float(z); + dataOut.w = float(w); } SIMD_FORCE_INLINE void btQuaternion::deSerializeFloat(const struct btQuaternionFloatData& dataIn) { - for (int i = 0; i < 4; i++) - m_floats[i] = btScalar(dataIn.m_floats[i]); + x = btScalar(dataIn.x); + y = btScalar(dataIn.y); + z = btScalar(dataIn.z); + w = btScalar(dataIn.w); } SIMD_FORCE_INLINE void btQuaternion::serializeDouble(struct btQuaternionDoubleData& dataOut) const { ///could also do a memcpy, check if it is worth it - for (int i = 0; i < 4; i++) - dataOut.m_floats[i] = double(m_floats[i]); + dataOut.x = double(x); + dataOut.y = double(y); + dataOut.z = double(z); + dataOut.w = double(w); } SIMD_FORCE_INLINE void btQuaternion::deSerializeDouble(const struct btQuaternionDoubleData& dataIn) { - for (int i = 0; i < 4; i++) - m_floats[i] = btScalar(dataIn.m_floats[i]); + x = btScalar(dataIn.x); + y = btScalar(dataIn.y); + z = btScalar(dataIn.z); + w = btScalar(dataIn.w); } SIMD_FORCE_INLINE void btQuaternion::serialize(struct btQuaternionData& dataOut) const { ///could also do a memcpy, check if it is worth it - for (int i = 0; i < 4; i++) - dataOut.m_floats[i] = m_floats[i]; + dataOut.x = x; + dataOut.y = y; + dataOut.z = z; + dataOut.w = w; } SIMD_FORCE_INLINE void btQuaternion::deSerialize(const struct btQuaternionFloatData& dataIn) { - for (int i = 0; i < 4; i++) - m_floats[i] = (btScalar)dataIn.m_floats[i]; + x = (btScalar)dataIn.x; + y = (btScalar)dataIn.y; + z = (btScalar)dataIn.z; + w = (btScalar)dataIn.w; } SIMD_FORCE_INLINE void btQuaternion::deSerialize(const struct btQuaternionDoubleData& dataIn) { - for (int i = 0; i < 4; i++) - m_floats[i] = (btScalar)dataIn.m_floats[i]; + x = (btScalar)dataIn.x; + y = (btScalar)dataIn.y; + z = (btScalar)dataIn.z; + w = (btScalar)dataIn.w; } #endif //BT_SIMD__QUATERNION_H_ diff --git a/3rdparty/bullet3/src/LinearMath/btTransform.h b/3rdparty/bullet3/src/LinearMath/btTransform.h index 24503e45ae..e2c751c89a 100644 --- a/3rdparty/bullet3/src/LinearMath/btTransform.h +++ b/3rdparty/bullet3/src/LinearMath/btTransform.h @@ -127,9 +127,9 @@ btTransform void getOpenGLMatrix(btScalar * m) const { m_basis.getOpenGLSubMatrix(m); - m[12] = m_origin.m_floats[0]; - m[13] = m_origin.m_floats[1]; - m[14] = m_origin.m_floats[2]; + m[12] = m_origin.x; + m[13] = m_origin.y; + m[14] = m_origin.z; m[15] = btScalar(1.0); } diff --git a/3rdparty/bullet3/src/LinearMath/btTransformUtil.h b/3rdparty/bullet3/src/LinearMath/btTransformUtil.h index cab3060d25..ffb1d58e25 100644 --- a/3rdparty/bullet3/src/LinearMath/btTransformUtil.h +++ b/3rdparty/bullet3/src/LinearMath/btTransformUtil.h @@ -20,9 +20,9 @@ subject to the following restrictions: SIMD_FORCE_INLINE btVector3 btAabbSupport(const btVector3& halfExtents, const btVector3& supportDir) { - return btVector3(supportDir.m_floats[0] < btScalar(0.0) ? -halfExtents.m_floats[0] : halfExtents.m_floats[0], - supportDir.m_floats[1] < btScalar(0.0) ? -halfExtents.m_floats[1] : halfExtents.m_floats[1], - supportDir.m_floats[2] < btScalar(0.0) ? -halfExtents.m_floats[2] : halfExtents.m_floats[2]); + return btVector3(supportDir.x < btScalar(0.0) ? -halfExtents.x : halfExtents.x, + supportDir.y < btScalar(0.0) ? -halfExtents.y : halfExtents.y, + supportDir.z < btScalar(0.0) ? -halfExtents.z : halfExtents.z); } /// Utils related to temporal transforms @@ -65,7 +65,7 @@ class btTransformUtil // sync(fAngle) = sin(c*fAngle)/t axis = angvel * (btSin(btScalar(0.5) * fAngle * timeStep) / fAngle); } - btQuaternion dorn(axis.m_floats[0], axis.m_floats[1], axis.m_floats[2], btCos(fAngle * timeStep * btScalar(0.5))); + btQuaternion dorn(axis.x, axis.y, axis.z, btCos(fAngle * timeStep * btScalar(0.5))); btQuaternion orn0 = curTrans.getRotation(); btQuaternion predictedOrn = dorn * orn0; @@ -102,7 +102,7 @@ class btTransformUtil btQuaternion orn1 = orn0.nearest(orn1a); btQuaternion dorn = orn1 * orn0.inverse(); angle = dorn.getAngle(); - axis = btVector3(dorn.m_floats[0], dorn.m_floats[1], dorn.m_floats[2]); + axis = btVector3(dorn.x, dorn.y, dorn.z); axis[3] = btScalar(0.); //check for axis length btScalar len = axis.length2(); @@ -131,7 +131,7 @@ class btTransformUtil dorn.normalize(); angle = dorn.getAngle(); - axis = btVector3(dorn.m_floats[0], dorn.m_floats[1], dorn.m_floats[2]); + axis = btVector3(dorn.x, dorn.y, dorn.z); axis[3] = btScalar(0.); //check for axis length btScalar len = axis.length2(); diff --git a/3rdparty/bullet3/src/LinearMath/btVector3.h b/3rdparty/bullet3/src/LinearMath/btVector3.h index bec7c3e8c0..af495d6b6c 100644 --- a/3rdparty/bullet3/src/LinearMath/btVector3.h +++ b/3rdparty/bullet3/src/LinearMath/btVector3.h @@ -84,12 +84,12 @@ btVector3 BT_DECLARE_ALIGNED_ALLOCATOR(); #if defined(__SPU__) && defined(__CELLOS_LV2__) - btScalar m_floats[4]; + btScalar x, y, z, w; public: SIMD_FORCE_INLINE const vec_float4& get128() const { - return *((const vec_float4*)&m_floats[0]); + return *((const vec_float4*)&x); } public: @@ -97,7 +97,7 @@ btVector3 #if defined(BT_USE_SSE) || defined(BT_USE_NEON) // _WIN32 || ARM union { btSimdFloat4 mVec128; - btScalar m_floats[4]; + struct { btScalar x, y, z, w; }; }; SIMD_FORCE_INLINE btSimdFloat4 get128() const { @@ -108,7 +108,7 @@ btVector3 mVec128 = v128; } #else - btScalar m_floats[4]; + btScalar x, y, z, w; #endif #endif //__CELLOS_LV2__ __SPU__ @@ -125,10 +125,10 @@ btVector3 */ SIMD_FORCE_INLINE btVector3(const btScalar& _x, const btScalar& _y, const btScalar& _z) { - m_floats[0] = _x; - m_floats[1] = _y; - m_floats[2] = _z; - m_floats[3] = btScalar(0.f); + x = _x; + y = _y; + z = _z; + w = btScalar(0.f); } #if (defined(BT_USE_SSE_IN_API) && defined(BT_USE_SSE)) || defined(BT_USE_NEON) @@ -163,9 +163,9 @@ btVector3 #elif defined(BT_USE_NEON) mVec128 = vaddq_f32(mVec128, v.mVec128); #else - m_floats[0] += v.m_floats[0]; - m_floats[1] += v.m_floats[1]; - m_floats[2] += v.m_floats[2]; + x += v.x; + y += v.y; + z += v.z; #endif return *this; } @@ -179,9 +179,9 @@ btVector3 #elif defined(BT_USE_NEON) mVec128 = vsubq_f32(mVec128, v.mVec128); #else - m_floats[0] -= v.m_floats[0]; - m_floats[1] -= v.m_floats[1]; - m_floats[2] -= v.m_floats[2]; + x -= v.x; + y -= v.y; + z -= v.z; #endif return *this; } @@ -197,9 +197,9 @@ btVector3 #elif defined(BT_USE_NEON) mVec128 = vmulq_n_f32(mVec128, s); #else - m_floats[0] *= s; - m_floats[1] *= s; - m_floats[2] *= s; + x *= s; + y *= s; + z *= s; #endif return *this; } @@ -241,9 +241,9 @@ btVector3 x = vadd_f32(x, vget_high_f32(vd)); return vget_lane_f32(x, 0); #else - return m_floats[0] * v.m_floats[0] + - m_floats[1] * v.m_floats[1] + - m_floats[2] * v.m_floats[2]; + return x * v.x + + y * v.y + + z * v.z; #endif } @@ -369,9 +369,9 @@ btVector3 return btVector3(vabsq_f32(mVec128)); #else return btVector3( - btFabs(m_floats[0]), - btFabs(m_floats[1]), - btFabs(m_floats[2])); + btFabs(x), + btFabs(y), + btFabs(z)); #endif } @@ -410,9 +410,9 @@ btVector3 return btVector3(V); #else return btVector3( - m_floats[1] * v.m_floats[2] - m_floats[2] * v.m_floats[1], - m_floats[2] * v.m_floats[0] - m_floats[0] * v.m_floats[2], - m_floats[0] * v.m_floats[1] - m_floats[1] * v.m_floats[0]); + y * v.z - z * v.y, + z * v.x - x * v.z, + x * v.y - y * v.x); #endif } @@ -459,9 +459,9 @@ btVector3 x = vadd_f32(x, vget_high_f32(V)); return vget_lane_f32(x, 0); #else - 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]); + return x * (v1.y * v2.z - v1.z * v2.y) + + y * (v1.z * v2.x - v1.x * v2.z) + + z * (v1.x * v2.y - v1.y * v2.x); #endif } @@ -469,14 +469,14 @@ btVector3 * Note return values are 0,1,2 for x, y, or z */ SIMD_FORCE_INLINE int minAxis() const { - return m_floats[0] < m_floats[1] ? (m_floats[0] < m_floats[2] ? 0 : 2) : (m_floats[1] < m_floats[2] ? 1 : 2); + return x < y ? (x < z ? 0 : 2) : (y < z ? 1 : 2); } /**@brief Return the axis with the largest value * Note return values are 0,1,2 for x, y, or z */ SIMD_FORCE_INLINE int maxAxis() const { - return m_floats[0] < m_floats[1] ? (m_floats[1] < m_floats[2] ? 2 : 1) : (m_floats[0] < m_floats[2] ? 2 : 0); + return x < y ? (y < z ? 2 : 1) : (x < z ? 2 : 0); } SIMD_FORCE_INLINE int furthestAxis() const @@ -507,9 +507,9 @@ btVector3 mVec128 = vaddq_f32(vl, v0.mVec128); #else btScalar s = btScalar(1.0) - rt; - m_floats[0] = s * v0.m_floats[0] + rt * v1.m_floats[0]; - m_floats[1] = s * v0.m_floats[1] + rt * v1.m_floats[1]; - m_floats[2] = s * v0.m_floats[2] + rt * v1.m_floats[2]; + x = s * v0.x + rt * v1.x; + y = s * v0.y + rt * v1.y; + z = s * v0.z + rt * v1.z; //don't do the unused w component // m_co[3] = s * v0[3] + rt * v1[3]; #endif @@ -535,9 +535,9 @@ btVector3 return btVector3(vl); #else - return btVector3(m_floats[0] + (v.m_floats[0] - m_floats[0]) * t, - m_floats[1] + (v.m_floats[1] - m_floats[1]) * t, - m_floats[2] + (v.m_floats[2] - m_floats[2]) * t); + return btVector3(x + (v.x - x) * t, + y + (v.y - y) * t, + z + (v.z - z) * t); #endif } @@ -550,28 +550,28 @@ btVector3 #elif defined(BT_USE_NEON) mVec128 = vmulq_f32(mVec128, v.mVec128); #else - m_floats[0] *= v.m_floats[0]; - m_floats[1] *= v.m_floats[1]; - m_floats[2] *= v.m_floats[2]; + x *= v.x; + y *= v.y; + z *= v.z; #endif return *this; } - //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]; } + //SIMD_FORCE_INLINE btScalar& operator[](int i) { return (&x)[i]; } + //SIMD_FORCE_INLINE const btScalar& operator[](int i) const { return (&x)[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 operator btScalar*() { return &x; } + SIMD_FORCE_INLINE operator const btScalar*() const { return &x; } SIMD_FORCE_INLINE bool operator==(const btVector3& other) const { #if defined(BT_USE_SSE_IN_API) && defined(BT_USE_SSE) return (0xf == _mm_movemask_ps((__m128)_mm_cmpeq_ps(mVec128, other.mVec128))); #else - 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])); + return ((w == other.w) && + (z == other.z) && + (y == other.y) && + (x == other.x)); #endif } @@ -590,10 +590,10 @@ btVector3 #elif defined(BT_USE_NEON) mVec128 = vmaxq_f32(mVec128, other.mVec128); #else - 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]); + btSetMax(x, other.x); + btSetMax(y, other.y); + btSetMax(z, other.z); + btSetMax(w, other.w); #endif } @@ -607,19 +607,19 @@ btVector3 #elif defined(BT_USE_NEON) mVec128 = vminq_f32(mVec128, other.mVec128); #else - 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]); + btSetMin(x, other.x); + btSetMin(y, other.y); + btSetMin(z, other.z); + btSetMin(w, other.w); #endif } SIMD_FORCE_INLINE void setValue(const btScalar& _x, const btScalar& _y, const btScalar& _z) { - m_floats[0] = _x; - m_floats[1] = _y; - m_floats[2] = _z; - m_floats[3] = btScalar(0.f); + x = _x; + y = _y; + z = _z; + w = btScalar(0.f); } void getSkewSymmetricMatrix(btVector3 * v0, btVector3 * v1, btVector3 * v2) const @@ -639,9 +639,9 @@ btVector3 v1->mVec128 = V1; v2->mVec128 = V2; #else - v0->setValue(0., -m_floats[2], m_floats[1]); - v1->setValue(m_floats[2], 0., -m_floats[0]); - v2->setValue(-m_floats[1], m_floats[0], 0.); + v0->setValue(0., -z, y); + v1->setValue(z, 0., -x); + v2->setValue(-y, x, 0.); #endif } @@ -659,7 +659,7 @@ btVector3 SIMD_FORCE_INLINE bool isZero() const { - return m_floats[0] == btScalar(0) && m_floats[1] == btScalar(0) && m_floats[2] == btScalar(0); + return x == btScalar(0) && y == btScalar(0) && z == btScalar(0); } SIMD_FORCE_INLINE bool fuzzyZero() const @@ -724,6 +724,16 @@ btVector3 return btVector3(dot(v0), dot(v1), dot(v2)); #endif } + + SIMD_FORCE_INLINE btScalar* toFloatPtr() + { + return &x; + } + + const SIMD_FORCE_INLINE btScalar* toFloatPtr() const + { + return &x; + } }; /**@brief Return the sum of two vectors (Point symantics)*/ @@ -736,9 +746,9 @@ operator+(const btVector3& v1, const btVector3& v2) return btVector3(vaddq_f32(v1.mVec128, v2.mVec128)); #else 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]); + v1.x + v2.x, + v1.y + v2.y, + v1.z + v2.z); #endif } @@ -752,9 +762,9 @@ operator*(const btVector3& v1, const btVector3& v2) return btVector3(vmulq_f32(v1.mVec128, v2.mVec128)); #else 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]); + v1.x * v2.x, + v1.y * v2.y, + v1.z * v2.z); #endif } @@ -772,9 +782,9 @@ operator-(const btVector3& v1, const btVector3& v2) return btVector3((float32x4_t)vandq_s32((int32x4_t)r, btvFFF0Mask)); #else 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]); + v1.x - v2.x, + v1.y - v2.y, + v1.z - v2.z); #endif } @@ -788,7 +798,7 @@ operator-(const btVector3& v) #elif defined(BT_USE_NEON) return btVector3((btSimdFloat4)veorq_s32((int32x4_t)v.mVec128, (int32x4_t)btvMzeroMask)); #else - return btVector3(-v.m_floats[0], -v.m_floats[1], -v.m_floats[2]); + return btVector3(-v.x, -v.y, -v.z); #endif } @@ -804,7 +814,7 @@ operator*(const btVector3& v, const btScalar& s) float32x4_t r = vmulq_n_f32(v.mVec128, s); return btVector3((float32x4_t)vandq_s32((int32x4_t)r, btvFFF0Mask)); #else - return btVector3(v.m_floats[0] * s, v.m_floats[1] * s, v.m_floats[2] * s); + return btVector3(v.x * s, v.y * s, v.z * s); #endif } @@ -856,9 +866,9 @@ operator/(const btVector3& v1, const btVector3& v2) return btVector3(v); #else 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]); + v1.x / v2.x, + v1.y / v2.y, + v1.z / v2.z); #endif } @@ -1003,7 +1013,7 @@ SIMD_FORCE_INLINE long btVector3::maxDot(const btVector3* array, long array_coun return ptIndex; } #if (defined BT_USE_SSE && defined BT_USE_SIMD_VECTOR3 && defined BT_USE_SSE_IN_API) || defined(BT_USE_NEON) - return _maxdot_large((float*)array, (float*)&m_floats[0], array_count, &dotOut); + return _maxdot_large((float*)array, (float*)&x, array_count, &dotOut); #endif } @@ -1043,7 +1053,7 @@ SIMD_FORCE_INLINE long btVector3::minDot(const btVector3* array, long array_coun return ptIndex; } #if (defined BT_USE_SSE && defined BT_USE_SIMD_VECTOR3 && defined BT_USE_SSE_IN_API) || defined(BT_USE_NEON) - return _mindot_large((float*)array, (float*)&m_floats[0], array_count, &dotOut); + return _mindot_large((float*)array, (float*)&x, array_count, &dotOut); #endif //BT_USE_SIMD_VECTOR3 } @@ -1055,7 +1065,7 @@ class btVector4 : public btVector3 SIMD_FORCE_INLINE btVector4(const btScalar& _x, const btScalar& _y, const btScalar& _z, const btScalar& _w) : btVector3(_x, _y, _z) { - m_floats[3] = _w; + w = _w; } #if (defined(BT_USE_SSE_IN_API) && defined(BT_USE_SSE)) || defined(BT_USE_NEON) @@ -1085,35 +1095,35 @@ class btVector4 : public btVector3 return btVector4(vabsq_f32(mVec128)); #else return btVector4( - btFabs(m_floats[0]), - btFabs(m_floats[1]), - btFabs(m_floats[2]), - btFabs(m_floats[3])); + btFabs(x), + btFabs(y), + btFabs(z), + btFabs(w)); #endif } - btScalar getW() const { return m_floats[3]; } + btScalar getW() const { return w; } SIMD_FORCE_INLINE int maxAxis4() const { int maxIndex = -1; btScalar maxVal = btScalar(-BT_LARGE_FLOAT); - if (m_floats[0] > maxVal) + if (x > maxVal) { maxIndex = 0; - maxVal = m_floats[0]; + maxVal = x; } - if (m_floats[1] > maxVal) + if (y > maxVal) { maxIndex = 1; - maxVal = m_floats[1]; + maxVal = y; } - if (m_floats[2] > maxVal) + if (z > maxVal) { maxIndex = 2; - maxVal = m_floats[2]; + maxVal = z; } - if (m_floats[3] > maxVal) + if (w > maxVal) { maxIndex = 3; } @@ -1125,22 +1135,22 @@ class btVector4 : public btVector3 { int minIndex = -1; btScalar minVal = btScalar(BT_LARGE_FLOAT); - if (m_floats[0] < minVal) + if (x < minVal) { minIndex = 0; - minVal = m_floats[0]; + minVal = x; } - if (m_floats[1] < minVal) + if (y < minVal) { minIndex = 1; - minVal = m_floats[1]; + minVal = y; } - if (m_floats[2] < minVal) + if (z < minVal) { minIndex = 2; - minVal = m_floats[2]; + minVal = z; } - if (m_floats[3] < minVal) + if (w < minVal) { minIndex = 3; } @@ -1161,9 +1171,9 @@ class btVector4 : public btVector3 /* void getValue(btScalar *m) const { - m[0] = m_floats[0]; - m[1] = m_floats[1]; - m[2] =m_floats[2]; + m[0] = x; + m[1] = y; + m[2] =z; } */ /**@brief Set the values @@ -1174,10 +1184,10 @@ class btVector4 : public btVector3 */ SIMD_FORCE_INLINE void setValue(const btScalar& _x, const btScalar& _y, const btScalar& _z, const btScalar& _w) { - m_floats[0] = _x; - m_floats[1] = _y; - m_floats[2] = _z; - m_floats[3] = _w; + x = _x; + y = _y; + z = _z; + w = _w; } }; @@ -1257,57 +1267,75 @@ SIMD_FORCE_INLINE void btPlaneSpace1(const T& n, T& p, T& q) struct btVector3FloatData { - float m_floats[4]; + float x, y, z, w; + + float* toPtr() { return &x; } }; struct btVector3DoubleData { - double m_floats[4]; + double x, y, z, w; + + double* toPtr() { return &x; } }; SIMD_FORCE_INLINE void btVector3::serializeFloat(struct btVector3FloatData& dataOut) const { ///could also do a memcpy, check if it is worth it - for (int i = 0; i < 4; i++) - dataOut.m_floats[i] = float(m_floats[i]); + dataOut.x = float(x); + dataOut.y = float(y); + dataOut.z = float(z); + dataOut.w = float(w); } SIMD_FORCE_INLINE void btVector3::deSerializeFloat(const struct btVector3FloatData& dataIn) { - for (int i = 0; i < 4; i++) - m_floats[i] = btScalar(dataIn.m_floats[i]); + x = btScalar(dataIn.x); + y = btScalar(dataIn.y); + z = btScalar(dataIn.z); + w = btScalar(dataIn.w); } SIMD_FORCE_INLINE void btVector3::serializeDouble(struct btVector3DoubleData& dataOut) const { ///could also do a memcpy, check if it is worth it - for (int i = 0; i < 4; i++) - dataOut.m_floats[i] = double(m_floats[i]); + dataOut.x = double(x); + dataOut.y = double(y); + dataOut.z = double(z); + dataOut.w = double(w); } SIMD_FORCE_INLINE void btVector3::deSerializeDouble(const struct btVector3DoubleData& dataIn) { - for (int i = 0; i < 4; i++) - m_floats[i] = btScalar(dataIn.m_floats[i]); + x = btScalar(dataIn.x); + y = btScalar(dataIn.y); + z = btScalar(dataIn.z); + w = btScalar(dataIn.w); } SIMD_FORCE_INLINE void btVector3::serialize(struct btVector3Data& dataOut) const { ///could also do a memcpy, check if it is worth it - for (int i = 0; i < 4; i++) - dataOut.m_floats[i] = m_floats[i]; + dataOut.x = x; + dataOut.y = y; + dataOut.z = z; + dataOut.w = w; } SIMD_FORCE_INLINE void btVector3::deSerialize(const struct btVector3FloatData& dataIn) { - for (int i = 0; i < 4; i++) - m_floats[i] = (btScalar)dataIn.m_floats[i]; + x = (btScalar)dataIn.x; + y = (btScalar)dataIn.y; + z = (btScalar)dataIn.z; + w = (btScalar)dataIn.w; } SIMD_FORCE_INLINE void btVector3::deSerialize(const struct btVector3DoubleData& dataIn) { - for (int i = 0; i < 4; i++) - m_floats[i] = (btScalar)dataIn.m_floats[i]; + x = (btScalar)dataIn.x; + y = (btScalar)dataIn.y; + z = (btScalar)dataIn.z; + w = (btScalar)dataIn.w; } #endif //BT_VECTOR3_H diff --git a/src/world/physics_world_bullet.cpp b/src/world/physics_world_bullet.cpp index 7e257f70ef..62b51b2019 100644 --- a/src/world/physics_world_bullet.cpp +++ b/src/world/physics_world_bullet.cpp @@ -99,12 +99,12 @@ static inline btTransform to_btTransform(const Matrix4x4 &m) static inline Vector3 to_vector3(const btVector3 &v) { - return vector3(v.m_floats[0], v.m_floats[1], v.m_floats[2]); + return vector3(v.x, v.y, v.z); } static inline Quaternion to_quaternion(const btQuaternion &q) { - return from_elements(q.m_floats[0], q.m_floats[1], q.m_floats[2], q.m_floats[3]); + return from_elements(q.x, q.y, q.z, q.w); } static inline Matrix4x4 to_matrix4x4(const btTransform &t) @@ -115,24 +115,24 @@ static inline Matrix4x4 to_matrix4x4(const btTransform &t) const btVector3 o = t.m_origin; Matrix4x4 m; - m.x.x = x.m_floats[0]; - m.x.y = y.m_floats[0]; - m.x.z = z.m_floats[0]; + m.x.x = x.x; + m.x.y = y.x; + m.x.z = z.x; m.x.w = 0.0f; - m.y.x = x.m_floats[1]; - m.y.y = y.m_floats[1]; - m.y.z = z.m_floats[1]; + m.y.x = x.y; + m.y.y = y.y; + m.y.z = z.y; m.y.w = 0.0f; - m.z.x = x.m_floats[2]; - m.z.y = y.m_floats[2]; - m.z.z = z.m_floats[2]; + m.z.x = x.z; + m.z.y = y.z; + m.z.z = z.z; m.z.w = 0.0f; - m.t.x = o.m_floats[0]; - m.t.y = o.m_floats[1]; - m.t.z = o.m_floats[2]; + m.t.x = o.x; + m.t.y = o.y; + m.t.z = o.z; m.t.w = 1.0f; return m;