prepare for Box2D style gui demo
This commit is contained in:
@@ -20,7 +20,7 @@ subject to the following restrictions:
|
||||
#include "btCollisionMargin.h"
|
||||
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
|
||||
#include "LinearMath/btPoint3.h"
|
||||
#include "LinearMath/btSimdMinMax.h"
|
||||
#include "LinearMath/btMinMax.h"
|
||||
|
||||
///btBoxShape implements both a feature based (vertex/edge/plane) and implicit (getSupportingVertex) Box
|
||||
class btBoxShape: public btPolyhedralConvexShape
|
||||
|
||||
@@ -192,8 +192,8 @@ btScalar resolveSingleFriction(
|
||||
j1 = -vrel * cpd->m_jacDiagABInvTangent0;
|
||||
btScalar oldTangentImpulse = cpd->m_accumulatedTangentImpulse0;
|
||||
cpd->m_accumulatedTangentImpulse0 = oldTangentImpulse + j1;
|
||||
GEN_set_min(cpd->m_accumulatedTangentImpulse0, limit);
|
||||
GEN_set_max(cpd->m_accumulatedTangentImpulse0, -limit);
|
||||
btSetMin(cpd->m_accumulatedTangentImpulse0, limit);
|
||||
btSetMax(cpd->m_accumulatedTangentImpulse0, -limit);
|
||||
j1 = cpd->m_accumulatedTangentImpulse0 - oldTangentImpulse;
|
||||
|
||||
}
|
||||
@@ -206,8 +206,8 @@ btScalar resolveSingleFriction(
|
||||
j2 = -vrel * cpd->m_jacDiagABInvTangent1;
|
||||
btScalar oldTangentImpulse = cpd->m_accumulatedTangentImpulse1;
|
||||
cpd->m_accumulatedTangentImpulse1 = oldTangentImpulse + j2;
|
||||
GEN_set_min(cpd->m_accumulatedTangentImpulse1, limit);
|
||||
GEN_set_max(cpd->m_accumulatedTangentImpulse1, -limit);
|
||||
btSetMin(cpd->m_accumulatedTangentImpulse1, limit);
|
||||
btSetMax(cpd->m_accumulatedTangentImpulse1, -limit);
|
||||
j2 = cpd->m_accumulatedTangentImpulse1 - oldTangentImpulse;
|
||||
}
|
||||
|
||||
@@ -270,8 +270,8 @@ btScalar resolveSingleFrictionOriginal(
|
||||
// calculate j that moves us to zero relative velocity
|
||||
btScalar j = -vrel * cpd->m_jacDiagABInvTangent0;
|
||||
btScalar total = cpd->m_accumulatedTangentImpulse0 + j;
|
||||
GEN_set_min(total, limit);
|
||||
GEN_set_max(total, -limit);
|
||||
btSetMin(total, limit);
|
||||
btSetMax(total, -limit);
|
||||
j = total - cpd->m_accumulatedTangentImpulse0;
|
||||
cpd->m_accumulatedTangentImpulse0 = total;
|
||||
body1.applyImpulse(j * cpd->m_frictionWorldTangential0, rel_pos1);
|
||||
@@ -290,8 +290,8 @@ btScalar resolveSingleFrictionOriginal(
|
||||
// calculate j that moves us to zero relative velocity
|
||||
btScalar j = -vrel * cpd->m_jacDiagABInvTangent1;
|
||||
btScalar total = cpd->m_accumulatedTangentImpulse1 + j;
|
||||
GEN_set_min(total, limit);
|
||||
GEN_set_max(total, -limit);
|
||||
btSetMin(total, limit);
|
||||
btSetMax(total, -limit);
|
||||
j = total - cpd->m_accumulatedTangentImpulse1;
|
||||
cpd->m_accumulatedTangentImpulse1 = total;
|
||||
body1.applyImpulse(j * cpd->m_frictionWorldTangential1, rel_pos1);
|
||||
@@ -388,8 +388,8 @@ btScalar resolveSingleCollisionCombined(
|
||||
(body1.getInvMass() + body2.getInvMass() + lat_vel.dot(temp1.cross(rel_pos1) + temp2.cross(rel_pos2)));
|
||||
btScalar normal_impulse = cpd->m_appliedImpulse * combinedFriction;
|
||||
|
||||
GEN_set_min(friction_impulse, normal_impulse);
|
||||
GEN_set_max(friction_impulse, -normal_impulse);
|
||||
btSetMin(friction_impulse, normal_impulse);
|
||||
btSetMax(friction_impulse, -normal_impulse);
|
||||
body1.applyImpulse(lat_vel * -friction_impulse, rel_pos1);
|
||||
body2.applyImpulse(lat_vel * friction_impulse, rel_pos2);
|
||||
}
|
||||
|
||||
@@ -508,8 +508,8 @@ btScalar calcRollingFriction(btWheelContactPoint& contactPoint)
|
||||
|
||||
// calculate j that moves us to zero relative velocity
|
||||
j1 = -vrel * contactPoint.m_jacDiagABInv;
|
||||
GEN_set_min(j1, maxImpulse);
|
||||
GEN_set_max(j1, -maxImpulse);
|
||||
btSetMin(j1, maxImpulse);
|
||||
btSetMax(j1, -maxImpulse);
|
||||
|
||||
return j1;
|
||||
}
|
||||
|
||||
@@ -18,11 +18,9 @@ subject to the following restrictions:
|
||||
#define AABB_UTIL2
|
||||
|
||||
#include "btVector3.h"
|
||||
#include "btSimdMinMax.h"
|
||||
#include "btMinMax.h"
|
||||
|
||||
|
||||
#define btMin(a,b) ((a < b ? a : b))
|
||||
#define btMax(a,b) ((a > b ? a : b))
|
||||
|
||||
|
||||
/// conservative test for overlap between two aabbs
|
||||
|
||||
@@ -18,15 +18,15 @@ subject to the following restrictions:
|
||||
#define GEN_MINMAX_H
|
||||
|
||||
template <class T>
|
||||
SIMD_FORCE_INLINE const T& GEN_min(const T& a, const T& b)
|
||||
SIMD_FORCE_INLINE const T& btMin(const T& a, const T& b)
|
||||
{
|
||||
return b < a ? b : a;
|
||||
return a < b ? a : b ;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SIMD_FORCE_INLINE const T& GEN_max(const T& a, const T& b)
|
||||
SIMD_FORCE_INLINE const T& btMax(const T& a, const T& b)
|
||||
{
|
||||
return a < b ? b : a;
|
||||
return a > b ? a : b;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
@@ -36,7 +36,7 @@ SIMD_FORCE_INLINE const T& GEN_clamped(const T& a, const T& lb, const T& ub)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SIMD_FORCE_INLINE void GEN_set_min(T& a, const T& b)
|
||||
SIMD_FORCE_INLINE void btSetMin(T& a, const T& b)
|
||||
{
|
||||
if (b < a)
|
||||
{
|
||||
@@ -45,7 +45,7 @@ SIMD_FORCE_INLINE void GEN_set_min(T& a, const T& b)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SIMD_FORCE_INLINE void GEN_set_max(T& a, const T& b)
|
||||
SIMD_FORCE_INLINE void btSetMax(T& a, const T& b)
|
||||
{
|
||||
if (a < b)
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ subject to the following restrictions:
|
||||
#define SIMD_QUADWORD_H
|
||||
|
||||
#include "btScalar.h"
|
||||
#include "btSimdMinMax.h"
|
||||
#include "btMinMax.h"
|
||||
|
||||
//ATTRIBUTE_ALIGNED16(class) btQuadWordStorage
|
||||
//some issues under PS3 Linux with IBM 2.1 SDK, gcc compiler prevent from using aligned quadword. todo: look into this
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans http://continuousphysics.com/Bullet/
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef SIMD_MINMAX_H
|
||||
#define SIMD_MINMAX_H
|
||||
#include "btScalar.h"
|
||||
|
||||
template <class T>
|
||||
SIMD_FORCE_INLINE const T& btMin(const T& a, const T& b) {
|
||||
return b < a ? b : a;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SIMD_FORCE_INLINE const T& btMax(const T& a, const T& b) {
|
||||
return a < b ? b : a;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SIMD_FORCE_INLINE void btSetMin(T& a, const T& b) {
|
||||
if (a > b) a = b;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
SIMD_FORCE_INLINE void btSetMax(T& a, const T& b) {
|
||||
if (a < b) a = b;
|
||||
}
|
||||
|
||||
// Specialize on float/double for platforms that have btFsel natively
|
||||
#ifdef BT_HAVE_NATIVE_FSEL
|
||||
SIMD_FORCE_INLINE float btMin( float a, float b) {
|
||||
return (float)btFsel((a-b), b, a);
|
||||
}
|
||||
|
||||
SIMD_FORCE_INLINE float btMax( float a, float b) {
|
||||
return (float)btFsel((a-b), a, b);
|
||||
}
|
||||
|
||||
SIMD_FORCE_INLINE void btSetMin(float& a, float b) {
|
||||
a = (float)btFsel((a-b), b, a);
|
||||
}
|
||||
|
||||
SIMD_FORCE_INLINE void btSetMax(float& a, float b) {
|
||||
a = (float)btFsel((a-b), a, b);
|
||||
}
|
||||
|
||||
SIMD_FORCE_INLINE double btMin( double a, double b) {
|
||||
return btFsel((a-b), b, a);
|
||||
}
|
||||
|
||||
SIMD_FORCE_INLINE double btMax( double a, double b) {
|
||||
return btFsel((a-b), a, b);
|
||||
}
|
||||
|
||||
SIMD_FORCE_INLINE void btSetMin(double& a, double b) {
|
||||
a = btFsel((a-b), b, a);
|
||||
}
|
||||
|
||||
SIMD_FORCE_INLINE void btSetMax(double& a, double b) {
|
||||
a = btFsel((a-b), a, b);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user