Merge branch 'Branch_2.86.1'

This commit is contained in:
nicolaichuk
2017-03-23 14:24:32 +03:00
32 changed files with 1548 additions and 1245 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -41,6 +41,10 @@ struct btBroadphaseRayCallback : public btBroadphaseAabbCallback
btScalar m_lambda_max;
virtual ~btBroadphaseRayCallback() {}
protected:
btBroadphaseRayCallback() {}
};
#include "LinearMath/btVector3.h"

View File

@@ -23,6 +23,9 @@ struct btBroadphasePair;
///The btOverlappingPairCallback class is an additional optional broadphase user callback for adding/removing overlapping pairs, similar interface to btOverlappingPairCache.
class btOverlappingPairCallback
{
protected:
btOverlappingPairCallback() {}
public:
virtual ~btOverlappingPairCallback()
{

View File

@@ -102,6 +102,7 @@ SET(Root_HDRS
../btBulletCollisionCommon.h
)
SET(BroadphaseCollision_HDRS
BroadphaseCollision/btAxisSweep3Internal.h
BroadphaseCollision/btAxisSweep3.h
BroadphaseCollision/btBroadphaseInterface.h
BroadphaseCollision/btBroadphaseProxy.h
@@ -189,12 +190,15 @@ SET(CollisionShapes_HDRS
SET(Gimpact_HDRS
Gimpact/btBoxCollision.h
Gimpact/btClipPolygon.h
Gimpact/btContactProcessingSructs.h
Gimpact/btContactProcessing.h
Gimpact/btGenericPoolAllocator.h
Gimpact/btGeometryOperations.h
Gimpact/btGImpactBvhSructs.h
Gimpact/btGImpactBvh.h
Gimpact/btGImpactCollisionAlgorithm.h
Gimpact/btGImpactMassUtil.h
Gimpact/btGImpactQuantizedBvhSructs.h
Gimpact/btGImpactQuantizedBvh.h
Gimpact/btGImpactShape.h
Gimpact/btQuantization.h

View File

@@ -24,12 +24,13 @@ class btActivatingCollisionAlgorithm : public btCollisionAlgorithm
// btCollisionObject* m_colObj0;
// btCollisionObject* m_colObj1;
public:
protected:
btActivatingCollisionAlgorithm (const btCollisionAlgorithmConstructionInfo& ci);
btActivatingCollisionAlgorithm (const btCollisionAlgorithmConstructionInfo& ci, const btCollisionObjectWrapper* body0Wrap,const btCollisionObjectWrapper* body1Wrap);
public:
virtual ~btActivatingCollisionAlgorithm();
};

View File

@@ -124,7 +124,7 @@ public:
btCollisionShape* getCollisionShapeByIndex(int index);
int getNumRigidBodies() const;
btCollisionObject* getRigidBodyByIndex(int index) const;
int getNumConstraints() const;
//int getNumConstraints() const;
int getNumBvhs() const;
btOptimizedBvh* getBvhByIndex(int index) const;

View File

@@ -33,8 +33,6 @@ class btDispatcher;
class btCollisionObject;
class btCollisionShape;
typedef bool (*btShapePairCallback)(const btCollisionShape* pShape0, const btCollisionShape* pShape1);
extern btShapePairCallback gCompoundCompoundChildShapePairCallback;
/// btCompoundCompoundCollisionAlgorithm supports collision between two btCompoundCollisionShape shapes
class btCompoundCompoundCollisionAlgorithm : public btCompoundCollisionAlgorithm

View File

@@ -111,6 +111,7 @@ void btManifoldResult::addContactPoint(const btVector3& normalOnBInWorld,const b
return;
bool isSwapped = m_manifoldPtr->getBody0() != m_body0Wrap->getCollisionObject();
bool isNewCollision = m_manifoldPtr->getNumContacts() == 0;
btVector3 pointA = pointInWorld + normalOnBInWorld * depth;
@@ -187,5 +188,9 @@ void btManifoldResult::addContactPoint(const btVector3& normalOnBInWorld,const b
(*gContactAddedCallback)(m_manifoldPtr->getContactPoint(insertIndex),obj0Wrap,newPt.m_partId0,newPt.m_index0,obj1Wrap,newPt.m_partId1,newPt.m_index1);
}
if (gContactStartedCallback && isNewCollision)
{
gContactStartedCallback(m_manifoldPtr);
}
}

View File

@@ -93,10 +93,12 @@ protected:
aabbMax = m_localAabbMax;
}
public:
protected:
btPolyhedralConvexAabbCachingShape();
public:
inline void getNonvirtualAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax, btScalar margin) const
{

View File

@@ -235,6 +235,23 @@ public:
btAABB()
{}
bool operator<(const btAABB& obj) const {
return
m_min < obj.m_min &&
m_max < obj.m_max;
}
bool operator>(const btAABB& obj) const {
return
m_min > obj.m_min &&
m_max > obj.m_max;
}
bool operator==(const btAABB& obj) const {
return
m_min == obj.m_min &&
m_max == obj.m_max;
}
btAABB(const btVector3 & V1,
const btVector3 & V2,

View File

@@ -27,86 +27,7 @@ subject to the following restrictions:
#include "LinearMath/btTransform.h"
#include "LinearMath/btAlignedObjectArray.h"
#include "btTriangleShapeEx.h"
/**
Configuration var for applying interpolation of contact normals
*/
#define NORMAL_CONTACT_AVERAGE 1
#define CONTACT_DIFF_EPSILON 0.00001f
///The GIM_CONTACT is an internal GIMPACT structure, similar to btManifoldPoint.
///@todo: remove and replace GIM_CONTACT by btManifoldPoint.
class GIM_CONTACT
{
public:
btVector3 m_point;
btVector3 m_normal;
btScalar m_depth;//Positive value indicates interpenetration
btScalar m_distance;//Padding not for use
int m_feature1;//Face number
int m_feature2;//Face number
public:
GIM_CONTACT()
{
}
GIM_CONTACT(const GIM_CONTACT & contact):
m_point(contact.m_point),
m_normal(contact.m_normal),
m_depth(contact.m_depth),
m_feature1(contact.m_feature1),
m_feature2(contact.m_feature2)
{
}
GIM_CONTACT(const btVector3 &point,const btVector3 & normal,
btScalar depth, int feature1, int feature2):
m_point(point),
m_normal(normal),
m_depth(depth),
m_feature1(feature1),
m_feature2(feature2)
{
}
//! Calcs key for coord classification
SIMD_FORCE_INLINE unsigned int calc_key_contact() const
{
int _coords[] = {
(int)(m_point[0]*1000.0f+1.0f),
(int)(m_point[1]*1333.0f),
(int)(m_point[2]*2133.0f+3.0f)};
unsigned int _hash=0;
unsigned int *_uitmp = (unsigned int *)(&_coords[0]);
_hash = *_uitmp;
_uitmp++;
_hash += (*_uitmp)<<4;
_uitmp++;
_hash += (*_uitmp)<<8;
return _hash;
}
SIMD_FORCE_INLINE void interpolate_normals( btVector3 * normals,int normal_count)
{
btVector3 vec_sum(m_normal);
for(int i=0;i<normal_count;i++)
{
vec_sum += normals[i];
}
btScalar vec_sum_len = vec_sum.length2();
if(vec_sum_len <CONTACT_DIFF_EPSILON) return;
//GIM_INV_SQRT(vec_sum_len,vec_sum_len); // 1/sqrt(vec_sum_len)
m_normal = vec_sum/btSqrt(vec_sum_len);
}
};
#include "btContactProcessingSructs.h"
class btContactArray:public btAlignedObjectArray<GIM_CONTACT>
{
@@ -141,5 +62,4 @@ public:
void merge_contacts_unique(const btContactArray & contacts);
};
#endif // GIM_CONTACT_H_INCLUDED

View File

@@ -0,0 +1,138 @@
#ifndef BT_CONTACT_H_STRUCTS_INCLUDED
#define BT_CONTACT_H_STRUCTS_INCLUDED
/*! \file gim_contact.h
\author Francisco Leon Najera
*/
/*
This source file is part of GIMPACT Library.
For the latest info, see http://gimpact.sourceforge.net/
Copyright (c) 2007 Francisco Leon Najera. C.C. 80087371.
email: projectileman@yahoo.com
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.
*/
#include "LinearMath/btTransform.h"
#include "LinearMath/btAlignedObjectArray.h"
#include "btTriangleShapeEx.h"
/**
Configuration var for applying interpolation of contact normals
*/
#define NORMAL_CONTACT_AVERAGE 1
#define CONTACT_DIFF_EPSILON 0.00001f
///The GIM_CONTACT is an internal GIMPACT structure, similar to btManifoldPoint.
///@todo: remove and replace GIM_CONTACT by btManifoldPoint.
class GIM_CONTACT
{
public:
btVector3 m_point;
btVector3 m_normal;
btScalar m_depth;//Positive value indicates interpenetration
btScalar m_distance;//Padding not for use
int m_feature1;//Face number
int m_feature2;//Face number
public:
GIM_CONTACT()
{
}
bool operator<(const GIM_CONTACT& obj) const {
return
m_point < obj.m_point &&
m_normal < obj.m_normal &&
m_depth < obj.m_depth &&
m_distance < obj.m_distance &&
m_feature1 < obj.m_feature1 &&
m_feature2 < obj.m_feature2;
}
bool operator>(const GIM_CONTACT& obj) const {
return
m_point > obj.m_point &&
m_normal > obj.m_normal &&
m_depth > obj.m_depth &&
m_distance > obj.m_distance &&
m_feature1 > obj.m_feature1 &&
m_feature2 > obj.m_feature2;
}
bool operator==(const GIM_CONTACT& obj) const {
return
m_point == obj.m_point &&
m_normal == obj.m_normal &&
m_depth == obj.m_depth &&
m_distance == obj.m_distance &&
m_feature1 == obj.m_feature1 &&
m_feature2 == obj.m_feature2;
}
GIM_CONTACT(const GIM_CONTACT & contact):
m_point(contact.m_point),
m_normal(contact.m_normal),
m_depth(contact.m_depth),
m_feature1(contact.m_feature1),
m_feature2(contact.m_feature2)
{
}
GIM_CONTACT(const btVector3 &point,const btVector3 & normal,
btScalar depth, int feature1, int feature2):
m_point(point),
m_normal(normal),
m_depth(depth),
m_feature1(feature1),
m_feature2(feature2)
{
}
//! Calcs key for coord classification
SIMD_FORCE_INLINE unsigned int calc_key_contact() const
{
int _coords[] = {
(int)(m_point[0]*1000.0f+1.0f),
(int)(m_point[1]*1333.0f),
(int)(m_point[2]*2133.0f+3.0f)};
unsigned int _hash=0;
unsigned int *_uitmp = (unsigned int *)(&_coords[0]);
_hash = *_uitmp;
_uitmp++;
_hash += (*_uitmp)<<4;
_uitmp++;
_hash += (*_uitmp)<<8;
return _hash;
}
SIMD_FORCE_INLINE void interpolate_normals( btVector3 * normals,int normal_count)
{
btVector3 vec_sum(m_normal);
for(int i=0;i<normal_count;i++)
{
vec_sum += normals[i];
}
btScalar vec_sum_len = vec_sum.length2();
if(vec_sum_len <CONTACT_DIFF_EPSILON) return;
//GIM_INV_SQRT(vec_sum_len,vec_sum_len); // 1/sqrt(vec_sum_len)
m_normal = vec_sum/btSqrt(vec_sum_len);
}
};
#endif // BT_CONTACT_H_STRUCTS_INCLUDED

View File

@@ -29,31 +29,7 @@ subject to the following restrictions:
#include "btBoxCollision.h"
#include "btTriangleShapeEx.h"
//! Overlapping pair
struct GIM_PAIR
{
int m_index1;
int m_index2;
GIM_PAIR()
{}
GIM_PAIR(const GIM_PAIR & p)
{
m_index1 = p.m_index1;
m_index2 = p.m_index2;
}
GIM_PAIR(int index1, int index2)
{
m_index1 = index1;
m_index2 = index2;
}
};
#include "btGImpactBvhSructs.h"
//! A pairset array
class btPairSet: public btAlignedObjectArray<GIM_PAIR>
@@ -74,59 +50,6 @@ public:
}
};
///GIM_BVH_DATA is an internal GIMPACT collision structure to contain axis aligned bounding box
struct GIM_BVH_DATA
{
btAABB m_bound;
int m_data;
};
//! Node Structure for trees
class GIM_BVH_TREE_NODE
{
public:
btAABB m_bound;
protected:
int m_escapeIndexOrDataIndex;
public:
GIM_BVH_TREE_NODE()
{
m_escapeIndexOrDataIndex = 0;
}
SIMD_FORCE_INLINE bool isLeafNode() const
{
//skipindex is negative (internal node), triangleindex >=0 (leafnode)
return (m_escapeIndexOrDataIndex>=0);
}
SIMD_FORCE_INLINE int getEscapeIndex() const
{
//btAssert(m_escapeIndexOrDataIndex < 0);
return -m_escapeIndexOrDataIndex;
}
SIMD_FORCE_INLINE void setEscapeIndex(int index)
{
m_escapeIndexOrDataIndex = -index;
}
SIMD_FORCE_INLINE int getDataIndex() const
{
//btAssert(m_escapeIndexOrDataIndex >= 0);
return m_escapeIndexOrDataIndex;
}
SIMD_FORCE_INLINE void setDataIndex(int index)
{
m_escapeIndexOrDataIndex = index;
}
};
class GIM_BVH_DATA_ARRAY:public btAlignedObjectArray<GIM_BVH_DATA>
{
};
@@ -392,5 +315,4 @@ public:
btPairSet & collision_pairs);
};
#endif // GIM_BOXPRUNING_H_INCLUDED

View File

@@ -0,0 +1,161 @@
#ifndef GIM_BOX_SET_STRUCT_H_INCLUDED
#define GIM_BOX_SET_STRUCT_H_INCLUDED
/*! \file gim_box_set.h
\author Francisco Leon Najera
*/
/*
This source file is part of GIMPACT Library.
For the latest info, see http://gimpact.sourceforge.net/
Copyright (c) 2007 Francisco Leon Najera. C.C. 80087371.
email: projectileman@yahoo.com
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.
*/
#include "LinearMath/btAlignedObjectArray.h"
#include "btBoxCollision.h"
#include "btTriangleShapeEx.h"
//! Overlapping pair
struct GIM_PAIR
{
int m_index1;
int m_index2;
bool operator<(const GIM_PAIR& obj) const {
return
m_index1 < obj.m_index1 &&
m_index2 < obj.m_index2;
}
bool operator>(const GIM_PAIR& obj) const {
return
m_index1 > obj.m_index1 &&
m_index2 > obj.m_index2;
}
bool operator==(const GIM_PAIR& obj) const {
return
m_index1 == obj.m_index1 &&
m_index2 == obj.m_index2;
}
GIM_PAIR()
{}
GIM_PAIR(const GIM_PAIR & p)
{
m_index1 = p.m_index1;
m_index2 = p.m_index2;
}
GIM_PAIR(int index1, int index2)
{
m_index1 = index1;
m_index2 = index2;
}
};
///GIM_BVH_DATA is an internal GIMPACT collision structure to contain axis aligned bounding box
struct GIM_BVH_DATA
{
btAABB m_bound;
int m_data;
bool operator<(const GIM_BVH_DATA& obj) const {
return
m_bound < obj.m_bound &&
m_data < obj.m_data;
}
bool operator>(const GIM_BVH_DATA& obj) const {
return
m_bound > obj.m_bound &&
m_data > obj.m_data;
}
bool operator==(const GIM_BVH_DATA& obj) const {
return
m_bound == obj.m_bound &&
m_data == obj.m_data;
}
};
//! Node Structure for trees
class GIM_BVH_TREE_NODE
{
public:
btAABB m_bound;
protected:
int m_escapeIndexOrDataIndex;
public:
bool operator<(const GIM_BVH_TREE_NODE& obj) const {
return
m_bound < obj.m_bound &&
m_escapeIndexOrDataIndex < obj.m_escapeIndexOrDataIndex;
}
bool operator>(const GIM_BVH_TREE_NODE& obj) const {
return
m_bound > obj.m_bound &&
m_escapeIndexOrDataIndex > obj.m_escapeIndexOrDataIndex;
}
bool operator==(const GIM_BVH_TREE_NODE& obj) const {
return
m_bound == obj.m_bound &&
m_escapeIndexOrDataIndex == obj.m_escapeIndexOrDataIndex;
}
GIM_BVH_TREE_NODE()
{
m_escapeIndexOrDataIndex = 0;
}
SIMD_FORCE_INLINE bool isLeafNode() const
{
//skipindex is negative (internal node), triangleindex >=0 (leafnode)
return (m_escapeIndexOrDataIndex>=0);
}
SIMD_FORCE_INLINE int getEscapeIndex() const
{
//btAssert(m_escapeIndexOrDataIndex < 0);
return -m_escapeIndexOrDataIndex;
}
SIMD_FORCE_INLINE void setEscapeIndex(int index)
{
m_escapeIndexOrDataIndex = -index;
}
SIMD_FORCE_INLINE int getDataIndex() const
{
//btAssert(m_escapeIndexOrDataIndex >= 0);
return m_escapeIndexOrDataIndex;
}
SIMD_FORCE_INLINE void setDataIndex(int index)
{
m_escapeIndexOrDataIndex = index;
}
};
#endif // GIM_BOXPRUNING_H_INCLUDED

View File

@@ -26,73 +26,7 @@ subject to the following restrictions:
#include "btGImpactBvh.h"
#include "btQuantization.h"
///btQuantizedBvhNode is a compressed aabb node, 16 bytes.
///Node can be used for leafnode or internal node. Leafnodes can point to 32-bit triangle index (non-negative range).
ATTRIBUTE_ALIGNED16 (struct) BT_QUANTIZED_BVH_NODE
{
//12 bytes
unsigned short int m_quantizedAabbMin[3];
unsigned short int m_quantizedAabbMax[3];
//4 bytes
int m_escapeIndexOrDataIndex;
BT_QUANTIZED_BVH_NODE()
{
m_escapeIndexOrDataIndex = 0;
}
SIMD_FORCE_INLINE bool isLeafNode() const
{
//skipindex is negative (internal node), triangleindex >=0 (leafnode)
return (m_escapeIndexOrDataIndex>=0);
}
SIMD_FORCE_INLINE int getEscapeIndex() const
{
//btAssert(m_escapeIndexOrDataIndex < 0);
return -m_escapeIndexOrDataIndex;
}
SIMD_FORCE_INLINE void setEscapeIndex(int index)
{
m_escapeIndexOrDataIndex = -index;
}
SIMD_FORCE_INLINE int getDataIndex() const
{
//btAssert(m_escapeIndexOrDataIndex >= 0);
return m_escapeIndexOrDataIndex;
}
SIMD_FORCE_INLINE void setDataIndex(int index)
{
m_escapeIndexOrDataIndex = index;
}
SIMD_FORCE_INLINE bool testQuantizedBoxOverlapp(
unsigned short * quantizedMin,unsigned short * quantizedMax) const
{
if(m_quantizedAabbMin[0] > quantizedMax[0] ||
m_quantizedAabbMax[0] < quantizedMin[0] ||
m_quantizedAabbMin[1] > quantizedMax[1] ||
m_quantizedAabbMax[1] < quantizedMin[1] ||
m_quantizedAabbMin[2] > quantizedMax[2] ||
m_quantizedAabbMax[2] < quantizedMin[2])
{
return false;
}
return true;
}
};
#include "btGImpactQuantizedBvhSructs.h"
class GIM_QUANTIZED_BVH_NODE_ARRAY:public btAlignedObjectArray<BT_QUANTIZED_BVH_NODE>
{
@@ -368,5 +302,4 @@ public:
btPairSet & collision_pairs);
};
#endif // GIM_BOXPRUNING_H_INCLUDED

View File

@@ -0,0 +1,124 @@
#ifndef GIM_QUANTIZED_SET_STRUCTS_H_INCLUDED
#define GIM_QUANTIZED_SET_STRUCTS_H_INCLUDED
/*! \file btGImpactQuantizedBvh.h
\author Francisco Leon Najera
*/
/*
This source file is part of GIMPACT Library.
For the latest info, see http://gimpact.sourceforge.net/
Copyright (c) 2007 Francisco Leon Najera. C.C. 80087371.
email: projectileman@yahoo.com
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.
*/
#include "btGImpactBvh.h"
#include "btQuantization.h"
///btQuantizedBvhNode is a compressed aabb node, 16 bytes.
///Node can be used for leafnode or internal node. Leafnodes can point to 32-bit triangle index (non-negative range).
ATTRIBUTE_ALIGNED16 (struct) BT_QUANTIZED_BVH_NODE
{
//12 bytes
unsigned short int m_quantizedAabbMin[3];
unsigned short int m_quantizedAabbMax[3];
//4 bytes
int m_escapeIndexOrDataIndex;
bool operator<(const BT_QUANTIZED_BVH_NODE& obj) const {
return
m_quantizedAabbMin[0] < obj.m_quantizedAabbMin[0] &&
m_quantizedAabbMin[1] < obj.m_quantizedAabbMin[1] &&
m_quantizedAabbMin[2] < obj.m_quantizedAabbMin[2] &&
m_quantizedAabbMax[0] < obj.m_quantizedAabbMax[0] &&
m_quantizedAabbMax[1] < obj.m_quantizedAabbMax[1] &&
m_quantizedAabbMax[2] < obj.m_quantizedAabbMax[2] &&
m_escapeIndexOrDataIndex < obj.m_escapeIndexOrDataIndex;
}
bool operator>(const BT_QUANTIZED_BVH_NODE& obj) const {
return
m_quantizedAabbMin[0] > obj.m_quantizedAabbMin[0] &&
m_quantizedAabbMin[1] > obj.m_quantizedAabbMin[1] &&
m_quantizedAabbMin[2] > obj.m_quantizedAabbMin[2] &&
m_quantizedAabbMax[0] > obj.m_quantizedAabbMax[0] &&
m_quantizedAabbMax[1] > obj.m_quantizedAabbMax[1] &&
m_quantizedAabbMax[2] > obj.m_quantizedAabbMax[2] &&
m_escapeIndexOrDataIndex > obj.m_escapeIndexOrDataIndex;
}
bool operator==(const BT_QUANTIZED_BVH_NODE& obj) const {
return
m_quantizedAabbMin[0] == obj.m_quantizedAabbMin[0] &&
m_quantizedAabbMin[1] == obj.m_quantizedAabbMin[1] &&
m_quantizedAabbMin[2] == obj.m_quantizedAabbMin[2] &&
m_quantizedAabbMax[0] == obj.m_quantizedAabbMax[0] &&
m_quantizedAabbMax[1] == obj.m_quantizedAabbMax[1] &&
m_quantizedAabbMax[2] == obj.m_quantizedAabbMax[2] &&
m_escapeIndexOrDataIndex == obj.m_escapeIndexOrDataIndex;
}
BT_QUANTIZED_BVH_NODE()
{
m_escapeIndexOrDataIndex = 0;
}
SIMD_FORCE_INLINE bool isLeafNode() const
{
//skipindex is negative (internal node), triangleindex >=0 (leafnode)
return (m_escapeIndexOrDataIndex>=0);
}
SIMD_FORCE_INLINE int getEscapeIndex() const
{
//btAssert(m_escapeIndexOrDataIndex < 0);
return -m_escapeIndexOrDataIndex;
}
SIMD_FORCE_INLINE void setEscapeIndex(int index)
{
m_escapeIndexOrDataIndex = -index;
}
SIMD_FORCE_INLINE int getDataIndex() const
{
//btAssert(m_escapeIndexOrDataIndex >= 0);
return m_escapeIndexOrDataIndex;
}
SIMD_FORCE_INLINE void setDataIndex(int index)
{
m_escapeIndexOrDataIndex = index;
}
SIMD_FORCE_INLINE bool testQuantizedBoxOverlapp(
unsigned short * quantizedMin,unsigned short * quantizedMax) const
{
if(m_quantizedAabbMin[0] > quantizedMax[0] ||
m_quantizedAabbMax[0] < quantizedMin[0] ||
m_quantizedAabbMin[1] > quantizedMax[1] ||
m_quantizedAabbMax[1] < quantizedMin[1] ||
m_quantizedAabbMin[2] > quantizedMax[2] ||
m_quantizedAabbMax[2] < quantizedMin[2])
{
return false;
}
return true;
}
};
#endif // GIM_QUANTIZED_SET_STRUCTS_H_INCLUDED

View File

@@ -228,7 +228,7 @@ public:
inline void push_back_memcpy(const T & obj)
{
this->growingCheck();
irr_simd_memcpy(&m_data[m_size],&obj,sizeof(T));
gim_simd_memcpy(&m_data[m_size],&obj,sizeof(T));
m_size++;
}

View File

@@ -41,10 +41,13 @@ email: projectileman@yahoo.com
#ifndef PLANEDIREPSILON
#define PLANEDIREPSILON 0.0000001f
#define PARALELENORMALS 0.000001f
#endif
#ifndef PARALELENORMALS
#define PARALELENORMALS 0.000001f
#endif
#define TRIANGLE_NORMAL(v1,v2,v3,n)\
{\

View File

@@ -97,6 +97,8 @@ email: projectileman@yahoo.com
// return test_cross_edge_box(edge,absolute_edge,pointa,pointb,extend,1,0,0,1);
//}
#ifndef TEST_CROSS_EDGE_BOX_MCR
#define TEST_CROSS_EDGE_BOX_MCR(edge,absolute_edge,pointa,pointb,_extend,i_dir_0,i_dir_1,i_comp_0,i_comp_1)\
{\
const btScalar dir0 = -edge[i_dir_0];\
@@ -113,6 +115,7 @@ email: projectileman@yahoo.com
if(pmin>rad || -rad>pmax) return false;\
}\
#endif
#define TEST_CROSS_EDGE_BOX_X_AXIS_MCR(edge,absolute_edge,pointa,pointb,_extend)\
{\
@@ -190,8 +193,9 @@ public:
}
};
#ifndef BOX_PLANE_EPSILON
#define BOX_PLANE_EPSILON 0.000001f
#endif
//! Axis aligned box
class GIM_AABB
@@ -571,7 +575,7 @@ public:
}
};
#ifndef BT_BOX_COLLISION_H_INCLUDED
//! Compairison of transformation objects
SIMD_FORCE_INLINE bool btCompareTransformsEqual(const btTransform & t1,const btTransform & t2)
{
@@ -582,6 +586,7 @@ SIMD_FORCE_INLINE bool btCompareTransformsEqual(const btTransform & t1,const btT
if(!(t1.getBasis().getRow(2) == t2.getBasis().getRow(2)) ) return false;
return true;
}
#endif

View File

@@ -40,8 +40,15 @@ email: projectileman@yahoo.com
/**
Configuration var for applying interpolation of contact normals
*/
#ifndef NORMAL_CONTACT_AVERAGE
#define NORMAL_CONTACT_AVERAGE 1
#endif
#ifndef CONTACT_DIFF_EPSILON
#define CONTACT_DIFF_EPSILON 0.00001f
#endif
#ifndef BT_CONTACT_H_STRUCTS_INCLUDED
/// Structure for collision results
///Functions for managing and sorting contacts resulting from a collision query.
@@ -121,6 +128,7 @@ public:
};
#endif
class gim_contact_array:public gim_array<GIM_CONTACT>
{

View File

@@ -38,8 +38,9 @@ email: projectileman@yahoo.com
#ifndef MAX_TRI_CLIPPING
#define MAX_TRI_CLIPPING 16
#endif
//! Structure for collision
struct GIM_TRIANGLE_CONTACT_DATA

View File

@@ -67,10 +67,12 @@ struct btStorageResult : public btDiscreteCollisionDetectorInterface::Result
btVector3 m_closestPointInB;
btScalar m_distance; //negative means penetration !
protected:
btStorageResult() : m_distance(btScalar(BT_LARGE_FLOAT))
{
}
public:
virtual ~btStorageResult() {};
virtual void addContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,btScalar depth)

View File

@@ -21,6 +21,8 @@ subject to the following restrictions:
btScalar gContactBreakingThreshold = btScalar(0.02);
ContactDestroyedCallback gContactDestroyedCallback = 0;
ContactProcessedCallback gContactProcessedCallback = 0;
ContactStartedCallback gContactStartedCallback = 0;
ContactEndedCallback gContactEndedCallback = 0;
///gContactCalcArea3Points will approximate the convex hull area using 3 points
///when setting it to false, it will use 4 points to compute the area: it is more accurate but slower
bool gContactCalcArea3Points = true;

View File

@@ -28,10 +28,18 @@ struct btCollisionResult;
///maximum contact breaking and merging threshold
extern btScalar gContactBreakingThreshold;
#ifndef SWIG
class btPersistentManifold;
typedef bool (*ContactDestroyedCallback)(void* userPersistentData);
typedef bool (*ContactProcessedCallback)(btManifoldPoint& cp,void* body0,void* body1);
typedef void (*ContactStartedCallback)(btPersistentManifold* const &manifold);
typedef void (*ContactEndedCallback)(btPersistentManifold* const &manifold);
extern ContactDestroyedCallback gContactDestroyedCallback;
extern ContactProcessedCallback gContactProcessedCallback;
extern ContactStartedCallback gContactStartedCallback;
extern ContactEndedCallback gContactEndedCallback;
#endif //SWIG
//the enum starts at 1024 to avoid type conflicts with btTypedConstraint
enum btContactManifoldTypes
@@ -171,6 +179,11 @@ public:
btAssert(m_pointCache[lastUsedIndex].m_userPersistentData==0);
m_cachedPoints--;
if (gContactEndedCallback && m_cachedPoints == 0)
{
gContactEndedCallback(this);
}
}
void replaceContactPoint(const btManifoldPoint& newPoint,int insertIndex)
{
@@ -220,6 +233,11 @@ public:
{
clearUserCache(m_pointCache[i]);
}
if (gContactEndedCallback && m_cachedPoints)
{
gContactEndedCallback(this);
}
m_cachedPoints = 0;
}

View File

@@ -28,11 +28,13 @@ protected:
btPersistentManifold m_contactManifold;
public:
protected:
btContactConstraint(btPersistentManifold* contactManifold,btRigidBody& rbA,btRigidBody& rbB);
public:
void setContactManifold(btPersistentManifold* contactManifold);
btPersistentManifold* getContactManifold()

View File

@@ -19,7 +19,7 @@ class btDynamicsWorld;
#include "btWheelInfo.h"
#include "BulletDynamics/Dynamics/btActionInterface.h"
class btVehicleTuning;
//class btVehicleTuning;
///rayCast vehicle, very special constraint that turn a rigidbody into a vehicle.
class btRaycastVehicle : public btActionInterface

View File

@@ -79,6 +79,8 @@ struct btWheelInfo
void* m_clientInfo;//can be used to store pointer to sync transforms...
btWheelInfo() {}
btWheelInfo(btWheelInfoConstructionInfo& ci)
{

View File

@@ -78,7 +78,7 @@ struct idArray {
typedef b3AlignedObjectArray<T> type;
};
typedef int idArrayIdx;
#define ID_DECLARE_ALIGNED_ALLOCATOR B3_DECLARE_ALIGNED_ALLOCATOR
#define ID_DECLARE_ALIGNED_ALLOCATOR() B3_DECLARE_ALIGNED_ALLOCATOR()
// use bullet's allocator functions
#define idMalloc btAllocFunc

View File

@@ -617,7 +617,7 @@ public:
RayFromToCaster(const btVector3& rayFrom,const btVector3& rayTo,btScalar mxt);
void Process(const btDbvtNode* leaf);
static inline btScalar rayFromToTriangle(const btVector3& rayFrom,
static /*inline*/ btScalar rayFromToTriangle(const btVector3& rayFrom,
const btVector3& rayTo,
const btVector3& rayNormalizedDirection,
const btVector3& a,

View File

@@ -20,7 +20,9 @@ subject to the following restrictions:
#include "BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.h"
#include "BulletSoftBody/btSoftBody.h"
#ifndef BT_SOFT_RIGID_DYNAMICS_WORLD_H
typedef btAlignedObjectArray<btSoftBody*> btSoftBodyArray;
#endif
class btSoftBodySolver;

View File

@@ -65,9 +65,11 @@ btLeaveProfileZoneFunc* btGetCurrentLeaveProfileZoneFunc();
void btSetCustomEnterProfileZoneFunc(btEnterProfileZoneFunc* enterFunc);
void btSetCustomLeaveProfileZoneFunc(btLeaveProfileZoneFunc* leaveFunc);
#ifndef BT_NO_PROFILE // FIX redefinition
//To disable built-in profiling, please comment out next line
//#define BT_NO_PROFILE 1
#endif //BT_NO_PROFILE
#ifndef BT_NO_PROFILE
//btQuickprofGetCurrentThreadIndex will return -1 if thread index cannot be determined,
//otherwise returns thread index in range [0..maxThreads]